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.

23641 lines
628KB

  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{framesync}
  252. @chapter Options for filters with several inputs (framesync)
  253. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  254. Some filters with several inputs support a common set of options.
  255. These options can only be set by name, not with the short notation.
  256. @table @option
  257. @item eof_action
  258. The action to take when EOF is encountered on the secondary input; it accepts
  259. one of the following values:
  260. @table @option
  261. @item repeat
  262. Repeat the last frame (the default).
  263. @item endall
  264. End both streams.
  265. @item pass
  266. Pass the main input through.
  267. @end table
  268. @item shortest
  269. If set to 1, force the output to terminate when the shortest input
  270. terminates. Default value is 0.
  271. @item repeatlast
  272. If set to 1, force the filter to extend the last frame of secondary streams
  273. until the end of the primary stream. A value of 0 disables this behavior.
  274. Default value is 1.
  275. @end table
  276. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  277. @chapter Audio Filters
  278. @c man begin AUDIO FILTERS
  279. When you configure your FFmpeg build, you can disable any of the
  280. existing filters using @code{--disable-filters}.
  281. The configure output will show the audio filters included in your
  282. build.
  283. Below is a description of the currently available audio filters.
  284. @section acompressor
  285. A compressor is mainly used to reduce the dynamic range of a signal.
  286. Especially modern music is mostly compressed at a high ratio to
  287. improve the overall loudness. It's done to get the highest attention
  288. of a listener, "fatten" the sound and bring more "power" to the track.
  289. If a signal is compressed too much it may sound dull or "dead"
  290. afterwards or it may start to "pump" (which could be a powerful effect
  291. but can also destroy a track completely).
  292. The right compression is the key to reach a professional sound and is
  293. the high art of mixing and mastering. Because of its complex settings
  294. it may take a long time to get the right feeling for this kind of effect.
  295. Compression is done by detecting the volume above a chosen level
  296. @code{threshold} and dividing it by the factor set with @code{ratio}.
  297. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  298. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  299. the signal would cause distortion of the waveform the reduction can be
  300. levelled over the time. This is done by setting "Attack" and "Release".
  301. @code{attack} determines how long the signal has to rise above the threshold
  302. before any reduction will occur and @code{release} sets the time the signal
  303. has to fall below the threshold to reduce the reduction again. Shorter signals
  304. than the chosen attack time will be left untouched.
  305. The overall reduction of the signal can be made up afterwards with the
  306. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  307. raising the makeup to this level results in a signal twice as loud than the
  308. source. To gain a softer entry in the compression the @code{knee} flattens the
  309. hard edge at the threshold in the range of the chosen decibels.
  310. The filter accepts the following options:
  311. @table @option
  312. @item level_in
  313. Set input gain. Default is 1. Range is between 0.015625 and 64.
  314. @item mode
  315. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  316. Default is @code{downward}.
  317. @item threshold
  318. If a signal of stream rises above this level it will affect the gain
  319. reduction.
  320. By default it is 0.125. Range is between 0.00097563 and 1.
  321. @item ratio
  322. Set a ratio by which the signal is reduced. 1:2 means that if the level
  323. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  324. Default is 2. Range is between 1 and 20.
  325. @item attack
  326. Amount of milliseconds the signal has to rise above the threshold before gain
  327. reduction starts. Default is 20. Range is between 0.01 and 2000.
  328. @item release
  329. Amount of milliseconds the signal has to fall below the threshold before
  330. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  331. @item makeup
  332. Set the amount by how much signal will be amplified after processing.
  333. Default is 1. Range is from 1 to 64.
  334. @item knee
  335. Curve the sharp knee around the threshold to enter gain reduction more softly.
  336. Default is 2.82843. Range is between 1 and 8.
  337. @item link
  338. Choose if the @code{average} level between all channels of input stream
  339. or the louder(@code{maximum}) channel of input stream affects the
  340. reduction. Default is @code{average}.
  341. @item detection
  342. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  343. of @code{rms}. Default is @code{rms} which is mostly smoother.
  344. @item mix
  345. How much to use compressed signal in output. Default is 1.
  346. Range is between 0 and 1.
  347. @end table
  348. @section acontrast
  349. Simple audio dynamic range compression/expansion filter.
  350. The filter accepts the following options:
  351. @table @option
  352. @item contrast
  353. Set contrast. Default is 33. Allowed range is between 0 and 100.
  354. @end table
  355. @section acopy
  356. Copy the input audio source unchanged to the output. This is mainly useful for
  357. testing purposes.
  358. @section acrossfade
  359. Apply cross fade from one input audio stream to another input audio stream.
  360. The cross fade is applied for specified duration near the end of first stream.
  361. The filter accepts the following options:
  362. @table @option
  363. @item nb_samples, ns
  364. Specify the number of samples for which the cross fade effect has to last.
  365. At the end of the cross fade effect the first input audio will be completely
  366. silent. Default is 44100.
  367. @item duration, d
  368. Specify the duration of the cross fade effect. See
  369. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  370. for the accepted syntax.
  371. By default the duration is determined by @var{nb_samples}.
  372. If set this option is used instead of @var{nb_samples}.
  373. @item overlap, o
  374. Should first stream end overlap with second stream start. Default is enabled.
  375. @item curve1
  376. Set curve for cross fade transition for first stream.
  377. @item curve2
  378. Set curve for cross fade transition for second stream.
  379. For description of available curve types see @ref{afade} filter description.
  380. @end table
  381. @subsection Examples
  382. @itemize
  383. @item
  384. Cross fade from one input to another:
  385. @example
  386. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  387. @end example
  388. @item
  389. Cross fade from one input to another but without overlapping:
  390. @example
  391. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  392. @end example
  393. @end itemize
  394. @section acrossover
  395. Split audio stream into several bands.
  396. This filter splits audio stream into two or more frequency ranges.
  397. Summing all streams back will give flat output.
  398. The filter accepts the following options:
  399. @table @option
  400. @item split
  401. Set split frequencies. Those must be positive and increasing.
  402. @item order
  403. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  404. Default is @var{4th}.
  405. @end table
  406. @section acrusher
  407. Reduce audio bit resolution.
  408. This filter is bit crusher with enhanced functionality. A bit crusher
  409. is used to audibly reduce number of bits an audio signal is sampled
  410. with. This doesn't change the bit depth at all, it just produces the
  411. effect. Material reduced in bit depth sounds more harsh and "digital".
  412. This filter is able to even round to continuous values instead of discrete
  413. bit depths.
  414. Additionally it has a D/C offset which results in different crushing of
  415. the lower and the upper half of the signal.
  416. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  417. Another feature of this filter is the logarithmic mode.
  418. This setting switches from linear distances between bits to logarithmic ones.
  419. The result is a much more "natural" sounding crusher which doesn't gate low
  420. signals for example. The human ear has a logarithmic perception,
  421. so this kind of crushing is much more pleasant.
  422. Logarithmic crushing is also able to get anti-aliased.
  423. The filter accepts the following options:
  424. @table @option
  425. @item level_in
  426. Set level in.
  427. @item level_out
  428. Set level out.
  429. @item bits
  430. Set bit reduction.
  431. @item mix
  432. Set mixing amount.
  433. @item mode
  434. Can be linear: @code{lin} or logarithmic: @code{log}.
  435. @item dc
  436. Set DC.
  437. @item aa
  438. Set anti-aliasing.
  439. @item samples
  440. Set sample reduction.
  441. @item lfo
  442. Enable LFO. By default disabled.
  443. @item lforange
  444. Set LFO range.
  445. @item lforate
  446. Set LFO rate.
  447. @end table
  448. @section acue
  449. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  450. filter.
  451. @section adeclick
  452. Remove impulsive noise from input audio.
  453. Samples detected as impulsive noise are replaced by interpolated samples using
  454. autoregressive modelling.
  455. @table @option
  456. @item w
  457. Set window size, in milliseconds. Allowed range is from @code{10} to
  458. @code{100}. Default value is @code{55} milliseconds.
  459. This sets size of window which will be processed at once.
  460. @item o
  461. Set window overlap, in percentage of window size. Allowed range is from
  462. @code{50} to @code{95}. Default value is @code{75} percent.
  463. Setting this to a very high value increases impulsive noise removal but makes
  464. whole process much slower.
  465. @item a
  466. Set autoregression order, in percentage of window size. Allowed range is from
  467. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  468. controls quality of interpolated samples using neighbour good samples.
  469. @item t
  470. Set threshold value. Allowed range is from @code{1} to @code{100}.
  471. Default value is @code{2}.
  472. This controls the strength of impulsive noise which is going to be removed.
  473. The lower value, the more samples will be detected as impulsive noise.
  474. @item b
  475. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  476. @code{10}. Default value is @code{2}.
  477. If any two samples detected as noise are spaced less than this value then any
  478. sample between those two samples will be also detected as noise.
  479. @item m
  480. Set overlap method.
  481. It accepts the following values:
  482. @table @option
  483. @item a
  484. Select overlap-add method. Even not interpolated samples are slightly
  485. changed with this method.
  486. @item s
  487. Select overlap-save method. Not interpolated samples remain unchanged.
  488. @end table
  489. Default value is @code{a}.
  490. @end table
  491. @section adeclip
  492. Remove clipped samples from input audio.
  493. Samples detected as clipped are replaced by interpolated samples using
  494. autoregressive modelling.
  495. @table @option
  496. @item w
  497. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  498. Default value is @code{55} milliseconds.
  499. This sets size of window which will be processed at once.
  500. @item o
  501. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  502. to @code{95}. Default value is @code{75} percent.
  503. @item a
  504. Set autoregression order, in percentage of window size. Allowed range is from
  505. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  506. quality of interpolated samples using neighbour good samples.
  507. @item t
  508. Set threshold value. Allowed range is from @code{1} to @code{100}.
  509. Default value is @code{10}. Higher values make clip detection less aggressive.
  510. @item n
  511. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  512. Default value is @code{1000}. Higher values make clip detection less aggressive.
  513. @item m
  514. Set overlap method.
  515. It accepts the following values:
  516. @table @option
  517. @item a
  518. Select overlap-add method. Even not interpolated samples are slightly changed
  519. with this method.
  520. @item s
  521. Select overlap-save method. Not interpolated samples remain unchanged.
  522. @end table
  523. Default value is @code{a}.
  524. @end table
  525. @section adelay
  526. Delay one or more audio channels.
  527. Samples in delayed channel are filled with silence.
  528. The filter accepts the following option:
  529. @table @option
  530. @item delays
  531. Set list of delays in milliseconds for each channel separated by '|'.
  532. Unused delays will be silently ignored. If number of given delays is
  533. smaller than number of channels all remaining channels will not be delayed.
  534. If you want to delay exact number of samples, append 'S' to number.
  535. If you want instead to delay in seconds, append 's' to number.
  536. @end table
  537. @subsection Examples
  538. @itemize
  539. @item
  540. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  541. the second channel (and any other channels that may be present) unchanged.
  542. @example
  543. adelay=1500|0|500
  544. @end example
  545. @item
  546. Delay second channel by 500 samples, the third channel by 700 samples and leave
  547. the first channel (and any other channels that may be present) unchanged.
  548. @example
  549. adelay=0|500S|700S
  550. @end example
  551. @end itemize
  552. @section aderivative, aintegral
  553. Compute derivative/integral of audio stream.
  554. Applying both filters one after another produces original audio.
  555. @section aecho
  556. Apply echoing to the input audio.
  557. Echoes are reflected sound and can occur naturally amongst mountains
  558. (and sometimes large buildings) when talking or shouting; digital echo
  559. effects emulate this behaviour and are often used to help fill out the
  560. sound of a single instrument or vocal. The time difference between the
  561. original signal and the reflection is the @code{delay}, and the
  562. loudness of the reflected signal is the @code{decay}.
  563. Multiple echoes can have different delays and decays.
  564. A description of the accepted parameters follows.
  565. @table @option
  566. @item in_gain
  567. Set input gain of reflected signal. Default is @code{0.6}.
  568. @item out_gain
  569. Set output gain of reflected signal. Default is @code{0.3}.
  570. @item delays
  571. Set list of time intervals in milliseconds between original signal and reflections
  572. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  573. Default is @code{1000}.
  574. @item decays
  575. Set list of loudness of reflected signals separated by '|'.
  576. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  577. Default is @code{0.5}.
  578. @end table
  579. @subsection Examples
  580. @itemize
  581. @item
  582. Make it sound as if there are twice as many instruments as are actually playing:
  583. @example
  584. aecho=0.8:0.88:60:0.4
  585. @end example
  586. @item
  587. If delay is very short, then it sound like a (metallic) robot playing music:
  588. @example
  589. aecho=0.8:0.88:6:0.4
  590. @end example
  591. @item
  592. A longer delay will sound like an open air concert in the mountains:
  593. @example
  594. aecho=0.8:0.9:1000:0.3
  595. @end example
  596. @item
  597. Same as above but with one more mountain:
  598. @example
  599. aecho=0.8:0.9:1000|1800:0.3|0.25
  600. @end example
  601. @end itemize
  602. @section aemphasis
  603. Audio emphasis filter creates or restores material directly taken from LPs or
  604. emphased CDs with different filter curves. E.g. to store music on vinyl the
  605. signal has to be altered by a filter first to even out the disadvantages of
  606. this recording medium.
  607. Once the material is played back the inverse filter has to be applied to
  608. restore the distortion of the frequency response.
  609. The filter accepts the following options:
  610. @table @option
  611. @item level_in
  612. Set input gain.
  613. @item level_out
  614. Set output gain.
  615. @item mode
  616. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  617. use @code{production} mode. Default is @code{reproduction} mode.
  618. @item type
  619. Set filter type. Selects medium. Can be one of the following:
  620. @table @option
  621. @item col
  622. select Columbia.
  623. @item emi
  624. select EMI.
  625. @item bsi
  626. select BSI (78RPM).
  627. @item riaa
  628. select RIAA.
  629. @item cd
  630. select Compact Disc (CD).
  631. @item 50fm
  632. select 50µs (FM).
  633. @item 75fm
  634. select 75µs (FM).
  635. @item 50kf
  636. select 50µs (FM-KF).
  637. @item 75kf
  638. select 75µs (FM-KF).
  639. @end table
  640. @end table
  641. @section aeval
  642. Modify an audio signal according to the specified expressions.
  643. This filter accepts one or more expressions (one for each channel),
  644. which are evaluated and used to modify a corresponding audio signal.
  645. It accepts the following parameters:
  646. @table @option
  647. @item exprs
  648. Set the '|'-separated expressions list for each separate channel. If
  649. the number of input channels is greater than the number of
  650. expressions, the last specified expression is used for the remaining
  651. output channels.
  652. @item channel_layout, c
  653. Set output channel layout. If not specified, the channel layout is
  654. specified by the number of expressions. If set to @samp{same}, it will
  655. use by default the same input channel layout.
  656. @end table
  657. Each expression in @var{exprs} can contain the following constants and functions:
  658. @table @option
  659. @item ch
  660. channel number of the current expression
  661. @item n
  662. number of the evaluated sample, starting from 0
  663. @item s
  664. sample rate
  665. @item t
  666. time of the evaluated sample expressed in seconds
  667. @item nb_in_channels
  668. @item nb_out_channels
  669. input and output number of channels
  670. @item val(CH)
  671. the value of input channel with number @var{CH}
  672. @end table
  673. Note: this filter is slow. For faster processing you should use a
  674. dedicated filter.
  675. @subsection Examples
  676. @itemize
  677. @item
  678. Half volume:
  679. @example
  680. aeval=val(ch)/2:c=same
  681. @end example
  682. @item
  683. Invert phase of the second channel:
  684. @example
  685. aeval=val(0)|-val(1)
  686. @end example
  687. @end itemize
  688. @anchor{afade}
  689. @section afade
  690. Apply fade-in/out effect to input audio.
  691. A description of the accepted parameters follows.
  692. @table @option
  693. @item type, t
  694. Specify the effect type, can be either @code{in} for fade-in, or
  695. @code{out} for a fade-out effect. Default is @code{in}.
  696. @item start_sample, ss
  697. Specify the number of the start sample for starting to apply the fade
  698. effect. Default is 0.
  699. @item nb_samples, ns
  700. Specify the number of samples for which the fade effect has to last. At
  701. the end of the fade-in effect the output audio will have the same
  702. volume as the input audio, at the end of the fade-out transition
  703. the output audio will be silence. Default is 44100.
  704. @item start_time, st
  705. Specify the start time of the fade effect. Default is 0.
  706. The value must be specified as a time duration; see
  707. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  708. for the accepted syntax.
  709. If set this option is used instead of @var{start_sample}.
  710. @item duration, d
  711. Specify the duration of the fade effect. See
  712. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  713. for the accepted syntax.
  714. At the end of the fade-in effect the output audio will have the same
  715. volume as the input audio, at the end of the fade-out transition
  716. the output audio will be silence.
  717. By default the duration is determined by @var{nb_samples}.
  718. If set this option is used instead of @var{nb_samples}.
  719. @item curve
  720. Set curve for fade transition.
  721. It accepts the following values:
  722. @table @option
  723. @item tri
  724. select triangular, linear slope (default)
  725. @item qsin
  726. select quarter of sine wave
  727. @item hsin
  728. select half of sine wave
  729. @item esin
  730. select exponential sine wave
  731. @item log
  732. select logarithmic
  733. @item ipar
  734. select inverted parabola
  735. @item qua
  736. select quadratic
  737. @item cub
  738. select cubic
  739. @item squ
  740. select square root
  741. @item cbr
  742. select cubic root
  743. @item par
  744. select parabola
  745. @item exp
  746. select exponential
  747. @item iqsin
  748. select inverted quarter of sine wave
  749. @item ihsin
  750. select inverted half of sine wave
  751. @item dese
  752. select double-exponential seat
  753. @item desi
  754. select double-exponential sigmoid
  755. @item losi
  756. select logistic sigmoid
  757. @item nofade
  758. no fade applied
  759. @end table
  760. @end table
  761. @subsection Examples
  762. @itemize
  763. @item
  764. Fade in first 15 seconds of audio:
  765. @example
  766. afade=t=in:ss=0:d=15
  767. @end example
  768. @item
  769. Fade out last 25 seconds of a 900 seconds audio:
  770. @example
  771. afade=t=out:st=875:d=25
  772. @end example
  773. @end itemize
  774. @section afftdn
  775. Denoise audio samples with FFT.
  776. A description of the accepted parameters follows.
  777. @table @option
  778. @item nr
  779. Set the noise reduction in dB, allowed range is 0.01 to 97.
  780. Default value is 12 dB.
  781. @item nf
  782. Set the noise floor in dB, allowed range is -80 to -20.
  783. Default value is -50 dB.
  784. @item nt
  785. Set the noise type.
  786. It accepts the following values:
  787. @table @option
  788. @item w
  789. Select white noise.
  790. @item v
  791. Select vinyl noise.
  792. @item s
  793. Select shellac noise.
  794. @item c
  795. Select custom noise, defined in @code{bn} option.
  796. Default value is white noise.
  797. @end table
  798. @item bn
  799. Set custom band noise for every one of 15 bands.
  800. Bands are separated by ' ' or '|'.
  801. @item rf
  802. Set the residual floor in dB, allowed range is -80 to -20.
  803. Default value is -38 dB.
  804. @item tn
  805. Enable noise tracking. By default is disabled.
  806. With this enabled, noise floor is automatically adjusted.
  807. @item tr
  808. Enable residual tracking. By default is disabled.
  809. @item om
  810. Set the output mode.
  811. It accepts the following values:
  812. @table @option
  813. @item i
  814. Pass input unchanged.
  815. @item o
  816. Pass noise filtered out.
  817. @item n
  818. Pass only noise.
  819. Default value is @var{o}.
  820. @end table
  821. @end table
  822. @subsection Commands
  823. This filter supports the following commands:
  824. @table @option
  825. @item sample_noise, sn
  826. Start or stop measuring noise profile.
  827. Syntax for the command is : "start" or "stop" string.
  828. After measuring noise profile is stopped it will be
  829. automatically applied in filtering.
  830. @item noise_reduction, nr
  831. Change noise reduction. Argument is single float number.
  832. Syntax for the command is : "@var{noise_reduction}"
  833. @item noise_floor, nf
  834. Change noise floor. Argument is single float number.
  835. Syntax for the command is : "@var{noise_floor}"
  836. @item output_mode, om
  837. Change output mode operation.
  838. Syntax for the command is : "i", "o" or "n" string.
  839. @end table
  840. @section afftfilt
  841. Apply arbitrary expressions to samples in frequency domain.
  842. @table @option
  843. @item real
  844. Set frequency domain real expression for each separate channel separated
  845. by '|'. Default is "re".
  846. If the number of input channels is greater than the number of
  847. expressions, the last specified expression is used for the remaining
  848. output channels.
  849. @item imag
  850. Set frequency domain imaginary expression for each separate channel
  851. separated by '|'. Default is "im".
  852. Each expression in @var{real} and @var{imag} can contain the following
  853. constants and functions:
  854. @table @option
  855. @item sr
  856. sample rate
  857. @item b
  858. current frequency bin number
  859. @item nb
  860. number of available bins
  861. @item ch
  862. channel number of the current expression
  863. @item chs
  864. number of channels
  865. @item pts
  866. current frame pts
  867. @item re
  868. current real part of frequency bin of current channel
  869. @item im
  870. current imaginary part of frequency bin of current channel
  871. @item real(b, ch)
  872. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  873. @item imag(b, ch)
  874. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  875. @end table
  876. @item win_size
  877. Set window size. Allowed range is from 16 to 131072.
  878. Default is @code{4096}
  879. @item win_func
  880. Set window function. Default is @code{hann}.
  881. @item overlap
  882. Set window overlap. If set to 1, the recommended overlap for selected
  883. window function will be picked. Default is @code{0.75}.
  884. @end table
  885. @subsection Examples
  886. @itemize
  887. @item
  888. Leave almost only low frequencies in audio:
  889. @example
  890. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  891. @end example
  892. @end itemize
  893. @anchor{afir}
  894. @section afir
  895. Apply an arbitrary Frequency Impulse Response filter.
  896. This filter is designed for applying long FIR filters,
  897. up to 60 seconds long.
  898. It can be used as component for digital crossover filters,
  899. room equalization, cross talk cancellation, wavefield synthesis,
  900. auralization, ambiophonics, ambisonics and spatialization.
  901. This filter uses second stream as FIR coefficients.
  902. If second stream holds single channel, it will be used
  903. for all input channels in first stream, otherwise
  904. number of channels in second stream must be same as
  905. number of channels in first stream.
  906. It accepts the following parameters:
  907. @table @option
  908. @item dry
  909. Set dry gain. This sets input gain.
  910. @item wet
  911. Set wet gain. This sets final output gain.
  912. @item length
  913. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  914. @item gtype
  915. Enable applying gain measured from power of IR.
  916. Set which approach to use for auto gain measurement.
  917. @table @option
  918. @item none
  919. Do not apply any gain.
  920. @item peak
  921. select peak gain, very conservative approach. This is default value.
  922. @item dc
  923. select DC gain, limited application.
  924. @item gn
  925. select gain to noise approach, this is most popular one.
  926. @end table
  927. @item irgain
  928. Set gain to be applied to IR coefficients before filtering.
  929. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  930. @item irfmt
  931. Set format of IR stream. Can be @code{mono} or @code{input}.
  932. Default is @code{input}.
  933. @item maxir
  934. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  935. Allowed range is 0.1 to 60 seconds.
  936. @item response
  937. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  938. By default it is disabled.
  939. @item channel
  940. Set for which IR channel to display frequency response. By default is first channel
  941. displayed. This option is used only when @var{response} is enabled.
  942. @item size
  943. Set video stream size. This option is used only when @var{response} is enabled.
  944. @item rate
  945. Set video stream frame rate. This option is used only when @var{response} is enabled.
  946. @item minp
  947. Set minimal partition size used for convolution. Default is @var{8192}.
  948. Allowed range is from @var{8} to @var{32768}.
  949. Lower values decreases latency at cost of higher CPU usage.
  950. @item maxp
  951. Set maximal partition size used for convolution. Default is @var{8192}.
  952. Allowed range is from @var{8} to @var{32768}.
  953. Lower values may increase CPU usage.
  954. @end table
  955. @subsection Examples
  956. @itemize
  957. @item
  958. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  959. @example
  960. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  961. @end example
  962. @end itemize
  963. @anchor{aformat}
  964. @section aformat
  965. Set output format constraints for the input audio. The framework will
  966. negotiate the most appropriate format to minimize conversions.
  967. It accepts the following parameters:
  968. @table @option
  969. @item sample_fmts
  970. A '|'-separated list of requested sample formats.
  971. @item sample_rates
  972. A '|'-separated list of requested sample rates.
  973. @item channel_layouts
  974. A '|'-separated list of requested channel layouts.
  975. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  976. for the required syntax.
  977. @end table
  978. If a parameter is omitted, all values are allowed.
  979. Force the output to either unsigned 8-bit or signed 16-bit stereo
  980. @example
  981. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  982. @end example
  983. @section agate
  984. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  985. processing reduces disturbing noise between useful signals.
  986. Gating is done by detecting the volume below a chosen level @var{threshold}
  987. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  988. floor is set via @var{range}. Because an exact manipulation of the signal
  989. would cause distortion of the waveform the reduction can be levelled over
  990. time. This is done by setting @var{attack} and @var{release}.
  991. @var{attack} determines how long the signal has to fall below the threshold
  992. before any reduction will occur and @var{release} sets the time the signal
  993. has to rise above the threshold to reduce the reduction again.
  994. Shorter signals than the chosen attack time will be left untouched.
  995. @table @option
  996. @item level_in
  997. Set input level before filtering.
  998. Default is 1. Allowed range is from 0.015625 to 64.
  999. @item mode
  1000. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1001. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1002. will be amplified, expanding dynamic range in upward direction.
  1003. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1004. @item range
  1005. Set the level of gain reduction when the signal is below the threshold.
  1006. Default is 0.06125. Allowed range is from 0 to 1.
  1007. Setting this to 0 disables reduction and then filter behaves like expander.
  1008. @item threshold
  1009. If a signal rises above this level the gain reduction is released.
  1010. Default is 0.125. Allowed range is from 0 to 1.
  1011. @item ratio
  1012. Set a ratio by which the signal is reduced.
  1013. Default is 2. Allowed range is from 1 to 9000.
  1014. @item attack
  1015. Amount of milliseconds the signal has to rise above the threshold before gain
  1016. reduction stops.
  1017. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1018. @item release
  1019. Amount of milliseconds the signal has to fall below the threshold before the
  1020. reduction is increased again. Default is 250 milliseconds.
  1021. Allowed range is from 0.01 to 9000.
  1022. @item makeup
  1023. Set amount of amplification of signal after processing.
  1024. Default is 1. Allowed range is from 1 to 64.
  1025. @item knee
  1026. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1027. Default is 2.828427125. Allowed range is from 1 to 8.
  1028. @item detection
  1029. Choose if exact signal should be taken for detection or an RMS like one.
  1030. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1031. @item link
  1032. Choose if the average level between all channels or the louder channel affects
  1033. the reduction.
  1034. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1035. @end table
  1036. @section aiir
  1037. Apply an arbitrary Infinite Impulse Response filter.
  1038. It accepts the following parameters:
  1039. @table @option
  1040. @item z
  1041. Set numerator/zeros coefficients.
  1042. @item p
  1043. Set denominator/poles coefficients.
  1044. @item k
  1045. Set channels gains.
  1046. @item dry_gain
  1047. Set input gain.
  1048. @item wet_gain
  1049. Set output gain.
  1050. @item f
  1051. Set coefficients format.
  1052. @table @samp
  1053. @item tf
  1054. transfer function
  1055. @item zp
  1056. Z-plane zeros/poles, cartesian (default)
  1057. @item pr
  1058. Z-plane zeros/poles, polar radians
  1059. @item pd
  1060. Z-plane zeros/poles, polar degrees
  1061. @end table
  1062. @item r
  1063. Set kind of processing.
  1064. Can be @code{d} - direct or @code{s} - serial cascading. Default is @code{s}.
  1065. @item e
  1066. Set filtering precision.
  1067. @table @samp
  1068. @item dbl
  1069. double-precision floating-point (default)
  1070. @item flt
  1071. single-precision floating-point
  1072. @item i32
  1073. 32-bit integers
  1074. @item i16
  1075. 16-bit integers
  1076. @end table
  1077. @item mix
  1078. How much to use filtered signal in output. Default is 1.
  1079. Range is between 0 and 1.
  1080. @item response
  1081. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1082. By default it is disabled.
  1083. @item channel
  1084. Set for which IR channel to display frequency response. By default is first channel
  1085. displayed. This option is used only when @var{response} is enabled.
  1086. @item size
  1087. Set video stream size. This option is used only when @var{response} is enabled.
  1088. @end table
  1089. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1090. order.
  1091. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1092. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1093. imaginary unit.
  1094. Different coefficients and gains can be provided for every channel, in such case
  1095. use '|' to separate coefficients or gains. Last provided coefficients will be
  1096. used for all remaining channels.
  1097. @subsection Examples
  1098. @itemize
  1099. @item
  1100. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1101. @example
  1102. 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
  1103. @end example
  1104. @item
  1105. Same as above but in @code{zp} format:
  1106. @example
  1107. 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
  1108. @end example
  1109. @end itemize
  1110. @section alimiter
  1111. The limiter prevents an input signal from rising over a desired threshold.
  1112. This limiter uses lookahead technology to prevent your signal from distorting.
  1113. It means that there is a small delay after the signal is processed. Keep in mind
  1114. that the delay it produces is the attack time you set.
  1115. The filter accepts the following options:
  1116. @table @option
  1117. @item level_in
  1118. Set input gain. Default is 1.
  1119. @item level_out
  1120. Set output gain. Default is 1.
  1121. @item limit
  1122. Don't let signals above this level pass the limiter. Default is 1.
  1123. @item attack
  1124. The limiter will reach its attenuation level in this amount of time in
  1125. milliseconds. Default is 5 milliseconds.
  1126. @item release
  1127. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1128. Default is 50 milliseconds.
  1129. @item asc
  1130. When gain reduction is always needed ASC takes care of releasing to an
  1131. average reduction level rather than reaching a reduction of 0 in the release
  1132. time.
  1133. @item asc_level
  1134. Select how much the release time is affected by ASC, 0 means nearly no changes
  1135. in release time while 1 produces higher release times.
  1136. @item level
  1137. Auto level output signal. Default is enabled.
  1138. This normalizes audio back to 0dB if enabled.
  1139. @end table
  1140. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1141. with @ref{aresample} before applying this filter.
  1142. @section allpass
  1143. Apply a two-pole all-pass filter with central frequency (in Hz)
  1144. @var{frequency}, and filter-width @var{width}.
  1145. An all-pass filter changes the audio's frequency to phase relationship
  1146. without changing its frequency to amplitude relationship.
  1147. The filter accepts the following options:
  1148. @table @option
  1149. @item frequency, f
  1150. Set frequency in Hz.
  1151. @item width_type, t
  1152. Set method to specify band-width of filter.
  1153. @table @option
  1154. @item h
  1155. Hz
  1156. @item q
  1157. Q-Factor
  1158. @item o
  1159. octave
  1160. @item s
  1161. slope
  1162. @item k
  1163. kHz
  1164. @end table
  1165. @item width, w
  1166. Specify the band-width of a filter in width_type units.
  1167. @item mix, m
  1168. How much to use filtered signal in output. Default is 1.
  1169. Range is between 0 and 1.
  1170. @item channels, c
  1171. Specify which channels to filter, by default all available are filtered.
  1172. @end table
  1173. @subsection Commands
  1174. This filter supports the following commands:
  1175. @table @option
  1176. @item frequency, f
  1177. Change allpass frequency.
  1178. Syntax for the command is : "@var{frequency}"
  1179. @item width_type, t
  1180. Change allpass width_type.
  1181. Syntax for the command is : "@var{width_type}"
  1182. @item width, w
  1183. Change allpass width.
  1184. Syntax for the command is : "@var{width}"
  1185. @item mix, m
  1186. Change allpass mix.
  1187. Syntax for the command is : "@var{mix}"
  1188. @end table
  1189. @section aloop
  1190. Loop audio samples.
  1191. The filter accepts the following options:
  1192. @table @option
  1193. @item loop
  1194. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1195. Default is 0.
  1196. @item size
  1197. Set maximal number of samples. Default is 0.
  1198. @item start
  1199. Set first sample of loop. Default is 0.
  1200. @end table
  1201. @anchor{amerge}
  1202. @section amerge
  1203. Merge two or more audio streams into a single multi-channel stream.
  1204. The filter accepts the following options:
  1205. @table @option
  1206. @item inputs
  1207. Set the number of inputs. Default is 2.
  1208. @end table
  1209. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1210. the channel layout of the output will be set accordingly and the channels
  1211. will be reordered as necessary. If the channel layouts of the inputs are not
  1212. disjoint, the output will have all the channels of the first input then all
  1213. the channels of the second input, in that order, and the channel layout of
  1214. the output will be the default value corresponding to the total number of
  1215. channels.
  1216. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1217. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1218. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1219. first input, b1 is the first channel of the second input).
  1220. On the other hand, if both input are in stereo, the output channels will be
  1221. in the default order: a1, a2, b1, b2, and the channel layout will be
  1222. arbitrarily set to 4.0, which may or may not be the expected value.
  1223. All inputs must have the same sample rate, and format.
  1224. If inputs do not have the same duration, the output will stop with the
  1225. shortest.
  1226. @subsection Examples
  1227. @itemize
  1228. @item
  1229. Merge two mono files into a stereo stream:
  1230. @example
  1231. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1232. @end example
  1233. @item
  1234. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1235. @example
  1236. 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
  1237. @end example
  1238. @end itemize
  1239. @section amix
  1240. Mixes multiple audio inputs into a single output.
  1241. Note that this filter only supports float samples (the @var{amerge}
  1242. and @var{pan} audio filters support many formats). If the @var{amix}
  1243. input has integer samples then @ref{aresample} will be automatically
  1244. inserted to perform the conversion to float samples.
  1245. For example
  1246. @example
  1247. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1248. @end example
  1249. will mix 3 input audio streams to a single output with the same duration as the
  1250. first input and a dropout transition time of 3 seconds.
  1251. It accepts the following parameters:
  1252. @table @option
  1253. @item inputs
  1254. The number of inputs. If unspecified, it defaults to 2.
  1255. @item duration
  1256. How to determine the end-of-stream.
  1257. @table @option
  1258. @item longest
  1259. The duration of the longest input. (default)
  1260. @item shortest
  1261. The duration of the shortest input.
  1262. @item first
  1263. The duration of the first input.
  1264. @end table
  1265. @item dropout_transition
  1266. The transition time, in seconds, for volume renormalization when an input
  1267. stream ends. The default value is 2 seconds.
  1268. @item weights
  1269. Specify weight of each input audio stream as sequence.
  1270. Each weight is separated by space. By default all inputs have same weight.
  1271. @end table
  1272. @section amultiply
  1273. Multiply first audio stream with second audio stream and store result
  1274. in output audio stream. Multiplication is done by multiplying each
  1275. sample from first stream with sample at same position from second stream.
  1276. With this element-wise multiplication one can create amplitude fades and
  1277. amplitude modulations.
  1278. @section anequalizer
  1279. High-order parametric multiband equalizer for each channel.
  1280. It accepts the following parameters:
  1281. @table @option
  1282. @item params
  1283. This option string is in format:
  1284. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1285. Each equalizer band is separated by '|'.
  1286. @table @option
  1287. @item chn
  1288. Set channel number to which equalization will be applied.
  1289. If input doesn't have that channel the entry is ignored.
  1290. @item f
  1291. Set central frequency for band.
  1292. If input doesn't have that frequency the entry is ignored.
  1293. @item w
  1294. Set band width in hertz.
  1295. @item g
  1296. Set band gain in dB.
  1297. @item t
  1298. Set filter type for band, optional, can be:
  1299. @table @samp
  1300. @item 0
  1301. Butterworth, this is default.
  1302. @item 1
  1303. Chebyshev type 1.
  1304. @item 2
  1305. Chebyshev type 2.
  1306. @end table
  1307. @end table
  1308. @item curves
  1309. With this option activated frequency response of anequalizer is displayed
  1310. in video stream.
  1311. @item size
  1312. Set video stream size. Only useful if curves option is activated.
  1313. @item mgain
  1314. Set max gain that will be displayed. Only useful if curves option is activated.
  1315. Setting this to a reasonable value makes it possible to display gain which is derived from
  1316. neighbour bands which are too close to each other and thus produce higher gain
  1317. when both are activated.
  1318. @item fscale
  1319. Set frequency scale used to draw frequency response in video output.
  1320. Can be linear or logarithmic. Default is logarithmic.
  1321. @item colors
  1322. Set color for each channel curve which is going to be displayed in video stream.
  1323. This is list of color names separated by space or by '|'.
  1324. Unrecognised or missing colors will be replaced by white color.
  1325. @end table
  1326. @subsection Examples
  1327. @itemize
  1328. @item
  1329. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1330. for first 2 channels using Chebyshev type 1 filter:
  1331. @example
  1332. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1333. @end example
  1334. @end itemize
  1335. @subsection Commands
  1336. This filter supports the following commands:
  1337. @table @option
  1338. @item change
  1339. Alter existing filter parameters.
  1340. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1341. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1342. error is returned.
  1343. @var{freq} set new frequency parameter.
  1344. @var{width} set new width parameter in herz.
  1345. @var{gain} set new gain parameter in dB.
  1346. Full filter invocation with asendcmd may look like this:
  1347. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1348. @end table
  1349. @section anlmdn
  1350. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1351. Each sample is adjusted by looking for other samples with similar contexts. This
  1352. context similarity is defined by comparing their surrounding patches of size
  1353. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1354. The filter accepts the following options.
  1355. @table @option
  1356. @item s
  1357. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1358. @item p
  1359. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1360. Default value is 2 milliseconds.
  1361. @item r
  1362. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1363. Default value is 6 milliseconds.
  1364. @item o
  1365. Set the output mode.
  1366. It accepts the following values:
  1367. @table @option
  1368. @item i
  1369. Pass input unchanged.
  1370. @item o
  1371. Pass noise filtered out.
  1372. @item n
  1373. Pass only noise.
  1374. Default value is @var{o}.
  1375. @end table
  1376. @item m
  1377. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1378. @end table
  1379. @subsection Commands
  1380. This filter supports the following commands:
  1381. @table @option
  1382. @item s
  1383. Change denoise strength. Argument is single float number.
  1384. Syntax for the command is : "@var{s}"
  1385. @item o
  1386. Change output mode.
  1387. Syntax for the command is : "i", "o" or "n" string.
  1388. @end table
  1389. @section anull
  1390. Pass the audio source unchanged to the output.
  1391. @section apad
  1392. Pad the end of an audio stream with silence.
  1393. This can be used together with @command{ffmpeg} @option{-shortest} to
  1394. extend audio streams to the same length as the video stream.
  1395. A description of the accepted options follows.
  1396. @table @option
  1397. @item packet_size
  1398. Set silence packet size. Default value is 4096.
  1399. @item pad_len
  1400. Set the number of samples of silence to add to the end. After the
  1401. value is reached, the stream is terminated. This option is mutually
  1402. exclusive with @option{whole_len}.
  1403. @item whole_len
  1404. Set the minimum total number of samples in the output audio stream. If
  1405. the value is longer than the input audio length, silence is added to
  1406. the end, until the value is reached. This option is mutually exclusive
  1407. with @option{pad_len}.
  1408. @item pad_dur
  1409. Specify the duration of samples of silence to add. See
  1410. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1411. for the accepted syntax. Used only if set to non-zero value.
  1412. @item whole_dur
  1413. Specify the minimum total duration in the output audio stream. See
  1414. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1415. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1416. the input audio length, silence is added to the end, until the value is reached.
  1417. This option is mutually exclusive with @option{pad_dur}
  1418. @end table
  1419. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1420. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1421. the input stream indefinitely.
  1422. @subsection Examples
  1423. @itemize
  1424. @item
  1425. Add 1024 samples of silence to the end of the input:
  1426. @example
  1427. apad=pad_len=1024
  1428. @end example
  1429. @item
  1430. Make sure the audio output will contain at least 10000 samples, pad
  1431. the input with silence if required:
  1432. @example
  1433. apad=whole_len=10000
  1434. @end example
  1435. @item
  1436. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1437. video stream will always result the shortest and will be converted
  1438. until the end in the output file when using the @option{shortest}
  1439. option:
  1440. @example
  1441. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1442. @end example
  1443. @end itemize
  1444. @section aphaser
  1445. Add a phasing effect to the input audio.
  1446. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1447. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1448. A description of the accepted parameters follows.
  1449. @table @option
  1450. @item in_gain
  1451. Set input gain. Default is 0.4.
  1452. @item out_gain
  1453. Set output gain. Default is 0.74
  1454. @item delay
  1455. Set delay in milliseconds. Default is 3.0.
  1456. @item decay
  1457. Set decay. Default is 0.4.
  1458. @item speed
  1459. Set modulation speed in Hz. Default is 0.5.
  1460. @item type
  1461. Set modulation type. Default is triangular.
  1462. It accepts the following values:
  1463. @table @samp
  1464. @item triangular, t
  1465. @item sinusoidal, s
  1466. @end table
  1467. @end table
  1468. @section apulsator
  1469. Audio pulsator is something between an autopanner and a tremolo.
  1470. But it can produce funny stereo effects as well. Pulsator changes the volume
  1471. of the left and right channel based on a LFO (low frequency oscillator) with
  1472. different waveforms and shifted phases.
  1473. This filter have the ability to define an offset between left and right
  1474. channel. An offset of 0 means that both LFO shapes match each other.
  1475. The left and right channel are altered equally - a conventional tremolo.
  1476. An offset of 50% means that the shape of the right channel is exactly shifted
  1477. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1478. an autopanner. At 1 both curves match again. Every setting in between moves the
  1479. phase shift gapless between all stages and produces some "bypassing" sounds with
  1480. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1481. the 0.5) the faster the signal passes from the left to the right speaker.
  1482. The filter accepts the following options:
  1483. @table @option
  1484. @item level_in
  1485. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1486. @item level_out
  1487. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1488. @item mode
  1489. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1490. sawup or sawdown. Default is sine.
  1491. @item amount
  1492. Set modulation. Define how much of original signal is affected by the LFO.
  1493. @item offset_l
  1494. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1495. @item offset_r
  1496. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1497. @item width
  1498. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1499. @item timing
  1500. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1501. @item bpm
  1502. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1503. is set to bpm.
  1504. @item ms
  1505. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1506. is set to ms.
  1507. @item hz
  1508. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1509. if timing is set to hz.
  1510. @end table
  1511. @anchor{aresample}
  1512. @section aresample
  1513. Resample the input audio to the specified parameters, using the
  1514. libswresample library. If none are specified then the filter will
  1515. automatically convert between its input and output.
  1516. This filter is also able to stretch/squeeze the audio data to make it match
  1517. the timestamps or to inject silence / cut out audio to make it match the
  1518. timestamps, do a combination of both or do neither.
  1519. The filter accepts the syntax
  1520. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1521. expresses a sample rate and @var{resampler_options} is a list of
  1522. @var{key}=@var{value} pairs, separated by ":". See the
  1523. @ref{Resampler Options,,"Resampler Options" section in the
  1524. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1525. for the complete list of supported options.
  1526. @subsection Examples
  1527. @itemize
  1528. @item
  1529. Resample the input audio to 44100Hz:
  1530. @example
  1531. aresample=44100
  1532. @end example
  1533. @item
  1534. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1535. samples per second compensation:
  1536. @example
  1537. aresample=async=1000
  1538. @end example
  1539. @end itemize
  1540. @section areverse
  1541. Reverse an audio clip.
  1542. Warning: This filter requires memory to buffer the entire clip, so trimming
  1543. is suggested.
  1544. @subsection Examples
  1545. @itemize
  1546. @item
  1547. Take the first 5 seconds of a clip, and reverse it.
  1548. @example
  1549. atrim=end=5,areverse
  1550. @end example
  1551. @end itemize
  1552. @section asetnsamples
  1553. Set the number of samples per each output audio frame.
  1554. The last output packet may contain a different number of samples, as
  1555. the filter will flush all the remaining samples when the input audio
  1556. signals its end.
  1557. The filter accepts the following options:
  1558. @table @option
  1559. @item nb_out_samples, n
  1560. Set the number of frames per each output audio frame. The number is
  1561. intended as the number of samples @emph{per each channel}.
  1562. Default value is 1024.
  1563. @item pad, p
  1564. If set to 1, the filter will pad the last audio frame with zeroes, so
  1565. that the last frame will contain the same number of samples as the
  1566. previous ones. Default value is 1.
  1567. @end table
  1568. For example, to set the number of per-frame samples to 1234 and
  1569. disable padding for the last frame, use:
  1570. @example
  1571. asetnsamples=n=1234:p=0
  1572. @end example
  1573. @section asetrate
  1574. Set the sample rate without altering the PCM data.
  1575. This will result in a change of speed and pitch.
  1576. The filter accepts the following options:
  1577. @table @option
  1578. @item sample_rate, r
  1579. Set the output sample rate. Default is 44100 Hz.
  1580. @end table
  1581. @section ashowinfo
  1582. Show a line containing various information for each input audio frame.
  1583. The input audio is not modified.
  1584. The shown line contains a sequence of key/value pairs of the form
  1585. @var{key}:@var{value}.
  1586. The following values are shown in the output:
  1587. @table @option
  1588. @item n
  1589. The (sequential) number of the input frame, starting from 0.
  1590. @item pts
  1591. The presentation timestamp of the input frame, in time base units; the time base
  1592. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1593. @item pts_time
  1594. The presentation timestamp of the input frame in seconds.
  1595. @item pos
  1596. position of the frame in the input stream, -1 if this information in
  1597. unavailable and/or meaningless (for example in case of synthetic audio)
  1598. @item fmt
  1599. The sample format.
  1600. @item chlayout
  1601. The channel layout.
  1602. @item rate
  1603. The sample rate for the audio frame.
  1604. @item nb_samples
  1605. The number of samples (per channel) in the frame.
  1606. @item checksum
  1607. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1608. audio, the data is treated as if all the planes were concatenated.
  1609. @item plane_checksums
  1610. A list of Adler-32 checksums for each data plane.
  1611. @end table
  1612. @section asoftclip
  1613. Apply audio soft clipping.
  1614. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1615. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1616. This filter accepts the following options:
  1617. @table @option
  1618. @item type
  1619. Set type of soft-clipping.
  1620. It accepts the following values:
  1621. @table @option
  1622. @item tanh
  1623. @item atan
  1624. @item cubic
  1625. @item exp
  1626. @item alg
  1627. @item quintic
  1628. @item sin
  1629. @end table
  1630. @item param
  1631. Set additional parameter which controls sigmoid function.
  1632. @end table
  1633. @section asr
  1634. Automatic Speech Recognition
  1635. This filter uses PocketSphinx for speech recognition. To enable
  1636. compilation of this filter, you need to configure FFmpeg with
  1637. @code{--enable-pocketsphinx}.
  1638. It accepts the following options:
  1639. @table @option
  1640. @item rate
  1641. Set sampling rate of input audio. Defaults is @code{16000}.
  1642. This need to match speech models, otherwise one will get poor results.
  1643. @item hmm
  1644. Set dictionary containing acoustic model files.
  1645. @item dict
  1646. Set pronunciation dictionary.
  1647. @item lm
  1648. Set language model file.
  1649. @item lmctl
  1650. Set language model set.
  1651. @item lmname
  1652. Set which language model to use.
  1653. @item logfn
  1654. Set output for log messages.
  1655. @end table
  1656. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1657. @anchor{astats}
  1658. @section astats
  1659. Display time domain statistical information about the audio channels.
  1660. Statistics are calculated and displayed for each audio channel and,
  1661. where applicable, an overall figure is also given.
  1662. It accepts the following option:
  1663. @table @option
  1664. @item length
  1665. Short window length in seconds, used for peak and trough RMS measurement.
  1666. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1667. @item metadata
  1668. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1669. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1670. disabled.
  1671. Available keys for each channel are:
  1672. DC_offset
  1673. Min_level
  1674. Max_level
  1675. Min_difference
  1676. Max_difference
  1677. Mean_difference
  1678. RMS_difference
  1679. Peak_level
  1680. RMS_peak
  1681. RMS_trough
  1682. Crest_factor
  1683. Flat_factor
  1684. Peak_count
  1685. Bit_depth
  1686. Dynamic_range
  1687. Zero_crossings
  1688. Zero_crossings_rate
  1689. Number_of_NaNs
  1690. Number_of_Infs
  1691. Number_of_denormals
  1692. and for Overall:
  1693. DC_offset
  1694. Min_level
  1695. Max_level
  1696. Min_difference
  1697. Max_difference
  1698. Mean_difference
  1699. RMS_difference
  1700. Peak_level
  1701. RMS_level
  1702. RMS_peak
  1703. RMS_trough
  1704. Flat_factor
  1705. Peak_count
  1706. Bit_depth
  1707. Number_of_samples
  1708. Number_of_NaNs
  1709. Number_of_Infs
  1710. Number_of_denormals
  1711. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1712. this @code{lavfi.astats.Overall.Peak_count}.
  1713. For description what each key means read below.
  1714. @item reset
  1715. Set number of frame after which stats are going to be recalculated.
  1716. Default is disabled.
  1717. @item measure_perchannel
  1718. Select the entries which need to be measured per channel. The metadata keys can
  1719. be used as flags, default is @option{all} which measures everything.
  1720. @option{none} disables all per channel measurement.
  1721. @item measure_overall
  1722. Select the entries which need to be measured overall. The metadata keys can
  1723. be used as flags, default is @option{all} which measures everything.
  1724. @option{none} disables all overall measurement.
  1725. @end table
  1726. A description of each shown parameter follows:
  1727. @table @option
  1728. @item DC offset
  1729. Mean amplitude displacement from zero.
  1730. @item Min level
  1731. Minimal sample level.
  1732. @item Max level
  1733. Maximal sample level.
  1734. @item Min difference
  1735. Minimal difference between two consecutive samples.
  1736. @item Max difference
  1737. Maximal difference between two consecutive samples.
  1738. @item Mean difference
  1739. Mean difference between two consecutive samples.
  1740. The average of each difference between two consecutive samples.
  1741. @item RMS difference
  1742. Root Mean Square difference between two consecutive samples.
  1743. @item Peak level dB
  1744. @item RMS level dB
  1745. Standard peak and RMS level measured in dBFS.
  1746. @item RMS peak dB
  1747. @item RMS trough dB
  1748. Peak and trough values for RMS level measured over a short window.
  1749. @item Crest factor
  1750. Standard ratio of peak to RMS level (note: not in dB).
  1751. @item Flat factor
  1752. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1753. (i.e. either @var{Min level} or @var{Max level}).
  1754. @item Peak count
  1755. Number of occasions (not the number of samples) that the signal attained either
  1756. @var{Min level} or @var{Max level}.
  1757. @item Bit depth
  1758. Overall bit depth of audio. Number of bits used for each sample.
  1759. @item Dynamic range
  1760. Measured dynamic range of audio in dB.
  1761. @item Zero crossings
  1762. Number of points where the waveform crosses the zero level axis.
  1763. @item Zero crossings rate
  1764. Rate of Zero crossings and number of audio samples.
  1765. @end table
  1766. @section atempo
  1767. Adjust audio tempo.
  1768. The filter accepts exactly one parameter, the audio tempo. If not
  1769. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1770. be in the [0.5, 100.0] range.
  1771. Note that tempo greater than 2 will skip some samples rather than
  1772. blend them in. If for any reason this is a concern it is always
  1773. possible to daisy-chain several instances of atempo to achieve the
  1774. desired product tempo.
  1775. @subsection Examples
  1776. @itemize
  1777. @item
  1778. Slow down audio to 80% tempo:
  1779. @example
  1780. atempo=0.8
  1781. @end example
  1782. @item
  1783. To speed up audio to 300% tempo:
  1784. @example
  1785. atempo=3
  1786. @end example
  1787. @item
  1788. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1789. @example
  1790. atempo=sqrt(3),atempo=sqrt(3)
  1791. @end example
  1792. @end itemize
  1793. @section atrim
  1794. Trim the input so that the output contains one continuous subpart of the input.
  1795. It accepts the following parameters:
  1796. @table @option
  1797. @item start
  1798. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1799. sample with the timestamp @var{start} will be the first sample in the output.
  1800. @item end
  1801. Specify time of the first audio sample that will be dropped, i.e. the
  1802. audio sample immediately preceding the one with the timestamp @var{end} will be
  1803. the last sample in the output.
  1804. @item start_pts
  1805. Same as @var{start}, except this option sets the start timestamp in samples
  1806. instead of seconds.
  1807. @item end_pts
  1808. Same as @var{end}, except this option sets the end timestamp in samples instead
  1809. of seconds.
  1810. @item duration
  1811. The maximum duration of the output in seconds.
  1812. @item start_sample
  1813. The number of the first sample that should be output.
  1814. @item end_sample
  1815. The number of the first sample that should be dropped.
  1816. @end table
  1817. @option{start}, @option{end}, and @option{duration} are expressed as time
  1818. duration specifications; see
  1819. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1820. Note that the first two sets of the start/end options and the @option{duration}
  1821. option look at the frame timestamp, while the _sample options simply count the
  1822. samples that pass through the filter. So start/end_pts and start/end_sample will
  1823. give different results when the timestamps are wrong, inexact or do not start at
  1824. zero. Also note that this filter does not modify the timestamps. If you wish
  1825. to have the output timestamps start at zero, insert the asetpts filter after the
  1826. atrim filter.
  1827. If multiple start or end options are set, this filter tries to be greedy and
  1828. keep all samples that match at least one of the specified constraints. To keep
  1829. only the part that matches all the constraints at once, chain multiple atrim
  1830. filters.
  1831. The defaults are such that all the input is kept. So it is possible to set e.g.
  1832. just the end values to keep everything before the specified time.
  1833. Examples:
  1834. @itemize
  1835. @item
  1836. Drop everything except the second minute of input:
  1837. @example
  1838. ffmpeg -i INPUT -af atrim=60:120
  1839. @end example
  1840. @item
  1841. Keep only the first 1000 samples:
  1842. @example
  1843. ffmpeg -i INPUT -af atrim=end_sample=1000
  1844. @end example
  1845. @end itemize
  1846. @section bandpass
  1847. Apply a two-pole Butterworth band-pass filter with central
  1848. frequency @var{frequency}, and (3dB-point) band-width width.
  1849. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1850. instead of the default: constant 0dB peak gain.
  1851. The filter roll off at 6dB per octave (20dB per decade).
  1852. The filter accepts the following options:
  1853. @table @option
  1854. @item frequency, f
  1855. Set the filter's central frequency. Default is @code{3000}.
  1856. @item csg
  1857. Constant skirt gain if set to 1. Defaults to 0.
  1858. @item width_type, t
  1859. Set method to specify band-width of filter.
  1860. @table @option
  1861. @item h
  1862. Hz
  1863. @item q
  1864. Q-Factor
  1865. @item o
  1866. octave
  1867. @item s
  1868. slope
  1869. @item k
  1870. kHz
  1871. @end table
  1872. @item width, w
  1873. Specify the band-width of a filter in width_type units.
  1874. @item mix, m
  1875. How much to use filtered signal in output. Default is 1.
  1876. Range is between 0 and 1.
  1877. @item channels, c
  1878. Specify which channels to filter, by default all available are filtered.
  1879. @end table
  1880. @subsection Commands
  1881. This filter supports the following commands:
  1882. @table @option
  1883. @item frequency, f
  1884. Change bandpass frequency.
  1885. Syntax for the command is : "@var{frequency}"
  1886. @item width_type, t
  1887. Change bandpass width_type.
  1888. Syntax for the command is : "@var{width_type}"
  1889. @item width, w
  1890. Change bandpass width.
  1891. Syntax for the command is : "@var{width}"
  1892. @item mix, m
  1893. Change bandpass mix.
  1894. Syntax for the command is : "@var{mix}"
  1895. @end table
  1896. @section bandreject
  1897. Apply a two-pole Butterworth band-reject filter with central
  1898. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1899. The filter roll off at 6dB per octave (20dB per decade).
  1900. The filter accepts the following options:
  1901. @table @option
  1902. @item frequency, f
  1903. Set the filter's central frequency. Default is @code{3000}.
  1904. @item width_type, t
  1905. Set method to specify band-width of filter.
  1906. @table @option
  1907. @item h
  1908. Hz
  1909. @item q
  1910. Q-Factor
  1911. @item o
  1912. octave
  1913. @item s
  1914. slope
  1915. @item k
  1916. kHz
  1917. @end table
  1918. @item width, w
  1919. Specify the band-width of a filter in width_type units.
  1920. @item mix, m
  1921. How much to use filtered signal in output. Default is 1.
  1922. Range is between 0 and 1.
  1923. @item channels, c
  1924. Specify which channels to filter, by default all available are filtered.
  1925. @end table
  1926. @subsection Commands
  1927. This filter supports the following commands:
  1928. @table @option
  1929. @item frequency, f
  1930. Change bandreject frequency.
  1931. Syntax for the command is : "@var{frequency}"
  1932. @item width_type, t
  1933. Change bandreject width_type.
  1934. Syntax for the command is : "@var{width_type}"
  1935. @item width, w
  1936. Change bandreject width.
  1937. Syntax for the command is : "@var{width}"
  1938. @item mix, m
  1939. Change bandreject mix.
  1940. Syntax for the command is : "@var{mix}"
  1941. @end table
  1942. @section bass, lowshelf
  1943. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1944. shelving filter with a response similar to that of a standard
  1945. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1946. The filter accepts the following options:
  1947. @table @option
  1948. @item gain, g
  1949. Give the gain at 0 Hz. Its useful range is about -20
  1950. (for a large cut) to +20 (for a large boost).
  1951. Beware of clipping when using a positive gain.
  1952. @item frequency, f
  1953. Set the filter's central frequency and so can be used
  1954. to extend or reduce the frequency range to be boosted or cut.
  1955. The default value is @code{100} Hz.
  1956. @item width_type, t
  1957. Set method to specify band-width of filter.
  1958. @table @option
  1959. @item h
  1960. Hz
  1961. @item q
  1962. Q-Factor
  1963. @item o
  1964. octave
  1965. @item s
  1966. slope
  1967. @item k
  1968. kHz
  1969. @end table
  1970. @item width, w
  1971. Determine how steep is the filter's shelf transition.
  1972. @item mix, m
  1973. How much to use filtered signal in output. Default is 1.
  1974. Range is between 0 and 1.
  1975. @item channels, c
  1976. Specify which channels to filter, by default all available are filtered.
  1977. @end table
  1978. @subsection Commands
  1979. This filter supports the following commands:
  1980. @table @option
  1981. @item frequency, f
  1982. Change bass frequency.
  1983. Syntax for the command is : "@var{frequency}"
  1984. @item width_type, t
  1985. Change bass width_type.
  1986. Syntax for the command is : "@var{width_type}"
  1987. @item width, w
  1988. Change bass width.
  1989. Syntax for the command is : "@var{width}"
  1990. @item gain, g
  1991. Change bass gain.
  1992. Syntax for the command is : "@var{gain}"
  1993. @item mix, m
  1994. Change bass mix.
  1995. Syntax for the command is : "@var{mix}"
  1996. @end table
  1997. @section biquad
  1998. Apply a biquad IIR filter with the given coefficients.
  1999. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2000. are the numerator and denominator coefficients respectively.
  2001. and @var{channels}, @var{c} specify which channels to filter, by default all
  2002. available are filtered.
  2003. @subsection Commands
  2004. This filter supports the following commands:
  2005. @table @option
  2006. @item a0
  2007. @item a1
  2008. @item a2
  2009. @item b0
  2010. @item b1
  2011. @item b2
  2012. Change biquad parameter.
  2013. Syntax for the command is : "@var{value}"
  2014. @item mix, m
  2015. How much to use filtered signal in output. Default is 1.
  2016. Range is between 0 and 1.
  2017. @end table
  2018. @section bs2b
  2019. Bauer stereo to binaural transformation, which improves headphone listening of
  2020. stereo audio records.
  2021. To enable compilation of this filter you need to configure FFmpeg with
  2022. @code{--enable-libbs2b}.
  2023. It accepts the following parameters:
  2024. @table @option
  2025. @item profile
  2026. Pre-defined crossfeed level.
  2027. @table @option
  2028. @item default
  2029. Default level (fcut=700, feed=50).
  2030. @item cmoy
  2031. Chu Moy circuit (fcut=700, feed=60).
  2032. @item jmeier
  2033. Jan Meier circuit (fcut=650, feed=95).
  2034. @end table
  2035. @item fcut
  2036. Cut frequency (in Hz).
  2037. @item feed
  2038. Feed level (in Hz).
  2039. @end table
  2040. @section channelmap
  2041. Remap input channels to new locations.
  2042. It accepts the following parameters:
  2043. @table @option
  2044. @item map
  2045. Map channels from input to output. The argument is a '|'-separated list of
  2046. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2047. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2048. channel (e.g. FL for front left) or its index in the input channel layout.
  2049. @var{out_channel} is the name of the output channel or its index in the output
  2050. channel layout. If @var{out_channel} is not given then it is implicitly an
  2051. index, starting with zero and increasing by one for each mapping.
  2052. @item channel_layout
  2053. The channel layout of the output stream.
  2054. @end table
  2055. If no mapping is present, the filter will implicitly map input channels to
  2056. output channels, preserving indices.
  2057. @subsection Examples
  2058. @itemize
  2059. @item
  2060. For example, assuming a 5.1+downmix input MOV file,
  2061. @example
  2062. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2063. @end example
  2064. will create an output WAV file tagged as stereo from the downmix channels of
  2065. the input.
  2066. @item
  2067. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2068. @example
  2069. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2070. @end example
  2071. @end itemize
  2072. @section channelsplit
  2073. Split each channel from an input audio stream into a separate output stream.
  2074. It accepts the following parameters:
  2075. @table @option
  2076. @item channel_layout
  2077. The channel layout of the input stream. The default is "stereo".
  2078. @item channels
  2079. A channel layout describing the channels to be extracted as separate output streams
  2080. or "all" to extract each input channel as a separate stream. The default is "all".
  2081. Choosing channels not present in channel layout in the input will result in an error.
  2082. @end table
  2083. @subsection Examples
  2084. @itemize
  2085. @item
  2086. For example, assuming a stereo input MP3 file,
  2087. @example
  2088. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2089. @end example
  2090. will create an output Matroska file with two audio streams, one containing only
  2091. the left channel and the other the right channel.
  2092. @item
  2093. Split a 5.1 WAV file into per-channel files:
  2094. @example
  2095. ffmpeg -i in.wav -filter_complex
  2096. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2097. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2098. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2099. side_right.wav
  2100. @end example
  2101. @item
  2102. Extract only LFE from a 5.1 WAV file:
  2103. @example
  2104. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2105. -map '[LFE]' lfe.wav
  2106. @end example
  2107. @end itemize
  2108. @section chorus
  2109. Add a chorus effect to the audio.
  2110. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2111. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2112. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2113. The modulation depth defines the range the modulated delay is played before or after
  2114. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2115. sound tuned around the original one, like in a chorus where some vocals are slightly
  2116. off key.
  2117. It accepts the following parameters:
  2118. @table @option
  2119. @item in_gain
  2120. Set input gain. Default is 0.4.
  2121. @item out_gain
  2122. Set output gain. Default is 0.4.
  2123. @item delays
  2124. Set delays. A typical delay is around 40ms to 60ms.
  2125. @item decays
  2126. Set decays.
  2127. @item speeds
  2128. Set speeds.
  2129. @item depths
  2130. Set depths.
  2131. @end table
  2132. @subsection Examples
  2133. @itemize
  2134. @item
  2135. A single delay:
  2136. @example
  2137. chorus=0.7:0.9:55:0.4:0.25:2
  2138. @end example
  2139. @item
  2140. Two delays:
  2141. @example
  2142. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2143. @end example
  2144. @item
  2145. Fuller sounding chorus with three delays:
  2146. @example
  2147. 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
  2148. @end example
  2149. @end itemize
  2150. @section compand
  2151. Compress or expand the audio's dynamic range.
  2152. It accepts the following parameters:
  2153. @table @option
  2154. @item attacks
  2155. @item decays
  2156. A list of times in seconds for each channel over which the instantaneous level
  2157. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2158. increase of volume and @var{decays} refers to decrease of volume. For most
  2159. situations, the attack time (response to the audio getting louder) should be
  2160. shorter than the decay time, because the human ear is more sensitive to sudden
  2161. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2162. a typical value for decay is 0.8 seconds.
  2163. If specified number of attacks & decays is lower than number of channels, the last
  2164. set attack/decay will be used for all remaining channels.
  2165. @item points
  2166. A list of points for the transfer function, specified in dB relative to the
  2167. maximum possible signal amplitude. Each key points list must be defined using
  2168. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2169. @code{x0/y0 x1/y1 x2/y2 ....}
  2170. The input values must be in strictly increasing order but the transfer function
  2171. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2172. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2173. function are @code{-70/-70|-60/-20|1/0}.
  2174. @item soft-knee
  2175. Set the curve radius in dB for all joints. It defaults to 0.01.
  2176. @item gain
  2177. Set the additional gain in dB to be applied at all points on the transfer
  2178. function. This allows for easy adjustment of the overall gain.
  2179. It defaults to 0.
  2180. @item volume
  2181. Set an initial volume, in dB, to be assumed for each channel when filtering
  2182. starts. This permits the user to supply a nominal level initially, so that, for
  2183. example, a very large gain is not applied to initial signal levels before the
  2184. companding has begun to operate. A typical value for audio which is initially
  2185. quiet is -90 dB. It defaults to 0.
  2186. @item delay
  2187. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2188. delayed before being fed to the volume adjuster. Specifying a delay
  2189. approximately equal to the attack/decay times allows the filter to effectively
  2190. operate in predictive rather than reactive mode. It defaults to 0.
  2191. @end table
  2192. @subsection Examples
  2193. @itemize
  2194. @item
  2195. Make music with both quiet and loud passages suitable for listening to in a
  2196. noisy environment:
  2197. @example
  2198. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2199. @end example
  2200. Another example for audio with whisper and explosion parts:
  2201. @example
  2202. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2203. @end example
  2204. @item
  2205. A noise gate for when the noise is at a lower level than the signal:
  2206. @example
  2207. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2208. @end example
  2209. @item
  2210. Here is another noise gate, this time for when the noise is at a higher level
  2211. than the signal (making it, in some ways, similar to squelch):
  2212. @example
  2213. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2214. @end example
  2215. @item
  2216. 2:1 compression starting at -6dB:
  2217. @example
  2218. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2219. @end example
  2220. @item
  2221. 2:1 compression starting at -9dB:
  2222. @example
  2223. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2224. @end example
  2225. @item
  2226. 2:1 compression starting at -12dB:
  2227. @example
  2228. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2229. @end example
  2230. @item
  2231. 2:1 compression starting at -18dB:
  2232. @example
  2233. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2234. @end example
  2235. @item
  2236. 3:1 compression starting at -15dB:
  2237. @example
  2238. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2239. @end example
  2240. @item
  2241. Compressor/Gate:
  2242. @example
  2243. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2244. @end example
  2245. @item
  2246. Expander:
  2247. @example
  2248. 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
  2249. @end example
  2250. @item
  2251. Hard limiter at -6dB:
  2252. @example
  2253. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2254. @end example
  2255. @item
  2256. Hard limiter at -12dB:
  2257. @example
  2258. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2259. @end example
  2260. @item
  2261. Hard noise gate at -35 dB:
  2262. @example
  2263. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2264. @end example
  2265. @item
  2266. Soft limiter:
  2267. @example
  2268. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2269. @end example
  2270. @end itemize
  2271. @section compensationdelay
  2272. Compensation Delay Line is a metric based delay to compensate differing
  2273. positions of microphones or speakers.
  2274. For example, you have recorded guitar with two microphones placed in
  2275. different location. Because the front of sound wave has fixed speed in
  2276. normal conditions, the phasing of microphones can vary and depends on
  2277. their location and interposition. The best sound mix can be achieved when
  2278. these microphones are in phase (synchronized). Note that distance of
  2279. ~30 cm between microphones makes one microphone to capture signal in
  2280. antiphase to another microphone. That makes the final mix sounding moody.
  2281. This filter helps to solve phasing problems by adding different delays
  2282. to each microphone track and make them synchronized.
  2283. The best result can be reached when you take one track as base and
  2284. synchronize other tracks one by one with it.
  2285. Remember that synchronization/delay tolerance depends on sample rate, too.
  2286. Higher sample rates will give more tolerance.
  2287. It accepts the following parameters:
  2288. @table @option
  2289. @item mm
  2290. Set millimeters distance. This is compensation distance for fine tuning.
  2291. Default is 0.
  2292. @item cm
  2293. Set cm distance. This is compensation distance for tightening distance setup.
  2294. Default is 0.
  2295. @item m
  2296. Set meters distance. This is compensation distance for hard distance setup.
  2297. Default is 0.
  2298. @item dry
  2299. Set dry amount. Amount of unprocessed (dry) signal.
  2300. Default is 0.
  2301. @item wet
  2302. Set wet amount. Amount of processed (wet) signal.
  2303. Default is 1.
  2304. @item temp
  2305. Set temperature degree in Celsius. This is the temperature of the environment.
  2306. Default is 20.
  2307. @end table
  2308. @section crossfeed
  2309. Apply headphone crossfeed filter.
  2310. Crossfeed is the process of blending the left and right channels of stereo
  2311. audio recording.
  2312. It is mainly used to reduce extreme stereo separation of low frequencies.
  2313. The intent is to produce more speaker like sound to the listener.
  2314. The filter accepts the following options:
  2315. @table @option
  2316. @item strength
  2317. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2318. This sets gain of low shelf filter for side part of stereo image.
  2319. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2320. @item range
  2321. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2322. This sets cut off frequency of low shelf filter. Default is cut off near
  2323. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2324. @item level_in
  2325. Set input gain. Default is 0.9.
  2326. @item level_out
  2327. Set output gain. Default is 1.
  2328. @end table
  2329. @section crystalizer
  2330. Simple algorithm to expand audio dynamic range.
  2331. The filter accepts the following options:
  2332. @table @option
  2333. @item i
  2334. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2335. (unchanged sound) to 10.0 (maximum effect).
  2336. @item c
  2337. Enable clipping. By default is enabled.
  2338. @end table
  2339. @section dcshift
  2340. Apply a DC shift to the audio.
  2341. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2342. in the recording chain) from the audio. The effect of a DC offset is reduced
  2343. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2344. a signal has a DC offset.
  2345. @table @option
  2346. @item shift
  2347. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2348. the audio.
  2349. @item limitergain
  2350. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2351. used to prevent clipping.
  2352. @end table
  2353. @section deesser
  2354. Apply de-essing to the audio samples.
  2355. @table @option
  2356. @item i
  2357. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2358. Default is 0.
  2359. @item m
  2360. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2361. Default is 0.5.
  2362. @item f
  2363. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2364. Default is 0.5.
  2365. @item s
  2366. Set the output mode.
  2367. It accepts the following values:
  2368. @table @option
  2369. @item i
  2370. Pass input unchanged.
  2371. @item o
  2372. Pass ess filtered out.
  2373. @item e
  2374. Pass only ess.
  2375. Default value is @var{o}.
  2376. @end table
  2377. @end table
  2378. @section drmeter
  2379. Measure audio dynamic range.
  2380. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2381. is found in transition material. And anything less that 8 have very poor dynamics
  2382. and is very compressed.
  2383. The filter accepts the following options:
  2384. @table @option
  2385. @item length
  2386. Set window length in seconds used to split audio into segments of equal length.
  2387. Default is 3 seconds.
  2388. @end table
  2389. @section dynaudnorm
  2390. Dynamic Audio Normalizer.
  2391. This filter applies a certain amount of gain to the input audio in order
  2392. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2393. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2394. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2395. This allows for applying extra gain to the "quiet" sections of the audio
  2396. while avoiding distortions or clipping the "loud" sections. In other words:
  2397. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2398. sections, in the sense that the volume of each section is brought to the
  2399. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2400. this goal *without* applying "dynamic range compressing". It will retain 100%
  2401. of the dynamic range *within* each section of the audio file.
  2402. @table @option
  2403. @item framelen, f
  2404. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2405. Default is 500 milliseconds.
  2406. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2407. referred to as frames. This is required, because a peak magnitude has no
  2408. meaning for just a single sample value. Instead, we need to determine the
  2409. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2410. normalizer would simply use the peak magnitude of the complete file, the
  2411. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2412. frame. The length of a frame is specified in milliseconds. By default, the
  2413. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2414. been found to give good results with most files.
  2415. Note that the exact frame length, in number of samples, will be determined
  2416. automatically, based on the sampling rate of the individual input audio file.
  2417. @item gausssize, g
  2418. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2419. number. Default is 31.
  2420. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2421. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2422. is specified in frames, centered around the current frame. For the sake of
  2423. simplicity, this must be an odd number. Consequently, the default value of 31
  2424. takes into account the current frame, as well as the 15 preceding frames and
  2425. the 15 subsequent frames. Using a larger window results in a stronger
  2426. smoothing effect and thus in less gain variation, i.e. slower gain
  2427. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2428. effect and thus in more gain variation, i.e. faster gain adaptation.
  2429. In other words, the more you increase this value, the more the Dynamic Audio
  2430. Normalizer will behave like a "traditional" normalization filter. On the
  2431. contrary, the more you decrease this value, the more the Dynamic Audio
  2432. Normalizer will behave like a dynamic range compressor.
  2433. @item peak, p
  2434. Set the target peak value. This specifies the highest permissible magnitude
  2435. level for the normalized audio input. This filter will try to approach the
  2436. target peak magnitude as closely as possible, but at the same time it also
  2437. makes sure that the normalized signal will never exceed the peak magnitude.
  2438. A frame's maximum local gain factor is imposed directly by the target peak
  2439. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2440. It is not recommended to go above this value.
  2441. @item maxgain, m
  2442. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2443. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2444. factor for each input frame, i.e. the maximum gain factor that does not
  2445. result in clipping or distortion. The maximum gain factor is determined by
  2446. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2447. additionally bounds the frame's maximum gain factor by a predetermined
  2448. (global) maximum gain factor. This is done in order to avoid excessive gain
  2449. factors in "silent" or almost silent frames. By default, the maximum gain
  2450. factor is 10.0, For most inputs the default value should be sufficient and
  2451. it usually is not recommended to increase this value. Though, for input
  2452. with an extremely low overall volume level, it may be necessary to allow even
  2453. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2454. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2455. Instead, a "sigmoid" threshold function will be applied. This way, the
  2456. gain factors will smoothly approach the threshold value, but never exceed that
  2457. value.
  2458. @item targetrms, r
  2459. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2460. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2461. This means that the maximum local gain factor for each frame is defined
  2462. (only) by the frame's highest magnitude sample. This way, the samples can
  2463. be amplified as much as possible without exceeding the maximum signal
  2464. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2465. Normalizer can also take into account the frame's root mean square,
  2466. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2467. determine the power of a time-varying signal. It is therefore considered
  2468. that the RMS is a better approximation of the "perceived loudness" than
  2469. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2470. frames to a constant RMS value, a uniform "perceived loudness" can be
  2471. established. If a target RMS value has been specified, a frame's local gain
  2472. factor is defined as the factor that would result in exactly that RMS value.
  2473. Note, however, that the maximum local gain factor is still restricted by the
  2474. frame's highest magnitude sample, in order to prevent clipping.
  2475. @item coupling, n
  2476. Enable channels coupling. By default is enabled.
  2477. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2478. amount. This means the same gain factor will be applied to all channels, i.e.
  2479. the maximum possible gain factor is determined by the "loudest" channel.
  2480. However, in some recordings, it may happen that the volume of the different
  2481. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2482. In this case, this option can be used to disable the channel coupling. This way,
  2483. the gain factor will be determined independently for each channel, depending
  2484. only on the individual channel's highest magnitude sample. This allows for
  2485. harmonizing the volume of the different channels.
  2486. @item correctdc, c
  2487. Enable DC bias correction. By default is disabled.
  2488. An audio signal (in the time domain) is a sequence of sample values.
  2489. In the Dynamic Audio Normalizer these sample values are represented in the
  2490. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2491. audio signal, or "waveform", should be centered around the zero point.
  2492. That means if we calculate the mean value of all samples in a file, or in a
  2493. single frame, then the result should be 0.0 or at least very close to that
  2494. value. If, however, there is a significant deviation of the mean value from
  2495. 0.0, in either positive or negative direction, this is referred to as a
  2496. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2497. Audio Normalizer provides optional DC bias correction.
  2498. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2499. the mean value, or "DC correction" offset, of each input frame and subtract
  2500. that value from all of the frame's sample values which ensures those samples
  2501. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2502. boundaries, the DC correction offset values will be interpolated smoothly
  2503. between neighbouring frames.
  2504. @item altboundary, b
  2505. Enable alternative boundary mode. By default is disabled.
  2506. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2507. around each frame. This includes the preceding frames as well as the
  2508. subsequent frames. However, for the "boundary" frames, located at the very
  2509. beginning and at the very end of the audio file, not all neighbouring
  2510. frames are available. In particular, for the first few frames in the audio
  2511. file, the preceding frames are not known. And, similarly, for the last few
  2512. frames in the audio file, the subsequent frames are not known. Thus, the
  2513. question arises which gain factors should be assumed for the missing frames
  2514. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2515. to deal with this situation. The default boundary mode assumes a gain factor
  2516. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2517. "fade out" at the beginning and at the end of the input, respectively.
  2518. @item compress, s
  2519. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2520. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2521. compression. This means that signal peaks will not be pruned and thus the
  2522. full dynamic range will be retained within each local neighbourhood. However,
  2523. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2524. normalization algorithm with a more "traditional" compression.
  2525. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2526. (thresholding) function. If (and only if) the compression feature is enabled,
  2527. all input frames will be processed by a soft knee thresholding function prior
  2528. to the actual normalization process. Put simply, the thresholding function is
  2529. going to prune all samples whose magnitude exceeds a certain threshold value.
  2530. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2531. value. Instead, the threshold value will be adjusted for each individual
  2532. frame.
  2533. In general, smaller parameters result in stronger compression, and vice versa.
  2534. Values below 3.0 are not recommended, because audible distortion may appear.
  2535. @end table
  2536. @section earwax
  2537. Make audio easier to listen to on headphones.
  2538. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2539. so that when listened to on headphones the stereo image is moved from
  2540. inside your head (standard for headphones) to outside and in front of
  2541. the listener (standard for speakers).
  2542. Ported from SoX.
  2543. @section equalizer
  2544. Apply a two-pole peaking equalisation (EQ) filter. With this
  2545. filter, the signal-level at and around a selected frequency can
  2546. be increased or decreased, whilst (unlike bandpass and bandreject
  2547. filters) that at all other frequencies is unchanged.
  2548. In order to produce complex equalisation curves, this filter can
  2549. be given several times, each with a different central frequency.
  2550. The filter accepts the following options:
  2551. @table @option
  2552. @item frequency, f
  2553. Set the filter's central frequency in Hz.
  2554. @item width_type, t
  2555. Set method to specify band-width of filter.
  2556. @table @option
  2557. @item h
  2558. Hz
  2559. @item q
  2560. Q-Factor
  2561. @item o
  2562. octave
  2563. @item s
  2564. slope
  2565. @item k
  2566. kHz
  2567. @end table
  2568. @item width, w
  2569. Specify the band-width of a filter in width_type units.
  2570. @item gain, g
  2571. Set the required gain or attenuation in dB.
  2572. Beware of clipping when using a positive gain.
  2573. @item mix, m
  2574. How much to use filtered signal in output. Default is 1.
  2575. Range is between 0 and 1.
  2576. @item channels, c
  2577. Specify which channels to filter, by default all available are filtered.
  2578. @end table
  2579. @subsection Examples
  2580. @itemize
  2581. @item
  2582. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2583. @example
  2584. equalizer=f=1000:t=h:width=200:g=-10
  2585. @end example
  2586. @item
  2587. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2588. @example
  2589. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2590. @end example
  2591. @end itemize
  2592. @subsection Commands
  2593. This filter supports the following commands:
  2594. @table @option
  2595. @item frequency, f
  2596. Change equalizer frequency.
  2597. Syntax for the command is : "@var{frequency}"
  2598. @item width_type, t
  2599. Change equalizer width_type.
  2600. Syntax for the command is : "@var{width_type}"
  2601. @item width, w
  2602. Change equalizer width.
  2603. Syntax for the command is : "@var{width}"
  2604. @item gain, g
  2605. Change equalizer gain.
  2606. Syntax for the command is : "@var{gain}"
  2607. @item mix, m
  2608. Change equalizer mix.
  2609. Syntax for the command is : "@var{mix}"
  2610. @end table
  2611. @section extrastereo
  2612. Linearly increases the difference between left and right channels which
  2613. adds some sort of "live" effect to playback.
  2614. The filter accepts the following options:
  2615. @table @option
  2616. @item m
  2617. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2618. (average of both channels), with 1.0 sound will be unchanged, with
  2619. -1.0 left and right channels will be swapped.
  2620. @item c
  2621. Enable clipping. By default is enabled.
  2622. @end table
  2623. @section firequalizer
  2624. Apply FIR Equalization using arbitrary frequency response.
  2625. The filter accepts the following option:
  2626. @table @option
  2627. @item gain
  2628. Set gain curve equation (in dB). The expression can contain variables:
  2629. @table @option
  2630. @item f
  2631. the evaluated frequency
  2632. @item sr
  2633. sample rate
  2634. @item ch
  2635. channel number, set to 0 when multichannels evaluation is disabled
  2636. @item chid
  2637. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2638. multichannels evaluation is disabled
  2639. @item chs
  2640. number of channels
  2641. @item chlayout
  2642. channel_layout, see libavutil/channel_layout.h
  2643. @end table
  2644. and functions:
  2645. @table @option
  2646. @item gain_interpolate(f)
  2647. interpolate gain on frequency f based on gain_entry
  2648. @item cubic_interpolate(f)
  2649. same as gain_interpolate, but smoother
  2650. @end table
  2651. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2652. @item gain_entry
  2653. Set gain entry for gain_interpolate function. The expression can
  2654. contain functions:
  2655. @table @option
  2656. @item entry(f, g)
  2657. store gain entry at frequency f with value g
  2658. @end table
  2659. This option is also available as command.
  2660. @item delay
  2661. Set filter delay in seconds. Higher value means more accurate.
  2662. Default is @code{0.01}.
  2663. @item accuracy
  2664. Set filter accuracy in Hz. Lower value means more accurate.
  2665. Default is @code{5}.
  2666. @item wfunc
  2667. Set window function. Acceptable values are:
  2668. @table @option
  2669. @item rectangular
  2670. rectangular window, useful when gain curve is already smooth
  2671. @item hann
  2672. hann window (default)
  2673. @item hamming
  2674. hamming window
  2675. @item blackman
  2676. blackman window
  2677. @item nuttall3
  2678. 3-terms continuous 1st derivative nuttall window
  2679. @item mnuttall3
  2680. minimum 3-terms discontinuous nuttall window
  2681. @item nuttall
  2682. 4-terms continuous 1st derivative nuttall window
  2683. @item bnuttall
  2684. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2685. @item bharris
  2686. blackman-harris window
  2687. @item tukey
  2688. tukey window
  2689. @end table
  2690. @item fixed
  2691. If enabled, use fixed number of audio samples. This improves speed when
  2692. filtering with large delay. Default is disabled.
  2693. @item multi
  2694. Enable multichannels evaluation on gain. Default is disabled.
  2695. @item zero_phase
  2696. Enable zero phase mode by subtracting timestamp to compensate delay.
  2697. Default is disabled.
  2698. @item scale
  2699. Set scale used by gain. Acceptable values are:
  2700. @table @option
  2701. @item linlin
  2702. linear frequency, linear gain
  2703. @item linlog
  2704. linear frequency, logarithmic (in dB) gain (default)
  2705. @item loglin
  2706. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2707. @item loglog
  2708. logarithmic frequency, logarithmic gain
  2709. @end table
  2710. @item dumpfile
  2711. Set file for dumping, suitable for gnuplot.
  2712. @item dumpscale
  2713. Set scale for dumpfile. Acceptable values are same with scale option.
  2714. Default is linlog.
  2715. @item fft2
  2716. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2717. Default is disabled.
  2718. @item min_phase
  2719. Enable minimum phase impulse response. Default is disabled.
  2720. @end table
  2721. @subsection Examples
  2722. @itemize
  2723. @item
  2724. lowpass at 1000 Hz:
  2725. @example
  2726. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2727. @end example
  2728. @item
  2729. lowpass at 1000 Hz with gain_entry:
  2730. @example
  2731. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2732. @end example
  2733. @item
  2734. custom equalization:
  2735. @example
  2736. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2737. @end example
  2738. @item
  2739. higher delay with zero phase to compensate delay:
  2740. @example
  2741. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2742. @end example
  2743. @item
  2744. lowpass on left channel, highpass on right channel:
  2745. @example
  2746. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2747. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2748. @end example
  2749. @end itemize
  2750. @section flanger
  2751. Apply a flanging effect to the audio.
  2752. The filter accepts the following options:
  2753. @table @option
  2754. @item delay
  2755. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2756. @item depth
  2757. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2758. @item regen
  2759. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2760. Default value is 0.
  2761. @item width
  2762. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2763. Default value is 71.
  2764. @item speed
  2765. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2766. @item shape
  2767. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2768. Default value is @var{sinusoidal}.
  2769. @item phase
  2770. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2771. Default value is 25.
  2772. @item interp
  2773. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2774. Default is @var{linear}.
  2775. @end table
  2776. @section haas
  2777. Apply Haas effect to audio.
  2778. Note that this makes most sense to apply on mono signals.
  2779. With this filter applied to mono signals it give some directionality and
  2780. stretches its stereo image.
  2781. The filter accepts the following options:
  2782. @table @option
  2783. @item level_in
  2784. Set input level. By default is @var{1}, or 0dB
  2785. @item level_out
  2786. Set output level. By default is @var{1}, or 0dB.
  2787. @item side_gain
  2788. Set gain applied to side part of signal. By default is @var{1}.
  2789. @item middle_source
  2790. Set kind of middle source. Can be one of the following:
  2791. @table @samp
  2792. @item left
  2793. Pick left channel.
  2794. @item right
  2795. Pick right channel.
  2796. @item mid
  2797. Pick middle part signal of stereo image.
  2798. @item side
  2799. Pick side part signal of stereo image.
  2800. @end table
  2801. @item middle_phase
  2802. Change middle phase. By default is disabled.
  2803. @item left_delay
  2804. Set left channel delay. By default is @var{2.05} milliseconds.
  2805. @item left_balance
  2806. Set left channel balance. By default is @var{-1}.
  2807. @item left_gain
  2808. Set left channel gain. By default is @var{1}.
  2809. @item left_phase
  2810. Change left phase. By default is disabled.
  2811. @item right_delay
  2812. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2813. @item right_balance
  2814. Set right channel balance. By default is @var{1}.
  2815. @item right_gain
  2816. Set right channel gain. By default is @var{1}.
  2817. @item right_phase
  2818. Change right phase. By default is enabled.
  2819. @end table
  2820. @section hdcd
  2821. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2822. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2823. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2824. of HDCD, and detects the Transient Filter flag.
  2825. @example
  2826. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2827. @end example
  2828. When using the filter with wav, note the default encoding for wav is 16-bit,
  2829. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2830. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2831. @example
  2832. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2833. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2834. @end example
  2835. The filter accepts the following options:
  2836. @table @option
  2837. @item disable_autoconvert
  2838. Disable any automatic format conversion or resampling in the filter graph.
  2839. @item process_stereo
  2840. Process the stereo channels together. If target_gain does not match between
  2841. channels, consider it invalid and use the last valid target_gain.
  2842. @item cdt_ms
  2843. Set the code detect timer period in ms.
  2844. @item force_pe
  2845. Always extend peaks above -3dBFS even if PE isn't signaled.
  2846. @item analyze_mode
  2847. Replace audio with a solid tone and adjust the amplitude to signal some
  2848. specific aspect of the decoding process. The output file can be loaded in
  2849. an audio editor alongside the original to aid analysis.
  2850. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2851. Modes are:
  2852. @table @samp
  2853. @item 0, off
  2854. Disabled
  2855. @item 1, lle
  2856. Gain adjustment level at each sample
  2857. @item 2, pe
  2858. Samples where peak extend occurs
  2859. @item 3, cdt
  2860. Samples where the code detect timer is active
  2861. @item 4, tgm
  2862. Samples where the target gain does not match between channels
  2863. @end table
  2864. @end table
  2865. @section headphone
  2866. Apply head-related transfer functions (HRTFs) to create virtual
  2867. loudspeakers around the user for binaural listening via headphones.
  2868. The HRIRs are provided via additional streams, for each channel
  2869. one stereo input stream is needed.
  2870. The filter accepts the following options:
  2871. @table @option
  2872. @item map
  2873. Set mapping of input streams for convolution.
  2874. The argument is a '|'-separated list of channel names in order as they
  2875. are given as additional stream inputs for filter.
  2876. This also specify number of input streams. Number of input streams
  2877. must be not less than number of channels in first stream plus one.
  2878. @item gain
  2879. Set gain applied to audio. Value is in dB. Default is 0.
  2880. @item type
  2881. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2882. processing audio in time domain which is slow.
  2883. @var{freq} is processing audio in frequency domain which is fast.
  2884. Default is @var{freq}.
  2885. @item lfe
  2886. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2887. @item size
  2888. Set size of frame in number of samples which will be processed at once.
  2889. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2890. @item hrir
  2891. Set format of hrir stream.
  2892. Default value is @var{stereo}. Alternative value is @var{multich}.
  2893. If value is set to @var{stereo}, number of additional streams should
  2894. be greater or equal to number of input channels in first input stream.
  2895. Also each additional stream should have stereo number of channels.
  2896. If value is set to @var{multich}, number of additional streams should
  2897. be exactly one. Also number of input channels of additional stream
  2898. should be equal or greater than twice number of channels of first input
  2899. stream.
  2900. @end table
  2901. @subsection Examples
  2902. @itemize
  2903. @item
  2904. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2905. each amovie filter use stereo file with IR coefficients as input.
  2906. The files give coefficients for each position of virtual loudspeaker:
  2907. @example
  2908. ffmpeg -i input.wav
  2909. -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"
  2910. output.wav
  2911. @end example
  2912. @item
  2913. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2914. but now in @var{multich} @var{hrir} format.
  2915. @example
  2916. 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"
  2917. output.wav
  2918. @end example
  2919. @end itemize
  2920. @section highpass
  2921. Apply a high-pass filter with 3dB point frequency.
  2922. The filter can be either single-pole, or double-pole (the default).
  2923. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2924. The filter accepts the following options:
  2925. @table @option
  2926. @item frequency, f
  2927. Set frequency in Hz. Default is 3000.
  2928. @item poles, p
  2929. Set number of poles. Default is 2.
  2930. @item width_type, t
  2931. Set method to specify band-width of filter.
  2932. @table @option
  2933. @item h
  2934. Hz
  2935. @item q
  2936. Q-Factor
  2937. @item o
  2938. octave
  2939. @item s
  2940. slope
  2941. @item k
  2942. kHz
  2943. @end table
  2944. @item width, w
  2945. Specify the band-width of a filter in width_type units.
  2946. Applies only to double-pole filter.
  2947. The default is 0.707q and gives a Butterworth response.
  2948. @item mix, m
  2949. How much to use filtered signal in output. Default is 1.
  2950. Range is between 0 and 1.
  2951. @item channels, c
  2952. Specify which channels to filter, by default all available are filtered.
  2953. @end table
  2954. @subsection Commands
  2955. This filter supports the following commands:
  2956. @table @option
  2957. @item frequency, f
  2958. Change highpass frequency.
  2959. Syntax for the command is : "@var{frequency}"
  2960. @item width_type, t
  2961. Change highpass width_type.
  2962. Syntax for the command is : "@var{width_type}"
  2963. @item width, w
  2964. Change highpass width.
  2965. Syntax for the command is : "@var{width}"
  2966. @item mix, m
  2967. Change highpass mix.
  2968. Syntax for the command is : "@var{mix}"
  2969. @end table
  2970. @section join
  2971. Join multiple input streams into one multi-channel stream.
  2972. It accepts the following parameters:
  2973. @table @option
  2974. @item inputs
  2975. The number of input streams. It defaults to 2.
  2976. @item channel_layout
  2977. The desired output channel layout. It defaults to stereo.
  2978. @item map
  2979. Map channels from inputs to output. The argument is a '|'-separated list of
  2980. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2981. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2982. can be either the name of the input channel (e.g. FL for front left) or its
  2983. index in the specified input stream. @var{out_channel} is the name of the output
  2984. channel.
  2985. @end table
  2986. The filter will attempt to guess the mappings when they are not specified
  2987. explicitly. It does so by first trying to find an unused matching input channel
  2988. and if that fails it picks the first unused input channel.
  2989. Join 3 inputs (with properly set channel layouts):
  2990. @example
  2991. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2992. @end example
  2993. Build a 5.1 output from 6 single-channel streams:
  2994. @example
  2995. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2996. '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'
  2997. out
  2998. @end example
  2999. @section ladspa
  3000. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3001. To enable compilation of this filter you need to configure FFmpeg with
  3002. @code{--enable-ladspa}.
  3003. @table @option
  3004. @item file, f
  3005. Specifies the name of LADSPA plugin library to load. If the environment
  3006. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3007. each one of the directories specified by the colon separated list in
  3008. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3009. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3010. @file{/usr/lib/ladspa/}.
  3011. @item plugin, p
  3012. Specifies the plugin within the library. Some libraries contain only
  3013. one plugin, but others contain many of them. If this is not set filter
  3014. will list all available plugins within the specified library.
  3015. @item controls, c
  3016. Set the '|' separated list of controls which are zero or more floating point
  3017. values that determine the behavior of the loaded plugin (for example delay,
  3018. threshold or gain).
  3019. Controls need to be defined using the following syntax:
  3020. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3021. @var{valuei} is the value set on the @var{i}-th control.
  3022. Alternatively they can be also defined using the following syntax:
  3023. @var{value0}|@var{value1}|@var{value2}|..., where
  3024. @var{valuei} is the value set on the @var{i}-th control.
  3025. If @option{controls} is set to @code{help}, all available controls and
  3026. their valid ranges are printed.
  3027. @item sample_rate, s
  3028. Specify the sample rate, default to 44100. Only used if plugin have
  3029. zero inputs.
  3030. @item nb_samples, n
  3031. Set the number of samples per channel per each output frame, default
  3032. is 1024. Only used if plugin have zero inputs.
  3033. @item duration, d
  3034. Set the minimum duration of the sourced audio. See
  3035. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3036. for the accepted syntax.
  3037. Note that the resulting duration may be greater than the specified duration,
  3038. as the generated audio is always cut at the end of a complete frame.
  3039. If not specified, or the expressed duration is negative, the audio is
  3040. supposed to be generated forever.
  3041. Only used if plugin have zero inputs.
  3042. @end table
  3043. @subsection Examples
  3044. @itemize
  3045. @item
  3046. List all available plugins within amp (LADSPA example plugin) library:
  3047. @example
  3048. ladspa=file=amp
  3049. @end example
  3050. @item
  3051. List all available controls and their valid ranges for @code{vcf_notch}
  3052. plugin from @code{VCF} library:
  3053. @example
  3054. ladspa=f=vcf:p=vcf_notch:c=help
  3055. @end example
  3056. @item
  3057. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3058. plugin library:
  3059. @example
  3060. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3061. @end example
  3062. @item
  3063. Add reverberation to the audio using TAP-plugins
  3064. (Tom's Audio Processing plugins):
  3065. @example
  3066. ladspa=file=tap_reverb:tap_reverb
  3067. @end example
  3068. @item
  3069. Generate white noise, with 0.2 amplitude:
  3070. @example
  3071. ladspa=file=cmt:noise_source_white:c=c0=.2
  3072. @end example
  3073. @item
  3074. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3075. @code{C* Audio Plugin Suite} (CAPS) library:
  3076. @example
  3077. ladspa=file=caps:Click:c=c1=20'
  3078. @end example
  3079. @item
  3080. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3081. @example
  3082. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3083. @end example
  3084. @item
  3085. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3086. @code{SWH Plugins} collection:
  3087. @example
  3088. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3089. @end example
  3090. @item
  3091. Attenuate low frequencies using Multiband EQ from Steve Harris
  3092. @code{SWH Plugins} collection:
  3093. @example
  3094. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3095. @end example
  3096. @item
  3097. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3098. (CAPS) library:
  3099. @example
  3100. ladspa=caps:Narrower
  3101. @end example
  3102. @item
  3103. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3104. @example
  3105. ladspa=caps:White:.2
  3106. @end example
  3107. @item
  3108. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3109. @example
  3110. ladspa=caps:Fractal:c=c1=1
  3111. @end example
  3112. @item
  3113. Dynamic volume normalization using @code{VLevel} plugin:
  3114. @example
  3115. ladspa=vlevel-ladspa:vlevel_mono
  3116. @end example
  3117. @end itemize
  3118. @subsection Commands
  3119. This filter supports the following commands:
  3120. @table @option
  3121. @item cN
  3122. Modify the @var{N}-th control value.
  3123. If the specified value is not valid, it is ignored and prior one is kept.
  3124. @end table
  3125. @section loudnorm
  3126. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3127. Support for both single pass (livestreams, files) and double pass (files) modes.
  3128. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  3129. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  3130. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3131. The filter accepts the following options:
  3132. @table @option
  3133. @item I, i
  3134. Set integrated loudness target.
  3135. Range is -70.0 - -5.0. Default value is -24.0.
  3136. @item LRA, lra
  3137. Set loudness range target.
  3138. Range is 1.0 - 20.0. Default value is 7.0.
  3139. @item TP, tp
  3140. Set maximum true peak.
  3141. Range is -9.0 - +0.0. Default value is -2.0.
  3142. @item measured_I, measured_i
  3143. Measured IL of input file.
  3144. Range is -99.0 - +0.0.
  3145. @item measured_LRA, measured_lra
  3146. Measured LRA of input file.
  3147. Range is 0.0 - 99.0.
  3148. @item measured_TP, measured_tp
  3149. Measured true peak of input file.
  3150. Range is -99.0 - +99.0.
  3151. @item measured_thresh
  3152. Measured threshold of input file.
  3153. Range is -99.0 - +0.0.
  3154. @item offset
  3155. Set offset gain. Gain is applied before the true-peak limiter.
  3156. Range is -99.0 - +99.0. Default is +0.0.
  3157. @item linear
  3158. Normalize linearly if possible.
  3159. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  3160. to be specified in order to use this mode.
  3161. Options are true or false. Default is true.
  3162. @item dual_mono
  3163. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3164. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3165. If set to @code{true}, this option will compensate for this effect.
  3166. Multi-channel input files are not affected by this option.
  3167. Options are true or false. Default is false.
  3168. @item print_format
  3169. Set print format for stats. Options are summary, json, or none.
  3170. Default value is none.
  3171. @end table
  3172. @section lowpass
  3173. Apply a low-pass filter with 3dB point frequency.
  3174. The filter can be either single-pole or double-pole (the default).
  3175. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3176. The filter accepts the following options:
  3177. @table @option
  3178. @item frequency, f
  3179. Set frequency in Hz. Default is 500.
  3180. @item poles, p
  3181. Set number of poles. Default is 2.
  3182. @item width_type, t
  3183. Set method to specify band-width of filter.
  3184. @table @option
  3185. @item h
  3186. Hz
  3187. @item q
  3188. Q-Factor
  3189. @item o
  3190. octave
  3191. @item s
  3192. slope
  3193. @item k
  3194. kHz
  3195. @end table
  3196. @item width, w
  3197. Specify the band-width of a filter in width_type units.
  3198. Applies only to double-pole filter.
  3199. The default is 0.707q and gives a Butterworth response.
  3200. @item mix, m
  3201. How much to use filtered signal in output. Default is 1.
  3202. Range is between 0 and 1.
  3203. @item channels, c
  3204. Specify which channels to filter, by default all available are filtered.
  3205. @end table
  3206. @subsection Examples
  3207. @itemize
  3208. @item
  3209. Lowpass only LFE channel, it LFE is not present it does nothing:
  3210. @example
  3211. lowpass=c=LFE
  3212. @end example
  3213. @end itemize
  3214. @subsection Commands
  3215. This filter supports the following commands:
  3216. @table @option
  3217. @item frequency, f
  3218. Change lowpass frequency.
  3219. Syntax for the command is : "@var{frequency}"
  3220. @item width_type, t
  3221. Change lowpass width_type.
  3222. Syntax for the command is : "@var{width_type}"
  3223. @item width, w
  3224. Change lowpass width.
  3225. Syntax for the command is : "@var{width}"
  3226. @item mix, m
  3227. Change lowpass mix.
  3228. Syntax for the command is : "@var{mix}"
  3229. @end table
  3230. @section lv2
  3231. Load a LV2 (LADSPA Version 2) plugin.
  3232. To enable compilation of this filter you need to configure FFmpeg with
  3233. @code{--enable-lv2}.
  3234. @table @option
  3235. @item plugin, p
  3236. Specifies the plugin URI. You may need to escape ':'.
  3237. @item controls, c
  3238. Set the '|' separated list of controls which are zero or more floating point
  3239. values that determine the behavior of the loaded plugin (for example delay,
  3240. threshold or gain).
  3241. If @option{controls} is set to @code{help}, all available controls and
  3242. their valid ranges are printed.
  3243. @item sample_rate, s
  3244. Specify the sample rate, default to 44100. Only used if plugin have
  3245. zero inputs.
  3246. @item nb_samples, n
  3247. Set the number of samples per channel per each output frame, default
  3248. is 1024. Only used if plugin have zero inputs.
  3249. @item duration, d
  3250. Set the minimum duration of the sourced audio. See
  3251. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3252. for the accepted syntax.
  3253. Note that the resulting duration may be greater than the specified duration,
  3254. as the generated audio is always cut at the end of a complete frame.
  3255. If not specified, or the expressed duration is negative, the audio is
  3256. supposed to be generated forever.
  3257. Only used if plugin have zero inputs.
  3258. @end table
  3259. @subsection Examples
  3260. @itemize
  3261. @item
  3262. Apply bass enhancer plugin from Calf:
  3263. @example
  3264. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3265. @end example
  3266. @item
  3267. Apply vinyl plugin from Calf:
  3268. @example
  3269. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3270. @end example
  3271. @item
  3272. Apply bit crusher plugin from ArtyFX:
  3273. @example
  3274. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3275. @end example
  3276. @end itemize
  3277. @section mcompand
  3278. Multiband Compress or expand the audio's dynamic range.
  3279. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3280. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3281. response when absent compander action.
  3282. It accepts the following parameters:
  3283. @table @option
  3284. @item args
  3285. This option syntax is:
  3286. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3287. For explanation of each item refer to compand filter documentation.
  3288. @end table
  3289. @anchor{pan}
  3290. @section pan
  3291. Mix channels with specific gain levels. The filter accepts the output
  3292. channel layout followed by a set of channels definitions.
  3293. This filter is also designed to efficiently remap the channels of an audio
  3294. stream.
  3295. The filter accepts parameters of the form:
  3296. "@var{l}|@var{outdef}|@var{outdef}|..."
  3297. @table @option
  3298. @item l
  3299. output channel layout or number of channels
  3300. @item outdef
  3301. output channel specification, of the form:
  3302. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3303. @item out_name
  3304. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3305. number (c0, c1, etc.)
  3306. @item gain
  3307. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3308. @item in_name
  3309. input channel to use, see out_name for details; it is not possible to mix
  3310. named and numbered input channels
  3311. @end table
  3312. If the `=' in a channel specification is replaced by `<', then the gains for
  3313. that specification will be renormalized so that the total is 1, thus
  3314. avoiding clipping noise.
  3315. @subsection Mixing examples
  3316. For example, if you want to down-mix from stereo to mono, but with a bigger
  3317. factor for the left channel:
  3318. @example
  3319. pan=1c|c0=0.9*c0+0.1*c1
  3320. @end example
  3321. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3322. 7-channels surround:
  3323. @example
  3324. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3325. @end example
  3326. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3327. that should be preferred (see "-ac" option) unless you have very specific
  3328. needs.
  3329. @subsection Remapping examples
  3330. The channel remapping will be effective if, and only if:
  3331. @itemize
  3332. @item gain coefficients are zeroes or ones,
  3333. @item only one input per channel output,
  3334. @end itemize
  3335. If all these conditions are satisfied, the filter will notify the user ("Pure
  3336. channel mapping detected"), and use an optimized and lossless method to do the
  3337. remapping.
  3338. For example, if you have a 5.1 source and want a stereo audio stream by
  3339. dropping the extra channels:
  3340. @example
  3341. pan="stereo| c0=FL | c1=FR"
  3342. @end example
  3343. Given the same source, you can also switch front left and front right channels
  3344. and keep the input channel layout:
  3345. @example
  3346. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3347. @end example
  3348. If the input is a stereo audio stream, you can mute the front left channel (and
  3349. still keep the stereo channel layout) with:
  3350. @example
  3351. pan="stereo|c1=c1"
  3352. @end example
  3353. Still with a stereo audio stream input, you can copy the right channel in both
  3354. front left and right:
  3355. @example
  3356. pan="stereo| c0=FR | c1=FR"
  3357. @end example
  3358. @section replaygain
  3359. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3360. outputs it unchanged.
  3361. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3362. @section resample
  3363. Convert the audio sample format, sample rate and channel layout. It is
  3364. not meant to be used directly.
  3365. @section rubberband
  3366. Apply time-stretching and pitch-shifting with librubberband.
  3367. To enable compilation of this filter, you need to configure FFmpeg with
  3368. @code{--enable-librubberband}.
  3369. The filter accepts the following options:
  3370. @table @option
  3371. @item tempo
  3372. Set tempo scale factor.
  3373. @item pitch
  3374. Set pitch scale factor.
  3375. @item transients
  3376. Set transients detector.
  3377. Possible values are:
  3378. @table @var
  3379. @item crisp
  3380. @item mixed
  3381. @item smooth
  3382. @end table
  3383. @item detector
  3384. Set detector.
  3385. Possible values are:
  3386. @table @var
  3387. @item compound
  3388. @item percussive
  3389. @item soft
  3390. @end table
  3391. @item phase
  3392. Set phase.
  3393. Possible values are:
  3394. @table @var
  3395. @item laminar
  3396. @item independent
  3397. @end table
  3398. @item window
  3399. Set processing window size.
  3400. Possible values are:
  3401. @table @var
  3402. @item standard
  3403. @item short
  3404. @item long
  3405. @end table
  3406. @item smoothing
  3407. Set smoothing.
  3408. Possible values are:
  3409. @table @var
  3410. @item off
  3411. @item on
  3412. @end table
  3413. @item formant
  3414. Enable formant preservation when shift pitching.
  3415. Possible values are:
  3416. @table @var
  3417. @item shifted
  3418. @item preserved
  3419. @end table
  3420. @item pitchq
  3421. Set pitch quality.
  3422. Possible values are:
  3423. @table @var
  3424. @item quality
  3425. @item speed
  3426. @item consistency
  3427. @end table
  3428. @item channels
  3429. Set channels.
  3430. Possible values are:
  3431. @table @var
  3432. @item apart
  3433. @item together
  3434. @end table
  3435. @end table
  3436. @section sidechaincompress
  3437. This filter acts like normal compressor but has the ability to compress
  3438. detected signal using second input signal.
  3439. It needs two input streams and returns one output stream.
  3440. First input stream will be processed depending on second stream signal.
  3441. The filtered signal then can be filtered with other filters in later stages of
  3442. processing. See @ref{pan} and @ref{amerge} filter.
  3443. The filter accepts the following options:
  3444. @table @option
  3445. @item level_in
  3446. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3447. @item mode
  3448. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3449. Default is @code{downward}.
  3450. @item threshold
  3451. If a signal of second stream raises above this level it will affect the gain
  3452. reduction of first stream.
  3453. By default is 0.125. Range is between 0.00097563 and 1.
  3454. @item ratio
  3455. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3456. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3457. Default is 2. Range is between 1 and 20.
  3458. @item attack
  3459. Amount of milliseconds the signal has to rise above the threshold before gain
  3460. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3461. @item release
  3462. Amount of milliseconds the signal has to fall below the threshold before
  3463. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3464. @item makeup
  3465. Set the amount by how much signal will be amplified after processing.
  3466. Default is 1. Range is from 1 to 64.
  3467. @item knee
  3468. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3469. Default is 2.82843. Range is between 1 and 8.
  3470. @item link
  3471. Choose if the @code{average} level between all channels of side-chain stream
  3472. or the louder(@code{maximum}) channel of side-chain stream affects the
  3473. reduction. Default is @code{average}.
  3474. @item detection
  3475. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3476. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3477. @item level_sc
  3478. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3479. @item mix
  3480. How much to use compressed signal in output. Default is 1.
  3481. Range is between 0 and 1.
  3482. @end table
  3483. @subsection Examples
  3484. @itemize
  3485. @item
  3486. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3487. depending on the signal of 2nd input and later compressed signal to be
  3488. merged with 2nd input:
  3489. @example
  3490. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3491. @end example
  3492. @end itemize
  3493. @section sidechaingate
  3494. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3495. filter the detected signal before sending it to the gain reduction stage.
  3496. Normally a gate uses the full range signal to detect a level above the
  3497. threshold.
  3498. For example: If you cut all lower frequencies from your sidechain signal
  3499. the gate will decrease the volume of your track only if not enough highs
  3500. appear. With this technique you are able to reduce the resonation of a
  3501. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3502. guitar.
  3503. It needs two input streams and returns one output stream.
  3504. First input stream will be processed depending on second stream signal.
  3505. The filter accepts the following options:
  3506. @table @option
  3507. @item level_in
  3508. Set input level before filtering.
  3509. Default is 1. Allowed range is from 0.015625 to 64.
  3510. @item mode
  3511. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3512. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3513. will be amplified, expanding dynamic range in upward direction.
  3514. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3515. @item range
  3516. Set the level of gain reduction when the signal is below the threshold.
  3517. Default is 0.06125. Allowed range is from 0 to 1.
  3518. Setting this to 0 disables reduction and then filter behaves like expander.
  3519. @item threshold
  3520. If a signal rises above this level the gain reduction is released.
  3521. Default is 0.125. Allowed range is from 0 to 1.
  3522. @item ratio
  3523. Set a ratio about which the signal is reduced.
  3524. Default is 2. Allowed range is from 1 to 9000.
  3525. @item attack
  3526. Amount of milliseconds the signal has to rise above the threshold before gain
  3527. reduction stops.
  3528. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3529. @item release
  3530. Amount of milliseconds the signal has to fall below the threshold before the
  3531. reduction is increased again. Default is 250 milliseconds.
  3532. Allowed range is from 0.01 to 9000.
  3533. @item makeup
  3534. Set amount of amplification of signal after processing.
  3535. Default is 1. Allowed range is from 1 to 64.
  3536. @item knee
  3537. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3538. Default is 2.828427125. Allowed range is from 1 to 8.
  3539. @item detection
  3540. Choose if exact signal should be taken for detection or an RMS like one.
  3541. Default is rms. Can be peak or rms.
  3542. @item link
  3543. Choose if the average level between all channels or the louder channel affects
  3544. the reduction.
  3545. Default is average. Can be average or maximum.
  3546. @item level_sc
  3547. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3548. @end table
  3549. @section silencedetect
  3550. Detect silence in an audio stream.
  3551. This filter logs a message when it detects that the input audio volume is less
  3552. or equal to a noise tolerance value for a duration greater or equal to the
  3553. minimum detected noise duration.
  3554. The printed times and duration are expressed in seconds.
  3555. The filter accepts the following options:
  3556. @table @option
  3557. @item noise, n
  3558. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3559. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3560. @item duration, d
  3561. Set silence duration until notification (default is 2 seconds).
  3562. @item mono, m
  3563. Process each channel separately, instead of combined. By default is disabled.
  3564. @end table
  3565. @subsection Examples
  3566. @itemize
  3567. @item
  3568. Detect 5 seconds of silence with -50dB noise tolerance:
  3569. @example
  3570. silencedetect=n=-50dB:d=5
  3571. @end example
  3572. @item
  3573. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3574. tolerance in @file{silence.mp3}:
  3575. @example
  3576. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3577. @end example
  3578. @end itemize
  3579. @section silenceremove
  3580. Remove silence from the beginning, middle or end of the audio.
  3581. The filter accepts the following options:
  3582. @table @option
  3583. @item start_periods
  3584. This value is used to indicate if audio should be trimmed at beginning of
  3585. the audio. A value of zero indicates no silence should be trimmed from the
  3586. beginning. When specifying a non-zero value, it trims audio up until it
  3587. finds non-silence. Normally, when trimming silence from beginning of audio
  3588. the @var{start_periods} will be @code{1} but it can be increased to higher
  3589. values to trim all audio up to specific count of non-silence periods.
  3590. Default value is @code{0}.
  3591. @item start_duration
  3592. Specify the amount of time that non-silence must be detected before it stops
  3593. trimming audio. By increasing the duration, bursts of noises can be treated
  3594. as silence and trimmed off. Default value is @code{0}.
  3595. @item start_threshold
  3596. This indicates what sample value should be treated as silence. For digital
  3597. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3598. you may wish to increase the value to account for background noise.
  3599. Can be specified in dB (in case "dB" is appended to the specified value)
  3600. or amplitude ratio. Default value is @code{0}.
  3601. @item start_silence
  3602. Specify max duration of silence at beginning that will be kept after
  3603. trimming. Default is 0, which is equal to trimming all samples detected
  3604. as silence.
  3605. @item start_mode
  3606. Specify mode of detection of silence end in start of multi-channel audio.
  3607. Can be @var{any} or @var{all}. Default is @var{any}.
  3608. With @var{any}, any sample that is detected as non-silence will cause
  3609. stopped trimming of silence.
  3610. With @var{all}, only if all channels are detected as non-silence will cause
  3611. stopped trimming of silence.
  3612. @item stop_periods
  3613. Set the count for trimming silence from the end of audio.
  3614. To remove silence from the middle of a file, specify a @var{stop_periods}
  3615. that is negative. This value is then treated as a positive value and is
  3616. used to indicate the effect should restart processing as specified by
  3617. @var{start_periods}, making it suitable for removing periods of silence
  3618. in the middle of the audio.
  3619. Default value is @code{0}.
  3620. @item stop_duration
  3621. Specify a duration of silence that must exist before audio is not copied any
  3622. more. By specifying a higher duration, silence that is wanted can be left in
  3623. the audio.
  3624. Default value is @code{0}.
  3625. @item stop_threshold
  3626. This is the same as @option{start_threshold} but for trimming silence from
  3627. the end of audio.
  3628. Can be specified in dB (in case "dB" is appended to the specified value)
  3629. or amplitude ratio. Default value is @code{0}.
  3630. @item stop_silence
  3631. Specify max duration of silence at end that will be kept after
  3632. trimming. Default is 0, which is equal to trimming all samples detected
  3633. as silence.
  3634. @item stop_mode
  3635. Specify mode of detection of silence start in end of multi-channel audio.
  3636. Can be @var{any} or @var{all}. Default is @var{any}.
  3637. With @var{any}, any sample that is detected as non-silence will cause
  3638. stopped trimming of silence.
  3639. With @var{all}, only if all channels are detected as non-silence will cause
  3640. stopped trimming of silence.
  3641. @item detection
  3642. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3643. and works better with digital silence which is exactly 0.
  3644. Default value is @code{rms}.
  3645. @item window
  3646. Set duration in number of seconds used to calculate size of window in number
  3647. of samples for detecting silence.
  3648. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3649. @end table
  3650. @subsection Examples
  3651. @itemize
  3652. @item
  3653. The following example shows how this filter can be used to start a recording
  3654. that does not contain the delay at the start which usually occurs between
  3655. pressing the record button and the start of the performance:
  3656. @example
  3657. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3658. @end example
  3659. @item
  3660. Trim all silence encountered from beginning to end where there is more than 1
  3661. second of silence in audio:
  3662. @example
  3663. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3664. @end example
  3665. @end itemize
  3666. @section sofalizer
  3667. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3668. loudspeakers around the user for binaural listening via headphones (audio
  3669. formats up to 9 channels supported).
  3670. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3671. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3672. Austrian Academy of Sciences.
  3673. To enable compilation of this filter you need to configure FFmpeg with
  3674. @code{--enable-libmysofa}.
  3675. The filter accepts the following options:
  3676. @table @option
  3677. @item sofa
  3678. Set the SOFA file used for rendering.
  3679. @item gain
  3680. Set gain applied to audio. Value is in dB. Default is 0.
  3681. @item rotation
  3682. Set rotation of virtual loudspeakers in deg. Default is 0.
  3683. @item elevation
  3684. Set elevation of virtual speakers in deg. Default is 0.
  3685. @item radius
  3686. Set distance in meters between loudspeakers and the listener with near-field
  3687. HRTFs. Default is 1.
  3688. @item type
  3689. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3690. processing audio in time domain which is slow.
  3691. @var{freq} is processing audio in frequency domain which is fast.
  3692. Default is @var{freq}.
  3693. @item speakers
  3694. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3695. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3696. Each virtual loudspeaker is described with short channel name following with
  3697. azimuth and elevation in degrees.
  3698. Each virtual loudspeaker description is separated by '|'.
  3699. For example to override front left and front right channel positions use:
  3700. 'speakers=FL 45 15|FR 345 15'.
  3701. Descriptions with unrecognised channel names are ignored.
  3702. @item lfegain
  3703. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3704. @item framesize
  3705. Set custom frame size in number of samples. Default is 1024.
  3706. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3707. is set to @var{freq}.
  3708. @item normalize
  3709. Should all IRs be normalized upon importing SOFA file.
  3710. By default is enabled.
  3711. @item interpolate
  3712. Should nearest IRs be interpolated with neighbor IRs if exact position
  3713. does not match. By default is disabled.
  3714. @item minphase
  3715. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3716. @item anglestep
  3717. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3718. @item radstep
  3719. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3720. @end table
  3721. @subsection Examples
  3722. @itemize
  3723. @item
  3724. Using ClubFritz6 sofa file:
  3725. @example
  3726. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3727. @end example
  3728. @item
  3729. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3730. @example
  3731. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3732. @end example
  3733. @item
  3734. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3735. and also with custom gain:
  3736. @example
  3737. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3738. @end example
  3739. @end itemize
  3740. @section stereotools
  3741. This filter has some handy utilities to manage stereo signals, for converting
  3742. M/S stereo recordings to L/R signal while having control over the parameters
  3743. or spreading the stereo image of master track.
  3744. The filter accepts the following options:
  3745. @table @option
  3746. @item level_in
  3747. Set input level before filtering for both channels. Defaults is 1.
  3748. Allowed range is from 0.015625 to 64.
  3749. @item level_out
  3750. Set output level after filtering for both channels. Defaults is 1.
  3751. Allowed range is from 0.015625 to 64.
  3752. @item balance_in
  3753. Set input balance between both channels. Default is 0.
  3754. Allowed range is from -1 to 1.
  3755. @item balance_out
  3756. Set output balance between both channels. Default is 0.
  3757. Allowed range is from -1 to 1.
  3758. @item softclip
  3759. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3760. clipping. Disabled by default.
  3761. @item mutel
  3762. Mute the left channel. Disabled by default.
  3763. @item muter
  3764. Mute the right channel. Disabled by default.
  3765. @item phasel
  3766. Change the phase of the left channel. Disabled by default.
  3767. @item phaser
  3768. Change the phase of the right channel. Disabled by default.
  3769. @item mode
  3770. Set stereo mode. Available values are:
  3771. @table @samp
  3772. @item lr>lr
  3773. Left/Right to Left/Right, this is default.
  3774. @item lr>ms
  3775. Left/Right to Mid/Side.
  3776. @item ms>lr
  3777. Mid/Side to Left/Right.
  3778. @item lr>ll
  3779. Left/Right to Left/Left.
  3780. @item lr>rr
  3781. Left/Right to Right/Right.
  3782. @item lr>l+r
  3783. Left/Right to Left + Right.
  3784. @item lr>rl
  3785. Left/Right to Right/Left.
  3786. @item ms>ll
  3787. Mid/Side to Left/Left.
  3788. @item ms>rr
  3789. Mid/Side to Right/Right.
  3790. @end table
  3791. @item slev
  3792. Set level of side signal. Default is 1.
  3793. Allowed range is from 0.015625 to 64.
  3794. @item sbal
  3795. Set balance of side signal. Default is 0.
  3796. Allowed range is from -1 to 1.
  3797. @item mlev
  3798. Set level of the middle signal. Default is 1.
  3799. Allowed range is from 0.015625 to 64.
  3800. @item mpan
  3801. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3802. @item base
  3803. Set stereo base between mono and inversed channels. Default is 0.
  3804. Allowed range is from -1 to 1.
  3805. @item delay
  3806. Set delay in milliseconds how much to delay left from right channel and
  3807. vice versa. Default is 0. Allowed range is from -20 to 20.
  3808. @item sclevel
  3809. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3810. @item phase
  3811. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3812. @item bmode_in, bmode_out
  3813. Set balance mode for balance_in/balance_out option.
  3814. Can be one of the following:
  3815. @table @samp
  3816. @item balance
  3817. Classic balance mode. Attenuate one channel at time.
  3818. Gain is raised up to 1.
  3819. @item amplitude
  3820. Similar as classic mode above but gain is raised up to 2.
  3821. @item power
  3822. Equal power distribution, from -6dB to +6dB range.
  3823. @end table
  3824. @end table
  3825. @subsection Examples
  3826. @itemize
  3827. @item
  3828. Apply karaoke like effect:
  3829. @example
  3830. stereotools=mlev=0.015625
  3831. @end example
  3832. @item
  3833. Convert M/S signal to L/R:
  3834. @example
  3835. "stereotools=mode=ms>lr"
  3836. @end example
  3837. @end itemize
  3838. @section stereowiden
  3839. This filter enhance the stereo effect by suppressing signal common to both
  3840. channels and by delaying the signal of left into right and vice versa,
  3841. thereby widening the stereo effect.
  3842. The filter accepts the following options:
  3843. @table @option
  3844. @item delay
  3845. Time in milliseconds of the delay of left signal into right and vice versa.
  3846. Default is 20 milliseconds.
  3847. @item feedback
  3848. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3849. effect of left signal in right output and vice versa which gives widening
  3850. effect. Default is 0.3.
  3851. @item crossfeed
  3852. Cross feed of left into right with inverted phase. This helps in suppressing
  3853. the mono. If the value is 1 it will cancel all the signal common to both
  3854. channels. Default is 0.3.
  3855. @item drymix
  3856. Set level of input signal of original channel. Default is 0.8.
  3857. @end table
  3858. @section superequalizer
  3859. Apply 18 band equalizer.
  3860. The filter accepts the following options:
  3861. @table @option
  3862. @item 1b
  3863. Set 65Hz band gain.
  3864. @item 2b
  3865. Set 92Hz band gain.
  3866. @item 3b
  3867. Set 131Hz band gain.
  3868. @item 4b
  3869. Set 185Hz band gain.
  3870. @item 5b
  3871. Set 262Hz band gain.
  3872. @item 6b
  3873. Set 370Hz band gain.
  3874. @item 7b
  3875. Set 523Hz band gain.
  3876. @item 8b
  3877. Set 740Hz band gain.
  3878. @item 9b
  3879. Set 1047Hz band gain.
  3880. @item 10b
  3881. Set 1480Hz band gain.
  3882. @item 11b
  3883. Set 2093Hz band gain.
  3884. @item 12b
  3885. Set 2960Hz band gain.
  3886. @item 13b
  3887. Set 4186Hz band gain.
  3888. @item 14b
  3889. Set 5920Hz band gain.
  3890. @item 15b
  3891. Set 8372Hz band gain.
  3892. @item 16b
  3893. Set 11840Hz band gain.
  3894. @item 17b
  3895. Set 16744Hz band gain.
  3896. @item 18b
  3897. Set 20000Hz band gain.
  3898. @end table
  3899. @section surround
  3900. Apply audio surround upmix filter.
  3901. This filter allows to produce multichannel output from audio stream.
  3902. The filter accepts the following options:
  3903. @table @option
  3904. @item chl_out
  3905. Set output channel layout. By default, this is @var{5.1}.
  3906. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3907. for the required syntax.
  3908. @item chl_in
  3909. Set input channel layout. By default, this is @var{stereo}.
  3910. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3911. for the required syntax.
  3912. @item level_in
  3913. Set input volume level. By default, this is @var{1}.
  3914. @item level_out
  3915. Set output volume level. By default, this is @var{1}.
  3916. @item lfe
  3917. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3918. @item lfe_low
  3919. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3920. @item lfe_high
  3921. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3922. @item lfe_mode
  3923. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  3924. In @var{add} mode, LFE channel is created from input audio and added to output.
  3925. In @var{sub} mode, LFE channel is created from input audio and added to output but
  3926. also all non-LFE output channels are subtracted with output LFE channel.
  3927. @item angle
  3928. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  3929. Default is @var{90}.
  3930. @item fc_in
  3931. Set front center input volume. By default, this is @var{1}.
  3932. @item fc_out
  3933. Set front center output volume. By default, this is @var{1}.
  3934. @item fl_in
  3935. Set front left input volume. By default, this is @var{1}.
  3936. @item fl_out
  3937. Set front left output volume. By default, this is @var{1}.
  3938. @item fr_in
  3939. Set front right input volume. By default, this is @var{1}.
  3940. @item fr_out
  3941. Set front right output volume. By default, this is @var{1}.
  3942. @item sl_in
  3943. Set side left input volume. By default, this is @var{1}.
  3944. @item sl_out
  3945. Set side left output volume. By default, this is @var{1}.
  3946. @item sr_in
  3947. Set side right input volume. By default, this is @var{1}.
  3948. @item sr_out
  3949. Set side right output volume. By default, this is @var{1}.
  3950. @item bl_in
  3951. Set back left input volume. By default, this is @var{1}.
  3952. @item bl_out
  3953. Set back left output volume. By default, this is @var{1}.
  3954. @item br_in
  3955. Set back right input volume. By default, this is @var{1}.
  3956. @item br_out
  3957. Set back right output volume. By default, this is @var{1}.
  3958. @item bc_in
  3959. Set back center input volume. By default, this is @var{1}.
  3960. @item bc_out
  3961. Set back center output volume. By default, this is @var{1}.
  3962. @item lfe_in
  3963. Set LFE input volume. By default, this is @var{1}.
  3964. @item lfe_out
  3965. Set LFE output volume. By default, this is @var{1}.
  3966. @item allx
  3967. Set spread usage of stereo image across X axis for all channels.
  3968. @item ally
  3969. Set spread usage of stereo image across Y axis for all channels.
  3970. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  3971. Set spread usage of stereo image across X axis for each channel.
  3972. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  3973. Set spread usage of stereo image across Y axis for each channel.
  3974. @item win_size
  3975. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  3976. @item win_func
  3977. Set window function.
  3978. It accepts the following values:
  3979. @table @samp
  3980. @item rect
  3981. @item bartlett
  3982. @item hann, hanning
  3983. @item hamming
  3984. @item blackman
  3985. @item welch
  3986. @item flattop
  3987. @item bharris
  3988. @item bnuttall
  3989. @item bhann
  3990. @item sine
  3991. @item nuttall
  3992. @item lanczos
  3993. @item gauss
  3994. @item tukey
  3995. @item dolph
  3996. @item cauchy
  3997. @item parzen
  3998. @item poisson
  3999. @item bohman
  4000. @end table
  4001. Default is @code{hann}.
  4002. @item overlap
  4003. Set window overlap. If set to 1, the recommended overlap for selected
  4004. window function will be picked. Default is @code{0.5}.
  4005. @end table
  4006. @section treble, highshelf
  4007. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4008. shelving filter with a response similar to that of a standard
  4009. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4010. The filter accepts the following options:
  4011. @table @option
  4012. @item gain, g
  4013. Give the gain at whichever is the lower of ~22 kHz and the
  4014. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4015. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4016. @item frequency, f
  4017. Set the filter's central frequency and so can be used
  4018. to extend or reduce the frequency range to be boosted or cut.
  4019. The default value is @code{3000} Hz.
  4020. @item width_type, t
  4021. Set method to specify band-width of filter.
  4022. @table @option
  4023. @item h
  4024. Hz
  4025. @item q
  4026. Q-Factor
  4027. @item o
  4028. octave
  4029. @item s
  4030. slope
  4031. @item k
  4032. kHz
  4033. @end table
  4034. @item width, w
  4035. Determine how steep is the filter's shelf transition.
  4036. @item mix, m
  4037. How much to use filtered signal in output. Default is 1.
  4038. Range is between 0 and 1.
  4039. @item channels, c
  4040. Specify which channels to filter, by default all available are filtered.
  4041. @end table
  4042. @subsection Commands
  4043. This filter supports the following commands:
  4044. @table @option
  4045. @item frequency, f
  4046. Change treble frequency.
  4047. Syntax for the command is : "@var{frequency}"
  4048. @item width_type, t
  4049. Change treble width_type.
  4050. Syntax for the command is : "@var{width_type}"
  4051. @item width, w
  4052. Change treble width.
  4053. Syntax for the command is : "@var{width}"
  4054. @item gain, g
  4055. Change treble gain.
  4056. Syntax for the command is : "@var{gain}"
  4057. @item mix, m
  4058. Change treble mix.
  4059. Syntax for the command is : "@var{mix}"
  4060. @end table
  4061. @section tremolo
  4062. Sinusoidal amplitude modulation.
  4063. The filter accepts the following options:
  4064. @table @option
  4065. @item f
  4066. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4067. (20 Hz or lower) will result in a tremolo effect.
  4068. This filter may also be used as a ring modulator by specifying
  4069. a modulation frequency higher than 20 Hz.
  4070. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4071. @item d
  4072. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4073. Default value is 0.5.
  4074. @end table
  4075. @section vibrato
  4076. Sinusoidal phase modulation.
  4077. The filter accepts the following options:
  4078. @table @option
  4079. @item f
  4080. Modulation frequency in Hertz.
  4081. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4082. @item d
  4083. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4084. Default value is 0.5.
  4085. @end table
  4086. @section volume
  4087. Adjust the input audio volume.
  4088. It accepts the following parameters:
  4089. @table @option
  4090. @item volume
  4091. Set audio volume expression.
  4092. Output values are clipped to the maximum value.
  4093. The output audio volume is given by the relation:
  4094. @example
  4095. @var{output_volume} = @var{volume} * @var{input_volume}
  4096. @end example
  4097. The default value for @var{volume} is "1.0".
  4098. @item precision
  4099. This parameter represents the mathematical precision.
  4100. It determines which input sample formats will be allowed, which affects the
  4101. precision of the volume scaling.
  4102. @table @option
  4103. @item fixed
  4104. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4105. @item float
  4106. 32-bit floating-point; this limits input sample format to FLT. (default)
  4107. @item double
  4108. 64-bit floating-point; this limits input sample format to DBL.
  4109. @end table
  4110. @item replaygain
  4111. Choose the behaviour on encountering ReplayGain side data in input frames.
  4112. @table @option
  4113. @item drop
  4114. Remove ReplayGain side data, ignoring its contents (the default).
  4115. @item ignore
  4116. Ignore ReplayGain side data, but leave it in the frame.
  4117. @item track
  4118. Prefer the track gain, if present.
  4119. @item album
  4120. Prefer the album gain, if present.
  4121. @end table
  4122. @item replaygain_preamp
  4123. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4124. Default value for @var{replaygain_preamp} is 0.0.
  4125. @item eval
  4126. Set when the volume expression is evaluated.
  4127. It accepts the following values:
  4128. @table @samp
  4129. @item once
  4130. only evaluate expression once during the filter initialization, or
  4131. when the @samp{volume} command is sent
  4132. @item frame
  4133. evaluate expression for each incoming frame
  4134. @end table
  4135. Default value is @samp{once}.
  4136. @end table
  4137. The volume expression can contain the following parameters.
  4138. @table @option
  4139. @item n
  4140. frame number (starting at zero)
  4141. @item nb_channels
  4142. number of channels
  4143. @item nb_consumed_samples
  4144. number of samples consumed by the filter
  4145. @item nb_samples
  4146. number of samples in the current frame
  4147. @item pos
  4148. original frame position in the file
  4149. @item pts
  4150. frame PTS
  4151. @item sample_rate
  4152. sample rate
  4153. @item startpts
  4154. PTS at start of stream
  4155. @item startt
  4156. time at start of stream
  4157. @item t
  4158. frame time
  4159. @item tb
  4160. timestamp timebase
  4161. @item volume
  4162. last set volume value
  4163. @end table
  4164. Note that when @option{eval} is set to @samp{once} only the
  4165. @var{sample_rate} and @var{tb} variables are available, all other
  4166. variables will evaluate to NAN.
  4167. @subsection Commands
  4168. This filter supports the following commands:
  4169. @table @option
  4170. @item volume
  4171. Modify the volume expression.
  4172. The command accepts the same syntax of the corresponding option.
  4173. If the specified expression is not valid, it is kept at its current
  4174. value.
  4175. @item replaygain_noclip
  4176. Prevent clipping by limiting the gain applied.
  4177. Default value for @var{replaygain_noclip} is 1.
  4178. @end table
  4179. @subsection Examples
  4180. @itemize
  4181. @item
  4182. Halve the input audio volume:
  4183. @example
  4184. volume=volume=0.5
  4185. volume=volume=1/2
  4186. volume=volume=-6.0206dB
  4187. @end example
  4188. In all the above example the named key for @option{volume} can be
  4189. omitted, for example like in:
  4190. @example
  4191. volume=0.5
  4192. @end example
  4193. @item
  4194. Increase input audio power by 6 decibels using fixed-point precision:
  4195. @example
  4196. volume=volume=6dB:precision=fixed
  4197. @end example
  4198. @item
  4199. Fade volume after time 10 with an annihilation period of 5 seconds:
  4200. @example
  4201. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4202. @end example
  4203. @end itemize
  4204. @section volumedetect
  4205. Detect the volume of the input video.
  4206. The filter has no parameters. The input is not modified. Statistics about
  4207. the volume will be printed in the log when the input stream end is reached.
  4208. In particular it will show the mean volume (root mean square), maximum
  4209. volume (on a per-sample basis), and the beginning of a histogram of the
  4210. registered volume values (from the maximum value to a cumulated 1/1000 of
  4211. the samples).
  4212. All volumes are in decibels relative to the maximum PCM value.
  4213. @subsection Examples
  4214. Here is an excerpt of the output:
  4215. @example
  4216. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4217. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4218. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4219. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4220. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4221. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4222. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4223. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4224. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4225. @end example
  4226. It means that:
  4227. @itemize
  4228. @item
  4229. The mean square energy is approximately -27 dB, or 10^-2.7.
  4230. @item
  4231. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4232. @item
  4233. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4234. @end itemize
  4235. In other words, raising the volume by +4 dB does not cause any clipping,
  4236. raising it by +5 dB causes clipping for 6 samples, etc.
  4237. @c man end AUDIO FILTERS
  4238. @chapter Audio Sources
  4239. @c man begin AUDIO SOURCES
  4240. Below is a description of the currently available audio sources.
  4241. @section abuffer
  4242. Buffer audio frames, and make them available to the filter chain.
  4243. This source is mainly intended for a programmatic use, in particular
  4244. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4245. It accepts the following parameters:
  4246. @table @option
  4247. @item time_base
  4248. The timebase which will be used for timestamps of submitted frames. It must be
  4249. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4250. @item sample_rate
  4251. The sample rate of the incoming audio buffers.
  4252. @item sample_fmt
  4253. The sample format of the incoming audio buffers.
  4254. Either a sample format name or its corresponding integer representation from
  4255. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4256. @item channel_layout
  4257. The channel layout of the incoming audio buffers.
  4258. Either a channel layout name from channel_layout_map in
  4259. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4260. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4261. @item channels
  4262. The number of channels of the incoming audio buffers.
  4263. If both @var{channels} and @var{channel_layout} are specified, then they
  4264. must be consistent.
  4265. @end table
  4266. @subsection Examples
  4267. @example
  4268. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4269. @end example
  4270. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4271. Since the sample format with name "s16p" corresponds to the number
  4272. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4273. equivalent to:
  4274. @example
  4275. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4276. @end example
  4277. @section aevalsrc
  4278. Generate an audio signal specified by an expression.
  4279. This source accepts in input one or more expressions (one for each
  4280. channel), which are evaluated and used to generate a corresponding
  4281. audio signal.
  4282. This source accepts the following options:
  4283. @table @option
  4284. @item exprs
  4285. Set the '|'-separated expressions list for each separate channel. In case the
  4286. @option{channel_layout} option is not specified, the selected channel layout
  4287. depends on the number of provided expressions. Otherwise the last
  4288. specified expression is applied to the remaining output channels.
  4289. @item channel_layout, c
  4290. Set the channel layout. The number of channels in the specified layout
  4291. must be equal to the number of specified expressions.
  4292. @item duration, d
  4293. Set the minimum duration of the sourced audio. See
  4294. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4295. for the accepted syntax.
  4296. Note that the resulting duration may be greater than the specified
  4297. duration, as the generated audio is always cut at the end of a
  4298. complete frame.
  4299. If not specified, or the expressed duration is negative, the audio is
  4300. supposed to be generated forever.
  4301. @item nb_samples, n
  4302. Set the number of samples per channel per each output frame,
  4303. default to 1024.
  4304. @item sample_rate, s
  4305. Specify the sample rate, default to 44100.
  4306. @end table
  4307. Each expression in @var{exprs} can contain the following constants:
  4308. @table @option
  4309. @item n
  4310. number of the evaluated sample, starting from 0
  4311. @item t
  4312. time of the evaluated sample expressed in seconds, starting from 0
  4313. @item s
  4314. sample rate
  4315. @end table
  4316. @subsection Examples
  4317. @itemize
  4318. @item
  4319. Generate silence:
  4320. @example
  4321. aevalsrc=0
  4322. @end example
  4323. @item
  4324. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4325. 8000 Hz:
  4326. @example
  4327. aevalsrc="sin(440*2*PI*t):s=8000"
  4328. @end example
  4329. @item
  4330. Generate a two channels signal, specify the channel layout (Front
  4331. Center + Back Center) explicitly:
  4332. @example
  4333. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4334. @end example
  4335. @item
  4336. Generate white noise:
  4337. @example
  4338. aevalsrc="-2+random(0)"
  4339. @end example
  4340. @item
  4341. Generate an amplitude modulated signal:
  4342. @example
  4343. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4344. @end example
  4345. @item
  4346. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4347. @example
  4348. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4349. @end example
  4350. @end itemize
  4351. @section anullsrc
  4352. The null audio source, return unprocessed audio frames. It is mainly useful
  4353. as a template and to be employed in analysis / debugging tools, or as
  4354. the source for filters which ignore the input data (for example the sox
  4355. synth filter).
  4356. This source accepts the following options:
  4357. @table @option
  4358. @item channel_layout, cl
  4359. Specifies the channel layout, and can be either an integer or a string
  4360. representing a channel layout. The default value of @var{channel_layout}
  4361. is "stereo".
  4362. Check the channel_layout_map definition in
  4363. @file{libavutil/channel_layout.c} for the mapping between strings and
  4364. channel layout values.
  4365. @item sample_rate, r
  4366. Specifies the sample rate, and defaults to 44100.
  4367. @item nb_samples, n
  4368. Set the number of samples per requested frames.
  4369. @end table
  4370. @subsection Examples
  4371. @itemize
  4372. @item
  4373. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4374. @example
  4375. anullsrc=r=48000:cl=4
  4376. @end example
  4377. @item
  4378. Do the same operation with a more obvious syntax:
  4379. @example
  4380. anullsrc=r=48000:cl=mono
  4381. @end example
  4382. @end itemize
  4383. All the parameters need to be explicitly defined.
  4384. @section flite
  4385. Synthesize a voice utterance using the libflite library.
  4386. To enable compilation of this filter you need to configure FFmpeg with
  4387. @code{--enable-libflite}.
  4388. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4389. The filter accepts the following options:
  4390. @table @option
  4391. @item list_voices
  4392. If set to 1, list the names of the available voices and exit
  4393. immediately. Default value is 0.
  4394. @item nb_samples, n
  4395. Set the maximum number of samples per frame. Default value is 512.
  4396. @item textfile
  4397. Set the filename containing the text to speak.
  4398. @item text
  4399. Set the text to speak.
  4400. @item voice, v
  4401. Set the voice to use for the speech synthesis. Default value is
  4402. @code{kal}. See also the @var{list_voices} option.
  4403. @end table
  4404. @subsection Examples
  4405. @itemize
  4406. @item
  4407. Read from file @file{speech.txt}, and synthesize the text using the
  4408. standard flite voice:
  4409. @example
  4410. flite=textfile=speech.txt
  4411. @end example
  4412. @item
  4413. Read the specified text selecting the @code{slt} voice:
  4414. @example
  4415. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4416. @end example
  4417. @item
  4418. Input text to ffmpeg:
  4419. @example
  4420. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4421. @end example
  4422. @item
  4423. Make @file{ffplay} speak the specified text, using @code{flite} and
  4424. the @code{lavfi} device:
  4425. @example
  4426. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4427. @end example
  4428. @end itemize
  4429. For more information about libflite, check:
  4430. @url{http://www.festvox.org/flite/}
  4431. @section anoisesrc
  4432. Generate a noise audio signal.
  4433. The filter accepts the following options:
  4434. @table @option
  4435. @item sample_rate, r
  4436. Specify the sample rate. Default value is 48000 Hz.
  4437. @item amplitude, a
  4438. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4439. is 1.0.
  4440. @item duration, d
  4441. Specify the duration of the generated audio stream. Not specifying this option
  4442. results in noise with an infinite length.
  4443. @item color, colour, c
  4444. Specify the color of noise. Available noise colors are white, pink, brown,
  4445. blue and violet. Default color is white.
  4446. @item seed, s
  4447. Specify a value used to seed the PRNG.
  4448. @item nb_samples, n
  4449. Set the number of samples per each output frame, default is 1024.
  4450. @end table
  4451. @subsection Examples
  4452. @itemize
  4453. @item
  4454. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4455. @example
  4456. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4457. @end example
  4458. @end itemize
  4459. @section hilbert
  4460. Generate odd-tap Hilbert transform FIR coefficients.
  4461. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4462. the signal by 90 degrees.
  4463. This is used in many matrix coding schemes and for analytic signal generation.
  4464. The process is often written as a multiplication by i (or j), the imaginary unit.
  4465. The filter accepts the following options:
  4466. @table @option
  4467. @item sample_rate, s
  4468. Set sample rate, default is 44100.
  4469. @item taps, t
  4470. Set length of FIR filter, default is 22051.
  4471. @item nb_samples, n
  4472. Set number of samples per each frame.
  4473. @item win_func, w
  4474. Set window function to be used when generating FIR coefficients.
  4475. @end table
  4476. @section sinc
  4477. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4478. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4479. The filter accepts the following options:
  4480. @table @option
  4481. @item sample_rate, r
  4482. Set sample rate, default is 44100.
  4483. @item nb_samples, n
  4484. Set number of samples per each frame. Default is 1024.
  4485. @item hp
  4486. Set high-pass frequency. Default is 0.
  4487. @item lp
  4488. Set low-pass frequency. Default is 0.
  4489. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4490. is higher than 0 then filter will create band-pass filter coefficients,
  4491. otherwise band-reject filter coefficients.
  4492. @item phase
  4493. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4494. @item beta
  4495. Set Kaiser window beta.
  4496. @item att
  4497. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4498. @item round
  4499. Enable rounding, by default is disabled.
  4500. @item hptaps
  4501. Set number of taps for high-pass filter.
  4502. @item lptaps
  4503. Set number of taps for low-pass filter.
  4504. @end table
  4505. @section sine
  4506. Generate an audio signal made of a sine wave with amplitude 1/8.
  4507. The audio signal is bit-exact.
  4508. The filter accepts the following options:
  4509. @table @option
  4510. @item frequency, f
  4511. Set the carrier frequency. Default is 440 Hz.
  4512. @item beep_factor, b
  4513. Enable a periodic beep every second with frequency @var{beep_factor} times
  4514. the carrier frequency. Default is 0, meaning the beep is disabled.
  4515. @item sample_rate, r
  4516. Specify the sample rate, default is 44100.
  4517. @item duration, d
  4518. Specify the duration of the generated audio stream.
  4519. @item samples_per_frame
  4520. Set the number of samples per output frame.
  4521. The expression can contain the following constants:
  4522. @table @option
  4523. @item n
  4524. The (sequential) number of the output audio frame, starting from 0.
  4525. @item pts
  4526. The PTS (Presentation TimeStamp) of the output audio frame,
  4527. expressed in @var{TB} units.
  4528. @item t
  4529. The PTS of the output audio frame, expressed in seconds.
  4530. @item TB
  4531. The timebase of the output audio frames.
  4532. @end table
  4533. Default is @code{1024}.
  4534. @end table
  4535. @subsection Examples
  4536. @itemize
  4537. @item
  4538. Generate a simple 440 Hz sine wave:
  4539. @example
  4540. sine
  4541. @end example
  4542. @item
  4543. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4544. @example
  4545. sine=220:4:d=5
  4546. sine=f=220:b=4:d=5
  4547. sine=frequency=220:beep_factor=4:duration=5
  4548. @end example
  4549. @item
  4550. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4551. pattern:
  4552. @example
  4553. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4554. @end example
  4555. @end itemize
  4556. @c man end AUDIO SOURCES
  4557. @chapter Audio Sinks
  4558. @c man begin AUDIO SINKS
  4559. Below is a description of the currently available audio sinks.
  4560. @section abuffersink
  4561. Buffer audio frames, and make them available to the end of filter chain.
  4562. This sink is mainly intended for programmatic use, in particular
  4563. through the interface defined in @file{libavfilter/buffersink.h}
  4564. or the options system.
  4565. It accepts a pointer to an AVABufferSinkContext structure, which
  4566. defines the incoming buffers' formats, to be passed as the opaque
  4567. parameter to @code{avfilter_init_filter} for initialization.
  4568. @section anullsink
  4569. Null audio sink; do absolutely nothing with the input audio. It is
  4570. mainly useful as a template and for use in analysis / debugging
  4571. tools.
  4572. @c man end AUDIO SINKS
  4573. @chapter Video Filters
  4574. @c man begin VIDEO FILTERS
  4575. When you configure your FFmpeg build, you can disable any of the
  4576. existing filters using @code{--disable-filters}.
  4577. The configure output will show the video filters included in your
  4578. build.
  4579. Below is a description of the currently available video filters.
  4580. @section addroi
  4581. Mark a region of interest in a video frame.
  4582. The frame data is passed through unchanged, but metadata is attached
  4583. to the frame indicating regions of interest which can affect the
  4584. behaviour of later encoding. Multiple regions can be marked by
  4585. applying the filter multiple times.
  4586. @table @option
  4587. @item x
  4588. Region distance in pixels from the left edge of the frame.
  4589. @item y
  4590. Region distance in pixels from the top edge of the frame.
  4591. @item w
  4592. Region width in pixels.
  4593. @item h
  4594. Region height in pixels.
  4595. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  4596. and may contain the following variables:
  4597. @table @option
  4598. @item iw
  4599. Width of the input frame.
  4600. @item ih
  4601. Height of the input frame.
  4602. @end table
  4603. @item qoffset
  4604. Quantisation offset to apply within the region.
  4605. This must be a real value in the range -1 to +1. A value of zero
  4606. indicates no quality change. A negative value asks for better quality
  4607. (less quantisation), while a positive value asks for worse quality
  4608. (greater quantisation).
  4609. The range is calibrated so that the extreme values indicate the
  4610. largest possible offset - if the rest of the frame is encoded with the
  4611. worst possible quality, an offset of -1 indicates that this region
  4612. should be encoded with the best possible quality anyway. Intermediate
  4613. values are then interpolated in some codec-dependent way.
  4614. For example, in 10-bit H.264 the quantisation parameter varies between
  4615. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  4616. this region should be encoded with a QP around one-tenth of the full
  4617. range better than the rest of the frame. So, if most of the frame
  4618. were to be encoded with a QP of around 30, this region would get a QP
  4619. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  4620. An extreme value of -1 would indicate that this region should be
  4621. encoded with the best possible quality regardless of the treatment of
  4622. the rest of the frame - that is, should be encoded at a QP of -12.
  4623. @item clear
  4624. If set to true, remove any existing regions of interest marked on the
  4625. frame before adding the new one.
  4626. @end table
  4627. @subsection Examples
  4628. @itemize
  4629. @item
  4630. Mark the centre quarter of the frame as interesting.
  4631. @example
  4632. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  4633. @end example
  4634. @item
  4635. Mark the 100-pixel-wide region on the left edge of the frame as very
  4636. uninteresting (to be encoded at much lower quality than the rest of
  4637. the frame).
  4638. @example
  4639. addroi=0:0:100:ih:+1/5
  4640. @end example
  4641. @end itemize
  4642. @section alphaextract
  4643. Extract the alpha component from the input as a grayscale video. This
  4644. is especially useful with the @var{alphamerge} filter.
  4645. @section alphamerge
  4646. Add or replace the alpha component of the primary input with the
  4647. grayscale value of a second input. This is intended for use with
  4648. @var{alphaextract} to allow the transmission or storage of frame
  4649. sequences that have alpha in a format that doesn't support an alpha
  4650. channel.
  4651. For example, to reconstruct full frames from a normal YUV-encoded video
  4652. and a separate video created with @var{alphaextract}, you might use:
  4653. @example
  4654. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4655. @end example
  4656. Since this filter is designed for reconstruction, it operates on frame
  4657. sequences without considering timestamps, and terminates when either
  4658. input reaches end of stream. This will cause problems if your encoding
  4659. pipeline drops frames. If you're trying to apply an image as an
  4660. overlay to a video stream, consider the @var{overlay} filter instead.
  4661. @section amplify
  4662. Amplify differences between current pixel and pixels of adjacent frames in
  4663. same pixel location.
  4664. This filter accepts the following options:
  4665. @table @option
  4666. @item radius
  4667. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4668. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4669. @item factor
  4670. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4671. @item threshold
  4672. Set threshold for difference amplification. Any difference greater or equal to
  4673. this value will not alter source pixel. Default is 10.
  4674. Allowed range is from 0 to 65535.
  4675. @item tolerance
  4676. Set tolerance for difference amplification. Any difference lower to
  4677. this value will not alter source pixel. Default is 0.
  4678. Allowed range is from 0 to 65535.
  4679. @item low
  4680. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4681. This option controls maximum possible value that will decrease source pixel value.
  4682. @item high
  4683. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4684. This option controls maximum possible value that will increase source pixel value.
  4685. @item planes
  4686. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4687. @end table
  4688. @section ass
  4689. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4690. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4691. Substation Alpha) subtitles files.
  4692. This filter accepts the following option in addition to the common options from
  4693. the @ref{subtitles} filter:
  4694. @table @option
  4695. @item shaping
  4696. Set the shaping engine
  4697. Available values are:
  4698. @table @samp
  4699. @item auto
  4700. The default libass shaping engine, which is the best available.
  4701. @item simple
  4702. Fast, font-agnostic shaper that can do only substitutions
  4703. @item complex
  4704. Slower shaper using OpenType for substitutions and positioning
  4705. @end table
  4706. The default is @code{auto}.
  4707. @end table
  4708. @section atadenoise
  4709. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4710. The filter accepts the following options:
  4711. @table @option
  4712. @item 0a
  4713. Set threshold A for 1st plane. Default is 0.02.
  4714. Valid range is 0 to 0.3.
  4715. @item 0b
  4716. Set threshold B for 1st plane. Default is 0.04.
  4717. Valid range is 0 to 5.
  4718. @item 1a
  4719. Set threshold A for 2nd plane. Default is 0.02.
  4720. Valid range is 0 to 0.3.
  4721. @item 1b
  4722. Set threshold B for 2nd plane. Default is 0.04.
  4723. Valid range is 0 to 5.
  4724. @item 2a
  4725. Set threshold A for 3rd plane. Default is 0.02.
  4726. Valid range is 0 to 0.3.
  4727. @item 2b
  4728. Set threshold B for 3rd plane. Default is 0.04.
  4729. Valid range is 0 to 5.
  4730. Threshold A is designed to react on abrupt changes in the input signal and
  4731. threshold B is designed to react on continuous changes in the input signal.
  4732. @item s
  4733. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4734. number in range [5, 129].
  4735. @item p
  4736. Set what planes of frame filter will use for averaging. Default is all.
  4737. @end table
  4738. @section avgblur
  4739. Apply average blur filter.
  4740. The filter accepts the following options:
  4741. @table @option
  4742. @item sizeX
  4743. Set horizontal radius size.
  4744. @item planes
  4745. Set which planes to filter. By default all planes are filtered.
  4746. @item sizeY
  4747. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4748. Default is @code{0}.
  4749. @end table
  4750. @section bbox
  4751. Compute the bounding box for the non-black pixels in the input frame
  4752. luminance plane.
  4753. This filter computes the bounding box containing all the pixels with a
  4754. luminance value greater than the minimum allowed value.
  4755. The parameters describing the bounding box are printed on the filter
  4756. log.
  4757. The filter accepts the following option:
  4758. @table @option
  4759. @item min_val
  4760. Set the minimal luminance value. Default is @code{16}.
  4761. @end table
  4762. @section bitplanenoise
  4763. Show and measure bit plane noise.
  4764. The filter accepts the following options:
  4765. @table @option
  4766. @item bitplane
  4767. Set which plane to analyze. Default is @code{1}.
  4768. @item filter
  4769. Filter out noisy pixels from @code{bitplane} set above.
  4770. Default is disabled.
  4771. @end table
  4772. @section blackdetect
  4773. Detect video intervals that are (almost) completely black. Can be
  4774. useful to detect chapter transitions, commercials, or invalid
  4775. recordings. Output lines contains the time for the start, end and
  4776. duration of the detected black interval expressed in seconds.
  4777. In order to display the output lines, you need to set the loglevel at
  4778. least to the AV_LOG_INFO value.
  4779. The filter accepts the following options:
  4780. @table @option
  4781. @item black_min_duration, d
  4782. Set the minimum detected black duration expressed in seconds. It must
  4783. be a non-negative floating point number.
  4784. Default value is 2.0.
  4785. @item picture_black_ratio_th, pic_th
  4786. Set the threshold for considering a picture "black".
  4787. Express the minimum value for the ratio:
  4788. @example
  4789. @var{nb_black_pixels} / @var{nb_pixels}
  4790. @end example
  4791. for which a picture is considered black.
  4792. Default value is 0.98.
  4793. @item pixel_black_th, pix_th
  4794. Set the threshold for considering a pixel "black".
  4795. The threshold expresses the maximum pixel luminance value for which a
  4796. pixel is considered "black". The provided value is scaled according to
  4797. the following equation:
  4798. @example
  4799. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4800. @end example
  4801. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4802. the input video format, the range is [0-255] for YUV full-range
  4803. formats and [16-235] for YUV non full-range formats.
  4804. Default value is 0.10.
  4805. @end table
  4806. The following example sets the maximum pixel threshold to the minimum
  4807. value, and detects only black intervals of 2 or more seconds:
  4808. @example
  4809. blackdetect=d=2:pix_th=0.00
  4810. @end example
  4811. @section blackframe
  4812. Detect frames that are (almost) completely black. Can be useful to
  4813. detect chapter transitions or commercials. Output lines consist of
  4814. the frame number of the detected frame, the percentage of blackness,
  4815. the position in the file if known or -1 and the timestamp in seconds.
  4816. In order to display the output lines, you need to set the loglevel at
  4817. least to the AV_LOG_INFO value.
  4818. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4819. The value represents the percentage of pixels in the picture that
  4820. are below the threshold value.
  4821. It accepts the following parameters:
  4822. @table @option
  4823. @item amount
  4824. The percentage of the pixels that have to be below the threshold; it defaults to
  4825. @code{98}.
  4826. @item threshold, thresh
  4827. The threshold below which a pixel value is considered black; it defaults to
  4828. @code{32}.
  4829. @end table
  4830. @section blend, tblend
  4831. Blend two video frames into each other.
  4832. The @code{blend} filter takes two input streams and outputs one
  4833. stream, the first input is the "top" layer and second input is
  4834. "bottom" layer. By default, the output terminates when the longest input terminates.
  4835. The @code{tblend} (time blend) filter takes two consecutive frames
  4836. from one single stream, and outputs the result obtained by blending
  4837. the new frame on top of the old frame.
  4838. A description of the accepted options follows.
  4839. @table @option
  4840. @item c0_mode
  4841. @item c1_mode
  4842. @item c2_mode
  4843. @item c3_mode
  4844. @item all_mode
  4845. Set blend mode for specific pixel component or all pixel components in case
  4846. of @var{all_mode}. Default value is @code{normal}.
  4847. Available values for component modes are:
  4848. @table @samp
  4849. @item addition
  4850. @item grainmerge
  4851. @item and
  4852. @item average
  4853. @item burn
  4854. @item darken
  4855. @item difference
  4856. @item grainextract
  4857. @item divide
  4858. @item dodge
  4859. @item freeze
  4860. @item exclusion
  4861. @item extremity
  4862. @item glow
  4863. @item hardlight
  4864. @item hardmix
  4865. @item heat
  4866. @item lighten
  4867. @item linearlight
  4868. @item multiply
  4869. @item multiply128
  4870. @item negation
  4871. @item normal
  4872. @item or
  4873. @item overlay
  4874. @item phoenix
  4875. @item pinlight
  4876. @item reflect
  4877. @item screen
  4878. @item softlight
  4879. @item subtract
  4880. @item vividlight
  4881. @item xor
  4882. @end table
  4883. @item c0_opacity
  4884. @item c1_opacity
  4885. @item c2_opacity
  4886. @item c3_opacity
  4887. @item all_opacity
  4888. Set blend opacity for specific pixel component or all pixel components in case
  4889. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4890. @item c0_expr
  4891. @item c1_expr
  4892. @item c2_expr
  4893. @item c3_expr
  4894. @item all_expr
  4895. Set blend expression for specific pixel component or all pixel components in case
  4896. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4897. The expressions can use the following variables:
  4898. @table @option
  4899. @item N
  4900. The sequential number of the filtered frame, starting from @code{0}.
  4901. @item X
  4902. @item Y
  4903. the coordinates of the current sample
  4904. @item W
  4905. @item H
  4906. the width and height of currently filtered plane
  4907. @item SW
  4908. @item SH
  4909. Width and height scale for the plane being filtered. It is the
  4910. ratio between the dimensions of the current plane to the luma plane,
  4911. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4912. the luma plane and @code{0.5,0.5} for the chroma planes.
  4913. @item T
  4914. Time of the current frame, expressed in seconds.
  4915. @item TOP, A
  4916. Value of pixel component at current location for first video frame (top layer).
  4917. @item BOTTOM, B
  4918. Value of pixel component at current location for second video frame (bottom layer).
  4919. @end table
  4920. @end table
  4921. The @code{blend} filter also supports the @ref{framesync} options.
  4922. @subsection Examples
  4923. @itemize
  4924. @item
  4925. Apply transition from bottom layer to top layer in first 10 seconds:
  4926. @example
  4927. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4928. @end example
  4929. @item
  4930. Apply linear horizontal transition from top layer to bottom layer:
  4931. @example
  4932. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4933. @end example
  4934. @item
  4935. Apply 1x1 checkerboard effect:
  4936. @example
  4937. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4938. @end example
  4939. @item
  4940. Apply uncover left effect:
  4941. @example
  4942. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4943. @end example
  4944. @item
  4945. Apply uncover down effect:
  4946. @example
  4947. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4948. @end example
  4949. @item
  4950. Apply uncover up-left effect:
  4951. @example
  4952. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4953. @end example
  4954. @item
  4955. Split diagonally video and shows top and bottom layer on each side:
  4956. @example
  4957. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4958. @end example
  4959. @item
  4960. Display differences between the current and the previous frame:
  4961. @example
  4962. tblend=all_mode=grainextract
  4963. @end example
  4964. @end itemize
  4965. @section bm3d
  4966. Denoise frames using Block-Matching 3D algorithm.
  4967. The filter accepts the following options.
  4968. @table @option
  4969. @item sigma
  4970. Set denoising strength. Default value is 1.
  4971. Allowed range is from 0 to 999.9.
  4972. The denoising algorithm is very sensitive to sigma, so adjust it
  4973. according to the source.
  4974. @item block
  4975. Set local patch size. This sets dimensions in 2D.
  4976. @item bstep
  4977. Set sliding step for processing blocks. Default value is 4.
  4978. Allowed range is from 1 to 64.
  4979. Smaller values allows processing more reference blocks and is slower.
  4980. @item group
  4981. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  4982. When set to 1, no block matching is done. Larger values allows more blocks
  4983. in single group.
  4984. Allowed range is from 1 to 256.
  4985. @item range
  4986. Set radius for search block matching. Default is 9.
  4987. Allowed range is from 1 to INT32_MAX.
  4988. @item mstep
  4989. Set step between two search locations for block matching. Default is 1.
  4990. Allowed range is from 1 to 64. Smaller is slower.
  4991. @item thmse
  4992. Set threshold of mean square error for block matching. Valid range is 0 to
  4993. INT32_MAX.
  4994. @item hdthr
  4995. Set thresholding parameter for hard thresholding in 3D transformed domain.
  4996. Larger values results in stronger hard-thresholding filtering in frequency
  4997. domain.
  4998. @item estim
  4999. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5000. Default is @code{basic}.
  5001. @item ref
  5002. If enabled, filter will use 2nd stream for block matching.
  5003. Default is disabled for @code{basic} value of @var{estim} option,
  5004. and always enabled if value of @var{estim} is @code{final}.
  5005. @item planes
  5006. Set planes to filter. Default is all available except alpha.
  5007. @end table
  5008. @subsection Examples
  5009. @itemize
  5010. @item
  5011. Basic filtering with bm3d:
  5012. @example
  5013. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5014. @end example
  5015. @item
  5016. Same as above, but filtering only luma:
  5017. @example
  5018. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5019. @end example
  5020. @item
  5021. Same as above, but with both estimation modes:
  5022. @example
  5023. 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
  5024. @end example
  5025. @item
  5026. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5027. @example
  5028. 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
  5029. @end example
  5030. @end itemize
  5031. @section boxblur
  5032. Apply a boxblur algorithm to the input video.
  5033. It accepts the following parameters:
  5034. @table @option
  5035. @item luma_radius, lr
  5036. @item luma_power, lp
  5037. @item chroma_radius, cr
  5038. @item chroma_power, cp
  5039. @item alpha_radius, ar
  5040. @item alpha_power, ap
  5041. @end table
  5042. A description of the accepted options follows.
  5043. @table @option
  5044. @item luma_radius, lr
  5045. @item chroma_radius, cr
  5046. @item alpha_radius, ar
  5047. Set an expression for the box radius in pixels used for blurring the
  5048. corresponding input plane.
  5049. The radius value must be a non-negative number, and must not be
  5050. greater than the value of the expression @code{min(w,h)/2} for the
  5051. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5052. planes.
  5053. Default value for @option{luma_radius} is "2". If not specified,
  5054. @option{chroma_radius} and @option{alpha_radius} default to the
  5055. corresponding value set for @option{luma_radius}.
  5056. The expressions can contain the following constants:
  5057. @table @option
  5058. @item w
  5059. @item h
  5060. The input width and height in pixels.
  5061. @item cw
  5062. @item ch
  5063. The input chroma image width and height in pixels.
  5064. @item hsub
  5065. @item vsub
  5066. The horizontal and vertical chroma subsample values. For example, for the
  5067. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5068. @end table
  5069. @item luma_power, lp
  5070. @item chroma_power, cp
  5071. @item alpha_power, ap
  5072. Specify how many times the boxblur filter is applied to the
  5073. corresponding plane.
  5074. Default value for @option{luma_power} is 2. If not specified,
  5075. @option{chroma_power} and @option{alpha_power} default to the
  5076. corresponding value set for @option{luma_power}.
  5077. A value of 0 will disable the effect.
  5078. @end table
  5079. @subsection Examples
  5080. @itemize
  5081. @item
  5082. Apply a boxblur filter with the luma, chroma, and alpha radii
  5083. set to 2:
  5084. @example
  5085. boxblur=luma_radius=2:luma_power=1
  5086. boxblur=2:1
  5087. @end example
  5088. @item
  5089. Set the luma radius to 2, and alpha and chroma radius to 0:
  5090. @example
  5091. boxblur=2:1:cr=0:ar=0
  5092. @end example
  5093. @item
  5094. Set the luma and chroma radii to a fraction of the video dimension:
  5095. @example
  5096. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5097. @end example
  5098. @end itemize
  5099. @section bwdif
  5100. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5101. Deinterlacing Filter").
  5102. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5103. interpolation algorithms.
  5104. It accepts the following parameters:
  5105. @table @option
  5106. @item mode
  5107. The interlacing mode to adopt. It accepts one of the following values:
  5108. @table @option
  5109. @item 0, send_frame
  5110. Output one frame for each frame.
  5111. @item 1, send_field
  5112. Output one frame for each field.
  5113. @end table
  5114. The default value is @code{send_field}.
  5115. @item parity
  5116. The picture field parity assumed for the input interlaced video. It accepts one
  5117. of the following values:
  5118. @table @option
  5119. @item 0, tff
  5120. Assume the top field is first.
  5121. @item 1, bff
  5122. Assume the bottom field is first.
  5123. @item -1, auto
  5124. Enable automatic detection of field parity.
  5125. @end table
  5126. The default value is @code{auto}.
  5127. If the interlacing is unknown or the decoder does not export this information,
  5128. top field first will be assumed.
  5129. @item deint
  5130. Specify which frames to deinterlace. Accept one of the following
  5131. values:
  5132. @table @option
  5133. @item 0, all
  5134. Deinterlace all frames.
  5135. @item 1, interlaced
  5136. Only deinterlace frames marked as interlaced.
  5137. @end table
  5138. The default value is @code{all}.
  5139. @end table
  5140. @section chromahold
  5141. Remove all color information for all colors except for certain one.
  5142. The filter accepts the following options:
  5143. @table @option
  5144. @item color
  5145. The color which will not be replaced with neutral chroma.
  5146. @item similarity
  5147. Similarity percentage with the above color.
  5148. 0.01 matches only the exact key color, while 1.0 matches everything.
  5149. @item blend
  5150. Blend percentage.
  5151. 0.0 makes pixels either fully gray, or not gray at all.
  5152. Higher values result in more preserved color.
  5153. @item yuv
  5154. Signals that the color passed is already in YUV instead of RGB.
  5155. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5156. This can be used to pass exact YUV values as hexadecimal numbers.
  5157. @end table
  5158. @section chromakey
  5159. YUV colorspace color/chroma keying.
  5160. The filter accepts the following options:
  5161. @table @option
  5162. @item color
  5163. The color which will be replaced with transparency.
  5164. @item similarity
  5165. Similarity percentage with the key color.
  5166. 0.01 matches only the exact key color, while 1.0 matches everything.
  5167. @item blend
  5168. Blend percentage.
  5169. 0.0 makes pixels either fully transparent, or not transparent at all.
  5170. Higher values result in semi-transparent pixels, with a higher transparency
  5171. the more similar the pixels color is to the key color.
  5172. @item yuv
  5173. Signals that the color passed is already in YUV instead of RGB.
  5174. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5175. This can be used to pass exact YUV values as hexadecimal numbers.
  5176. @end table
  5177. @subsection Examples
  5178. @itemize
  5179. @item
  5180. Make every green pixel in the input image transparent:
  5181. @example
  5182. ffmpeg -i input.png -vf chromakey=green out.png
  5183. @end example
  5184. @item
  5185. Overlay a greenscreen-video on top of a static black background.
  5186. @example
  5187. 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
  5188. @end example
  5189. @end itemize
  5190. @section chromashift
  5191. Shift chroma pixels horizontally and/or vertically.
  5192. The filter accepts the following options:
  5193. @table @option
  5194. @item cbh
  5195. Set amount to shift chroma-blue horizontally.
  5196. @item cbv
  5197. Set amount to shift chroma-blue vertically.
  5198. @item crh
  5199. Set amount to shift chroma-red horizontally.
  5200. @item crv
  5201. Set amount to shift chroma-red vertically.
  5202. @item edge
  5203. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5204. @end table
  5205. @section ciescope
  5206. Display CIE color diagram with pixels overlaid onto it.
  5207. The filter accepts the following options:
  5208. @table @option
  5209. @item system
  5210. Set color system.
  5211. @table @samp
  5212. @item ntsc, 470m
  5213. @item ebu, 470bg
  5214. @item smpte
  5215. @item 240m
  5216. @item apple
  5217. @item widergb
  5218. @item cie1931
  5219. @item rec709, hdtv
  5220. @item uhdtv, rec2020
  5221. @item dcip3
  5222. @end table
  5223. @item cie
  5224. Set CIE system.
  5225. @table @samp
  5226. @item xyy
  5227. @item ucs
  5228. @item luv
  5229. @end table
  5230. @item gamuts
  5231. Set what gamuts to draw.
  5232. See @code{system} option for available values.
  5233. @item size, s
  5234. Set ciescope size, by default set to 512.
  5235. @item intensity, i
  5236. Set intensity used to map input pixel values to CIE diagram.
  5237. @item contrast
  5238. Set contrast used to draw tongue colors that are out of active color system gamut.
  5239. @item corrgamma
  5240. Correct gamma displayed on scope, by default enabled.
  5241. @item showwhite
  5242. Show white point on CIE diagram, by default disabled.
  5243. @item gamma
  5244. Set input gamma. Used only with XYZ input color space.
  5245. @end table
  5246. @section codecview
  5247. Visualize information exported by some codecs.
  5248. Some codecs can export information through frames using side-data or other
  5249. means. For example, some MPEG based codecs export motion vectors through the
  5250. @var{export_mvs} flag in the codec @option{flags2} option.
  5251. The filter accepts the following option:
  5252. @table @option
  5253. @item mv
  5254. Set motion vectors to visualize.
  5255. Available flags for @var{mv} are:
  5256. @table @samp
  5257. @item pf
  5258. forward predicted MVs of P-frames
  5259. @item bf
  5260. forward predicted MVs of B-frames
  5261. @item bb
  5262. backward predicted MVs of B-frames
  5263. @end table
  5264. @item qp
  5265. Display quantization parameters using the chroma planes.
  5266. @item mv_type, mvt
  5267. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5268. Available flags for @var{mv_type} are:
  5269. @table @samp
  5270. @item fp
  5271. forward predicted MVs
  5272. @item bp
  5273. backward predicted MVs
  5274. @end table
  5275. @item frame_type, ft
  5276. Set frame type to visualize motion vectors of.
  5277. Available flags for @var{frame_type} are:
  5278. @table @samp
  5279. @item if
  5280. intra-coded frames (I-frames)
  5281. @item pf
  5282. predicted frames (P-frames)
  5283. @item bf
  5284. bi-directionally predicted frames (B-frames)
  5285. @end table
  5286. @end table
  5287. @subsection Examples
  5288. @itemize
  5289. @item
  5290. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5291. @example
  5292. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5293. @end example
  5294. @item
  5295. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5296. @example
  5297. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5298. @end example
  5299. @end itemize
  5300. @section colorbalance
  5301. Modify intensity of primary colors (red, green and blue) of input frames.
  5302. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5303. regions for the red-cyan, green-magenta or blue-yellow balance.
  5304. A positive adjustment value shifts the balance towards the primary color, a negative
  5305. value towards the complementary color.
  5306. The filter accepts the following options:
  5307. @table @option
  5308. @item rs
  5309. @item gs
  5310. @item bs
  5311. Adjust red, green and blue shadows (darkest pixels).
  5312. @item rm
  5313. @item gm
  5314. @item bm
  5315. Adjust red, green and blue midtones (medium pixels).
  5316. @item rh
  5317. @item gh
  5318. @item bh
  5319. Adjust red, green and blue highlights (brightest pixels).
  5320. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5321. @end table
  5322. @subsection Examples
  5323. @itemize
  5324. @item
  5325. Add red color cast to shadows:
  5326. @example
  5327. colorbalance=rs=.3
  5328. @end example
  5329. @end itemize
  5330. @section colorkey
  5331. RGB colorspace color keying.
  5332. The filter accepts the following options:
  5333. @table @option
  5334. @item color
  5335. The color which will be replaced with transparency.
  5336. @item similarity
  5337. Similarity percentage with the key color.
  5338. 0.01 matches only the exact key color, while 1.0 matches everything.
  5339. @item blend
  5340. Blend percentage.
  5341. 0.0 makes pixels either fully transparent, or not transparent at all.
  5342. Higher values result in semi-transparent pixels, with a higher transparency
  5343. the more similar the pixels color is to the key color.
  5344. @end table
  5345. @subsection Examples
  5346. @itemize
  5347. @item
  5348. Make every green pixel in the input image transparent:
  5349. @example
  5350. ffmpeg -i input.png -vf colorkey=green out.png
  5351. @end example
  5352. @item
  5353. Overlay a greenscreen-video on top of a static background image.
  5354. @example
  5355. 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
  5356. @end example
  5357. @end itemize
  5358. @section colorhold
  5359. Remove all color information for all RGB colors except for certain one.
  5360. The filter accepts the following options:
  5361. @table @option
  5362. @item color
  5363. The color which will not be replaced with neutral gray.
  5364. @item similarity
  5365. Similarity percentage with the above color.
  5366. 0.01 matches only the exact key color, while 1.0 matches everything.
  5367. @item blend
  5368. Blend percentage. 0.0 makes pixels fully gray.
  5369. Higher values result in more preserved color.
  5370. @end table
  5371. @section colorlevels
  5372. Adjust video input frames using levels.
  5373. The filter accepts the following options:
  5374. @table @option
  5375. @item rimin
  5376. @item gimin
  5377. @item bimin
  5378. @item aimin
  5379. Adjust red, green, blue and alpha input black point.
  5380. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5381. @item rimax
  5382. @item gimax
  5383. @item bimax
  5384. @item aimax
  5385. Adjust red, green, blue and alpha input white point.
  5386. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5387. Input levels are used to lighten highlights (bright tones), darken shadows
  5388. (dark tones), change the balance of bright and dark tones.
  5389. @item romin
  5390. @item gomin
  5391. @item bomin
  5392. @item aomin
  5393. Adjust red, green, blue and alpha output black point.
  5394. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5395. @item romax
  5396. @item gomax
  5397. @item bomax
  5398. @item aomax
  5399. Adjust red, green, blue and alpha output white point.
  5400. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5401. Output levels allows manual selection of a constrained output level range.
  5402. @end table
  5403. @subsection Examples
  5404. @itemize
  5405. @item
  5406. Make video output darker:
  5407. @example
  5408. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5409. @end example
  5410. @item
  5411. Increase contrast:
  5412. @example
  5413. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5414. @end example
  5415. @item
  5416. Make video output lighter:
  5417. @example
  5418. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5419. @end example
  5420. @item
  5421. Increase brightness:
  5422. @example
  5423. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5424. @end example
  5425. @end itemize
  5426. @section colorchannelmixer
  5427. Adjust video input frames by re-mixing color channels.
  5428. This filter modifies a color channel by adding the values associated to
  5429. the other channels of the same pixels. For example if the value to
  5430. modify is red, the output value will be:
  5431. @example
  5432. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5433. @end example
  5434. The filter accepts the following options:
  5435. @table @option
  5436. @item rr
  5437. @item rg
  5438. @item rb
  5439. @item ra
  5440. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5441. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5442. @item gr
  5443. @item gg
  5444. @item gb
  5445. @item ga
  5446. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5447. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5448. @item br
  5449. @item bg
  5450. @item bb
  5451. @item ba
  5452. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5453. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5454. @item ar
  5455. @item ag
  5456. @item ab
  5457. @item aa
  5458. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5459. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5460. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5461. @end table
  5462. @subsection Examples
  5463. @itemize
  5464. @item
  5465. Convert source to grayscale:
  5466. @example
  5467. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5468. @end example
  5469. @item
  5470. Simulate sepia tones:
  5471. @example
  5472. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5473. @end example
  5474. @end itemize
  5475. @section colormatrix
  5476. Convert color matrix.
  5477. The filter accepts the following options:
  5478. @table @option
  5479. @item src
  5480. @item dst
  5481. Specify the source and destination color matrix. Both values must be
  5482. specified.
  5483. The accepted values are:
  5484. @table @samp
  5485. @item bt709
  5486. BT.709
  5487. @item fcc
  5488. FCC
  5489. @item bt601
  5490. BT.601
  5491. @item bt470
  5492. BT.470
  5493. @item bt470bg
  5494. BT.470BG
  5495. @item smpte170m
  5496. SMPTE-170M
  5497. @item smpte240m
  5498. SMPTE-240M
  5499. @item bt2020
  5500. BT.2020
  5501. @end table
  5502. @end table
  5503. For example to convert from BT.601 to SMPTE-240M, use the command:
  5504. @example
  5505. colormatrix=bt601:smpte240m
  5506. @end example
  5507. @section colorspace
  5508. Convert colorspace, transfer characteristics or color primaries.
  5509. Input video needs to have an even size.
  5510. The filter accepts the following options:
  5511. @table @option
  5512. @anchor{all}
  5513. @item all
  5514. Specify all color properties at once.
  5515. The accepted values are:
  5516. @table @samp
  5517. @item bt470m
  5518. BT.470M
  5519. @item bt470bg
  5520. BT.470BG
  5521. @item bt601-6-525
  5522. BT.601-6 525
  5523. @item bt601-6-625
  5524. BT.601-6 625
  5525. @item bt709
  5526. BT.709
  5527. @item smpte170m
  5528. SMPTE-170M
  5529. @item smpte240m
  5530. SMPTE-240M
  5531. @item bt2020
  5532. BT.2020
  5533. @end table
  5534. @anchor{space}
  5535. @item space
  5536. Specify output colorspace.
  5537. The accepted values are:
  5538. @table @samp
  5539. @item bt709
  5540. BT.709
  5541. @item fcc
  5542. FCC
  5543. @item bt470bg
  5544. BT.470BG or BT.601-6 625
  5545. @item smpte170m
  5546. SMPTE-170M or BT.601-6 525
  5547. @item smpte240m
  5548. SMPTE-240M
  5549. @item ycgco
  5550. YCgCo
  5551. @item bt2020ncl
  5552. BT.2020 with non-constant luminance
  5553. @end table
  5554. @anchor{trc}
  5555. @item trc
  5556. Specify output transfer characteristics.
  5557. The accepted values are:
  5558. @table @samp
  5559. @item bt709
  5560. BT.709
  5561. @item bt470m
  5562. BT.470M
  5563. @item bt470bg
  5564. BT.470BG
  5565. @item gamma22
  5566. Constant gamma of 2.2
  5567. @item gamma28
  5568. Constant gamma of 2.8
  5569. @item smpte170m
  5570. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5571. @item smpte240m
  5572. SMPTE-240M
  5573. @item srgb
  5574. SRGB
  5575. @item iec61966-2-1
  5576. iec61966-2-1
  5577. @item iec61966-2-4
  5578. iec61966-2-4
  5579. @item xvycc
  5580. xvycc
  5581. @item bt2020-10
  5582. BT.2020 for 10-bits content
  5583. @item bt2020-12
  5584. BT.2020 for 12-bits content
  5585. @end table
  5586. @anchor{primaries}
  5587. @item primaries
  5588. Specify output color primaries.
  5589. The accepted values are:
  5590. @table @samp
  5591. @item bt709
  5592. BT.709
  5593. @item bt470m
  5594. BT.470M
  5595. @item bt470bg
  5596. BT.470BG or BT.601-6 625
  5597. @item smpte170m
  5598. SMPTE-170M or BT.601-6 525
  5599. @item smpte240m
  5600. SMPTE-240M
  5601. @item film
  5602. film
  5603. @item smpte431
  5604. SMPTE-431
  5605. @item smpte432
  5606. SMPTE-432
  5607. @item bt2020
  5608. BT.2020
  5609. @item jedec-p22
  5610. JEDEC P22 phosphors
  5611. @end table
  5612. @anchor{range}
  5613. @item range
  5614. Specify output color range.
  5615. The accepted values are:
  5616. @table @samp
  5617. @item tv
  5618. TV (restricted) range
  5619. @item mpeg
  5620. MPEG (restricted) range
  5621. @item pc
  5622. PC (full) range
  5623. @item jpeg
  5624. JPEG (full) range
  5625. @end table
  5626. @item format
  5627. Specify output color format.
  5628. The accepted values are:
  5629. @table @samp
  5630. @item yuv420p
  5631. YUV 4:2:0 planar 8-bits
  5632. @item yuv420p10
  5633. YUV 4:2:0 planar 10-bits
  5634. @item yuv420p12
  5635. YUV 4:2:0 planar 12-bits
  5636. @item yuv422p
  5637. YUV 4:2:2 planar 8-bits
  5638. @item yuv422p10
  5639. YUV 4:2:2 planar 10-bits
  5640. @item yuv422p12
  5641. YUV 4:2:2 planar 12-bits
  5642. @item yuv444p
  5643. YUV 4:4:4 planar 8-bits
  5644. @item yuv444p10
  5645. YUV 4:4:4 planar 10-bits
  5646. @item yuv444p12
  5647. YUV 4:4:4 planar 12-bits
  5648. @end table
  5649. @item fast
  5650. Do a fast conversion, which skips gamma/primary correction. This will take
  5651. significantly less CPU, but will be mathematically incorrect. To get output
  5652. compatible with that produced by the colormatrix filter, use fast=1.
  5653. @item dither
  5654. Specify dithering mode.
  5655. The accepted values are:
  5656. @table @samp
  5657. @item none
  5658. No dithering
  5659. @item fsb
  5660. Floyd-Steinberg dithering
  5661. @end table
  5662. @item wpadapt
  5663. Whitepoint adaptation mode.
  5664. The accepted values are:
  5665. @table @samp
  5666. @item bradford
  5667. Bradford whitepoint adaptation
  5668. @item vonkries
  5669. von Kries whitepoint adaptation
  5670. @item identity
  5671. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5672. @end table
  5673. @item iall
  5674. Override all input properties at once. Same accepted values as @ref{all}.
  5675. @item ispace
  5676. Override input colorspace. Same accepted values as @ref{space}.
  5677. @item iprimaries
  5678. Override input color primaries. Same accepted values as @ref{primaries}.
  5679. @item itrc
  5680. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5681. @item irange
  5682. Override input color range. Same accepted values as @ref{range}.
  5683. @end table
  5684. The filter converts the transfer characteristics, color space and color
  5685. primaries to the specified user values. The output value, if not specified,
  5686. is set to a default value based on the "all" property. If that property is
  5687. also not specified, the filter will log an error. The output color range and
  5688. format default to the same value as the input color range and format. The
  5689. input transfer characteristics, color space, color primaries and color range
  5690. should be set on the input data. If any of these are missing, the filter will
  5691. log an error and no conversion will take place.
  5692. For example to convert the input to SMPTE-240M, use the command:
  5693. @example
  5694. colorspace=smpte240m
  5695. @end example
  5696. @section convolution
  5697. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5698. The filter accepts the following options:
  5699. @table @option
  5700. @item 0m
  5701. @item 1m
  5702. @item 2m
  5703. @item 3m
  5704. Set matrix for each plane.
  5705. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5706. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5707. @item 0rdiv
  5708. @item 1rdiv
  5709. @item 2rdiv
  5710. @item 3rdiv
  5711. Set multiplier for calculated value for each plane.
  5712. If unset or 0, it will be sum of all matrix elements.
  5713. @item 0bias
  5714. @item 1bias
  5715. @item 2bias
  5716. @item 3bias
  5717. Set bias for each plane. This value is added to the result of the multiplication.
  5718. Useful for making the overall image brighter or darker. Default is 0.0.
  5719. @item 0mode
  5720. @item 1mode
  5721. @item 2mode
  5722. @item 3mode
  5723. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5724. Default is @var{square}.
  5725. @end table
  5726. @subsection Examples
  5727. @itemize
  5728. @item
  5729. Apply sharpen:
  5730. @example
  5731. 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"
  5732. @end example
  5733. @item
  5734. Apply blur:
  5735. @example
  5736. 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"
  5737. @end example
  5738. @item
  5739. Apply edge enhance:
  5740. @example
  5741. 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"
  5742. @end example
  5743. @item
  5744. Apply edge detect:
  5745. @example
  5746. 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"
  5747. @end example
  5748. @item
  5749. Apply laplacian edge detector which includes diagonals:
  5750. @example
  5751. 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"
  5752. @end example
  5753. @item
  5754. Apply emboss:
  5755. @example
  5756. 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"
  5757. @end example
  5758. @end itemize
  5759. @section convolve
  5760. Apply 2D convolution of video stream in frequency domain using second stream
  5761. as impulse.
  5762. The filter accepts the following options:
  5763. @table @option
  5764. @item planes
  5765. Set which planes to process.
  5766. @item impulse
  5767. Set which impulse video frames will be processed, can be @var{first}
  5768. or @var{all}. Default is @var{all}.
  5769. @end table
  5770. The @code{convolve} filter also supports the @ref{framesync} options.
  5771. @section copy
  5772. Copy the input video source unchanged to the output. This is mainly useful for
  5773. testing purposes.
  5774. @anchor{coreimage}
  5775. @section coreimage
  5776. Video filtering on GPU using Apple's CoreImage API on OSX.
  5777. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5778. processed by video hardware. However, software-based OpenGL implementations
  5779. exist which means there is no guarantee for hardware processing. It depends on
  5780. the respective OSX.
  5781. There are many filters and image generators provided by Apple that come with a
  5782. large variety of options. The filter has to be referenced by its name along
  5783. with its options.
  5784. The coreimage filter accepts the following options:
  5785. @table @option
  5786. @item list_filters
  5787. List all available filters and generators along with all their respective
  5788. options as well as possible minimum and maximum values along with the default
  5789. values.
  5790. @example
  5791. list_filters=true
  5792. @end example
  5793. @item filter
  5794. Specify all filters by their respective name and options.
  5795. Use @var{list_filters} to determine all valid filter names and options.
  5796. Numerical options are specified by a float value and are automatically clamped
  5797. to their respective value range. Vector and color options have to be specified
  5798. by a list of space separated float values. Character escaping has to be done.
  5799. A special option name @code{default} is available to use default options for a
  5800. filter.
  5801. It is required to specify either @code{default} or at least one of the filter options.
  5802. All omitted options are used with their default values.
  5803. The syntax of the filter string is as follows:
  5804. @example
  5805. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5806. @end example
  5807. @item output_rect
  5808. Specify a rectangle where the output of the filter chain is copied into the
  5809. input image. It is given by a list of space separated float values:
  5810. @example
  5811. output_rect=x\ y\ width\ height
  5812. @end example
  5813. If not given, the output rectangle equals the dimensions of the input image.
  5814. The output rectangle is automatically cropped at the borders of the input
  5815. image. Negative values are valid for each component.
  5816. @example
  5817. output_rect=25\ 25\ 100\ 100
  5818. @end example
  5819. @end table
  5820. Several filters can be chained for successive processing without GPU-HOST
  5821. transfers allowing for fast processing of complex filter chains.
  5822. Currently, only filters with zero (generators) or exactly one (filters) input
  5823. image and one output image are supported. Also, transition filters are not yet
  5824. usable as intended.
  5825. Some filters generate output images with additional padding depending on the
  5826. respective filter kernel. The padding is automatically removed to ensure the
  5827. filter output has the same size as the input image.
  5828. For image generators, the size of the output image is determined by the
  5829. previous output image of the filter chain or the input image of the whole
  5830. filterchain, respectively. The generators do not use the pixel information of
  5831. this image to generate their output. However, the generated output is
  5832. blended onto this image, resulting in partial or complete coverage of the
  5833. output image.
  5834. The @ref{coreimagesrc} video source can be used for generating input images
  5835. which are directly fed into the filter chain. By using it, providing input
  5836. images by another video source or an input video is not required.
  5837. @subsection Examples
  5838. @itemize
  5839. @item
  5840. List all filters available:
  5841. @example
  5842. coreimage=list_filters=true
  5843. @end example
  5844. @item
  5845. Use the CIBoxBlur filter with default options to blur an image:
  5846. @example
  5847. coreimage=filter=CIBoxBlur@@default
  5848. @end example
  5849. @item
  5850. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5851. its center at 100x100 and a radius of 50 pixels:
  5852. @example
  5853. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5854. @end example
  5855. @item
  5856. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5857. given as complete and escaped command-line for Apple's standard bash shell:
  5858. @example
  5859. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5860. @end example
  5861. @end itemize
  5862. @section crop
  5863. Crop the input video to given dimensions.
  5864. It accepts the following parameters:
  5865. @table @option
  5866. @item w, out_w
  5867. The width of the output video. It defaults to @code{iw}.
  5868. This expression is evaluated only once during the filter
  5869. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5870. @item h, out_h
  5871. The height of the output video. It defaults to @code{ih}.
  5872. This expression is evaluated only once during the filter
  5873. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5874. @item x
  5875. The horizontal position, in the input video, of the left edge of the output
  5876. video. It defaults to @code{(in_w-out_w)/2}.
  5877. This expression is evaluated per-frame.
  5878. @item y
  5879. The vertical position, in the input video, of the top edge of the output video.
  5880. It defaults to @code{(in_h-out_h)/2}.
  5881. This expression is evaluated per-frame.
  5882. @item keep_aspect
  5883. If set to 1 will force the output display aspect ratio
  5884. to be the same of the input, by changing the output sample aspect
  5885. ratio. It defaults to 0.
  5886. @item exact
  5887. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5888. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5889. It defaults to 0.
  5890. @end table
  5891. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5892. expressions containing the following constants:
  5893. @table @option
  5894. @item x
  5895. @item y
  5896. The computed values for @var{x} and @var{y}. They are evaluated for
  5897. each new frame.
  5898. @item in_w
  5899. @item in_h
  5900. The input width and height.
  5901. @item iw
  5902. @item ih
  5903. These are the same as @var{in_w} and @var{in_h}.
  5904. @item out_w
  5905. @item out_h
  5906. The output (cropped) width and height.
  5907. @item ow
  5908. @item oh
  5909. These are the same as @var{out_w} and @var{out_h}.
  5910. @item a
  5911. same as @var{iw} / @var{ih}
  5912. @item sar
  5913. input sample aspect ratio
  5914. @item dar
  5915. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5916. @item hsub
  5917. @item vsub
  5918. horizontal and vertical chroma subsample values. For example for the
  5919. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5920. @item n
  5921. The number of the input frame, starting from 0.
  5922. @item pos
  5923. the position in the file of the input frame, NAN if unknown
  5924. @item t
  5925. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5926. @end table
  5927. The expression for @var{out_w} may depend on the value of @var{out_h},
  5928. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5929. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5930. evaluated after @var{out_w} and @var{out_h}.
  5931. The @var{x} and @var{y} parameters specify the expressions for the
  5932. position of the top-left corner of the output (non-cropped) area. They
  5933. are evaluated for each frame. If the evaluated value is not valid, it
  5934. is approximated to the nearest valid value.
  5935. The expression for @var{x} may depend on @var{y}, and the expression
  5936. for @var{y} may depend on @var{x}.
  5937. @subsection Examples
  5938. @itemize
  5939. @item
  5940. Crop area with size 100x100 at position (12,34).
  5941. @example
  5942. crop=100:100:12:34
  5943. @end example
  5944. Using named options, the example above becomes:
  5945. @example
  5946. crop=w=100:h=100:x=12:y=34
  5947. @end example
  5948. @item
  5949. Crop the central input area with size 100x100:
  5950. @example
  5951. crop=100:100
  5952. @end example
  5953. @item
  5954. Crop the central input area with size 2/3 of the input video:
  5955. @example
  5956. crop=2/3*in_w:2/3*in_h
  5957. @end example
  5958. @item
  5959. Crop the input video central square:
  5960. @example
  5961. crop=out_w=in_h
  5962. crop=in_h
  5963. @end example
  5964. @item
  5965. Delimit the rectangle with the top-left corner placed at position
  5966. 100:100 and the right-bottom corner corresponding to the right-bottom
  5967. corner of the input image.
  5968. @example
  5969. crop=in_w-100:in_h-100:100:100
  5970. @end example
  5971. @item
  5972. Crop 10 pixels from the left and right borders, and 20 pixels from
  5973. the top and bottom borders
  5974. @example
  5975. crop=in_w-2*10:in_h-2*20
  5976. @end example
  5977. @item
  5978. Keep only the bottom right quarter of the input image:
  5979. @example
  5980. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5981. @end example
  5982. @item
  5983. Crop height for getting Greek harmony:
  5984. @example
  5985. crop=in_w:1/PHI*in_w
  5986. @end example
  5987. @item
  5988. Apply trembling effect:
  5989. @example
  5990. 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)
  5991. @end example
  5992. @item
  5993. Apply erratic camera effect depending on timestamp:
  5994. @example
  5995. 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)"
  5996. @end example
  5997. @item
  5998. Set x depending on the value of y:
  5999. @example
  6000. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6001. @end example
  6002. @end itemize
  6003. @subsection Commands
  6004. This filter supports the following commands:
  6005. @table @option
  6006. @item w, out_w
  6007. @item h, out_h
  6008. @item x
  6009. @item y
  6010. Set width/height of the output video and the horizontal/vertical position
  6011. in the input video.
  6012. The command accepts the same syntax of the corresponding option.
  6013. If the specified expression is not valid, it is kept at its current
  6014. value.
  6015. @end table
  6016. @section cropdetect
  6017. Auto-detect the crop size.
  6018. It calculates the necessary cropping parameters and prints the
  6019. recommended parameters via the logging system. The detected dimensions
  6020. correspond to the non-black area of the input video.
  6021. It accepts the following parameters:
  6022. @table @option
  6023. @item limit
  6024. Set higher black value threshold, which can be optionally specified
  6025. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6026. value greater to the set value is considered non-black. It defaults to 24.
  6027. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6028. on the bitdepth of the pixel format.
  6029. @item round
  6030. The value which the width/height should be divisible by. It defaults to
  6031. 16. The offset is automatically adjusted to center the video. Use 2 to
  6032. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6033. encoding to most video codecs.
  6034. @item reset_count, reset
  6035. Set the counter that determines after how many frames cropdetect will
  6036. reset the previously detected largest video area and start over to
  6037. detect the current optimal crop area. Default value is 0.
  6038. This can be useful when channel logos distort the video area. 0
  6039. indicates 'never reset', and returns the largest area encountered during
  6040. playback.
  6041. @end table
  6042. @anchor{cue}
  6043. @section cue
  6044. Delay video filtering until a given wallclock timestamp. The filter first
  6045. passes on @option{preroll} amount of frames, then it buffers at most
  6046. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6047. it forwards the buffered frames and also any subsequent frames coming in its
  6048. input.
  6049. The filter can be used synchronize the output of multiple ffmpeg processes for
  6050. realtime output devices like decklink. By putting the delay in the filtering
  6051. chain and pre-buffering frames the process can pass on data to output almost
  6052. immediately after the target wallclock timestamp is reached.
  6053. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6054. some use cases.
  6055. @table @option
  6056. @item cue
  6057. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6058. @item preroll
  6059. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6060. @item buffer
  6061. The maximum duration of content to buffer before waiting for the cue expressed
  6062. in seconds. Default is 0.
  6063. @end table
  6064. @anchor{curves}
  6065. @section curves
  6066. Apply color adjustments using curves.
  6067. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6068. component (red, green and blue) has its values defined by @var{N} key points
  6069. tied from each other using a smooth curve. The x-axis represents the pixel
  6070. values from the input frame, and the y-axis the new pixel values to be set for
  6071. the output frame.
  6072. By default, a component curve is defined by the two points @var{(0;0)} and
  6073. @var{(1;1)}. This creates a straight line where each original pixel value is
  6074. "adjusted" to its own value, which means no change to the image.
  6075. The filter allows you to redefine these two points and add some more. A new
  6076. curve (using a natural cubic spline interpolation) will be define to pass
  6077. smoothly through all these new coordinates. The new defined points needs to be
  6078. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6079. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6080. the vector spaces, the values will be clipped accordingly.
  6081. The filter accepts the following options:
  6082. @table @option
  6083. @item preset
  6084. Select one of the available color presets. This option can be used in addition
  6085. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6086. options takes priority on the preset values.
  6087. Available presets are:
  6088. @table @samp
  6089. @item none
  6090. @item color_negative
  6091. @item cross_process
  6092. @item darker
  6093. @item increase_contrast
  6094. @item lighter
  6095. @item linear_contrast
  6096. @item medium_contrast
  6097. @item negative
  6098. @item strong_contrast
  6099. @item vintage
  6100. @end table
  6101. Default is @code{none}.
  6102. @item master, m
  6103. Set the master key points. These points will define a second pass mapping. It
  6104. is sometimes called a "luminance" or "value" mapping. It can be used with
  6105. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6106. post-processing LUT.
  6107. @item red, r
  6108. Set the key points for the red component.
  6109. @item green, g
  6110. Set the key points for the green component.
  6111. @item blue, b
  6112. Set the key points for the blue component.
  6113. @item all
  6114. Set the key points for all components (not including master).
  6115. Can be used in addition to the other key points component
  6116. options. In this case, the unset component(s) will fallback on this
  6117. @option{all} setting.
  6118. @item psfile
  6119. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6120. @item plot
  6121. Save Gnuplot script of the curves in specified file.
  6122. @end table
  6123. To avoid some filtergraph syntax conflicts, each key points list need to be
  6124. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6125. @subsection Examples
  6126. @itemize
  6127. @item
  6128. Increase slightly the middle level of blue:
  6129. @example
  6130. curves=blue='0/0 0.5/0.58 1/1'
  6131. @end example
  6132. @item
  6133. Vintage effect:
  6134. @example
  6135. 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'
  6136. @end example
  6137. Here we obtain the following coordinates for each components:
  6138. @table @var
  6139. @item red
  6140. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6141. @item green
  6142. @code{(0;0) (0.50;0.48) (1;1)}
  6143. @item blue
  6144. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6145. @end table
  6146. @item
  6147. The previous example can also be achieved with the associated built-in preset:
  6148. @example
  6149. curves=preset=vintage
  6150. @end example
  6151. @item
  6152. Or simply:
  6153. @example
  6154. curves=vintage
  6155. @end example
  6156. @item
  6157. Use a Photoshop preset and redefine the points of the green component:
  6158. @example
  6159. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6160. @end example
  6161. @item
  6162. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6163. and @command{gnuplot}:
  6164. @example
  6165. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6166. gnuplot -p /tmp/curves.plt
  6167. @end example
  6168. @end itemize
  6169. @section datascope
  6170. Video data analysis filter.
  6171. This filter shows hexadecimal pixel values of part of video.
  6172. The filter accepts the following options:
  6173. @table @option
  6174. @item size, s
  6175. Set output video size.
  6176. @item x
  6177. Set x offset from where to pick pixels.
  6178. @item y
  6179. Set y offset from where to pick pixels.
  6180. @item mode
  6181. Set scope mode, can be one of the following:
  6182. @table @samp
  6183. @item mono
  6184. Draw hexadecimal pixel values with white color on black background.
  6185. @item color
  6186. Draw hexadecimal pixel values with input video pixel color on black
  6187. background.
  6188. @item color2
  6189. Draw hexadecimal pixel values on color background picked from input video,
  6190. the text color is picked in such way so its always visible.
  6191. @end table
  6192. @item axis
  6193. Draw rows and columns numbers on left and top of video.
  6194. @item opacity
  6195. Set background opacity.
  6196. @end table
  6197. @section dctdnoiz
  6198. Denoise frames using 2D DCT (frequency domain filtering).
  6199. This filter is not designed for real time.
  6200. The filter accepts the following options:
  6201. @table @option
  6202. @item sigma, s
  6203. Set the noise sigma constant.
  6204. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6205. coefficient (absolute value) below this threshold with be dropped.
  6206. If you need a more advanced filtering, see @option{expr}.
  6207. Default is @code{0}.
  6208. @item overlap
  6209. Set number overlapping pixels for each block. Since the filter can be slow, you
  6210. may want to reduce this value, at the cost of a less effective filter and the
  6211. risk of various artefacts.
  6212. If the overlapping value doesn't permit processing the whole input width or
  6213. height, a warning will be displayed and according borders won't be denoised.
  6214. Default value is @var{blocksize}-1, which is the best possible setting.
  6215. @item expr, e
  6216. Set the coefficient factor expression.
  6217. For each coefficient of a DCT block, this expression will be evaluated as a
  6218. multiplier value for the coefficient.
  6219. If this is option is set, the @option{sigma} option will be ignored.
  6220. The absolute value of the coefficient can be accessed through the @var{c}
  6221. variable.
  6222. @item n
  6223. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6224. @var{blocksize}, which is the width and height of the processed blocks.
  6225. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6226. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6227. on the speed processing. Also, a larger block size does not necessarily means a
  6228. better de-noising.
  6229. @end table
  6230. @subsection Examples
  6231. Apply a denoise with a @option{sigma} of @code{4.5}:
  6232. @example
  6233. dctdnoiz=4.5
  6234. @end example
  6235. The same operation can be achieved using the expression system:
  6236. @example
  6237. dctdnoiz=e='gte(c, 4.5*3)'
  6238. @end example
  6239. Violent denoise using a block size of @code{16x16}:
  6240. @example
  6241. dctdnoiz=15:n=4
  6242. @end example
  6243. @section deband
  6244. Remove banding artifacts from input video.
  6245. It works by replacing banded pixels with average value of referenced pixels.
  6246. The filter accepts the following options:
  6247. @table @option
  6248. @item 1thr
  6249. @item 2thr
  6250. @item 3thr
  6251. @item 4thr
  6252. Set banding detection threshold for each plane. Default is 0.02.
  6253. Valid range is 0.00003 to 0.5.
  6254. If difference between current pixel and reference pixel is less than threshold,
  6255. it will be considered as banded.
  6256. @item range, r
  6257. Banding detection range in pixels. Default is 16. If positive, random number
  6258. in range 0 to set value will be used. If negative, exact absolute value
  6259. will be used.
  6260. The range defines square of four pixels around current pixel.
  6261. @item direction, d
  6262. Set direction in radians from which four pixel will be compared. If positive,
  6263. random direction from 0 to set direction will be picked. If negative, exact of
  6264. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6265. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6266. column.
  6267. @item blur, b
  6268. If enabled, current pixel is compared with average value of all four
  6269. surrounding pixels. The default is enabled. If disabled current pixel is
  6270. compared with all four surrounding pixels. The pixel is considered banded
  6271. if only all four differences with surrounding pixels are less than threshold.
  6272. @item coupling, c
  6273. If enabled, current pixel is changed if and only if all pixel components are banded,
  6274. e.g. banding detection threshold is triggered for all color components.
  6275. The default is disabled.
  6276. @end table
  6277. @section deblock
  6278. Remove blocking artifacts from input video.
  6279. The filter accepts the following options:
  6280. @table @option
  6281. @item filter
  6282. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6283. This controls what kind of deblocking is applied.
  6284. @item block
  6285. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6286. @item alpha
  6287. @item beta
  6288. @item gamma
  6289. @item delta
  6290. Set blocking detection thresholds. Allowed range is 0 to 1.
  6291. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6292. Using higher threshold gives more deblocking strength.
  6293. Setting @var{alpha} controls threshold detection at exact edge of block.
  6294. Remaining options controls threshold detection near the edge. Each one for
  6295. below/above or left/right. Setting any of those to @var{0} disables
  6296. deblocking.
  6297. @item planes
  6298. Set planes to filter. Default is to filter all available planes.
  6299. @end table
  6300. @subsection Examples
  6301. @itemize
  6302. @item
  6303. Deblock using weak filter and block size of 4 pixels.
  6304. @example
  6305. deblock=filter=weak:block=4
  6306. @end example
  6307. @item
  6308. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6309. deblocking more edges.
  6310. @example
  6311. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6312. @end example
  6313. @item
  6314. Similar as above, but filter only first plane.
  6315. @example
  6316. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6317. @end example
  6318. @item
  6319. Similar as above, but filter only second and third plane.
  6320. @example
  6321. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6322. @end example
  6323. @end itemize
  6324. @anchor{decimate}
  6325. @section decimate
  6326. Drop duplicated frames at regular intervals.
  6327. The filter accepts the following options:
  6328. @table @option
  6329. @item cycle
  6330. Set the number of frames from which one will be dropped. Setting this to
  6331. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6332. Default is @code{5}.
  6333. @item dupthresh
  6334. Set the threshold for duplicate detection. If the difference metric for a frame
  6335. is less than or equal to this value, then it is declared as duplicate. Default
  6336. is @code{1.1}
  6337. @item scthresh
  6338. Set scene change threshold. Default is @code{15}.
  6339. @item blockx
  6340. @item blocky
  6341. Set the size of the x and y-axis blocks used during metric calculations.
  6342. Larger blocks give better noise suppression, but also give worse detection of
  6343. small movements. Must be a power of two. Default is @code{32}.
  6344. @item ppsrc
  6345. Mark main input as a pre-processed input and activate clean source input
  6346. stream. This allows the input to be pre-processed with various filters to help
  6347. the metrics calculation while keeping the frame selection lossless. When set to
  6348. @code{1}, the first stream is for the pre-processed input, and the second
  6349. stream is the clean source from where the kept frames are chosen. Default is
  6350. @code{0}.
  6351. @item chroma
  6352. Set whether or not chroma is considered in the metric calculations. Default is
  6353. @code{1}.
  6354. @end table
  6355. @section deconvolve
  6356. Apply 2D deconvolution of video stream in frequency domain using second stream
  6357. as impulse.
  6358. The filter accepts the following options:
  6359. @table @option
  6360. @item planes
  6361. Set which planes to process.
  6362. @item impulse
  6363. Set which impulse video frames will be processed, can be @var{first}
  6364. or @var{all}. Default is @var{all}.
  6365. @item noise
  6366. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6367. and height are not same and not power of 2 or if stream prior to convolving
  6368. had noise.
  6369. @end table
  6370. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6371. @section dedot
  6372. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6373. It accepts the following options:
  6374. @table @option
  6375. @item m
  6376. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6377. @var{rainbows} for cross-color reduction.
  6378. @item lt
  6379. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6380. @item tl
  6381. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6382. @item tc
  6383. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6384. @item ct
  6385. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6386. @end table
  6387. @section deflate
  6388. Apply deflate effect to the video.
  6389. This filter replaces the pixel by the local(3x3) average by taking into account
  6390. only values lower than the pixel.
  6391. It accepts the following options:
  6392. @table @option
  6393. @item threshold0
  6394. @item threshold1
  6395. @item threshold2
  6396. @item threshold3
  6397. Limit the maximum change for each plane, default is 65535.
  6398. If 0, plane will remain unchanged.
  6399. @end table
  6400. @section deflicker
  6401. Remove temporal frame luminance variations.
  6402. It accepts the following options:
  6403. @table @option
  6404. @item size, s
  6405. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6406. @item mode, m
  6407. Set averaging mode to smooth temporal luminance variations.
  6408. Available values are:
  6409. @table @samp
  6410. @item am
  6411. Arithmetic mean
  6412. @item gm
  6413. Geometric mean
  6414. @item hm
  6415. Harmonic mean
  6416. @item qm
  6417. Quadratic mean
  6418. @item cm
  6419. Cubic mean
  6420. @item pm
  6421. Power mean
  6422. @item median
  6423. Median
  6424. @end table
  6425. @item bypass
  6426. Do not actually modify frame. Useful when one only wants metadata.
  6427. @end table
  6428. @section dejudder
  6429. Remove judder produced by partially interlaced telecined content.
  6430. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6431. source was partially telecined content then the output of @code{pullup,dejudder}
  6432. will have a variable frame rate. May change the recorded frame rate of the
  6433. container. Aside from that change, this filter will not affect constant frame
  6434. rate video.
  6435. The option available in this filter is:
  6436. @table @option
  6437. @item cycle
  6438. Specify the length of the window over which the judder repeats.
  6439. Accepts any integer greater than 1. Useful values are:
  6440. @table @samp
  6441. @item 4
  6442. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6443. @item 5
  6444. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6445. @item 20
  6446. If a mixture of the two.
  6447. @end table
  6448. The default is @samp{4}.
  6449. @end table
  6450. @section delogo
  6451. Suppress a TV station logo by a simple interpolation of the surrounding
  6452. pixels. Just set a rectangle covering the logo and watch it disappear
  6453. (and sometimes something even uglier appear - your mileage may vary).
  6454. It accepts the following parameters:
  6455. @table @option
  6456. @item x
  6457. @item y
  6458. Specify the top left corner coordinates of the logo. They must be
  6459. specified.
  6460. @item w
  6461. @item h
  6462. Specify the width and height of the logo to clear. They must be
  6463. specified.
  6464. @item band, t
  6465. Specify the thickness of the fuzzy edge of the rectangle (added to
  6466. @var{w} and @var{h}). The default value is 1. This option is
  6467. deprecated, setting higher values should no longer be necessary and
  6468. is not recommended.
  6469. @item show
  6470. When set to 1, a green rectangle is drawn on the screen to simplify
  6471. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6472. The default value is 0.
  6473. The rectangle is drawn on the outermost pixels which will be (partly)
  6474. replaced with interpolated values. The values of the next pixels
  6475. immediately outside this rectangle in each direction will be used to
  6476. compute the interpolated pixel values inside the rectangle.
  6477. @end table
  6478. @subsection Examples
  6479. @itemize
  6480. @item
  6481. Set a rectangle covering the area with top left corner coordinates 0,0
  6482. and size 100x77, and a band of size 10:
  6483. @example
  6484. delogo=x=0:y=0:w=100:h=77:band=10
  6485. @end example
  6486. @end itemize
  6487. @section derain
  6488. Remove the rain in the input image/video by applying the derain methods based on
  6489. convolutional neural networks. Supported models:
  6490. @itemize
  6491. @item
  6492. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  6493. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  6494. @end itemize
  6495. Training scripts as well as scripts for model generation are provided in
  6496. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  6497. The filter accepts the following options:
  6498. @table @option
  6499. @item dnn_backend
  6500. Specify which DNN backend to use for model loading and execution. This option accepts
  6501. the following values:
  6502. @table @samp
  6503. @item native
  6504. Native implementation of DNN loading and execution.
  6505. @end table
  6506. Default value is @samp{native}.
  6507. @item model
  6508. Set path to model file specifying network architecture and its parameters.
  6509. Note that different backends use different file formats. TensorFlow backend
  6510. can load files for both formats, while native backend can load files for only
  6511. its format.
  6512. @end table
  6513. @section deshake
  6514. Attempt to fix small changes in horizontal and/or vertical shift. This
  6515. filter helps remove camera shake from hand-holding a camera, bumping a
  6516. tripod, moving on a vehicle, etc.
  6517. The filter accepts the following options:
  6518. @table @option
  6519. @item x
  6520. @item y
  6521. @item w
  6522. @item h
  6523. Specify a rectangular area where to limit the search for motion
  6524. vectors.
  6525. If desired the search for motion vectors can be limited to a
  6526. rectangular area of the frame defined by its top left corner, width
  6527. and height. These parameters have the same meaning as the drawbox
  6528. filter which can be used to visualise the position of the bounding
  6529. box.
  6530. This is useful when simultaneous movement of subjects within the frame
  6531. might be confused for camera motion by the motion vector search.
  6532. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6533. then the full frame is used. This allows later options to be set
  6534. without specifying the bounding box for the motion vector search.
  6535. Default - search the whole frame.
  6536. @item rx
  6537. @item ry
  6538. Specify the maximum extent of movement in x and y directions in the
  6539. range 0-64 pixels. Default 16.
  6540. @item edge
  6541. Specify how to generate pixels to fill blanks at the edge of the
  6542. frame. Available values are:
  6543. @table @samp
  6544. @item blank, 0
  6545. Fill zeroes at blank locations
  6546. @item original, 1
  6547. Original image at blank locations
  6548. @item clamp, 2
  6549. Extruded edge value at blank locations
  6550. @item mirror, 3
  6551. Mirrored edge at blank locations
  6552. @end table
  6553. Default value is @samp{mirror}.
  6554. @item blocksize
  6555. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6556. default 8.
  6557. @item contrast
  6558. Specify the contrast threshold for blocks. Only blocks with more than
  6559. the specified contrast (difference between darkest and lightest
  6560. pixels) will be considered. Range 1-255, default 125.
  6561. @item search
  6562. Specify the search strategy. Available values are:
  6563. @table @samp
  6564. @item exhaustive, 0
  6565. Set exhaustive search
  6566. @item less, 1
  6567. Set less exhaustive search.
  6568. @end table
  6569. Default value is @samp{exhaustive}.
  6570. @item filename
  6571. If set then a detailed log of the motion search is written to the
  6572. specified file.
  6573. @end table
  6574. @section despill
  6575. Remove unwanted contamination of foreground colors, caused by reflected color of
  6576. greenscreen or bluescreen.
  6577. This filter accepts the following options:
  6578. @table @option
  6579. @item type
  6580. Set what type of despill to use.
  6581. @item mix
  6582. Set how spillmap will be generated.
  6583. @item expand
  6584. Set how much to get rid of still remaining spill.
  6585. @item red
  6586. Controls amount of red in spill area.
  6587. @item green
  6588. Controls amount of green in spill area.
  6589. Should be -1 for greenscreen.
  6590. @item blue
  6591. Controls amount of blue in spill area.
  6592. Should be -1 for bluescreen.
  6593. @item brightness
  6594. Controls brightness of spill area, preserving colors.
  6595. @item alpha
  6596. Modify alpha from generated spillmap.
  6597. @end table
  6598. @section detelecine
  6599. Apply an exact inverse of the telecine operation. It requires a predefined
  6600. pattern specified using the pattern option which must be the same as that passed
  6601. to the telecine filter.
  6602. This filter accepts the following options:
  6603. @table @option
  6604. @item first_field
  6605. @table @samp
  6606. @item top, t
  6607. top field first
  6608. @item bottom, b
  6609. bottom field first
  6610. The default value is @code{top}.
  6611. @end table
  6612. @item pattern
  6613. A string of numbers representing the pulldown pattern you wish to apply.
  6614. The default value is @code{23}.
  6615. @item start_frame
  6616. A number representing position of the first frame with respect to the telecine
  6617. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6618. @end table
  6619. @section dilation
  6620. Apply dilation effect to the video.
  6621. This filter replaces the pixel by the local(3x3) maximum.
  6622. It accepts the following options:
  6623. @table @option
  6624. @item threshold0
  6625. @item threshold1
  6626. @item threshold2
  6627. @item threshold3
  6628. Limit the maximum change for each plane, default is 65535.
  6629. If 0, plane will remain unchanged.
  6630. @item coordinates
  6631. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6632. pixels are used.
  6633. Flags to local 3x3 coordinates maps like this:
  6634. 1 2 3
  6635. 4 5
  6636. 6 7 8
  6637. @end table
  6638. @section displace
  6639. Displace pixels as indicated by second and third input stream.
  6640. It takes three input streams and outputs one stream, the first input is the
  6641. source, and second and third input are displacement maps.
  6642. The second input specifies how much to displace pixels along the
  6643. x-axis, while the third input specifies how much to displace pixels
  6644. along the y-axis.
  6645. If one of displacement map streams terminates, last frame from that
  6646. displacement map will be used.
  6647. Note that once generated, displacements maps can be reused over and over again.
  6648. A description of the accepted options follows.
  6649. @table @option
  6650. @item edge
  6651. Set displace behavior for pixels that are out of range.
  6652. Available values are:
  6653. @table @samp
  6654. @item blank
  6655. Missing pixels are replaced by black pixels.
  6656. @item smear
  6657. Adjacent pixels will spread out to replace missing pixels.
  6658. @item wrap
  6659. Out of range pixels are wrapped so they point to pixels of other side.
  6660. @item mirror
  6661. Out of range pixels will be replaced with mirrored pixels.
  6662. @end table
  6663. Default is @samp{smear}.
  6664. @end table
  6665. @subsection Examples
  6666. @itemize
  6667. @item
  6668. Add ripple effect to rgb input of video size hd720:
  6669. @example
  6670. 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
  6671. @end example
  6672. @item
  6673. Add wave effect to rgb input of video size hd720:
  6674. @example
  6675. 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
  6676. @end example
  6677. @end itemize
  6678. @section drawbox
  6679. Draw a colored box on the input image.
  6680. It accepts the following parameters:
  6681. @table @option
  6682. @item x
  6683. @item y
  6684. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6685. @item width, w
  6686. @item height, h
  6687. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6688. the input width and height. It defaults to 0.
  6689. @item color, c
  6690. Specify the color of the box to write. For the general syntax of this option,
  6691. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6692. value @code{invert} is used, the box edge color is the same as the
  6693. video with inverted luma.
  6694. @item thickness, t
  6695. The expression which sets the thickness of the box edge.
  6696. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6697. See below for the list of accepted constants.
  6698. @item replace
  6699. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6700. will overwrite the video's color and alpha pixels.
  6701. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6702. @end table
  6703. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6704. following constants:
  6705. @table @option
  6706. @item dar
  6707. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6708. @item hsub
  6709. @item vsub
  6710. horizontal and vertical chroma subsample values. For example for the
  6711. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6712. @item in_h, ih
  6713. @item in_w, iw
  6714. The input width and height.
  6715. @item sar
  6716. The input sample aspect ratio.
  6717. @item x
  6718. @item y
  6719. The x and y offset coordinates where the box is drawn.
  6720. @item w
  6721. @item h
  6722. The width and height of the drawn box.
  6723. @item t
  6724. The thickness of the drawn box.
  6725. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6726. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6727. @end table
  6728. @subsection Examples
  6729. @itemize
  6730. @item
  6731. Draw a black box around the edge of the input image:
  6732. @example
  6733. drawbox
  6734. @end example
  6735. @item
  6736. Draw a box with color red and an opacity of 50%:
  6737. @example
  6738. drawbox=10:20:200:60:red@@0.5
  6739. @end example
  6740. The previous example can be specified as:
  6741. @example
  6742. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6743. @end example
  6744. @item
  6745. Fill the box with pink color:
  6746. @example
  6747. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6748. @end example
  6749. @item
  6750. Draw a 2-pixel red 2.40:1 mask:
  6751. @example
  6752. 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
  6753. @end example
  6754. @end itemize
  6755. @section drawgrid
  6756. Draw a grid on the input image.
  6757. It accepts the following parameters:
  6758. @table @option
  6759. @item x
  6760. @item y
  6761. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6762. @item width, w
  6763. @item height, h
  6764. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6765. input width and height, respectively, minus @code{thickness}, so image gets
  6766. framed. Default to 0.
  6767. @item color, c
  6768. Specify the color of the grid. For the general syntax of this option,
  6769. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6770. value @code{invert} is used, the grid color is the same as the
  6771. video with inverted luma.
  6772. @item thickness, t
  6773. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6774. See below for the list of accepted constants.
  6775. @item replace
  6776. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6777. will overwrite the video's color and alpha pixels.
  6778. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6779. @end table
  6780. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6781. following constants:
  6782. @table @option
  6783. @item dar
  6784. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6785. @item hsub
  6786. @item vsub
  6787. horizontal and vertical chroma subsample values. For example for the
  6788. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6789. @item in_h, ih
  6790. @item in_w, iw
  6791. The input grid cell width and height.
  6792. @item sar
  6793. The input sample aspect ratio.
  6794. @item x
  6795. @item y
  6796. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6797. @item w
  6798. @item h
  6799. The width and height of the drawn cell.
  6800. @item t
  6801. The thickness of the drawn cell.
  6802. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6803. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6804. @end table
  6805. @subsection Examples
  6806. @itemize
  6807. @item
  6808. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6809. @example
  6810. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6811. @end example
  6812. @item
  6813. Draw a white 3x3 grid with an opacity of 50%:
  6814. @example
  6815. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6816. @end example
  6817. @end itemize
  6818. @anchor{drawtext}
  6819. @section drawtext
  6820. Draw a text string or text from a specified file on top of a video, using the
  6821. libfreetype library.
  6822. To enable compilation of this filter, you need to configure FFmpeg with
  6823. @code{--enable-libfreetype}.
  6824. To enable default font fallback and the @var{font} option you need to
  6825. configure FFmpeg with @code{--enable-libfontconfig}.
  6826. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6827. @code{--enable-libfribidi}.
  6828. @subsection Syntax
  6829. It accepts the following parameters:
  6830. @table @option
  6831. @item box
  6832. Used to draw a box around text using the background color.
  6833. The value must be either 1 (enable) or 0 (disable).
  6834. The default value of @var{box} is 0.
  6835. @item boxborderw
  6836. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6837. The default value of @var{boxborderw} is 0.
  6838. @item boxcolor
  6839. The color to be used for drawing box around text. For the syntax of this
  6840. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6841. The default value of @var{boxcolor} is "white".
  6842. @item line_spacing
  6843. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6844. The default value of @var{line_spacing} is 0.
  6845. @item borderw
  6846. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6847. The default value of @var{borderw} is 0.
  6848. @item bordercolor
  6849. Set the color to be used for drawing border around text. For the syntax of this
  6850. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6851. The default value of @var{bordercolor} is "black".
  6852. @item expansion
  6853. Select how the @var{text} is expanded. Can be either @code{none},
  6854. @code{strftime} (deprecated) or
  6855. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6856. below for details.
  6857. @item basetime
  6858. Set a start time for the count. Value is in microseconds. Only applied
  6859. in the deprecated strftime expansion mode. To emulate in normal expansion
  6860. mode use the @code{pts} function, supplying the start time (in seconds)
  6861. as the second argument.
  6862. @item fix_bounds
  6863. If true, check and fix text coords to avoid clipping.
  6864. @item fontcolor
  6865. The color to be used for drawing fonts. For the syntax of this option, check
  6866. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6867. The default value of @var{fontcolor} is "black".
  6868. @item fontcolor_expr
  6869. String which is expanded the same way as @var{text} to obtain dynamic
  6870. @var{fontcolor} value. By default this option has empty value and is not
  6871. processed. When this option is set, it overrides @var{fontcolor} option.
  6872. @item font
  6873. The font family to be used for drawing text. By default Sans.
  6874. @item fontfile
  6875. The font file to be used for drawing text. The path must be included.
  6876. This parameter is mandatory if the fontconfig support is disabled.
  6877. @item alpha
  6878. Draw the text applying alpha blending. The value can
  6879. be a number between 0.0 and 1.0.
  6880. The expression accepts the same variables @var{x, y} as well.
  6881. The default value is 1.
  6882. Please see @var{fontcolor_expr}.
  6883. @item fontsize
  6884. The font size to be used for drawing text.
  6885. The default value of @var{fontsize} is 16.
  6886. @item text_shaping
  6887. If set to 1, attempt to shape the text (for example, reverse the order of
  6888. right-to-left text and join Arabic characters) before drawing it.
  6889. Otherwise, just draw the text exactly as given.
  6890. By default 1 (if supported).
  6891. @item ft_load_flags
  6892. The flags to be used for loading the fonts.
  6893. The flags map the corresponding flags supported by libfreetype, and are
  6894. a combination of the following values:
  6895. @table @var
  6896. @item default
  6897. @item no_scale
  6898. @item no_hinting
  6899. @item render
  6900. @item no_bitmap
  6901. @item vertical_layout
  6902. @item force_autohint
  6903. @item crop_bitmap
  6904. @item pedantic
  6905. @item ignore_global_advance_width
  6906. @item no_recurse
  6907. @item ignore_transform
  6908. @item monochrome
  6909. @item linear_design
  6910. @item no_autohint
  6911. @end table
  6912. Default value is "default".
  6913. For more information consult the documentation for the FT_LOAD_*
  6914. libfreetype flags.
  6915. @item shadowcolor
  6916. The color to be used for drawing a shadow behind the drawn text. For the
  6917. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6918. ffmpeg-utils manual,ffmpeg-utils}.
  6919. The default value of @var{shadowcolor} is "black".
  6920. @item shadowx
  6921. @item shadowy
  6922. The x and y offsets for the text shadow position with respect to the
  6923. position of the text. They can be either positive or negative
  6924. values. The default value for both is "0".
  6925. @item start_number
  6926. The starting frame number for the n/frame_num variable. The default value
  6927. is "0".
  6928. @item tabsize
  6929. The size in number of spaces to use for rendering the tab.
  6930. Default value is 4.
  6931. @item timecode
  6932. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6933. format. It can be used with or without text parameter. @var{timecode_rate}
  6934. option must be specified.
  6935. @item timecode_rate, rate, r
  6936. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6937. integer. Minimum value is "1".
  6938. Drop-frame timecode is supported for frame rates 30 & 60.
  6939. @item tc24hmax
  6940. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6941. Default is 0 (disabled).
  6942. @item text
  6943. The text string to be drawn. The text must be a sequence of UTF-8
  6944. encoded characters.
  6945. This parameter is mandatory if no file is specified with the parameter
  6946. @var{textfile}.
  6947. @item textfile
  6948. A text file containing text to be drawn. The text must be a sequence
  6949. of UTF-8 encoded characters.
  6950. This parameter is mandatory if no text string is specified with the
  6951. parameter @var{text}.
  6952. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6953. @item reload
  6954. If set to 1, the @var{textfile} will be reloaded before each frame.
  6955. Be sure to update it atomically, or it may be read partially, or even fail.
  6956. @item x
  6957. @item y
  6958. The expressions which specify the offsets where text will be drawn
  6959. within the video frame. They are relative to the top/left border of the
  6960. output image.
  6961. The default value of @var{x} and @var{y} is "0".
  6962. See below for the list of accepted constants and functions.
  6963. @end table
  6964. The parameters for @var{x} and @var{y} are expressions containing the
  6965. following constants and functions:
  6966. @table @option
  6967. @item dar
  6968. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6969. @item hsub
  6970. @item vsub
  6971. horizontal and vertical chroma subsample values. For example for the
  6972. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6973. @item line_h, lh
  6974. the height of each text line
  6975. @item main_h, h, H
  6976. the input height
  6977. @item main_w, w, W
  6978. the input width
  6979. @item max_glyph_a, ascent
  6980. the maximum distance from the baseline to the highest/upper grid
  6981. coordinate used to place a glyph outline point, for all the rendered
  6982. glyphs.
  6983. It is a positive value, due to the grid's orientation with the Y axis
  6984. upwards.
  6985. @item max_glyph_d, descent
  6986. the maximum distance from the baseline to the lowest grid coordinate
  6987. used to place a glyph outline point, for all the rendered glyphs.
  6988. This is a negative value, due to the grid's orientation, with the Y axis
  6989. upwards.
  6990. @item max_glyph_h
  6991. maximum glyph height, that is the maximum height for all the glyphs
  6992. contained in the rendered text, it is equivalent to @var{ascent} -
  6993. @var{descent}.
  6994. @item max_glyph_w
  6995. maximum glyph width, that is the maximum width for all the glyphs
  6996. contained in the rendered text
  6997. @item n
  6998. the number of input frame, starting from 0
  6999. @item rand(min, max)
  7000. return a random number included between @var{min} and @var{max}
  7001. @item sar
  7002. The input sample aspect ratio.
  7003. @item t
  7004. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7005. @item text_h, th
  7006. the height of the rendered text
  7007. @item text_w, tw
  7008. the width of the rendered text
  7009. @item x
  7010. @item y
  7011. the x and y offset coordinates where the text is drawn.
  7012. These parameters allow the @var{x} and @var{y} expressions to refer
  7013. to each other, so you can for example specify @code{y=x/dar}.
  7014. @item pict_type
  7015. A one character description of the current frame's picture type.
  7016. @item pkt_pos
  7017. The current packet's position in the input file or stream
  7018. (in bytes, from the start of the input). A value of -1 indicates
  7019. this info is not available.
  7020. @item pkt_duration
  7021. The current packet's duration, in seconds.
  7022. @item pkt_size
  7023. The current packet's size (in bytes).
  7024. @end table
  7025. @anchor{drawtext_expansion}
  7026. @subsection Text expansion
  7027. If @option{expansion} is set to @code{strftime},
  7028. the filter recognizes strftime() sequences in the provided text and
  7029. expands them accordingly. Check the documentation of strftime(). This
  7030. feature is deprecated.
  7031. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  7032. If @option{expansion} is set to @code{normal} (which is the default),
  7033. the following expansion mechanism is used.
  7034. The backslash character @samp{\}, followed by any character, always expands to
  7035. the second character.
  7036. Sequences of the form @code{%@{...@}} are expanded. The text between the
  7037. braces is a function name, possibly followed by arguments separated by ':'.
  7038. If the arguments contain special characters or delimiters (':' or '@}'),
  7039. they should be escaped.
  7040. Note that they probably must also be escaped as the value for the
  7041. @option{text} option in the filter argument string and as the filter
  7042. argument in the filtergraph description, and possibly also for the shell,
  7043. that makes up to four levels of escaping; using a text file avoids these
  7044. problems.
  7045. The following functions are available:
  7046. @table @command
  7047. @item expr, e
  7048. The expression evaluation result.
  7049. It must take one argument specifying the expression to be evaluated,
  7050. which accepts the same constants and functions as the @var{x} and
  7051. @var{y} values. Note that not all constants should be used, for
  7052. example the text size is not known when evaluating the expression, so
  7053. the constants @var{text_w} and @var{text_h} will have an undefined
  7054. value.
  7055. @item expr_int_format, eif
  7056. Evaluate the expression's value and output as formatted integer.
  7057. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  7058. The second argument specifies the output format. Allowed values are @samp{x},
  7059. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  7060. @code{printf} function.
  7061. The third parameter is optional and sets the number of positions taken by the output.
  7062. It can be used to add padding with zeros from the left.
  7063. @item gmtime
  7064. The time at which the filter is running, expressed in UTC.
  7065. It can accept an argument: a strftime() format string.
  7066. @item localtime
  7067. The time at which the filter is running, expressed in the local time zone.
  7068. It can accept an argument: a strftime() format string.
  7069. @item metadata
  7070. Frame metadata. Takes one or two arguments.
  7071. The first argument is mandatory and specifies the metadata key.
  7072. The second argument is optional and specifies a default value, used when the
  7073. metadata key is not found or empty.
  7074. Available metadata can be identified by inspecting entries
  7075. starting with TAG included within each frame section
  7076. printed by running @code{ffprobe -show_frames}.
  7077. String metadata generated in filters leading to
  7078. the drawtext filter are also available.
  7079. @item n, frame_num
  7080. The frame number, starting from 0.
  7081. @item pict_type
  7082. A one character description of the current picture type.
  7083. @item pts
  7084. The timestamp of the current frame.
  7085. It can take up to three arguments.
  7086. The first argument is the format of the timestamp; it defaults to @code{flt}
  7087. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  7088. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  7089. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  7090. @code{localtime} stands for the timestamp of the frame formatted as
  7091. local time zone time.
  7092. The second argument is an offset added to the timestamp.
  7093. If the format is set to @code{hms}, a third argument @code{24HH} may be
  7094. supplied to present the hour part of the formatted timestamp in 24h format
  7095. (00-23).
  7096. If the format is set to @code{localtime} or @code{gmtime},
  7097. a third argument may be supplied: a strftime() format string.
  7098. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  7099. @end table
  7100. @subsection Commands
  7101. This filter supports altering parameters via commands:
  7102. @table @option
  7103. @item reinit
  7104. Alter existing filter parameters.
  7105. Syntax for the argument is the same as for filter invocation, e.g.
  7106. @example
  7107. fontsize=56:fontcolor=green:text='Hello World'
  7108. @end example
  7109. Full filter invocation with sendcmd would look like this:
  7110. @example
  7111. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7112. @end example
  7113. @end table
  7114. If the entire argument can't be parsed or applied as valid values then the filter will
  7115. continue with its existing parameters.
  7116. @subsection Examples
  7117. @itemize
  7118. @item
  7119. Draw "Test Text" with font FreeSerif, using the default values for the
  7120. optional parameters.
  7121. @example
  7122. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7123. @end example
  7124. @item
  7125. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7126. and y=50 (counting from the top-left corner of the screen), text is
  7127. yellow with a red box around it. Both the text and the box have an
  7128. opacity of 20%.
  7129. @example
  7130. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7131. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7132. @end example
  7133. Note that the double quotes are not necessary if spaces are not used
  7134. within the parameter list.
  7135. @item
  7136. Show the text at the center of the video frame:
  7137. @example
  7138. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7139. @end example
  7140. @item
  7141. Show the text at a random position, switching to a new position every 30 seconds:
  7142. @example
  7143. 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)"
  7144. @end example
  7145. @item
  7146. Show a text line sliding from right to left in the last row of the video
  7147. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7148. with no newlines.
  7149. @example
  7150. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7151. @end example
  7152. @item
  7153. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7154. @example
  7155. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7156. @end example
  7157. @item
  7158. Draw a single green letter "g", at the center of the input video.
  7159. The glyph baseline is placed at half screen height.
  7160. @example
  7161. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7162. @end example
  7163. @item
  7164. Show text for 1 second every 3 seconds:
  7165. @example
  7166. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7167. @end example
  7168. @item
  7169. Use fontconfig to set the font. Note that the colons need to be escaped.
  7170. @example
  7171. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7172. @end example
  7173. @item
  7174. Print the date of a real-time encoding (see strftime(3)):
  7175. @example
  7176. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7177. @end example
  7178. @item
  7179. Show text fading in and out (appearing/disappearing):
  7180. @example
  7181. #!/bin/sh
  7182. DS=1.0 # display start
  7183. DE=10.0 # display end
  7184. FID=1.5 # fade in duration
  7185. FOD=5 # fade out duration
  7186. 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 @}"
  7187. @end example
  7188. @item
  7189. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7190. and the @option{fontsize} value are included in the @option{y} offset.
  7191. @example
  7192. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7193. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7194. @end example
  7195. @end itemize
  7196. For more information about libfreetype, check:
  7197. @url{http://www.freetype.org/}.
  7198. For more information about fontconfig, check:
  7199. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7200. For more information about libfribidi, check:
  7201. @url{http://fribidi.org/}.
  7202. @section edgedetect
  7203. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7204. The filter accepts the following options:
  7205. @table @option
  7206. @item low
  7207. @item high
  7208. Set low and high threshold values used by the Canny thresholding
  7209. algorithm.
  7210. The high threshold selects the "strong" edge pixels, which are then
  7211. connected through 8-connectivity with the "weak" edge pixels selected
  7212. by the low threshold.
  7213. @var{low} and @var{high} threshold values must be chosen in the range
  7214. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7215. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  7216. is @code{50/255}.
  7217. @item mode
  7218. Define the drawing mode.
  7219. @table @samp
  7220. @item wires
  7221. Draw white/gray wires on black background.
  7222. @item colormix
  7223. Mix the colors to create a paint/cartoon effect.
  7224. @item canny
  7225. Apply Canny edge detector on all selected planes.
  7226. @end table
  7227. Default value is @var{wires}.
  7228. @item planes
  7229. Select planes for filtering. By default all available planes are filtered.
  7230. @end table
  7231. @subsection Examples
  7232. @itemize
  7233. @item
  7234. Standard edge detection with custom values for the hysteresis thresholding:
  7235. @example
  7236. edgedetect=low=0.1:high=0.4
  7237. @end example
  7238. @item
  7239. Painting effect without thresholding:
  7240. @example
  7241. edgedetect=mode=colormix:high=0
  7242. @end example
  7243. @end itemize
  7244. @section eq
  7245. Set brightness, contrast, saturation and approximate gamma adjustment.
  7246. The filter accepts the following options:
  7247. @table @option
  7248. @item contrast
  7249. Set the contrast expression. The value must be a float value in range
  7250. @code{-2.0} to @code{2.0}. The default value is "1".
  7251. @item brightness
  7252. Set the brightness expression. The value must be a float value in
  7253. range @code{-1.0} to @code{1.0}. The default value is "0".
  7254. @item saturation
  7255. Set the saturation expression. The value must be a float in
  7256. range @code{0.0} to @code{3.0}. The default value is "1".
  7257. @item gamma
  7258. Set the gamma expression. The value must be a float in range
  7259. @code{0.1} to @code{10.0}. The default value is "1".
  7260. @item gamma_r
  7261. Set the gamma expression for red. The value must be a float in
  7262. range @code{0.1} to @code{10.0}. The default value is "1".
  7263. @item gamma_g
  7264. Set the gamma expression for green. The value must be a float in range
  7265. @code{0.1} to @code{10.0}. The default value is "1".
  7266. @item gamma_b
  7267. Set the gamma expression for blue. The value must be a float in range
  7268. @code{0.1} to @code{10.0}. The default value is "1".
  7269. @item gamma_weight
  7270. Set the gamma weight expression. It can be used to reduce the effect
  7271. of a high gamma value on bright image areas, e.g. keep them from
  7272. getting overamplified and just plain white. The value must be a float
  7273. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7274. gamma correction all the way down while @code{1.0} leaves it at its
  7275. full strength. Default is "1".
  7276. @item eval
  7277. Set when the expressions for brightness, contrast, saturation and
  7278. gamma expressions are evaluated.
  7279. It accepts the following values:
  7280. @table @samp
  7281. @item init
  7282. only evaluate expressions once during the filter initialization or
  7283. when a command is processed
  7284. @item frame
  7285. evaluate expressions for each incoming frame
  7286. @end table
  7287. Default value is @samp{init}.
  7288. @end table
  7289. The expressions accept the following parameters:
  7290. @table @option
  7291. @item n
  7292. frame count of the input frame starting from 0
  7293. @item pos
  7294. byte position of the corresponding packet in the input file, NAN if
  7295. unspecified
  7296. @item r
  7297. frame rate of the input video, NAN if the input frame rate is unknown
  7298. @item t
  7299. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7300. @end table
  7301. @subsection Commands
  7302. The filter supports the following commands:
  7303. @table @option
  7304. @item contrast
  7305. Set the contrast expression.
  7306. @item brightness
  7307. Set the brightness expression.
  7308. @item saturation
  7309. Set the saturation expression.
  7310. @item gamma
  7311. Set the gamma expression.
  7312. @item gamma_r
  7313. Set the gamma_r expression.
  7314. @item gamma_g
  7315. Set gamma_g expression.
  7316. @item gamma_b
  7317. Set gamma_b expression.
  7318. @item gamma_weight
  7319. Set gamma_weight expression.
  7320. The command accepts the same syntax of the corresponding option.
  7321. If the specified expression is not valid, it is kept at its current
  7322. value.
  7323. @end table
  7324. @section erosion
  7325. Apply erosion effect to the video.
  7326. This filter replaces the pixel by the local(3x3) minimum.
  7327. It accepts the following options:
  7328. @table @option
  7329. @item threshold0
  7330. @item threshold1
  7331. @item threshold2
  7332. @item threshold3
  7333. Limit the maximum change for each plane, default is 65535.
  7334. If 0, plane will remain unchanged.
  7335. @item coordinates
  7336. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7337. pixels are used.
  7338. Flags to local 3x3 coordinates maps like this:
  7339. 1 2 3
  7340. 4 5
  7341. 6 7 8
  7342. @end table
  7343. @section extractplanes
  7344. Extract color channel components from input video stream into
  7345. separate grayscale video streams.
  7346. The filter accepts the following option:
  7347. @table @option
  7348. @item planes
  7349. Set plane(s) to extract.
  7350. Available values for planes are:
  7351. @table @samp
  7352. @item y
  7353. @item u
  7354. @item v
  7355. @item a
  7356. @item r
  7357. @item g
  7358. @item b
  7359. @end table
  7360. Choosing planes not available in the input will result in an error.
  7361. That means you cannot select @code{r}, @code{g}, @code{b} planes
  7362. with @code{y}, @code{u}, @code{v} planes at same time.
  7363. @end table
  7364. @subsection Examples
  7365. @itemize
  7366. @item
  7367. Extract luma, u and v color channel component from input video frame
  7368. into 3 grayscale outputs:
  7369. @example
  7370. 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
  7371. @end example
  7372. @end itemize
  7373. @section elbg
  7374. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7375. For each input image, the filter will compute the optimal mapping from
  7376. the input to the output given the codebook length, that is the number
  7377. of distinct output colors.
  7378. This filter accepts the following options.
  7379. @table @option
  7380. @item codebook_length, l
  7381. Set codebook length. The value must be a positive integer, and
  7382. represents the number of distinct output colors. Default value is 256.
  7383. @item nb_steps, n
  7384. Set the maximum number of iterations to apply for computing the optimal
  7385. mapping. The higher the value the better the result and the higher the
  7386. computation time. Default value is 1.
  7387. @item seed, s
  7388. Set a random seed, must be an integer included between 0 and
  7389. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7390. will try to use a good random seed on a best effort basis.
  7391. @item pal8
  7392. Set pal8 output pixel format. This option does not work with codebook
  7393. length greater than 256.
  7394. @end table
  7395. @section entropy
  7396. Measure graylevel entropy in histogram of color channels of video frames.
  7397. It accepts the following parameters:
  7398. @table @option
  7399. @item mode
  7400. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7401. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7402. between neighbour histogram values.
  7403. @end table
  7404. @section fade
  7405. Apply a fade-in/out effect to the input video.
  7406. It accepts the following parameters:
  7407. @table @option
  7408. @item type, t
  7409. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7410. effect.
  7411. Default is @code{in}.
  7412. @item start_frame, s
  7413. Specify the number of the frame to start applying the fade
  7414. effect at. Default is 0.
  7415. @item nb_frames, n
  7416. The number of frames that the fade effect lasts. At the end of the
  7417. fade-in effect, the output video will have the same intensity as the input video.
  7418. At the end of the fade-out transition, the output video will be filled with the
  7419. selected @option{color}.
  7420. Default is 25.
  7421. @item alpha
  7422. If set to 1, fade only alpha channel, if one exists on the input.
  7423. Default value is 0.
  7424. @item start_time, st
  7425. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7426. effect. If both start_frame and start_time are specified, the fade will start at
  7427. whichever comes last. Default is 0.
  7428. @item duration, d
  7429. The number of seconds for which the fade effect has to last. At the end of the
  7430. fade-in effect the output video will have the same intensity as the input video,
  7431. at the end of the fade-out transition the output video will be filled with the
  7432. selected @option{color}.
  7433. If both duration and nb_frames are specified, duration is used. Default is 0
  7434. (nb_frames is used by default).
  7435. @item color, c
  7436. Specify the color of the fade. Default is "black".
  7437. @end table
  7438. @subsection Examples
  7439. @itemize
  7440. @item
  7441. Fade in the first 30 frames of video:
  7442. @example
  7443. fade=in:0:30
  7444. @end example
  7445. The command above is equivalent to:
  7446. @example
  7447. fade=t=in:s=0:n=30
  7448. @end example
  7449. @item
  7450. Fade out the last 45 frames of a 200-frame video:
  7451. @example
  7452. fade=out:155:45
  7453. fade=type=out:start_frame=155:nb_frames=45
  7454. @end example
  7455. @item
  7456. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7457. @example
  7458. fade=in:0:25, fade=out:975:25
  7459. @end example
  7460. @item
  7461. Make the first 5 frames yellow, then fade in from frame 5-24:
  7462. @example
  7463. fade=in:5:20:color=yellow
  7464. @end example
  7465. @item
  7466. Fade in alpha over first 25 frames of video:
  7467. @example
  7468. fade=in:0:25:alpha=1
  7469. @end example
  7470. @item
  7471. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7472. @example
  7473. fade=t=in:st=5.5:d=0.5
  7474. @end example
  7475. @end itemize
  7476. @section fftfilt
  7477. Apply arbitrary expressions to samples in frequency domain
  7478. @table @option
  7479. @item dc_Y
  7480. Adjust the dc value (gain) of the luma plane of the image. The filter
  7481. accepts an integer value in range @code{0} to @code{1000}. The default
  7482. value is set to @code{0}.
  7483. @item dc_U
  7484. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7485. filter accepts an integer value in range @code{0} to @code{1000}. The
  7486. default value is set to @code{0}.
  7487. @item dc_V
  7488. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7489. filter accepts an integer value in range @code{0} to @code{1000}. The
  7490. default value is set to @code{0}.
  7491. @item weight_Y
  7492. Set the frequency domain weight expression for the luma plane.
  7493. @item weight_U
  7494. Set the frequency domain weight expression for the 1st chroma plane.
  7495. @item weight_V
  7496. Set the frequency domain weight expression for the 2nd chroma plane.
  7497. @item eval
  7498. Set when the expressions are evaluated.
  7499. It accepts the following values:
  7500. @table @samp
  7501. @item init
  7502. Only evaluate expressions once during the filter initialization.
  7503. @item frame
  7504. Evaluate expressions for each incoming frame.
  7505. @end table
  7506. Default value is @samp{init}.
  7507. The filter accepts the following variables:
  7508. @item X
  7509. @item Y
  7510. The coordinates of the current sample.
  7511. @item W
  7512. @item H
  7513. The width and height of the image.
  7514. @item N
  7515. The number of input frame, starting from 0.
  7516. @end table
  7517. @subsection Examples
  7518. @itemize
  7519. @item
  7520. High-pass:
  7521. @example
  7522. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7523. @end example
  7524. @item
  7525. Low-pass:
  7526. @example
  7527. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7528. @end example
  7529. @item
  7530. Sharpen:
  7531. @example
  7532. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7533. @end example
  7534. @item
  7535. Blur:
  7536. @example
  7537. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7538. @end example
  7539. @end itemize
  7540. @section fftdnoiz
  7541. Denoise frames using 3D FFT (frequency domain filtering).
  7542. The filter accepts the following options:
  7543. @table @option
  7544. @item sigma
  7545. Set the noise sigma constant. This sets denoising strength.
  7546. Default value is 1. Allowed range is from 0 to 30.
  7547. Using very high sigma with low overlap may give blocking artifacts.
  7548. @item amount
  7549. Set amount of denoising. By default all detected noise is reduced.
  7550. Default value is 1. Allowed range is from 0 to 1.
  7551. @item block
  7552. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7553. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7554. block size in pixels is 2^4 which is 16.
  7555. @item overlap
  7556. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7557. @item prev
  7558. Set number of previous frames to use for denoising. By default is set to 0.
  7559. @item next
  7560. Set number of next frames to to use for denoising. By default is set to 0.
  7561. @item planes
  7562. Set planes which will be filtered, by default are all available filtered
  7563. except alpha.
  7564. @end table
  7565. @section field
  7566. Extract a single field from an interlaced image using stride
  7567. arithmetic to avoid wasting CPU time. The output frames are marked as
  7568. non-interlaced.
  7569. The filter accepts the following options:
  7570. @table @option
  7571. @item type
  7572. Specify whether to extract the top (if the value is @code{0} or
  7573. @code{top}) or the bottom field (if the value is @code{1} or
  7574. @code{bottom}).
  7575. @end table
  7576. @section fieldhint
  7577. Create new frames by copying the top and bottom fields from surrounding frames
  7578. supplied as numbers by the hint file.
  7579. @table @option
  7580. @item hint
  7581. Set file containing hints: absolute/relative frame numbers.
  7582. There must be one line for each frame in a clip. Each line must contain two
  7583. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7584. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7585. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7586. for @code{relative} mode. First number tells from which frame to pick up top
  7587. field and second number tells from which frame to pick up bottom field.
  7588. If optionally followed by @code{+} output frame will be marked as interlaced,
  7589. else if followed by @code{-} output frame will be marked as progressive, else
  7590. it will be marked same as input frame.
  7591. If line starts with @code{#} or @code{;} that line is skipped.
  7592. @item mode
  7593. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7594. @end table
  7595. Example of first several lines of @code{hint} file for @code{relative} mode:
  7596. @example
  7597. 0,0 - # first frame
  7598. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7599. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7600. 1,0 -
  7601. 0,0 -
  7602. 0,0 -
  7603. 1,0 -
  7604. 1,0 -
  7605. 1,0 -
  7606. 0,0 -
  7607. 0,0 -
  7608. 1,0 -
  7609. 1,0 -
  7610. 1,0 -
  7611. 0,0 -
  7612. @end example
  7613. @section fieldmatch
  7614. Field matching filter for inverse telecine. It is meant to reconstruct the
  7615. progressive frames from a telecined stream. The filter does not drop duplicated
  7616. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7617. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7618. The separation of the field matching and the decimation is notably motivated by
  7619. the possibility of inserting a de-interlacing filter fallback between the two.
  7620. If the source has mixed telecined and real interlaced content,
  7621. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7622. But these remaining combed frames will be marked as interlaced, and thus can be
  7623. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7624. In addition to the various configuration options, @code{fieldmatch} can take an
  7625. optional second stream, activated through the @option{ppsrc} option. If
  7626. enabled, the frames reconstruction will be based on the fields and frames from
  7627. this second stream. This allows the first input to be pre-processed in order to
  7628. help the various algorithms of the filter, while keeping the output lossless
  7629. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7630. or brightness/contrast adjustments can help.
  7631. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7632. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7633. which @code{fieldmatch} is based on. While the semantic and usage are very
  7634. close, some behaviour and options names can differ.
  7635. The @ref{decimate} filter currently only works for constant frame rate input.
  7636. If your input has mixed telecined (30fps) and progressive content with a lower
  7637. framerate like 24fps use the following filterchain to produce the necessary cfr
  7638. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7639. The filter accepts the following options:
  7640. @table @option
  7641. @item order
  7642. Specify the assumed field order of the input stream. Available values are:
  7643. @table @samp
  7644. @item auto
  7645. Auto detect parity (use FFmpeg's internal parity value).
  7646. @item bff
  7647. Assume bottom field first.
  7648. @item tff
  7649. Assume top field first.
  7650. @end table
  7651. Note that it is sometimes recommended not to trust the parity announced by the
  7652. stream.
  7653. Default value is @var{auto}.
  7654. @item mode
  7655. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7656. sense that it won't risk creating jerkiness due to duplicate frames when
  7657. possible, but if there are bad edits or blended fields it will end up
  7658. outputting combed frames when a good match might actually exist. On the other
  7659. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7660. but will almost always find a good frame if there is one. The other values are
  7661. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7662. jerkiness and creating duplicate frames versus finding good matches in sections
  7663. with bad edits, orphaned fields, blended fields, etc.
  7664. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7665. Available values are:
  7666. @table @samp
  7667. @item pc
  7668. 2-way matching (p/c)
  7669. @item pc_n
  7670. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7671. @item pc_u
  7672. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7673. @item pc_n_ub
  7674. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7675. still combed (p/c + n + u/b)
  7676. @item pcn
  7677. 3-way matching (p/c/n)
  7678. @item pcn_ub
  7679. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7680. detected as combed (p/c/n + u/b)
  7681. @end table
  7682. The parenthesis at the end indicate the matches that would be used for that
  7683. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7684. @var{top}).
  7685. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7686. the slowest.
  7687. Default value is @var{pc_n}.
  7688. @item ppsrc
  7689. Mark the main input stream as a pre-processed input, and enable the secondary
  7690. input stream as the clean source to pick the fields from. See the filter
  7691. introduction for more details. It is similar to the @option{clip2} feature from
  7692. VFM/TFM.
  7693. Default value is @code{0} (disabled).
  7694. @item field
  7695. Set the field to match from. It is recommended to set this to the same value as
  7696. @option{order} unless you experience matching failures with that setting. In
  7697. certain circumstances changing the field that is used to match from can have a
  7698. large impact on matching performance. Available values are:
  7699. @table @samp
  7700. @item auto
  7701. Automatic (same value as @option{order}).
  7702. @item bottom
  7703. Match from the bottom field.
  7704. @item top
  7705. Match from the top field.
  7706. @end table
  7707. Default value is @var{auto}.
  7708. @item mchroma
  7709. Set whether or not chroma is included during the match comparisons. In most
  7710. cases it is recommended to leave this enabled. You should set this to @code{0}
  7711. only if your clip has bad chroma problems such as heavy rainbowing or other
  7712. artifacts. Setting this to @code{0} could also be used to speed things up at
  7713. the cost of some accuracy.
  7714. Default value is @code{1}.
  7715. @item y0
  7716. @item y1
  7717. These define an exclusion band which excludes the lines between @option{y0} and
  7718. @option{y1} from being included in the field matching decision. An exclusion
  7719. band can be used to ignore subtitles, a logo, or other things that may
  7720. interfere with the matching. @option{y0} sets the starting scan line and
  7721. @option{y1} sets the ending line; all lines in between @option{y0} and
  7722. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7723. @option{y0} and @option{y1} to the same value will disable the feature.
  7724. @option{y0} and @option{y1} defaults to @code{0}.
  7725. @item scthresh
  7726. Set the scene change detection threshold as a percentage of maximum change on
  7727. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7728. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7729. @option{scthresh} is @code{[0.0, 100.0]}.
  7730. Default value is @code{12.0}.
  7731. @item combmatch
  7732. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7733. account the combed scores of matches when deciding what match to use as the
  7734. final match. Available values are:
  7735. @table @samp
  7736. @item none
  7737. No final matching based on combed scores.
  7738. @item sc
  7739. Combed scores are only used when a scene change is detected.
  7740. @item full
  7741. Use combed scores all the time.
  7742. @end table
  7743. Default is @var{sc}.
  7744. @item combdbg
  7745. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7746. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7747. Available values are:
  7748. @table @samp
  7749. @item none
  7750. No forced calculation.
  7751. @item pcn
  7752. Force p/c/n calculations.
  7753. @item pcnub
  7754. Force p/c/n/u/b calculations.
  7755. @end table
  7756. Default value is @var{none}.
  7757. @item cthresh
  7758. This is the area combing threshold used for combed frame detection. This
  7759. essentially controls how "strong" or "visible" combing must be to be detected.
  7760. Larger values mean combing must be more visible and smaller values mean combing
  7761. can be less visible or strong and still be detected. Valid settings are from
  7762. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7763. be detected as combed). This is basically a pixel difference value. A good
  7764. range is @code{[8, 12]}.
  7765. Default value is @code{9}.
  7766. @item chroma
  7767. Sets whether or not chroma is considered in the combed frame decision. Only
  7768. disable this if your source has chroma problems (rainbowing, etc.) that are
  7769. causing problems for the combed frame detection with chroma enabled. Actually,
  7770. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7771. where there is chroma only combing in the source.
  7772. Default value is @code{0}.
  7773. @item blockx
  7774. @item blocky
  7775. Respectively set the x-axis and y-axis size of the window used during combed
  7776. frame detection. This has to do with the size of the area in which
  7777. @option{combpel} pixels are required to be detected as combed for a frame to be
  7778. declared combed. See the @option{combpel} parameter description for more info.
  7779. Possible values are any number that is a power of 2 starting at 4 and going up
  7780. to 512.
  7781. Default value is @code{16}.
  7782. @item combpel
  7783. The number of combed pixels inside any of the @option{blocky} by
  7784. @option{blockx} size blocks on the frame for the frame to be detected as
  7785. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7786. setting controls "how much" combing there must be in any localized area (a
  7787. window defined by the @option{blockx} and @option{blocky} settings) on the
  7788. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7789. which point no frames will ever be detected as combed). This setting is known
  7790. as @option{MI} in TFM/VFM vocabulary.
  7791. Default value is @code{80}.
  7792. @end table
  7793. @anchor{p/c/n/u/b meaning}
  7794. @subsection p/c/n/u/b meaning
  7795. @subsubsection p/c/n
  7796. We assume the following telecined stream:
  7797. @example
  7798. Top fields: 1 2 2 3 4
  7799. Bottom fields: 1 2 3 4 4
  7800. @end example
  7801. The numbers correspond to the progressive frame the fields relate to. Here, the
  7802. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7803. When @code{fieldmatch} is configured to run a matching from bottom
  7804. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7805. @example
  7806. Input stream:
  7807. T 1 2 2 3 4
  7808. B 1 2 3 4 4 <-- matching reference
  7809. Matches: c c n n c
  7810. Output stream:
  7811. T 1 2 3 4 4
  7812. B 1 2 3 4 4
  7813. @end example
  7814. As a result of the field matching, we can see that some frames get duplicated.
  7815. To perform a complete inverse telecine, you need to rely on a decimation filter
  7816. after this operation. See for instance the @ref{decimate} filter.
  7817. The same operation now matching from top fields (@option{field}=@var{top})
  7818. looks like this:
  7819. @example
  7820. Input stream:
  7821. T 1 2 2 3 4 <-- matching reference
  7822. B 1 2 3 4 4
  7823. Matches: c c p p c
  7824. Output stream:
  7825. T 1 2 2 3 4
  7826. B 1 2 2 3 4
  7827. @end example
  7828. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7829. basically, they refer to the frame and field of the opposite parity:
  7830. @itemize
  7831. @item @var{p} matches the field of the opposite parity in the previous frame
  7832. @item @var{c} matches the field of the opposite parity in the current frame
  7833. @item @var{n} matches the field of the opposite parity in the next frame
  7834. @end itemize
  7835. @subsubsection u/b
  7836. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7837. from the opposite parity flag. In the following examples, we assume that we are
  7838. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7839. 'x' is placed above and below each matched fields.
  7840. With bottom matching (@option{field}=@var{bottom}):
  7841. @example
  7842. Match: c p n b u
  7843. x x x x x
  7844. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7845. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7846. x x x x x
  7847. Output frames:
  7848. 2 1 2 2 2
  7849. 2 2 2 1 3
  7850. @end example
  7851. With top matching (@option{field}=@var{top}):
  7852. @example
  7853. Match: c p n b u
  7854. x x x x x
  7855. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7856. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7857. x x x x x
  7858. Output frames:
  7859. 2 2 2 1 2
  7860. 2 1 3 2 2
  7861. @end example
  7862. @subsection Examples
  7863. Simple IVTC of a top field first telecined stream:
  7864. @example
  7865. fieldmatch=order=tff:combmatch=none, decimate
  7866. @end example
  7867. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7868. @example
  7869. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7870. @end example
  7871. @section fieldorder
  7872. Transform the field order of the input video.
  7873. It accepts the following parameters:
  7874. @table @option
  7875. @item order
  7876. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7877. for bottom field first.
  7878. @end table
  7879. The default value is @samp{tff}.
  7880. The transformation is done by shifting the picture content up or down
  7881. by one line, and filling the remaining line with appropriate picture content.
  7882. This method is consistent with most broadcast field order converters.
  7883. If the input video is not flagged as being interlaced, or it is already
  7884. flagged as being of the required output field order, then this filter does
  7885. not alter the incoming video.
  7886. It is very useful when converting to or from PAL DV material,
  7887. which is bottom field first.
  7888. For example:
  7889. @example
  7890. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7891. @end example
  7892. @section fifo, afifo
  7893. Buffer input images and send them when they are requested.
  7894. It is mainly useful when auto-inserted by the libavfilter
  7895. framework.
  7896. It does not take parameters.
  7897. @section fillborders
  7898. Fill borders of the input video, without changing video stream dimensions.
  7899. Sometimes video can have garbage at the four edges and you may not want to
  7900. crop video input to keep size multiple of some number.
  7901. This filter accepts the following options:
  7902. @table @option
  7903. @item left
  7904. Number of pixels to fill from left border.
  7905. @item right
  7906. Number of pixels to fill from right border.
  7907. @item top
  7908. Number of pixels to fill from top border.
  7909. @item bottom
  7910. Number of pixels to fill from bottom border.
  7911. @item mode
  7912. Set fill mode.
  7913. It accepts the following values:
  7914. @table @samp
  7915. @item smear
  7916. fill pixels using outermost pixels
  7917. @item mirror
  7918. fill pixels using mirroring
  7919. @item fixed
  7920. fill pixels with constant value
  7921. @end table
  7922. Default is @var{smear}.
  7923. @item color
  7924. Set color for pixels in fixed mode. Default is @var{black}.
  7925. @end table
  7926. @section find_rect
  7927. Find a rectangular object
  7928. It accepts the following options:
  7929. @table @option
  7930. @item object
  7931. Filepath of the object image, needs to be in gray8.
  7932. @item threshold
  7933. Detection threshold, default is 0.5.
  7934. @item mipmaps
  7935. Number of mipmaps, default is 3.
  7936. @item xmin, ymin, xmax, ymax
  7937. Specifies the rectangle in which to search.
  7938. @end table
  7939. @subsection Examples
  7940. @itemize
  7941. @item
  7942. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  7943. @example
  7944. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7945. @end example
  7946. @end itemize
  7947. @section cover_rect
  7948. Cover a rectangular object
  7949. It accepts the following options:
  7950. @table @option
  7951. @item cover
  7952. Filepath of the optional cover image, needs to be in yuv420.
  7953. @item mode
  7954. Set covering mode.
  7955. It accepts the following values:
  7956. @table @samp
  7957. @item cover
  7958. cover it by the supplied image
  7959. @item blur
  7960. cover it by interpolating the surrounding pixels
  7961. @end table
  7962. Default value is @var{blur}.
  7963. @end table
  7964. @subsection Examples
  7965. @itemize
  7966. @item
  7967. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  7968. @example
  7969. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7970. @end example
  7971. @end itemize
  7972. @section floodfill
  7973. Flood area with values of same pixel components with another values.
  7974. It accepts the following options:
  7975. @table @option
  7976. @item x
  7977. Set pixel x coordinate.
  7978. @item y
  7979. Set pixel y coordinate.
  7980. @item s0
  7981. Set source #0 component value.
  7982. @item s1
  7983. Set source #1 component value.
  7984. @item s2
  7985. Set source #2 component value.
  7986. @item s3
  7987. Set source #3 component value.
  7988. @item d0
  7989. Set destination #0 component value.
  7990. @item d1
  7991. Set destination #1 component value.
  7992. @item d2
  7993. Set destination #2 component value.
  7994. @item d3
  7995. Set destination #3 component value.
  7996. @end table
  7997. @anchor{format}
  7998. @section format
  7999. Convert the input video to one of the specified pixel formats.
  8000. Libavfilter will try to pick one that is suitable as input to
  8001. the next filter.
  8002. It accepts the following parameters:
  8003. @table @option
  8004. @item pix_fmts
  8005. A '|'-separated list of pixel format names, such as
  8006. "pix_fmts=yuv420p|monow|rgb24".
  8007. @end table
  8008. @subsection Examples
  8009. @itemize
  8010. @item
  8011. Convert the input video to the @var{yuv420p} format
  8012. @example
  8013. format=pix_fmts=yuv420p
  8014. @end example
  8015. Convert the input video to any of the formats in the list
  8016. @example
  8017. format=pix_fmts=yuv420p|yuv444p|yuv410p
  8018. @end example
  8019. @end itemize
  8020. @anchor{fps}
  8021. @section fps
  8022. Convert the video to specified constant frame rate by duplicating or dropping
  8023. frames as necessary.
  8024. It accepts the following parameters:
  8025. @table @option
  8026. @item fps
  8027. The desired output frame rate. The default is @code{25}.
  8028. @item start_time
  8029. Assume the first PTS should be the given value, in seconds. This allows for
  8030. padding/trimming at the start of stream. By default, no assumption is made
  8031. about the first frame's expected PTS, so no padding or trimming is done.
  8032. For example, this could be set to 0 to pad the beginning with duplicates of
  8033. the first frame if a video stream starts after the audio stream or to trim any
  8034. frames with a negative PTS.
  8035. @item round
  8036. Timestamp (PTS) rounding method.
  8037. Possible values are:
  8038. @table @option
  8039. @item zero
  8040. round towards 0
  8041. @item inf
  8042. round away from 0
  8043. @item down
  8044. round towards -infinity
  8045. @item up
  8046. round towards +infinity
  8047. @item near
  8048. round to nearest
  8049. @end table
  8050. The default is @code{near}.
  8051. @item eof_action
  8052. Action performed when reading the last frame.
  8053. Possible values are:
  8054. @table @option
  8055. @item round
  8056. Use same timestamp rounding method as used for other frames.
  8057. @item pass
  8058. Pass through last frame if input duration has not been reached yet.
  8059. @end table
  8060. The default is @code{round}.
  8061. @end table
  8062. Alternatively, the options can be specified as a flat string:
  8063. @var{fps}[:@var{start_time}[:@var{round}]].
  8064. See also the @ref{setpts} filter.
  8065. @subsection Examples
  8066. @itemize
  8067. @item
  8068. A typical usage in order to set the fps to 25:
  8069. @example
  8070. fps=fps=25
  8071. @end example
  8072. @item
  8073. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  8074. @example
  8075. fps=fps=film:round=near
  8076. @end example
  8077. @end itemize
  8078. @section framepack
  8079. Pack two different video streams into a stereoscopic video, setting proper
  8080. metadata on supported codecs. The two views should have the same size and
  8081. framerate and processing will stop when the shorter video ends. Please note
  8082. that you may conveniently adjust view properties with the @ref{scale} and
  8083. @ref{fps} filters.
  8084. It accepts the following parameters:
  8085. @table @option
  8086. @item format
  8087. The desired packing format. Supported values are:
  8088. @table @option
  8089. @item sbs
  8090. The views are next to each other (default).
  8091. @item tab
  8092. The views are on top of each other.
  8093. @item lines
  8094. The views are packed by line.
  8095. @item columns
  8096. The views are packed by column.
  8097. @item frameseq
  8098. The views are temporally interleaved.
  8099. @end table
  8100. @end table
  8101. Some examples:
  8102. @example
  8103. # Convert left and right views into a frame-sequential video
  8104. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8105. # Convert views into a side-by-side video with the same output resolution as the input
  8106. 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
  8107. @end example
  8108. @section framerate
  8109. Change the frame rate by interpolating new video output frames from the source
  8110. frames.
  8111. This filter is not designed to function correctly with interlaced media. If
  8112. you wish to change the frame rate of interlaced media then you are required
  8113. to deinterlace before this filter and re-interlace after this filter.
  8114. A description of the accepted options follows.
  8115. @table @option
  8116. @item fps
  8117. Specify the output frames per second. This option can also be specified
  8118. as a value alone. The default is @code{50}.
  8119. @item interp_start
  8120. Specify the start of a range where the output frame will be created as a
  8121. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8122. the default is @code{15}.
  8123. @item interp_end
  8124. Specify the end of a range where the output frame will be created as a
  8125. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8126. the default is @code{240}.
  8127. @item scene
  8128. Specify the level at which a scene change is detected as a value between
  8129. 0 and 100 to indicate a new scene; a low value reflects a low
  8130. probability for the current frame to introduce a new scene, while a higher
  8131. value means the current frame is more likely to be one.
  8132. The default is @code{8.2}.
  8133. @item flags
  8134. Specify flags influencing the filter process.
  8135. Available value for @var{flags} is:
  8136. @table @option
  8137. @item scene_change_detect, scd
  8138. Enable scene change detection using the value of the option @var{scene}.
  8139. This flag is enabled by default.
  8140. @end table
  8141. @end table
  8142. @section framestep
  8143. Select one frame every N-th frame.
  8144. This filter accepts the following option:
  8145. @table @option
  8146. @item step
  8147. Select frame after every @code{step} frames.
  8148. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8149. @end table
  8150. @section freezedetect
  8151. Detect frozen video.
  8152. This filter logs a message and sets frame metadata when it detects that the
  8153. input video has no significant change in content during a specified duration.
  8154. Video freeze detection calculates the mean average absolute difference of all
  8155. the components of video frames and compares it to a noise floor.
  8156. The printed times and duration are expressed in seconds. The
  8157. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8158. whose timestamp equals or exceeds the detection duration and it contains the
  8159. timestamp of the first frame of the freeze. The
  8160. @code{lavfi.freezedetect.freeze_duration} and
  8161. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8162. after the freeze.
  8163. The filter accepts the following options:
  8164. @table @option
  8165. @item noise, n
  8166. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8167. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8168. 0.001.
  8169. @item duration, d
  8170. Set freeze duration until notification (default is 2 seconds).
  8171. @end table
  8172. @anchor{frei0r}
  8173. @section frei0r
  8174. Apply a frei0r effect to the input video.
  8175. To enable the compilation of this filter, you need to install the frei0r
  8176. header and configure FFmpeg with @code{--enable-frei0r}.
  8177. It accepts the following parameters:
  8178. @table @option
  8179. @item filter_name
  8180. The name of the frei0r effect to load. If the environment variable
  8181. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8182. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8183. Otherwise, the standard frei0r paths are searched, in this order:
  8184. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8185. @file{/usr/lib/frei0r-1/}.
  8186. @item filter_params
  8187. A '|'-separated list of parameters to pass to the frei0r effect.
  8188. @end table
  8189. A frei0r effect parameter can be a boolean (its value is either
  8190. "y" or "n"), a double, a color (specified as
  8191. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8192. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8193. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8194. a position (specified as @var{X}/@var{Y}, where
  8195. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8196. The number and types of parameters depend on the loaded effect. If an
  8197. effect parameter is not specified, the default value is set.
  8198. @subsection Examples
  8199. @itemize
  8200. @item
  8201. Apply the distort0r effect, setting the first two double parameters:
  8202. @example
  8203. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8204. @end example
  8205. @item
  8206. Apply the colordistance effect, taking a color as the first parameter:
  8207. @example
  8208. frei0r=colordistance:0.2/0.3/0.4
  8209. frei0r=colordistance:violet
  8210. frei0r=colordistance:0x112233
  8211. @end example
  8212. @item
  8213. Apply the perspective effect, specifying the top left and top right image
  8214. positions:
  8215. @example
  8216. frei0r=perspective:0.2/0.2|0.8/0.2
  8217. @end example
  8218. @end itemize
  8219. For more information, see
  8220. @url{http://frei0r.dyne.org}
  8221. @section fspp
  8222. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8223. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8224. processing filter, one of them is performed once per block, not per pixel.
  8225. This allows for much higher speed.
  8226. The filter accepts the following options:
  8227. @table @option
  8228. @item quality
  8229. Set quality. This option defines the number of levels for averaging. It accepts
  8230. an integer in the range 4-5. Default value is @code{4}.
  8231. @item qp
  8232. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8233. If not set, the filter will use the QP from the video stream (if available).
  8234. @item strength
  8235. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8236. more details but also more artifacts, while higher values make the image smoother
  8237. but also blurrier. Default value is @code{0} − PSNR optimal.
  8238. @item use_bframe_qp
  8239. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8240. option may cause flicker since the B-Frames have often larger QP. Default is
  8241. @code{0} (not enabled).
  8242. @end table
  8243. @section gblur
  8244. Apply Gaussian blur filter.
  8245. The filter accepts the following options:
  8246. @table @option
  8247. @item sigma
  8248. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8249. @item steps
  8250. Set number of steps for Gaussian approximation. Default is @code{1}.
  8251. @item planes
  8252. Set which planes to filter. By default all planes are filtered.
  8253. @item sigmaV
  8254. Set vertical sigma, if negative it will be same as @code{sigma}.
  8255. Default is @code{-1}.
  8256. @end table
  8257. @section geq
  8258. Apply generic equation to each pixel.
  8259. The filter accepts the following options:
  8260. @table @option
  8261. @item lum_expr, lum
  8262. Set the luminance expression.
  8263. @item cb_expr, cb
  8264. Set the chrominance blue expression.
  8265. @item cr_expr, cr
  8266. Set the chrominance red expression.
  8267. @item alpha_expr, a
  8268. Set the alpha expression.
  8269. @item red_expr, r
  8270. Set the red expression.
  8271. @item green_expr, g
  8272. Set the green expression.
  8273. @item blue_expr, b
  8274. Set the blue expression.
  8275. @end table
  8276. The colorspace is selected according to the specified options. If one
  8277. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8278. options is specified, the filter will automatically select a YCbCr
  8279. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8280. @option{blue_expr} options is specified, it will select an RGB
  8281. colorspace.
  8282. If one of the chrominance expression is not defined, it falls back on the other
  8283. one. If no alpha expression is specified it will evaluate to opaque value.
  8284. If none of chrominance expressions are specified, they will evaluate
  8285. to the luminance expression.
  8286. The expressions can use the following variables and functions:
  8287. @table @option
  8288. @item N
  8289. The sequential number of the filtered frame, starting from @code{0}.
  8290. @item X
  8291. @item Y
  8292. The coordinates of the current sample.
  8293. @item W
  8294. @item H
  8295. The width and height of the image.
  8296. @item SW
  8297. @item SH
  8298. Width and height scale depending on the currently filtered plane. It is the
  8299. ratio between the corresponding luma plane number of pixels and the current
  8300. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8301. @code{0.5,0.5} for chroma planes.
  8302. @item T
  8303. Time of the current frame, expressed in seconds.
  8304. @item p(x, y)
  8305. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8306. plane.
  8307. @item lum(x, y)
  8308. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8309. plane.
  8310. @item cb(x, y)
  8311. Return the value of the pixel at location (@var{x},@var{y}) of the
  8312. blue-difference chroma plane. Return 0 if there is no such plane.
  8313. @item cr(x, y)
  8314. Return the value of the pixel at location (@var{x},@var{y}) of the
  8315. red-difference chroma plane. Return 0 if there is no such plane.
  8316. @item r(x, y)
  8317. @item g(x, y)
  8318. @item b(x, y)
  8319. Return the value of the pixel at location (@var{x},@var{y}) of the
  8320. red/green/blue component. Return 0 if there is no such component.
  8321. @item alpha(x, y)
  8322. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8323. plane. Return 0 if there is no such plane.
  8324. @end table
  8325. For functions, if @var{x} and @var{y} are outside the area, the value will be
  8326. automatically clipped to the closer edge.
  8327. @subsection Examples
  8328. @itemize
  8329. @item
  8330. Flip the image horizontally:
  8331. @example
  8332. geq=p(W-X\,Y)
  8333. @end example
  8334. @item
  8335. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  8336. wavelength of 100 pixels:
  8337. @example
  8338. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  8339. @end example
  8340. @item
  8341. Generate a fancy enigmatic moving light:
  8342. @example
  8343. 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
  8344. @end example
  8345. @item
  8346. Generate a quick emboss effect:
  8347. @example
  8348. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  8349. @end example
  8350. @item
  8351. Modify RGB components depending on pixel position:
  8352. @example
  8353. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  8354. @end example
  8355. @item
  8356. Create a radial gradient that is the same size as the input (also see
  8357. the @ref{vignette} filter):
  8358. @example
  8359. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8360. @end example
  8361. @end itemize
  8362. @section gradfun
  8363. Fix the banding artifacts that are sometimes introduced into nearly flat
  8364. regions by truncation to 8-bit color depth.
  8365. Interpolate the gradients that should go where the bands are, and
  8366. dither them.
  8367. It is designed for playback only. Do not use it prior to
  8368. lossy compression, because compression tends to lose the dither and
  8369. bring back the bands.
  8370. It accepts the following parameters:
  8371. @table @option
  8372. @item strength
  8373. The maximum amount by which the filter will change any one pixel. This is also
  8374. the threshold for detecting nearly flat regions. Acceptable values range from
  8375. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8376. valid range.
  8377. @item radius
  8378. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8379. gradients, but also prevents the filter from modifying the pixels near detailed
  8380. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8381. values will be clipped to the valid range.
  8382. @end table
  8383. Alternatively, the options can be specified as a flat string:
  8384. @var{strength}[:@var{radius}]
  8385. @subsection Examples
  8386. @itemize
  8387. @item
  8388. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8389. @example
  8390. gradfun=3.5:8
  8391. @end example
  8392. @item
  8393. Specify radius, omitting the strength (which will fall-back to the default
  8394. value):
  8395. @example
  8396. gradfun=radius=8
  8397. @end example
  8398. @end itemize
  8399. @section graphmonitor, agraphmonitor
  8400. Show various filtergraph stats.
  8401. With this filter one can debug complete filtergraph.
  8402. Especially issues with links filling with queued frames.
  8403. The filter accepts the following options:
  8404. @table @option
  8405. @item size, s
  8406. Set video output size. Default is @var{hd720}.
  8407. @item opacity, o
  8408. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8409. @item mode, m
  8410. Set output mode, can be @var{fulll} or @var{compact}.
  8411. In @var{compact} mode only filters with some queued frames have displayed stats.
  8412. @item flags, f
  8413. Set flags which enable which stats are shown in video.
  8414. Available values for flags are:
  8415. @table @samp
  8416. @item queue
  8417. Display number of queued frames in each link.
  8418. @item frame_count_in
  8419. Display number of frames taken from filter.
  8420. @item frame_count_out
  8421. Display number of frames given out from filter.
  8422. @item pts
  8423. Display current filtered frame pts.
  8424. @item time
  8425. Display current filtered frame time.
  8426. @item timebase
  8427. Display time base for filter link.
  8428. @item format
  8429. Display used format for filter link.
  8430. @item size
  8431. Display video size or number of audio channels in case of audio used by filter link.
  8432. @item rate
  8433. Display video frame rate or sample rate in case of audio used by filter link.
  8434. @end table
  8435. @item rate, r
  8436. Set upper limit for video rate of output stream, Default value is @var{25}.
  8437. This guarantee that output video frame rate will not be higher than this value.
  8438. @end table
  8439. @section greyedge
  8440. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8441. and corrects the scene colors accordingly.
  8442. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8443. The filter accepts the following options:
  8444. @table @option
  8445. @item difford
  8446. The order of differentiation to be applied on the scene. Must be chosen in the range
  8447. [0,2] and default value is 1.
  8448. @item minknorm
  8449. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8450. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8451. max value instead of calculating Minkowski distance.
  8452. @item sigma
  8453. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8454. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8455. can't be equal to 0 if @var{difford} is greater than 0.
  8456. @end table
  8457. @subsection Examples
  8458. @itemize
  8459. @item
  8460. Grey Edge:
  8461. @example
  8462. greyedge=difford=1:minknorm=5:sigma=2
  8463. @end example
  8464. @item
  8465. Max Edge:
  8466. @example
  8467. greyedge=difford=1:minknorm=0:sigma=2
  8468. @end example
  8469. @end itemize
  8470. @anchor{haldclut}
  8471. @section haldclut
  8472. Apply a Hald CLUT to a video stream.
  8473. First input is the video stream to process, and second one is the Hald CLUT.
  8474. The Hald CLUT input can be a simple picture or a complete video stream.
  8475. The filter accepts the following options:
  8476. @table @option
  8477. @item shortest
  8478. Force termination when the shortest input terminates. Default is @code{0}.
  8479. @item repeatlast
  8480. Continue applying the last CLUT after the end of the stream. A value of
  8481. @code{0} disable the filter after the last frame of the CLUT is reached.
  8482. Default is @code{1}.
  8483. @end table
  8484. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8485. filters share the same internals).
  8486. This filter also supports the @ref{framesync} options.
  8487. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8488. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8489. @subsection Workflow examples
  8490. @subsubsection Hald CLUT video stream
  8491. Generate an identity Hald CLUT stream altered with various effects:
  8492. @example
  8493. 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
  8494. @end example
  8495. Note: make sure you use a lossless codec.
  8496. Then use it with @code{haldclut} to apply it on some random stream:
  8497. @example
  8498. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8499. @end example
  8500. The Hald CLUT will be applied to the 10 first seconds (duration of
  8501. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8502. to the remaining frames of the @code{mandelbrot} stream.
  8503. @subsubsection Hald CLUT with preview
  8504. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8505. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8506. biggest possible square starting at the top left of the picture. The remaining
  8507. padding pixels (bottom or right) will be ignored. This area can be used to add
  8508. a preview of the Hald CLUT.
  8509. Typically, the following generated Hald CLUT will be supported by the
  8510. @code{haldclut} filter:
  8511. @example
  8512. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8513. pad=iw+320 [padded_clut];
  8514. smptebars=s=320x256, split [a][b];
  8515. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8516. [main][b] overlay=W-320" -frames:v 1 clut.png
  8517. @end example
  8518. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8519. bars are displayed on the right-top, and below the same color bars processed by
  8520. the color changes.
  8521. Then, the effect of this Hald CLUT can be visualized with:
  8522. @example
  8523. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8524. @end example
  8525. @section hflip
  8526. Flip the input video horizontally.
  8527. For example, to horizontally flip the input video with @command{ffmpeg}:
  8528. @example
  8529. ffmpeg -i in.avi -vf "hflip" out.avi
  8530. @end example
  8531. @section histeq
  8532. This filter applies a global color histogram equalization on a
  8533. per-frame basis.
  8534. It can be used to correct video that has a compressed range of pixel
  8535. intensities. The filter redistributes the pixel intensities to
  8536. equalize their distribution across the intensity range. It may be
  8537. viewed as an "automatically adjusting contrast filter". This filter is
  8538. useful only for correcting degraded or poorly captured source
  8539. video.
  8540. The filter accepts the following options:
  8541. @table @option
  8542. @item strength
  8543. Determine the amount of equalization to be applied. As the strength
  8544. is reduced, the distribution of pixel intensities more-and-more
  8545. approaches that of the input frame. The value must be a float number
  8546. in the range [0,1] and defaults to 0.200.
  8547. @item intensity
  8548. Set the maximum intensity that can generated and scale the output
  8549. values appropriately. The strength should be set as desired and then
  8550. the intensity can be limited if needed to avoid washing-out. The value
  8551. must be a float number in the range [0,1] and defaults to 0.210.
  8552. @item antibanding
  8553. Set the antibanding level. If enabled the filter will randomly vary
  8554. the luminance of output pixels by a small amount to avoid banding of
  8555. the histogram. Possible values are @code{none}, @code{weak} or
  8556. @code{strong}. It defaults to @code{none}.
  8557. @end table
  8558. @section histogram
  8559. Compute and draw a color distribution histogram for the input video.
  8560. The computed histogram is a representation of the color component
  8561. distribution in an image.
  8562. Standard histogram displays the color components distribution in an image.
  8563. Displays color graph for each color component. Shows distribution of
  8564. the Y, U, V, A or R, G, B components, depending on input format, in the
  8565. current frame. Below each graph a color component scale meter is shown.
  8566. The filter accepts the following options:
  8567. @table @option
  8568. @item level_height
  8569. Set height of level. Default value is @code{200}.
  8570. Allowed range is [50, 2048].
  8571. @item scale_height
  8572. Set height of color scale. Default value is @code{12}.
  8573. Allowed range is [0, 40].
  8574. @item display_mode
  8575. Set display mode.
  8576. It accepts the following values:
  8577. @table @samp
  8578. @item stack
  8579. Per color component graphs are placed below each other.
  8580. @item parade
  8581. Per color component graphs are placed side by side.
  8582. @item overlay
  8583. Presents information identical to that in the @code{parade}, except
  8584. that the graphs representing color components are superimposed directly
  8585. over one another.
  8586. @end table
  8587. Default is @code{stack}.
  8588. @item levels_mode
  8589. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8590. Default is @code{linear}.
  8591. @item components
  8592. Set what color components to display.
  8593. Default is @code{7}.
  8594. @item fgopacity
  8595. Set foreground opacity. Default is @code{0.7}.
  8596. @item bgopacity
  8597. Set background opacity. Default is @code{0.5}.
  8598. @end table
  8599. @subsection Examples
  8600. @itemize
  8601. @item
  8602. Calculate and draw histogram:
  8603. @example
  8604. ffplay -i input -vf histogram
  8605. @end example
  8606. @end itemize
  8607. @anchor{hqdn3d}
  8608. @section hqdn3d
  8609. This is a high precision/quality 3d denoise filter. It aims to reduce
  8610. image noise, producing smooth images and making still images really
  8611. still. It should enhance compressibility.
  8612. It accepts the following optional parameters:
  8613. @table @option
  8614. @item luma_spatial
  8615. A non-negative floating point number which specifies spatial luma strength.
  8616. It defaults to 4.0.
  8617. @item chroma_spatial
  8618. A non-negative floating point number which specifies spatial chroma strength.
  8619. It defaults to 3.0*@var{luma_spatial}/4.0.
  8620. @item luma_tmp
  8621. A floating point number which specifies luma temporal strength. It defaults to
  8622. 6.0*@var{luma_spatial}/4.0.
  8623. @item chroma_tmp
  8624. A floating point number which specifies chroma temporal strength. It defaults to
  8625. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8626. @end table
  8627. @anchor{hwdownload}
  8628. @section hwdownload
  8629. Download hardware frames to system memory.
  8630. The input must be in hardware frames, and the output a non-hardware format.
  8631. Not all formats will be supported on the output - it may be necessary to insert
  8632. an additional @option{format} filter immediately following in the graph to get
  8633. the output in a supported format.
  8634. @section hwmap
  8635. Map hardware frames to system memory or to another device.
  8636. This filter has several different modes of operation; which one is used depends
  8637. on the input and output formats:
  8638. @itemize
  8639. @item
  8640. Hardware frame input, normal frame output
  8641. Map the input frames to system memory and pass them to the output. If the
  8642. original hardware frame is later required (for example, after overlaying
  8643. something else on part of it), the @option{hwmap} filter can be used again
  8644. in the next mode to retrieve it.
  8645. @item
  8646. Normal frame input, hardware frame output
  8647. If the input is actually a software-mapped hardware frame, then unmap it -
  8648. that is, return the original hardware frame.
  8649. Otherwise, a device must be provided. Create new hardware surfaces on that
  8650. device for the output, then map them back to the software format at the input
  8651. and give those frames to the preceding filter. This will then act like the
  8652. @option{hwupload} filter, but may be able to avoid an additional copy when
  8653. the input is already in a compatible format.
  8654. @item
  8655. Hardware frame input and output
  8656. A device must be supplied for the output, either directly or with the
  8657. @option{derive_device} option. The input and output devices must be of
  8658. different types and compatible - the exact meaning of this is
  8659. system-dependent, but typically it means that they must refer to the same
  8660. underlying hardware context (for example, refer to the same graphics card).
  8661. If the input frames were originally created on the output device, then unmap
  8662. to retrieve the original frames.
  8663. Otherwise, map the frames to the output device - create new hardware frames
  8664. on the output corresponding to the frames on the input.
  8665. @end itemize
  8666. The following additional parameters are accepted:
  8667. @table @option
  8668. @item mode
  8669. Set the frame mapping mode. Some combination of:
  8670. @table @var
  8671. @item read
  8672. The mapped frame should be readable.
  8673. @item write
  8674. The mapped frame should be writeable.
  8675. @item overwrite
  8676. The mapping will always overwrite the entire frame.
  8677. This may improve performance in some cases, as the original contents of the
  8678. frame need not be loaded.
  8679. @item direct
  8680. The mapping must not involve any copying.
  8681. Indirect mappings to copies of frames are created in some cases where either
  8682. direct mapping is not possible or it would have unexpected properties.
  8683. Setting this flag ensures that the mapping is direct and will fail if that is
  8684. not possible.
  8685. @end table
  8686. Defaults to @var{read+write} if not specified.
  8687. @item derive_device @var{type}
  8688. Rather than using the device supplied at initialisation, instead derive a new
  8689. device of type @var{type} from the device the input frames exist on.
  8690. @item reverse
  8691. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8692. and map them back to the source. This may be necessary in some cases where
  8693. a mapping in one direction is required but only the opposite direction is
  8694. supported by the devices being used.
  8695. This option is dangerous - it may break the preceding filter in undefined
  8696. ways if there are any additional constraints on that filter's output.
  8697. Do not use it without fully understanding the implications of its use.
  8698. @end table
  8699. @anchor{hwupload}
  8700. @section hwupload
  8701. Upload system memory frames to hardware surfaces.
  8702. The device to upload to must be supplied when the filter is initialised. If
  8703. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8704. option.
  8705. @anchor{hwupload_cuda}
  8706. @section hwupload_cuda
  8707. Upload system memory frames to a CUDA device.
  8708. It accepts the following optional parameters:
  8709. @table @option
  8710. @item device
  8711. The number of the CUDA device to use
  8712. @end table
  8713. @section hqx
  8714. Apply a high-quality magnification filter designed for pixel art. This filter
  8715. was originally created by Maxim Stepin.
  8716. It accepts the following option:
  8717. @table @option
  8718. @item n
  8719. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8720. @code{hq3x} and @code{4} for @code{hq4x}.
  8721. Default is @code{3}.
  8722. @end table
  8723. @section hstack
  8724. Stack input videos horizontally.
  8725. All streams must be of same pixel format and of same height.
  8726. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8727. to create same output.
  8728. The filter accept the following option:
  8729. @table @option
  8730. @item inputs
  8731. Set number of input streams. Default is 2.
  8732. @item shortest
  8733. If set to 1, force the output to terminate when the shortest input
  8734. terminates. Default value is 0.
  8735. @end table
  8736. @section hue
  8737. Modify the hue and/or the saturation of the input.
  8738. It accepts the following parameters:
  8739. @table @option
  8740. @item h
  8741. Specify the hue angle as a number of degrees. It accepts an expression,
  8742. and defaults to "0".
  8743. @item s
  8744. Specify the saturation in the [-10,10] range. It accepts an expression and
  8745. defaults to "1".
  8746. @item H
  8747. Specify the hue angle as a number of radians. It accepts an
  8748. expression, and defaults to "0".
  8749. @item b
  8750. Specify the brightness in the [-10,10] range. It accepts an expression and
  8751. defaults to "0".
  8752. @end table
  8753. @option{h} and @option{H} are mutually exclusive, and can't be
  8754. specified at the same time.
  8755. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8756. expressions containing the following constants:
  8757. @table @option
  8758. @item n
  8759. frame count of the input frame starting from 0
  8760. @item pts
  8761. presentation timestamp of the input frame expressed in time base units
  8762. @item r
  8763. frame rate of the input video, NAN if the input frame rate is unknown
  8764. @item t
  8765. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8766. @item tb
  8767. time base of the input video
  8768. @end table
  8769. @subsection Examples
  8770. @itemize
  8771. @item
  8772. Set the hue to 90 degrees and the saturation to 1.0:
  8773. @example
  8774. hue=h=90:s=1
  8775. @end example
  8776. @item
  8777. Same command but expressing the hue in radians:
  8778. @example
  8779. hue=H=PI/2:s=1
  8780. @end example
  8781. @item
  8782. Rotate hue and make the saturation swing between 0
  8783. and 2 over a period of 1 second:
  8784. @example
  8785. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8786. @end example
  8787. @item
  8788. Apply a 3 seconds saturation fade-in effect starting at 0:
  8789. @example
  8790. hue="s=min(t/3\,1)"
  8791. @end example
  8792. The general fade-in expression can be written as:
  8793. @example
  8794. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8795. @end example
  8796. @item
  8797. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8798. @example
  8799. hue="s=max(0\, min(1\, (8-t)/3))"
  8800. @end example
  8801. The general fade-out expression can be written as:
  8802. @example
  8803. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8804. @end example
  8805. @end itemize
  8806. @subsection Commands
  8807. This filter supports the following commands:
  8808. @table @option
  8809. @item b
  8810. @item s
  8811. @item h
  8812. @item H
  8813. Modify the hue and/or the saturation and/or brightness of the input video.
  8814. The command accepts the same syntax of the corresponding option.
  8815. If the specified expression is not valid, it is kept at its current
  8816. value.
  8817. @end table
  8818. @section hysteresis
  8819. Grow first stream into second stream by connecting components.
  8820. This makes it possible to build more robust edge masks.
  8821. This filter accepts the following options:
  8822. @table @option
  8823. @item planes
  8824. Set which planes will be processed as bitmap, unprocessed planes will be
  8825. copied from first stream.
  8826. By default value 0xf, all planes will be processed.
  8827. @item threshold
  8828. Set threshold which is used in filtering. If pixel component value is higher than
  8829. this value filter algorithm for connecting components is activated.
  8830. By default value is 0.
  8831. @end table
  8832. @section idet
  8833. Detect video interlacing type.
  8834. This filter tries to detect if the input frames are interlaced, progressive,
  8835. top or bottom field first. It will also try to detect fields that are
  8836. repeated between adjacent frames (a sign of telecine).
  8837. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8838. Multiple frame detection incorporates the classification history of previous frames.
  8839. The filter will log these metadata values:
  8840. @table @option
  8841. @item single.current_frame
  8842. Detected type of current frame using single-frame detection. One of:
  8843. ``tff'' (top field first), ``bff'' (bottom field first),
  8844. ``progressive'', or ``undetermined''
  8845. @item single.tff
  8846. Cumulative number of frames detected as top field first using single-frame detection.
  8847. @item multiple.tff
  8848. Cumulative number of frames detected as top field first using multiple-frame detection.
  8849. @item single.bff
  8850. Cumulative number of frames detected as bottom field first using single-frame detection.
  8851. @item multiple.current_frame
  8852. Detected type of current frame using multiple-frame detection. One of:
  8853. ``tff'' (top field first), ``bff'' (bottom field first),
  8854. ``progressive'', or ``undetermined''
  8855. @item multiple.bff
  8856. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8857. @item single.progressive
  8858. Cumulative number of frames detected as progressive using single-frame detection.
  8859. @item multiple.progressive
  8860. Cumulative number of frames detected as progressive using multiple-frame detection.
  8861. @item single.undetermined
  8862. Cumulative number of frames that could not be classified using single-frame detection.
  8863. @item multiple.undetermined
  8864. Cumulative number of frames that could not be classified using multiple-frame detection.
  8865. @item repeated.current_frame
  8866. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8867. @item repeated.neither
  8868. Cumulative number of frames with no repeated field.
  8869. @item repeated.top
  8870. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8871. @item repeated.bottom
  8872. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8873. @end table
  8874. The filter accepts the following options:
  8875. @table @option
  8876. @item intl_thres
  8877. Set interlacing threshold.
  8878. @item prog_thres
  8879. Set progressive threshold.
  8880. @item rep_thres
  8881. Threshold for repeated field detection.
  8882. @item half_life
  8883. Number of frames after which a given frame's contribution to the
  8884. statistics is halved (i.e., it contributes only 0.5 to its
  8885. classification). The default of 0 means that all frames seen are given
  8886. full weight of 1.0 forever.
  8887. @item analyze_interlaced_flag
  8888. When this is not 0 then idet will use the specified number of frames to determine
  8889. if the interlaced flag is accurate, it will not count undetermined frames.
  8890. If the flag is found to be accurate it will be used without any further
  8891. computations, if it is found to be inaccurate it will be cleared without any
  8892. further computations. This allows inserting the idet filter as a low computational
  8893. method to clean up the interlaced flag
  8894. @end table
  8895. @section il
  8896. Deinterleave or interleave fields.
  8897. This filter allows one to process interlaced images fields without
  8898. deinterlacing them. Deinterleaving splits the input frame into 2
  8899. fields (so called half pictures). Odd lines are moved to the top
  8900. half of the output image, even lines to the bottom half.
  8901. You can process (filter) them independently and then re-interleave them.
  8902. The filter accepts the following options:
  8903. @table @option
  8904. @item luma_mode, l
  8905. @item chroma_mode, c
  8906. @item alpha_mode, a
  8907. Available values for @var{luma_mode}, @var{chroma_mode} and
  8908. @var{alpha_mode} are:
  8909. @table @samp
  8910. @item none
  8911. Do nothing.
  8912. @item deinterleave, d
  8913. Deinterleave fields, placing one above the other.
  8914. @item interleave, i
  8915. Interleave fields. Reverse the effect of deinterleaving.
  8916. @end table
  8917. Default value is @code{none}.
  8918. @item luma_swap, ls
  8919. @item chroma_swap, cs
  8920. @item alpha_swap, as
  8921. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  8922. @end table
  8923. @section inflate
  8924. Apply inflate effect to the video.
  8925. This filter replaces the pixel by the local(3x3) average by taking into account
  8926. only values higher than the pixel.
  8927. It accepts the following options:
  8928. @table @option
  8929. @item threshold0
  8930. @item threshold1
  8931. @item threshold2
  8932. @item threshold3
  8933. Limit the maximum change for each plane, default is 65535.
  8934. If 0, plane will remain unchanged.
  8935. @end table
  8936. @section interlace
  8937. Simple interlacing filter from progressive contents. This interleaves upper (or
  8938. lower) lines from odd frames with lower (or upper) lines from even frames,
  8939. halving the frame rate and preserving image height.
  8940. @example
  8941. Original Original New Frame
  8942. Frame 'j' Frame 'j+1' (tff)
  8943. ========== =========== ==================
  8944. Line 0 --------------------> Frame 'j' Line 0
  8945. Line 1 Line 1 ----> Frame 'j+1' Line 1
  8946. Line 2 ---------------------> Frame 'j' Line 2
  8947. Line 3 Line 3 ----> Frame 'j+1' Line 3
  8948. ... ... ...
  8949. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  8950. @end example
  8951. It accepts the following optional parameters:
  8952. @table @option
  8953. @item scan
  8954. This determines whether the interlaced frame is taken from the even
  8955. (tff - default) or odd (bff) lines of the progressive frame.
  8956. @item lowpass
  8957. Vertical lowpass filter to avoid twitter interlacing and
  8958. reduce moire patterns.
  8959. @table @samp
  8960. @item 0, off
  8961. Disable vertical lowpass filter
  8962. @item 1, linear
  8963. Enable linear filter (default)
  8964. @item 2, complex
  8965. Enable complex filter. This will slightly less reduce twitter and moire
  8966. but better retain detail and subjective sharpness impression.
  8967. @end table
  8968. @end table
  8969. @section kerndeint
  8970. Deinterlace input video by applying Donald Graft's adaptive kernel
  8971. deinterling. Work on interlaced parts of a video to produce
  8972. progressive frames.
  8973. The description of the accepted parameters follows.
  8974. @table @option
  8975. @item thresh
  8976. Set the threshold which affects the filter's tolerance when
  8977. determining if a pixel line must be processed. It must be an integer
  8978. in the range [0,255] and defaults to 10. A value of 0 will result in
  8979. applying the process on every pixels.
  8980. @item map
  8981. Paint pixels exceeding the threshold value to white if set to 1.
  8982. Default is 0.
  8983. @item order
  8984. Set the fields order. Swap fields if set to 1, leave fields alone if
  8985. 0. Default is 0.
  8986. @item sharp
  8987. Enable additional sharpening if set to 1. Default is 0.
  8988. @item twoway
  8989. Enable twoway sharpening if set to 1. Default is 0.
  8990. @end table
  8991. @subsection Examples
  8992. @itemize
  8993. @item
  8994. Apply default values:
  8995. @example
  8996. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  8997. @end example
  8998. @item
  8999. Enable additional sharpening:
  9000. @example
  9001. kerndeint=sharp=1
  9002. @end example
  9003. @item
  9004. Paint processed pixels in white:
  9005. @example
  9006. kerndeint=map=1
  9007. @end example
  9008. @end itemize
  9009. @section lagfun
  9010. Slowly update darker pixels.
  9011. This filter makes short flashes of light appear longer.
  9012. This filter accepts the following options:
  9013. @table @option
  9014. @item decay
  9015. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  9016. @item planes
  9017. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  9018. @end table
  9019. @section lenscorrection
  9020. Correct radial lens distortion
  9021. This filter can be used to correct for radial distortion as can result from the use
  9022. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  9023. one can use tools available for example as part of opencv or simply trial-and-error.
  9024. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  9025. and extract the k1 and k2 coefficients from the resulting matrix.
  9026. Note that effectively the same filter is available in the open-source tools Krita and
  9027. Digikam from the KDE project.
  9028. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  9029. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  9030. brightness distribution, so you may want to use both filters together in certain
  9031. cases, though you will have to take care of ordering, i.e. whether vignetting should
  9032. be applied before or after lens correction.
  9033. @subsection Options
  9034. The filter accepts the following options:
  9035. @table @option
  9036. @item cx
  9037. Relative x-coordinate of the focal point of the image, and thereby the center of the
  9038. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9039. width. Default is 0.5.
  9040. @item cy
  9041. Relative y-coordinate of the focal point of the image, and thereby the center of the
  9042. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9043. height. Default is 0.5.
  9044. @item k1
  9045. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  9046. no correction. Default is 0.
  9047. @item k2
  9048. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  9049. 0 means no correction. Default is 0.
  9050. @end table
  9051. The formula that generates the correction is:
  9052. @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)
  9053. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  9054. distances from the focal point in the source and target images, respectively.
  9055. @section lensfun
  9056. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  9057. The @code{lensfun} filter requires the camera make, camera model, and lens model
  9058. to apply the lens correction. The filter will load the lensfun database and
  9059. query it to find the corresponding camera and lens entries in the database. As
  9060. long as these entries can be found with the given options, the filter can
  9061. perform corrections on frames. Note that incomplete strings will result in the
  9062. filter choosing the best match with the given options, and the filter will
  9063. output the chosen camera and lens models (logged with level "info"). You must
  9064. provide the make, camera model, and lens model as they are required.
  9065. The filter accepts the following options:
  9066. @table @option
  9067. @item make
  9068. The make of the camera (for example, "Canon"). This option is required.
  9069. @item model
  9070. The model of the camera (for example, "Canon EOS 100D"). This option is
  9071. required.
  9072. @item lens_model
  9073. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  9074. option is required.
  9075. @item mode
  9076. The type of correction to apply. The following values are valid options:
  9077. @table @samp
  9078. @item vignetting
  9079. Enables fixing lens vignetting.
  9080. @item geometry
  9081. Enables fixing lens geometry. This is the default.
  9082. @item subpixel
  9083. Enables fixing chromatic aberrations.
  9084. @item vig_geo
  9085. Enables fixing lens vignetting and lens geometry.
  9086. @item vig_subpixel
  9087. Enables fixing lens vignetting and chromatic aberrations.
  9088. @item distortion
  9089. Enables fixing both lens geometry and chromatic aberrations.
  9090. @item all
  9091. Enables all possible corrections.
  9092. @end table
  9093. @item focal_length
  9094. The focal length of the image/video (zoom; expected constant for video). For
  9095. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  9096. range should be chosen when using that lens. Default 18.
  9097. @item aperture
  9098. The aperture of the image/video (expected constant for video). Note that
  9099. aperture is only used for vignetting correction. Default 3.5.
  9100. @item focus_distance
  9101. The focus distance of the image/video (expected constant for video). Note that
  9102. focus distance is only used for vignetting and only slightly affects the
  9103. vignetting correction process. If unknown, leave it at the default value (which
  9104. is 1000).
  9105. @item scale
  9106. The scale factor which is applied after transformation. After correction the
  9107. video is no longer necessarily rectangular. This parameter controls how much of
  9108. the resulting image is visible. The value 0 means that a value will be chosen
  9109. automatically such that there is little or no unmapped area in the output
  9110. image. 1.0 means that no additional scaling is done. Lower values may result
  9111. in more of the corrected image being visible, while higher values may avoid
  9112. unmapped areas in the output.
  9113. @item target_geometry
  9114. The target geometry of the output image/video. The following values are valid
  9115. options:
  9116. @table @samp
  9117. @item rectilinear (default)
  9118. @item fisheye
  9119. @item panoramic
  9120. @item equirectangular
  9121. @item fisheye_orthographic
  9122. @item fisheye_stereographic
  9123. @item fisheye_equisolid
  9124. @item fisheye_thoby
  9125. @end table
  9126. @item reverse
  9127. Apply the reverse of image correction (instead of correcting distortion, apply
  9128. it).
  9129. @item interpolation
  9130. The type of interpolation used when correcting distortion. The following values
  9131. are valid options:
  9132. @table @samp
  9133. @item nearest
  9134. @item linear (default)
  9135. @item lanczos
  9136. @end table
  9137. @end table
  9138. @subsection Examples
  9139. @itemize
  9140. @item
  9141. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9142. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9143. aperture of "8.0".
  9144. @example
  9145. 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
  9146. @end example
  9147. @item
  9148. Apply the same as before, but only for the first 5 seconds of video.
  9149. @example
  9150. 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
  9151. @end example
  9152. @end itemize
  9153. @section libvmaf
  9154. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9155. score between two input videos.
  9156. The obtained VMAF score is printed through the logging system.
  9157. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9158. After installing the library it can be enabled using:
  9159. @code{./configure --enable-libvmaf --enable-version3}.
  9160. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9161. The filter has following options:
  9162. @table @option
  9163. @item model_path
  9164. Set the model path which is to be used for SVM.
  9165. Default value: @code{"vmaf_v0.6.1.pkl"}
  9166. @item log_path
  9167. Set the file path to be used to store logs.
  9168. @item log_fmt
  9169. Set the format of the log file (xml or json).
  9170. @item enable_transform
  9171. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  9172. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  9173. Default value: @code{false}
  9174. @item phone_model
  9175. Invokes the phone model which will generate VMAF scores higher than in the
  9176. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  9177. @item psnr
  9178. Enables computing psnr along with vmaf.
  9179. @item ssim
  9180. Enables computing ssim along with vmaf.
  9181. @item ms_ssim
  9182. Enables computing ms_ssim along with vmaf.
  9183. @item pool
  9184. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  9185. @item n_threads
  9186. Set number of threads to be used when computing vmaf.
  9187. @item n_subsample
  9188. Set interval for frame subsampling used when computing vmaf.
  9189. @item enable_conf_interval
  9190. Enables confidence interval.
  9191. @end table
  9192. This filter also supports the @ref{framesync} options.
  9193. On the below examples the input file @file{main.mpg} being processed is
  9194. compared with the reference file @file{ref.mpg}.
  9195. @example
  9196. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  9197. @end example
  9198. Example with options:
  9199. @example
  9200. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  9201. @end example
  9202. @section limiter
  9203. Limits the pixel components values to the specified range [min, max].
  9204. The filter accepts the following options:
  9205. @table @option
  9206. @item min
  9207. Lower bound. Defaults to the lowest allowed value for the input.
  9208. @item max
  9209. Upper bound. Defaults to the highest allowed value for the input.
  9210. @item planes
  9211. Specify which planes will be processed. Defaults to all available.
  9212. @end table
  9213. @section loop
  9214. Loop video frames.
  9215. The filter accepts the following options:
  9216. @table @option
  9217. @item loop
  9218. Set the number of loops. Setting this value to -1 will result in infinite loops.
  9219. Default is 0.
  9220. @item size
  9221. Set maximal size in number of frames. Default is 0.
  9222. @item start
  9223. Set first frame of loop. Default is 0.
  9224. @end table
  9225. @subsection Examples
  9226. @itemize
  9227. @item
  9228. Loop single first frame infinitely:
  9229. @example
  9230. loop=loop=-1:size=1:start=0
  9231. @end example
  9232. @item
  9233. Loop single first frame 10 times:
  9234. @example
  9235. loop=loop=10:size=1:start=0
  9236. @end example
  9237. @item
  9238. Loop 10 first frames 5 times:
  9239. @example
  9240. loop=loop=5:size=10:start=0
  9241. @end example
  9242. @end itemize
  9243. @section lut1d
  9244. Apply a 1D LUT to an input video.
  9245. The filter accepts the following options:
  9246. @table @option
  9247. @item file
  9248. Set the 1D LUT file name.
  9249. Currently supported formats:
  9250. @table @samp
  9251. @item cube
  9252. Iridas
  9253. @item csp
  9254. cineSpace
  9255. @end table
  9256. @item interp
  9257. Select interpolation mode.
  9258. Available values are:
  9259. @table @samp
  9260. @item nearest
  9261. Use values from the nearest defined point.
  9262. @item linear
  9263. Interpolate values using the linear interpolation.
  9264. @item cosine
  9265. Interpolate values using the cosine interpolation.
  9266. @item cubic
  9267. Interpolate values using the cubic interpolation.
  9268. @item spline
  9269. Interpolate values using the spline interpolation.
  9270. @end table
  9271. @end table
  9272. @anchor{lut3d}
  9273. @section lut3d
  9274. Apply a 3D LUT to an input video.
  9275. The filter accepts the following options:
  9276. @table @option
  9277. @item file
  9278. Set the 3D LUT file name.
  9279. Currently supported formats:
  9280. @table @samp
  9281. @item 3dl
  9282. AfterEffects
  9283. @item cube
  9284. Iridas
  9285. @item dat
  9286. DaVinci
  9287. @item m3d
  9288. Pandora
  9289. @item csp
  9290. cineSpace
  9291. @end table
  9292. @item interp
  9293. Select interpolation mode.
  9294. Available values are:
  9295. @table @samp
  9296. @item nearest
  9297. Use values from the nearest defined point.
  9298. @item trilinear
  9299. Interpolate values using the 8 points defining a cube.
  9300. @item tetrahedral
  9301. Interpolate values using a tetrahedron.
  9302. @end table
  9303. @end table
  9304. @section lumakey
  9305. Turn certain luma values into transparency.
  9306. The filter accepts the following options:
  9307. @table @option
  9308. @item threshold
  9309. Set the luma which will be used as base for transparency.
  9310. Default value is @code{0}.
  9311. @item tolerance
  9312. Set the range of luma values to be keyed out.
  9313. Default value is @code{0}.
  9314. @item softness
  9315. Set the range of softness. Default value is @code{0}.
  9316. Use this to control gradual transition from zero to full transparency.
  9317. @end table
  9318. @section lut, lutrgb, lutyuv
  9319. Compute a look-up table for binding each pixel component input value
  9320. to an output value, and apply it to the input video.
  9321. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  9322. to an RGB input video.
  9323. These filters accept the following parameters:
  9324. @table @option
  9325. @item c0
  9326. set first pixel component expression
  9327. @item c1
  9328. set second pixel component expression
  9329. @item c2
  9330. set third pixel component expression
  9331. @item c3
  9332. set fourth pixel component expression, corresponds to the alpha component
  9333. @item r
  9334. set red component expression
  9335. @item g
  9336. set green component expression
  9337. @item b
  9338. set blue component expression
  9339. @item a
  9340. alpha component expression
  9341. @item y
  9342. set Y/luminance component expression
  9343. @item u
  9344. set U/Cb component expression
  9345. @item v
  9346. set V/Cr component expression
  9347. @end table
  9348. Each of them specifies the expression to use for computing the lookup table for
  9349. the corresponding pixel component values.
  9350. The exact component associated to each of the @var{c*} options depends on the
  9351. format in input.
  9352. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  9353. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  9354. The expressions can contain the following constants and functions:
  9355. @table @option
  9356. @item w
  9357. @item h
  9358. The input width and height.
  9359. @item val
  9360. The input value for the pixel component.
  9361. @item clipval
  9362. The input value, clipped to the @var{minval}-@var{maxval} range.
  9363. @item maxval
  9364. The maximum value for the pixel component.
  9365. @item minval
  9366. The minimum value for the pixel component.
  9367. @item negval
  9368. The negated value for the pixel component value, clipped to the
  9369. @var{minval}-@var{maxval} range; it corresponds to the expression
  9370. "maxval-clipval+minval".
  9371. @item clip(val)
  9372. The computed value in @var{val}, clipped to the
  9373. @var{minval}-@var{maxval} range.
  9374. @item gammaval(gamma)
  9375. The computed gamma correction value of the pixel component value,
  9376. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  9377. expression
  9378. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  9379. @end table
  9380. All expressions default to "val".
  9381. @subsection Examples
  9382. @itemize
  9383. @item
  9384. Negate input video:
  9385. @example
  9386. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  9387. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  9388. @end example
  9389. The above is the same as:
  9390. @example
  9391. lutrgb="r=negval:g=negval:b=negval"
  9392. lutyuv="y=negval:u=negval:v=negval"
  9393. @end example
  9394. @item
  9395. Negate luminance:
  9396. @example
  9397. lutyuv=y=negval
  9398. @end example
  9399. @item
  9400. Remove chroma components, turning the video into a graytone image:
  9401. @example
  9402. lutyuv="u=128:v=128"
  9403. @end example
  9404. @item
  9405. Apply a luma burning effect:
  9406. @example
  9407. lutyuv="y=2*val"
  9408. @end example
  9409. @item
  9410. Remove green and blue components:
  9411. @example
  9412. lutrgb="g=0:b=0"
  9413. @end example
  9414. @item
  9415. Set a constant alpha channel value on input:
  9416. @example
  9417. format=rgba,lutrgb=a="maxval-minval/2"
  9418. @end example
  9419. @item
  9420. Correct luminance gamma by a factor of 0.5:
  9421. @example
  9422. lutyuv=y=gammaval(0.5)
  9423. @end example
  9424. @item
  9425. Discard least significant bits of luma:
  9426. @example
  9427. lutyuv=y='bitand(val, 128+64+32)'
  9428. @end example
  9429. @item
  9430. Technicolor like effect:
  9431. @example
  9432. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9433. @end example
  9434. @end itemize
  9435. @section lut2, tlut2
  9436. The @code{lut2} filter takes two input streams and outputs one
  9437. stream.
  9438. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9439. from one single stream.
  9440. This filter accepts the following parameters:
  9441. @table @option
  9442. @item c0
  9443. set first pixel component expression
  9444. @item c1
  9445. set second pixel component expression
  9446. @item c2
  9447. set third pixel component expression
  9448. @item c3
  9449. set fourth pixel component expression, corresponds to the alpha component
  9450. @item d
  9451. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9452. which means bit depth is automatically picked from first input format.
  9453. @end table
  9454. Each of them specifies the expression to use for computing the lookup table for
  9455. the corresponding pixel component values.
  9456. The exact component associated to each of the @var{c*} options depends on the
  9457. format in inputs.
  9458. The expressions can contain the following constants:
  9459. @table @option
  9460. @item w
  9461. @item h
  9462. The input width and height.
  9463. @item x
  9464. The first input value for the pixel component.
  9465. @item y
  9466. The second input value for the pixel component.
  9467. @item bdx
  9468. The first input video bit depth.
  9469. @item bdy
  9470. The second input video bit depth.
  9471. @end table
  9472. All expressions default to "x".
  9473. @subsection Examples
  9474. @itemize
  9475. @item
  9476. Highlight differences between two RGB video streams:
  9477. @example
  9478. 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)'
  9479. @end example
  9480. @item
  9481. Highlight differences between two YUV video streams:
  9482. @example
  9483. 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)'
  9484. @end example
  9485. @item
  9486. Show max difference between two video streams:
  9487. @example
  9488. 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)))'
  9489. @end example
  9490. @end itemize
  9491. @section maskedclamp
  9492. Clamp the first input stream with the second input and third input stream.
  9493. Returns the value of first stream to be between second input
  9494. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9495. This filter accepts the following options:
  9496. @table @option
  9497. @item undershoot
  9498. Default value is @code{0}.
  9499. @item overshoot
  9500. Default value is @code{0}.
  9501. @item planes
  9502. Set which planes will be processed as bitmap, unprocessed planes will be
  9503. copied from first stream.
  9504. By default value 0xf, all planes will be processed.
  9505. @end table
  9506. @section maskedmerge
  9507. Merge the first input stream with the second input stream using per pixel
  9508. weights in the third input stream.
  9509. A value of 0 in the third stream pixel component means that pixel component
  9510. from first stream is returned unchanged, while maximum value (eg. 255 for
  9511. 8-bit videos) means that pixel component from second stream is returned
  9512. unchanged. Intermediate values define the amount of merging between both
  9513. input stream's pixel components.
  9514. This filter accepts the following options:
  9515. @table @option
  9516. @item planes
  9517. Set which planes will be processed as bitmap, unprocessed planes will be
  9518. copied from first stream.
  9519. By default value 0xf, all planes will be processed.
  9520. @end table
  9521. @section maskfun
  9522. Create mask from input video.
  9523. For example it is useful to create motion masks after @code{tblend} filter.
  9524. This filter accepts the following options:
  9525. @table @option
  9526. @item low
  9527. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  9528. @item high
  9529. Set high threshold. Any pixel component higher than this value will be set to max value
  9530. allowed for current pixel format.
  9531. @item planes
  9532. Set planes to filter, by default all available planes are filtered.
  9533. @item fill
  9534. Fill all frame pixels with this value.
  9535. @item sum
  9536. Set max average pixel value for frame. If sum of all pixel components is higher that this
  9537. average, output frame will be completely filled with value set by @var{fill} option.
  9538. Typically useful for scene changes when used in combination with @code{tblend} filter.
  9539. @end table
  9540. @section mcdeint
  9541. Apply motion-compensation deinterlacing.
  9542. It needs one field per frame as input and must thus be used together
  9543. with yadif=1/3 or equivalent.
  9544. This filter accepts the following options:
  9545. @table @option
  9546. @item mode
  9547. Set the deinterlacing mode.
  9548. It accepts one of the following values:
  9549. @table @samp
  9550. @item fast
  9551. @item medium
  9552. @item slow
  9553. use iterative motion estimation
  9554. @item extra_slow
  9555. like @samp{slow}, but use multiple reference frames.
  9556. @end table
  9557. Default value is @samp{fast}.
  9558. @item parity
  9559. Set the picture field parity assumed for the input video. It must be
  9560. one of the following values:
  9561. @table @samp
  9562. @item 0, tff
  9563. assume top field first
  9564. @item 1, bff
  9565. assume bottom field first
  9566. @end table
  9567. Default value is @samp{bff}.
  9568. @item qp
  9569. Set per-block quantization parameter (QP) used by the internal
  9570. encoder.
  9571. Higher values should result in a smoother motion vector field but less
  9572. optimal individual vectors. Default value is 1.
  9573. @end table
  9574. @section mergeplanes
  9575. Merge color channel components from several video streams.
  9576. The filter accepts up to 4 input streams, and merge selected input
  9577. planes to the output video.
  9578. This filter accepts the following options:
  9579. @table @option
  9580. @item mapping
  9581. Set input to output plane mapping. Default is @code{0}.
  9582. The mappings is specified as a bitmap. It should be specified as a
  9583. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  9584. mapping for the first plane of the output stream. 'A' sets the number of
  9585. the input stream to use (from 0 to 3), and 'a' the plane number of the
  9586. corresponding input to use (from 0 to 3). The rest of the mappings is
  9587. similar, 'Bb' describes the mapping for the output stream second
  9588. plane, 'Cc' describes the mapping for the output stream third plane and
  9589. 'Dd' describes the mapping for the output stream fourth plane.
  9590. @item format
  9591. Set output pixel format. Default is @code{yuva444p}.
  9592. @end table
  9593. @subsection Examples
  9594. @itemize
  9595. @item
  9596. Merge three gray video streams of same width and height into single video stream:
  9597. @example
  9598. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  9599. @end example
  9600. @item
  9601. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  9602. @example
  9603. [a0][a1]mergeplanes=0x00010210:yuva444p
  9604. @end example
  9605. @item
  9606. Swap Y and A plane in yuva444p stream:
  9607. @example
  9608. format=yuva444p,mergeplanes=0x03010200:yuva444p
  9609. @end example
  9610. @item
  9611. Swap U and V plane in yuv420p stream:
  9612. @example
  9613. format=yuv420p,mergeplanes=0x000201:yuv420p
  9614. @end example
  9615. @item
  9616. Cast a rgb24 clip to yuv444p:
  9617. @example
  9618. format=rgb24,mergeplanes=0x000102:yuv444p
  9619. @end example
  9620. @end itemize
  9621. @section mestimate
  9622. Estimate and export motion vectors using block matching algorithms.
  9623. Motion vectors are stored in frame side data to be used by other filters.
  9624. This filter accepts the following options:
  9625. @table @option
  9626. @item method
  9627. Specify the motion estimation method. Accepts one of the following values:
  9628. @table @samp
  9629. @item esa
  9630. Exhaustive search algorithm.
  9631. @item tss
  9632. Three step search algorithm.
  9633. @item tdls
  9634. Two dimensional logarithmic search algorithm.
  9635. @item ntss
  9636. New three step search algorithm.
  9637. @item fss
  9638. Four step search algorithm.
  9639. @item ds
  9640. Diamond search algorithm.
  9641. @item hexbs
  9642. Hexagon-based search algorithm.
  9643. @item epzs
  9644. Enhanced predictive zonal search algorithm.
  9645. @item umh
  9646. Uneven multi-hexagon search algorithm.
  9647. @end table
  9648. Default value is @samp{esa}.
  9649. @item mb_size
  9650. Macroblock size. Default @code{16}.
  9651. @item search_param
  9652. Search parameter. Default @code{7}.
  9653. @end table
  9654. @section midequalizer
  9655. Apply Midway Image Equalization effect using two video streams.
  9656. Midway Image Equalization adjusts a pair of images to have the same
  9657. histogram, while maintaining their dynamics as much as possible. It's
  9658. useful for e.g. matching exposures from a pair of stereo cameras.
  9659. This filter has two inputs and one output, which must be of same pixel format, but
  9660. may be of different sizes. The output of filter is first input adjusted with
  9661. midway histogram of both inputs.
  9662. This filter accepts the following option:
  9663. @table @option
  9664. @item planes
  9665. Set which planes to process. Default is @code{15}, which is all available planes.
  9666. @end table
  9667. @section minterpolate
  9668. Convert the video to specified frame rate using motion interpolation.
  9669. This filter accepts the following options:
  9670. @table @option
  9671. @item fps
  9672. 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}.
  9673. @item mi_mode
  9674. Motion interpolation mode. Following values are accepted:
  9675. @table @samp
  9676. @item dup
  9677. Duplicate previous or next frame for interpolating new ones.
  9678. @item blend
  9679. Blend source frames. Interpolated frame is mean of previous and next frames.
  9680. @item mci
  9681. Motion compensated interpolation. Following options are effective when this mode is selected:
  9682. @table @samp
  9683. @item mc_mode
  9684. Motion compensation mode. Following values are accepted:
  9685. @table @samp
  9686. @item obmc
  9687. Overlapped block motion compensation.
  9688. @item aobmc
  9689. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  9690. @end table
  9691. Default mode is @samp{obmc}.
  9692. @item me_mode
  9693. Motion estimation mode. Following values are accepted:
  9694. @table @samp
  9695. @item bidir
  9696. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  9697. @item bilat
  9698. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  9699. @end table
  9700. Default mode is @samp{bilat}.
  9701. @item me
  9702. The algorithm to be used for motion estimation. Following values are accepted:
  9703. @table @samp
  9704. @item esa
  9705. Exhaustive search algorithm.
  9706. @item tss
  9707. Three step search algorithm.
  9708. @item tdls
  9709. Two dimensional logarithmic search algorithm.
  9710. @item ntss
  9711. New three step search algorithm.
  9712. @item fss
  9713. Four step search algorithm.
  9714. @item ds
  9715. Diamond search algorithm.
  9716. @item hexbs
  9717. Hexagon-based search algorithm.
  9718. @item epzs
  9719. Enhanced predictive zonal search algorithm.
  9720. @item umh
  9721. Uneven multi-hexagon search algorithm.
  9722. @end table
  9723. Default algorithm is @samp{epzs}.
  9724. @item mb_size
  9725. Macroblock size. Default @code{16}.
  9726. @item search_param
  9727. Motion estimation search parameter. Default @code{32}.
  9728. @item vsbmc
  9729. 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).
  9730. @end table
  9731. @end table
  9732. @item scd
  9733. 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:
  9734. @table @samp
  9735. @item none
  9736. Disable scene change detection.
  9737. @item fdiff
  9738. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  9739. @end table
  9740. Default method is @samp{fdiff}.
  9741. @item scd_threshold
  9742. Scene change detection threshold. Default is @code{5.0}.
  9743. @end table
  9744. @section mix
  9745. Mix several video input streams into one video stream.
  9746. A description of the accepted options follows.
  9747. @table @option
  9748. @item nb_inputs
  9749. The number of inputs. If unspecified, it defaults to 2.
  9750. @item weights
  9751. Specify weight of each input video stream as sequence.
  9752. Each weight is separated by space. If number of weights
  9753. is smaller than number of @var{frames} last specified
  9754. weight will be used for all remaining unset weights.
  9755. @item scale
  9756. Specify scale, if it is set it will be multiplied with sum
  9757. of each weight multiplied with pixel values to give final destination
  9758. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9759. @item duration
  9760. Specify how end of stream is determined.
  9761. @table @samp
  9762. @item longest
  9763. The duration of the longest input. (default)
  9764. @item shortest
  9765. The duration of the shortest input.
  9766. @item first
  9767. The duration of the first input.
  9768. @end table
  9769. @end table
  9770. @section mpdecimate
  9771. Drop frames that do not differ greatly from the previous frame in
  9772. order to reduce frame rate.
  9773. The main use of this filter is for very-low-bitrate encoding
  9774. (e.g. streaming over dialup modem), but it could in theory be used for
  9775. fixing movies that were inverse-telecined incorrectly.
  9776. A description of the accepted options follows.
  9777. @table @option
  9778. @item max
  9779. Set the maximum number of consecutive frames which can be dropped (if
  9780. positive), or the minimum interval between dropped frames (if
  9781. negative). If the value is 0, the frame is dropped disregarding the
  9782. number of previous sequentially dropped frames.
  9783. Default value is 0.
  9784. @item hi
  9785. @item lo
  9786. @item frac
  9787. Set the dropping threshold values.
  9788. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9789. represent actual pixel value differences, so a threshold of 64
  9790. corresponds to 1 unit of difference for each pixel, or the same spread
  9791. out differently over the block.
  9792. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9793. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9794. meaning the whole image) differ by more than a threshold of @option{lo}.
  9795. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9796. 64*5, and default value for @option{frac} is 0.33.
  9797. @end table
  9798. @section negate
  9799. Negate (invert) the input video.
  9800. It accepts the following option:
  9801. @table @option
  9802. @item negate_alpha
  9803. With value 1, it negates the alpha component, if present. Default value is 0.
  9804. @end table
  9805. @anchor{nlmeans}
  9806. @section nlmeans
  9807. Denoise frames using Non-Local Means algorithm.
  9808. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9809. context similarity is defined by comparing their surrounding patches of size
  9810. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9811. around the pixel.
  9812. Note that the research area defines centers for patches, which means some
  9813. patches will be made of pixels outside that research area.
  9814. The filter accepts the following options.
  9815. @table @option
  9816. @item s
  9817. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  9818. @item p
  9819. Set patch size. Default is 7. Must be odd number in range [0, 99].
  9820. @item pc
  9821. Same as @option{p} but for chroma planes.
  9822. The default value is @var{0} and means automatic.
  9823. @item r
  9824. Set research size. Default is 15. Must be odd number in range [0, 99].
  9825. @item rc
  9826. Same as @option{r} but for chroma planes.
  9827. The default value is @var{0} and means automatic.
  9828. @end table
  9829. @section nnedi
  9830. Deinterlace video using neural network edge directed interpolation.
  9831. This filter accepts the following options:
  9832. @table @option
  9833. @item weights
  9834. Mandatory option, without binary file filter can not work.
  9835. Currently file can be found here:
  9836. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9837. @item deint
  9838. Set which frames to deinterlace, by default it is @code{all}.
  9839. Can be @code{all} or @code{interlaced}.
  9840. @item field
  9841. Set mode of operation.
  9842. Can be one of the following:
  9843. @table @samp
  9844. @item af
  9845. Use frame flags, both fields.
  9846. @item a
  9847. Use frame flags, single field.
  9848. @item t
  9849. Use top field only.
  9850. @item b
  9851. Use bottom field only.
  9852. @item tf
  9853. Use both fields, top first.
  9854. @item bf
  9855. Use both fields, bottom first.
  9856. @end table
  9857. @item planes
  9858. Set which planes to process, by default filter process all frames.
  9859. @item nsize
  9860. Set size of local neighborhood around each pixel, used by the predictor neural
  9861. network.
  9862. Can be one of the following:
  9863. @table @samp
  9864. @item s8x6
  9865. @item s16x6
  9866. @item s32x6
  9867. @item s48x6
  9868. @item s8x4
  9869. @item s16x4
  9870. @item s32x4
  9871. @end table
  9872. @item nns
  9873. Set the number of neurons in predictor neural network.
  9874. Can be one of the following:
  9875. @table @samp
  9876. @item n16
  9877. @item n32
  9878. @item n64
  9879. @item n128
  9880. @item n256
  9881. @end table
  9882. @item qual
  9883. Controls the number of different neural network predictions that are blended
  9884. together to compute the final output value. Can be @code{fast}, default or
  9885. @code{slow}.
  9886. @item etype
  9887. Set which set of weights to use in the predictor.
  9888. Can be one of the following:
  9889. @table @samp
  9890. @item a
  9891. weights trained to minimize absolute error
  9892. @item s
  9893. weights trained to minimize squared error
  9894. @end table
  9895. @item pscrn
  9896. Controls whether or not the prescreener neural network is used to decide
  9897. which pixels should be processed by the predictor neural network and which
  9898. can be handled by simple cubic interpolation.
  9899. The prescreener is trained to know whether cubic interpolation will be
  9900. sufficient for a pixel or whether it should be predicted by the predictor nn.
  9901. The computational complexity of the prescreener nn is much less than that of
  9902. the predictor nn. Since most pixels can be handled by cubic interpolation,
  9903. using the prescreener generally results in much faster processing.
  9904. The prescreener is pretty accurate, so the difference between using it and not
  9905. using it is almost always unnoticeable.
  9906. Can be one of the following:
  9907. @table @samp
  9908. @item none
  9909. @item original
  9910. @item new
  9911. @end table
  9912. Default is @code{new}.
  9913. @item fapprox
  9914. Set various debugging flags.
  9915. @end table
  9916. @section noformat
  9917. Force libavfilter not to use any of the specified pixel formats for the
  9918. input to the next filter.
  9919. It accepts the following parameters:
  9920. @table @option
  9921. @item pix_fmts
  9922. A '|'-separated list of pixel format names, such as
  9923. pix_fmts=yuv420p|monow|rgb24".
  9924. @end table
  9925. @subsection Examples
  9926. @itemize
  9927. @item
  9928. Force libavfilter to use a format different from @var{yuv420p} for the
  9929. input to the vflip filter:
  9930. @example
  9931. noformat=pix_fmts=yuv420p,vflip
  9932. @end example
  9933. @item
  9934. Convert the input video to any of the formats not contained in the list:
  9935. @example
  9936. noformat=yuv420p|yuv444p|yuv410p
  9937. @end example
  9938. @end itemize
  9939. @section noise
  9940. Add noise on video input frame.
  9941. The filter accepts the following options:
  9942. @table @option
  9943. @item all_seed
  9944. @item c0_seed
  9945. @item c1_seed
  9946. @item c2_seed
  9947. @item c3_seed
  9948. Set noise seed for specific pixel component or all pixel components in case
  9949. of @var{all_seed}. Default value is @code{123457}.
  9950. @item all_strength, alls
  9951. @item c0_strength, c0s
  9952. @item c1_strength, c1s
  9953. @item c2_strength, c2s
  9954. @item c3_strength, c3s
  9955. Set noise strength for specific pixel component or all pixel components in case
  9956. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  9957. @item all_flags, allf
  9958. @item c0_flags, c0f
  9959. @item c1_flags, c1f
  9960. @item c2_flags, c2f
  9961. @item c3_flags, c3f
  9962. Set pixel component flags or set flags for all components if @var{all_flags}.
  9963. Available values for component flags are:
  9964. @table @samp
  9965. @item a
  9966. averaged temporal noise (smoother)
  9967. @item p
  9968. mix random noise with a (semi)regular pattern
  9969. @item t
  9970. temporal noise (noise pattern changes between frames)
  9971. @item u
  9972. uniform noise (gaussian otherwise)
  9973. @end table
  9974. @end table
  9975. @subsection Examples
  9976. Add temporal and uniform noise to input video:
  9977. @example
  9978. noise=alls=20:allf=t+u
  9979. @end example
  9980. @section normalize
  9981. Normalize RGB video (aka histogram stretching, contrast stretching).
  9982. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  9983. For each channel of each frame, the filter computes the input range and maps
  9984. it linearly to the user-specified output range. The output range defaults
  9985. to the full dynamic range from pure black to pure white.
  9986. Temporal smoothing can be used on the input range to reduce flickering (rapid
  9987. changes in brightness) caused when small dark or bright objects enter or leave
  9988. the scene. This is similar to the auto-exposure (automatic gain control) on a
  9989. video camera, and, like a video camera, it may cause a period of over- or
  9990. under-exposure of the video.
  9991. The R,G,B channels can be normalized independently, which may cause some
  9992. color shifting, or linked together as a single channel, which prevents
  9993. color shifting. Linked normalization preserves hue. Independent normalization
  9994. does not, so it can be used to remove some color casts. Independent and linked
  9995. normalization can be combined in any ratio.
  9996. The normalize filter accepts the following options:
  9997. @table @option
  9998. @item blackpt
  9999. @item whitept
  10000. Colors which define the output range. The minimum input value is mapped to
  10001. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  10002. The defaults are black and white respectively. Specifying white for
  10003. @var{blackpt} and black for @var{whitept} will give color-inverted,
  10004. normalized video. Shades of grey can be used to reduce the dynamic range
  10005. (contrast). Specifying saturated colors here can create some interesting
  10006. effects.
  10007. @item smoothing
  10008. The number of previous frames to use for temporal smoothing. The input range
  10009. of each channel is smoothed using a rolling average over the current frame
  10010. and the @var{smoothing} previous frames. The default is 0 (no temporal
  10011. smoothing).
  10012. @item independence
  10013. Controls the ratio of independent (color shifting) channel normalization to
  10014. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  10015. independent. Defaults to 1.0 (fully independent).
  10016. @item strength
  10017. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  10018. expensive no-op. Defaults to 1.0 (full strength).
  10019. @end table
  10020. @subsection Examples
  10021. Stretch video contrast to use the full dynamic range, with no temporal
  10022. smoothing; may flicker depending on the source content:
  10023. @example
  10024. normalize=blackpt=black:whitept=white:smoothing=0
  10025. @end example
  10026. As above, but with 50 frames of temporal smoothing; flicker should be
  10027. reduced, depending on the source content:
  10028. @example
  10029. normalize=blackpt=black:whitept=white:smoothing=50
  10030. @end example
  10031. As above, but with hue-preserving linked channel normalization:
  10032. @example
  10033. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  10034. @end example
  10035. As above, but with half strength:
  10036. @example
  10037. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  10038. @end example
  10039. Map the darkest input color to red, the brightest input color to cyan:
  10040. @example
  10041. normalize=blackpt=red:whitept=cyan
  10042. @end example
  10043. @section null
  10044. Pass the video source unchanged to the output.
  10045. @section ocr
  10046. Optical Character Recognition
  10047. This filter uses Tesseract for optical character recognition. To enable
  10048. compilation of this filter, you need to configure FFmpeg with
  10049. @code{--enable-libtesseract}.
  10050. It accepts the following options:
  10051. @table @option
  10052. @item datapath
  10053. Set datapath to tesseract data. Default is to use whatever was
  10054. set at installation.
  10055. @item language
  10056. Set language, default is "eng".
  10057. @item whitelist
  10058. Set character whitelist.
  10059. @item blacklist
  10060. Set character blacklist.
  10061. @end table
  10062. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  10063. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  10064. @section ocv
  10065. Apply a video transform using libopencv.
  10066. To enable this filter, install the libopencv library and headers and
  10067. configure FFmpeg with @code{--enable-libopencv}.
  10068. It accepts the following parameters:
  10069. @table @option
  10070. @item filter_name
  10071. The name of the libopencv filter to apply.
  10072. @item filter_params
  10073. The parameters to pass to the libopencv filter. If not specified, the default
  10074. values are assumed.
  10075. @end table
  10076. Refer to the official libopencv documentation for more precise
  10077. information:
  10078. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  10079. Several libopencv filters are supported; see the following subsections.
  10080. @anchor{dilate}
  10081. @subsection dilate
  10082. Dilate an image by using a specific structuring element.
  10083. It corresponds to the libopencv function @code{cvDilate}.
  10084. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  10085. @var{struct_el} represents a structuring element, and has the syntax:
  10086. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  10087. @var{cols} and @var{rows} represent the number of columns and rows of
  10088. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  10089. point, and @var{shape} the shape for the structuring element. @var{shape}
  10090. must be "rect", "cross", "ellipse", or "custom".
  10091. If the value for @var{shape} is "custom", it must be followed by a
  10092. string of the form "=@var{filename}". The file with name
  10093. @var{filename} is assumed to represent a binary image, with each
  10094. printable character corresponding to a bright pixel. When a custom
  10095. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  10096. or columns and rows of the read file are assumed instead.
  10097. The default value for @var{struct_el} is "3x3+0x0/rect".
  10098. @var{nb_iterations} specifies the number of times the transform is
  10099. applied to the image, and defaults to 1.
  10100. Some examples:
  10101. @example
  10102. # Use the default values
  10103. ocv=dilate
  10104. # Dilate using a structuring element with a 5x5 cross, iterating two times
  10105. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  10106. # Read the shape from the file diamond.shape, iterating two times.
  10107. # The file diamond.shape may contain a pattern of characters like this
  10108. # *
  10109. # ***
  10110. # *****
  10111. # ***
  10112. # *
  10113. # The specified columns and rows are ignored
  10114. # but the anchor point coordinates are not
  10115. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  10116. @end example
  10117. @subsection erode
  10118. Erode an image by using a specific structuring element.
  10119. It corresponds to the libopencv function @code{cvErode}.
  10120. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  10121. with the same syntax and semantics as the @ref{dilate} filter.
  10122. @subsection smooth
  10123. Smooth the input video.
  10124. The filter takes the following parameters:
  10125. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  10126. @var{type} is the type of smooth filter to apply, and must be one of
  10127. the following values: "blur", "blur_no_scale", "median", "gaussian",
  10128. or "bilateral". The default value is "gaussian".
  10129. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  10130. depend on the smooth type. @var{param1} and
  10131. @var{param2} accept integer positive values or 0. @var{param3} and
  10132. @var{param4} accept floating point values.
  10133. The default value for @var{param1} is 3. The default value for the
  10134. other parameters is 0.
  10135. These parameters correspond to the parameters assigned to the
  10136. libopencv function @code{cvSmooth}.
  10137. @section oscilloscope
  10138. 2D Video Oscilloscope.
  10139. Useful to measure spatial impulse, step responses, chroma delays, etc.
  10140. It accepts the following parameters:
  10141. @table @option
  10142. @item x
  10143. Set scope center x position.
  10144. @item y
  10145. Set scope center y position.
  10146. @item s
  10147. Set scope size, relative to frame diagonal.
  10148. @item t
  10149. Set scope tilt/rotation.
  10150. @item o
  10151. Set trace opacity.
  10152. @item tx
  10153. Set trace center x position.
  10154. @item ty
  10155. Set trace center y position.
  10156. @item tw
  10157. Set trace width, relative to width of frame.
  10158. @item th
  10159. Set trace height, relative to height of frame.
  10160. @item c
  10161. Set which components to trace. By default it traces first three components.
  10162. @item g
  10163. Draw trace grid. By default is enabled.
  10164. @item st
  10165. Draw some statistics. By default is enabled.
  10166. @item sc
  10167. Draw scope. By default is enabled.
  10168. @end table
  10169. @subsection Examples
  10170. @itemize
  10171. @item
  10172. Inspect full first row of video frame.
  10173. @example
  10174. oscilloscope=x=0.5:y=0:s=1
  10175. @end example
  10176. @item
  10177. Inspect full last row of video frame.
  10178. @example
  10179. oscilloscope=x=0.5:y=1:s=1
  10180. @end example
  10181. @item
  10182. Inspect full 5th line of video frame of height 1080.
  10183. @example
  10184. oscilloscope=x=0.5:y=5/1080:s=1
  10185. @end example
  10186. @item
  10187. Inspect full last column of video frame.
  10188. @example
  10189. oscilloscope=x=1:y=0.5:s=1:t=1
  10190. @end example
  10191. @end itemize
  10192. @anchor{overlay}
  10193. @section overlay
  10194. Overlay one video on top of another.
  10195. It takes two inputs and has one output. The first input is the "main"
  10196. video on which the second input is overlaid.
  10197. It accepts the following parameters:
  10198. A description of the accepted options follows.
  10199. @table @option
  10200. @item x
  10201. @item y
  10202. Set the expression for the x and y coordinates of the overlaid video
  10203. on the main video. Default value is "0" for both expressions. In case
  10204. the expression is invalid, it is set to a huge value (meaning that the
  10205. overlay will not be displayed within the output visible area).
  10206. @item eof_action
  10207. See @ref{framesync}.
  10208. @item eval
  10209. Set when the expressions for @option{x}, and @option{y} are evaluated.
  10210. It accepts the following values:
  10211. @table @samp
  10212. @item init
  10213. only evaluate expressions once during the filter initialization or
  10214. when a command is processed
  10215. @item frame
  10216. evaluate expressions for each incoming frame
  10217. @end table
  10218. Default value is @samp{frame}.
  10219. @item shortest
  10220. See @ref{framesync}.
  10221. @item format
  10222. Set the format for the output video.
  10223. It accepts the following values:
  10224. @table @samp
  10225. @item yuv420
  10226. force YUV420 output
  10227. @item yuv422
  10228. force YUV422 output
  10229. @item yuv444
  10230. force YUV444 output
  10231. @item rgb
  10232. force packed RGB output
  10233. @item gbrp
  10234. force planar RGB output
  10235. @item auto
  10236. automatically pick format
  10237. @end table
  10238. Default value is @samp{yuv420}.
  10239. @item repeatlast
  10240. See @ref{framesync}.
  10241. @item alpha
  10242. Set format of alpha of the overlaid video, it can be @var{straight} or
  10243. @var{premultiplied}. Default is @var{straight}.
  10244. @end table
  10245. The @option{x}, and @option{y} expressions can contain the following
  10246. parameters.
  10247. @table @option
  10248. @item main_w, W
  10249. @item main_h, H
  10250. The main input width and height.
  10251. @item overlay_w, w
  10252. @item overlay_h, h
  10253. The overlay input width and height.
  10254. @item x
  10255. @item y
  10256. The computed values for @var{x} and @var{y}. They are evaluated for
  10257. each new frame.
  10258. @item hsub
  10259. @item vsub
  10260. horizontal and vertical chroma subsample values of the output
  10261. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  10262. @var{vsub} is 1.
  10263. @item n
  10264. the number of input frame, starting from 0
  10265. @item pos
  10266. the position in the file of the input frame, NAN if unknown
  10267. @item t
  10268. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  10269. @end table
  10270. This filter also supports the @ref{framesync} options.
  10271. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  10272. when evaluation is done @emph{per frame}, and will evaluate to NAN
  10273. when @option{eval} is set to @samp{init}.
  10274. Be aware that frames are taken from each input video in timestamp
  10275. order, hence, if their initial timestamps differ, it is a good idea
  10276. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  10277. have them begin in the same zero timestamp, as the example for
  10278. the @var{movie} filter does.
  10279. You can chain together more overlays but you should test the
  10280. efficiency of such approach.
  10281. @subsection Commands
  10282. This filter supports the following commands:
  10283. @table @option
  10284. @item x
  10285. @item y
  10286. Modify the x and y of the overlay input.
  10287. The command accepts the same syntax of the corresponding option.
  10288. If the specified expression is not valid, it is kept at its current
  10289. value.
  10290. @end table
  10291. @subsection Examples
  10292. @itemize
  10293. @item
  10294. Draw the overlay at 10 pixels from the bottom right corner of the main
  10295. video:
  10296. @example
  10297. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  10298. @end example
  10299. Using named options the example above becomes:
  10300. @example
  10301. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  10302. @end example
  10303. @item
  10304. Insert a transparent PNG logo in the bottom left corner of the input,
  10305. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  10306. @example
  10307. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  10308. @end example
  10309. @item
  10310. Insert 2 different transparent PNG logos (second logo on bottom
  10311. right corner) using the @command{ffmpeg} tool:
  10312. @example
  10313. 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
  10314. @end example
  10315. @item
  10316. Add a transparent color layer on top of the main video; @code{WxH}
  10317. must specify the size of the main input to the overlay filter:
  10318. @example
  10319. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  10320. @end example
  10321. @item
  10322. Play an original video and a filtered version (here with the deshake
  10323. filter) side by side using the @command{ffplay} tool:
  10324. @example
  10325. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  10326. @end example
  10327. The above command is the same as:
  10328. @example
  10329. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  10330. @end example
  10331. @item
  10332. Make a sliding overlay appearing from the left to the right top part of the
  10333. screen starting since time 2:
  10334. @example
  10335. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  10336. @end example
  10337. @item
  10338. Compose output by putting two input videos side to side:
  10339. @example
  10340. ffmpeg -i left.avi -i right.avi -filter_complex "
  10341. nullsrc=size=200x100 [background];
  10342. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  10343. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  10344. [background][left] overlay=shortest=1 [background+left];
  10345. [background+left][right] overlay=shortest=1:x=100 [left+right]
  10346. "
  10347. @end example
  10348. @item
  10349. Mask 10-20 seconds of a video by applying the delogo filter to a section
  10350. @example
  10351. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  10352. -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]'
  10353. masked.avi
  10354. @end example
  10355. @item
  10356. Chain several overlays in cascade:
  10357. @example
  10358. nullsrc=s=200x200 [bg];
  10359. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  10360. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  10361. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  10362. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  10363. [in3] null, [mid2] overlay=100:100 [out0]
  10364. @end example
  10365. @end itemize
  10366. @section owdenoise
  10367. Apply Overcomplete Wavelet denoiser.
  10368. The filter accepts the following options:
  10369. @table @option
  10370. @item depth
  10371. Set depth.
  10372. Larger depth values will denoise lower frequency components more, but
  10373. slow down filtering.
  10374. Must be an int in the range 8-16, default is @code{8}.
  10375. @item luma_strength, ls
  10376. Set luma strength.
  10377. Must be a double value in the range 0-1000, default is @code{1.0}.
  10378. @item chroma_strength, cs
  10379. Set chroma strength.
  10380. Must be a double value in the range 0-1000, default is @code{1.0}.
  10381. @end table
  10382. @anchor{pad}
  10383. @section pad
  10384. Add paddings to the input image, and place the original input at the
  10385. provided @var{x}, @var{y} coordinates.
  10386. It accepts the following parameters:
  10387. @table @option
  10388. @item width, w
  10389. @item height, h
  10390. Specify an expression for the size of the output image with the
  10391. paddings added. If the value for @var{width} or @var{height} is 0, the
  10392. corresponding input size is used for the output.
  10393. The @var{width} expression can reference the value set by the
  10394. @var{height} expression, and vice versa.
  10395. The default value of @var{width} and @var{height} is 0.
  10396. @item x
  10397. @item y
  10398. Specify the offsets to place the input image at within the padded area,
  10399. with respect to the top/left border of the output image.
  10400. The @var{x} expression can reference the value set by the @var{y}
  10401. expression, and vice versa.
  10402. The default value of @var{x} and @var{y} is 0.
  10403. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  10404. so the input image is centered on the padded area.
  10405. @item color
  10406. Specify the color of the padded area. For the syntax of this option,
  10407. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10408. manual,ffmpeg-utils}.
  10409. The default value of @var{color} is "black".
  10410. @item eval
  10411. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  10412. It accepts the following values:
  10413. @table @samp
  10414. @item init
  10415. Only evaluate expressions once during the filter initialization or when
  10416. a command is processed.
  10417. @item frame
  10418. Evaluate expressions for each incoming frame.
  10419. @end table
  10420. Default value is @samp{init}.
  10421. @item aspect
  10422. Pad to aspect instead to a resolution.
  10423. @end table
  10424. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  10425. options are expressions containing the following constants:
  10426. @table @option
  10427. @item in_w
  10428. @item in_h
  10429. The input video width and height.
  10430. @item iw
  10431. @item ih
  10432. These are the same as @var{in_w} and @var{in_h}.
  10433. @item out_w
  10434. @item out_h
  10435. The output width and height (the size of the padded area), as
  10436. specified by the @var{width} and @var{height} expressions.
  10437. @item ow
  10438. @item oh
  10439. These are the same as @var{out_w} and @var{out_h}.
  10440. @item x
  10441. @item y
  10442. The x and y offsets as specified by the @var{x} and @var{y}
  10443. expressions, or NAN if not yet specified.
  10444. @item a
  10445. same as @var{iw} / @var{ih}
  10446. @item sar
  10447. input sample aspect ratio
  10448. @item dar
  10449. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  10450. @item hsub
  10451. @item vsub
  10452. The horizontal and vertical chroma subsample values. For example for the
  10453. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10454. @end table
  10455. @subsection Examples
  10456. @itemize
  10457. @item
  10458. Add paddings with the color "violet" to the input video. The output video
  10459. size is 640x480, and the top-left corner of the input video is placed at
  10460. column 0, row 40
  10461. @example
  10462. pad=640:480:0:40:violet
  10463. @end example
  10464. The example above is equivalent to the following command:
  10465. @example
  10466. pad=width=640:height=480:x=0:y=40:color=violet
  10467. @end example
  10468. @item
  10469. Pad the input to get an output with dimensions increased by 3/2,
  10470. and put the input video at the center of the padded area:
  10471. @example
  10472. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10473. @end example
  10474. @item
  10475. Pad the input to get a squared output with size equal to the maximum
  10476. value between the input width and height, and put the input video at
  10477. the center of the padded area:
  10478. @example
  10479. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10480. @end example
  10481. @item
  10482. Pad the input to get a final w/h ratio of 16:9:
  10483. @example
  10484. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10485. @end example
  10486. @item
  10487. In case of anamorphic video, in order to set the output display aspect
  10488. correctly, it is necessary to use @var{sar} in the expression,
  10489. according to the relation:
  10490. @example
  10491. (ih * X / ih) * sar = output_dar
  10492. X = output_dar / sar
  10493. @end example
  10494. Thus the previous example needs to be modified to:
  10495. @example
  10496. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  10497. @end example
  10498. @item
  10499. Double the output size and put the input video in the bottom-right
  10500. corner of the output padded area:
  10501. @example
  10502. pad="2*iw:2*ih:ow-iw:oh-ih"
  10503. @end example
  10504. @end itemize
  10505. @anchor{palettegen}
  10506. @section palettegen
  10507. Generate one palette for a whole video stream.
  10508. It accepts the following options:
  10509. @table @option
  10510. @item max_colors
  10511. Set the maximum number of colors to quantize in the palette.
  10512. Note: the palette will still contain 256 colors; the unused palette entries
  10513. will be black.
  10514. @item reserve_transparent
  10515. Create a palette of 255 colors maximum and reserve the last one for
  10516. transparency. Reserving the transparency color is useful for GIF optimization.
  10517. If not set, the maximum of colors in the palette will be 256. You probably want
  10518. to disable this option for a standalone image.
  10519. Set by default.
  10520. @item transparency_color
  10521. Set the color that will be used as background for transparency.
  10522. @item stats_mode
  10523. Set statistics mode.
  10524. It accepts the following values:
  10525. @table @samp
  10526. @item full
  10527. Compute full frame histograms.
  10528. @item diff
  10529. Compute histograms only for the part that differs from previous frame. This
  10530. might be relevant to give more importance to the moving part of your input if
  10531. the background is static.
  10532. @item single
  10533. Compute new histogram for each frame.
  10534. @end table
  10535. Default value is @var{full}.
  10536. @end table
  10537. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  10538. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  10539. color quantization of the palette. This information is also visible at
  10540. @var{info} logging level.
  10541. @subsection Examples
  10542. @itemize
  10543. @item
  10544. Generate a representative palette of a given video using @command{ffmpeg}:
  10545. @example
  10546. ffmpeg -i input.mkv -vf palettegen palette.png
  10547. @end example
  10548. @end itemize
  10549. @section paletteuse
  10550. Use a palette to downsample an input video stream.
  10551. The filter takes two inputs: one video stream and a palette. The palette must
  10552. be a 256 pixels image.
  10553. It accepts the following options:
  10554. @table @option
  10555. @item dither
  10556. Select dithering mode. Available algorithms are:
  10557. @table @samp
  10558. @item bayer
  10559. Ordered 8x8 bayer dithering (deterministic)
  10560. @item heckbert
  10561. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  10562. Note: this dithering is sometimes considered "wrong" and is included as a
  10563. reference.
  10564. @item floyd_steinberg
  10565. Floyd and Steingberg dithering (error diffusion)
  10566. @item sierra2
  10567. Frankie Sierra dithering v2 (error diffusion)
  10568. @item sierra2_4a
  10569. Frankie Sierra dithering v2 "Lite" (error diffusion)
  10570. @end table
  10571. Default is @var{sierra2_4a}.
  10572. @item bayer_scale
  10573. When @var{bayer} dithering is selected, this option defines the scale of the
  10574. pattern (how much the crosshatch pattern is visible). A low value means more
  10575. visible pattern for less banding, and higher value means less visible pattern
  10576. at the cost of more banding.
  10577. The option must be an integer value in the range [0,5]. Default is @var{2}.
  10578. @item diff_mode
  10579. If set, define the zone to process
  10580. @table @samp
  10581. @item rectangle
  10582. Only the changing rectangle will be reprocessed. This is similar to GIF
  10583. cropping/offsetting compression mechanism. This option can be useful for speed
  10584. if only a part of the image is changing, and has use cases such as limiting the
  10585. scope of the error diffusal @option{dither} to the rectangle that bounds the
  10586. moving scene (it leads to more deterministic output if the scene doesn't change
  10587. much, and as a result less moving noise and better GIF compression).
  10588. @end table
  10589. Default is @var{none}.
  10590. @item new
  10591. Take new palette for each output frame.
  10592. @item alpha_threshold
  10593. Sets the alpha threshold for transparency. Alpha values above this threshold
  10594. will be treated as completely opaque, and values below this threshold will be
  10595. treated as completely transparent.
  10596. The option must be an integer value in the range [0,255]. Default is @var{128}.
  10597. @end table
  10598. @subsection Examples
  10599. @itemize
  10600. @item
  10601. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  10602. using @command{ffmpeg}:
  10603. @example
  10604. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  10605. @end example
  10606. @end itemize
  10607. @section perspective
  10608. Correct perspective of video not recorded perpendicular to the screen.
  10609. A description of the accepted parameters follows.
  10610. @table @option
  10611. @item x0
  10612. @item y0
  10613. @item x1
  10614. @item y1
  10615. @item x2
  10616. @item y2
  10617. @item x3
  10618. @item y3
  10619. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  10620. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  10621. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  10622. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  10623. then the corners of the source will be sent to the specified coordinates.
  10624. The expressions can use the following variables:
  10625. @table @option
  10626. @item W
  10627. @item H
  10628. the width and height of video frame.
  10629. @item in
  10630. Input frame count.
  10631. @item on
  10632. Output frame count.
  10633. @end table
  10634. @item interpolation
  10635. Set interpolation for perspective correction.
  10636. It accepts the following values:
  10637. @table @samp
  10638. @item linear
  10639. @item cubic
  10640. @end table
  10641. Default value is @samp{linear}.
  10642. @item sense
  10643. Set interpretation of coordinate options.
  10644. It accepts the following values:
  10645. @table @samp
  10646. @item 0, source
  10647. Send point in the source specified by the given coordinates to
  10648. the corners of the destination.
  10649. @item 1, destination
  10650. Send the corners of the source to the point in the destination specified
  10651. by the given coordinates.
  10652. Default value is @samp{source}.
  10653. @end table
  10654. @item eval
  10655. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  10656. It accepts the following values:
  10657. @table @samp
  10658. @item init
  10659. only evaluate expressions once during the filter initialization or
  10660. when a command is processed
  10661. @item frame
  10662. evaluate expressions for each incoming frame
  10663. @end table
  10664. Default value is @samp{init}.
  10665. @end table
  10666. @section phase
  10667. Delay interlaced video by one field time so that the field order changes.
  10668. The intended use is to fix PAL movies that have been captured with the
  10669. opposite field order to the film-to-video transfer.
  10670. A description of the accepted parameters follows.
  10671. @table @option
  10672. @item mode
  10673. Set phase mode.
  10674. It accepts the following values:
  10675. @table @samp
  10676. @item t
  10677. Capture field order top-first, transfer bottom-first.
  10678. Filter will delay the bottom field.
  10679. @item b
  10680. Capture field order bottom-first, transfer top-first.
  10681. Filter will delay the top field.
  10682. @item p
  10683. Capture and transfer with the same field order. This mode only exists
  10684. for the documentation of the other options to refer to, but if you
  10685. actually select it, the filter will faithfully do nothing.
  10686. @item a
  10687. Capture field order determined automatically by field flags, transfer
  10688. opposite.
  10689. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  10690. basis using field flags. If no field information is available,
  10691. then this works just like @samp{u}.
  10692. @item u
  10693. Capture unknown or varying, transfer opposite.
  10694. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  10695. analyzing the images and selecting the alternative that produces best
  10696. match between the fields.
  10697. @item T
  10698. Capture top-first, transfer unknown or varying.
  10699. Filter selects among @samp{t} and @samp{p} using image analysis.
  10700. @item B
  10701. Capture bottom-first, transfer unknown or varying.
  10702. Filter selects among @samp{b} and @samp{p} using image analysis.
  10703. @item A
  10704. Capture determined by field flags, transfer unknown or varying.
  10705. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  10706. image analysis. If no field information is available, then this works just
  10707. like @samp{U}. This is the default mode.
  10708. @item U
  10709. Both capture and transfer unknown or varying.
  10710. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  10711. @end table
  10712. @end table
  10713. @section pixdesctest
  10714. Pixel format descriptor test filter, mainly useful for internal
  10715. testing. The output video should be equal to the input video.
  10716. For example:
  10717. @example
  10718. format=monow, pixdesctest
  10719. @end example
  10720. can be used to test the monowhite pixel format descriptor definition.
  10721. @section pixscope
  10722. Display sample values of color channels. Mainly useful for checking color
  10723. and levels. Minimum supported resolution is 640x480.
  10724. The filters accept the following options:
  10725. @table @option
  10726. @item x
  10727. Set scope X position, relative offset on X axis.
  10728. @item y
  10729. Set scope Y position, relative offset on Y axis.
  10730. @item w
  10731. Set scope width.
  10732. @item h
  10733. Set scope height.
  10734. @item o
  10735. Set window opacity. This window also holds statistics about pixel area.
  10736. @item wx
  10737. Set window X position, relative offset on X axis.
  10738. @item wy
  10739. Set window Y position, relative offset on Y axis.
  10740. @end table
  10741. @section pp
  10742. Enable the specified chain of postprocessing subfilters using libpostproc. This
  10743. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  10744. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  10745. Each subfilter and some options have a short and a long name that can be used
  10746. interchangeably, i.e. dr/dering are the same.
  10747. The filters accept the following options:
  10748. @table @option
  10749. @item subfilters
  10750. Set postprocessing subfilters string.
  10751. @end table
  10752. All subfilters share common options to determine their scope:
  10753. @table @option
  10754. @item a/autoq
  10755. Honor the quality commands for this subfilter.
  10756. @item c/chrom
  10757. Do chrominance filtering, too (default).
  10758. @item y/nochrom
  10759. Do luminance filtering only (no chrominance).
  10760. @item n/noluma
  10761. Do chrominance filtering only (no luminance).
  10762. @end table
  10763. These options can be appended after the subfilter name, separated by a '|'.
  10764. Available subfilters are:
  10765. @table @option
  10766. @item hb/hdeblock[|difference[|flatness]]
  10767. Horizontal deblocking filter
  10768. @table @option
  10769. @item difference
  10770. Difference factor where higher values mean more deblocking (default: @code{32}).
  10771. @item flatness
  10772. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10773. @end table
  10774. @item vb/vdeblock[|difference[|flatness]]
  10775. Vertical deblocking filter
  10776. @table @option
  10777. @item difference
  10778. Difference factor where higher values mean more deblocking (default: @code{32}).
  10779. @item flatness
  10780. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10781. @end table
  10782. @item ha/hadeblock[|difference[|flatness]]
  10783. Accurate horizontal deblocking filter
  10784. @table @option
  10785. @item difference
  10786. Difference factor where higher values mean more deblocking (default: @code{32}).
  10787. @item flatness
  10788. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10789. @end table
  10790. @item va/vadeblock[|difference[|flatness]]
  10791. Accurate vertical deblocking filter
  10792. @table @option
  10793. @item difference
  10794. Difference factor where higher values mean more deblocking (default: @code{32}).
  10795. @item flatness
  10796. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10797. @end table
  10798. @end table
  10799. The horizontal and vertical deblocking filters share the difference and
  10800. flatness values so you cannot set different horizontal and vertical
  10801. thresholds.
  10802. @table @option
  10803. @item h1/x1hdeblock
  10804. Experimental horizontal deblocking filter
  10805. @item v1/x1vdeblock
  10806. Experimental vertical deblocking filter
  10807. @item dr/dering
  10808. Deringing filter
  10809. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10810. @table @option
  10811. @item threshold1
  10812. larger -> stronger filtering
  10813. @item threshold2
  10814. larger -> stronger filtering
  10815. @item threshold3
  10816. larger -> stronger filtering
  10817. @end table
  10818. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10819. @table @option
  10820. @item f/fullyrange
  10821. Stretch luminance to @code{0-255}.
  10822. @end table
  10823. @item lb/linblenddeint
  10824. Linear blend deinterlacing filter that deinterlaces the given block by
  10825. filtering all lines with a @code{(1 2 1)} filter.
  10826. @item li/linipoldeint
  10827. Linear interpolating deinterlacing filter that deinterlaces the given block by
  10828. linearly interpolating every second line.
  10829. @item ci/cubicipoldeint
  10830. Cubic interpolating deinterlacing filter deinterlaces the given block by
  10831. cubically interpolating every second line.
  10832. @item md/mediandeint
  10833. Median deinterlacing filter that deinterlaces the given block by applying a
  10834. median filter to every second line.
  10835. @item fd/ffmpegdeint
  10836. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  10837. second line with a @code{(-1 4 2 4 -1)} filter.
  10838. @item l5/lowpass5
  10839. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  10840. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  10841. @item fq/forceQuant[|quantizer]
  10842. Overrides the quantizer table from the input with the constant quantizer you
  10843. specify.
  10844. @table @option
  10845. @item quantizer
  10846. Quantizer to use
  10847. @end table
  10848. @item de/default
  10849. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  10850. @item fa/fast
  10851. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  10852. @item ac
  10853. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  10854. @end table
  10855. @subsection Examples
  10856. @itemize
  10857. @item
  10858. Apply horizontal and vertical deblocking, deringing and automatic
  10859. brightness/contrast:
  10860. @example
  10861. pp=hb/vb/dr/al
  10862. @end example
  10863. @item
  10864. Apply default filters without brightness/contrast correction:
  10865. @example
  10866. pp=de/-al
  10867. @end example
  10868. @item
  10869. Apply default filters and temporal denoiser:
  10870. @example
  10871. pp=default/tmpnoise|1|2|3
  10872. @end example
  10873. @item
  10874. Apply deblocking on luminance only, and switch vertical deblocking on or off
  10875. automatically depending on available CPU time:
  10876. @example
  10877. pp=hb|y/vb|a
  10878. @end example
  10879. @end itemize
  10880. @section pp7
  10881. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  10882. similar to spp = 6 with 7 point DCT, where only the center sample is
  10883. used after IDCT.
  10884. The filter accepts the following options:
  10885. @table @option
  10886. @item qp
  10887. Force a constant quantization parameter. It accepts an integer in range
  10888. 0 to 63. If not set, the filter will use the QP from the video stream
  10889. (if available).
  10890. @item mode
  10891. Set thresholding mode. Available modes are:
  10892. @table @samp
  10893. @item hard
  10894. Set hard thresholding.
  10895. @item soft
  10896. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10897. @item medium
  10898. Set medium thresholding (good results, default).
  10899. @end table
  10900. @end table
  10901. @section premultiply
  10902. Apply alpha premultiply effect to input video stream using first plane
  10903. of second stream as alpha.
  10904. Both streams must have same dimensions and same pixel format.
  10905. The filter accepts the following option:
  10906. @table @option
  10907. @item planes
  10908. Set which planes will be processed, unprocessed planes will be copied.
  10909. By default value 0xf, all planes will be processed.
  10910. @item inplace
  10911. Do not require 2nd input for processing, instead use alpha plane from input stream.
  10912. @end table
  10913. @section prewitt
  10914. Apply prewitt operator to input video stream.
  10915. The filter accepts the following option:
  10916. @table @option
  10917. @item planes
  10918. Set which planes will be processed, unprocessed planes will be copied.
  10919. By default value 0xf, all planes will be processed.
  10920. @item scale
  10921. Set value which will be multiplied with filtered result.
  10922. @item delta
  10923. Set value which will be added to filtered result.
  10924. @end table
  10925. @anchor{program_opencl}
  10926. @section program_opencl
  10927. Filter video using an OpenCL program.
  10928. @table @option
  10929. @item source
  10930. OpenCL program source file.
  10931. @item kernel
  10932. Kernel name in program.
  10933. @item inputs
  10934. Number of inputs to the filter. Defaults to 1.
  10935. @item size, s
  10936. Size of output frames. Defaults to the same as the first input.
  10937. @end table
  10938. The program source file must contain a kernel function with the given name,
  10939. which will be run once for each plane of the output. Each run on a plane
  10940. gets enqueued as a separate 2D global NDRange with one work-item for each
  10941. pixel to be generated. The global ID offset for each work-item is therefore
  10942. the coordinates of a pixel in the destination image.
  10943. The kernel function needs to take the following arguments:
  10944. @itemize
  10945. @item
  10946. Destination image, @var{__write_only image2d_t}.
  10947. This image will become the output; the kernel should write all of it.
  10948. @item
  10949. Frame index, @var{unsigned int}.
  10950. This is a counter starting from zero and increasing by one for each frame.
  10951. @item
  10952. Source images, @var{__read_only image2d_t}.
  10953. These are the most recent images on each input. The kernel may read from
  10954. them to generate the output, but they can't be written to.
  10955. @end itemize
  10956. Example programs:
  10957. @itemize
  10958. @item
  10959. Copy the input to the output (output must be the same size as the input).
  10960. @verbatim
  10961. __kernel void copy(__write_only image2d_t destination,
  10962. unsigned int index,
  10963. __read_only image2d_t source)
  10964. {
  10965. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  10966. int2 location = (int2)(get_global_id(0), get_global_id(1));
  10967. float4 value = read_imagef(source, sampler, location);
  10968. write_imagef(destination, location, value);
  10969. }
  10970. @end verbatim
  10971. @item
  10972. Apply a simple transformation, rotating the input by an amount increasing
  10973. with the index counter. Pixel values are linearly interpolated by the
  10974. sampler, and the output need not have the same dimensions as the input.
  10975. @verbatim
  10976. __kernel void rotate_image(__write_only image2d_t dst,
  10977. unsigned int index,
  10978. __read_only image2d_t src)
  10979. {
  10980. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10981. CLK_FILTER_LINEAR);
  10982. float angle = (float)index / 100.0f;
  10983. float2 dst_dim = convert_float2(get_image_dim(dst));
  10984. float2 src_dim = convert_float2(get_image_dim(src));
  10985. float2 dst_cen = dst_dim / 2.0f;
  10986. float2 src_cen = src_dim / 2.0f;
  10987. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10988. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  10989. float2 src_pos = {
  10990. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  10991. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  10992. };
  10993. src_pos = src_pos * src_dim / dst_dim;
  10994. float2 src_loc = src_pos + src_cen;
  10995. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  10996. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  10997. write_imagef(dst, dst_loc, 0.5f);
  10998. else
  10999. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  11000. }
  11001. @end verbatim
  11002. @item
  11003. Blend two inputs together, with the amount of each input used varying
  11004. with the index counter.
  11005. @verbatim
  11006. __kernel void blend_images(__write_only image2d_t dst,
  11007. unsigned int index,
  11008. __read_only image2d_t src1,
  11009. __read_only image2d_t src2)
  11010. {
  11011. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  11012. CLK_FILTER_LINEAR);
  11013. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  11014. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  11015. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  11016. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  11017. float4 val1 = read_imagef(src1, sampler, src1_loc);
  11018. float4 val2 = read_imagef(src2, sampler, src2_loc);
  11019. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  11020. }
  11021. @end verbatim
  11022. @end itemize
  11023. @section pseudocolor
  11024. Alter frame colors in video with pseudocolors.
  11025. This filter accept the following options:
  11026. @table @option
  11027. @item c0
  11028. set pixel first component expression
  11029. @item c1
  11030. set pixel second component expression
  11031. @item c2
  11032. set pixel third component expression
  11033. @item c3
  11034. set pixel fourth component expression, corresponds to the alpha component
  11035. @item i
  11036. set component to use as base for altering colors
  11037. @end table
  11038. Each of them specifies the expression to use for computing the lookup table for
  11039. the corresponding pixel component values.
  11040. The expressions can contain the following constants and functions:
  11041. @table @option
  11042. @item w
  11043. @item h
  11044. The input width and height.
  11045. @item val
  11046. The input value for the pixel component.
  11047. @item ymin, umin, vmin, amin
  11048. The minimum allowed component value.
  11049. @item ymax, umax, vmax, amax
  11050. The maximum allowed component value.
  11051. @end table
  11052. All expressions default to "val".
  11053. @subsection Examples
  11054. @itemize
  11055. @item
  11056. Change too high luma values to gradient:
  11057. @example
  11058. 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'"
  11059. @end example
  11060. @end itemize
  11061. @section psnr
  11062. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  11063. Ratio) between two input videos.
  11064. This filter takes in input two input videos, the first input is
  11065. considered the "main" source and is passed unchanged to the
  11066. output. The second input is used as a "reference" video for computing
  11067. the PSNR.
  11068. Both video inputs must have the same resolution and pixel format for
  11069. this filter to work correctly. Also it assumes that both inputs
  11070. have the same number of frames, which are compared one by one.
  11071. The obtained average PSNR is printed through the logging system.
  11072. The filter stores the accumulated MSE (mean squared error) of each
  11073. frame, and at the end of the processing it is averaged across all frames
  11074. equally, and the following formula is applied to obtain the PSNR:
  11075. @example
  11076. PSNR = 10*log10(MAX^2/MSE)
  11077. @end example
  11078. Where MAX is the average of the maximum values of each component of the
  11079. image.
  11080. The description of the accepted parameters follows.
  11081. @table @option
  11082. @item stats_file, f
  11083. If specified the filter will use the named file to save the PSNR of
  11084. each individual frame. When filename equals "-" the data is sent to
  11085. standard output.
  11086. @item stats_version
  11087. Specifies which version of the stats file format to use. Details of
  11088. each format are written below.
  11089. Default value is 1.
  11090. @item stats_add_max
  11091. Determines whether the max value is output to the stats log.
  11092. Default value is 0.
  11093. Requires stats_version >= 2. If this is set and stats_version < 2,
  11094. the filter will return an error.
  11095. @end table
  11096. This filter also supports the @ref{framesync} options.
  11097. The file printed if @var{stats_file} is selected, contains a sequence of
  11098. key/value pairs of the form @var{key}:@var{value} for each compared
  11099. couple of frames.
  11100. If a @var{stats_version} greater than 1 is specified, a header line precedes
  11101. the list of per-frame-pair stats, with key value pairs following the frame
  11102. format with the following parameters:
  11103. @table @option
  11104. @item psnr_log_version
  11105. The version of the log file format. Will match @var{stats_version}.
  11106. @item fields
  11107. A comma separated list of the per-frame-pair parameters included in
  11108. the log.
  11109. @end table
  11110. A description of each shown per-frame-pair parameter follows:
  11111. @table @option
  11112. @item n
  11113. sequential number of the input frame, starting from 1
  11114. @item mse_avg
  11115. Mean Square Error pixel-by-pixel average difference of the compared
  11116. frames, averaged over all the image components.
  11117. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  11118. Mean Square Error pixel-by-pixel average difference of the compared
  11119. frames for the component specified by the suffix.
  11120. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  11121. Peak Signal to Noise ratio of the compared frames for the component
  11122. specified by the suffix.
  11123. @item max_avg, max_y, max_u, max_v
  11124. Maximum allowed value for each channel, and average over all
  11125. channels.
  11126. @end table
  11127. For example:
  11128. @example
  11129. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11130. [main][ref] psnr="stats_file=stats.log" [out]
  11131. @end example
  11132. On this example the input file being processed is compared with the
  11133. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  11134. is stored in @file{stats.log}.
  11135. @anchor{pullup}
  11136. @section pullup
  11137. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  11138. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  11139. content.
  11140. The pullup filter is designed to take advantage of future context in making
  11141. its decisions. This filter is stateless in the sense that it does not lock
  11142. onto a pattern to follow, but it instead looks forward to the following
  11143. fields in order to identify matches and rebuild progressive frames.
  11144. To produce content with an even framerate, insert the fps filter after
  11145. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  11146. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  11147. The filter accepts the following options:
  11148. @table @option
  11149. @item jl
  11150. @item jr
  11151. @item jt
  11152. @item jb
  11153. These options set the amount of "junk" to ignore at the left, right, top, and
  11154. bottom of the image, respectively. Left and right are in units of 8 pixels,
  11155. while top and bottom are in units of 2 lines.
  11156. The default is 8 pixels on each side.
  11157. @item sb
  11158. Set the strict breaks. Setting this option to 1 will reduce the chances of
  11159. filter generating an occasional mismatched frame, but it may also cause an
  11160. excessive number of frames to be dropped during high motion sequences.
  11161. Conversely, setting it to -1 will make filter match fields more easily.
  11162. This may help processing of video where there is slight blurring between
  11163. the fields, but may also cause there to be interlaced frames in the output.
  11164. Default value is @code{0}.
  11165. @item mp
  11166. Set the metric plane to use. It accepts the following values:
  11167. @table @samp
  11168. @item l
  11169. Use luma plane.
  11170. @item u
  11171. Use chroma blue plane.
  11172. @item v
  11173. Use chroma red plane.
  11174. @end table
  11175. This option may be set to use chroma plane instead of the default luma plane
  11176. for doing filter's computations. This may improve accuracy on very clean
  11177. source material, but more likely will decrease accuracy, especially if there
  11178. is chroma noise (rainbow effect) or any grayscale video.
  11179. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  11180. load and make pullup usable in realtime on slow machines.
  11181. @end table
  11182. For best results (without duplicated frames in the output file) it is
  11183. necessary to change the output frame rate. For example, to inverse
  11184. telecine NTSC input:
  11185. @example
  11186. ffmpeg -i input -vf pullup -r 24000/1001 ...
  11187. @end example
  11188. @section qp
  11189. Change video quantization parameters (QP).
  11190. The filter accepts the following option:
  11191. @table @option
  11192. @item qp
  11193. Set expression for quantization parameter.
  11194. @end table
  11195. The expression is evaluated through the eval API and can contain, among others,
  11196. the following constants:
  11197. @table @var
  11198. @item known
  11199. 1 if index is not 129, 0 otherwise.
  11200. @item qp
  11201. Sequential index starting from -129 to 128.
  11202. @end table
  11203. @subsection Examples
  11204. @itemize
  11205. @item
  11206. Some equation like:
  11207. @example
  11208. qp=2+2*sin(PI*qp)
  11209. @end example
  11210. @end itemize
  11211. @section random
  11212. Flush video frames from internal cache of frames into a random order.
  11213. No frame is discarded.
  11214. Inspired by @ref{frei0r} nervous filter.
  11215. @table @option
  11216. @item frames
  11217. Set size in number of frames of internal cache, in range from @code{2} to
  11218. @code{512}. Default is @code{30}.
  11219. @item seed
  11220. Set seed for random number generator, must be an integer included between
  11221. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11222. less than @code{0}, the filter will try to use a good random seed on a
  11223. best effort basis.
  11224. @end table
  11225. @section readeia608
  11226. Read closed captioning (EIA-608) information from the top lines of a video frame.
  11227. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  11228. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  11229. with EIA-608 data (starting from 0). A description of each metadata value follows:
  11230. @table @option
  11231. @item lavfi.readeia608.X.cc
  11232. The two bytes stored as EIA-608 data (printed in hexadecimal).
  11233. @item lavfi.readeia608.X.line
  11234. The number of the line on which the EIA-608 data was identified and read.
  11235. @end table
  11236. This filter accepts the following options:
  11237. @table @option
  11238. @item scan_min
  11239. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  11240. @item scan_max
  11241. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  11242. @item mac
  11243. Set minimal acceptable amplitude change for sync codes detection.
  11244. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  11245. @item spw
  11246. Set the ratio of width reserved for sync code detection.
  11247. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  11248. @item mhd
  11249. Set the max peaks height difference for sync code detection.
  11250. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11251. @item mpd
  11252. Set max peaks period difference for sync code detection.
  11253. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11254. @item msd
  11255. Set the first two max start code bits differences.
  11256. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  11257. @item bhd
  11258. Set the minimum ratio of bits height compared to 3rd start code bit.
  11259. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  11260. @item th_w
  11261. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  11262. @item th_b
  11263. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  11264. @item chp
  11265. Enable checking the parity bit. In the event of a parity error, the filter will output
  11266. @code{0x00} for that character. Default is false.
  11267. @item lp
  11268. Lowpass lines prior further proccessing. Default is disabled.
  11269. @end table
  11270. @subsection Examples
  11271. @itemize
  11272. @item
  11273. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  11274. @example
  11275. 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
  11276. @end example
  11277. @end itemize
  11278. @section readvitc
  11279. Read vertical interval timecode (VITC) information from the top lines of a
  11280. video frame.
  11281. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  11282. timecode value, if a valid timecode has been detected. Further metadata key
  11283. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  11284. timecode data has been found or not.
  11285. This filter accepts the following options:
  11286. @table @option
  11287. @item scan_max
  11288. Set the maximum number of lines to scan for VITC data. If the value is set to
  11289. @code{-1} the full video frame is scanned. Default is @code{45}.
  11290. @item thr_b
  11291. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  11292. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  11293. @item thr_w
  11294. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  11295. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  11296. @end table
  11297. @subsection Examples
  11298. @itemize
  11299. @item
  11300. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  11301. draw @code{--:--:--:--} as a placeholder:
  11302. @example
  11303. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  11304. @end example
  11305. @end itemize
  11306. @section remap
  11307. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  11308. Destination pixel at position (X, Y) will be picked from source (x, y) position
  11309. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  11310. value for pixel will be used for destination pixel.
  11311. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  11312. will have Xmap/Ymap video stream dimensions.
  11313. Xmap and Ymap input video streams are 16bit depth, single channel.
  11314. @table @option
  11315. @item format
  11316. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  11317. Default is @code{color}.
  11318. @end table
  11319. @section removegrain
  11320. The removegrain filter is a spatial denoiser for progressive video.
  11321. @table @option
  11322. @item m0
  11323. Set mode for the first plane.
  11324. @item m1
  11325. Set mode for the second plane.
  11326. @item m2
  11327. Set mode for the third plane.
  11328. @item m3
  11329. Set mode for the fourth plane.
  11330. @end table
  11331. Range of mode is from 0 to 24. Description of each mode follows:
  11332. @table @var
  11333. @item 0
  11334. Leave input plane unchanged. Default.
  11335. @item 1
  11336. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  11337. @item 2
  11338. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  11339. @item 3
  11340. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  11341. @item 4
  11342. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  11343. This is equivalent to a median filter.
  11344. @item 5
  11345. Line-sensitive clipping giving the minimal change.
  11346. @item 6
  11347. Line-sensitive clipping, intermediate.
  11348. @item 7
  11349. Line-sensitive clipping, intermediate.
  11350. @item 8
  11351. Line-sensitive clipping, intermediate.
  11352. @item 9
  11353. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  11354. @item 10
  11355. Replaces the target pixel with the closest neighbour.
  11356. @item 11
  11357. [1 2 1] horizontal and vertical kernel blur.
  11358. @item 12
  11359. Same as mode 11.
  11360. @item 13
  11361. Bob mode, interpolates top field from the line where the neighbours
  11362. pixels are the closest.
  11363. @item 14
  11364. Bob mode, interpolates bottom field from the line where the neighbours
  11365. pixels are the closest.
  11366. @item 15
  11367. Bob mode, interpolates top field. Same as 13 but with a more complicated
  11368. interpolation formula.
  11369. @item 16
  11370. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  11371. interpolation formula.
  11372. @item 17
  11373. Clips the pixel with the minimum and maximum of respectively the maximum and
  11374. minimum of each pair of opposite neighbour pixels.
  11375. @item 18
  11376. Line-sensitive clipping using opposite neighbours whose greatest distance from
  11377. the current pixel is minimal.
  11378. @item 19
  11379. Replaces the pixel with the average of its 8 neighbours.
  11380. @item 20
  11381. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  11382. @item 21
  11383. Clips pixels using the averages of opposite neighbour.
  11384. @item 22
  11385. Same as mode 21 but simpler and faster.
  11386. @item 23
  11387. Small edge and halo removal, but reputed useless.
  11388. @item 24
  11389. Similar as 23.
  11390. @end table
  11391. @section removelogo
  11392. Suppress a TV station logo, using an image file to determine which
  11393. pixels comprise the logo. It works by filling in the pixels that
  11394. comprise the logo with neighboring pixels.
  11395. The filter accepts the following options:
  11396. @table @option
  11397. @item filename, f
  11398. Set the filter bitmap file, which can be any image format supported by
  11399. libavformat. The width and height of the image file must match those of the
  11400. video stream being processed.
  11401. @end table
  11402. Pixels in the provided bitmap image with a value of zero are not
  11403. considered part of the logo, non-zero pixels are considered part of
  11404. the logo. If you use white (255) for the logo and black (0) for the
  11405. rest, you will be safe. For making the filter bitmap, it is
  11406. recommended to take a screen capture of a black frame with the logo
  11407. visible, and then using a threshold filter followed by the erode
  11408. filter once or twice.
  11409. If needed, little splotches can be fixed manually. Remember that if
  11410. logo pixels are not covered, the filter quality will be much
  11411. reduced. Marking too many pixels as part of the logo does not hurt as
  11412. much, but it will increase the amount of blurring needed to cover over
  11413. the image and will destroy more information than necessary, and extra
  11414. pixels will slow things down on a large logo.
  11415. @section repeatfields
  11416. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  11417. fields based on its value.
  11418. @section reverse
  11419. Reverse a video clip.
  11420. Warning: This filter requires memory to buffer the entire clip, so trimming
  11421. is suggested.
  11422. @subsection Examples
  11423. @itemize
  11424. @item
  11425. Take the first 5 seconds of a clip, and reverse it.
  11426. @example
  11427. trim=end=5,reverse
  11428. @end example
  11429. @end itemize
  11430. @section rgbashift
  11431. Shift R/G/B/A pixels horizontally and/or vertically.
  11432. The filter accepts the following options:
  11433. @table @option
  11434. @item rh
  11435. Set amount to shift red horizontally.
  11436. @item rv
  11437. Set amount to shift red vertically.
  11438. @item gh
  11439. Set amount to shift green horizontally.
  11440. @item gv
  11441. Set amount to shift green vertically.
  11442. @item bh
  11443. Set amount to shift blue horizontally.
  11444. @item bv
  11445. Set amount to shift blue vertically.
  11446. @item ah
  11447. Set amount to shift alpha horizontally.
  11448. @item av
  11449. Set amount to shift alpha vertically.
  11450. @item edge
  11451. Set edge mode, can be @var{smear}, default, or @var{warp}.
  11452. @end table
  11453. @section roberts
  11454. Apply roberts cross operator to input video stream.
  11455. The filter accepts the following option:
  11456. @table @option
  11457. @item planes
  11458. Set which planes will be processed, unprocessed planes will be copied.
  11459. By default value 0xf, all planes will be processed.
  11460. @item scale
  11461. Set value which will be multiplied with filtered result.
  11462. @item delta
  11463. Set value which will be added to filtered result.
  11464. @end table
  11465. @section rotate
  11466. Rotate video by an arbitrary angle expressed in radians.
  11467. The filter accepts the following options:
  11468. A description of the optional parameters follows.
  11469. @table @option
  11470. @item angle, a
  11471. Set an expression for the angle by which to rotate the input video
  11472. clockwise, expressed as a number of radians. A negative value will
  11473. result in a counter-clockwise rotation. By default it is set to "0".
  11474. This expression is evaluated for each frame.
  11475. @item out_w, ow
  11476. Set the output width expression, default value is "iw".
  11477. This expression is evaluated just once during configuration.
  11478. @item out_h, oh
  11479. Set the output height expression, default value is "ih".
  11480. This expression is evaluated just once during configuration.
  11481. @item bilinear
  11482. Enable bilinear interpolation if set to 1, a value of 0 disables
  11483. it. Default value is 1.
  11484. @item fillcolor, c
  11485. Set the color used to fill the output area not covered by the rotated
  11486. image. For the general syntax of this option, check the
  11487. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11488. If the special value "none" is selected then no
  11489. background is printed (useful for example if the background is never shown).
  11490. Default value is "black".
  11491. @end table
  11492. The expressions for the angle and the output size can contain the
  11493. following constants and functions:
  11494. @table @option
  11495. @item n
  11496. sequential number of the input frame, starting from 0. It is always NAN
  11497. before the first frame is filtered.
  11498. @item t
  11499. time in seconds of the input frame, it is set to 0 when the filter is
  11500. configured. It is always NAN before the first frame is filtered.
  11501. @item hsub
  11502. @item vsub
  11503. horizontal and vertical chroma subsample values. For example for the
  11504. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11505. @item in_w, iw
  11506. @item in_h, ih
  11507. the input video width and height
  11508. @item out_w, ow
  11509. @item out_h, oh
  11510. the output width and height, that is the size of the padded area as
  11511. specified by the @var{width} and @var{height} expressions
  11512. @item rotw(a)
  11513. @item roth(a)
  11514. the minimal width/height required for completely containing the input
  11515. video rotated by @var{a} radians.
  11516. These are only available when computing the @option{out_w} and
  11517. @option{out_h} expressions.
  11518. @end table
  11519. @subsection Examples
  11520. @itemize
  11521. @item
  11522. Rotate the input by PI/6 radians clockwise:
  11523. @example
  11524. rotate=PI/6
  11525. @end example
  11526. @item
  11527. Rotate the input by PI/6 radians counter-clockwise:
  11528. @example
  11529. rotate=-PI/6
  11530. @end example
  11531. @item
  11532. Rotate the input by 45 degrees clockwise:
  11533. @example
  11534. rotate=45*PI/180
  11535. @end example
  11536. @item
  11537. Apply a constant rotation with period T, starting from an angle of PI/3:
  11538. @example
  11539. rotate=PI/3+2*PI*t/T
  11540. @end example
  11541. @item
  11542. Make the input video rotation oscillating with a period of T
  11543. seconds and an amplitude of A radians:
  11544. @example
  11545. rotate=A*sin(2*PI/T*t)
  11546. @end example
  11547. @item
  11548. Rotate the video, output size is chosen so that the whole rotating
  11549. input video is always completely contained in the output:
  11550. @example
  11551. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  11552. @end example
  11553. @item
  11554. Rotate the video, reduce the output size so that no background is ever
  11555. shown:
  11556. @example
  11557. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  11558. @end example
  11559. @end itemize
  11560. @subsection Commands
  11561. The filter supports the following commands:
  11562. @table @option
  11563. @item a, angle
  11564. Set the angle expression.
  11565. The command accepts the same syntax of the corresponding option.
  11566. If the specified expression is not valid, it is kept at its current
  11567. value.
  11568. @end table
  11569. @section sab
  11570. Apply Shape Adaptive Blur.
  11571. The filter accepts the following options:
  11572. @table @option
  11573. @item luma_radius, lr
  11574. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  11575. value is 1.0. A greater value will result in a more blurred image, and
  11576. in slower processing.
  11577. @item luma_pre_filter_radius, lpfr
  11578. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  11579. value is 1.0.
  11580. @item luma_strength, ls
  11581. Set luma maximum difference between pixels to still be considered, must
  11582. be a value in the 0.1-100.0 range, default value is 1.0.
  11583. @item chroma_radius, cr
  11584. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  11585. greater value will result in a more blurred image, and in slower
  11586. processing.
  11587. @item chroma_pre_filter_radius, cpfr
  11588. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  11589. @item chroma_strength, cs
  11590. Set chroma maximum difference between pixels to still be considered,
  11591. must be a value in the -0.9-100.0 range.
  11592. @end table
  11593. Each chroma option value, if not explicitly specified, is set to the
  11594. corresponding luma option value.
  11595. @anchor{scale}
  11596. @section scale
  11597. Scale (resize) the input video, using the libswscale library.
  11598. The scale filter forces the output display aspect ratio to be the same
  11599. of the input, by changing the output sample aspect ratio.
  11600. If the input image format is different from the format requested by
  11601. the next filter, the scale filter will convert the input to the
  11602. requested format.
  11603. @subsection Options
  11604. The filter accepts the following options, or any of the options
  11605. supported by the libswscale scaler.
  11606. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  11607. the complete list of scaler options.
  11608. @table @option
  11609. @item width, w
  11610. @item height, h
  11611. Set the output video dimension expression. Default value is the input
  11612. dimension.
  11613. If the @var{width} or @var{w} value is 0, the input width is used for
  11614. the output. If the @var{height} or @var{h} value is 0, the input height
  11615. is used for the output.
  11616. If one and only one of the values is -n with n >= 1, the scale filter
  11617. will use a value that maintains the aspect ratio of the input image,
  11618. calculated from the other specified dimension. After that it will,
  11619. however, make sure that the calculated dimension is divisible by n and
  11620. adjust the value if necessary.
  11621. If both values are -n with n >= 1, the behavior will be identical to
  11622. both values being set to 0 as previously detailed.
  11623. See below for the list of accepted constants for use in the dimension
  11624. expression.
  11625. @item eval
  11626. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  11627. @table @samp
  11628. @item init
  11629. Only evaluate expressions once during the filter initialization or when a command is processed.
  11630. @item frame
  11631. Evaluate expressions for each incoming frame.
  11632. @end table
  11633. Default value is @samp{init}.
  11634. @item interl
  11635. Set the interlacing mode. It accepts the following values:
  11636. @table @samp
  11637. @item 1
  11638. Force interlaced aware scaling.
  11639. @item 0
  11640. Do not apply interlaced scaling.
  11641. @item -1
  11642. Select interlaced aware scaling depending on whether the source frames
  11643. are flagged as interlaced or not.
  11644. @end table
  11645. Default value is @samp{0}.
  11646. @item flags
  11647. Set libswscale scaling flags. See
  11648. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11649. complete list of values. If not explicitly specified the filter applies
  11650. the default flags.
  11651. @item param0, param1
  11652. Set libswscale input parameters for scaling algorithms that need them. See
  11653. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11654. complete documentation. If not explicitly specified the filter applies
  11655. empty parameters.
  11656. @item size, s
  11657. Set the video size. For the syntax of this option, check the
  11658. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11659. @item in_color_matrix
  11660. @item out_color_matrix
  11661. Set in/output YCbCr color space type.
  11662. This allows the autodetected value to be overridden as well as allows forcing
  11663. a specific value used for the output and encoder.
  11664. If not specified, the color space type depends on the pixel format.
  11665. Possible values:
  11666. @table @samp
  11667. @item auto
  11668. Choose automatically.
  11669. @item bt709
  11670. Format conforming to International Telecommunication Union (ITU)
  11671. Recommendation BT.709.
  11672. @item fcc
  11673. Set color space conforming to the United States Federal Communications
  11674. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  11675. @item bt601
  11676. @item bt470
  11677. @item smpte170m
  11678. Set color space conforming to:
  11679. @itemize
  11680. @item
  11681. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  11682. @item
  11683. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  11684. @item
  11685. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  11686. @end itemize
  11687. @item smpte240m
  11688. Set color space conforming to SMPTE ST 240:1999.
  11689. @item bt2020
  11690. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  11691. @end table
  11692. @item in_range
  11693. @item out_range
  11694. Set in/output YCbCr sample range.
  11695. This allows the autodetected value to be overridden as well as allows forcing
  11696. a specific value used for the output and encoder. If not specified, the
  11697. range depends on the pixel format. Possible values:
  11698. @table @samp
  11699. @item auto/unknown
  11700. Choose automatically.
  11701. @item jpeg/full/pc
  11702. Set full range (0-255 in case of 8-bit luma).
  11703. @item mpeg/limited/tv
  11704. Set "MPEG" range (16-235 in case of 8-bit luma).
  11705. @end table
  11706. @item force_original_aspect_ratio
  11707. Enable decreasing or increasing output video width or height if necessary to
  11708. keep the original aspect ratio. Possible values:
  11709. @table @samp
  11710. @item disable
  11711. Scale the video as specified and disable this feature.
  11712. @item decrease
  11713. The output video dimensions will automatically be decreased if needed.
  11714. @item increase
  11715. The output video dimensions will automatically be increased if needed.
  11716. @end table
  11717. One useful instance of this option is that when you know a specific device's
  11718. maximum allowed resolution, you can use this to limit the output video to
  11719. that, while retaining the aspect ratio. For example, device A allows
  11720. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  11721. decrease) and specifying 1280x720 to the command line makes the output
  11722. 1280x533.
  11723. Please note that this is a different thing than specifying -1 for @option{w}
  11724. or @option{h}, you still need to specify the output resolution for this option
  11725. to work.
  11726. @item force_divisible_by Ensures that the output resolution is divisible by the
  11727. given integer when used together with @option{force_original_aspect_ratio}. This
  11728. works similar to using -n in the @option{w} and @option{h} options.
  11729. This option respects the value set for @option{force_original_aspect_ratio},
  11730. increasing or decreasing the resolution accordingly. This may slightly modify
  11731. the video's aspect ration.
  11732. This can be handy, for example, if you want to have a video fit within a defined
  11733. resolution using the @option{force_original_aspect_ratio} option but have
  11734. encoder restrictions when it comes to width or height.
  11735. @end table
  11736. The values of the @option{w} and @option{h} options are expressions
  11737. containing the following constants:
  11738. @table @var
  11739. @item in_w
  11740. @item in_h
  11741. The input width and height
  11742. @item iw
  11743. @item ih
  11744. These are the same as @var{in_w} and @var{in_h}.
  11745. @item out_w
  11746. @item out_h
  11747. The output (scaled) width and height
  11748. @item ow
  11749. @item oh
  11750. These are the same as @var{out_w} and @var{out_h}
  11751. @item a
  11752. The same as @var{iw} / @var{ih}
  11753. @item sar
  11754. input sample aspect ratio
  11755. @item dar
  11756. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11757. @item hsub
  11758. @item vsub
  11759. horizontal and vertical input chroma subsample values. For example for the
  11760. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11761. @item ohsub
  11762. @item ovsub
  11763. horizontal and vertical output chroma subsample values. For example for the
  11764. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11765. @end table
  11766. @subsection Examples
  11767. @itemize
  11768. @item
  11769. Scale the input video to a size of 200x100
  11770. @example
  11771. scale=w=200:h=100
  11772. @end example
  11773. This is equivalent to:
  11774. @example
  11775. scale=200:100
  11776. @end example
  11777. or:
  11778. @example
  11779. scale=200x100
  11780. @end example
  11781. @item
  11782. Specify a size abbreviation for the output size:
  11783. @example
  11784. scale=qcif
  11785. @end example
  11786. which can also be written as:
  11787. @example
  11788. scale=size=qcif
  11789. @end example
  11790. @item
  11791. Scale the input to 2x:
  11792. @example
  11793. scale=w=2*iw:h=2*ih
  11794. @end example
  11795. @item
  11796. The above is the same as:
  11797. @example
  11798. scale=2*in_w:2*in_h
  11799. @end example
  11800. @item
  11801. Scale the input to 2x with forced interlaced scaling:
  11802. @example
  11803. scale=2*iw:2*ih:interl=1
  11804. @end example
  11805. @item
  11806. Scale the input to half size:
  11807. @example
  11808. scale=w=iw/2:h=ih/2
  11809. @end example
  11810. @item
  11811. Increase the width, and set the height to the same size:
  11812. @example
  11813. scale=3/2*iw:ow
  11814. @end example
  11815. @item
  11816. Seek Greek harmony:
  11817. @example
  11818. scale=iw:1/PHI*iw
  11819. scale=ih*PHI:ih
  11820. @end example
  11821. @item
  11822. Increase the height, and set the width to 3/2 of the height:
  11823. @example
  11824. scale=w=3/2*oh:h=3/5*ih
  11825. @end example
  11826. @item
  11827. Increase the size, making the size a multiple of the chroma
  11828. subsample values:
  11829. @example
  11830. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  11831. @end example
  11832. @item
  11833. Increase the width to a maximum of 500 pixels,
  11834. keeping the same aspect ratio as the input:
  11835. @example
  11836. scale=w='min(500\, iw*3/2):h=-1'
  11837. @end example
  11838. @item
  11839. Make pixels square by combining scale and setsar:
  11840. @example
  11841. scale='trunc(ih*dar):ih',setsar=1/1
  11842. @end example
  11843. @item
  11844. Make pixels square by combining scale and setsar,
  11845. making sure the resulting resolution is even (required by some codecs):
  11846. @example
  11847. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  11848. @end example
  11849. @end itemize
  11850. @subsection Commands
  11851. This filter supports the following commands:
  11852. @table @option
  11853. @item width, w
  11854. @item height, h
  11855. Set the output video dimension expression.
  11856. The command accepts the same syntax of the corresponding option.
  11857. If the specified expression is not valid, it is kept at its current
  11858. value.
  11859. @end table
  11860. @section scale_npp
  11861. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  11862. format conversion on CUDA video frames. Setting the output width and height
  11863. works in the same way as for the @var{scale} filter.
  11864. The following additional options are accepted:
  11865. @table @option
  11866. @item format
  11867. The pixel format of the output CUDA frames. If set to the string "same" (the
  11868. default), the input format will be kept. Note that automatic format negotiation
  11869. and conversion is not yet supported for hardware frames
  11870. @item interp_algo
  11871. The interpolation algorithm used for resizing. One of the following:
  11872. @table @option
  11873. @item nn
  11874. Nearest neighbour.
  11875. @item linear
  11876. @item cubic
  11877. @item cubic2p_bspline
  11878. 2-parameter cubic (B=1, C=0)
  11879. @item cubic2p_catmullrom
  11880. 2-parameter cubic (B=0, C=1/2)
  11881. @item cubic2p_b05c03
  11882. 2-parameter cubic (B=1/2, C=3/10)
  11883. @item super
  11884. Supersampling
  11885. @item lanczos
  11886. @end table
  11887. @end table
  11888. @section scale2ref
  11889. Scale (resize) the input video, based on a reference video.
  11890. See the scale filter for available options, scale2ref supports the same but
  11891. uses the reference video instead of the main input as basis. scale2ref also
  11892. supports the following additional constants for the @option{w} and
  11893. @option{h} options:
  11894. @table @var
  11895. @item main_w
  11896. @item main_h
  11897. The main input video's width and height
  11898. @item main_a
  11899. The same as @var{main_w} / @var{main_h}
  11900. @item main_sar
  11901. The main input video's sample aspect ratio
  11902. @item main_dar, mdar
  11903. The main input video's display aspect ratio. Calculated from
  11904. @code{(main_w / main_h) * main_sar}.
  11905. @item main_hsub
  11906. @item main_vsub
  11907. The main input video's horizontal and vertical chroma subsample values.
  11908. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  11909. is 1.
  11910. @end table
  11911. @subsection Examples
  11912. @itemize
  11913. @item
  11914. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  11915. @example
  11916. 'scale2ref[b][a];[a][b]overlay'
  11917. @end example
  11918. @item
  11919. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  11920. @example
  11921. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  11922. @end example
  11923. @end itemize
  11924. @anchor{selectivecolor}
  11925. @section selectivecolor
  11926. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  11927. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  11928. by the "purity" of the color (that is, how saturated it already is).
  11929. This filter is similar to the Adobe Photoshop Selective Color tool.
  11930. The filter accepts the following options:
  11931. @table @option
  11932. @item correction_method
  11933. Select color correction method.
  11934. Available values are:
  11935. @table @samp
  11936. @item absolute
  11937. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  11938. component value).
  11939. @item relative
  11940. Specified adjustments are relative to the original component value.
  11941. @end table
  11942. Default is @code{absolute}.
  11943. @item reds
  11944. Adjustments for red pixels (pixels where the red component is the maximum)
  11945. @item yellows
  11946. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  11947. @item greens
  11948. Adjustments for green pixels (pixels where the green component is the maximum)
  11949. @item cyans
  11950. Adjustments for cyan pixels (pixels where the red component is the minimum)
  11951. @item blues
  11952. Adjustments for blue pixels (pixels where the blue component is the maximum)
  11953. @item magentas
  11954. Adjustments for magenta pixels (pixels where the green component is the minimum)
  11955. @item whites
  11956. Adjustments for white pixels (pixels where all components are greater than 128)
  11957. @item neutrals
  11958. Adjustments for all pixels except pure black and pure white
  11959. @item blacks
  11960. Adjustments for black pixels (pixels where all components are lesser than 128)
  11961. @item psfile
  11962. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  11963. @end table
  11964. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  11965. 4 space separated floating point adjustment values in the [-1,1] range,
  11966. respectively to adjust the amount of cyan, magenta, yellow and black for the
  11967. pixels of its range.
  11968. @subsection Examples
  11969. @itemize
  11970. @item
  11971. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  11972. increase magenta by 27% in blue areas:
  11973. @example
  11974. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  11975. @end example
  11976. @item
  11977. Use a Photoshop selective color preset:
  11978. @example
  11979. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  11980. @end example
  11981. @end itemize
  11982. @anchor{separatefields}
  11983. @section separatefields
  11984. The @code{separatefields} takes a frame-based video input and splits
  11985. each frame into its components fields, producing a new half height clip
  11986. with twice the frame rate and twice the frame count.
  11987. This filter use field-dominance information in frame to decide which
  11988. of each pair of fields to place first in the output.
  11989. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  11990. @section setdar, setsar
  11991. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  11992. output video.
  11993. This is done by changing the specified Sample (aka Pixel) Aspect
  11994. Ratio, according to the following equation:
  11995. @example
  11996. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  11997. @end example
  11998. Keep in mind that the @code{setdar} filter does not modify the pixel
  11999. dimensions of the video frame. Also, the display aspect ratio set by
  12000. this filter may be changed by later filters in the filterchain,
  12001. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  12002. applied.
  12003. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  12004. the filter output video.
  12005. Note that as a consequence of the application of this filter, the
  12006. output display aspect ratio will change according to the equation
  12007. above.
  12008. Keep in mind that the sample aspect ratio set by the @code{setsar}
  12009. filter may be changed by later filters in the filterchain, e.g. if
  12010. another "setsar" or a "setdar" filter is applied.
  12011. It accepts the following parameters:
  12012. @table @option
  12013. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  12014. Set the aspect ratio used by the filter.
  12015. The parameter can be a floating point number string, an expression, or
  12016. a string of the form @var{num}:@var{den}, where @var{num} and
  12017. @var{den} are the numerator and denominator of the aspect ratio. If
  12018. the parameter is not specified, it is assumed the value "0".
  12019. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  12020. should be escaped.
  12021. @item max
  12022. Set the maximum integer value to use for expressing numerator and
  12023. denominator when reducing the expressed aspect ratio to a rational.
  12024. Default value is @code{100}.
  12025. @end table
  12026. The parameter @var{sar} is an expression containing
  12027. the following constants:
  12028. @table @option
  12029. @item E, PI, PHI
  12030. These are approximated values for the mathematical constants e
  12031. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  12032. @item w, h
  12033. The input width and height.
  12034. @item a
  12035. These are the same as @var{w} / @var{h}.
  12036. @item sar
  12037. The input sample aspect ratio.
  12038. @item dar
  12039. The input display aspect ratio. It is the same as
  12040. (@var{w} / @var{h}) * @var{sar}.
  12041. @item hsub, vsub
  12042. Horizontal and vertical chroma subsample values. For example, for the
  12043. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12044. @end table
  12045. @subsection Examples
  12046. @itemize
  12047. @item
  12048. To change the display aspect ratio to 16:9, specify one of the following:
  12049. @example
  12050. setdar=dar=1.77777
  12051. setdar=dar=16/9
  12052. @end example
  12053. @item
  12054. To change the sample aspect ratio to 10:11, specify:
  12055. @example
  12056. setsar=sar=10/11
  12057. @end example
  12058. @item
  12059. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  12060. 1000 in the aspect ratio reduction, use the command:
  12061. @example
  12062. setdar=ratio=16/9:max=1000
  12063. @end example
  12064. @end itemize
  12065. @anchor{setfield}
  12066. @section setfield
  12067. Force field for the output video frame.
  12068. The @code{setfield} filter marks the interlace type field for the
  12069. output frames. It does not change the input frame, but only sets the
  12070. corresponding property, which affects how the frame is treated by
  12071. following filters (e.g. @code{fieldorder} or @code{yadif}).
  12072. The filter accepts the following options:
  12073. @table @option
  12074. @item mode
  12075. Available values are:
  12076. @table @samp
  12077. @item auto
  12078. Keep the same field property.
  12079. @item bff
  12080. Mark the frame as bottom-field-first.
  12081. @item tff
  12082. Mark the frame as top-field-first.
  12083. @item prog
  12084. Mark the frame as progressive.
  12085. @end table
  12086. @end table
  12087. @anchor{setparams}
  12088. @section setparams
  12089. Force frame parameter for the output video frame.
  12090. The @code{setparams} filter marks interlace and color range for the
  12091. output frames. It does not change the input frame, but only sets the
  12092. corresponding property, which affects how the frame is treated by
  12093. filters/encoders.
  12094. @table @option
  12095. @item field_mode
  12096. Available values are:
  12097. @table @samp
  12098. @item auto
  12099. Keep the same field property (default).
  12100. @item bff
  12101. Mark the frame as bottom-field-first.
  12102. @item tff
  12103. Mark the frame as top-field-first.
  12104. @item prog
  12105. Mark the frame as progressive.
  12106. @end table
  12107. @item range
  12108. Available values are:
  12109. @table @samp
  12110. @item auto
  12111. Keep the same color range property (default).
  12112. @item unspecified, unknown
  12113. Mark the frame as unspecified color range.
  12114. @item limited, tv, mpeg
  12115. Mark the frame as limited range.
  12116. @item full, pc, jpeg
  12117. Mark the frame as full range.
  12118. @end table
  12119. @item color_primaries
  12120. Set the color primaries.
  12121. Available values are:
  12122. @table @samp
  12123. @item auto
  12124. Keep the same color primaries property (default).
  12125. @item bt709
  12126. @item unknown
  12127. @item bt470m
  12128. @item bt470bg
  12129. @item smpte170m
  12130. @item smpte240m
  12131. @item film
  12132. @item bt2020
  12133. @item smpte428
  12134. @item smpte431
  12135. @item smpte432
  12136. @item jedec-p22
  12137. @end table
  12138. @item color_trc
  12139. Set the color transfer.
  12140. Available values are:
  12141. @table @samp
  12142. @item auto
  12143. Keep the same color trc property (default).
  12144. @item bt709
  12145. @item unknown
  12146. @item bt470m
  12147. @item bt470bg
  12148. @item smpte170m
  12149. @item smpte240m
  12150. @item linear
  12151. @item log100
  12152. @item log316
  12153. @item iec61966-2-4
  12154. @item bt1361e
  12155. @item iec61966-2-1
  12156. @item bt2020-10
  12157. @item bt2020-12
  12158. @item smpte2084
  12159. @item smpte428
  12160. @item arib-std-b67
  12161. @end table
  12162. @item colorspace
  12163. Set the colorspace.
  12164. Available values are:
  12165. @table @samp
  12166. @item auto
  12167. Keep the same colorspace property (default).
  12168. @item gbr
  12169. @item bt709
  12170. @item unknown
  12171. @item fcc
  12172. @item bt470bg
  12173. @item smpte170m
  12174. @item smpte240m
  12175. @item ycgco
  12176. @item bt2020nc
  12177. @item bt2020c
  12178. @item smpte2085
  12179. @item chroma-derived-nc
  12180. @item chroma-derived-c
  12181. @item ictcp
  12182. @end table
  12183. @end table
  12184. @section showinfo
  12185. Show a line containing various information for each input video frame.
  12186. The input video is not modified.
  12187. This filter supports the following options:
  12188. @table @option
  12189. @item checksum
  12190. Calculate checksums of each plane. By default enabled.
  12191. @end table
  12192. The shown line contains a sequence of key/value pairs of the form
  12193. @var{key}:@var{value}.
  12194. The following values are shown in the output:
  12195. @table @option
  12196. @item n
  12197. The (sequential) number of the input frame, starting from 0.
  12198. @item pts
  12199. The Presentation TimeStamp of the input frame, expressed as a number of
  12200. time base units. The time base unit depends on the filter input pad.
  12201. @item pts_time
  12202. The Presentation TimeStamp of the input frame, expressed as a number of
  12203. seconds.
  12204. @item pos
  12205. The position of the frame in the input stream, or -1 if this information is
  12206. unavailable and/or meaningless (for example in case of synthetic video).
  12207. @item fmt
  12208. The pixel format name.
  12209. @item sar
  12210. The sample aspect ratio of the input frame, expressed in the form
  12211. @var{num}/@var{den}.
  12212. @item s
  12213. The size of the input frame. For the syntax of this option, check the
  12214. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12215. @item i
  12216. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  12217. for bottom field first).
  12218. @item iskey
  12219. This is 1 if the frame is a key frame, 0 otherwise.
  12220. @item type
  12221. The picture type of the input frame ("I" for an I-frame, "P" for a
  12222. P-frame, "B" for a B-frame, or "?" for an unknown type).
  12223. Also refer to the documentation of the @code{AVPictureType} enum and of
  12224. the @code{av_get_picture_type_char} function defined in
  12225. @file{libavutil/avutil.h}.
  12226. @item checksum
  12227. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  12228. @item plane_checksum
  12229. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  12230. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  12231. @end table
  12232. @section showpalette
  12233. Displays the 256 colors palette of each frame. This filter is only relevant for
  12234. @var{pal8} pixel format frames.
  12235. It accepts the following option:
  12236. @table @option
  12237. @item s
  12238. Set the size of the box used to represent one palette color entry. Default is
  12239. @code{30} (for a @code{30x30} pixel box).
  12240. @end table
  12241. @section shuffleframes
  12242. Reorder and/or duplicate and/or drop video frames.
  12243. It accepts the following parameters:
  12244. @table @option
  12245. @item mapping
  12246. Set the destination indexes of input frames.
  12247. This is space or '|' separated list of indexes that maps input frames to output
  12248. frames. Number of indexes also sets maximal value that each index may have.
  12249. '-1' index have special meaning and that is to drop frame.
  12250. @end table
  12251. The first frame has the index 0. The default is to keep the input unchanged.
  12252. @subsection Examples
  12253. @itemize
  12254. @item
  12255. Swap second and third frame of every three frames of the input:
  12256. @example
  12257. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  12258. @end example
  12259. @item
  12260. Swap 10th and 1st frame of every ten frames of the input:
  12261. @example
  12262. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  12263. @end example
  12264. @end itemize
  12265. @section shuffleplanes
  12266. Reorder and/or duplicate video planes.
  12267. It accepts the following parameters:
  12268. @table @option
  12269. @item map0
  12270. The index of the input plane to be used as the first output plane.
  12271. @item map1
  12272. The index of the input plane to be used as the second output plane.
  12273. @item map2
  12274. The index of the input plane to be used as the third output plane.
  12275. @item map3
  12276. The index of the input plane to be used as the fourth output plane.
  12277. @end table
  12278. The first plane has the index 0. The default is to keep the input unchanged.
  12279. @subsection Examples
  12280. @itemize
  12281. @item
  12282. Swap the second and third planes of the input:
  12283. @example
  12284. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  12285. @end example
  12286. @end itemize
  12287. @anchor{signalstats}
  12288. @section signalstats
  12289. Evaluate various visual metrics that assist in determining issues associated
  12290. with the digitization of analog video media.
  12291. By default the filter will log these metadata values:
  12292. @table @option
  12293. @item YMIN
  12294. Display the minimal Y value contained within the input frame. Expressed in
  12295. range of [0-255].
  12296. @item YLOW
  12297. Display the Y value at the 10% percentile within the input frame. Expressed in
  12298. range of [0-255].
  12299. @item YAVG
  12300. Display the average Y value within the input frame. Expressed in range of
  12301. [0-255].
  12302. @item YHIGH
  12303. Display the Y value at the 90% percentile within the input frame. Expressed in
  12304. range of [0-255].
  12305. @item YMAX
  12306. Display the maximum Y value contained within the input frame. Expressed in
  12307. range of [0-255].
  12308. @item UMIN
  12309. Display the minimal U value contained within the input frame. Expressed in
  12310. range of [0-255].
  12311. @item ULOW
  12312. Display the U value at the 10% percentile within the input frame. Expressed in
  12313. range of [0-255].
  12314. @item UAVG
  12315. Display the average U value within the input frame. Expressed in range of
  12316. [0-255].
  12317. @item UHIGH
  12318. Display the U value at the 90% percentile within the input frame. Expressed in
  12319. range of [0-255].
  12320. @item UMAX
  12321. Display the maximum U value contained within the input frame. Expressed in
  12322. range of [0-255].
  12323. @item VMIN
  12324. Display the minimal V value contained within the input frame. Expressed in
  12325. range of [0-255].
  12326. @item VLOW
  12327. Display the V value at the 10% percentile within the input frame. Expressed in
  12328. range of [0-255].
  12329. @item VAVG
  12330. Display the average V value within the input frame. Expressed in range of
  12331. [0-255].
  12332. @item VHIGH
  12333. Display the V value at the 90% percentile within the input frame. Expressed in
  12334. range of [0-255].
  12335. @item VMAX
  12336. Display the maximum V value contained within the input frame. Expressed in
  12337. range of [0-255].
  12338. @item SATMIN
  12339. Display the minimal saturation value contained within the input frame.
  12340. Expressed in range of [0-~181.02].
  12341. @item SATLOW
  12342. Display the saturation value at the 10% percentile within the input frame.
  12343. Expressed in range of [0-~181.02].
  12344. @item SATAVG
  12345. Display the average saturation value within the input frame. Expressed in range
  12346. of [0-~181.02].
  12347. @item SATHIGH
  12348. Display the saturation value at the 90% percentile within the input frame.
  12349. Expressed in range of [0-~181.02].
  12350. @item SATMAX
  12351. Display the maximum saturation value contained within the input frame.
  12352. Expressed in range of [0-~181.02].
  12353. @item HUEMED
  12354. Display the median value for hue within the input frame. Expressed in range of
  12355. [0-360].
  12356. @item HUEAVG
  12357. Display the average value for hue within the input frame. Expressed in range of
  12358. [0-360].
  12359. @item YDIF
  12360. Display the average of sample value difference between all values of the Y
  12361. plane in the current frame and corresponding values of the previous input frame.
  12362. Expressed in range of [0-255].
  12363. @item UDIF
  12364. Display the average of sample value difference between all values of the U
  12365. plane in the current frame and corresponding values of the previous input frame.
  12366. Expressed in range of [0-255].
  12367. @item VDIF
  12368. Display the average of sample value difference between all values of the V
  12369. plane in the current frame and corresponding values of the previous input frame.
  12370. Expressed in range of [0-255].
  12371. @item YBITDEPTH
  12372. Display bit depth of Y plane in current frame.
  12373. Expressed in range of [0-16].
  12374. @item UBITDEPTH
  12375. Display bit depth of U plane in current frame.
  12376. Expressed in range of [0-16].
  12377. @item VBITDEPTH
  12378. Display bit depth of V plane in current frame.
  12379. Expressed in range of [0-16].
  12380. @end table
  12381. The filter accepts the following options:
  12382. @table @option
  12383. @item stat
  12384. @item out
  12385. @option{stat} specify an additional form of image analysis.
  12386. @option{out} output video with the specified type of pixel highlighted.
  12387. Both options accept the following values:
  12388. @table @samp
  12389. @item tout
  12390. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  12391. unlike the neighboring pixels of the same field. Examples of temporal outliers
  12392. include the results of video dropouts, head clogs, or tape tracking issues.
  12393. @item vrep
  12394. Identify @var{vertical line repetition}. Vertical line repetition includes
  12395. similar rows of pixels within a frame. In born-digital video vertical line
  12396. repetition is common, but this pattern is uncommon in video digitized from an
  12397. analog source. When it occurs in video that results from the digitization of an
  12398. analog source it can indicate concealment from a dropout compensator.
  12399. @item brng
  12400. Identify pixels that fall outside of legal broadcast range.
  12401. @end table
  12402. @item color, c
  12403. Set the highlight color for the @option{out} option. The default color is
  12404. yellow.
  12405. @end table
  12406. @subsection Examples
  12407. @itemize
  12408. @item
  12409. Output data of various video metrics:
  12410. @example
  12411. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  12412. @end example
  12413. @item
  12414. Output specific data about the minimum and maximum values of the Y plane per frame:
  12415. @example
  12416. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  12417. @end example
  12418. @item
  12419. Playback video while highlighting pixels that are outside of broadcast range in red.
  12420. @example
  12421. ffplay example.mov -vf signalstats="out=brng:color=red"
  12422. @end example
  12423. @item
  12424. Playback video with signalstats metadata drawn over the frame.
  12425. @example
  12426. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  12427. @end example
  12428. The contents of signalstat_drawtext.txt used in the command are:
  12429. @example
  12430. time %@{pts:hms@}
  12431. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  12432. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  12433. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  12434. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  12435. @end example
  12436. @end itemize
  12437. @anchor{signature}
  12438. @section signature
  12439. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  12440. input. In this case the matching between the inputs can be calculated additionally.
  12441. The filter always passes through the first input. The signature of each stream can
  12442. be written into a file.
  12443. It accepts the following options:
  12444. @table @option
  12445. @item detectmode
  12446. Enable or disable the matching process.
  12447. Available values are:
  12448. @table @samp
  12449. @item off
  12450. Disable the calculation of a matching (default).
  12451. @item full
  12452. Calculate the matching for the whole video and output whether the whole video
  12453. matches or only parts.
  12454. @item fast
  12455. Calculate only until a matching is found or the video ends. Should be faster in
  12456. some cases.
  12457. @end table
  12458. @item nb_inputs
  12459. Set the number of inputs. The option value must be a non negative integer.
  12460. Default value is 1.
  12461. @item filename
  12462. Set the path to which the output is written. If there is more than one input,
  12463. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  12464. integer), that will be replaced with the input number. If no filename is
  12465. specified, no output will be written. This is the default.
  12466. @item format
  12467. Choose the output format.
  12468. Available values are:
  12469. @table @samp
  12470. @item binary
  12471. Use the specified binary representation (default).
  12472. @item xml
  12473. Use the specified xml representation.
  12474. @end table
  12475. @item th_d
  12476. Set threshold to detect one word as similar. The option value must be an integer
  12477. greater than zero. The default value is 9000.
  12478. @item th_dc
  12479. Set threshold to detect all words as similar. The option value must be an integer
  12480. greater than zero. The default value is 60000.
  12481. @item th_xh
  12482. Set threshold to detect frames as similar. The option value must be an integer
  12483. greater than zero. The default value is 116.
  12484. @item th_di
  12485. Set the minimum length of a sequence in frames to recognize it as matching
  12486. sequence. The option value must be a non negative integer value.
  12487. The default value is 0.
  12488. @item th_it
  12489. Set the minimum relation, that matching frames to all frames must have.
  12490. The option value must be a double value between 0 and 1. The default value is 0.5.
  12491. @end table
  12492. @subsection Examples
  12493. @itemize
  12494. @item
  12495. To calculate the signature of an input video and store it in signature.bin:
  12496. @example
  12497. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  12498. @end example
  12499. @item
  12500. To detect whether two videos match and store the signatures in XML format in
  12501. signature0.xml and signature1.xml:
  12502. @example
  12503. 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 -
  12504. @end example
  12505. @end itemize
  12506. @anchor{smartblur}
  12507. @section smartblur
  12508. Blur the input video without impacting the outlines.
  12509. It accepts the following options:
  12510. @table @option
  12511. @item luma_radius, lr
  12512. Set the luma radius. The option value must be a float number in
  12513. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12514. used to blur the image (slower if larger). Default value is 1.0.
  12515. @item luma_strength, ls
  12516. Set the luma strength. The option value must be a float number
  12517. in the range [-1.0,1.0] that configures the blurring. A value included
  12518. in [0.0,1.0] will blur the image whereas a value included in
  12519. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  12520. @item luma_threshold, lt
  12521. Set the luma threshold used as a coefficient to determine
  12522. whether a pixel should be blurred or not. The option value must be an
  12523. integer in the range [-30,30]. A value of 0 will filter all the image,
  12524. a value included in [0,30] will filter flat areas and a value included
  12525. in [-30,0] will filter edges. Default value is 0.
  12526. @item chroma_radius, cr
  12527. Set the chroma radius. The option value must be a float number in
  12528. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12529. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  12530. @item chroma_strength, cs
  12531. Set the chroma strength. The option value must be a float number
  12532. in the range [-1.0,1.0] that configures the blurring. A value included
  12533. in [0.0,1.0] will blur the image whereas a value included in
  12534. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  12535. @item chroma_threshold, ct
  12536. Set the chroma threshold used as a coefficient to determine
  12537. whether a pixel should be blurred or not. The option value must be an
  12538. integer in the range [-30,30]. A value of 0 will filter all the image,
  12539. a value included in [0,30] will filter flat areas and a value included
  12540. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  12541. @end table
  12542. If a chroma option is not explicitly set, the corresponding luma value
  12543. is set.
  12544. @section ssim
  12545. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  12546. This filter takes in input two input videos, the first input is
  12547. considered the "main" source and is passed unchanged to the
  12548. output. The second input is used as a "reference" video for computing
  12549. the SSIM.
  12550. Both video inputs must have the same resolution and pixel format for
  12551. this filter to work correctly. Also it assumes that both inputs
  12552. have the same number of frames, which are compared one by one.
  12553. The filter stores the calculated SSIM of each frame.
  12554. The description of the accepted parameters follows.
  12555. @table @option
  12556. @item stats_file, f
  12557. If specified the filter will use the named file to save the SSIM of
  12558. each individual frame. When filename equals "-" the data is sent to
  12559. standard output.
  12560. @end table
  12561. The file printed if @var{stats_file} is selected, contains a sequence of
  12562. key/value pairs of the form @var{key}:@var{value} for each compared
  12563. couple of frames.
  12564. A description of each shown parameter follows:
  12565. @table @option
  12566. @item n
  12567. sequential number of the input frame, starting from 1
  12568. @item Y, U, V, R, G, B
  12569. SSIM of the compared frames for the component specified by the suffix.
  12570. @item All
  12571. SSIM of the compared frames for the whole frame.
  12572. @item dB
  12573. Same as above but in dB representation.
  12574. @end table
  12575. This filter also supports the @ref{framesync} options.
  12576. For example:
  12577. @example
  12578. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12579. [main][ref] ssim="stats_file=stats.log" [out]
  12580. @end example
  12581. On this example the input file being processed is compared with the
  12582. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  12583. is stored in @file{stats.log}.
  12584. Another example with both psnr and ssim at same time:
  12585. @example
  12586. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  12587. @end example
  12588. @section stereo3d
  12589. Convert between different stereoscopic image formats.
  12590. The filters accept the following options:
  12591. @table @option
  12592. @item in
  12593. Set stereoscopic image format of input.
  12594. Available values for input image formats are:
  12595. @table @samp
  12596. @item sbsl
  12597. side by side parallel (left eye left, right eye right)
  12598. @item sbsr
  12599. side by side crosseye (right eye left, left eye right)
  12600. @item sbs2l
  12601. side by side parallel with half width resolution
  12602. (left eye left, right eye right)
  12603. @item sbs2r
  12604. side by side crosseye with half width resolution
  12605. (right eye left, left eye right)
  12606. @item abl
  12607. above-below (left eye above, right eye below)
  12608. @item abr
  12609. above-below (right eye above, left eye below)
  12610. @item ab2l
  12611. above-below with half height resolution
  12612. (left eye above, right eye below)
  12613. @item ab2r
  12614. above-below with half height resolution
  12615. (right eye above, left eye below)
  12616. @item al
  12617. alternating frames (left eye first, right eye second)
  12618. @item ar
  12619. alternating frames (right eye first, left eye second)
  12620. @item irl
  12621. interleaved rows (left eye has top row, right eye starts on next row)
  12622. @item irr
  12623. interleaved rows (right eye has top row, left eye starts on next row)
  12624. @item icl
  12625. interleaved columns, left eye first
  12626. @item icr
  12627. interleaved columns, right eye first
  12628. Default value is @samp{sbsl}.
  12629. @end table
  12630. @item out
  12631. Set stereoscopic image format of output.
  12632. @table @samp
  12633. @item sbsl
  12634. side by side parallel (left eye left, right eye right)
  12635. @item sbsr
  12636. side by side crosseye (right eye left, left eye right)
  12637. @item sbs2l
  12638. side by side parallel with half width resolution
  12639. (left eye left, right eye right)
  12640. @item sbs2r
  12641. side by side crosseye with half width resolution
  12642. (right eye left, left eye right)
  12643. @item abl
  12644. above-below (left eye above, right eye below)
  12645. @item abr
  12646. above-below (right eye above, left eye below)
  12647. @item ab2l
  12648. above-below with half height resolution
  12649. (left eye above, right eye below)
  12650. @item ab2r
  12651. above-below with half height resolution
  12652. (right eye above, left eye below)
  12653. @item al
  12654. alternating frames (left eye first, right eye second)
  12655. @item ar
  12656. alternating frames (right eye first, left eye second)
  12657. @item irl
  12658. interleaved rows (left eye has top row, right eye starts on next row)
  12659. @item irr
  12660. interleaved rows (right eye has top row, left eye starts on next row)
  12661. @item arbg
  12662. anaglyph red/blue gray
  12663. (red filter on left eye, blue filter on right eye)
  12664. @item argg
  12665. anaglyph red/green gray
  12666. (red filter on left eye, green filter on right eye)
  12667. @item arcg
  12668. anaglyph red/cyan gray
  12669. (red filter on left eye, cyan filter on right eye)
  12670. @item arch
  12671. anaglyph red/cyan half colored
  12672. (red filter on left eye, cyan filter on right eye)
  12673. @item arcc
  12674. anaglyph red/cyan color
  12675. (red filter on left eye, cyan filter on right eye)
  12676. @item arcd
  12677. anaglyph red/cyan color optimized with the least squares projection of dubois
  12678. (red filter on left eye, cyan filter on right eye)
  12679. @item agmg
  12680. anaglyph green/magenta gray
  12681. (green filter on left eye, magenta filter on right eye)
  12682. @item agmh
  12683. anaglyph green/magenta half colored
  12684. (green filter on left eye, magenta filter on right eye)
  12685. @item agmc
  12686. anaglyph green/magenta colored
  12687. (green filter on left eye, magenta filter on right eye)
  12688. @item agmd
  12689. anaglyph green/magenta color optimized with the least squares projection of dubois
  12690. (green filter on left eye, magenta filter on right eye)
  12691. @item aybg
  12692. anaglyph yellow/blue gray
  12693. (yellow filter on left eye, blue filter on right eye)
  12694. @item aybh
  12695. anaglyph yellow/blue half colored
  12696. (yellow filter on left eye, blue filter on right eye)
  12697. @item aybc
  12698. anaglyph yellow/blue colored
  12699. (yellow filter on left eye, blue filter on right eye)
  12700. @item aybd
  12701. anaglyph yellow/blue color optimized with the least squares projection of dubois
  12702. (yellow filter on left eye, blue filter on right eye)
  12703. @item ml
  12704. mono output (left eye only)
  12705. @item mr
  12706. mono output (right eye only)
  12707. @item chl
  12708. checkerboard, left eye first
  12709. @item chr
  12710. checkerboard, right eye first
  12711. @item icl
  12712. interleaved columns, left eye first
  12713. @item icr
  12714. interleaved columns, right eye first
  12715. @item hdmi
  12716. HDMI frame pack
  12717. @end table
  12718. Default value is @samp{arcd}.
  12719. @end table
  12720. @subsection Examples
  12721. @itemize
  12722. @item
  12723. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  12724. @example
  12725. stereo3d=sbsl:aybd
  12726. @end example
  12727. @item
  12728. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  12729. @example
  12730. stereo3d=abl:sbsr
  12731. @end example
  12732. @end itemize
  12733. @section streamselect, astreamselect
  12734. Select video or audio streams.
  12735. The filter accepts the following options:
  12736. @table @option
  12737. @item inputs
  12738. Set number of inputs. Default is 2.
  12739. @item map
  12740. Set input indexes to remap to outputs.
  12741. @end table
  12742. @subsection Commands
  12743. The @code{streamselect} and @code{astreamselect} filter supports the following
  12744. commands:
  12745. @table @option
  12746. @item map
  12747. Set input indexes to remap to outputs.
  12748. @end table
  12749. @subsection Examples
  12750. @itemize
  12751. @item
  12752. Select first 5 seconds 1st stream and rest of time 2nd stream:
  12753. @example
  12754. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  12755. @end example
  12756. @item
  12757. Same as above, but for audio:
  12758. @example
  12759. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  12760. @end example
  12761. @end itemize
  12762. @section sobel
  12763. Apply sobel operator to input video stream.
  12764. The filter accepts the following option:
  12765. @table @option
  12766. @item planes
  12767. Set which planes will be processed, unprocessed planes will be copied.
  12768. By default value 0xf, all planes will be processed.
  12769. @item scale
  12770. Set value which will be multiplied with filtered result.
  12771. @item delta
  12772. Set value which will be added to filtered result.
  12773. @end table
  12774. @anchor{spp}
  12775. @section spp
  12776. Apply a simple postprocessing filter that compresses and decompresses the image
  12777. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  12778. and average the results.
  12779. The filter accepts the following options:
  12780. @table @option
  12781. @item quality
  12782. Set quality. This option defines the number of levels for averaging. It accepts
  12783. an integer in the range 0-6. If set to @code{0}, the filter will have no
  12784. effect. A value of @code{6} means the higher quality. For each increment of
  12785. that value the speed drops by a factor of approximately 2. Default value is
  12786. @code{3}.
  12787. @item qp
  12788. Force a constant quantization parameter. If not set, the filter will use the QP
  12789. from the video stream (if available).
  12790. @item mode
  12791. Set thresholding mode. Available modes are:
  12792. @table @samp
  12793. @item hard
  12794. Set hard thresholding (default).
  12795. @item soft
  12796. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12797. @end table
  12798. @item use_bframe_qp
  12799. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  12800. option may cause flicker since the B-Frames have often larger QP. Default is
  12801. @code{0} (not enabled).
  12802. @end table
  12803. @section sr
  12804. Scale the input by applying one of the super-resolution methods based on
  12805. convolutional neural networks. Supported models:
  12806. @itemize
  12807. @item
  12808. Super-Resolution Convolutional Neural Network model (SRCNN).
  12809. See @url{https://arxiv.org/abs/1501.00092}.
  12810. @item
  12811. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  12812. See @url{https://arxiv.org/abs/1609.05158}.
  12813. @end itemize
  12814. Training scripts as well as scripts for model file (.pb) saving can be found at
  12815. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  12816. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  12817. Native model files (.model) can be generated from TensorFlow model
  12818. files (.pb) by using tools/python/convert.py
  12819. The filter accepts the following options:
  12820. @table @option
  12821. @item dnn_backend
  12822. Specify which DNN backend to use for model loading and execution. This option accepts
  12823. the following values:
  12824. @table @samp
  12825. @item native
  12826. Native implementation of DNN loading and execution.
  12827. @item tensorflow
  12828. TensorFlow backend. To enable this backend you
  12829. need to install the TensorFlow for C library (see
  12830. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  12831. @code{--enable-libtensorflow}
  12832. @end table
  12833. Default value is @samp{native}.
  12834. @item model
  12835. Set path to model file specifying network architecture and its parameters.
  12836. Note that different backends use different file formats. TensorFlow backend
  12837. can load files for both formats, while native backend can load files for only
  12838. its format.
  12839. @item scale_factor
  12840. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  12841. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  12842. input upscaled using bicubic upscaling with proper scale factor.
  12843. @end table
  12844. @anchor{subtitles}
  12845. @section subtitles
  12846. Draw subtitles on top of input video using the libass library.
  12847. To enable compilation of this filter you need to configure FFmpeg with
  12848. @code{--enable-libass}. This filter also requires a build with libavcodec and
  12849. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  12850. Alpha) subtitles format.
  12851. The filter accepts the following options:
  12852. @table @option
  12853. @item filename, f
  12854. Set the filename of the subtitle file to read. It must be specified.
  12855. @item original_size
  12856. Specify the size of the original video, the video for which the ASS file
  12857. was composed. For the syntax of this option, check the
  12858. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12859. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  12860. correctly scale the fonts if the aspect ratio has been changed.
  12861. @item fontsdir
  12862. Set a directory path containing fonts that can be used by the filter.
  12863. These fonts will be used in addition to whatever the font provider uses.
  12864. @item alpha
  12865. Process alpha channel, by default alpha channel is untouched.
  12866. @item charenc
  12867. Set subtitles input character encoding. @code{subtitles} filter only. Only
  12868. useful if not UTF-8.
  12869. @item stream_index, si
  12870. Set subtitles stream index. @code{subtitles} filter only.
  12871. @item force_style
  12872. Override default style or script info parameters of the subtitles. It accepts a
  12873. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  12874. @end table
  12875. If the first key is not specified, it is assumed that the first value
  12876. specifies the @option{filename}.
  12877. For example, to render the file @file{sub.srt} on top of the input
  12878. video, use the command:
  12879. @example
  12880. subtitles=sub.srt
  12881. @end example
  12882. which is equivalent to:
  12883. @example
  12884. subtitles=filename=sub.srt
  12885. @end example
  12886. To render the default subtitles stream from file @file{video.mkv}, use:
  12887. @example
  12888. subtitles=video.mkv
  12889. @end example
  12890. To render the second subtitles stream from that file, use:
  12891. @example
  12892. subtitles=video.mkv:si=1
  12893. @end example
  12894. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  12895. @code{DejaVu Serif}, use:
  12896. @example
  12897. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  12898. @end example
  12899. @section super2xsai
  12900. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  12901. Interpolate) pixel art scaling algorithm.
  12902. Useful for enlarging pixel art images without reducing sharpness.
  12903. @section swaprect
  12904. Swap two rectangular objects in video.
  12905. This filter accepts the following options:
  12906. @table @option
  12907. @item w
  12908. Set object width.
  12909. @item h
  12910. Set object height.
  12911. @item x1
  12912. Set 1st rect x coordinate.
  12913. @item y1
  12914. Set 1st rect y coordinate.
  12915. @item x2
  12916. Set 2nd rect x coordinate.
  12917. @item y2
  12918. Set 2nd rect y coordinate.
  12919. All expressions are evaluated once for each frame.
  12920. @end table
  12921. The all options are expressions containing the following constants:
  12922. @table @option
  12923. @item w
  12924. @item h
  12925. The input width and height.
  12926. @item a
  12927. same as @var{w} / @var{h}
  12928. @item sar
  12929. input sample aspect ratio
  12930. @item dar
  12931. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  12932. @item n
  12933. The number of the input frame, starting from 0.
  12934. @item t
  12935. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  12936. @item pos
  12937. the position in the file of the input frame, NAN if unknown
  12938. @end table
  12939. @section swapuv
  12940. Swap U & V plane.
  12941. @section telecine
  12942. Apply telecine process to the video.
  12943. This filter accepts the following options:
  12944. @table @option
  12945. @item first_field
  12946. @table @samp
  12947. @item top, t
  12948. top field first
  12949. @item bottom, b
  12950. bottom field first
  12951. The default value is @code{top}.
  12952. @end table
  12953. @item pattern
  12954. A string of numbers representing the pulldown pattern you wish to apply.
  12955. The default value is @code{23}.
  12956. @end table
  12957. @example
  12958. Some typical patterns:
  12959. NTSC output (30i):
  12960. 27.5p: 32222
  12961. 24p: 23 (classic)
  12962. 24p: 2332 (preferred)
  12963. 20p: 33
  12964. 18p: 334
  12965. 16p: 3444
  12966. PAL output (25i):
  12967. 27.5p: 12222
  12968. 24p: 222222222223 ("Euro pulldown")
  12969. 16.67p: 33
  12970. 16p: 33333334
  12971. @end example
  12972. @section threshold
  12973. Apply threshold effect to video stream.
  12974. This filter needs four video streams to perform thresholding.
  12975. First stream is stream we are filtering.
  12976. Second stream is holding threshold values, third stream is holding min values,
  12977. and last, fourth stream is holding max values.
  12978. The filter accepts the following option:
  12979. @table @option
  12980. @item planes
  12981. Set which planes will be processed, unprocessed planes will be copied.
  12982. By default value 0xf, all planes will be processed.
  12983. @end table
  12984. For example if first stream pixel's component value is less then threshold value
  12985. of pixel component from 2nd threshold stream, third stream value will picked,
  12986. otherwise fourth stream pixel component value will be picked.
  12987. Using color source filter one can perform various types of thresholding:
  12988. @subsection Examples
  12989. @itemize
  12990. @item
  12991. Binary threshold, using gray color as threshold:
  12992. @example
  12993. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  12994. @end example
  12995. @item
  12996. Inverted binary threshold, using gray color as threshold:
  12997. @example
  12998. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  12999. @end example
  13000. @item
  13001. Truncate binary threshold, using gray color as threshold:
  13002. @example
  13003. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  13004. @end example
  13005. @item
  13006. Threshold to zero, using gray color as threshold:
  13007. @example
  13008. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  13009. @end example
  13010. @item
  13011. Inverted threshold to zero, using gray color as threshold:
  13012. @example
  13013. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  13014. @end example
  13015. @end itemize
  13016. @section thumbnail
  13017. Select the most representative frame in a given sequence of consecutive frames.
  13018. The filter accepts the following options:
  13019. @table @option
  13020. @item n
  13021. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  13022. will pick one of them, and then handle the next batch of @var{n} frames until
  13023. the end. Default is @code{100}.
  13024. @end table
  13025. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  13026. value will result in a higher memory usage, so a high value is not recommended.
  13027. @subsection Examples
  13028. @itemize
  13029. @item
  13030. Extract one picture each 50 frames:
  13031. @example
  13032. thumbnail=50
  13033. @end example
  13034. @item
  13035. Complete example of a thumbnail creation with @command{ffmpeg}:
  13036. @example
  13037. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  13038. @end example
  13039. @end itemize
  13040. @section tile
  13041. Tile several successive frames together.
  13042. The filter accepts the following options:
  13043. @table @option
  13044. @item layout
  13045. Set the grid size (i.e. the number of lines and columns). For the syntax of
  13046. this option, check the
  13047. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13048. @item nb_frames
  13049. Set the maximum number of frames to render in the given area. It must be less
  13050. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  13051. the area will be used.
  13052. @item margin
  13053. Set the outer border margin in pixels.
  13054. @item padding
  13055. Set the inner border thickness (i.e. the number of pixels between frames). For
  13056. more advanced padding options (such as having different values for the edges),
  13057. refer to the pad video filter.
  13058. @item color
  13059. Specify the color of the unused area. For the syntax of this option, check the
  13060. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13061. The default value of @var{color} is "black".
  13062. @item overlap
  13063. Set the number of frames to overlap when tiling several successive frames together.
  13064. The value must be between @code{0} and @var{nb_frames - 1}.
  13065. @item init_padding
  13066. Set the number of frames to initially be empty before displaying first output frame.
  13067. This controls how soon will one get first output frame.
  13068. The value must be between @code{0} and @var{nb_frames - 1}.
  13069. @end table
  13070. @subsection Examples
  13071. @itemize
  13072. @item
  13073. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  13074. @example
  13075. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  13076. @end example
  13077. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  13078. duplicating each output frame to accommodate the originally detected frame
  13079. rate.
  13080. @item
  13081. Display @code{5} pictures in an area of @code{3x2} frames,
  13082. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  13083. mixed flat and named options:
  13084. @example
  13085. tile=3x2:nb_frames=5:padding=7:margin=2
  13086. @end example
  13087. @end itemize
  13088. @section tinterlace
  13089. Perform various types of temporal field interlacing.
  13090. Frames are counted starting from 1, so the first input frame is
  13091. considered odd.
  13092. The filter accepts the following options:
  13093. @table @option
  13094. @item mode
  13095. Specify the mode of the interlacing. This option can also be specified
  13096. as a value alone. See below for a list of values for this option.
  13097. Available values are:
  13098. @table @samp
  13099. @item merge, 0
  13100. Move odd frames into the upper field, even into the lower field,
  13101. generating a double height frame at half frame rate.
  13102. @example
  13103. ------> time
  13104. Input:
  13105. Frame 1 Frame 2 Frame 3 Frame 4
  13106. 11111 22222 33333 44444
  13107. 11111 22222 33333 44444
  13108. 11111 22222 33333 44444
  13109. 11111 22222 33333 44444
  13110. Output:
  13111. 11111 33333
  13112. 22222 44444
  13113. 11111 33333
  13114. 22222 44444
  13115. 11111 33333
  13116. 22222 44444
  13117. 11111 33333
  13118. 22222 44444
  13119. @end example
  13120. @item drop_even, 1
  13121. Only output odd frames, even frames are dropped, generating a frame with
  13122. unchanged height at half frame rate.
  13123. @example
  13124. ------> time
  13125. Input:
  13126. Frame 1 Frame 2 Frame 3 Frame 4
  13127. 11111 22222 33333 44444
  13128. 11111 22222 33333 44444
  13129. 11111 22222 33333 44444
  13130. 11111 22222 33333 44444
  13131. Output:
  13132. 11111 33333
  13133. 11111 33333
  13134. 11111 33333
  13135. 11111 33333
  13136. @end example
  13137. @item drop_odd, 2
  13138. Only output even frames, odd frames are dropped, generating a frame with
  13139. unchanged height at half frame rate.
  13140. @example
  13141. ------> time
  13142. Input:
  13143. Frame 1 Frame 2 Frame 3 Frame 4
  13144. 11111 22222 33333 44444
  13145. 11111 22222 33333 44444
  13146. 11111 22222 33333 44444
  13147. 11111 22222 33333 44444
  13148. Output:
  13149. 22222 44444
  13150. 22222 44444
  13151. 22222 44444
  13152. 22222 44444
  13153. @end example
  13154. @item pad, 3
  13155. Expand each frame to full height, but pad alternate lines with black,
  13156. generating a frame with double height at the same input frame rate.
  13157. @example
  13158. ------> time
  13159. Input:
  13160. Frame 1 Frame 2 Frame 3 Frame 4
  13161. 11111 22222 33333 44444
  13162. 11111 22222 33333 44444
  13163. 11111 22222 33333 44444
  13164. 11111 22222 33333 44444
  13165. Output:
  13166. 11111 ..... 33333 .....
  13167. ..... 22222 ..... 44444
  13168. 11111 ..... 33333 .....
  13169. ..... 22222 ..... 44444
  13170. 11111 ..... 33333 .....
  13171. ..... 22222 ..... 44444
  13172. 11111 ..... 33333 .....
  13173. ..... 22222 ..... 44444
  13174. @end example
  13175. @item interleave_top, 4
  13176. Interleave the upper field from odd frames with the lower field from
  13177. even frames, generating a frame with unchanged height at half frame rate.
  13178. @example
  13179. ------> time
  13180. Input:
  13181. Frame 1 Frame 2 Frame 3 Frame 4
  13182. 11111<- 22222 33333<- 44444
  13183. 11111 22222<- 33333 44444<-
  13184. 11111<- 22222 33333<- 44444
  13185. 11111 22222<- 33333 44444<-
  13186. Output:
  13187. 11111 33333
  13188. 22222 44444
  13189. 11111 33333
  13190. 22222 44444
  13191. @end example
  13192. @item interleave_bottom, 5
  13193. Interleave the lower field from odd frames with the upper field from
  13194. even frames, generating a frame with unchanged height at half frame rate.
  13195. @example
  13196. ------> time
  13197. Input:
  13198. Frame 1 Frame 2 Frame 3 Frame 4
  13199. 11111 22222<- 33333 44444<-
  13200. 11111<- 22222 33333<- 44444
  13201. 11111 22222<- 33333 44444<-
  13202. 11111<- 22222 33333<- 44444
  13203. Output:
  13204. 22222 44444
  13205. 11111 33333
  13206. 22222 44444
  13207. 11111 33333
  13208. @end example
  13209. @item interlacex2, 6
  13210. Double frame rate with unchanged height. Frames are inserted each
  13211. containing the second temporal field from the previous input frame and
  13212. the first temporal field from the next input frame. This mode relies on
  13213. the top_field_first flag. Useful for interlaced video displays with no
  13214. field synchronisation.
  13215. @example
  13216. ------> time
  13217. Input:
  13218. Frame 1 Frame 2 Frame 3 Frame 4
  13219. 11111 22222 33333 44444
  13220. 11111 22222 33333 44444
  13221. 11111 22222 33333 44444
  13222. 11111 22222 33333 44444
  13223. Output:
  13224. 11111 22222 22222 33333 33333 44444 44444
  13225. 11111 11111 22222 22222 33333 33333 44444
  13226. 11111 22222 22222 33333 33333 44444 44444
  13227. 11111 11111 22222 22222 33333 33333 44444
  13228. @end example
  13229. @item mergex2, 7
  13230. Move odd frames into the upper field, even into the lower field,
  13231. generating a double height frame at same frame rate.
  13232. @example
  13233. ------> time
  13234. Input:
  13235. Frame 1 Frame 2 Frame 3 Frame 4
  13236. 11111 22222 33333 44444
  13237. 11111 22222 33333 44444
  13238. 11111 22222 33333 44444
  13239. 11111 22222 33333 44444
  13240. Output:
  13241. 11111 33333 33333 55555
  13242. 22222 22222 44444 44444
  13243. 11111 33333 33333 55555
  13244. 22222 22222 44444 44444
  13245. 11111 33333 33333 55555
  13246. 22222 22222 44444 44444
  13247. 11111 33333 33333 55555
  13248. 22222 22222 44444 44444
  13249. @end example
  13250. @end table
  13251. Numeric values are deprecated but are accepted for backward
  13252. compatibility reasons.
  13253. Default mode is @code{merge}.
  13254. @item flags
  13255. Specify flags influencing the filter process.
  13256. Available value for @var{flags} is:
  13257. @table @option
  13258. @item low_pass_filter, vlpf
  13259. Enable linear vertical low-pass filtering in the filter.
  13260. Vertical low-pass filtering is required when creating an interlaced
  13261. destination from a progressive source which contains high-frequency
  13262. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  13263. patterning.
  13264. @item complex_filter, cvlpf
  13265. Enable complex vertical low-pass filtering.
  13266. This will slightly less reduce interlace 'twitter' and Moire
  13267. patterning but better retain detail and subjective sharpness impression.
  13268. @end table
  13269. Vertical low-pass filtering can only be enabled for @option{mode}
  13270. @var{interleave_top} and @var{interleave_bottom}.
  13271. @end table
  13272. @section tmix
  13273. Mix successive video frames.
  13274. A description of the accepted options follows.
  13275. @table @option
  13276. @item frames
  13277. The number of successive frames to mix. If unspecified, it defaults to 3.
  13278. @item weights
  13279. Specify weight of each input video frame.
  13280. Each weight is separated by space. If number of weights is smaller than
  13281. number of @var{frames} last specified weight will be used for all remaining
  13282. unset weights.
  13283. @item scale
  13284. Specify scale, if it is set it will be multiplied with sum
  13285. of each weight multiplied with pixel values to give final destination
  13286. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13287. @end table
  13288. @subsection Examples
  13289. @itemize
  13290. @item
  13291. Average 7 successive frames:
  13292. @example
  13293. tmix=frames=7:weights="1 1 1 1 1 1 1"
  13294. @end example
  13295. @item
  13296. Apply simple temporal convolution:
  13297. @example
  13298. tmix=frames=3:weights="-1 3 -1"
  13299. @end example
  13300. @item
  13301. Similar as above but only showing temporal differences:
  13302. @example
  13303. tmix=frames=3:weights="-1 2 -1":scale=1
  13304. @end example
  13305. @end itemize
  13306. @anchor{tonemap}
  13307. @section tonemap
  13308. Tone map colors from different dynamic ranges.
  13309. This filter expects data in single precision floating point, as it needs to
  13310. operate on (and can output) out-of-range values. Another filter, such as
  13311. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  13312. The tonemapping algorithms implemented only work on linear light, so input
  13313. data should be linearized beforehand (and possibly correctly tagged).
  13314. @example
  13315. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  13316. @end example
  13317. @subsection Options
  13318. The filter accepts the following options.
  13319. @table @option
  13320. @item tonemap
  13321. Set the tone map algorithm to use.
  13322. Possible values are:
  13323. @table @var
  13324. @item none
  13325. Do not apply any tone map, only desaturate overbright pixels.
  13326. @item clip
  13327. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  13328. in-range values, while distorting out-of-range values.
  13329. @item linear
  13330. Stretch the entire reference gamut to a linear multiple of the display.
  13331. @item gamma
  13332. Fit a logarithmic transfer between the tone curves.
  13333. @item reinhard
  13334. Preserve overall image brightness with a simple curve, using nonlinear
  13335. contrast, which results in flattening details and degrading color accuracy.
  13336. @item hable
  13337. Preserve both dark and bright details better than @var{reinhard}, at the cost
  13338. of slightly darkening everything. Use it when detail preservation is more
  13339. important than color and brightness accuracy.
  13340. @item mobius
  13341. Smoothly map out-of-range values, while retaining contrast and colors for
  13342. in-range material as much as possible. Use it when color accuracy is more
  13343. important than detail preservation.
  13344. @end table
  13345. Default is none.
  13346. @item param
  13347. Tune the tone mapping algorithm.
  13348. This affects the following algorithms:
  13349. @table @var
  13350. @item none
  13351. Ignored.
  13352. @item linear
  13353. Specifies the scale factor to use while stretching.
  13354. Default to 1.0.
  13355. @item gamma
  13356. Specifies the exponent of the function.
  13357. Default to 1.8.
  13358. @item clip
  13359. Specify an extra linear coefficient to multiply into the signal before clipping.
  13360. Default to 1.0.
  13361. @item reinhard
  13362. Specify the local contrast coefficient at the display peak.
  13363. Default to 0.5, which means that in-gamut values will be about half as bright
  13364. as when clipping.
  13365. @item hable
  13366. Ignored.
  13367. @item mobius
  13368. Specify the transition point from linear to mobius transform. Every value
  13369. below this point is guaranteed to be mapped 1:1. The higher the value, the
  13370. more accurate the result will be, at the cost of losing bright details.
  13371. Default to 0.3, which due to the steep initial slope still preserves in-range
  13372. colors fairly accurately.
  13373. @end table
  13374. @item desat
  13375. Apply desaturation for highlights that exceed this level of brightness. The
  13376. higher the parameter, the more color information will be preserved. This
  13377. setting helps prevent unnaturally blown-out colors for super-highlights, by
  13378. (smoothly) turning into white instead. This makes images feel more natural,
  13379. at the cost of reducing information about out-of-range colors.
  13380. The default of 2.0 is somewhat conservative and will mostly just apply to
  13381. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  13382. This option works only if the input frame has a supported color tag.
  13383. @item peak
  13384. Override signal/nominal/reference peak with this value. Useful when the
  13385. embedded peak information in display metadata is not reliable or when tone
  13386. mapping from a lower range to a higher range.
  13387. @end table
  13388. @section tpad
  13389. Temporarily pad video frames.
  13390. The filter accepts the following options:
  13391. @table @option
  13392. @item start
  13393. Specify number of delay frames before input video stream.
  13394. @item stop
  13395. Specify number of padding frames after input video stream.
  13396. Set to -1 to pad indefinitely.
  13397. @item start_mode
  13398. Set kind of frames added to beginning of stream.
  13399. Can be either @var{add} or @var{clone}.
  13400. With @var{add} frames of solid-color are added.
  13401. With @var{clone} frames are clones of first frame.
  13402. @item stop_mode
  13403. Set kind of frames added to end of stream.
  13404. Can be either @var{add} or @var{clone}.
  13405. With @var{add} frames of solid-color are added.
  13406. With @var{clone} frames are clones of last frame.
  13407. @item start_duration, stop_duration
  13408. Specify the duration of the start/stop delay. See
  13409. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13410. for the accepted syntax.
  13411. These options override @var{start} and @var{stop}.
  13412. @item color
  13413. Specify the color of the padded area. For the syntax of this option,
  13414. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  13415. manual,ffmpeg-utils}.
  13416. The default value of @var{color} is "black".
  13417. @end table
  13418. @anchor{transpose}
  13419. @section transpose
  13420. Transpose rows with columns in the input video and optionally flip it.
  13421. It accepts the following parameters:
  13422. @table @option
  13423. @item dir
  13424. Specify the transposition direction.
  13425. Can assume the following values:
  13426. @table @samp
  13427. @item 0, 4, cclock_flip
  13428. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  13429. @example
  13430. L.R L.l
  13431. . . -> . .
  13432. l.r R.r
  13433. @end example
  13434. @item 1, 5, clock
  13435. Rotate by 90 degrees clockwise, that is:
  13436. @example
  13437. L.R l.L
  13438. . . -> . .
  13439. l.r r.R
  13440. @end example
  13441. @item 2, 6, cclock
  13442. Rotate by 90 degrees counterclockwise, that is:
  13443. @example
  13444. L.R R.r
  13445. . . -> . .
  13446. l.r L.l
  13447. @end example
  13448. @item 3, 7, clock_flip
  13449. Rotate by 90 degrees clockwise and vertically flip, that is:
  13450. @example
  13451. L.R r.R
  13452. . . -> . .
  13453. l.r l.L
  13454. @end example
  13455. @end table
  13456. For values between 4-7, the transposition is only done if the input
  13457. video geometry is portrait and not landscape. These values are
  13458. deprecated, the @code{passthrough} option should be used instead.
  13459. Numerical values are deprecated, and should be dropped in favor of
  13460. symbolic constants.
  13461. @item passthrough
  13462. Do not apply the transposition if the input geometry matches the one
  13463. specified by the specified value. It accepts the following values:
  13464. @table @samp
  13465. @item none
  13466. Always apply transposition.
  13467. @item portrait
  13468. Preserve portrait geometry (when @var{height} >= @var{width}).
  13469. @item landscape
  13470. Preserve landscape geometry (when @var{width} >= @var{height}).
  13471. @end table
  13472. Default value is @code{none}.
  13473. @end table
  13474. For example to rotate by 90 degrees clockwise and preserve portrait
  13475. layout:
  13476. @example
  13477. transpose=dir=1:passthrough=portrait
  13478. @end example
  13479. The command above can also be specified as:
  13480. @example
  13481. transpose=1:portrait
  13482. @end example
  13483. @section transpose_npp
  13484. Transpose rows with columns in the input video and optionally flip it.
  13485. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  13486. It accepts the following parameters:
  13487. @table @option
  13488. @item dir
  13489. Specify the transposition direction.
  13490. Can assume the following values:
  13491. @table @samp
  13492. @item cclock_flip
  13493. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  13494. @item clock
  13495. Rotate by 90 degrees clockwise.
  13496. @item cclock
  13497. Rotate by 90 degrees counterclockwise.
  13498. @item clock_flip
  13499. Rotate by 90 degrees clockwise and vertically flip.
  13500. @end table
  13501. @item passthrough
  13502. Do not apply the transposition if the input geometry matches the one
  13503. specified by the specified value. It accepts the following values:
  13504. @table @samp
  13505. @item none
  13506. Always apply transposition. (default)
  13507. @item portrait
  13508. Preserve portrait geometry (when @var{height} >= @var{width}).
  13509. @item landscape
  13510. Preserve landscape geometry (when @var{width} >= @var{height}).
  13511. @end table
  13512. @end table
  13513. @section trim
  13514. Trim the input so that the output contains one continuous subpart of the input.
  13515. It accepts the following parameters:
  13516. @table @option
  13517. @item start
  13518. Specify the time of the start of the kept section, i.e. the frame with the
  13519. timestamp @var{start} will be the first frame in the output.
  13520. @item end
  13521. Specify the time of the first frame that will be dropped, i.e. the frame
  13522. immediately preceding the one with the timestamp @var{end} will be the last
  13523. frame in the output.
  13524. @item start_pts
  13525. This is the same as @var{start}, except this option sets the start timestamp
  13526. in timebase units instead of seconds.
  13527. @item end_pts
  13528. This is the same as @var{end}, except this option sets the end timestamp
  13529. in timebase units instead of seconds.
  13530. @item duration
  13531. The maximum duration of the output in seconds.
  13532. @item start_frame
  13533. The number of the first frame that should be passed to the output.
  13534. @item end_frame
  13535. The number of the first frame that should be dropped.
  13536. @end table
  13537. @option{start}, @option{end}, and @option{duration} are expressed as time
  13538. duration specifications; see
  13539. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13540. for the accepted syntax.
  13541. Note that the first two sets of the start/end options and the @option{duration}
  13542. option look at the frame timestamp, while the _frame variants simply count the
  13543. frames that pass through the filter. Also note that this filter does not modify
  13544. the timestamps. If you wish for the output timestamps to start at zero, insert a
  13545. setpts filter after the trim filter.
  13546. If multiple start or end options are set, this filter tries to be greedy and
  13547. keep all the frames that match at least one of the specified constraints. To keep
  13548. only the part that matches all the constraints at once, chain multiple trim
  13549. filters.
  13550. The defaults are such that all the input is kept. So it is possible to set e.g.
  13551. just the end values to keep everything before the specified time.
  13552. Examples:
  13553. @itemize
  13554. @item
  13555. Drop everything except the second minute of input:
  13556. @example
  13557. ffmpeg -i INPUT -vf trim=60:120
  13558. @end example
  13559. @item
  13560. Keep only the first second:
  13561. @example
  13562. ffmpeg -i INPUT -vf trim=duration=1
  13563. @end example
  13564. @end itemize
  13565. @section unpremultiply
  13566. Apply alpha unpremultiply effect to input video stream using first plane
  13567. of second stream as alpha.
  13568. Both streams must have same dimensions and same pixel format.
  13569. The filter accepts the following option:
  13570. @table @option
  13571. @item planes
  13572. Set which planes will be processed, unprocessed planes will be copied.
  13573. By default value 0xf, all planes will be processed.
  13574. If the format has 1 or 2 components, then luma is bit 0.
  13575. If the format has 3 or 4 components:
  13576. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  13577. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  13578. If present, the alpha channel is always the last bit.
  13579. @item inplace
  13580. Do not require 2nd input for processing, instead use alpha plane from input stream.
  13581. @end table
  13582. @anchor{unsharp}
  13583. @section unsharp
  13584. Sharpen or blur the input video.
  13585. It accepts the following parameters:
  13586. @table @option
  13587. @item luma_msize_x, lx
  13588. Set the luma matrix horizontal size. It must be an odd integer between
  13589. 3 and 23. The default value is 5.
  13590. @item luma_msize_y, ly
  13591. Set the luma matrix vertical size. It must be an odd integer between 3
  13592. and 23. The default value is 5.
  13593. @item luma_amount, la
  13594. Set the luma effect strength. It must be a floating point number, reasonable
  13595. values lay between -1.5 and 1.5.
  13596. Negative values will blur the input video, while positive values will
  13597. sharpen it, a value of zero will disable the effect.
  13598. Default value is 1.0.
  13599. @item chroma_msize_x, cx
  13600. Set the chroma matrix horizontal size. It must be an odd integer
  13601. between 3 and 23. The default value is 5.
  13602. @item chroma_msize_y, cy
  13603. Set the chroma matrix vertical size. It must be an odd integer
  13604. between 3 and 23. The default value is 5.
  13605. @item chroma_amount, ca
  13606. Set the chroma effect strength. It must be a floating point number, reasonable
  13607. values lay between -1.5 and 1.5.
  13608. Negative values will blur the input video, while positive values will
  13609. sharpen it, a value of zero will disable the effect.
  13610. Default value is 0.0.
  13611. @end table
  13612. All parameters are optional and default to the equivalent of the
  13613. string '5:5:1.0:5:5:0.0'.
  13614. @subsection Examples
  13615. @itemize
  13616. @item
  13617. Apply strong luma sharpen effect:
  13618. @example
  13619. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  13620. @end example
  13621. @item
  13622. Apply a strong blur of both luma and chroma parameters:
  13623. @example
  13624. unsharp=7:7:-2:7:7:-2
  13625. @end example
  13626. @end itemize
  13627. @section uspp
  13628. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  13629. the image at several (or - in the case of @option{quality} level @code{8} - all)
  13630. shifts and average the results.
  13631. The way this differs from the behavior of spp is that uspp actually encodes &
  13632. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  13633. DCT similar to MJPEG.
  13634. The filter accepts the following options:
  13635. @table @option
  13636. @item quality
  13637. Set quality. This option defines the number of levels for averaging. It accepts
  13638. an integer in the range 0-8. If set to @code{0}, the filter will have no
  13639. effect. A value of @code{8} means the higher quality. For each increment of
  13640. that value the speed drops by a factor of approximately 2. Default value is
  13641. @code{3}.
  13642. @item qp
  13643. Force a constant quantization parameter. If not set, the filter will use the QP
  13644. from the video stream (if available).
  13645. @end table
  13646. @section v360
  13647. Convert 360 videos between various formats.
  13648. The filter accepts the following options:
  13649. @table @option
  13650. @item input
  13651. @item output
  13652. Set format of the input/output video.
  13653. Available formats:
  13654. @table @samp
  13655. @item e
  13656. Equirectangular projection.
  13657. @item c3x2
  13658. @item c6x1
  13659. Cubemap with 3x2/6x1 layout.
  13660. Format specific options:
  13661. @table @option
  13662. @item in_forder
  13663. @item out_forder
  13664. Set order of faces for the input/output cubemap. Choose one direction for each position.
  13665. Designation of directions:
  13666. @table @samp
  13667. @item r
  13668. right
  13669. @item l
  13670. left
  13671. @item u
  13672. up
  13673. @item d
  13674. down
  13675. @item f
  13676. forward
  13677. @item b
  13678. back
  13679. @end table
  13680. Default value is @b{@samp{rludfb}}.
  13681. @item in_frot
  13682. @item out_frot
  13683. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  13684. Designation of angles:
  13685. @table @samp
  13686. @item 0
  13687. 0 degrees clockwise
  13688. @item 1
  13689. 90 degrees clockwise
  13690. @item 2
  13691. 180 degrees clockwise
  13692. @item 4
  13693. 270 degrees clockwise
  13694. @end table
  13695. Default value is @b{@samp{000000}}.
  13696. @end table
  13697. @item eac
  13698. Equi-Angular Cubemap.
  13699. @item flat
  13700. Regular video. @i{(output only)}
  13701. Format specific options:
  13702. @table @option
  13703. @item h_fov
  13704. @item v_fov
  13705. Set horizontal/vertical field of view. Values in degrees.
  13706. @end table
  13707. @end table
  13708. @item interp
  13709. Set interpolation method.@*
  13710. @i{Note: more complex interpolation methods require much more memory to run.}
  13711. Available methods:
  13712. @table @samp
  13713. @item near
  13714. @item nearest
  13715. Nearest neighbour.
  13716. @item line
  13717. @item linear
  13718. Bilinear interpolation.
  13719. @item cube
  13720. @item cubic
  13721. Bicubic interpolation.
  13722. @item lanc
  13723. @item lanczos
  13724. Lanczos interpolation.
  13725. @end table
  13726. Default value is @b{@samp{line}}.
  13727. @item w
  13728. @item h
  13729. Set the output video resolution.
  13730. Default resolution depends on formats.
  13731. @item yaw
  13732. @item pitch
  13733. @item roll
  13734. Set rotation for the output video. Values in degrees.
  13735. @item hflip
  13736. @item vflip
  13737. @item dflip
  13738. Flip the output video horizontally/vertically/in-depth. Boolean values.
  13739. @end table
  13740. @subsection Examples
  13741. @itemize
  13742. @item
  13743. Convert equirectangular video to cubemap with 3x2 layout using bicubic interpolation:
  13744. @example
  13745. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic output.mkv
  13746. @end example
  13747. @item
  13748. Extract back view of Equi-Angular Cubemap:
  13749. @example
  13750. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  13751. @end example
  13752. @end itemize
  13753. @section vaguedenoiser
  13754. Apply a wavelet based denoiser.
  13755. It transforms each frame from the video input into the wavelet domain,
  13756. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  13757. the obtained coefficients. It does an inverse wavelet transform after.
  13758. Due to wavelet properties, it should give a nice smoothed result, and
  13759. reduced noise, without blurring picture features.
  13760. This filter accepts the following options:
  13761. @table @option
  13762. @item threshold
  13763. The filtering strength. The higher, the more filtered the video will be.
  13764. Hard thresholding can use a higher threshold than soft thresholding
  13765. before the video looks overfiltered. Default value is 2.
  13766. @item method
  13767. The filtering method the filter will use.
  13768. It accepts the following values:
  13769. @table @samp
  13770. @item hard
  13771. All values under the threshold will be zeroed.
  13772. @item soft
  13773. All values under the threshold will be zeroed. All values above will be
  13774. reduced by the threshold.
  13775. @item garrote
  13776. Scales or nullifies coefficients - intermediary between (more) soft and
  13777. (less) hard thresholding.
  13778. @end table
  13779. Default is garrote.
  13780. @item nsteps
  13781. Number of times, the wavelet will decompose the picture. Picture can't
  13782. be decomposed beyond a particular point (typically, 8 for a 640x480
  13783. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  13784. @item percent
  13785. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  13786. @item planes
  13787. A list of the planes to process. By default all planes are processed.
  13788. @end table
  13789. @section vectorscope
  13790. Display 2 color component values in the two dimensional graph (which is called
  13791. a vectorscope).
  13792. This filter accepts the following options:
  13793. @table @option
  13794. @item mode, m
  13795. Set vectorscope mode.
  13796. It accepts the following values:
  13797. @table @samp
  13798. @item gray
  13799. Gray values are displayed on graph, higher brightness means more pixels have
  13800. same component color value on location in graph. This is the default mode.
  13801. @item color
  13802. Gray values are displayed on graph. Surrounding pixels values which are not
  13803. present in video frame are drawn in gradient of 2 color components which are
  13804. set by option @code{x} and @code{y}. The 3rd color component is static.
  13805. @item color2
  13806. Actual color components values present in video frame are displayed on graph.
  13807. @item color3
  13808. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  13809. on graph increases value of another color component, which is luminance by
  13810. default values of @code{x} and @code{y}.
  13811. @item color4
  13812. Actual colors present in video frame are displayed on graph. If two different
  13813. colors map to same position on graph then color with higher value of component
  13814. not present in graph is picked.
  13815. @item color5
  13816. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  13817. component picked from radial gradient.
  13818. @end table
  13819. @item x
  13820. Set which color component will be represented on X-axis. Default is @code{1}.
  13821. @item y
  13822. Set which color component will be represented on Y-axis. Default is @code{2}.
  13823. @item intensity, i
  13824. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  13825. of color component which represents frequency of (X, Y) location in graph.
  13826. @item envelope, e
  13827. @table @samp
  13828. @item none
  13829. No envelope, this is default.
  13830. @item instant
  13831. Instant envelope, even darkest single pixel will be clearly highlighted.
  13832. @item peak
  13833. Hold maximum and minimum values presented in graph over time. This way you
  13834. can still spot out of range values without constantly looking at vectorscope.
  13835. @item peak+instant
  13836. Peak and instant envelope combined together.
  13837. @end table
  13838. @item graticule, g
  13839. Set what kind of graticule to draw.
  13840. @table @samp
  13841. @item none
  13842. @item green
  13843. @item color
  13844. @end table
  13845. @item opacity, o
  13846. Set graticule opacity.
  13847. @item flags, f
  13848. Set graticule flags.
  13849. @table @samp
  13850. @item white
  13851. Draw graticule for white point.
  13852. @item black
  13853. Draw graticule for black point.
  13854. @item name
  13855. Draw color points short names.
  13856. @end table
  13857. @item bgopacity, b
  13858. Set background opacity.
  13859. @item lthreshold, l
  13860. Set low threshold for color component not represented on X or Y axis.
  13861. Values lower than this value will be ignored. Default is 0.
  13862. Note this value is multiplied with actual max possible value one pixel component
  13863. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  13864. is 0.1 * 255 = 25.
  13865. @item hthreshold, h
  13866. Set high threshold for color component not represented on X or Y axis.
  13867. Values higher than this value will be ignored. Default is 1.
  13868. Note this value is multiplied with actual max possible value one pixel component
  13869. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  13870. is 0.9 * 255 = 230.
  13871. @item colorspace, c
  13872. Set what kind of colorspace to use when drawing graticule.
  13873. @table @samp
  13874. @item auto
  13875. @item 601
  13876. @item 709
  13877. @end table
  13878. Default is auto.
  13879. @end table
  13880. @anchor{vidstabdetect}
  13881. @section vidstabdetect
  13882. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  13883. @ref{vidstabtransform} for pass 2.
  13884. This filter generates a file with relative translation and rotation
  13885. transform information about subsequent frames, which is then used by
  13886. the @ref{vidstabtransform} filter.
  13887. To enable compilation of this filter you need to configure FFmpeg with
  13888. @code{--enable-libvidstab}.
  13889. This filter accepts the following options:
  13890. @table @option
  13891. @item result
  13892. Set the path to the file used to write the transforms information.
  13893. Default value is @file{transforms.trf}.
  13894. @item shakiness
  13895. Set how shaky the video is and how quick the camera is. It accepts an
  13896. integer in the range 1-10, a value of 1 means little shakiness, a
  13897. value of 10 means strong shakiness. Default value is 5.
  13898. @item accuracy
  13899. Set the accuracy of the detection process. It must be a value in the
  13900. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  13901. accuracy. Default value is 15.
  13902. @item stepsize
  13903. Set stepsize of the search process. The region around minimum is
  13904. scanned with 1 pixel resolution. Default value is 6.
  13905. @item mincontrast
  13906. Set minimum contrast. Below this value a local measurement field is
  13907. discarded. Must be a floating point value in the range 0-1. Default
  13908. value is 0.3.
  13909. @item tripod
  13910. Set reference frame number for tripod mode.
  13911. If enabled, the motion of the frames is compared to a reference frame
  13912. in the filtered stream, identified by the specified number. The idea
  13913. is to compensate all movements in a more-or-less static scene and keep
  13914. the camera view absolutely still.
  13915. If set to 0, it is disabled. The frames are counted starting from 1.
  13916. @item show
  13917. Show fields and transforms in the resulting frames. It accepts an
  13918. integer in the range 0-2. Default value is 0, which disables any
  13919. visualization.
  13920. @end table
  13921. @subsection Examples
  13922. @itemize
  13923. @item
  13924. Use default values:
  13925. @example
  13926. vidstabdetect
  13927. @end example
  13928. @item
  13929. Analyze strongly shaky movie and put the results in file
  13930. @file{mytransforms.trf}:
  13931. @example
  13932. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  13933. @end example
  13934. @item
  13935. Visualize the result of internal transformations in the resulting
  13936. video:
  13937. @example
  13938. vidstabdetect=show=1
  13939. @end example
  13940. @item
  13941. Analyze a video with medium shakiness using @command{ffmpeg}:
  13942. @example
  13943. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  13944. @end example
  13945. @end itemize
  13946. @anchor{vidstabtransform}
  13947. @section vidstabtransform
  13948. Video stabilization/deshaking: pass 2 of 2,
  13949. see @ref{vidstabdetect} for pass 1.
  13950. Read a file with transform information for each frame and
  13951. apply/compensate them. Together with the @ref{vidstabdetect}
  13952. filter this can be used to deshake videos. See also
  13953. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  13954. the @ref{unsharp} filter, see below.
  13955. To enable compilation of this filter you need to configure FFmpeg with
  13956. @code{--enable-libvidstab}.
  13957. @subsection Options
  13958. @table @option
  13959. @item input
  13960. Set path to the file used to read the transforms. Default value is
  13961. @file{transforms.trf}.
  13962. @item smoothing
  13963. Set the number of frames (value*2 + 1) used for lowpass filtering the
  13964. camera movements. Default value is 10.
  13965. For example a number of 10 means that 21 frames are used (10 in the
  13966. past and 10 in the future) to smoothen the motion in the video. A
  13967. larger value leads to a smoother video, but limits the acceleration of
  13968. the camera (pan/tilt movements). 0 is a special case where a static
  13969. camera is simulated.
  13970. @item optalgo
  13971. Set the camera path optimization algorithm.
  13972. Accepted values are:
  13973. @table @samp
  13974. @item gauss
  13975. gaussian kernel low-pass filter on camera motion (default)
  13976. @item avg
  13977. averaging on transformations
  13978. @end table
  13979. @item maxshift
  13980. Set maximal number of pixels to translate frames. Default value is -1,
  13981. meaning no limit.
  13982. @item maxangle
  13983. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  13984. value is -1, meaning no limit.
  13985. @item crop
  13986. Specify how to deal with borders that may be visible due to movement
  13987. compensation.
  13988. Available values are:
  13989. @table @samp
  13990. @item keep
  13991. keep image information from previous frame (default)
  13992. @item black
  13993. fill the border black
  13994. @end table
  13995. @item invert
  13996. Invert transforms if set to 1. Default value is 0.
  13997. @item relative
  13998. Consider transforms as relative to previous frame if set to 1,
  13999. absolute if set to 0. Default value is 0.
  14000. @item zoom
  14001. Set percentage to zoom. A positive value will result in a zoom-in
  14002. effect, a negative value in a zoom-out effect. Default value is 0 (no
  14003. zoom).
  14004. @item optzoom
  14005. Set optimal zooming to avoid borders.
  14006. Accepted values are:
  14007. @table @samp
  14008. @item 0
  14009. disabled
  14010. @item 1
  14011. optimal static zoom value is determined (only very strong movements
  14012. will lead to visible borders) (default)
  14013. @item 2
  14014. optimal adaptive zoom value is determined (no borders will be
  14015. visible), see @option{zoomspeed}
  14016. @end table
  14017. Note that the value given at zoom is added to the one calculated here.
  14018. @item zoomspeed
  14019. Set percent to zoom maximally each frame (enabled when
  14020. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  14021. 0.25.
  14022. @item interpol
  14023. Specify type of interpolation.
  14024. Available values are:
  14025. @table @samp
  14026. @item no
  14027. no interpolation
  14028. @item linear
  14029. linear only horizontal
  14030. @item bilinear
  14031. linear in both directions (default)
  14032. @item bicubic
  14033. cubic in both directions (slow)
  14034. @end table
  14035. @item tripod
  14036. Enable virtual tripod mode if set to 1, which is equivalent to
  14037. @code{relative=0:smoothing=0}. Default value is 0.
  14038. Use also @code{tripod} option of @ref{vidstabdetect}.
  14039. @item debug
  14040. Increase log verbosity if set to 1. Also the detected global motions
  14041. are written to the temporary file @file{global_motions.trf}. Default
  14042. value is 0.
  14043. @end table
  14044. @subsection Examples
  14045. @itemize
  14046. @item
  14047. Use @command{ffmpeg} for a typical stabilization with default values:
  14048. @example
  14049. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  14050. @end example
  14051. Note the use of the @ref{unsharp} filter which is always recommended.
  14052. @item
  14053. Zoom in a bit more and load transform data from a given file:
  14054. @example
  14055. vidstabtransform=zoom=5:input="mytransforms.trf"
  14056. @end example
  14057. @item
  14058. Smoothen the video even more:
  14059. @example
  14060. vidstabtransform=smoothing=30
  14061. @end example
  14062. @end itemize
  14063. @section vflip
  14064. Flip the input video vertically.
  14065. For example, to vertically flip a video with @command{ffmpeg}:
  14066. @example
  14067. ffmpeg -i in.avi -vf "vflip" out.avi
  14068. @end example
  14069. @section vfrdet
  14070. Detect variable frame rate video.
  14071. This filter tries to detect if the input is variable or constant frame rate.
  14072. At end it will output number of frames detected as having variable delta pts,
  14073. and ones with constant delta pts.
  14074. If there was frames with variable delta, than it will also show min and max delta
  14075. encountered.
  14076. @section vibrance
  14077. Boost or alter saturation.
  14078. The filter accepts the following options:
  14079. @table @option
  14080. @item intensity
  14081. Set strength of boost if positive value or strength of alter if negative value.
  14082. Default is 0. Allowed range is from -2 to 2.
  14083. @item rbal
  14084. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  14085. @item gbal
  14086. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  14087. @item bbal
  14088. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  14089. @item rlum
  14090. Set the red luma coefficient.
  14091. @item glum
  14092. Set the green luma coefficient.
  14093. @item blum
  14094. Set the blue luma coefficient.
  14095. @item alternate
  14096. If @code{intensity} is negative and this is set to 1, colors will change,
  14097. otherwise colors will be less saturated, more towards gray.
  14098. @end table
  14099. @anchor{vignette}
  14100. @section vignette
  14101. Make or reverse a natural vignetting effect.
  14102. The filter accepts the following options:
  14103. @table @option
  14104. @item angle, a
  14105. Set lens angle expression as a number of radians.
  14106. The value is clipped in the @code{[0,PI/2]} range.
  14107. Default value: @code{"PI/5"}
  14108. @item x0
  14109. @item y0
  14110. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  14111. by default.
  14112. @item mode
  14113. Set forward/backward mode.
  14114. Available modes are:
  14115. @table @samp
  14116. @item forward
  14117. The larger the distance from the central point, the darker the image becomes.
  14118. @item backward
  14119. The larger the distance from the central point, the brighter the image becomes.
  14120. This can be used to reverse a vignette effect, though there is no automatic
  14121. detection to extract the lens @option{angle} and other settings (yet). It can
  14122. also be used to create a burning effect.
  14123. @end table
  14124. Default value is @samp{forward}.
  14125. @item eval
  14126. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  14127. It accepts the following values:
  14128. @table @samp
  14129. @item init
  14130. Evaluate expressions only once during the filter initialization.
  14131. @item frame
  14132. Evaluate expressions for each incoming frame. This is way slower than the
  14133. @samp{init} mode since it requires all the scalers to be re-computed, but it
  14134. allows advanced dynamic expressions.
  14135. @end table
  14136. Default value is @samp{init}.
  14137. @item dither
  14138. Set dithering to reduce the circular banding effects. Default is @code{1}
  14139. (enabled).
  14140. @item aspect
  14141. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  14142. Setting this value to the SAR of the input will make a rectangular vignetting
  14143. following the dimensions of the video.
  14144. Default is @code{1/1}.
  14145. @end table
  14146. @subsection Expressions
  14147. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  14148. following parameters.
  14149. @table @option
  14150. @item w
  14151. @item h
  14152. input width and height
  14153. @item n
  14154. the number of input frame, starting from 0
  14155. @item pts
  14156. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  14157. @var{TB} units, NAN if undefined
  14158. @item r
  14159. frame rate of the input video, NAN if the input frame rate is unknown
  14160. @item t
  14161. the PTS (Presentation TimeStamp) of the filtered video frame,
  14162. expressed in seconds, NAN if undefined
  14163. @item tb
  14164. time base of the input video
  14165. @end table
  14166. @subsection Examples
  14167. @itemize
  14168. @item
  14169. Apply simple strong vignetting effect:
  14170. @example
  14171. vignette=PI/4
  14172. @end example
  14173. @item
  14174. Make a flickering vignetting:
  14175. @example
  14176. vignette='PI/4+random(1)*PI/50':eval=frame
  14177. @end example
  14178. @end itemize
  14179. @section vmafmotion
  14180. Obtain the average vmaf motion score of a video.
  14181. It is one of the component filters of VMAF.
  14182. The obtained average motion score is printed through the logging system.
  14183. In the below example the input file @file{ref.mpg} is being processed and score
  14184. is computed.
  14185. @example
  14186. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  14187. @end example
  14188. @section vstack
  14189. Stack input videos vertically.
  14190. All streams must be of same pixel format and of same width.
  14191. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  14192. to create same output.
  14193. The filter accept the following option:
  14194. @table @option
  14195. @item inputs
  14196. Set number of input streams. Default is 2.
  14197. @item shortest
  14198. If set to 1, force the output to terminate when the shortest input
  14199. terminates. Default value is 0.
  14200. @end table
  14201. @section w3fdif
  14202. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  14203. Deinterlacing Filter").
  14204. Based on the process described by Martin Weston for BBC R&D, and
  14205. implemented based on the de-interlace algorithm written by Jim
  14206. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  14207. uses filter coefficients calculated by BBC R&D.
  14208. This filter use field-dominance information in frame to decide which
  14209. of each pair of fields to place first in the output.
  14210. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  14211. There are two sets of filter coefficients, so called "simple":
  14212. and "complex". Which set of filter coefficients is used can
  14213. be set by passing an optional parameter:
  14214. @table @option
  14215. @item filter
  14216. Set the interlacing filter coefficients. Accepts one of the following values:
  14217. @table @samp
  14218. @item simple
  14219. Simple filter coefficient set.
  14220. @item complex
  14221. More-complex filter coefficient set.
  14222. @end table
  14223. Default value is @samp{complex}.
  14224. @item deint
  14225. Specify which frames to deinterlace. Accept one of the following values:
  14226. @table @samp
  14227. @item all
  14228. Deinterlace all frames,
  14229. @item interlaced
  14230. Only deinterlace frames marked as interlaced.
  14231. @end table
  14232. Default value is @samp{all}.
  14233. @end table
  14234. @section waveform
  14235. Video waveform monitor.
  14236. The waveform monitor plots color component intensity. By default luminance
  14237. only. Each column of the waveform corresponds to a column of pixels in the
  14238. source video.
  14239. It accepts the following options:
  14240. @table @option
  14241. @item mode, m
  14242. Can be either @code{row}, or @code{column}. Default is @code{column}.
  14243. In row mode, the graph on the left side represents color component value 0 and
  14244. the right side represents value = 255. In column mode, the top side represents
  14245. color component value = 0 and bottom side represents value = 255.
  14246. @item intensity, i
  14247. Set intensity. Smaller values are useful to find out how many values of the same
  14248. luminance are distributed across input rows/columns.
  14249. Default value is @code{0.04}. Allowed range is [0, 1].
  14250. @item mirror, r
  14251. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  14252. In mirrored mode, higher values will be represented on the left
  14253. side for @code{row} mode and at the top for @code{column} mode. Default is
  14254. @code{1} (mirrored).
  14255. @item display, d
  14256. Set display mode.
  14257. It accepts the following values:
  14258. @table @samp
  14259. @item overlay
  14260. Presents information identical to that in the @code{parade}, except
  14261. that the graphs representing color components are superimposed directly
  14262. over one another.
  14263. This display mode makes it easier to spot relative differences or similarities
  14264. in overlapping areas of the color components that are supposed to be identical,
  14265. such as neutral whites, grays, or blacks.
  14266. @item stack
  14267. Display separate graph for the color components side by side in
  14268. @code{row} mode or one below the other in @code{column} mode.
  14269. @item parade
  14270. Display separate graph for the color components side by side in
  14271. @code{column} mode or one below the other in @code{row} mode.
  14272. Using this display mode makes it easy to spot color casts in the highlights
  14273. and shadows of an image, by comparing the contours of the top and the bottom
  14274. graphs of each waveform. Since whites, grays, and blacks are characterized
  14275. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  14276. should display three waveforms of roughly equal width/height. If not, the
  14277. correction is easy to perform by making level adjustments the three waveforms.
  14278. @end table
  14279. Default is @code{stack}.
  14280. @item components, c
  14281. Set which color components to display. Default is 1, which means only luminance
  14282. or red color component if input is in RGB colorspace. If is set for example to
  14283. 7 it will display all 3 (if) available color components.
  14284. @item envelope, e
  14285. @table @samp
  14286. @item none
  14287. No envelope, this is default.
  14288. @item instant
  14289. Instant envelope, minimum and maximum values presented in graph will be easily
  14290. visible even with small @code{step} value.
  14291. @item peak
  14292. Hold minimum and maximum values presented in graph across time. This way you
  14293. can still spot out of range values without constantly looking at waveforms.
  14294. @item peak+instant
  14295. Peak and instant envelope combined together.
  14296. @end table
  14297. @item filter, f
  14298. @table @samp
  14299. @item lowpass
  14300. No filtering, this is default.
  14301. @item flat
  14302. Luma and chroma combined together.
  14303. @item aflat
  14304. Similar as above, but shows difference between blue and red chroma.
  14305. @item xflat
  14306. Similar as above, but use different colors.
  14307. @item chroma
  14308. Displays only chroma.
  14309. @item color
  14310. Displays actual color value on waveform.
  14311. @item acolor
  14312. Similar as above, but with luma showing frequency of chroma values.
  14313. @end table
  14314. @item graticule, g
  14315. Set which graticule to display.
  14316. @table @samp
  14317. @item none
  14318. Do not display graticule.
  14319. @item green
  14320. Display green graticule showing legal broadcast ranges.
  14321. @item orange
  14322. Display orange graticule showing legal broadcast ranges.
  14323. @end table
  14324. @item opacity, o
  14325. Set graticule opacity.
  14326. @item flags, fl
  14327. Set graticule flags.
  14328. @table @samp
  14329. @item numbers
  14330. Draw numbers above lines. By default enabled.
  14331. @item dots
  14332. Draw dots instead of lines.
  14333. @end table
  14334. @item scale, s
  14335. Set scale used for displaying graticule.
  14336. @table @samp
  14337. @item digital
  14338. @item millivolts
  14339. @item ire
  14340. @end table
  14341. Default is digital.
  14342. @item bgopacity, b
  14343. Set background opacity.
  14344. @end table
  14345. @section weave, doubleweave
  14346. The @code{weave} takes a field-based video input and join
  14347. each two sequential fields into single frame, producing a new double
  14348. height clip with half the frame rate and half the frame count.
  14349. The @code{doubleweave} works same as @code{weave} but without
  14350. halving frame rate and frame count.
  14351. It accepts the following option:
  14352. @table @option
  14353. @item first_field
  14354. Set first field. Available values are:
  14355. @table @samp
  14356. @item top, t
  14357. Set the frame as top-field-first.
  14358. @item bottom, b
  14359. Set the frame as bottom-field-first.
  14360. @end table
  14361. @end table
  14362. @subsection Examples
  14363. @itemize
  14364. @item
  14365. Interlace video using @ref{select} and @ref{separatefields} filter:
  14366. @example
  14367. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  14368. @end example
  14369. @end itemize
  14370. @section xbr
  14371. Apply the xBR high-quality magnification filter which is designed for pixel
  14372. art. It follows a set of edge-detection rules, see
  14373. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  14374. It accepts the following option:
  14375. @table @option
  14376. @item n
  14377. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  14378. @code{3xBR} and @code{4} for @code{4xBR}.
  14379. Default is @code{3}.
  14380. @end table
  14381. @section xmedian
  14382. Pick median pixels from several input videos.
  14383. The filter accept the following options:
  14384. @table @option
  14385. @item inputs
  14386. Set number of inputs.
  14387. Default is 3. Allowed range is from 3 to 255.
  14388. If number of inputs is even number, than result will be mean value between two median values.
  14389. @item planes
  14390. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14391. @end table
  14392. @section xstack
  14393. Stack video inputs into custom layout.
  14394. All streams must be of same pixel format.
  14395. The filter accept the following option:
  14396. @table @option
  14397. @item inputs
  14398. Set number of input streams. Default is 2.
  14399. @item layout
  14400. Specify layout of inputs.
  14401. This option requires the desired layout configuration to be explicitly set by the user.
  14402. This sets position of each video input in output. Each input
  14403. is separated by '|'.
  14404. The first number represents the column, and the second number represents the row.
  14405. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  14406. where X is video input from which to take width or height.
  14407. Multiple values can be used when separated by '+'. In such
  14408. case values are summed together.
  14409. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  14410. a layout must be set by the user.
  14411. @item shortest
  14412. If set to 1, force the output to terminate when the shortest input
  14413. terminates. Default value is 0.
  14414. @end table
  14415. @subsection Examples
  14416. @itemize
  14417. @item
  14418. Display 4 inputs into 2x2 grid,
  14419. note that if inputs are of different sizes unused gaps might appear,
  14420. as not all of output video is used.
  14421. @example
  14422. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  14423. @end example
  14424. @item
  14425. Display 4 inputs into 1x4 grid,
  14426. note that if inputs are of different sizes unused gaps might appear,
  14427. as not all of output video is used.
  14428. @example
  14429. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  14430. @end example
  14431. @item
  14432. Display 9 inputs into 3x3 grid,
  14433. note that if inputs are of different sizes unused gaps might appear,
  14434. as not all of output video is used.
  14435. @example
  14436. xstack=inputs=9:layout=w3_0|w3_h0+h2|w3_h0|0_h4|0_0|w3+w1_0|0_h1+h2|w3+w1_h0|w3+w1_h1+h2
  14437. @end example
  14438. @end itemize
  14439. @anchor{yadif}
  14440. @section yadif
  14441. Deinterlace the input video ("yadif" means "yet another deinterlacing
  14442. filter").
  14443. It accepts the following parameters:
  14444. @table @option
  14445. @item mode
  14446. The interlacing mode to adopt. It accepts one of the following values:
  14447. @table @option
  14448. @item 0, send_frame
  14449. Output one frame for each frame.
  14450. @item 1, send_field
  14451. Output one frame for each field.
  14452. @item 2, send_frame_nospatial
  14453. Like @code{send_frame}, but it skips the spatial interlacing check.
  14454. @item 3, send_field_nospatial
  14455. Like @code{send_field}, but it skips the spatial interlacing check.
  14456. @end table
  14457. The default value is @code{send_frame}.
  14458. @item parity
  14459. The picture field parity assumed for the input interlaced video. It accepts one
  14460. of the following values:
  14461. @table @option
  14462. @item 0, tff
  14463. Assume the top field is first.
  14464. @item 1, bff
  14465. Assume the bottom field is first.
  14466. @item -1, auto
  14467. Enable automatic detection of field parity.
  14468. @end table
  14469. The default value is @code{auto}.
  14470. If the interlacing is unknown or the decoder does not export this information,
  14471. top field first will be assumed.
  14472. @item deint
  14473. Specify which frames to deinterlace. Accept one of the following
  14474. values:
  14475. @table @option
  14476. @item 0, all
  14477. Deinterlace all frames.
  14478. @item 1, interlaced
  14479. Only deinterlace frames marked as interlaced.
  14480. @end table
  14481. The default value is @code{all}.
  14482. @end table
  14483. @section yadif_cuda
  14484. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  14485. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  14486. and/or nvenc.
  14487. It accepts the following parameters:
  14488. @table @option
  14489. @item mode
  14490. The interlacing mode to adopt. It accepts one of the following values:
  14491. @table @option
  14492. @item 0, send_frame
  14493. Output one frame for each frame.
  14494. @item 1, send_field
  14495. Output one frame for each field.
  14496. @item 2, send_frame_nospatial
  14497. Like @code{send_frame}, but it skips the spatial interlacing check.
  14498. @item 3, send_field_nospatial
  14499. Like @code{send_field}, but it skips the spatial interlacing check.
  14500. @end table
  14501. The default value is @code{send_frame}.
  14502. @item parity
  14503. The picture field parity assumed for the input interlaced video. It accepts one
  14504. of the following values:
  14505. @table @option
  14506. @item 0, tff
  14507. Assume the top field is first.
  14508. @item 1, bff
  14509. Assume the bottom field is first.
  14510. @item -1, auto
  14511. Enable automatic detection of field parity.
  14512. @end table
  14513. The default value is @code{auto}.
  14514. If the interlacing is unknown or the decoder does not export this information,
  14515. top field first will be assumed.
  14516. @item deint
  14517. Specify which frames to deinterlace. Accept one of the following
  14518. values:
  14519. @table @option
  14520. @item 0, all
  14521. Deinterlace all frames.
  14522. @item 1, interlaced
  14523. Only deinterlace frames marked as interlaced.
  14524. @end table
  14525. The default value is @code{all}.
  14526. @end table
  14527. @section zoompan
  14528. Apply Zoom & Pan effect.
  14529. This filter accepts the following options:
  14530. @table @option
  14531. @item zoom, z
  14532. Set the zoom expression. Range is 1-10. Default is 1.
  14533. @item x
  14534. @item y
  14535. Set the x and y expression. Default is 0.
  14536. @item d
  14537. Set the duration expression in number of frames.
  14538. This sets for how many number of frames effect will last for
  14539. single input image.
  14540. @item s
  14541. Set the output image size, default is 'hd720'.
  14542. @item fps
  14543. Set the output frame rate, default is '25'.
  14544. @end table
  14545. Each expression can contain the following constants:
  14546. @table @option
  14547. @item in_w, iw
  14548. Input width.
  14549. @item in_h, ih
  14550. Input height.
  14551. @item out_w, ow
  14552. Output width.
  14553. @item out_h, oh
  14554. Output height.
  14555. @item in
  14556. Input frame count.
  14557. @item on
  14558. Output frame count.
  14559. @item x
  14560. @item y
  14561. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  14562. for current input frame.
  14563. @item px
  14564. @item py
  14565. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  14566. not yet such frame (first input frame).
  14567. @item zoom
  14568. Last calculated zoom from 'z' expression for current input frame.
  14569. @item pzoom
  14570. Last calculated zoom of last output frame of previous input frame.
  14571. @item duration
  14572. Number of output frames for current input frame. Calculated from 'd' expression
  14573. for each input frame.
  14574. @item pduration
  14575. number of output frames created for previous input frame
  14576. @item a
  14577. Rational number: input width / input height
  14578. @item sar
  14579. sample aspect ratio
  14580. @item dar
  14581. display aspect ratio
  14582. @end table
  14583. @subsection Examples
  14584. @itemize
  14585. @item
  14586. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  14587. @example
  14588. 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
  14589. @end example
  14590. @item
  14591. Zoom-in up to 1.5 and pan always at center of picture:
  14592. @example
  14593. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14594. @end example
  14595. @item
  14596. Same as above but without pausing:
  14597. @example
  14598. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14599. @end example
  14600. @end itemize
  14601. @anchor{zscale}
  14602. @section zscale
  14603. Scale (resize) the input video, using the z.lib library:
  14604. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  14605. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  14606. The zscale filter forces the output display aspect ratio to be the same
  14607. as the input, by changing the output sample aspect ratio.
  14608. If the input image format is different from the format requested by
  14609. the next filter, the zscale filter will convert the input to the
  14610. requested format.
  14611. @subsection Options
  14612. The filter accepts the following options.
  14613. @table @option
  14614. @item width, w
  14615. @item height, h
  14616. Set the output video dimension expression. Default value is the input
  14617. dimension.
  14618. If the @var{width} or @var{w} value is 0, the input width is used for
  14619. the output. If the @var{height} or @var{h} value is 0, the input height
  14620. is used for the output.
  14621. If one and only one of the values is -n with n >= 1, the zscale filter
  14622. will use a value that maintains the aspect ratio of the input image,
  14623. calculated from the other specified dimension. After that it will,
  14624. however, make sure that the calculated dimension is divisible by n and
  14625. adjust the value if necessary.
  14626. If both values are -n with n >= 1, the behavior will be identical to
  14627. both values being set to 0 as previously detailed.
  14628. See below for the list of accepted constants for use in the dimension
  14629. expression.
  14630. @item size, s
  14631. Set the video size. For the syntax of this option, check the
  14632. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14633. @item dither, d
  14634. Set the dither type.
  14635. Possible values are:
  14636. @table @var
  14637. @item none
  14638. @item ordered
  14639. @item random
  14640. @item error_diffusion
  14641. @end table
  14642. Default is none.
  14643. @item filter, f
  14644. Set the resize filter type.
  14645. Possible values are:
  14646. @table @var
  14647. @item point
  14648. @item bilinear
  14649. @item bicubic
  14650. @item spline16
  14651. @item spline36
  14652. @item lanczos
  14653. @end table
  14654. Default is bilinear.
  14655. @item range, r
  14656. Set the color range.
  14657. Possible values are:
  14658. @table @var
  14659. @item input
  14660. @item limited
  14661. @item full
  14662. @end table
  14663. Default is same as input.
  14664. @item primaries, p
  14665. Set the color primaries.
  14666. Possible values are:
  14667. @table @var
  14668. @item input
  14669. @item 709
  14670. @item unspecified
  14671. @item 170m
  14672. @item 240m
  14673. @item 2020
  14674. @end table
  14675. Default is same as input.
  14676. @item transfer, t
  14677. Set the transfer characteristics.
  14678. Possible values are:
  14679. @table @var
  14680. @item input
  14681. @item 709
  14682. @item unspecified
  14683. @item 601
  14684. @item linear
  14685. @item 2020_10
  14686. @item 2020_12
  14687. @item smpte2084
  14688. @item iec61966-2-1
  14689. @item arib-std-b67
  14690. @end table
  14691. Default is same as input.
  14692. @item matrix, m
  14693. Set the colorspace matrix.
  14694. Possible value are:
  14695. @table @var
  14696. @item input
  14697. @item 709
  14698. @item unspecified
  14699. @item 470bg
  14700. @item 170m
  14701. @item 2020_ncl
  14702. @item 2020_cl
  14703. @end table
  14704. Default is same as input.
  14705. @item rangein, rin
  14706. Set the input color range.
  14707. Possible values are:
  14708. @table @var
  14709. @item input
  14710. @item limited
  14711. @item full
  14712. @end table
  14713. Default is same as input.
  14714. @item primariesin, pin
  14715. Set the input color primaries.
  14716. Possible values are:
  14717. @table @var
  14718. @item input
  14719. @item 709
  14720. @item unspecified
  14721. @item 170m
  14722. @item 240m
  14723. @item 2020
  14724. @end table
  14725. Default is same as input.
  14726. @item transferin, tin
  14727. Set the input transfer characteristics.
  14728. Possible values are:
  14729. @table @var
  14730. @item input
  14731. @item 709
  14732. @item unspecified
  14733. @item 601
  14734. @item linear
  14735. @item 2020_10
  14736. @item 2020_12
  14737. @end table
  14738. Default is same as input.
  14739. @item matrixin, min
  14740. Set the input colorspace matrix.
  14741. Possible value are:
  14742. @table @var
  14743. @item input
  14744. @item 709
  14745. @item unspecified
  14746. @item 470bg
  14747. @item 170m
  14748. @item 2020_ncl
  14749. @item 2020_cl
  14750. @end table
  14751. @item chromal, c
  14752. Set the output chroma location.
  14753. Possible values are:
  14754. @table @var
  14755. @item input
  14756. @item left
  14757. @item center
  14758. @item topleft
  14759. @item top
  14760. @item bottomleft
  14761. @item bottom
  14762. @end table
  14763. @item chromalin, cin
  14764. Set the input chroma location.
  14765. Possible values are:
  14766. @table @var
  14767. @item input
  14768. @item left
  14769. @item center
  14770. @item topleft
  14771. @item top
  14772. @item bottomleft
  14773. @item bottom
  14774. @end table
  14775. @item npl
  14776. Set the nominal peak luminance.
  14777. @end table
  14778. The values of the @option{w} and @option{h} options are expressions
  14779. containing the following constants:
  14780. @table @var
  14781. @item in_w
  14782. @item in_h
  14783. The input width and height
  14784. @item iw
  14785. @item ih
  14786. These are the same as @var{in_w} and @var{in_h}.
  14787. @item out_w
  14788. @item out_h
  14789. The output (scaled) width and height
  14790. @item ow
  14791. @item oh
  14792. These are the same as @var{out_w} and @var{out_h}
  14793. @item a
  14794. The same as @var{iw} / @var{ih}
  14795. @item sar
  14796. input sample aspect ratio
  14797. @item dar
  14798. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  14799. @item hsub
  14800. @item vsub
  14801. horizontal and vertical input chroma subsample values. For example for the
  14802. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14803. @item ohsub
  14804. @item ovsub
  14805. horizontal and vertical output chroma subsample values. For example for the
  14806. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14807. @end table
  14808. @table @option
  14809. @end table
  14810. @c man end VIDEO FILTERS
  14811. @chapter OpenCL Video Filters
  14812. @c man begin OPENCL VIDEO FILTERS
  14813. Below is a description of the currently available OpenCL video filters.
  14814. To enable compilation of these filters you need to configure FFmpeg with
  14815. @code{--enable-opencl}.
  14816. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  14817. @table @option
  14818. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  14819. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  14820. given device parameters.
  14821. @item -filter_hw_device @var{name}
  14822. Pass the hardware device called @var{name} to all filters in any filter graph.
  14823. @end table
  14824. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  14825. @itemize
  14826. @item
  14827. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  14828. @example
  14829. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  14830. @end example
  14831. @end itemize
  14832. 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.
  14833. @section avgblur_opencl
  14834. Apply average blur filter.
  14835. The filter accepts the following options:
  14836. @table @option
  14837. @item sizeX
  14838. Set horizontal radius size.
  14839. Range is @code{[1, 1024]} and default value is @code{1}.
  14840. @item planes
  14841. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14842. @item sizeY
  14843. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  14844. @end table
  14845. @subsection Example
  14846. @itemize
  14847. @item
  14848. 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.
  14849. @example
  14850. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  14851. @end example
  14852. @end itemize
  14853. @section boxblur_opencl
  14854. Apply a boxblur algorithm to the input video.
  14855. It accepts the following parameters:
  14856. @table @option
  14857. @item luma_radius, lr
  14858. @item luma_power, lp
  14859. @item chroma_radius, cr
  14860. @item chroma_power, cp
  14861. @item alpha_radius, ar
  14862. @item alpha_power, ap
  14863. @end table
  14864. A description of the accepted options follows.
  14865. @table @option
  14866. @item luma_radius, lr
  14867. @item chroma_radius, cr
  14868. @item alpha_radius, ar
  14869. Set an expression for the box radius in pixels used for blurring the
  14870. corresponding input plane.
  14871. The radius value must be a non-negative number, and must not be
  14872. greater than the value of the expression @code{min(w,h)/2} for the
  14873. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  14874. planes.
  14875. Default value for @option{luma_radius} is "2". If not specified,
  14876. @option{chroma_radius} and @option{alpha_radius} default to the
  14877. corresponding value set for @option{luma_radius}.
  14878. The expressions can contain the following constants:
  14879. @table @option
  14880. @item w
  14881. @item h
  14882. The input width and height in pixels.
  14883. @item cw
  14884. @item ch
  14885. The input chroma image width and height in pixels.
  14886. @item hsub
  14887. @item vsub
  14888. The horizontal and vertical chroma subsample values. For example, for the
  14889. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  14890. @end table
  14891. @item luma_power, lp
  14892. @item chroma_power, cp
  14893. @item alpha_power, ap
  14894. Specify how many times the boxblur filter is applied to the
  14895. corresponding plane.
  14896. Default value for @option{luma_power} is 2. If not specified,
  14897. @option{chroma_power} and @option{alpha_power} default to the
  14898. corresponding value set for @option{luma_power}.
  14899. A value of 0 will disable the effect.
  14900. @end table
  14901. @subsection Examples
  14902. 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.
  14903. @itemize
  14904. @item
  14905. Apply a boxblur filter with the luma, chroma, and alpha radius
  14906. 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.
  14907. @example
  14908. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  14909. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  14910. @end example
  14911. @item
  14912. 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.
  14913. For the luma plane, a 2x2 box radius will be run once.
  14914. For the chroma plane, a 4x4 box radius will be run 5 times.
  14915. For the alpha plane, a 3x3 box radius will be run 7 times.
  14916. @example
  14917. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  14918. @end example
  14919. @end itemize
  14920. @section convolution_opencl
  14921. Apply convolution of 3x3, 5x5, 7x7 matrix.
  14922. The filter accepts the following options:
  14923. @table @option
  14924. @item 0m
  14925. @item 1m
  14926. @item 2m
  14927. @item 3m
  14928. Set matrix for each plane.
  14929. Matrix is sequence of 9, 25 or 49 signed numbers.
  14930. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  14931. @item 0rdiv
  14932. @item 1rdiv
  14933. @item 2rdiv
  14934. @item 3rdiv
  14935. Set multiplier for calculated value for each plane.
  14936. If unset or 0, it will be sum of all matrix elements.
  14937. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  14938. @item 0bias
  14939. @item 1bias
  14940. @item 2bias
  14941. @item 3bias
  14942. Set bias for each plane. This value is added to the result of the multiplication.
  14943. Useful for making the overall image brighter or darker.
  14944. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  14945. @end table
  14946. @subsection Examples
  14947. @itemize
  14948. @item
  14949. Apply sharpen:
  14950. @example
  14951. -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
  14952. @end example
  14953. @item
  14954. Apply blur:
  14955. @example
  14956. -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
  14957. @end example
  14958. @item
  14959. Apply edge enhance:
  14960. @example
  14961. -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
  14962. @end example
  14963. @item
  14964. Apply edge detect:
  14965. @example
  14966. -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
  14967. @end example
  14968. @item
  14969. Apply laplacian edge detector which includes diagonals:
  14970. @example
  14971. -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
  14972. @end example
  14973. @item
  14974. Apply emboss:
  14975. @example
  14976. -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
  14977. @end example
  14978. @end itemize
  14979. @section dilation_opencl
  14980. Apply dilation effect to the video.
  14981. This filter replaces the pixel by the local(3x3) maximum.
  14982. It accepts the following options:
  14983. @table @option
  14984. @item threshold0
  14985. @item threshold1
  14986. @item threshold2
  14987. @item threshold3
  14988. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14989. If @code{0}, plane will remain unchanged.
  14990. @item coordinates
  14991. Flag which specifies the pixel to refer to.
  14992. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14993. Flags to local 3x3 coordinates region centered on @code{x}:
  14994. 1 2 3
  14995. 4 x 5
  14996. 6 7 8
  14997. @end table
  14998. @subsection Example
  14999. @itemize
  15000. @item
  15001. 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.
  15002. @example
  15003. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  15004. @end example
  15005. @end itemize
  15006. @section erosion_opencl
  15007. Apply erosion effect to the video.
  15008. This filter replaces the pixel by the local(3x3) minimum.
  15009. It accepts the following options:
  15010. @table @option
  15011. @item threshold0
  15012. @item threshold1
  15013. @item threshold2
  15014. @item threshold3
  15015. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  15016. If @code{0}, plane will remain unchanged.
  15017. @item coordinates
  15018. Flag which specifies the pixel to refer to.
  15019. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  15020. Flags to local 3x3 coordinates region centered on @code{x}:
  15021. 1 2 3
  15022. 4 x 5
  15023. 6 7 8
  15024. @end table
  15025. @subsection Example
  15026. @itemize
  15027. @item
  15028. 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.
  15029. @example
  15030. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  15031. @end example
  15032. @end itemize
  15033. @section colorkey_opencl
  15034. RGB colorspace color keying.
  15035. The filter accepts the following options:
  15036. @table @option
  15037. @item color
  15038. The color which will be replaced with transparency.
  15039. @item similarity
  15040. Similarity percentage with the key color.
  15041. 0.01 matches only the exact key color, while 1.0 matches everything.
  15042. @item blend
  15043. Blend percentage.
  15044. 0.0 makes pixels either fully transparent, or not transparent at all.
  15045. Higher values result in semi-transparent pixels, with a higher transparency
  15046. the more similar the pixels color is to the key color.
  15047. @end table
  15048. @subsection Examples
  15049. @itemize
  15050. @item
  15051. Make every semi-green pixel in the input transparent with some slight blending:
  15052. @example
  15053. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  15054. @end example
  15055. @end itemize
  15056. @section nlmeans_opencl
  15057. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  15058. @section overlay_opencl
  15059. Overlay one video on top of another.
  15060. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  15061. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  15062. The filter accepts the following options:
  15063. @table @option
  15064. @item x
  15065. Set the x coordinate of the overlaid video on the main video.
  15066. Default value is @code{0}.
  15067. @item y
  15068. Set the x coordinate of the overlaid video on the main video.
  15069. Default value is @code{0}.
  15070. @end table
  15071. @subsection Examples
  15072. @itemize
  15073. @item
  15074. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  15075. @example
  15076. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  15077. @end example
  15078. @item
  15079. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  15080. @example
  15081. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  15082. @end example
  15083. @end itemize
  15084. @section prewitt_opencl
  15085. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  15086. The filter accepts the following option:
  15087. @table @option
  15088. @item planes
  15089. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15090. @item scale
  15091. Set value which will be multiplied with filtered result.
  15092. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15093. @item delta
  15094. Set value which will be added to filtered result.
  15095. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15096. @end table
  15097. @subsection Example
  15098. @itemize
  15099. @item
  15100. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  15101. @example
  15102. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15103. @end example
  15104. @end itemize
  15105. @section roberts_opencl
  15106. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  15107. The filter accepts the following option:
  15108. @table @option
  15109. @item planes
  15110. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15111. @item scale
  15112. Set value which will be multiplied with filtered result.
  15113. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15114. @item delta
  15115. Set value which will be added to filtered result.
  15116. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15117. @end table
  15118. @subsection Example
  15119. @itemize
  15120. @item
  15121. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  15122. @example
  15123. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15124. @end example
  15125. @end itemize
  15126. @section sobel_opencl
  15127. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  15128. The filter accepts the following option:
  15129. @table @option
  15130. @item planes
  15131. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15132. @item scale
  15133. Set value which will be multiplied with filtered result.
  15134. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15135. @item delta
  15136. Set value which will be added to filtered result.
  15137. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15138. @end table
  15139. @subsection Example
  15140. @itemize
  15141. @item
  15142. Apply sobel operator with scale set to 2 and delta set to 10
  15143. @example
  15144. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15145. @end example
  15146. @end itemize
  15147. @section tonemap_opencl
  15148. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  15149. It accepts the following parameters:
  15150. @table @option
  15151. @item tonemap
  15152. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  15153. @item param
  15154. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  15155. @item desat
  15156. Apply desaturation for highlights that exceed this level of brightness. The
  15157. higher the parameter, the more color information will be preserved. This
  15158. setting helps prevent unnaturally blown-out colors for super-highlights, by
  15159. (smoothly) turning into white instead. This makes images feel more natural,
  15160. at the cost of reducing information about out-of-range colors.
  15161. The default value is 0.5, and the algorithm here is a little different from
  15162. the cpu version tonemap currently. A setting of 0.0 disables this option.
  15163. @item threshold
  15164. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  15165. is used to detect whether the scene has changed or not. If the distance between
  15166. the current frame average brightness and the current running average exceeds
  15167. a threshold value, we would re-calculate scene average and peak brightness.
  15168. The default value is 0.2.
  15169. @item format
  15170. Specify the output pixel format.
  15171. Currently supported formats are:
  15172. @table @var
  15173. @item p010
  15174. @item nv12
  15175. @end table
  15176. @item range, r
  15177. Set the output color range.
  15178. Possible values are:
  15179. @table @var
  15180. @item tv/mpeg
  15181. @item pc/jpeg
  15182. @end table
  15183. Default is same as input.
  15184. @item primaries, p
  15185. Set the output color primaries.
  15186. Possible values are:
  15187. @table @var
  15188. @item bt709
  15189. @item bt2020
  15190. @end table
  15191. Default is same as input.
  15192. @item transfer, t
  15193. Set the output transfer characteristics.
  15194. Possible values are:
  15195. @table @var
  15196. @item bt709
  15197. @item bt2020
  15198. @end table
  15199. Default is bt709.
  15200. @item matrix, m
  15201. Set the output colorspace matrix.
  15202. Possible value are:
  15203. @table @var
  15204. @item bt709
  15205. @item bt2020
  15206. @end table
  15207. Default is same as input.
  15208. @end table
  15209. @subsection Example
  15210. @itemize
  15211. @item
  15212. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  15213. @example
  15214. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  15215. @end example
  15216. @end itemize
  15217. @section unsharp_opencl
  15218. Sharpen or blur the input video.
  15219. It accepts the following parameters:
  15220. @table @option
  15221. @item luma_msize_x, lx
  15222. Set the luma matrix horizontal size.
  15223. Range is @code{[1, 23]} and default value is @code{5}.
  15224. @item luma_msize_y, ly
  15225. Set the luma matrix vertical size.
  15226. Range is @code{[1, 23]} and default value is @code{5}.
  15227. @item luma_amount, la
  15228. Set the luma effect strength.
  15229. Range is @code{[-10, 10]} and default value is @code{1.0}.
  15230. Negative values will blur the input video, while positive values will
  15231. sharpen it, a value of zero will disable the effect.
  15232. @item chroma_msize_x, cx
  15233. Set the chroma matrix horizontal size.
  15234. Range is @code{[1, 23]} and default value is @code{5}.
  15235. @item chroma_msize_y, cy
  15236. Set the chroma matrix vertical size.
  15237. Range is @code{[1, 23]} and default value is @code{5}.
  15238. @item chroma_amount, ca
  15239. Set the chroma effect strength.
  15240. Range is @code{[-10, 10]} and default value is @code{0.0}.
  15241. Negative values will blur the input video, while positive values will
  15242. sharpen it, a value of zero will disable the effect.
  15243. @end table
  15244. All parameters are optional and default to the equivalent of the
  15245. string '5:5:1.0:5:5:0.0'.
  15246. @subsection Examples
  15247. @itemize
  15248. @item
  15249. Apply strong luma sharpen effect:
  15250. @example
  15251. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  15252. @end example
  15253. @item
  15254. Apply a strong blur of both luma and chroma parameters:
  15255. @example
  15256. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  15257. @end example
  15258. @end itemize
  15259. @c man end OPENCL VIDEO FILTERS
  15260. @chapter Video Sources
  15261. @c man begin VIDEO SOURCES
  15262. Below is a description of the currently available video sources.
  15263. @section buffer
  15264. Buffer video frames, and make them available to the filter chain.
  15265. This source is mainly intended for a programmatic use, in particular
  15266. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  15267. It accepts the following parameters:
  15268. @table @option
  15269. @item video_size
  15270. Specify the size (width and height) of the buffered video frames. For the
  15271. syntax of this option, check the
  15272. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15273. @item width
  15274. The input video width.
  15275. @item height
  15276. The input video height.
  15277. @item pix_fmt
  15278. A string representing the pixel format of the buffered video frames.
  15279. It may be a number corresponding to a pixel format, or a pixel format
  15280. name.
  15281. @item time_base
  15282. Specify the timebase assumed by the timestamps of the buffered frames.
  15283. @item frame_rate
  15284. Specify the frame rate expected for the video stream.
  15285. @item pixel_aspect, sar
  15286. The sample (pixel) aspect ratio of the input video.
  15287. @item sws_param
  15288. Specify the optional parameters to be used for the scale filter which
  15289. is automatically inserted when an input change is detected in the
  15290. input size or format.
  15291. @item hw_frames_ctx
  15292. When using a hardware pixel format, this should be a reference to an
  15293. AVHWFramesContext describing input frames.
  15294. @end table
  15295. For example:
  15296. @example
  15297. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  15298. @end example
  15299. will instruct the source to accept video frames with size 320x240 and
  15300. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  15301. square pixels (1:1 sample aspect ratio).
  15302. Since the pixel format with name "yuv410p" corresponds to the number 6
  15303. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  15304. this example corresponds to:
  15305. @example
  15306. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  15307. @end example
  15308. Alternatively, the options can be specified as a flat string, but this
  15309. syntax is deprecated:
  15310. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}[:@var{sws_param}]
  15311. @section cellauto
  15312. Create a pattern generated by an elementary cellular automaton.
  15313. The initial state of the cellular automaton can be defined through the
  15314. @option{filename} and @option{pattern} options. If such options are
  15315. not specified an initial state is created randomly.
  15316. At each new frame a new row in the video is filled with the result of
  15317. the cellular automaton next generation. The behavior when the whole
  15318. frame is filled is defined by the @option{scroll} option.
  15319. This source accepts the following options:
  15320. @table @option
  15321. @item filename, f
  15322. Read the initial cellular automaton state, i.e. the starting row, from
  15323. the specified file.
  15324. In the file, each non-whitespace character is considered an alive
  15325. cell, a newline will terminate the row, and further characters in the
  15326. file will be ignored.
  15327. @item pattern, p
  15328. Read the initial cellular automaton state, i.e. the starting row, from
  15329. the specified string.
  15330. Each non-whitespace character in the string is considered an alive
  15331. cell, a newline will terminate the row, and further characters in the
  15332. string will be ignored.
  15333. @item rate, r
  15334. Set the video rate, that is the number of frames generated per second.
  15335. Default is 25.
  15336. @item random_fill_ratio, ratio
  15337. Set the random fill ratio for the initial cellular automaton row. It
  15338. is a floating point number value ranging from 0 to 1, defaults to
  15339. 1/PHI.
  15340. This option is ignored when a file or a pattern is specified.
  15341. @item random_seed, seed
  15342. Set the seed for filling randomly the initial row, must be an integer
  15343. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15344. set to -1, the filter will try to use a good random seed on a best
  15345. effort basis.
  15346. @item rule
  15347. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  15348. Default value is 110.
  15349. @item size, s
  15350. Set the size of the output video. For the syntax of this option, check the
  15351. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15352. If @option{filename} or @option{pattern} is specified, the size is set
  15353. by default to the width of the specified initial state row, and the
  15354. height is set to @var{width} * PHI.
  15355. If @option{size} is set, it must contain the width of the specified
  15356. pattern string, and the specified pattern will be centered in the
  15357. larger row.
  15358. If a filename or a pattern string is not specified, the size value
  15359. defaults to "320x518" (used for a randomly generated initial state).
  15360. @item scroll
  15361. If set to 1, scroll the output upward when all the rows in the output
  15362. have been already filled. If set to 0, the new generated row will be
  15363. written over the top row just after the bottom row is filled.
  15364. Defaults to 1.
  15365. @item start_full, full
  15366. If set to 1, completely fill the output with generated rows before
  15367. outputting the first frame.
  15368. This is the default behavior, for disabling set the value to 0.
  15369. @item stitch
  15370. If set to 1, stitch the left and right row edges together.
  15371. This is the default behavior, for disabling set the value to 0.
  15372. @end table
  15373. @subsection Examples
  15374. @itemize
  15375. @item
  15376. Read the initial state from @file{pattern}, and specify an output of
  15377. size 200x400.
  15378. @example
  15379. cellauto=f=pattern:s=200x400
  15380. @end example
  15381. @item
  15382. Generate a random initial row with a width of 200 cells, with a fill
  15383. ratio of 2/3:
  15384. @example
  15385. cellauto=ratio=2/3:s=200x200
  15386. @end example
  15387. @item
  15388. Create a pattern generated by rule 18 starting by a single alive cell
  15389. centered on an initial row with width 100:
  15390. @example
  15391. cellauto=p=@@:s=100x400:full=0:rule=18
  15392. @end example
  15393. @item
  15394. Specify a more elaborated initial pattern:
  15395. @example
  15396. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  15397. @end example
  15398. @end itemize
  15399. @anchor{coreimagesrc}
  15400. @section coreimagesrc
  15401. Video source generated on GPU using Apple's CoreImage API on OSX.
  15402. This video source is a specialized version of the @ref{coreimage} video filter.
  15403. Use a core image generator at the beginning of the applied filterchain to
  15404. generate the content.
  15405. The coreimagesrc video source accepts the following options:
  15406. @table @option
  15407. @item list_generators
  15408. List all available generators along with all their respective options as well as
  15409. possible minimum and maximum values along with the default values.
  15410. @example
  15411. list_generators=true
  15412. @end example
  15413. @item size, s
  15414. Specify the size of the sourced video. For the syntax of this option, check the
  15415. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15416. The default value is @code{320x240}.
  15417. @item rate, r
  15418. Specify the frame rate of the sourced video, as the number of frames
  15419. generated per second. It has to be a string in the format
  15420. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15421. number or a valid video frame rate abbreviation. The default value is
  15422. "25".
  15423. @item sar
  15424. Set the sample aspect ratio of the sourced video.
  15425. @item duration, d
  15426. Set the duration of the sourced video. See
  15427. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15428. for the accepted syntax.
  15429. If not specified, or the expressed duration is negative, the video is
  15430. supposed to be generated forever.
  15431. @end table
  15432. Additionally, all options of the @ref{coreimage} video filter are accepted.
  15433. A complete filterchain can be used for further processing of the
  15434. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  15435. and examples for details.
  15436. @subsection Examples
  15437. @itemize
  15438. @item
  15439. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  15440. given as complete and escaped command-line for Apple's standard bash shell:
  15441. @example
  15442. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  15443. @end example
  15444. This example is equivalent to the QRCode example of @ref{coreimage} without the
  15445. need for a nullsrc video source.
  15446. @end itemize
  15447. @section mandelbrot
  15448. Generate a Mandelbrot set fractal, and progressively zoom towards the
  15449. point specified with @var{start_x} and @var{start_y}.
  15450. This source accepts the following options:
  15451. @table @option
  15452. @item end_pts
  15453. Set the terminal pts value. Default value is 400.
  15454. @item end_scale
  15455. Set the terminal scale value.
  15456. Must be a floating point value. Default value is 0.3.
  15457. @item inner
  15458. Set the inner coloring mode, that is the algorithm used to draw the
  15459. Mandelbrot fractal internal region.
  15460. It shall assume one of the following values:
  15461. @table @option
  15462. @item black
  15463. Set black mode.
  15464. @item convergence
  15465. Show time until convergence.
  15466. @item mincol
  15467. Set color based on point closest to the origin of the iterations.
  15468. @item period
  15469. Set period mode.
  15470. @end table
  15471. Default value is @var{mincol}.
  15472. @item bailout
  15473. Set the bailout value. Default value is 10.0.
  15474. @item maxiter
  15475. Set the maximum of iterations performed by the rendering
  15476. algorithm. Default value is 7189.
  15477. @item outer
  15478. Set outer coloring mode.
  15479. It shall assume one of following values:
  15480. @table @option
  15481. @item iteration_count
  15482. Set iteration count mode.
  15483. @item normalized_iteration_count
  15484. set normalized iteration count mode.
  15485. @end table
  15486. Default value is @var{normalized_iteration_count}.
  15487. @item rate, r
  15488. Set frame rate, expressed as number of frames per second. Default
  15489. value is "25".
  15490. @item size, s
  15491. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  15492. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  15493. @item start_scale
  15494. Set the initial scale value. Default value is 3.0.
  15495. @item start_x
  15496. Set the initial x position. Must be a floating point value between
  15497. -100 and 100. Default value is -0.743643887037158704752191506114774.
  15498. @item start_y
  15499. Set the initial y position. Must be a floating point value between
  15500. -100 and 100. Default value is -0.131825904205311970493132056385139.
  15501. @end table
  15502. @section mptestsrc
  15503. Generate various test patterns, as generated by the MPlayer test filter.
  15504. The size of the generated video is fixed, and is 256x256.
  15505. This source is useful in particular for testing encoding features.
  15506. This source accepts the following options:
  15507. @table @option
  15508. @item rate, r
  15509. Specify the frame rate of the sourced video, as the number of frames
  15510. generated per second. It has to be a string in the format
  15511. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15512. number or a valid video frame rate abbreviation. The default value is
  15513. "25".
  15514. @item duration, d
  15515. Set the duration of the sourced video. See
  15516. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15517. for the accepted syntax.
  15518. If not specified, or the expressed duration is negative, the video is
  15519. supposed to be generated forever.
  15520. @item test, t
  15521. Set the number or the name of the test to perform. Supported tests are:
  15522. @table @option
  15523. @item dc_luma
  15524. @item dc_chroma
  15525. @item freq_luma
  15526. @item freq_chroma
  15527. @item amp_luma
  15528. @item amp_chroma
  15529. @item cbp
  15530. @item mv
  15531. @item ring1
  15532. @item ring2
  15533. @item all
  15534. @end table
  15535. Default value is "all", which will cycle through the list of all tests.
  15536. @end table
  15537. Some examples:
  15538. @example
  15539. mptestsrc=t=dc_luma
  15540. @end example
  15541. will generate a "dc_luma" test pattern.
  15542. @section frei0r_src
  15543. Provide a frei0r source.
  15544. To enable compilation of this filter you need to install the frei0r
  15545. header and configure FFmpeg with @code{--enable-frei0r}.
  15546. This source accepts the following parameters:
  15547. @table @option
  15548. @item size
  15549. The size of the video to generate. For the syntax of this option, check the
  15550. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15551. @item framerate
  15552. The framerate of the generated video. It may be a string of the form
  15553. @var{num}/@var{den} or a frame rate abbreviation.
  15554. @item filter_name
  15555. The name to the frei0r source to load. For more information regarding frei0r and
  15556. how to set the parameters, read the @ref{frei0r} section in the video filters
  15557. documentation.
  15558. @item filter_params
  15559. A '|'-separated list of parameters to pass to the frei0r source.
  15560. @end table
  15561. For example, to generate a frei0r partik0l source with size 200x200
  15562. and frame rate 10 which is overlaid on the overlay filter main input:
  15563. @example
  15564. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  15565. @end example
  15566. @section life
  15567. Generate a life pattern.
  15568. This source is based on a generalization of John Conway's life game.
  15569. The sourced input represents a life grid, each pixel represents a cell
  15570. which can be in one of two possible states, alive or dead. Every cell
  15571. interacts with its eight neighbours, which are the cells that are
  15572. horizontally, vertically, or diagonally adjacent.
  15573. At each interaction the grid evolves according to the adopted rule,
  15574. which specifies the number of neighbor alive cells which will make a
  15575. cell stay alive or born. The @option{rule} option allows one to specify
  15576. the rule to adopt.
  15577. This source accepts the following options:
  15578. @table @option
  15579. @item filename, f
  15580. Set the file from which to read the initial grid state. In the file,
  15581. each non-whitespace character is considered an alive cell, and newline
  15582. is used to delimit the end of each row.
  15583. If this option is not specified, the initial grid is generated
  15584. randomly.
  15585. @item rate, r
  15586. Set the video rate, that is the number of frames generated per second.
  15587. Default is 25.
  15588. @item random_fill_ratio, ratio
  15589. Set the random fill ratio for the initial random grid. It is a
  15590. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  15591. It is ignored when a file is specified.
  15592. @item random_seed, seed
  15593. Set the seed for filling the initial random grid, must be an integer
  15594. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15595. set to -1, the filter will try to use a good random seed on a best
  15596. effort basis.
  15597. @item rule
  15598. Set the life rule.
  15599. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  15600. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  15601. @var{NS} specifies the number of alive neighbor cells which make a
  15602. live cell stay alive, and @var{NB} the number of alive neighbor cells
  15603. which make a dead cell to become alive (i.e. to "born").
  15604. "s" and "b" can be used in place of "S" and "B", respectively.
  15605. Alternatively a rule can be specified by an 18-bits integer. The 9
  15606. high order bits are used to encode the next cell state if it is alive
  15607. for each number of neighbor alive cells, the low order bits specify
  15608. the rule for "borning" new cells. Higher order bits encode for an
  15609. higher number of neighbor cells.
  15610. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  15611. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  15612. Default value is "S23/B3", which is the original Conway's game of life
  15613. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  15614. cells, and will born a new cell if there are three alive cells around
  15615. a dead cell.
  15616. @item size, s
  15617. Set the size of the output video. For the syntax of this option, check the
  15618. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15619. If @option{filename} is specified, the size is set by default to the
  15620. same size of the input file. If @option{size} is set, it must contain
  15621. the size specified in the input file, and the initial grid defined in
  15622. that file is centered in the larger resulting area.
  15623. If a filename is not specified, the size value defaults to "320x240"
  15624. (used for a randomly generated initial grid).
  15625. @item stitch
  15626. If set to 1, stitch the left and right grid edges together, and the
  15627. top and bottom edges also. Defaults to 1.
  15628. @item mold
  15629. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  15630. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  15631. value from 0 to 255.
  15632. @item life_color
  15633. Set the color of living (or new born) cells.
  15634. @item death_color
  15635. Set the color of dead cells. If @option{mold} is set, this is the first color
  15636. used to represent a dead cell.
  15637. @item mold_color
  15638. Set mold color, for definitely dead and moldy cells.
  15639. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  15640. ffmpeg-utils manual,ffmpeg-utils}.
  15641. @end table
  15642. @subsection Examples
  15643. @itemize
  15644. @item
  15645. Read a grid from @file{pattern}, and center it on a grid of size
  15646. 300x300 pixels:
  15647. @example
  15648. life=f=pattern:s=300x300
  15649. @end example
  15650. @item
  15651. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  15652. @example
  15653. life=ratio=2/3:s=200x200
  15654. @end example
  15655. @item
  15656. Specify a custom rule for evolving a randomly generated grid:
  15657. @example
  15658. life=rule=S14/B34
  15659. @end example
  15660. @item
  15661. Full example with slow death effect (mold) using @command{ffplay}:
  15662. @example
  15663. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  15664. @end example
  15665. @end itemize
  15666. @anchor{allrgb}
  15667. @anchor{allyuv}
  15668. @anchor{color}
  15669. @anchor{haldclutsrc}
  15670. @anchor{nullsrc}
  15671. @anchor{pal75bars}
  15672. @anchor{pal100bars}
  15673. @anchor{rgbtestsrc}
  15674. @anchor{smptebars}
  15675. @anchor{smptehdbars}
  15676. @anchor{testsrc}
  15677. @anchor{testsrc2}
  15678. @anchor{yuvtestsrc}
  15679. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  15680. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  15681. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  15682. The @code{color} source provides an uniformly colored input.
  15683. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  15684. @ref{haldclut} filter.
  15685. The @code{nullsrc} source returns unprocessed video frames. It is
  15686. mainly useful to be employed in analysis / debugging tools, or as the
  15687. source for filters which ignore the input data.
  15688. The @code{pal75bars} source generates a color bars pattern, based on
  15689. EBU PAL recommendations with 75% color levels.
  15690. The @code{pal100bars} source generates a color bars pattern, based on
  15691. EBU PAL recommendations with 100% color levels.
  15692. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  15693. detecting RGB vs BGR issues. You should see a red, green and blue
  15694. stripe from top to bottom.
  15695. The @code{smptebars} source generates a color bars pattern, based on
  15696. the SMPTE Engineering Guideline EG 1-1990.
  15697. The @code{smptehdbars} source generates a color bars pattern, based on
  15698. the SMPTE RP 219-2002.
  15699. The @code{testsrc} source generates a test video pattern, showing a
  15700. color pattern, a scrolling gradient and a timestamp. This is mainly
  15701. intended for testing purposes.
  15702. The @code{testsrc2} source is similar to testsrc, but supports more
  15703. pixel formats instead of just @code{rgb24}. This allows using it as an
  15704. input for other tests without requiring a format conversion.
  15705. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  15706. see a y, cb and cr stripe from top to bottom.
  15707. The sources accept the following parameters:
  15708. @table @option
  15709. @item level
  15710. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  15711. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  15712. pixels to be used as identity matrix for 3D lookup tables. Each component is
  15713. coded on a @code{1/(N*N)} scale.
  15714. @item color, c
  15715. Specify the color of the source, only available in the @code{color}
  15716. source. For the syntax of this option, check the
  15717. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15718. @item size, s
  15719. Specify the size of the sourced video. For the syntax of this option, check the
  15720. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15721. The default value is @code{320x240}.
  15722. This option is not available with the @code{allrgb}, @code{allyuv}, and
  15723. @code{haldclutsrc} filters.
  15724. @item rate, r
  15725. Specify the frame rate of the sourced video, as the number of frames
  15726. generated per second. It has to be a string in the format
  15727. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15728. number or a valid video frame rate abbreviation. The default value is
  15729. "25".
  15730. @item duration, d
  15731. Set the duration of the sourced video. See
  15732. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15733. for the accepted syntax.
  15734. If not specified, or the expressed duration is negative, the video is
  15735. supposed to be generated forever.
  15736. @item sar
  15737. Set the sample aspect ratio of the sourced video.
  15738. @item alpha
  15739. Specify the alpha (opacity) of the background, only available in the
  15740. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  15741. 255 (fully opaque, the default).
  15742. @item decimals, n
  15743. Set the number of decimals to show in the timestamp, only available in the
  15744. @code{testsrc} source.
  15745. The displayed timestamp value will correspond to the original
  15746. timestamp value multiplied by the power of 10 of the specified
  15747. value. Default value is 0.
  15748. @end table
  15749. @subsection Examples
  15750. @itemize
  15751. @item
  15752. Generate a video with a duration of 5.3 seconds, with size
  15753. 176x144 and a frame rate of 10 frames per second:
  15754. @example
  15755. testsrc=duration=5.3:size=qcif:rate=10
  15756. @end example
  15757. @item
  15758. The following graph description will generate a red source
  15759. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  15760. frames per second:
  15761. @example
  15762. color=c=red@@0.2:s=qcif:r=10
  15763. @end example
  15764. @item
  15765. If the input content is to be ignored, @code{nullsrc} can be used. The
  15766. following command generates noise in the luminance plane by employing
  15767. the @code{geq} filter:
  15768. @example
  15769. nullsrc=s=256x256, geq=random(1)*255:128:128
  15770. @end example
  15771. @end itemize
  15772. @subsection Commands
  15773. The @code{color} source supports the following commands:
  15774. @table @option
  15775. @item c, color
  15776. Set the color of the created image. Accepts the same syntax of the
  15777. corresponding @option{color} option.
  15778. @end table
  15779. @section openclsrc
  15780. Generate video using an OpenCL program.
  15781. @table @option
  15782. @item source
  15783. OpenCL program source file.
  15784. @item kernel
  15785. Kernel name in program.
  15786. @item size, s
  15787. Size of frames to generate. This must be set.
  15788. @item format
  15789. Pixel format to use for the generated frames. This must be set.
  15790. @item rate, r
  15791. Number of frames generated every second. Default value is '25'.
  15792. @end table
  15793. For details of how the program loading works, see the @ref{program_opencl}
  15794. filter.
  15795. Example programs:
  15796. @itemize
  15797. @item
  15798. Generate a colour ramp by setting pixel values from the position of the pixel
  15799. in the output image. (Note that this will work with all pixel formats, but
  15800. the generated output will not be the same.)
  15801. @verbatim
  15802. __kernel void ramp(__write_only image2d_t dst,
  15803. unsigned int index)
  15804. {
  15805. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15806. float4 val;
  15807. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  15808. write_imagef(dst, loc, val);
  15809. }
  15810. @end verbatim
  15811. @item
  15812. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  15813. @verbatim
  15814. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  15815. unsigned int index)
  15816. {
  15817. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15818. float4 value = 0.0f;
  15819. int x = loc.x + index;
  15820. int y = loc.y + index;
  15821. while (x > 0 || y > 0) {
  15822. if (x % 3 == 1 && y % 3 == 1) {
  15823. value = 1.0f;
  15824. break;
  15825. }
  15826. x /= 3;
  15827. y /= 3;
  15828. }
  15829. write_imagef(dst, loc, value);
  15830. }
  15831. @end verbatim
  15832. @end itemize
  15833. @c man end VIDEO SOURCES
  15834. @chapter Video Sinks
  15835. @c man begin VIDEO SINKS
  15836. Below is a description of the currently available video sinks.
  15837. @section buffersink
  15838. Buffer video frames, and make them available to the end of the filter
  15839. graph.
  15840. This sink is mainly intended for programmatic use, in particular
  15841. through the interface defined in @file{libavfilter/buffersink.h}
  15842. or the options system.
  15843. It accepts a pointer to an AVBufferSinkContext structure, which
  15844. defines the incoming buffers' formats, to be passed as the opaque
  15845. parameter to @code{avfilter_init_filter} for initialization.
  15846. @section nullsink
  15847. Null video sink: do absolutely nothing with the input video. It is
  15848. mainly useful as a template and for use in analysis / debugging
  15849. tools.
  15850. @c man end VIDEO SINKS
  15851. @chapter Multimedia Filters
  15852. @c man begin MULTIMEDIA FILTERS
  15853. Below is a description of the currently available multimedia filters.
  15854. @section abitscope
  15855. Convert input audio to a video output, displaying the audio bit scope.
  15856. The filter accepts the following options:
  15857. @table @option
  15858. @item rate, r
  15859. Set frame rate, expressed as number of frames per second. Default
  15860. value is "25".
  15861. @item size, s
  15862. Specify the video size for the output. For the syntax of this option, check the
  15863. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15864. Default value is @code{1024x256}.
  15865. @item colors
  15866. Specify list of colors separated by space or by '|' which will be used to
  15867. draw channels. Unrecognized or missing colors will be replaced
  15868. by white color.
  15869. @end table
  15870. @section ahistogram
  15871. Convert input audio to a video output, displaying the volume histogram.
  15872. The filter accepts the following options:
  15873. @table @option
  15874. @item dmode
  15875. Specify how histogram is calculated.
  15876. It accepts the following values:
  15877. @table @samp
  15878. @item single
  15879. Use single histogram for all channels.
  15880. @item separate
  15881. Use separate histogram for each channel.
  15882. @end table
  15883. Default is @code{single}.
  15884. @item rate, r
  15885. Set frame rate, expressed as number of frames per second. Default
  15886. value is "25".
  15887. @item size, s
  15888. Specify the video size for the output. For the syntax of this option, check the
  15889. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15890. Default value is @code{hd720}.
  15891. @item scale
  15892. Set display scale.
  15893. It accepts the following values:
  15894. @table @samp
  15895. @item log
  15896. logarithmic
  15897. @item sqrt
  15898. square root
  15899. @item cbrt
  15900. cubic root
  15901. @item lin
  15902. linear
  15903. @item rlog
  15904. reverse logarithmic
  15905. @end table
  15906. Default is @code{log}.
  15907. @item ascale
  15908. Set amplitude scale.
  15909. It accepts the following values:
  15910. @table @samp
  15911. @item log
  15912. logarithmic
  15913. @item lin
  15914. linear
  15915. @end table
  15916. Default is @code{log}.
  15917. @item acount
  15918. Set how much frames to accumulate in histogram.
  15919. Default is 1. Setting this to -1 accumulates all frames.
  15920. @item rheight
  15921. Set histogram ratio of window height.
  15922. @item slide
  15923. Set sonogram sliding.
  15924. It accepts the following values:
  15925. @table @samp
  15926. @item replace
  15927. replace old rows with new ones.
  15928. @item scroll
  15929. scroll from top to bottom.
  15930. @end table
  15931. Default is @code{replace}.
  15932. @end table
  15933. @section aphasemeter
  15934. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  15935. representing mean phase of current audio frame. A video output can also be produced and is
  15936. enabled by default. The audio is passed through as first output.
  15937. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  15938. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  15939. and @code{1} means channels are in phase.
  15940. The filter accepts the following options, all related to its video output:
  15941. @table @option
  15942. @item rate, r
  15943. Set the output frame rate. Default value is @code{25}.
  15944. @item size, s
  15945. Set the video size for the output. For the syntax of this option, check the
  15946. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15947. Default value is @code{800x400}.
  15948. @item rc
  15949. @item gc
  15950. @item bc
  15951. Specify the red, green, blue contrast. Default values are @code{2},
  15952. @code{7} and @code{1}.
  15953. Allowed range is @code{[0, 255]}.
  15954. @item mpc
  15955. Set color which will be used for drawing median phase. If color is
  15956. @code{none} which is default, no median phase value will be drawn.
  15957. @item video
  15958. Enable video output. Default is enabled.
  15959. @end table
  15960. @section avectorscope
  15961. Convert input audio to a video output, representing the audio vector
  15962. scope.
  15963. The filter is used to measure the difference between channels of stereo
  15964. audio stream. A monoaural signal, consisting of identical left and right
  15965. signal, results in straight vertical line. Any stereo separation is visible
  15966. as a deviation from this line, creating a Lissajous figure.
  15967. If the straight (or deviation from it) but horizontal line appears this
  15968. indicates that the left and right channels are out of phase.
  15969. The filter accepts the following options:
  15970. @table @option
  15971. @item mode, m
  15972. Set the vectorscope mode.
  15973. Available values are:
  15974. @table @samp
  15975. @item lissajous
  15976. Lissajous rotated by 45 degrees.
  15977. @item lissajous_xy
  15978. Same as above but not rotated.
  15979. @item polar
  15980. Shape resembling half of circle.
  15981. @end table
  15982. Default value is @samp{lissajous}.
  15983. @item size, s
  15984. Set the video size for the output. For the syntax of this option, check the
  15985. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15986. Default value is @code{400x400}.
  15987. @item rate, r
  15988. Set the output frame rate. Default value is @code{25}.
  15989. @item rc
  15990. @item gc
  15991. @item bc
  15992. @item ac
  15993. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  15994. @code{160}, @code{80} and @code{255}.
  15995. Allowed range is @code{[0, 255]}.
  15996. @item rf
  15997. @item gf
  15998. @item bf
  15999. @item af
  16000. Specify the red, green, blue and alpha fade. Default values are @code{15},
  16001. @code{10}, @code{5} and @code{5}.
  16002. Allowed range is @code{[0, 255]}.
  16003. @item zoom
  16004. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  16005. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  16006. @item draw
  16007. Set the vectorscope drawing mode.
  16008. Available values are:
  16009. @table @samp
  16010. @item dot
  16011. Draw dot for each sample.
  16012. @item line
  16013. Draw line between previous and current sample.
  16014. @end table
  16015. Default value is @samp{dot}.
  16016. @item scale
  16017. Specify amplitude scale of audio samples.
  16018. Available values are:
  16019. @table @samp
  16020. @item lin
  16021. Linear.
  16022. @item sqrt
  16023. Square root.
  16024. @item cbrt
  16025. Cubic root.
  16026. @item log
  16027. Logarithmic.
  16028. @end table
  16029. @item swap
  16030. Swap left channel axis with right channel axis.
  16031. @item mirror
  16032. Mirror axis.
  16033. @table @samp
  16034. @item none
  16035. No mirror.
  16036. @item x
  16037. Mirror only x axis.
  16038. @item y
  16039. Mirror only y axis.
  16040. @item xy
  16041. Mirror both axis.
  16042. @end table
  16043. @end table
  16044. @subsection Examples
  16045. @itemize
  16046. @item
  16047. Complete example using @command{ffplay}:
  16048. @example
  16049. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  16050. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  16051. @end example
  16052. @end itemize
  16053. @section bench, abench
  16054. Benchmark part of a filtergraph.
  16055. The filter accepts the following options:
  16056. @table @option
  16057. @item action
  16058. Start or stop a timer.
  16059. Available values are:
  16060. @table @samp
  16061. @item start
  16062. Get the current time, set it as frame metadata (using the key
  16063. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  16064. @item stop
  16065. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  16066. the input frame metadata to get the time difference. Time difference, average,
  16067. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  16068. @code{min}) are then printed. The timestamps are expressed in seconds.
  16069. @end table
  16070. @end table
  16071. @subsection Examples
  16072. @itemize
  16073. @item
  16074. Benchmark @ref{selectivecolor} filter:
  16075. @example
  16076. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  16077. @end example
  16078. @end itemize
  16079. @section concat
  16080. Concatenate audio and video streams, joining them together one after the
  16081. other.
  16082. The filter works on segments of synchronized video and audio streams. All
  16083. segments must have the same number of streams of each type, and that will
  16084. also be the number of streams at output.
  16085. The filter accepts the following options:
  16086. @table @option
  16087. @item n
  16088. Set the number of segments. Default is 2.
  16089. @item v
  16090. Set the number of output video streams, that is also the number of video
  16091. streams in each segment. Default is 1.
  16092. @item a
  16093. Set the number of output audio streams, that is also the number of audio
  16094. streams in each segment. Default is 0.
  16095. @item unsafe
  16096. Activate unsafe mode: do not fail if segments have a different format.
  16097. @end table
  16098. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  16099. @var{a} audio outputs.
  16100. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  16101. segment, in the same order as the outputs, then the inputs for the second
  16102. segment, etc.
  16103. Related streams do not always have exactly the same duration, for various
  16104. reasons including codec frame size or sloppy authoring. For that reason,
  16105. related synchronized streams (e.g. a video and its audio track) should be
  16106. concatenated at once. The concat filter will use the duration of the longest
  16107. stream in each segment (except the last one), and if necessary pad shorter
  16108. audio streams with silence.
  16109. For this filter to work correctly, all segments must start at timestamp 0.
  16110. All corresponding streams must have the same parameters in all segments; the
  16111. filtering system will automatically select a common pixel format for video
  16112. streams, and a common sample format, sample rate and channel layout for
  16113. audio streams, but other settings, such as resolution, must be converted
  16114. explicitly by the user.
  16115. Different frame rates are acceptable but will result in variable frame rate
  16116. at output; be sure to configure the output file to handle it.
  16117. @subsection Examples
  16118. @itemize
  16119. @item
  16120. Concatenate an opening, an episode and an ending, all in bilingual version
  16121. (video in stream 0, audio in streams 1 and 2):
  16122. @example
  16123. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  16124. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  16125. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  16126. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  16127. @end example
  16128. @item
  16129. Concatenate two parts, handling audio and video separately, using the
  16130. (a)movie sources, and adjusting the resolution:
  16131. @example
  16132. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  16133. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  16134. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  16135. @end example
  16136. Note that a desync will happen at the stitch if the audio and video streams
  16137. do not have exactly the same duration in the first file.
  16138. @end itemize
  16139. @subsection Commands
  16140. This filter supports the following commands:
  16141. @table @option
  16142. @item next
  16143. Close the current segment and step to the next one
  16144. @end table
  16145. @section drawgraph, adrawgraph
  16146. Draw a graph using input video or audio metadata.
  16147. It accepts the following parameters:
  16148. @table @option
  16149. @item m1
  16150. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  16151. @item fg1
  16152. Set 1st foreground color expression.
  16153. @item m2
  16154. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  16155. @item fg2
  16156. Set 2nd foreground color expression.
  16157. @item m3
  16158. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  16159. @item fg3
  16160. Set 3rd foreground color expression.
  16161. @item m4
  16162. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  16163. @item fg4
  16164. Set 4th foreground color expression.
  16165. @item min
  16166. Set minimal value of metadata value.
  16167. @item max
  16168. Set maximal value of metadata value.
  16169. @item bg
  16170. Set graph background color. Default is white.
  16171. @item mode
  16172. Set graph mode.
  16173. Available values for mode is:
  16174. @table @samp
  16175. @item bar
  16176. @item dot
  16177. @item line
  16178. @end table
  16179. Default is @code{line}.
  16180. @item slide
  16181. Set slide mode.
  16182. Available values for slide is:
  16183. @table @samp
  16184. @item frame
  16185. Draw new frame when right border is reached.
  16186. @item replace
  16187. Replace old columns with new ones.
  16188. @item scroll
  16189. Scroll from right to left.
  16190. @item rscroll
  16191. Scroll from left to right.
  16192. @item picture
  16193. Draw single picture.
  16194. @end table
  16195. Default is @code{frame}.
  16196. @item size
  16197. Set size of graph video. For the syntax of this option, check the
  16198. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16199. The default value is @code{900x256}.
  16200. The foreground color expressions can use the following variables:
  16201. @table @option
  16202. @item MIN
  16203. Minimal value of metadata value.
  16204. @item MAX
  16205. Maximal value of metadata value.
  16206. @item VAL
  16207. Current metadata key value.
  16208. @end table
  16209. The color is defined as 0xAABBGGRR.
  16210. @end table
  16211. Example using metadata from @ref{signalstats} filter:
  16212. @example
  16213. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  16214. @end example
  16215. Example using metadata from @ref{ebur128} filter:
  16216. @example
  16217. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  16218. @end example
  16219. @anchor{ebur128}
  16220. @section ebur128
  16221. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  16222. level. By default, it logs a message at a frequency of 10Hz with the
  16223. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  16224. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  16225. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  16226. sample format is double-precision floating point. The input stream will be converted to
  16227. this specification, if needed. Users may need to insert aformat and/or aresample filters
  16228. after this filter to obtain the original parameters.
  16229. The filter also has a video output (see the @var{video} option) with a real
  16230. time graph to observe the loudness evolution. The graphic contains the logged
  16231. message mentioned above, so it is not printed anymore when this option is set,
  16232. unless the verbose logging is set. The main graphing area contains the
  16233. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  16234. the momentary loudness (400 milliseconds), but can optionally be configured
  16235. to instead display short-term loudness (see @var{gauge}).
  16236. The green area marks a +/- 1LU target range around the target loudness
  16237. (-23LUFS by default, unless modified through @var{target}).
  16238. More information about the Loudness Recommendation EBU R128 on
  16239. @url{http://tech.ebu.ch/loudness}.
  16240. The filter accepts the following options:
  16241. @table @option
  16242. @item video
  16243. Activate the video output. The audio stream is passed unchanged whether this
  16244. option is set or no. The video stream will be the first output stream if
  16245. activated. Default is @code{0}.
  16246. @item size
  16247. Set the video size. This option is for video only. For the syntax of this
  16248. option, check the
  16249. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16250. Default and minimum resolution is @code{640x480}.
  16251. @item meter
  16252. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  16253. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  16254. other integer value between this range is allowed.
  16255. @item metadata
  16256. Set metadata injection. If set to @code{1}, the audio input will be segmented
  16257. into 100ms output frames, each of them containing various loudness information
  16258. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  16259. Default is @code{0}.
  16260. @item framelog
  16261. Force the frame logging level.
  16262. Available values are:
  16263. @table @samp
  16264. @item info
  16265. information logging level
  16266. @item verbose
  16267. verbose logging level
  16268. @end table
  16269. By default, the logging level is set to @var{info}. If the @option{video} or
  16270. the @option{metadata} options are set, it switches to @var{verbose}.
  16271. @item peak
  16272. Set peak mode(s).
  16273. Available modes can be cumulated (the option is a @code{flag} type). Possible
  16274. values are:
  16275. @table @samp
  16276. @item none
  16277. Disable any peak mode (default).
  16278. @item sample
  16279. Enable sample-peak mode.
  16280. Simple peak mode looking for the higher sample value. It logs a message
  16281. for sample-peak (identified by @code{SPK}).
  16282. @item true
  16283. Enable true-peak mode.
  16284. If enabled, the peak lookup is done on an over-sampled version of the input
  16285. stream for better peak accuracy. It logs a message for true-peak.
  16286. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  16287. This mode requires a build with @code{libswresample}.
  16288. @end table
  16289. @item dualmono
  16290. Treat mono input files as "dual mono". If a mono file is intended for playback
  16291. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  16292. If set to @code{true}, this option will compensate for this effect.
  16293. Multi-channel input files are not affected by this option.
  16294. @item panlaw
  16295. Set a specific pan law to be used for the measurement of dual mono files.
  16296. This parameter is optional, and has a default value of -3.01dB.
  16297. @item target
  16298. Set a specific target level (in LUFS) used as relative zero in the visualization.
  16299. This parameter is optional and has a default value of -23LUFS as specified
  16300. by EBU R128. However, material published online may prefer a level of -16LUFS
  16301. (e.g. for use with podcasts or video platforms).
  16302. @item gauge
  16303. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  16304. @code{shortterm}. By default the momentary value will be used, but in certain
  16305. scenarios it may be more useful to observe the short term value instead (e.g.
  16306. live mixing).
  16307. @item scale
  16308. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  16309. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  16310. video output, not the summary or continuous log output.
  16311. @end table
  16312. @subsection Examples
  16313. @itemize
  16314. @item
  16315. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  16316. @example
  16317. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  16318. @end example
  16319. @item
  16320. Run an analysis with @command{ffmpeg}:
  16321. @example
  16322. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  16323. @end example
  16324. @end itemize
  16325. @section interleave, ainterleave
  16326. Temporally interleave frames from several inputs.
  16327. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  16328. These filters read frames from several inputs and send the oldest
  16329. queued frame to the output.
  16330. Input streams must have well defined, monotonically increasing frame
  16331. timestamp values.
  16332. In order to submit one frame to output, these filters need to enqueue
  16333. at least one frame for each input, so they cannot work in case one
  16334. input is not yet terminated and will not receive incoming frames.
  16335. For example consider the case when one input is a @code{select} filter
  16336. which always drops input frames. The @code{interleave} filter will keep
  16337. reading from that input, but it will never be able to send new frames
  16338. to output until the input sends an end-of-stream signal.
  16339. Also, depending on inputs synchronization, the filters will drop
  16340. frames in case one input receives more frames than the other ones, and
  16341. the queue is already filled.
  16342. These filters accept the following options:
  16343. @table @option
  16344. @item nb_inputs, n
  16345. Set the number of different inputs, it is 2 by default.
  16346. @end table
  16347. @subsection Examples
  16348. @itemize
  16349. @item
  16350. Interleave frames belonging to different streams using @command{ffmpeg}:
  16351. @example
  16352. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  16353. @end example
  16354. @item
  16355. Add flickering blur effect:
  16356. @example
  16357. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  16358. @end example
  16359. @end itemize
  16360. @section metadata, ametadata
  16361. Manipulate frame metadata.
  16362. This filter accepts the following options:
  16363. @table @option
  16364. @item mode
  16365. Set mode of operation of the filter.
  16366. Can be one of the following:
  16367. @table @samp
  16368. @item select
  16369. If both @code{value} and @code{key} is set, select frames
  16370. which have such metadata. If only @code{key} is set, select
  16371. every frame that has such key in metadata.
  16372. @item add
  16373. Add new metadata @code{key} and @code{value}. If key is already available
  16374. do nothing.
  16375. @item modify
  16376. Modify value of already present key.
  16377. @item delete
  16378. If @code{value} is set, delete only keys that have such value.
  16379. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  16380. the frame.
  16381. @item print
  16382. Print key and its value if metadata was found. If @code{key} is not set print all
  16383. metadata values available in frame.
  16384. @end table
  16385. @item key
  16386. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  16387. @item value
  16388. Set metadata value which will be used. This option is mandatory for
  16389. @code{modify} and @code{add} mode.
  16390. @item function
  16391. Which function to use when comparing metadata value and @code{value}.
  16392. Can be one of following:
  16393. @table @samp
  16394. @item same_str
  16395. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  16396. @item starts_with
  16397. Values are interpreted as strings, returns true if metadata value starts with
  16398. the @code{value} option string.
  16399. @item less
  16400. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  16401. @item equal
  16402. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  16403. @item greater
  16404. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  16405. @item expr
  16406. Values are interpreted as floats, returns true if expression from option @code{expr}
  16407. evaluates to true.
  16408. @end table
  16409. @item expr
  16410. Set expression which is used when @code{function} is set to @code{expr}.
  16411. The expression is evaluated through the eval API and can contain the following
  16412. constants:
  16413. @table @option
  16414. @item VALUE1
  16415. Float representation of @code{value} from metadata key.
  16416. @item VALUE2
  16417. Float representation of @code{value} as supplied by user in @code{value} option.
  16418. @end table
  16419. @item file
  16420. If specified in @code{print} mode, output is written to the named file. Instead of
  16421. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  16422. for standard output. If @code{file} option is not set, output is written to the log
  16423. with AV_LOG_INFO loglevel.
  16424. @end table
  16425. @subsection Examples
  16426. @itemize
  16427. @item
  16428. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  16429. between 0 and 1.
  16430. @example
  16431. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  16432. @end example
  16433. @item
  16434. Print silencedetect output to file @file{metadata.txt}.
  16435. @example
  16436. silencedetect,ametadata=mode=print:file=metadata.txt
  16437. @end example
  16438. @item
  16439. Direct all metadata to a pipe with file descriptor 4.
  16440. @example
  16441. metadata=mode=print:file='pipe\:4'
  16442. @end example
  16443. @end itemize
  16444. @section perms, aperms
  16445. Set read/write permissions for the output frames.
  16446. These filters are mainly aimed at developers to test direct path in the
  16447. following filter in the filtergraph.
  16448. The filters accept the following options:
  16449. @table @option
  16450. @item mode
  16451. Select the permissions mode.
  16452. It accepts the following values:
  16453. @table @samp
  16454. @item none
  16455. Do nothing. This is the default.
  16456. @item ro
  16457. Set all the output frames read-only.
  16458. @item rw
  16459. Set all the output frames directly writable.
  16460. @item toggle
  16461. Make the frame read-only if writable, and writable if read-only.
  16462. @item random
  16463. Set each output frame read-only or writable randomly.
  16464. @end table
  16465. @item seed
  16466. Set the seed for the @var{random} mode, must be an integer included between
  16467. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  16468. @code{-1}, the filter will try to use a good random seed on a best effort
  16469. basis.
  16470. @end table
  16471. Note: in case of auto-inserted filter between the permission filter and the
  16472. following one, the permission might not be received as expected in that
  16473. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  16474. perms/aperms filter can avoid this problem.
  16475. @section realtime, arealtime
  16476. Slow down filtering to match real time approximately.
  16477. These filters will pause the filtering for a variable amount of time to
  16478. match the output rate with the input timestamps.
  16479. They are similar to the @option{re} option to @code{ffmpeg}.
  16480. They accept the following options:
  16481. @table @option
  16482. @item limit
  16483. Time limit for the pauses. Any pause longer than that will be considered
  16484. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  16485. @item speed
  16486. Speed factor for processing. The value must be a float larger than zero.
  16487. Values larger than 1.0 will result in faster than realtime processing,
  16488. smaller will slow processing down. The @var{limit} is automatically adapted
  16489. accordingly. Default is 1.0.
  16490. A processing speed faster than what is possible without these filters cannot
  16491. be achieved.
  16492. @end table
  16493. @anchor{select}
  16494. @section select, aselect
  16495. Select frames to pass in output.
  16496. This filter accepts the following options:
  16497. @table @option
  16498. @item expr, e
  16499. Set expression, which is evaluated for each input frame.
  16500. If the expression is evaluated to zero, the frame is discarded.
  16501. If the evaluation result is negative or NaN, the frame is sent to the
  16502. first output; otherwise it is sent to the output with index
  16503. @code{ceil(val)-1}, assuming that the input index starts from 0.
  16504. For example a value of @code{1.2} corresponds to the output with index
  16505. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  16506. @item outputs, n
  16507. Set the number of outputs. The output to which to send the selected
  16508. frame is based on the result of the evaluation. Default value is 1.
  16509. @end table
  16510. The expression can contain the following constants:
  16511. @table @option
  16512. @item n
  16513. The (sequential) number of the filtered frame, starting from 0.
  16514. @item selected_n
  16515. The (sequential) number of the selected frame, starting from 0.
  16516. @item prev_selected_n
  16517. The sequential number of the last selected frame. It's NAN if undefined.
  16518. @item TB
  16519. The timebase of the input timestamps.
  16520. @item pts
  16521. The PTS (Presentation TimeStamp) of the filtered video frame,
  16522. expressed in @var{TB} units. It's NAN if undefined.
  16523. @item t
  16524. The PTS of the filtered video frame,
  16525. expressed in seconds. It's NAN if undefined.
  16526. @item prev_pts
  16527. The PTS of the previously filtered video frame. It's NAN if undefined.
  16528. @item prev_selected_pts
  16529. The PTS of the last previously filtered video frame. It's NAN if undefined.
  16530. @item prev_selected_t
  16531. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  16532. @item start_pts
  16533. The PTS of the first video frame in the video. It's NAN if undefined.
  16534. @item start_t
  16535. The time of the first video frame in the video. It's NAN if undefined.
  16536. @item pict_type @emph{(video only)}
  16537. The type of the filtered frame. It can assume one of the following
  16538. values:
  16539. @table @option
  16540. @item I
  16541. @item P
  16542. @item B
  16543. @item S
  16544. @item SI
  16545. @item SP
  16546. @item BI
  16547. @end table
  16548. @item interlace_type @emph{(video only)}
  16549. The frame interlace type. It can assume one of the following values:
  16550. @table @option
  16551. @item PROGRESSIVE
  16552. The frame is progressive (not interlaced).
  16553. @item TOPFIRST
  16554. The frame is top-field-first.
  16555. @item BOTTOMFIRST
  16556. The frame is bottom-field-first.
  16557. @end table
  16558. @item consumed_sample_n @emph{(audio only)}
  16559. the number of selected samples before the current frame
  16560. @item samples_n @emph{(audio only)}
  16561. the number of samples in the current frame
  16562. @item sample_rate @emph{(audio only)}
  16563. the input sample rate
  16564. @item key
  16565. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  16566. @item pos
  16567. the position in the file of the filtered frame, -1 if the information
  16568. is not available (e.g. for synthetic video)
  16569. @item scene @emph{(video only)}
  16570. value between 0 and 1 to indicate a new scene; a low value reflects a low
  16571. probability for the current frame to introduce a new scene, while a higher
  16572. value means the current frame is more likely to be one (see the example below)
  16573. @item concatdec_select
  16574. The concat demuxer can select only part of a concat input file by setting an
  16575. inpoint and an outpoint, but the output packets may not be entirely contained
  16576. in the selected interval. By using this variable, it is possible to skip frames
  16577. generated by the concat demuxer which are not exactly contained in the selected
  16578. interval.
  16579. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  16580. and the @var{lavf.concat.duration} packet metadata values which are also
  16581. present in the decoded frames.
  16582. The @var{concatdec_select} variable is -1 if the frame pts is at least
  16583. start_time and either the duration metadata is missing or the frame pts is less
  16584. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  16585. missing.
  16586. That basically means that an input frame is selected if its pts is within the
  16587. interval set by the concat demuxer.
  16588. @end table
  16589. The default value of the select expression is "1".
  16590. @subsection Examples
  16591. @itemize
  16592. @item
  16593. Select all frames in input:
  16594. @example
  16595. select
  16596. @end example
  16597. The example above is the same as:
  16598. @example
  16599. select=1
  16600. @end example
  16601. @item
  16602. Skip all frames:
  16603. @example
  16604. select=0
  16605. @end example
  16606. @item
  16607. Select only I-frames:
  16608. @example
  16609. select='eq(pict_type\,I)'
  16610. @end example
  16611. @item
  16612. Select one frame every 100:
  16613. @example
  16614. select='not(mod(n\,100))'
  16615. @end example
  16616. @item
  16617. Select only frames contained in the 10-20 time interval:
  16618. @example
  16619. select=between(t\,10\,20)
  16620. @end example
  16621. @item
  16622. Select only I-frames contained in the 10-20 time interval:
  16623. @example
  16624. select=between(t\,10\,20)*eq(pict_type\,I)
  16625. @end example
  16626. @item
  16627. Select frames with a minimum distance of 10 seconds:
  16628. @example
  16629. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  16630. @end example
  16631. @item
  16632. Use aselect to select only audio frames with samples number > 100:
  16633. @example
  16634. aselect='gt(samples_n\,100)'
  16635. @end example
  16636. @item
  16637. Create a mosaic of the first scenes:
  16638. @example
  16639. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  16640. @end example
  16641. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  16642. choice.
  16643. @item
  16644. Send even and odd frames to separate outputs, and compose them:
  16645. @example
  16646. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  16647. @end example
  16648. @item
  16649. Select useful frames from an ffconcat file which is using inpoints and
  16650. outpoints but where the source files are not intra frame only.
  16651. @example
  16652. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  16653. @end example
  16654. @end itemize
  16655. @section sendcmd, asendcmd
  16656. Send commands to filters in the filtergraph.
  16657. These filters read commands to be sent to other filters in the
  16658. filtergraph.
  16659. @code{sendcmd} must be inserted between two video filters,
  16660. @code{asendcmd} must be inserted between two audio filters, but apart
  16661. from that they act the same way.
  16662. The specification of commands can be provided in the filter arguments
  16663. with the @var{commands} option, or in a file specified by the
  16664. @var{filename} option.
  16665. These filters accept the following options:
  16666. @table @option
  16667. @item commands, c
  16668. Set the commands to be read and sent to the other filters.
  16669. @item filename, f
  16670. Set the filename of the commands to be read and sent to the other
  16671. filters.
  16672. @end table
  16673. @subsection Commands syntax
  16674. A commands description consists of a sequence of interval
  16675. specifications, comprising a list of commands to be executed when a
  16676. particular event related to that interval occurs. The occurring event
  16677. is typically the current frame time entering or leaving a given time
  16678. interval.
  16679. An interval is specified by the following syntax:
  16680. @example
  16681. @var{START}[-@var{END}] @var{COMMANDS};
  16682. @end example
  16683. The time interval is specified by the @var{START} and @var{END} times.
  16684. @var{END} is optional and defaults to the maximum time.
  16685. The current frame time is considered within the specified interval if
  16686. it is included in the interval [@var{START}, @var{END}), that is when
  16687. the time is greater or equal to @var{START} and is lesser than
  16688. @var{END}.
  16689. @var{COMMANDS} consists of a sequence of one or more command
  16690. specifications, separated by ",", relating to that interval. The
  16691. syntax of a command specification is given by:
  16692. @example
  16693. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  16694. @end example
  16695. @var{FLAGS} is optional and specifies the type of events relating to
  16696. the time interval which enable sending the specified command, and must
  16697. be a non-null sequence of identifier flags separated by "+" or "|" and
  16698. enclosed between "[" and "]".
  16699. The following flags are recognized:
  16700. @table @option
  16701. @item enter
  16702. The command is sent when the current frame timestamp enters the
  16703. specified interval. In other words, the command is sent when the
  16704. previous frame timestamp was not in the given interval, and the
  16705. current is.
  16706. @item leave
  16707. The command is sent when the current frame timestamp leaves the
  16708. specified interval. In other words, the command is sent when the
  16709. previous frame timestamp was in the given interval, and the
  16710. current is not.
  16711. @end table
  16712. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  16713. assumed.
  16714. @var{TARGET} specifies the target of the command, usually the name of
  16715. the filter class or a specific filter instance name.
  16716. @var{COMMAND} specifies the name of the command for the target filter.
  16717. @var{ARG} is optional and specifies the optional list of argument for
  16718. the given @var{COMMAND}.
  16719. Between one interval specification and another, whitespaces, or
  16720. sequences of characters starting with @code{#} until the end of line,
  16721. are ignored and can be used to annotate comments.
  16722. A simplified BNF description of the commands specification syntax
  16723. follows:
  16724. @example
  16725. @var{COMMAND_FLAG} ::= "enter" | "leave"
  16726. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  16727. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  16728. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  16729. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  16730. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  16731. @end example
  16732. @subsection Examples
  16733. @itemize
  16734. @item
  16735. Specify audio tempo change at second 4:
  16736. @example
  16737. asendcmd=c='4.0 atempo tempo 1.5',atempo
  16738. @end example
  16739. @item
  16740. Target a specific filter instance:
  16741. @example
  16742. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  16743. @end example
  16744. @item
  16745. Specify a list of drawtext and hue commands in a file.
  16746. @example
  16747. # show text in the interval 5-10
  16748. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  16749. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  16750. # desaturate the image in the interval 15-20
  16751. 15.0-20.0 [enter] hue s 0,
  16752. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  16753. [leave] hue s 1,
  16754. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  16755. # apply an exponential saturation fade-out effect, starting from time 25
  16756. 25 [enter] hue s exp(25-t)
  16757. @end example
  16758. A filtergraph allowing to read and process the above command list
  16759. stored in a file @file{test.cmd}, can be specified with:
  16760. @example
  16761. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  16762. @end example
  16763. @end itemize
  16764. @anchor{setpts}
  16765. @section setpts, asetpts
  16766. Change the PTS (presentation timestamp) of the input frames.
  16767. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  16768. This filter accepts the following options:
  16769. @table @option
  16770. @item expr
  16771. The expression which is evaluated for each frame to construct its timestamp.
  16772. @end table
  16773. The expression is evaluated through the eval API and can contain the following
  16774. constants:
  16775. @table @option
  16776. @item FRAME_RATE, FR
  16777. frame rate, only defined for constant frame-rate video
  16778. @item PTS
  16779. The presentation timestamp in input
  16780. @item N
  16781. The count of the input frame for video or the number of consumed samples,
  16782. not including the current frame for audio, starting from 0.
  16783. @item NB_CONSUMED_SAMPLES
  16784. The number of consumed samples, not including the current frame (only
  16785. audio)
  16786. @item NB_SAMPLES, S
  16787. The number of samples in the current frame (only audio)
  16788. @item SAMPLE_RATE, SR
  16789. The audio sample rate.
  16790. @item STARTPTS
  16791. The PTS of the first frame.
  16792. @item STARTT
  16793. the time in seconds of the first frame
  16794. @item INTERLACED
  16795. State whether the current frame is interlaced.
  16796. @item T
  16797. the time in seconds of the current frame
  16798. @item POS
  16799. original position in the file of the frame, or undefined if undefined
  16800. for the current frame
  16801. @item PREV_INPTS
  16802. The previous input PTS.
  16803. @item PREV_INT
  16804. previous input time in seconds
  16805. @item PREV_OUTPTS
  16806. The previous output PTS.
  16807. @item PREV_OUTT
  16808. previous output time in seconds
  16809. @item RTCTIME
  16810. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  16811. instead.
  16812. @item RTCSTART
  16813. The wallclock (RTC) time at the start of the movie in microseconds.
  16814. @item TB
  16815. The timebase of the input timestamps.
  16816. @end table
  16817. @subsection Examples
  16818. @itemize
  16819. @item
  16820. Start counting PTS from zero
  16821. @example
  16822. setpts=PTS-STARTPTS
  16823. @end example
  16824. @item
  16825. Apply fast motion effect:
  16826. @example
  16827. setpts=0.5*PTS
  16828. @end example
  16829. @item
  16830. Apply slow motion effect:
  16831. @example
  16832. setpts=2.0*PTS
  16833. @end example
  16834. @item
  16835. Set fixed rate of 25 frames per second:
  16836. @example
  16837. setpts=N/(25*TB)
  16838. @end example
  16839. @item
  16840. Set fixed rate 25 fps with some jitter:
  16841. @example
  16842. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  16843. @end example
  16844. @item
  16845. Apply an offset of 10 seconds to the input PTS:
  16846. @example
  16847. setpts=PTS+10/TB
  16848. @end example
  16849. @item
  16850. Generate timestamps from a "live source" and rebase onto the current timebase:
  16851. @example
  16852. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  16853. @end example
  16854. @item
  16855. Generate timestamps by counting samples:
  16856. @example
  16857. asetpts=N/SR/TB
  16858. @end example
  16859. @end itemize
  16860. @section setrange
  16861. Force color range for the output video frame.
  16862. The @code{setrange} filter marks the color range property for the
  16863. output frames. It does not change the input frame, but only sets the
  16864. corresponding property, which affects how the frame is treated by
  16865. following filters.
  16866. The filter accepts the following options:
  16867. @table @option
  16868. @item range
  16869. Available values are:
  16870. @table @samp
  16871. @item auto
  16872. Keep the same color range property.
  16873. @item unspecified, unknown
  16874. Set the color range as unspecified.
  16875. @item limited, tv, mpeg
  16876. Set the color range as limited.
  16877. @item full, pc, jpeg
  16878. Set the color range as full.
  16879. @end table
  16880. @end table
  16881. @section settb, asettb
  16882. Set the timebase to use for the output frames timestamps.
  16883. It is mainly useful for testing timebase configuration.
  16884. It accepts the following parameters:
  16885. @table @option
  16886. @item expr, tb
  16887. The expression which is evaluated into the output timebase.
  16888. @end table
  16889. The value for @option{tb} is an arithmetic expression representing a
  16890. rational. The expression can contain the constants "AVTB" (the default
  16891. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  16892. audio only). Default value is "intb".
  16893. @subsection Examples
  16894. @itemize
  16895. @item
  16896. Set the timebase to 1/25:
  16897. @example
  16898. settb=expr=1/25
  16899. @end example
  16900. @item
  16901. Set the timebase to 1/10:
  16902. @example
  16903. settb=expr=0.1
  16904. @end example
  16905. @item
  16906. Set the timebase to 1001/1000:
  16907. @example
  16908. settb=1+0.001
  16909. @end example
  16910. @item
  16911. Set the timebase to 2*intb:
  16912. @example
  16913. settb=2*intb
  16914. @end example
  16915. @item
  16916. Set the default timebase value:
  16917. @example
  16918. settb=AVTB
  16919. @end example
  16920. @end itemize
  16921. @section showcqt
  16922. Convert input audio to a video output representing frequency spectrum
  16923. logarithmically using Brown-Puckette constant Q transform algorithm with
  16924. direct frequency domain coefficient calculation (but the transform itself
  16925. is not really constant Q, instead the Q factor is actually variable/clamped),
  16926. with musical tone scale, from E0 to D#10.
  16927. The filter accepts the following options:
  16928. @table @option
  16929. @item size, s
  16930. Specify the video size for the output. It must be even. For the syntax of this option,
  16931. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16932. Default value is @code{1920x1080}.
  16933. @item fps, rate, r
  16934. Set the output frame rate. Default value is @code{25}.
  16935. @item bar_h
  16936. Set the bargraph height. It must be even. Default value is @code{-1} which
  16937. computes the bargraph height automatically.
  16938. @item axis_h
  16939. Set the axis height. It must be even. Default value is @code{-1} which computes
  16940. the axis height automatically.
  16941. @item sono_h
  16942. Set the sonogram height. It must be even. Default value is @code{-1} which
  16943. computes the sonogram height automatically.
  16944. @item fullhd
  16945. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  16946. instead. Default value is @code{1}.
  16947. @item sono_v, volume
  16948. Specify the sonogram volume expression. It can contain variables:
  16949. @table @option
  16950. @item bar_v
  16951. the @var{bar_v} evaluated expression
  16952. @item frequency, freq, f
  16953. the frequency where it is evaluated
  16954. @item timeclamp, tc
  16955. the value of @var{timeclamp} option
  16956. @end table
  16957. and functions:
  16958. @table @option
  16959. @item a_weighting(f)
  16960. A-weighting of equal loudness
  16961. @item b_weighting(f)
  16962. B-weighting of equal loudness
  16963. @item c_weighting(f)
  16964. C-weighting of equal loudness.
  16965. @end table
  16966. Default value is @code{16}.
  16967. @item bar_v, volume2
  16968. Specify the bargraph volume expression. It can contain variables:
  16969. @table @option
  16970. @item sono_v
  16971. the @var{sono_v} evaluated expression
  16972. @item frequency, freq, f
  16973. the frequency where it is evaluated
  16974. @item timeclamp, tc
  16975. the value of @var{timeclamp} option
  16976. @end table
  16977. and functions:
  16978. @table @option
  16979. @item a_weighting(f)
  16980. A-weighting of equal loudness
  16981. @item b_weighting(f)
  16982. B-weighting of equal loudness
  16983. @item c_weighting(f)
  16984. C-weighting of equal loudness.
  16985. @end table
  16986. Default value is @code{sono_v}.
  16987. @item sono_g, gamma
  16988. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  16989. higher gamma makes the spectrum having more range. Default value is @code{3}.
  16990. Acceptable range is @code{[1, 7]}.
  16991. @item bar_g, gamma2
  16992. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  16993. @code{[1, 7]}.
  16994. @item bar_t
  16995. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  16996. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  16997. @item timeclamp, tc
  16998. Specify the transform timeclamp. At low frequency, there is trade-off between
  16999. accuracy in time domain and frequency domain. If timeclamp is lower,
  17000. event in time domain is represented more accurately (such as fast bass drum),
  17001. otherwise event in frequency domain is represented more accurately
  17002. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  17003. @item attack
  17004. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  17005. limits future samples by applying asymmetric windowing in time domain, useful
  17006. when low latency is required. Accepted range is @code{[0, 1]}.
  17007. @item basefreq
  17008. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  17009. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  17010. @item endfreq
  17011. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  17012. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  17013. @item coeffclamp
  17014. This option is deprecated and ignored.
  17015. @item tlength
  17016. Specify the transform length in time domain. Use this option to control accuracy
  17017. trade-off between time domain and frequency domain at every frequency sample.
  17018. It can contain variables:
  17019. @table @option
  17020. @item frequency, freq, f
  17021. the frequency where it is evaluated
  17022. @item timeclamp, tc
  17023. the value of @var{timeclamp} option.
  17024. @end table
  17025. Default value is @code{384*tc/(384+tc*f)}.
  17026. @item count
  17027. Specify the transform count for every video frame. Default value is @code{6}.
  17028. Acceptable range is @code{[1, 30]}.
  17029. @item fcount
  17030. Specify the transform count for every single pixel. Default value is @code{0},
  17031. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  17032. @item fontfile
  17033. Specify font file for use with freetype to draw the axis. If not specified,
  17034. use embedded font. Note that drawing with font file or embedded font is not
  17035. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  17036. option instead.
  17037. @item font
  17038. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  17039. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  17040. @item fontcolor
  17041. Specify font color expression. This is arithmetic expression that should return
  17042. integer value 0xRRGGBB. It can contain variables:
  17043. @table @option
  17044. @item frequency, freq, f
  17045. the frequency where it is evaluated
  17046. @item timeclamp, tc
  17047. the value of @var{timeclamp} option
  17048. @end table
  17049. and functions:
  17050. @table @option
  17051. @item midi(f)
  17052. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  17053. @item r(x), g(x), b(x)
  17054. red, green, and blue value of intensity x.
  17055. @end table
  17056. Default value is @code{st(0, (midi(f)-59.5)/12);
  17057. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  17058. r(1-ld(1)) + b(ld(1))}.
  17059. @item axisfile
  17060. Specify image file to draw the axis. This option override @var{fontfile} and
  17061. @var{fontcolor} option.
  17062. @item axis, text
  17063. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  17064. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  17065. Default value is @code{1}.
  17066. @item csp
  17067. Set colorspace. The accepted values are:
  17068. @table @samp
  17069. @item unspecified
  17070. Unspecified (default)
  17071. @item bt709
  17072. BT.709
  17073. @item fcc
  17074. FCC
  17075. @item bt470bg
  17076. BT.470BG or BT.601-6 625
  17077. @item smpte170m
  17078. SMPTE-170M or BT.601-6 525
  17079. @item smpte240m
  17080. SMPTE-240M
  17081. @item bt2020ncl
  17082. BT.2020 with non-constant luminance
  17083. @end table
  17084. @item cscheme
  17085. Set spectrogram color scheme. This is list of floating point values with format
  17086. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  17087. The default is @code{1|0.5|0|0|0.5|1}.
  17088. @end table
  17089. @subsection Examples
  17090. @itemize
  17091. @item
  17092. Playing audio while showing the spectrum:
  17093. @example
  17094. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  17095. @end example
  17096. @item
  17097. Same as above, but with frame rate 30 fps:
  17098. @example
  17099. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  17100. @end example
  17101. @item
  17102. Playing at 1280x720:
  17103. @example
  17104. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  17105. @end example
  17106. @item
  17107. Disable sonogram display:
  17108. @example
  17109. sono_h=0
  17110. @end example
  17111. @item
  17112. A1 and its harmonics: A1, A2, (near)E3, A3:
  17113. @example
  17114. 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),
  17115. asplit[a][out1]; [a] showcqt [out0]'
  17116. @end example
  17117. @item
  17118. Same as above, but with more accuracy in frequency domain:
  17119. @example
  17120. 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),
  17121. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  17122. @end example
  17123. @item
  17124. Custom volume:
  17125. @example
  17126. bar_v=10:sono_v=bar_v*a_weighting(f)
  17127. @end example
  17128. @item
  17129. Custom gamma, now spectrum is linear to the amplitude.
  17130. @example
  17131. bar_g=2:sono_g=2
  17132. @end example
  17133. @item
  17134. Custom tlength equation:
  17135. @example
  17136. 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)))'
  17137. @end example
  17138. @item
  17139. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  17140. @example
  17141. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  17142. @end example
  17143. @item
  17144. Custom font using fontconfig:
  17145. @example
  17146. font='Courier New,Monospace,mono|bold'
  17147. @end example
  17148. @item
  17149. Custom frequency range with custom axis using image file:
  17150. @example
  17151. axisfile=myaxis.png:basefreq=40:endfreq=10000
  17152. @end example
  17153. @end itemize
  17154. @section showfreqs
  17155. Convert input audio to video output representing the audio power spectrum.
  17156. Audio amplitude is on Y-axis while frequency is on X-axis.
  17157. The filter accepts the following options:
  17158. @table @option
  17159. @item size, s
  17160. Specify size of video. For the syntax of this option, check the
  17161. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17162. Default is @code{1024x512}.
  17163. @item mode
  17164. Set display mode.
  17165. This set how each frequency bin will be represented.
  17166. It accepts the following values:
  17167. @table @samp
  17168. @item line
  17169. @item bar
  17170. @item dot
  17171. @end table
  17172. Default is @code{bar}.
  17173. @item ascale
  17174. Set amplitude scale.
  17175. It accepts the following values:
  17176. @table @samp
  17177. @item lin
  17178. Linear scale.
  17179. @item sqrt
  17180. Square root scale.
  17181. @item cbrt
  17182. Cubic root scale.
  17183. @item log
  17184. Logarithmic scale.
  17185. @end table
  17186. Default is @code{log}.
  17187. @item fscale
  17188. Set frequency scale.
  17189. It accepts the following values:
  17190. @table @samp
  17191. @item lin
  17192. Linear scale.
  17193. @item log
  17194. Logarithmic scale.
  17195. @item rlog
  17196. Reverse logarithmic scale.
  17197. @end table
  17198. Default is @code{lin}.
  17199. @item win_size
  17200. Set window size. Allowed range is from 16 to 65536.
  17201. Default is @code{2048}
  17202. @item win_func
  17203. Set windowing function.
  17204. It accepts the following values:
  17205. @table @samp
  17206. @item rect
  17207. @item bartlett
  17208. @item hanning
  17209. @item hamming
  17210. @item blackman
  17211. @item welch
  17212. @item flattop
  17213. @item bharris
  17214. @item bnuttall
  17215. @item bhann
  17216. @item sine
  17217. @item nuttall
  17218. @item lanczos
  17219. @item gauss
  17220. @item tukey
  17221. @item dolph
  17222. @item cauchy
  17223. @item parzen
  17224. @item poisson
  17225. @item bohman
  17226. @end table
  17227. Default is @code{hanning}.
  17228. @item overlap
  17229. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17230. which means optimal overlap for selected window function will be picked.
  17231. @item averaging
  17232. Set time averaging. Setting this to 0 will display current maximal peaks.
  17233. Default is @code{1}, which means time averaging is disabled.
  17234. @item colors
  17235. Specify list of colors separated by space or by '|' which will be used to
  17236. draw channel frequencies. Unrecognized or missing colors will be replaced
  17237. by white color.
  17238. @item cmode
  17239. Set channel display mode.
  17240. It accepts the following values:
  17241. @table @samp
  17242. @item combined
  17243. @item separate
  17244. @end table
  17245. Default is @code{combined}.
  17246. @item minamp
  17247. Set minimum amplitude used in @code{log} amplitude scaler.
  17248. @end table
  17249. @section showspatial
  17250. Convert stereo input audio to a video output, representing the spatial relationship
  17251. between two channels.
  17252. The filter accepts the following options:
  17253. @table @option
  17254. @item size, s
  17255. Specify the video size for the output. For the syntax of this option, check the
  17256. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17257. Default value is @code{512x512}.
  17258. @item win_size
  17259. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  17260. @item win_func
  17261. Set window function.
  17262. It accepts the following values:
  17263. @table @samp
  17264. @item rect
  17265. @item bartlett
  17266. @item hann
  17267. @item hanning
  17268. @item hamming
  17269. @item blackman
  17270. @item welch
  17271. @item flattop
  17272. @item bharris
  17273. @item bnuttall
  17274. @item bhann
  17275. @item sine
  17276. @item nuttall
  17277. @item lanczos
  17278. @item gauss
  17279. @item tukey
  17280. @item dolph
  17281. @item cauchy
  17282. @item parzen
  17283. @item poisson
  17284. @item bohman
  17285. @end table
  17286. Default value is @code{hann}.
  17287. @item overlap
  17288. Set ratio of overlap window. Default value is @code{0.5}.
  17289. When value is @code{1} overlap is set to recommended size for specific
  17290. window function currently used.
  17291. @end table
  17292. @anchor{showspectrum}
  17293. @section showspectrum
  17294. Convert input audio to a video output, representing the audio frequency
  17295. spectrum.
  17296. The filter accepts the following options:
  17297. @table @option
  17298. @item size, s
  17299. Specify the video size for the output. For the syntax of this option, check the
  17300. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17301. Default value is @code{640x512}.
  17302. @item slide
  17303. Specify how the spectrum should slide along the window.
  17304. It accepts the following values:
  17305. @table @samp
  17306. @item replace
  17307. the samples start again on the left when they reach the right
  17308. @item scroll
  17309. the samples scroll from right to left
  17310. @item fullframe
  17311. frames are only produced when the samples reach the right
  17312. @item rscroll
  17313. the samples scroll from left to right
  17314. @end table
  17315. Default value is @code{replace}.
  17316. @item mode
  17317. Specify display mode.
  17318. It accepts the following values:
  17319. @table @samp
  17320. @item combined
  17321. all channels are displayed in the same row
  17322. @item separate
  17323. all channels are displayed in separate rows
  17324. @end table
  17325. Default value is @samp{combined}.
  17326. @item color
  17327. Specify display color mode.
  17328. It accepts the following values:
  17329. @table @samp
  17330. @item channel
  17331. each channel is displayed in a separate color
  17332. @item intensity
  17333. each channel is displayed using the same color scheme
  17334. @item rainbow
  17335. each channel is displayed using the rainbow color scheme
  17336. @item moreland
  17337. each channel is displayed using the moreland color scheme
  17338. @item nebulae
  17339. each channel is displayed using the nebulae color scheme
  17340. @item fire
  17341. each channel is displayed using the fire color scheme
  17342. @item fiery
  17343. each channel is displayed using the fiery color scheme
  17344. @item fruit
  17345. each channel is displayed using the fruit color scheme
  17346. @item cool
  17347. each channel is displayed using the cool color scheme
  17348. @item magma
  17349. each channel is displayed using the magma color scheme
  17350. @item green
  17351. each channel is displayed using the green color scheme
  17352. @item viridis
  17353. each channel is displayed using the viridis color scheme
  17354. @item plasma
  17355. each channel is displayed using the plasma color scheme
  17356. @item cividis
  17357. each channel is displayed using the cividis color scheme
  17358. @item terrain
  17359. each channel is displayed using the terrain color scheme
  17360. @end table
  17361. Default value is @samp{channel}.
  17362. @item scale
  17363. Specify scale used for calculating intensity color values.
  17364. It accepts the following values:
  17365. @table @samp
  17366. @item lin
  17367. linear
  17368. @item sqrt
  17369. square root, default
  17370. @item cbrt
  17371. cubic root
  17372. @item log
  17373. logarithmic
  17374. @item 4thrt
  17375. 4th root
  17376. @item 5thrt
  17377. 5th root
  17378. @end table
  17379. Default value is @samp{sqrt}.
  17380. @item fscale
  17381. Specify frequency scale.
  17382. It accepts the following values:
  17383. @table @samp
  17384. @item lin
  17385. linear
  17386. @item log
  17387. logarithmic
  17388. @end table
  17389. Default value is @samp{lin}.
  17390. @item saturation
  17391. Set saturation modifier for displayed colors. Negative values provide
  17392. alternative color scheme. @code{0} is no saturation at all.
  17393. Saturation must be in [-10.0, 10.0] range.
  17394. Default value is @code{1}.
  17395. @item win_func
  17396. Set window function.
  17397. It accepts the following values:
  17398. @table @samp
  17399. @item rect
  17400. @item bartlett
  17401. @item hann
  17402. @item hanning
  17403. @item hamming
  17404. @item blackman
  17405. @item welch
  17406. @item flattop
  17407. @item bharris
  17408. @item bnuttall
  17409. @item bhann
  17410. @item sine
  17411. @item nuttall
  17412. @item lanczos
  17413. @item gauss
  17414. @item tukey
  17415. @item dolph
  17416. @item cauchy
  17417. @item parzen
  17418. @item poisson
  17419. @item bohman
  17420. @end table
  17421. Default value is @code{hann}.
  17422. @item orientation
  17423. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17424. @code{horizontal}. Default is @code{vertical}.
  17425. @item overlap
  17426. Set ratio of overlap window. Default value is @code{0}.
  17427. When value is @code{1} overlap is set to recommended size for specific
  17428. window function currently used.
  17429. @item gain
  17430. Set scale gain for calculating intensity color values.
  17431. Default value is @code{1}.
  17432. @item data
  17433. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  17434. @item rotation
  17435. Set color rotation, must be in [-1.0, 1.0] range.
  17436. Default value is @code{0}.
  17437. @item start
  17438. Set start frequency from which to display spectrogram. Default is @code{0}.
  17439. @item stop
  17440. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17441. @item fps
  17442. Set upper frame rate limit. Default is @code{auto}, unlimited.
  17443. @item legend
  17444. Draw time and frequency axes and legends. Default is disabled.
  17445. @end table
  17446. The usage is very similar to the showwaves filter; see the examples in that
  17447. section.
  17448. @subsection Examples
  17449. @itemize
  17450. @item
  17451. Large window with logarithmic color scaling:
  17452. @example
  17453. showspectrum=s=1280x480:scale=log
  17454. @end example
  17455. @item
  17456. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  17457. @example
  17458. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  17459. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  17460. @end example
  17461. @end itemize
  17462. @section showspectrumpic
  17463. Convert input audio to a single video frame, representing the audio frequency
  17464. spectrum.
  17465. The filter accepts the following options:
  17466. @table @option
  17467. @item size, s
  17468. Specify the video size for the output. For the syntax of this option, check the
  17469. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17470. Default value is @code{4096x2048}.
  17471. @item mode
  17472. Specify display mode.
  17473. It accepts the following values:
  17474. @table @samp
  17475. @item combined
  17476. all channels are displayed in the same row
  17477. @item separate
  17478. all channels are displayed in separate rows
  17479. @end table
  17480. Default value is @samp{combined}.
  17481. @item color
  17482. Specify display color mode.
  17483. It accepts the following values:
  17484. @table @samp
  17485. @item channel
  17486. each channel is displayed in a separate color
  17487. @item intensity
  17488. each channel is displayed using the same color scheme
  17489. @item rainbow
  17490. each channel is displayed using the rainbow color scheme
  17491. @item moreland
  17492. each channel is displayed using the moreland color scheme
  17493. @item nebulae
  17494. each channel is displayed using the nebulae color scheme
  17495. @item fire
  17496. each channel is displayed using the fire color scheme
  17497. @item fiery
  17498. each channel is displayed using the fiery color scheme
  17499. @item fruit
  17500. each channel is displayed using the fruit color scheme
  17501. @item cool
  17502. each channel is displayed using the cool color scheme
  17503. @item magma
  17504. each channel is displayed using the magma color scheme
  17505. @item green
  17506. each channel is displayed using the green color scheme
  17507. @item viridis
  17508. each channel is displayed using the viridis color scheme
  17509. @item plasma
  17510. each channel is displayed using the plasma color scheme
  17511. @item cividis
  17512. each channel is displayed using the cividis color scheme
  17513. @item terrain
  17514. each channel is displayed using the terrain color scheme
  17515. @end table
  17516. Default value is @samp{intensity}.
  17517. @item scale
  17518. Specify scale used for calculating intensity color values.
  17519. It accepts the following values:
  17520. @table @samp
  17521. @item lin
  17522. linear
  17523. @item sqrt
  17524. square root, default
  17525. @item cbrt
  17526. cubic root
  17527. @item log
  17528. logarithmic
  17529. @item 4thrt
  17530. 4th root
  17531. @item 5thrt
  17532. 5th root
  17533. @end table
  17534. Default value is @samp{log}.
  17535. @item fscale
  17536. Specify frequency scale.
  17537. It accepts the following values:
  17538. @table @samp
  17539. @item lin
  17540. linear
  17541. @item log
  17542. logarithmic
  17543. @end table
  17544. Default value is @samp{lin}.
  17545. @item saturation
  17546. Set saturation modifier for displayed colors. Negative values provide
  17547. alternative color scheme. @code{0} is no saturation at all.
  17548. Saturation must be in [-10.0, 10.0] range.
  17549. Default value is @code{1}.
  17550. @item win_func
  17551. Set window function.
  17552. It accepts the following values:
  17553. @table @samp
  17554. @item rect
  17555. @item bartlett
  17556. @item hann
  17557. @item hanning
  17558. @item hamming
  17559. @item blackman
  17560. @item welch
  17561. @item flattop
  17562. @item bharris
  17563. @item bnuttall
  17564. @item bhann
  17565. @item sine
  17566. @item nuttall
  17567. @item lanczos
  17568. @item gauss
  17569. @item tukey
  17570. @item dolph
  17571. @item cauchy
  17572. @item parzen
  17573. @item poisson
  17574. @item bohman
  17575. @end table
  17576. Default value is @code{hann}.
  17577. @item orientation
  17578. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17579. @code{horizontal}. Default is @code{vertical}.
  17580. @item gain
  17581. Set scale gain for calculating intensity color values.
  17582. Default value is @code{1}.
  17583. @item legend
  17584. Draw time and frequency axes and legends. Default is enabled.
  17585. @item rotation
  17586. Set color rotation, must be in [-1.0, 1.0] range.
  17587. Default value is @code{0}.
  17588. @item start
  17589. Set start frequency from which to display spectrogram. Default is @code{0}.
  17590. @item stop
  17591. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17592. @end table
  17593. @subsection Examples
  17594. @itemize
  17595. @item
  17596. Extract an audio spectrogram of a whole audio track
  17597. in a 1024x1024 picture using @command{ffmpeg}:
  17598. @example
  17599. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  17600. @end example
  17601. @end itemize
  17602. @section showvolume
  17603. Convert input audio volume to a video output.
  17604. The filter accepts the following options:
  17605. @table @option
  17606. @item rate, r
  17607. Set video rate.
  17608. @item b
  17609. Set border width, allowed range is [0, 5]. Default is 1.
  17610. @item w
  17611. Set channel width, allowed range is [80, 8192]. Default is 400.
  17612. @item h
  17613. Set channel height, allowed range is [1, 900]. Default is 20.
  17614. @item f
  17615. Set fade, allowed range is [0, 1]. Default is 0.95.
  17616. @item c
  17617. Set volume color expression.
  17618. The expression can use the following variables:
  17619. @table @option
  17620. @item VOLUME
  17621. Current max volume of channel in dB.
  17622. @item PEAK
  17623. Current peak.
  17624. @item CHANNEL
  17625. Current channel number, starting from 0.
  17626. @end table
  17627. @item t
  17628. If set, displays channel names. Default is enabled.
  17629. @item v
  17630. If set, displays volume values. Default is enabled.
  17631. @item o
  17632. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  17633. default is @code{h}.
  17634. @item s
  17635. Set step size, allowed range is [0, 5]. Default is 0, which means
  17636. step is disabled.
  17637. @item p
  17638. Set background opacity, allowed range is [0, 1]. Default is 0.
  17639. @item m
  17640. Set metering mode, can be peak: @code{p} or rms: @code{r},
  17641. default is @code{p}.
  17642. @item ds
  17643. Set display scale, can be linear: @code{lin} or log: @code{log},
  17644. default is @code{lin}.
  17645. @item dm
  17646. In second.
  17647. If set to > 0., display a line for the max level
  17648. in the previous seconds.
  17649. default is disabled: @code{0.}
  17650. @item dmc
  17651. The color of the max line. Use when @code{dm} option is set to > 0.
  17652. default is: @code{orange}
  17653. @end table
  17654. @section showwaves
  17655. Convert input audio to a video output, representing the samples waves.
  17656. The filter accepts the following options:
  17657. @table @option
  17658. @item size, s
  17659. Specify the video size for the output. For the syntax of this option, check the
  17660. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17661. Default value is @code{600x240}.
  17662. @item mode
  17663. Set display mode.
  17664. Available values are:
  17665. @table @samp
  17666. @item point
  17667. Draw a point for each sample.
  17668. @item line
  17669. Draw a vertical line for each sample.
  17670. @item p2p
  17671. Draw a point for each sample and a line between them.
  17672. @item cline
  17673. Draw a centered vertical line for each sample.
  17674. @end table
  17675. Default value is @code{point}.
  17676. @item n
  17677. Set the number of samples which are printed on the same column. A
  17678. larger value will decrease the frame rate. Must be a positive
  17679. integer. This option can be set only if the value for @var{rate}
  17680. is not explicitly specified.
  17681. @item rate, r
  17682. Set the (approximate) output frame rate. This is done by setting the
  17683. option @var{n}. Default value is "25".
  17684. @item split_channels
  17685. Set if channels should be drawn separately or overlap. Default value is 0.
  17686. @item colors
  17687. Set colors separated by '|' which are going to be used for drawing of each channel.
  17688. @item scale
  17689. Set amplitude scale.
  17690. Available values are:
  17691. @table @samp
  17692. @item lin
  17693. Linear.
  17694. @item log
  17695. Logarithmic.
  17696. @item sqrt
  17697. Square root.
  17698. @item cbrt
  17699. Cubic root.
  17700. @end table
  17701. Default is linear.
  17702. @item draw
  17703. Set the draw mode. This is mostly useful to set for high @var{n}.
  17704. Available values are:
  17705. @table @samp
  17706. @item scale
  17707. Scale pixel values for each drawn sample.
  17708. @item full
  17709. Draw every sample directly.
  17710. @end table
  17711. Default value is @code{scale}.
  17712. @end table
  17713. @subsection Examples
  17714. @itemize
  17715. @item
  17716. Output the input file audio and the corresponding video representation
  17717. at the same time:
  17718. @example
  17719. amovie=a.mp3,asplit[out0],showwaves[out1]
  17720. @end example
  17721. @item
  17722. Create a synthetic signal and show it with showwaves, forcing a
  17723. frame rate of 30 frames per second:
  17724. @example
  17725. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  17726. @end example
  17727. @end itemize
  17728. @section showwavespic
  17729. Convert input audio to a single video frame, representing the samples waves.
  17730. The filter accepts the following options:
  17731. @table @option
  17732. @item size, s
  17733. Specify the video size for the output. For the syntax of this option, check the
  17734. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17735. Default value is @code{600x240}.
  17736. @item split_channels
  17737. Set if channels should be drawn separately or overlap. Default value is 0.
  17738. @item colors
  17739. Set colors separated by '|' which are going to be used for drawing of each channel.
  17740. @item scale
  17741. Set amplitude scale.
  17742. Available values are:
  17743. @table @samp
  17744. @item lin
  17745. Linear.
  17746. @item log
  17747. Logarithmic.
  17748. @item sqrt
  17749. Square root.
  17750. @item cbrt
  17751. Cubic root.
  17752. @end table
  17753. Default is linear.
  17754. @item draw
  17755. Set the draw mode.
  17756. Available values are:
  17757. @table @samp
  17758. @item scale
  17759. Scale pixel values for each drawn sample.
  17760. @item full
  17761. Draw every sample directly.
  17762. @end table
  17763. Default value is @code{scale}.
  17764. @end table
  17765. @subsection Examples
  17766. @itemize
  17767. @item
  17768. Extract a channel split representation of the wave form of a whole audio track
  17769. in a 1024x800 picture using @command{ffmpeg}:
  17770. @example
  17771. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  17772. @end example
  17773. @end itemize
  17774. @section sidedata, asidedata
  17775. Delete frame side data, or select frames based on it.
  17776. This filter accepts the following options:
  17777. @table @option
  17778. @item mode
  17779. Set mode of operation of the filter.
  17780. Can be one of the following:
  17781. @table @samp
  17782. @item select
  17783. Select every frame with side data of @code{type}.
  17784. @item delete
  17785. Delete side data of @code{type}. If @code{type} is not set, delete all side
  17786. data in the frame.
  17787. @end table
  17788. @item type
  17789. Set side data type used with all modes. Must be set for @code{select} mode. For
  17790. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  17791. in @file{libavutil/frame.h}. For example, to choose
  17792. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  17793. @end table
  17794. @section spectrumsynth
  17795. Sythesize audio from 2 input video spectrums, first input stream represents
  17796. magnitude across time and second represents phase across time.
  17797. The filter will transform from frequency domain as displayed in videos back
  17798. to time domain as presented in audio output.
  17799. This filter is primarily created for reversing processed @ref{showspectrum}
  17800. filter outputs, but can synthesize sound from other spectrograms too.
  17801. But in such case results are going to be poor if the phase data is not
  17802. available, because in such cases phase data need to be recreated, usually
  17803. it's just recreated from random noise.
  17804. For best results use gray only output (@code{channel} color mode in
  17805. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  17806. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  17807. @code{data} option. Inputs videos should generally use @code{fullframe}
  17808. slide mode as that saves resources needed for decoding video.
  17809. The filter accepts the following options:
  17810. @table @option
  17811. @item sample_rate
  17812. Specify sample rate of output audio, the sample rate of audio from which
  17813. spectrum was generated may differ.
  17814. @item channels
  17815. Set number of channels represented in input video spectrums.
  17816. @item scale
  17817. Set scale which was used when generating magnitude input spectrum.
  17818. Can be @code{lin} or @code{log}. Default is @code{log}.
  17819. @item slide
  17820. Set slide which was used when generating inputs spectrums.
  17821. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  17822. Default is @code{fullframe}.
  17823. @item win_func
  17824. Set window function used for resynthesis.
  17825. @item overlap
  17826. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17827. which means optimal overlap for selected window function will be picked.
  17828. @item orientation
  17829. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  17830. Default is @code{vertical}.
  17831. @end table
  17832. @subsection Examples
  17833. @itemize
  17834. @item
  17835. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  17836. then resynthesize videos back to audio with spectrumsynth:
  17837. @example
  17838. 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
  17839. 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
  17840. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  17841. @end example
  17842. @end itemize
  17843. @section split, asplit
  17844. Split input into several identical outputs.
  17845. @code{asplit} works with audio input, @code{split} with video.
  17846. The filter accepts a single parameter which specifies the number of outputs. If
  17847. unspecified, it defaults to 2.
  17848. @subsection Examples
  17849. @itemize
  17850. @item
  17851. Create two separate outputs from the same input:
  17852. @example
  17853. [in] split [out0][out1]
  17854. @end example
  17855. @item
  17856. To create 3 or more outputs, you need to specify the number of
  17857. outputs, like in:
  17858. @example
  17859. [in] asplit=3 [out0][out1][out2]
  17860. @end example
  17861. @item
  17862. Create two separate outputs from the same input, one cropped and
  17863. one padded:
  17864. @example
  17865. [in] split [splitout1][splitout2];
  17866. [splitout1] crop=100:100:0:0 [cropout];
  17867. [splitout2] pad=200:200:100:100 [padout];
  17868. @end example
  17869. @item
  17870. Create 5 copies of the input audio with @command{ffmpeg}:
  17871. @example
  17872. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  17873. @end example
  17874. @end itemize
  17875. @section zmq, azmq
  17876. Receive commands sent through a libzmq client, and forward them to
  17877. filters in the filtergraph.
  17878. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  17879. must be inserted between two video filters, @code{azmq} between two
  17880. audio filters. Both are capable to send messages to any filter type.
  17881. To enable these filters you need to install the libzmq library and
  17882. headers and configure FFmpeg with @code{--enable-libzmq}.
  17883. For more information about libzmq see:
  17884. @url{http://www.zeromq.org/}
  17885. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  17886. receives messages sent through a network interface defined by the
  17887. @option{bind_address} (or the abbreviation "@option{b}") option.
  17888. Default value of this option is @file{tcp://localhost:5555}. You may
  17889. want to alter this value to your needs, but do not forget to escape any
  17890. ':' signs (see @ref{filtergraph escaping}).
  17891. The received message must be in the form:
  17892. @example
  17893. @var{TARGET} @var{COMMAND} [@var{ARG}]
  17894. @end example
  17895. @var{TARGET} specifies the target of the command, usually the name of
  17896. the filter class or a specific filter instance name. The default
  17897. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  17898. but you can override this by using the @samp{filter_name@@id} syntax
  17899. (see @ref{Filtergraph syntax}).
  17900. @var{COMMAND} specifies the name of the command for the target filter.
  17901. @var{ARG} is optional and specifies the optional argument list for the
  17902. given @var{COMMAND}.
  17903. Upon reception, the message is processed and the corresponding command
  17904. is injected into the filtergraph. Depending on the result, the filter
  17905. will send a reply to the client, adopting the format:
  17906. @example
  17907. @var{ERROR_CODE} @var{ERROR_REASON}
  17908. @var{MESSAGE}
  17909. @end example
  17910. @var{MESSAGE} is optional.
  17911. @subsection Examples
  17912. Look at @file{tools/zmqsend} for an example of a zmq client which can
  17913. be used to send commands processed by these filters.
  17914. Consider the following filtergraph generated by @command{ffplay}.
  17915. In this example the last overlay filter has an instance name. All other
  17916. filters will have default instance names.
  17917. @example
  17918. ffplay -dumpgraph 1 -f lavfi "
  17919. color=s=100x100:c=red [l];
  17920. color=s=100x100:c=blue [r];
  17921. nullsrc=s=200x100, zmq [bg];
  17922. [bg][l] overlay [bg+l];
  17923. [bg+l][r] overlay@@my=x=100 "
  17924. @end example
  17925. To change the color of the left side of the video, the following
  17926. command can be used:
  17927. @example
  17928. echo Parsed_color_0 c yellow | tools/zmqsend
  17929. @end example
  17930. To change the right side:
  17931. @example
  17932. echo Parsed_color_1 c pink | tools/zmqsend
  17933. @end example
  17934. To change the position of the right side:
  17935. @example
  17936. echo overlay@@my x 150 | tools/zmqsend
  17937. @end example
  17938. @c man end MULTIMEDIA FILTERS
  17939. @chapter Multimedia Sources
  17940. @c man begin MULTIMEDIA SOURCES
  17941. Below is a description of the currently available multimedia sources.
  17942. @section amovie
  17943. This is the same as @ref{movie} source, except it selects an audio
  17944. stream by default.
  17945. @anchor{movie}
  17946. @section movie
  17947. Read audio and/or video stream(s) from a movie container.
  17948. It accepts the following parameters:
  17949. @table @option
  17950. @item filename
  17951. The name of the resource to read (not necessarily a file; it can also be a
  17952. device or a stream accessed through some protocol).
  17953. @item format_name, f
  17954. Specifies the format assumed for the movie to read, and can be either
  17955. the name of a container or an input device. If not specified, the
  17956. format is guessed from @var{movie_name} or by probing.
  17957. @item seek_point, sp
  17958. Specifies the seek point in seconds. The frames will be output
  17959. starting from this seek point. The parameter is evaluated with
  17960. @code{av_strtod}, so the numerical value may be suffixed by an IS
  17961. postfix. The default value is "0".
  17962. @item streams, s
  17963. Specifies the streams to read. Several streams can be specified,
  17964. separated by "+". The source will then have as many outputs, in the
  17965. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  17966. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  17967. respectively the default (best suited) video and audio stream. Default
  17968. is "dv", or "da" if the filter is called as "amovie".
  17969. @item stream_index, si
  17970. Specifies the index of the video stream to read. If the value is -1,
  17971. the most suitable video stream will be automatically selected. The default
  17972. value is "-1". Deprecated. If the filter is called "amovie", it will select
  17973. audio instead of video.
  17974. @item loop
  17975. Specifies how many times to read the stream in sequence.
  17976. If the value is 0, the stream will be looped infinitely.
  17977. Default value is "1".
  17978. Note that when the movie is looped the source timestamps are not
  17979. changed, so it will generate non monotonically increasing timestamps.
  17980. @item discontinuity
  17981. Specifies the time difference between frames above which the point is
  17982. considered a timestamp discontinuity which is removed by adjusting the later
  17983. timestamps.
  17984. @end table
  17985. It allows overlaying a second video on top of the main input of
  17986. a filtergraph, as shown in this graph:
  17987. @example
  17988. input -----------> deltapts0 --> overlay --> output
  17989. ^
  17990. |
  17991. movie --> scale--> deltapts1 -------+
  17992. @end example
  17993. @subsection Examples
  17994. @itemize
  17995. @item
  17996. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  17997. on top of the input labelled "in":
  17998. @example
  17999. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  18000. [in] setpts=PTS-STARTPTS [main];
  18001. [main][over] overlay=16:16 [out]
  18002. @end example
  18003. @item
  18004. Read from a video4linux2 device, and overlay it on top of the input
  18005. labelled "in":
  18006. @example
  18007. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  18008. [in] setpts=PTS-STARTPTS [main];
  18009. [main][over] overlay=16:16 [out]
  18010. @end example
  18011. @item
  18012. Read the first video stream and the audio stream with id 0x81 from
  18013. dvd.vob; the video is connected to the pad named "video" and the audio is
  18014. connected to the pad named "audio":
  18015. @example
  18016. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  18017. @end example
  18018. @end itemize
  18019. @subsection Commands
  18020. Both movie and amovie support the following commands:
  18021. @table @option
  18022. @item seek
  18023. Perform seek using "av_seek_frame".
  18024. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  18025. @itemize
  18026. @item
  18027. @var{stream_index}: If stream_index is -1, a default
  18028. stream is selected, and @var{timestamp} is automatically converted
  18029. from AV_TIME_BASE units to the stream specific time_base.
  18030. @item
  18031. @var{timestamp}: Timestamp in AVStream.time_base units
  18032. or, if no stream is specified, in AV_TIME_BASE units.
  18033. @item
  18034. @var{flags}: Flags which select direction and seeking mode.
  18035. @end itemize
  18036. @item get_duration
  18037. Get movie duration in AV_TIME_BASE units.
  18038. @end table
  18039. @c man end MULTIMEDIA SOURCES