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.

20872 lines
554KB

  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 threshold
  315. If a signal of stream rises above this level it will affect the gain
  316. reduction.
  317. By default it is 0.125. Range is between 0.00097563 and 1.
  318. @item ratio
  319. Set a ratio by which the signal is reduced. 1:2 means that if the level
  320. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  321. Default is 2. Range is between 1 and 20.
  322. @item attack
  323. Amount of milliseconds the signal has to rise above the threshold before gain
  324. reduction starts. Default is 20. Range is between 0.01 and 2000.
  325. @item release
  326. Amount of milliseconds the signal has to fall below the threshold before
  327. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  328. @item makeup
  329. Set the amount by how much signal will be amplified after processing.
  330. Default is 1. Range is from 1 to 64.
  331. @item knee
  332. Curve the sharp knee around the threshold to enter gain reduction more softly.
  333. Default is 2.82843. Range is between 1 and 8.
  334. @item link
  335. Choose if the @code{average} level between all channels of input stream
  336. or the louder(@code{maximum}) channel of input stream affects the
  337. reduction. Default is @code{average}.
  338. @item detection
  339. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  340. of @code{rms}. Default is @code{rms} which is mostly smoother.
  341. @item mix
  342. How much to use compressed signal in output. Default is 1.
  343. Range is between 0 and 1.
  344. @end table
  345. @section acontrast
  346. Simple audio dynamic range commpression/expansion filter.
  347. The filter accepts the following options:
  348. @table @option
  349. @item contrast
  350. Set contrast. Default is 33. Allowed range is between 0 and 100.
  351. @end table
  352. @section acopy
  353. Copy the input audio source unchanged to the output. This is mainly useful for
  354. testing purposes.
  355. @section acrossfade
  356. Apply cross fade from one input audio stream to another input audio stream.
  357. The cross fade is applied for specified duration near the end of first stream.
  358. The filter accepts the following options:
  359. @table @option
  360. @item nb_samples, ns
  361. Specify the number of samples for which the cross fade effect has to last.
  362. At the end of the cross fade effect the first input audio will be completely
  363. silent. Default is 44100.
  364. @item duration, d
  365. Specify the duration of the cross fade effect. See
  366. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  367. for the accepted syntax.
  368. By default the duration is determined by @var{nb_samples}.
  369. If set this option is used instead of @var{nb_samples}.
  370. @item overlap, o
  371. Should first stream end overlap with second stream start. Default is enabled.
  372. @item curve1
  373. Set curve for cross fade transition for first stream.
  374. @item curve2
  375. Set curve for cross fade transition for second stream.
  376. For description of available curve types see @ref{afade} filter description.
  377. @end table
  378. @subsection Examples
  379. @itemize
  380. @item
  381. Cross fade from one input to another:
  382. @example
  383. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  384. @end example
  385. @item
  386. Cross fade from one input to another but without overlapping:
  387. @example
  388. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  389. @end example
  390. @end itemize
  391. @section acrusher
  392. Reduce audio bit resolution.
  393. This filter is bit crusher with enhanced functionality. A bit crusher
  394. is used to audibly reduce number of bits an audio signal is sampled
  395. with. This doesn't change the bit depth at all, it just produces the
  396. effect. Material reduced in bit depth sounds more harsh and "digital".
  397. This filter is able to even round to continuous values instead of discrete
  398. bit depths.
  399. Additionally it has a D/C offset which results in different crushing of
  400. the lower and the upper half of the signal.
  401. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  402. Another feature of this filter is the logarithmic mode.
  403. This setting switches from linear distances between bits to logarithmic ones.
  404. The result is a much more "natural" sounding crusher which doesn't gate low
  405. signals for example. The human ear has a logarithmic perception,
  406. so this kind of crushing is much more pleasant.
  407. Logarithmic crushing is also able to get anti-aliased.
  408. The filter accepts the following options:
  409. @table @option
  410. @item level_in
  411. Set level in.
  412. @item level_out
  413. Set level out.
  414. @item bits
  415. Set bit reduction.
  416. @item mix
  417. Set mixing amount.
  418. @item mode
  419. Can be linear: @code{lin} or logarithmic: @code{log}.
  420. @item dc
  421. Set DC.
  422. @item aa
  423. Set anti-aliasing.
  424. @item samples
  425. Set sample reduction.
  426. @item lfo
  427. Enable LFO. By default disabled.
  428. @item lforange
  429. Set LFO range.
  430. @item lforate
  431. Set LFO rate.
  432. @end table
  433. @section adeclick
  434. Remove impulsive noise from input audio.
  435. Samples detected as impulsive noise are replaced by interpolated samples using
  436. autoregressive modelling.
  437. @table @option
  438. @item w
  439. Set window size, in milliseconds. Allowed range is from @code{10} to
  440. @code{100}. Default value is @code{55} milliseconds.
  441. This sets size of window which will be processed at once.
  442. @item o
  443. Set window overlap, in percentage of window size. Allowed range is from
  444. @code{50} to @code{95}. Default value is @code{75} percent.
  445. Setting this to a very high value increases impulsive noise removal but makes
  446. whole process much slower.
  447. @item a
  448. Set autoregression order, in percentage of window size. Allowed range is from
  449. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  450. controls quality of interpolated samples using neighbour good samples.
  451. @item t
  452. Set threshold value. Allowed range is from @code{1} to @code{100}.
  453. Default value is @code{2}.
  454. This controls the strength of impulsive noise which is going to be removed.
  455. The lower value, the more samples will be detected as impulsive noise.
  456. @item b
  457. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  458. @code{10}. Default value is @code{2}.
  459. If any two samples deteced as noise are spaced less than this value then any
  460. sample inbetween those two samples will be also detected as noise.
  461. @item m
  462. Set overlap method.
  463. It accepts the following values:
  464. @table @option
  465. @item a
  466. Select overlap-add method. Even not interpolated samples are slightly
  467. changed with this method.
  468. @item s
  469. Select overlap-save method. Not interpolated samples remain unchanged.
  470. @end table
  471. Default value is @code{a}.
  472. @end table
  473. @section adeclip
  474. Remove clipped samples from input audio.
  475. Samples detected as clipped are replaced by interpolated samples using
  476. autoregressive modelling.
  477. @table @option
  478. @item w
  479. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  480. Default value is @code{55} milliseconds.
  481. This sets size of window which will be processed at once.
  482. @item o
  483. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  484. to @code{95}. Default value is @code{75} percent.
  485. @item a
  486. Set autoregression order, in percentage of window size. Allowed range is from
  487. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  488. quality of interpolated samples using neighbour good samples.
  489. @item t
  490. Set threshold value. Allowed range is from @code{1} to @code{100}.
  491. Default value is @code{10}. Higher values make clip detection less aggressive.
  492. @item n
  493. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  494. Default value is @code{1000}. Higher values make clip detection less aggressive.
  495. @item m
  496. Set overlap method.
  497. It accepts the following values:
  498. @table @option
  499. @item a
  500. Select overlap-add method. Even not interpolated samples are slightly changed
  501. with this method.
  502. @item s
  503. Select overlap-save method. Not interpolated samples remain unchanged.
  504. @end table
  505. Default value is @code{a}.
  506. @end table
  507. @section adelay
  508. Delay one or more audio channels.
  509. Samples in delayed channel are filled with silence.
  510. The filter accepts the following option:
  511. @table @option
  512. @item delays
  513. Set list of delays in milliseconds for each channel separated by '|'.
  514. Unused delays will be silently ignored. If number of given delays is
  515. smaller than number of channels all remaining channels will not be delayed.
  516. If you want to delay exact number of samples, append 'S' to number.
  517. @end table
  518. @subsection Examples
  519. @itemize
  520. @item
  521. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  522. the second channel (and any other channels that may be present) unchanged.
  523. @example
  524. adelay=1500|0|500
  525. @end example
  526. @item
  527. Delay second channel by 500 samples, the third channel by 700 samples and leave
  528. the first channel (and any other channels that may be present) unchanged.
  529. @example
  530. adelay=0|500S|700S
  531. @end example
  532. @end itemize
  533. @section aderivative, aintegral
  534. Compute derivative/integral of audio stream.
  535. Applying both filters one after another produces original audio.
  536. @section aecho
  537. Apply echoing to the input audio.
  538. Echoes are reflected sound and can occur naturally amongst mountains
  539. (and sometimes large buildings) when talking or shouting; digital echo
  540. effects emulate this behaviour and are often used to help fill out the
  541. sound of a single instrument or vocal. The time difference between the
  542. original signal and the reflection is the @code{delay}, and the
  543. loudness of the reflected signal is the @code{decay}.
  544. Multiple echoes can have different delays and decays.
  545. A description of the accepted parameters follows.
  546. @table @option
  547. @item in_gain
  548. Set input gain of reflected signal. Default is @code{0.6}.
  549. @item out_gain
  550. Set output gain of reflected signal. Default is @code{0.3}.
  551. @item delays
  552. Set list of time intervals in milliseconds between original signal and reflections
  553. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  554. Default is @code{1000}.
  555. @item decays
  556. Set list of loudness of reflected signals separated by '|'.
  557. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  558. Default is @code{0.5}.
  559. @end table
  560. @subsection Examples
  561. @itemize
  562. @item
  563. Make it sound as if there are twice as many instruments as are actually playing:
  564. @example
  565. aecho=0.8:0.88:60:0.4
  566. @end example
  567. @item
  568. If delay is very short, then it sound like a (metallic) robot playing music:
  569. @example
  570. aecho=0.8:0.88:6:0.4
  571. @end example
  572. @item
  573. A longer delay will sound like an open air concert in the mountains:
  574. @example
  575. aecho=0.8:0.9:1000:0.3
  576. @end example
  577. @item
  578. Same as above but with one more mountain:
  579. @example
  580. aecho=0.8:0.9:1000|1800:0.3|0.25
  581. @end example
  582. @end itemize
  583. @section aemphasis
  584. Audio emphasis filter creates or restores material directly taken from LPs or
  585. emphased CDs with different filter curves. E.g. to store music on vinyl the
  586. signal has to be altered by a filter first to even out the disadvantages of
  587. this recording medium.
  588. Once the material is played back the inverse filter has to be applied to
  589. restore the distortion of the frequency response.
  590. The filter accepts the following options:
  591. @table @option
  592. @item level_in
  593. Set input gain.
  594. @item level_out
  595. Set output gain.
  596. @item mode
  597. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  598. use @code{production} mode. Default is @code{reproduction} mode.
  599. @item type
  600. Set filter type. Selects medium. Can be one of the following:
  601. @table @option
  602. @item col
  603. select Columbia.
  604. @item emi
  605. select EMI.
  606. @item bsi
  607. select BSI (78RPM).
  608. @item riaa
  609. select RIAA.
  610. @item cd
  611. select Compact Disc (CD).
  612. @item 50fm
  613. select 50µs (FM).
  614. @item 75fm
  615. select 75µs (FM).
  616. @item 50kf
  617. select 50µs (FM-KF).
  618. @item 75kf
  619. select 75µs (FM-KF).
  620. @end table
  621. @end table
  622. @section aeval
  623. Modify an audio signal according to the specified expressions.
  624. This filter accepts one or more expressions (one for each channel),
  625. which are evaluated and used to modify a corresponding audio signal.
  626. It accepts the following parameters:
  627. @table @option
  628. @item exprs
  629. Set the '|'-separated expressions list for each separate channel. If
  630. the number of input channels is greater than the number of
  631. expressions, the last specified expression is used for the remaining
  632. output channels.
  633. @item channel_layout, c
  634. Set output channel layout. If not specified, the channel layout is
  635. specified by the number of expressions. If set to @samp{same}, it will
  636. use by default the same input channel layout.
  637. @end table
  638. Each expression in @var{exprs} can contain the following constants and functions:
  639. @table @option
  640. @item ch
  641. channel number of the current expression
  642. @item n
  643. number of the evaluated sample, starting from 0
  644. @item s
  645. sample rate
  646. @item t
  647. time of the evaluated sample expressed in seconds
  648. @item nb_in_channels
  649. @item nb_out_channels
  650. input and output number of channels
  651. @item val(CH)
  652. the value of input channel with number @var{CH}
  653. @end table
  654. Note: this filter is slow. For faster processing you should use a
  655. dedicated filter.
  656. @subsection Examples
  657. @itemize
  658. @item
  659. Half volume:
  660. @example
  661. aeval=val(ch)/2:c=same
  662. @end example
  663. @item
  664. Invert phase of the second channel:
  665. @example
  666. aeval=val(0)|-val(1)
  667. @end example
  668. @end itemize
  669. @anchor{afade}
  670. @section afade
  671. Apply fade-in/out effect to input audio.
  672. A description of the accepted parameters follows.
  673. @table @option
  674. @item type, t
  675. Specify the effect type, can be either @code{in} for fade-in, or
  676. @code{out} for a fade-out effect. Default is @code{in}.
  677. @item start_sample, ss
  678. Specify the number of the start sample for starting to apply the fade
  679. effect. Default is 0.
  680. @item nb_samples, ns
  681. Specify the number of samples for which the fade effect has to last. At
  682. the end of the fade-in effect the output audio will have the same
  683. volume as the input audio, at the end of the fade-out transition
  684. the output audio will be silence. Default is 44100.
  685. @item start_time, st
  686. Specify the start time of the fade effect. Default is 0.
  687. The value must be specified as a time duration; see
  688. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  689. for the accepted syntax.
  690. If set this option is used instead of @var{start_sample}.
  691. @item duration, d
  692. Specify the duration of the fade effect. See
  693. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  694. for the accepted syntax.
  695. At the end of the fade-in effect the output audio will have the same
  696. volume as the input audio, at the end of the fade-out transition
  697. the output audio will be silence.
  698. By default the duration is determined by @var{nb_samples}.
  699. If set this option is used instead of @var{nb_samples}.
  700. @item curve
  701. Set curve for fade transition.
  702. It accepts the following values:
  703. @table @option
  704. @item tri
  705. select triangular, linear slope (default)
  706. @item qsin
  707. select quarter of sine wave
  708. @item hsin
  709. select half of sine wave
  710. @item esin
  711. select exponential sine wave
  712. @item log
  713. select logarithmic
  714. @item ipar
  715. select inverted parabola
  716. @item qua
  717. select quadratic
  718. @item cub
  719. select cubic
  720. @item squ
  721. select square root
  722. @item cbr
  723. select cubic root
  724. @item par
  725. select parabola
  726. @item exp
  727. select exponential
  728. @item iqsin
  729. select inverted quarter of sine wave
  730. @item ihsin
  731. select inverted half of sine wave
  732. @item dese
  733. select double-exponential seat
  734. @item desi
  735. select double-exponential sigmoid
  736. @end table
  737. @end table
  738. @subsection Examples
  739. @itemize
  740. @item
  741. Fade in first 15 seconds of audio:
  742. @example
  743. afade=t=in:ss=0:d=15
  744. @end example
  745. @item
  746. Fade out last 25 seconds of a 900 seconds audio:
  747. @example
  748. afade=t=out:st=875:d=25
  749. @end example
  750. @end itemize
  751. @section afftfilt
  752. Apply arbitrary expressions to samples in frequency domain.
  753. @table @option
  754. @item real
  755. Set frequency domain real expression for each separate channel separated
  756. by '|'. Default is "1".
  757. If the number of input channels is greater than the number of
  758. expressions, the last specified expression is used for the remaining
  759. output channels.
  760. @item imag
  761. Set frequency domain imaginary expression for each separate channel
  762. separated by '|'. If not set, @var{real} option is used.
  763. Each expression in @var{real} and @var{imag} can contain the following
  764. constants:
  765. @table @option
  766. @item sr
  767. sample rate
  768. @item b
  769. current frequency bin number
  770. @item nb
  771. number of available bins
  772. @item ch
  773. channel number of the current expression
  774. @item chs
  775. number of channels
  776. @item pts
  777. current frame pts
  778. @end table
  779. @item win_size
  780. Set window size.
  781. It accepts the following values:
  782. @table @samp
  783. @item w16
  784. @item w32
  785. @item w64
  786. @item w128
  787. @item w256
  788. @item w512
  789. @item w1024
  790. @item w2048
  791. @item w4096
  792. @item w8192
  793. @item w16384
  794. @item w32768
  795. @item w65536
  796. @end table
  797. Default is @code{w4096}
  798. @item win_func
  799. Set window function. Default is @code{hann}.
  800. @item overlap
  801. Set window overlap. If set to 1, the recommended overlap for selected
  802. window function will be picked. Default is @code{0.75}.
  803. @end table
  804. @subsection Examples
  805. @itemize
  806. @item
  807. Leave almost only low frequencies in audio:
  808. @example
  809. afftfilt="1-clip((b/nb)*b,0,1)"
  810. @end example
  811. @end itemize
  812. @anchor{afir}
  813. @section afir
  814. Apply an arbitrary Frequency Impulse Response filter.
  815. This filter is designed for applying long FIR filters,
  816. up to 30 seconds long.
  817. It can be used as component for digital crossover filters,
  818. room equalization, cross talk cancellation, wavefield synthesis,
  819. auralization, ambiophonics and ambisonics.
  820. This filter uses second stream as FIR coefficients.
  821. If second stream holds single channel, it will be used
  822. for all input channels in first stream, otherwise
  823. number of channels in second stream must be same as
  824. number of channels in first stream.
  825. It accepts the following parameters:
  826. @table @option
  827. @item dry
  828. Set dry gain. This sets input gain.
  829. @item wet
  830. Set wet gain. This sets final output gain.
  831. @item length
  832. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  833. @item again
  834. Enable applying gain measured from power of IR.
  835. @item maxir
  836. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  837. Allowed range is 0.1 to 60 seconds.
  838. @item response
  839. Show IR frequency reponse, magnitude and phase in additional video stream.
  840. By default it is disabled.
  841. @item channel
  842. Set for which IR channel to display frequency response. By default is first channel
  843. displayed. This option is used only when @var{response} is enabled.
  844. @item size
  845. Set video stream size. This option is used only when @var{response} is enabled.
  846. @end table
  847. @subsection Examples
  848. @itemize
  849. @item
  850. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  851. @example
  852. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  853. @end example
  854. @end itemize
  855. @anchor{aformat}
  856. @section aformat
  857. Set output format constraints for the input audio. The framework will
  858. negotiate the most appropriate format to minimize conversions.
  859. It accepts the following parameters:
  860. @table @option
  861. @item sample_fmts
  862. A '|'-separated list of requested sample formats.
  863. @item sample_rates
  864. A '|'-separated list of requested sample rates.
  865. @item channel_layouts
  866. A '|'-separated list of requested channel layouts.
  867. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  868. for the required syntax.
  869. @end table
  870. If a parameter is omitted, all values are allowed.
  871. Force the output to either unsigned 8-bit or signed 16-bit stereo
  872. @example
  873. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  874. @end example
  875. @section agate
  876. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  877. processing reduces disturbing noise between useful signals.
  878. Gating is done by detecting the volume below a chosen level @var{threshold}
  879. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  880. floor is set via @var{range}. Because an exact manipulation of the signal
  881. would cause distortion of the waveform the reduction can be levelled over
  882. time. This is done by setting @var{attack} and @var{release}.
  883. @var{attack} determines how long the signal has to fall below the threshold
  884. before any reduction will occur and @var{release} sets the time the signal
  885. has to rise above the threshold to reduce the reduction again.
  886. Shorter signals than the chosen attack time will be left untouched.
  887. @table @option
  888. @item level_in
  889. Set input level before filtering.
  890. Default is 1. Allowed range is from 0.015625 to 64.
  891. @item range
  892. Set the level of gain reduction when the signal is below the threshold.
  893. Default is 0.06125. Allowed range is from 0 to 1.
  894. @item threshold
  895. If a signal rises above this level the gain reduction is released.
  896. Default is 0.125. Allowed range is from 0 to 1.
  897. @item ratio
  898. Set a ratio by which the signal is reduced.
  899. Default is 2. Allowed range is from 1 to 9000.
  900. @item attack
  901. Amount of milliseconds the signal has to rise above the threshold before gain
  902. reduction stops.
  903. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  904. @item release
  905. Amount of milliseconds the signal has to fall below the threshold before the
  906. reduction is increased again. Default is 250 milliseconds.
  907. Allowed range is from 0.01 to 9000.
  908. @item makeup
  909. Set amount of amplification of signal after processing.
  910. Default is 1. Allowed range is from 1 to 64.
  911. @item knee
  912. Curve the sharp knee around the threshold to enter gain reduction more softly.
  913. Default is 2.828427125. Allowed range is from 1 to 8.
  914. @item detection
  915. Choose if exact signal should be taken for detection or an RMS like one.
  916. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  917. @item link
  918. Choose if the average level between all channels or the louder channel affects
  919. the reduction.
  920. Default is @code{average}. Can be @code{average} or @code{maximum}.
  921. @end table
  922. @section aiir
  923. Apply an arbitrary Infinite Impulse Response filter.
  924. It accepts the following parameters:
  925. @table @option
  926. @item z
  927. Set numerator/zeros coefficients.
  928. @item p
  929. Set denominator/poles coefficients.
  930. @item k
  931. Set channels gains.
  932. @item dry_gain
  933. Set input gain.
  934. @item wet_gain
  935. Set output gain.
  936. @item f
  937. Set coefficients format.
  938. @table @samp
  939. @item tf
  940. transfer function
  941. @item zp
  942. Z-plane zeros/poles, cartesian (default)
  943. @item pr
  944. Z-plane zeros/poles, polar radians
  945. @item pd
  946. Z-plane zeros/poles, polar degrees
  947. @end table
  948. @item r
  949. Set kind of processing.
  950. Can be @code{d} - direct or @code{s} - serial cascading. Defauls is @code{s}.
  951. @item e
  952. Set filtering precision.
  953. @table @samp
  954. @item dbl
  955. double-precision floating-point (default)
  956. @item flt
  957. single-precision floating-point
  958. @item i32
  959. 32-bit integers
  960. @item i16
  961. 16-bit integers
  962. @end table
  963. @item response
  964. Show IR frequency reponse, magnitude and phase in additional video stream.
  965. By default it is disabled.
  966. @item channel
  967. Set for which IR channel to display frequency response. By default is first channel
  968. displayed. This option is used only when @var{response} is enabled.
  969. @item size
  970. Set video stream size. This option is used only when @var{response} is enabled.
  971. @end table
  972. Coefficients in @code{tf} format are separated by spaces and are in ascending
  973. order.
  974. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  975. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  976. imaginary unit.
  977. Different coefficients and gains can be provided for every channel, in such case
  978. use '|' to separate coefficients or gains. Last provided coefficients will be
  979. used for all remaining channels.
  980. @subsection Examples
  981. @itemize
  982. @item
  983. Apply 2 pole elliptic notch at arround 5000Hz for 48000 Hz sample rate:
  984. @example
  985. 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
  986. @end example
  987. @item
  988. Same as above but in @code{zp} format:
  989. @example
  990. 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
  991. @end example
  992. @end itemize
  993. @section alimiter
  994. The limiter prevents an input signal from rising over a desired threshold.
  995. This limiter uses lookahead technology to prevent your signal from distorting.
  996. It means that there is a small delay after the signal is processed. Keep in mind
  997. that the delay it produces is the attack time you set.
  998. The filter accepts the following options:
  999. @table @option
  1000. @item level_in
  1001. Set input gain. Default is 1.
  1002. @item level_out
  1003. Set output gain. Default is 1.
  1004. @item limit
  1005. Don't let signals above this level pass the limiter. Default is 1.
  1006. @item attack
  1007. The limiter will reach its attenuation level in this amount of time in
  1008. milliseconds. Default is 5 milliseconds.
  1009. @item release
  1010. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1011. Default is 50 milliseconds.
  1012. @item asc
  1013. When gain reduction is always needed ASC takes care of releasing to an
  1014. average reduction level rather than reaching a reduction of 0 in the release
  1015. time.
  1016. @item asc_level
  1017. Select how much the release time is affected by ASC, 0 means nearly no changes
  1018. in release time while 1 produces higher release times.
  1019. @item level
  1020. Auto level output signal. Default is enabled.
  1021. This normalizes audio back to 0dB if enabled.
  1022. @end table
  1023. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1024. with @ref{aresample} before applying this filter.
  1025. @section allpass
  1026. Apply a two-pole all-pass filter with central frequency (in Hz)
  1027. @var{frequency}, and filter-width @var{width}.
  1028. An all-pass filter changes the audio's frequency to phase relationship
  1029. without changing its frequency to amplitude relationship.
  1030. The filter accepts the following options:
  1031. @table @option
  1032. @item frequency, f
  1033. Set frequency in Hz.
  1034. @item width_type, t
  1035. Set method to specify band-width of filter.
  1036. @table @option
  1037. @item h
  1038. Hz
  1039. @item q
  1040. Q-Factor
  1041. @item o
  1042. octave
  1043. @item s
  1044. slope
  1045. @item k
  1046. kHz
  1047. @end table
  1048. @item width, w
  1049. Specify the band-width of a filter in width_type units.
  1050. @item channels, c
  1051. Specify which channels to filter, by default all available are filtered.
  1052. @end table
  1053. @subsection Commands
  1054. This filter supports the following commands:
  1055. @table @option
  1056. @item frequency, f
  1057. Change allpass frequency.
  1058. Syntax for the command is : "@var{frequency}"
  1059. @item width_type, t
  1060. Change allpass width_type.
  1061. Syntax for the command is : "@var{width_type}"
  1062. @item width, w
  1063. Change allpass width.
  1064. Syntax for the command is : "@var{width}"
  1065. @end table
  1066. @section aloop
  1067. Loop audio samples.
  1068. The filter accepts the following options:
  1069. @table @option
  1070. @item loop
  1071. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1072. Default is 0.
  1073. @item size
  1074. Set maximal number of samples. Default is 0.
  1075. @item start
  1076. Set first sample of loop. Default is 0.
  1077. @end table
  1078. @anchor{amerge}
  1079. @section amerge
  1080. Merge two or more audio streams into a single multi-channel stream.
  1081. The filter accepts the following options:
  1082. @table @option
  1083. @item inputs
  1084. Set the number of inputs. Default is 2.
  1085. @end table
  1086. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1087. the channel layout of the output will be set accordingly and the channels
  1088. will be reordered as necessary. If the channel layouts of the inputs are not
  1089. disjoint, the output will have all the channels of the first input then all
  1090. the channels of the second input, in that order, and the channel layout of
  1091. the output will be the default value corresponding to the total number of
  1092. channels.
  1093. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1094. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1095. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1096. first input, b1 is the first channel of the second input).
  1097. On the other hand, if both input are in stereo, the output channels will be
  1098. in the default order: a1, a2, b1, b2, and the channel layout will be
  1099. arbitrarily set to 4.0, which may or may not be the expected value.
  1100. All inputs must have the same sample rate, and format.
  1101. If inputs do not have the same duration, the output will stop with the
  1102. shortest.
  1103. @subsection Examples
  1104. @itemize
  1105. @item
  1106. Merge two mono files into a stereo stream:
  1107. @example
  1108. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1109. @end example
  1110. @item
  1111. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1112. @example
  1113. 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
  1114. @end example
  1115. @end itemize
  1116. @section amix
  1117. Mixes multiple audio inputs into a single output.
  1118. Note that this filter only supports float samples (the @var{amerge}
  1119. and @var{pan} audio filters support many formats). If the @var{amix}
  1120. input has integer samples then @ref{aresample} will be automatically
  1121. inserted to perform the conversion to float samples.
  1122. For example
  1123. @example
  1124. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1125. @end example
  1126. will mix 3 input audio streams to a single output with the same duration as the
  1127. first input and a dropout transition time of 3 seconds.
  1128. It accepts the following parameters:
  1129. @table @option
  1130. @item inputs
  1131. The number of inputs. If unspecified, it defaults to 2.
  1132. @item duration
  1133. How to determine the end-of-stream.
  1134. @table @option
  1135. @item longest
  1136. The duration of the longest input. (default)
  1137. @item shortest
  1138. The duration of the shortest input.
  1139. @item first
  1140. The duration of the first input.
  1141. @end table
  1142. @item dropout_transition
  1143. The transition time, in seconds, for volume renormalization when an input
  1144. stream ends. The default value is 2 seconds.
  1145. @item weights
  1146. Specify weight of each input audio stream as sequence.
  1147. Each weight is separated by space. By default all inputs have same weight.
  1148. @end table
  1149. @section anequalizer
  1150. High-order parametric multiband equalizer for each channel.
  1151. It accepts the following parameters:
  1152. @table @option
  1153. @item params
  1154. This option string is in format:
  1155. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1156. Each equalizer band is separated by '|'.
  1157. @table @option
  1158. @item chn
  1159. Set channel number to which equalization will be applied.
  1160. If input doesn't have that channel the entry is ignored.
  1161. @item f
  1162. Set central frequency for band.
  1163. If input doesn't have that frequency the entry is ignored.
  1164. @item w
  1165. Set band width in hertz.
  1166. @item g
  1167. Set band gain in dB.
  1168. @item t
  1169. Set filter type for band, optional, can be:
  1170. @table @samp
  1171. @item 0
  1172. Butterworth, this is default.
  1173. @item 1
  1174. Chebyshev type 1.
  1175. @item 2
  1176. Chebyshev type 2.
  1177. @end table
  1178. @end table
  1179. @item curves
  1180. With this option activated frequency response of anequalizer is displayed
  1181. in video stream.
  1182. @item size
  1183. Set video stream size. Only useful if curves option is activated.
  1184. @item mgain
  1185. Set max gain that will be displayed. Only useful if curves option is activated.
  1186. Setting this to a reasonable value makes it possible to display gain which is derived from
  1187. neighbour bands which are too close to each other and thus produce higher gain
  1188. when both are activated.
  1189. @item fscale
  1190. Set frequency scale used to draw frequency response in video output.
  1191. Can be linear or logarithmic. Default is logarithmic.
  1192. @item colors
  1193. Set color for each channel curve which is going to be displayed in video stream.
  1194. This is list of color names separated by space or by '|'.
  1195. Unrecognised or missing colors will be replaced by white color.
  1196. @end table
  1197. @subsection Examples
  1198. @itemize
  1199. @item
  1200. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1201. for first 2 channels using Chebyshev type 1 filter:
  1202. @example
  1203. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1204. @end example
  1205. @end itemize
  1206. @subsection Commands
  1207. This filter supports the following commands:
  1208. @table @option
  1209. @item change
  1210. Alter existing filter parameters.
  1211. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1212. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1213. error is returned.
  1214. @var{freq} set new frequency parameter.
  1215. @var{width} set new width parameter in herz.
  1216. @var{gain} set new gain parameter in dB.
  1217. Full filter invocation with asendcmd may look like this:
  1218. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1219. @end table
  1220. @section anull
  1221. Pass the audio source unchanged to the output.
  1222. @section apad
  1223. Pad the end of an audio stream with silence.
  1224. This can be used together with @command{ffmpeg} @option{-shortest} to
  1225. extend audio streams to the same length as the video stream.
  1226. A description of the accepted options follows.
  1227. @table @option
  1228. @item packet_size
  1229. Set silence packet size. Default value is 4096.
  1230. @item pad_len
  1231. Set the number of samples of silence to add to the end. After the
  1232. value is reached, the stream is terminated. This option is mutually
  1233. exclusive with @option{whole_len}.
  1234. @item whole_len
  1235. Set the minimum total number of samples in the output audio stream. If
  1236. the value is longer than the input audio length, silence is added to
  1237. the end, until the value is reached. This option is mutually exclusive
  1238. with @option{pad_len}.
  1239. @end table
  1240. If neither the @option{pad_len} nor the @option{whole_len} option is
  1241. set, the filter will add silence to the end of the input stream
  1242. indefinitely.
  1243. @subsection Examples
  1244. @itemize
  1245. @item
  1246. Add 1024 samples of silence to the end of the input:
  1247. @example
  1248. apad=pad_len=1024
  1249. @end example
  1250. @item
  1251. Make sure the audio output will contain at least 10000 samples, pad
  1252. the input with silence if required:
  1253. @example
  1254. apad=whole_len=10000
  1255. @end example
  1256. @item
  1257. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1258. video stream will always result the shortest and will be converted
  1259. until the end in the output file when using the @option{shortest}
  1260. option:
  1261. @example
  1262. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1263. @end example
  1264. @end itemize
  1265. @section aphaser
  1266. Add a phasing effect to the input audio.
  1267. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1268. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1269. A description of the accepted parameters follows.
  1270. @table @option
  1271. @item in_gain
  1272. Set input gain. Default is 0.4.
  1273. @item out_gain
  1274. Set output gain. Default is 0.74
  1275. @item delay
  1276. Set delay in milliseconds. Default is 3.0.
  1277. @item decay
  1278. Set decay. Default is 0.4.
  1279. @item speed
  1280. Set modulation speed in Hz. Default is 0.5.
  1281. @item type
  1282. Set modulation type. Default is triangular.
  1283. It accepts the following values:
  1284. @table @samp
  1285. @item triangular, t
  1286. @item sinusoidal, s
  1287. @end table
  1288. @end table
  1289. @section apulsator
  1290. Audio pulsator is something between an autopanner and a tremolo.
  1291. But it can produce funny stereo effects as well. Pulsator changes the volume
  1292. of the left and right channel based on a LFO (low frequency oscillator) with
  1293. different waveforms and shifted phases.
  1294. This filter have the ability to define an offset between left and right
  1295. channel. An offset of 0 means that both LFO shapes match each other.
  1296. The left and right channel are altered equally - a conventional tremolo.
  1297. An offset of 50% means that the shape of the right channel is exactly shifted
  1298. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1299. an autopanner. At 1 both curves match again. Every setting in between moves the
  1300. phase shift gapless between all stages and produces some "bypassing" sounds with
  1301. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1302. the 0.5) the faster the signal passes from the left to the right speaker.
  1303. The filter accepts the following options:
  1304. @table @option
  1305. @item level_in
  1306. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1307. @item level_out
  1308. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1309. @item mode
  1310. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1311. sawup or sawdown. Default is sine.
  1312. @item amount
  1313. Set modulation. Define how much of original signal is affected by the LFO.
  1314. @item offset_l
  1315. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1316. @item offset_r
  1317. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1318. @item width
  1319. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1320. @item timing
  1321. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1322. @item bpm
  1323. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1324. is set to bpm.
  1325. @item ms
  1326. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1327. is set to ms.
  1328. @item hz
  1329. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1330. if timing is set to hz.
  1331. @end table
  1332. @anchor{aresample}
  1333. @section aresample
  1334. Resample the input audio to the specified parameters, using the
  1335. libswresample library. If none are specified then the filter will
  1336. automatically convert between its input and output.
  1337. This filter is also able to stretch/squeeze the audio data to make it match
  1338. the timestamps or to inject silence / cut out audio to make it match the
  1339. timestamps, do a combination of both or do neither.
  1340. The filter accepts the syntax
  1341. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1342. expresses a sample rate and @var{resampler_options} is a list of
  1343. @var{key}=@var{value} pairs, separated by ":". See the
  1344. @ref{Resampler Options,,"Resampler Options" section in the
  1345. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1346. for the complete list of supported options.
  1347. @subsection Examples
  1348. @itemize
  1349. @item
  1350. Resample the input audio to 44100Hz:
  1351. @example
  1352. aresample=44100
  1353. @end example
  1354. @item
  1355. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1356. samples per second compensation:
  1357. @example
  1358. aresample=async=1000
  1359. @end example
  1360. @end itemize
  1361. @section areverse
  1362. Reverse an audio clip.
  1363. Warning: This filter requires memory to buffer the entire clip, so trimming
  1364. is suggested.
  1365. @subsection Examples
  1366. @itemize
  1367. @item
  1368. Take the first 5 seconds of a clip, and reverse it.
  1369. @example
  1370. atrim=end=5,areverse
  1371. @end example
  1372. @end itemize
  1373. @section asetnsamples
  1374. Set the number of samples per each output audio frame.
  1375. The last output packet may contain a different number of samples, as
  1376. the filter will flush all the remaining samples when the input audio
  1377. signals its end.
  1378. The filter accepts the following options:
  1379. @table @option
  1380. @item nb_out_samples, n
  1381. Set the number of frames per each output audio frame. The number is
  1382. intended as the number of samples @emph{per each channel}.
  1383. Default value is 1024.
  1384. @item pad, p
  1385. If set to 1, the filter will pad the last audio frame with zeroes, so
  1386. that the last frame will contain the same number of samples as the
  1387. previous ones. Default value is 1.
  1388. @end table
  1389. For example, to set the number of per-frame samples to 1234 and
  1390. disable padding for the last frame, use:
  1391. @example
  1392. asetnsamples=n=1234:p=0
  1393. @end example
  1394. @section asetrate
  1395. Set the sample rate without altering the PCM data.
  1396. This will result in a change of speed and pitch.
  1397. The filter accepts the following options:
  1398. @table @option
  1399. @item sample_rate, r
  1400. Set the output sample rate. Default is 44100 Hz.
  1401. @end table
  1402. @section ashowinfo
  1403. Show a line containing various information for each input audio frame.
  1404. The input audio is not modified.
  1405. The shown line contains a sequence of key/value pairs of the form
  1406. @var{key}:@var{value}.
  1407. The following values are shown in the output:
  1408. @table @option
  1409. @item n
  1410. The (sequential) number of the input frame, starting from 0.
  1411. @item pts
  1412. The presentation timestamp of the input frame, in time base units; the time base
  1413. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1414. @item pts_time
  1415. The presentation timestamp of the input frame in seconds.
  1416. @item pos
  1417. position of the frame in the input stream, -1 if this information in
  1418. unavailable and/or meaningless (for example in case of synthetic audio)
  1419. @item fmt
  1420. The sample format.
  1421. @item chlayout
  1422. The channel layout.
  1423. @item rate
  1424. The sample rate for the audio frame.
  1425. @item nb_samples
  1426. The number of samples (per channel) in the frame.
  1427. @item checksum
  1428. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1429. audio, the data is treated as if all the planes were concatenated.
  1430. @item plane_checksums
  1431. A list of Adler-32 checksums for each data plane.
  1432. @end table
  1433. @anchor{astats}
  1434. @section astats
  1435. Display time domain statistical information about the audio channels.
  1436. Statistics are calculated and displayed for each audio channel and,
  1437. where applicable, an overall figure is also given.
  1438. It accepts the following option:
  1439. @table @option
  1440. @item length
  1441. Short window length in seconds, used for peak and trough RMS measurement.
  1442. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1443. @item metadata
  1444. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1445. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1446. disabled.
  1447. Available keys for each channel are:
  1448. DC_offset
  1449. Min_level
  1450. Max_level
  1451. Min_difference
  1452. Max_difference
  1453. Mean_difference
  1454. RMS_difference
  1455. Peak_level
  1456. RMS_peak
  1457. RMS_trough
  1458. Crest_factor
  1459. Flat_factor
  1460. Peak_count
  1461. Bit_depth
  1462. Dynamic_range
  1463. and for Overall:
  1464. DC_offset
  1465. Min_level
  1466. Max_level
  1467. Min_difference
  1468. Max_difference
  1469. Mean_difference
  1470. RMS_difference
  1471. Peak_level
  1472. RMS_level
  1473. RMS_peak
  1474. RMS_trough
  1475. Flat_factor
  1476. Peak_count
  1477. Bit_depth
  1478. Number_of_samples
  1479. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1480. this @code{lavfi.astats.Overall.Peak_count}.
  1481. For description what each key means read below.
  1482. @item reset
  1483. Set number of frame after which stats are going to be recalculated.
  1484. Default is disabled.
  1485. @end table
  1486. A description of each shown parameter follows:
  1487. @table @option
  1488. @item DC offset
  1489. Mean amplitude displacement from zero.
  1490. @item Min level
  1491. Minimal sample level.
  1492. @item Max level
  1493. Maximal sample level.
  1494. @item Min difference
  1495. Minimal difference between two consecutive samples.
  1496. @item Max difference
  1497. Maximal difference between two consecutive samples.
  1498. @item Mean difference
  1499. Mean difference between two consecutive samples.
  1500. The average of each difference between two consecutive samples.
  1501. @item RMS difference
  1502. Root Mean Square difference between two consecutive samples.
  1503. @item Peak level dB
  1504. @item RMS level dB
  1505. Standard peak and RMS level measured in dBFS.
  1506. @item RMS peak dB
  1507. @item RMS trough dB
  1508. Peak and trough values for RMS level measured over a short window.
  1509. @item Crest factor
  1510. Standard ratio of peak to RMS level (note: not in dB).
  1511. @item Flat factor
  1512. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1513. (i.e. either @var{Min level} or @var{Max level}).
  1514. @item Peak count
  1515. Number of occasions (not the number of samples) that the signal attained either
  1516. @var{Min level} or @var{Max level}.
  1517. @item Bit depth
  1518. Overall bit depth of audio. Number of bits used for each sample.
  1519. @item Dynamic range
  1520. Measured dynamic range of audio in dB.
  1521. @end table
  1522. @section atempo
  1523. Adjust audio tempo.
  1524. The filter accepts exactly one parameter, the audio tempo. If not
  1525. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1526. be in the [0.5, 100.0] range.
  1527. Note that tempo greater than 2 will skip some samples rather than
  1528. blend them in. If for any reason this is a concern it is always
  1529. possible to daisy-chain several instances of atempo to achieve the
  1530. desired product tempo.
  1531. @subsection Examples
  1532. @itemize
  1533. @item
  1534. Slow down audio to 80% tempo:
  1535. @example
  1536. atempo=0.8
  1537. @end example
  1538. @item
  1539. To speed up audio to 300% tempo:
  1540. @example
  1541. atempo=3
  1542. @end example
  1543. @item
  1544. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1545. @example
  1546. atempo=sqrt(3),atempo=sqrt(3)
  1547. @end example
  1548. @end itemize
  1549. @section atrim
  1550. Trim the input so that the output contains one continuous subpart of the input.
  1551. It accepts the following parameters:
  1552. @table @option
  1553. @item start
  1554. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1555. sample with the timestamp @var{start} will be the first sample in the output.
  1556. @item end
  1557. Specify time of the first audio sample that will be dropped, i.e. the
  1558. audio sample immediately preceding the one with the timestamp @var{end} will be
  1559. the last sample in the output.
  1560. @item start_pts
  1561. Same as @var{start}, except this option sets the start timestamp in samples
  1562. instead of seconds.
  1563. @item end_pts
  1564. Same as @var{end}, except this option sets the end timestamp in samples instead
  1565. of seconds.
  1566. @item duration
  1567. The maximum duration of the output in seconds.
  1568. @item start_sample
  1569. The number of the first sample that should be output.
  1570. @item end_sample
  1571. The number of the first sample that should be dropped.
  1572. @end table
  1573. @option{start}, @option{end}, and @option{duration} are expressed as time
  1574. duration specifications; see
  1575. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1576. Note that the first two sets of the start/end options and the @option{duration}
  1577. option look at the frame timestamp, while the _sample options simply count the
  1578. samples that pass through the filter. So start/end_pts and start/end_sample will
  1579. give different results when the timestamps are wrong, inexact or do not start at
  1580. zero. Also note that this filter does not modify the timestamps. If you wish
  1581. to have the output timestamps start at zero, insert the asetpts filter after the
  1582. atrim filter.
  1583. If multiple start or end options are set, this filter tries to be greedy and
  1584. keep all samples that match at least one of the specified constraints. To keep
  1585. only the part that matches all the constraints at once, chain multiple atrim
  1586. filters.
  1587. The defaults are such that all the input is kept. So it is possible to set e.g.
  1588. just the end values to keep everything before the specified time.
  1589. Examples:
  1590. @itemize
  1591. @item
  1592. Drop everything except the second minute of input:
  1593. @example
  1594. ffmpeg -i INPUT -af atrim=60:120
  1595. @end example
  1596. @item
  1597. Keep only the first 1000 samples:
  1598. @example
  1599. ffmpeg -i INPUT -af atrim=end_sample=1000
  1600. @end example
  1601. @end itemize
  1602. @section bandpass
  1603. Apply a two-pole Butterworth band-pass filter with central
  1604. frequency @var{frequency}, and (3dB-point) band-width width.
  1605. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1606. instead of the default: constant 0dB peak gain.
  1607. The filter roll off at 6dB per octave (20dB per decade).
  1608. The filter accepts the following options:
  1609. @table @option
  1610. @item frequency, f
  1611. Set the filter's central frequency. Default is @code{3000}.
  1612. @item csg
  1613. Constant skirt gain if set to 1. Defaults to 0.
  1614. @item width_type, t
  1615. Set method to specify band-width of filter.
  1616. @table @option
  1617. @item h
  1618. Hz
  1619. @item q
  1620. Q-Factor
  1621. @item o
  1622. octave
  1623. @item s
  1624. slope
  1625. @item k
  1626. kHz
  1627. @end table
  1628. @item width, w
  1629. Specify the band-width of a filter in width_type units.
  1630. @item channels, c
  1631. Specify which channels to filter, by default all available are filtered.
  1632. @end table
  1633. @subsection Commands
  1634. This filter supports the following commands:
  1635. @table @option
  1636. @item frequency, f
  1637. Change bandpass frequency.
  1638. Syntax for the command is : "@var{frequency}"
  1639. @item width_type, t
  1640. Change bandpass width_type.
  1641. Syntax for the command is : "@var{width_type}"
  1642. @item width, w
  1643. Change bandpass width.
  1644. Syntax for the command is : "@var{width}"
  1645. @end table
  1646. @section bandreject
  1647. Apply a two-pole Butterworth band-reject filter with central
  1648. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1649. The filter roll off at 6dB per octave (20dB per decade).
  1650. The filter accepts the following options:
  1651. @table @option
  1652. @item frequency, f
  1653. Set the filter's central frequency. Default is @code{3000}.
  1654. @item width_type, t
  1655. Set method to specify band-width of filter.
  1656. @table @option
  1657. @item h
  1658. Hz
  1659. @item q
  1660. Q-Factor
  1661. @item o
  1662. octave
  1663. @item s
  1664. slope
  1665. @item k
  1666. kHz
  1667. @end table
  1668. @item width, w
  1669. Specify the band-width of a filter in width_type units.
  1670. @item channels, c
  1671. Specify which channels to filter, by default all available are filtered.
  1672. @end table
  1673. @subsection Commands
  1674. This filter supports the following commands:
  1675. @table @option
  1676. @item frequency, f
  1677. Change bandreject frequency.
  1678. Syntax for the command is : "@var{frequency}"
  1679. @item width_type, t
  1680. Change bandreject width_type.
  1681. Syntax for the command is : "@var{width_type}"
  1682. @item width, w
  1683. Change bandreject width.
  1684. Syntax for the command is : "@var{width}"
  1685. @end table
  1686. @section bass, lowshelf
  1687. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1688. shelving filter with a response similar to that of a standard
  1689. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1690. The filter accepts the following options:
  1691. @table @option
  1692. @item gain, g
  1693. Give the gain at 0 Hz. Its useful range is about -20
  1694. (for a large cut) to +20 (for a large boost).
  1695. Beware of clipping when using a positive gain.
  1696. @item frequency, f
  1697. Set the filter's central frequency and so can be used
  1698. to extend or reduce the frequency range to be boosted or cut.
  1699. The default value is @code{100} Hz.
  1700. @item width_type, t
  1701. Set method to specify band-width of filter.
  1702. @table @option
  1703. @item h
  1704. Hz
  1705. @item q
  1706. Q-Factor
  1707. @item o
  1708. octave
  1709. @item s
  1710. slope
  1711. @item k
  1712. kHz
  1713. @end table
  1714. @item width, w
  1715. Determine how steep is the filter's shelf transition.
  1716. @item channels, c
  1717. Specify which channels to filter, by default all available are filtered.
  1718. @end table
  1719. @subsection Commands
  1720. This filter supports the following commands:
  1721. @table @option
  1722. @item frequency, f
  1723. Change bass frequency.
  1724. Syntax for the command is : "@var{frequency}"
  1725. @item width_type, t
  1726. Change bass width_type.
  1727. Syntax for the command is : "@var{width_type}"
  1728. @item width, w
  1729. Change bass width.
  1730. Syntax for the command is : "@var{width}"
  1731. @item gain, g
  1732. Change bass gain.
  1733. Syntax for the command is : "@var{gain}"
  1734. @end table
  1735. @section biquad
  1736. Apply a biquad IIR filter with the given coefficients.
  1737. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1738. are the numerator and denominator coefficients respectively.
  1739. and @var{channels}, @var{c} specify which channels to filter, by default all
  1740. available are filtered.
  1741. @subsection Commands
  1742. This filter supports the following commands:
  1743. @table @option
  1744. @item a0
  1745. @item a1
  1746. @item a2
  1747. @item b0
  1748. @item b1
  1749. @item b2
  1750. Change biquad parameter.
  1751. Syntax for the command is : "@var{value}"
  1752. @end table
  1753. @section bs2b
  1754. Bauer stereo to binaural transformation, which improves headphone listening of
  1755. stereo audio records.
  1756. To enable compilation of this filter you need to configure FFmpeg with
  1757. @code{--enable-libbs2b}.
  1758. It accepts the following parameters:
  1759. @table @option
  1760. @item profile
  1761. Pre-defined crossfeed level.
  1762. @table @option
  1763. @item default
  1764. Default level (fcut=700, feed=50).
  1765. @item cmoy
  1766. Chu Moy circuit (fcut=700, feed=60).
  1767. @item jmeier
  1768. Jan Meier circuit (fcut=650, feed=95).
  1769. @end table
  1770. @item fcut
  1771. Cut frequency (in Hz).
  1772. @item feed
  1773. Feed level (in Hz).
  1774. @end table
  1775. @section channelmap
  1776. Remap input channels to new locations.
  1777. It accepts the following parameters:
  1778. @table @option
  1779. @item map
  1780. Map channels from input to output. The argument is a '|'-separated list of
  1781. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1782. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1783. channel (e.g. FL for front left) or its index in the input channel layout.
  1784. @var{out_channel} is the name of the output channel or its index in the output
  1785. channel layout. If @var{out_channel} is not given then it is implicitly an
  1786. index, starting with zero and increasing by one for each mapping.
  1787. @item channel_layout
  1788. The channel layout of the output stream.
  1789. @end table
  1790. If no mapping is present, the filter will implicitly map input channels to
  1791. output channels, preserving indices.
  1792. @subsection Examples
  1793. @itemize
  1794. @item
  1795. For example, assuming a 5.1+downmix input MOV file,
  1796. @example
  1797. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1798. @end example
  1799. will create an output WAV file tagged as stereo from the downmix channels of
  1800. the input.
  1801. @item
  1802. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1803. @example
  1804. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1805. @end example
  1806. @end itemize
  1807. @section channelsplit
  1808. Split each channel from an input audio stream into a separate output stream.
  1809. It accepts the following parameters:
  1810. @table @option
  1811. @item channel_layout
  1812. The channel layout of the input stream. The default is "stereo".
  1813. @item channels
  1814. A channel layout describing the channels to be extracted as separate output streams
  1815. or "all" to extract each input channel as a separate stream. The default is "all".
  1816. Choosing channels not present in channel layout in the input will result in an error.
  1817. @end table
  1818. @subsection Examples
  1819. @itemize
  1820. @item
  1821. For example, assuming a stereo input MP3 file,
  1822. @example
  1823. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1824. @end example
  1825. will create an output Matroska file with two audio streams, one containing only
  1826. the left channel and the other the right channel.
  1827. @item
  1828. Split a 5.1 WAV file into per-channel files:
  1829. @example
  1830. ffmpeg -i in.wav -filter_complex
  1831. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1832. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1833. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1834. side_right.wav
  1835. @end example
  1836. @item
  1837. Extract only LFE from a 5.1 WAV file:
  1838. @example
  1839. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  1840. -map '[LFE]' lfe.wav
  1841. @end example
  1842. @end itemize
  1843. @section chorus
  1844. Add a chorus effect to the audio.
  1845. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1846. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1847. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1848. The modulation depth defines the range the modulated delay is played before or after
  1849. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1850. sound tuned around the original one, like in a chorus where some vocals are slightly
  1851. off key.
  1852. It accepts the following parameters:
  1853. @table @option
  1854. @item in_gain
  1855. Set input gain. Default is 0.4.
  1856. @item out_gain
  1857. Set output gain. Default is 0.4.
  1858. @item delays
  1859. Set delays. A typical delay is around 40ms to 60ms.
  1860. @item decays
  1861. Set decays.
  1862. @item speeds
  1863. Set speeds.
  1864. @item depths
  1865. Set depths.
  1866. @end table
  1867. @subsection Examples
  1868. @itemize
  1869. @item
  1870. A single delay:
  1871. @example
  1872. chorus=0.7:0.9:55:0.4:0.25:2
  1873. @end example
  1874. @item
  1875. Two delays:
  1876. @example
  1877. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1878. @end example
  1879. @item
  1880. Fuller sounding chorus with three delays:
  1881. @example
  1882. 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
  1883. @end example
  1884. @end itemize
  1885. @section compand
  1886. Compress or expand the audio's dynamic range.
  1887. It accepts the following parameters:
  1888. @table @option
  1889. @item attacks
  1890. @item decays
  1891. A list of times in seconds for each channel over which the instantaneous level
  1892. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1893. increase of volume and @var{decays} refers to decrease of volume. For most
  1894. situations, the attack time (response to the audio getting louder) should be
  1895. shorter than the decay time, because the human ear is more sensitive to sudden
  1896. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1897. a typical value for decay is 0.8 seconds.
  1898. If specified number of attacks & decays is lower than number of channels, the last
  1899. set attack/decay will be used for all remaining channels.
  1900. @item points
  1901. A list of points for the transfer function, specified in dB relative to the
  1902. maximum possible signal amplitude. Each key points list must be defined using
  1903. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1904. @code{x0/y0 x1/y1 x2/y2 ....}
  1905. The input values must be in strictly increasing order but the transfer function
  1906. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1907. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1908. function are @code{-70/-70|-60/-20|1/0}.
  1909. @item soft-knee
  1910. Set the curve radius in dB for all joints. It defaults to 0.01.
  1911. @item gain
  1912. Set the additional gain in dB to be applied at all points on the transfer
  1913. function. This allows for easy adjustment of the overall gain.
  1914. It defaults to 0.
  1915. @item volume
  1916. Set an initial volume, in dB, to be assumed for each channel when filtering
  1917. starts. This permits the user to supply a nominal level initially, so that, for
  1918. example, a very large gain is not applied to initial signal levels before the
  1919. companding has begun to operate. A typical value for audio which is initially
  1920. quiet is -90 dB. It defaults to 0.
  1921. @item delay
  1922. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1923. delayed before being fed to the volume adjuster. Specifying a delay
  1924. approximately equal to the attack/decay times allows the filter to effectively
  1925. operate in predictive rather than reactive mode. It defaults to 0.
  1926. @end table
  1927. @subsection Examples
  1928. @itemize
  1929. @item
  1930. Make music with both quiet and loud passages suitable for listening to in a
  1931. noisy environment:
  1932. @example
  1933. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1934. @end example
  1935. Another example for audio with whisper and explosion parts:
  1936. @example
  1937. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1938. @end example
  1939. @item
  1940. A noise gate for when the noise is at a lower level than the signal:
  1941. @example
  1942. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1943. @end example
  1944. @item
  1945. Here is another noise gate, this time for when the noise is at a higher level
  1946. than the signal (making it, in some ways, similar to squelch):
  1947. @example
  1948. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1949. @end example
  1950. @item
  1951. 2:1 compression starting at -6dB:
  1952. @example
  1953. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1954. @end example
  1955. @item
  1956. 2:1 compression starting at -9dB:
  1957. @example
  1958. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1959. @end example
  1960. @item
  1961. 2:1 compression starting at -12dB:
  1962. @example
  1963. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1964. @end example
  1965. @item
  1966. 2:1 compression starting at -18dB:
  1967. @example
  1968. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1969. @end example
  1970. @item
  1971. 3:1 compression starting at -15dB:
  1972. @example
  1973. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1974. @end example
  1975. @item
  1976. Compressor/Gate:
  1977. @example
  1978. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1979. @end example
  1980. @item
  1981. Expander:
  1982. @example
  1983. 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
  1984. @end example
  1985. @item
  1986. Hard limiter at -6dB:
  1987. @example
  1988. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1989. @end example
  1990. @item
  1991. Hard limiter at -12dB:
  1992. @example
  1993. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1994. @end example
  1995. @item
  1996. Hard noise gate at -35 dB:
  1997. @example
  1998. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1999. @end example
  2000. @item
  2001. Soft limiter:
  2002. @example
  2003. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2004. @end example
  2005. @end itemize
  2006. @section compensationdelay
  2007. Compensation Delay Line is a metric based delay to compensate differing
  2008. positions of microphones or speakers.
  2009. For example, you have recorded guitar with two microphones placed in
  2010. different location. Because the front of sound wave has fixed speed in
  2011. normal conditions, the phasing of microphones can vary and depends on
  2012. their location and interposition. The best sound mix can be achieved when
  2013. these microphones are in phase (synchronized). Note that distance of
  2014. ~30 cm between microphones makes one microphone to capture signal in
  2015. antiphase to another microphone. That makes the final mix sounding moody.
  2016. This filter helps to solve phasing problems by adding different delays
  2017. to each microphone track and make them synchronized.
  2018. The best result can be reached when you take one track as base and
  2019. synchronize other tracks one by one with it.
  2020. Remember that synchronization/delay tolerance depends on sample rate, too.
  2021. Higher sample rates will give more tolerance.
  2022. It accepts the following parameters:
  2023. @table @option
  2024. @item mm
  2025. Set millimeters distance. This is compensation distance for fine tuning.
  2026. Default is 0.
  2027. @item cm
  2028. Set cm distance. This is compensation distance for tightening distance setup.
  2029. Default is 0.
  2030. @item m
  2031. Set meters distance. This is compensation distance for hard distance setup.
  2032. Default is 0.
  2033. @item dry
  2034. Set dry amount. Amount of unprocessed (dry) signal.
  2035. Default is 0.
  2036. @item wet
  2037. Set wet amount. Amount of processed (wet) signal.
  2038. Default is 1.
  2039. @item temp
  2040. Set temperature degree in Celsius. This is the temperature of the environment.
  2041. Default is 20.
  2042. @end table
  2043. @section crossfeed
  2044. Apply headphone crossfeed filter.
  2045. Crossfeed is the process of blending the left and right channels of stereo
  2046. audio recording.
  2047. It is mainly used to reduce extreme stereo separation of low frequencies.
  2048. The intent is to produce more speaker like sound to the listener.
  2049. The filter accepts the following options:
  2050. @table @option
  2051. @item strength
  2052. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2053. This sets gain of low shelf filter for side part of stereo image.
  2054. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2055. @item range
  2056. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2057. This sets cut off frequency of low shelf filter. Default is cut off near
  2058. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2059. @item level_in
  2060. Set input gain. Default is 0.9.
  2061. @item level_out
  2062. Set output gain. Default is 1.
  2063. @end table
  2064. @section crystalizer
  2065. Simple algorithm to expand audio dynamic range.
  2066. The filter accepts the following options:
  2067. @table @option
  2068. @item i
  2069. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2070. (unchanged sound) to 10.0 (maximum effect).
  2071. @item c
  2072. Enable clipping. By default is enabled.
  2073. @end table
  2074. @section dcshift
  2075. Apply a DC shift to the audio.
  2076. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2077. in the recording chain) from the audio. The effect of a DC offset is reduced
  2078. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2079. a signal has a DC offset.
  2080. @table @option
  2081. @item shift
  2082. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2083. the audio.
  2084. @item limitergain
  2085. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2086. used to prevent clipping.
  2087. @end table
  2088. @section drmeter
  2089. Measure audio dynamic range.
  2090. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2091. is found in transition material. And anything less that 8 have very poor dynamics
  2092. and is very compressed.
  2093. The filter accepts the following options:
  2094. @table @option
  2095. @item length
  2096. Set window length in seconds used to split audio into segments of equal length.
  2097. Default is 3 seconds.
  2098. @end table
  2099. @section dynaudnorm
  2100. Dynamic Audio Normalizer.
  2101. This filter applies a certain amount of gain to the input audio in order
  2102. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2103. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2104. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2105. This allows for applying extra gain to the "quiet" sections of the audio
  2106. while avoiding distortions or clipping the "loud" sections. In other words:
  2107. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2108. sections, in the sense that the volume of each section is brought to the
  2109. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2110. this goal *without* applying "dynamic range compressing". It will retain 100%
  2111. of the dynamic range *within* each section of the audio file.
  2112. @table @option
  2113. @item f
  2114. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2115. Default is 500 milliseconds.
  2116. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2117. referred to as frames. This is required, because a peak magnitude has no
  2118. meaning for just a single sample value. Instead, we need to determine the
  2119. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2120. normalizer would simply use the peak magnitude of the complete file, the
  2121. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2122. frame. The length of a frame is specified in milliseconds. By default, the
  2123. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2124. been found to give good results with most files.
  2125. Note that the exact frame length, in number of samples, will be determined
  2126. automatically, based on the sampling rate of the individual input audio file.
  2127. @item g
  2128. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2129. number. Default is 31.
  2130. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2131. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2132. is specified in frames, centered around the current frame. For the sake of
  2133. simplicity, this must be an odd number. Consequently, the default value of 31
  2134. takes into account the current frame, as well as the 15 preceding frames and
  2135. the 15 subsequent frames. Using a larger window results in a stronger
  2136. smoothing effect and thus in less gain variation, i.e. slower gain
  2137. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2138. effect and thus in more gain variation, i.e. faster gain adaptation.
  2139. In other words, the more you increase this value, the more the Dynamic Audio
  2140. Normalizer will behave like a "traditional" normalization filter. On the
  2141. contrary, the more you decrease this value, the more the Dynamic Audio
  2142. Normalizer will behave like a dynamic range compressor.
  2143. @item p
  2144. Set the target peak value. This specifies the highest permissible magnitude
  2145. level for the normalized audio input. This filter will try to approach the
  2146. target peak magnitude as closely as possible, but at the same time it also
  2147. makes sure that the normalized signal will never exceed the peak magnitude.
  2148. A frame's maximum local gain factor is imposed directly by the target peak
  2149. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2150. It is not recommended to go above this value.
  2151. @item m
  2152. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2153. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2154. factor for each input frame, i.e. the maximum gain factor that does not
  2155. result in clipping or distortion. The maximum gain factor is determined by
  2156. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2157. additionally bounds the frame's maximum gain factor by a predetermined
  2158. (global) maximum gain factor. This is done in order to avoid excessive gain
  2159. factors in "silent" or almost silent frames. By default, the maximum gain
  2160. factor is 10.0, For most inputs the default value should be sufficient and
  2161. it usually is not recommended to increase this value. Though, for input
  2162. with an extremely low overall volume level, it may be necessary to allow even
  2163. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2164. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2165. Instead, a "sigmoid" threshold function will be applied. This way, the
  2166. gain factors will smoothly approach the threshold value, but never exceed that
  2167. value.
  2168. @item r
  2169. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2170. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2171. This means that the maximum local gain factor for each frame is defined
  2172. (only) by the frame's highest magnitude sample. This way, the samples can
  2173. be amplified as much as possible without exceeding the maximum signal
  2174. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2175. Normalizer can also take into account the frame's root mean square,
  2176. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2177. determine the power of a time-varying signal. It is therefore considered
  2178. that the RMS is a better approximation of the "perceived loudness" than
  2179. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2180. frames to a constant RMS value, a uniform "perceived loudness" can be
  2181. established. If a target RMS value has been specified, a frame's local gain
  2182. factor is defined as the factor that would result in exactly that RMS value.
  2183. Note, however, that the maximum local gain factor is still restricted by the
  2184. frame's highest magnitude sample, in order to prevent clipping.
  2185. @item n
  2186. Enable channels coupling. By default is enabled.
  2187. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2188. amount. This means the same gain factor will be applied to all channels, i.e.
  2189. the maximum possible gain factor is determined by the "loudest" channel.
  2190. However, in some recordings, it may happen that the volume of the different
  2191. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2192. In this case, this option can be used to disable the channel coupling. This way,
  2193. the gain factor will be determined independently for each channel, depending
  2194. only on the individual channel's highest magnitude sample. This allows for
  2195. harmonizing the volume of the different channels.
  2196. @item c
  2197. Enable DC bias correction. By default is disabled.
  2198. An audio signal (in the time domain) is a sequence of sample values.
  2199. In the Dynamic Audio Normalizer these sample values are represented in the
  2200. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2201. audio signal, or "waveform", should be centered around the zero point.
  2202. That means if we calculate the mean value of all samples in a file, or in a
  2203. single frame, then the result should be 0.0 or at least very close to that
  2204. value. If, however, there is a significant deviation of the mean value from
  2205. 0.0, in either positive or negative direction, this is referred to as a
  2206. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2207. Audio Normalizer provides optional DC bias correction.
  2208. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2209. the mean value, or "DC correction" offset, of each input frame and subtract
  2210. that value from all of the frame's sample values which ensures those samples
  2211. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2212. boundaries, the DC correction offset values will be interpolated smoothly
  2213. between neighbouring frames.
  2214. @item b
  2215. Enable alternative boundary mode. By default is disabled.
  2216. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2217. around each frame. This includes the preceding frames as well as the
  2218. subsequent frames. However, for the "boundary" frames, located at the very
  2219. beginning and at the very end of the audio file, not all neighbouring
  2220. frames are available. In particular, for the first few frames in the audio
  2221. file, the preceding frames are not known. And, similarly, for the last few
  2222. frames in the audio file, the subsequent frames are not known. Thus, the
  2223. question arises which gain factors should be assumed for the missing frames
  2224. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2225. to deal with this situation. The default boundary mode assumes a gain factor
  2226. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2227. "fade out" at the beginning and at the end of the input, respectively.
  2228. @item s
  2229. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2230. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2231. compression. This means that signal peaks will not be pruned and thus the
  2232. full dynamic range will be retained within each local neighbourhood. However,
  2233. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2234. normalization algorithm with a more "traditional" compression.
  2235. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2236. (thresholding) function. If (and only if) the compression feature is enabled,
  2237. all input frames will be processed by a soft knee thresholding function prior
  2238. to the actual normalization process. Put simply, the thresholding function is
  2239. going to prune all samples whose magnitude exceeds a certain threshold value.
  2240. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2241. value. Instead, the threshold value will be adjusted for each individual
  2242. frame.
  2243. In general, smaller parameters result in stronger compression, and vice versa.
  2244. Values below 3.0 are not recommended, because audible distortion may appear.
  2245. @end table
  2246. @section earwax
  2247. Make audio easier to listen to on headphones.
  2248. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2249. so that when listened to on headphones the stereo image is moved from
  2250. inside your head (standard for headphones) to outside and in front of
  2251. the listener (standard for speakers).
  2252. Ported from SoX.
  2253. @section equalizer
  2254. Apply a two-pole peaking equalisation (EQ) filter. With this
  2255. filter, the signal-level at and around a selected frequency can
  2256. be increased or decreased, whilst (unlike bandpass and bandreject
  2257. filters) that at all other frequencies is unchanged.
  2258. In order to produce complex equalisation curves, this filter can
  2259. be given several times, each with a different central frequency.
  2260. The filter accepts the following options:
  2261. @table @option
  2262. @item frequency, f
  2263. Set the filter's central frequency in Hz.
  2264. @item width_type, t
  2265. Set method to specify band-width of filter.
  2266. @table @option
  2267. @item h
  2268. Hz
  2269. @item q
  2270. Q-Factor
  2271. @item o
  2272. octave
  2273. @item s
  2274. slope
  2275. @item k
  2276. kHz
  2277. @end table
  2278. @item width, w
  2279. Specify the band-width of a filter in width_type units.
  2280. @item gain, g
  2281. Set the required gain or attenuation in dB.
  2282. Beware of clipping when using a positive gain.
  2283. @item channels, c
  2284. Specify which channels to filter, by default all available are filtered.
  2285. @end table
  2286. @subsection Examples
  2287. @itemize
  2288. @item
  2289. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2290. @example
  2291. equalizer=f=1000:t=h:width=200:g=-10
  2292. @end example
  2293. @item
  2294. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2295. @example
  2296. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2297. @end example
  2298. @end itemize
  2299. @subsection Commands
  2300. This filter supports the following commands:
  2301. @table @option
  2302. @item frequency, f
  2303. Change equalizer frequency.
  2304. Syntax for the command is : "@var{frequency}"
  2305. @item width_type, t
  2306. Change equalizer width_type.
  2307. Syntax for the command is : "@var{width_type}"
  2308. @item width, w
  2309. Change equalizer width.
  2310. Syntax for the command is : "@var{width}"
  2311. @item gain, g
  2312. Change equalizer gain.
  2313. Syntax for the command is : "@var{gain}"
  2314. @end table
  2315. @section extrastereo
  2316. Linearly increases the difference between left and right channels which
  2317. adds some sort of "live" effect to playback.
  2318. The filter accepts the following options:
  2319. @table @option
  2320. @item m
  2321. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2322. (average of both channels), with 1.0 sound will be unchanged, with
  2323. -1.0 left and right channels will be swapped.
  2324. @item c
  2325. Enable clipping. By default is enabled.
  2326. @end table
  2327. @section firequalizer
  2328. Apply FIR Equalization using arbitrary frequency response.
  2329. The filter accepts the following option:
  2330. @table @option
  2331. @item gain
  2332. Set gain curve equation (in dB). The expression can contain variables:
  2333. @table @option
  2334. @item f
  2335. the evaluated frequency
  2336. @item sr
  2337. sample rate
  2338. @item ch
  2339. channel number, set to 0 when multichannels evaluation is disabled
  2340. @item chid
  2341. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2342. multichannels evaluation is disabled
  2343. @item chs
  2344. number of channels
  2345. @item chlayout
  2346. channel_layout, see libavutil/channel_layout.h
  2347. @end table
  2348. and functions:
  2349. @table @option
  2350. @item gain_interpolate(f)
  2351. interpolate gain on frequency f based on gain_entry
  2352. @item cubic_interpolate(f)
  2353. same as gain_interpolate, but smoother
  2354. @end table
  2355. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2356. @item gain_entry
  2357. Set gain entry for gain_interpolate function. The expression can
  2358. contain functions:
  2359. @table @option
  2360. @item entry(f, g)
  2361. store gain entry at frequency f with value g
  2362. @end table
  2363. This option is also available as command.
  2364. @item delay
  2365. Set filter delay in seconds. Higher value means more accurate.
  2366. Default is @code{0.01}.
  2367. @item accuracy
  2368. Set filter accuracy in Hz. Lower value means more accurate.
  2369. Default is @code{5}.
  2370. @item wfunc
  2371. Set window function. Acceptable values are:
  2372. @table @option
  2373. @item rectangular
  2374. rectangular window, useful when gain curve is already smooth
  2375. @item hann
  2376. hann window (default)
  2377. @item hamming
  2378. hamming window
  2379. @item blackman
  2380. blackman window
  2381. @item nuttall3
  2382. 3-terms continuous 1st derivative nuttall window
  2383. @item mnuttall3
  2384. minimum 3-terms discontinuous nuttall window
  2385. @item nuttall
  2386. 4-terms continuous 1st derivative nuttall window
  2387. @item bnuttall
  2388. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2389. @item bharris
  2390. blackman-harris window
  2391. @item tukey
  2392. tukey window
  2393. @end table
  2394. @item fixed
  2395. If enabled, use fixed number of audio samples. This improves speed when
  2396. filtering with large delay. Default is disabled.
  2397. @item multi
  2398. Enable multichannels evaluation on gain. Default is disabled.
  2399. @item zero_phase
  2400. Enable zero phase mode by subtracting timestamp to compensate delay.
  2401. Default is disabled.
  2402. @item scale
  2403. Set scale used by gain. Acceptable values are:
  2404. @table @option
  2405. @item linlin
  2406. linear frequency, linear gain
  2407. @item linlog
  2408. linear frequency, logarithmic (in dB) gain (default)
  2409. @item loglin
  2410. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2411. @item loglog
  2412. logarithmic frequency, logarithmic gain
  2413. @end table
  2414. @item dumpfile
  2415. Set file for dumping, suitable for gnuplot.
  2416. @item dumpscale
  2417. Set scale for dumpfile. Acceptable values are same with scale option.
  2418. Default is linlog.
  2419. @item fft2
  2420. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2421. Default is disabled.
  2422. @item min_phase
  2423. Enable minimum phase impulse response. Default is disabled.
  2424. @end table
  2425. @subsection Examples
  2426. @itemize
  2427. @item
  2428. lowpass at 1000 Hz:
  2429. @example
  2430. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2431. @end example
  2432. @item
  2433. lowpass at 1000 Hz with gain_entry:
  2434. @example
  2435. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2436. @end example
  2437. @item
  2438. custom equalization:
  2439. @example
  2440. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2441. @end example
  2442. @item
  2443. higher delay with zero phase to compensate delay:
  2444. @example
  2445. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2446. @end example
  2447. @item
  2448. lowpass on left channel, highpass on right channel:
  2449. @example
  2450. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2451. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2452. @end example
  2453. @end itemize
  2454. @section flanger
  2455. Apply a flanging effect to the audio.
  2456. The filter accepts the following options:
  2457. @table @option
  2458. @item delay
  2459. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2460. @item depth
  2461. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2462. @item regen
  2463. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2464. Default value is 0.
  2465. @item width
  2466. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2467. Default value is 71.
  2468. @item speed
  2469. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2470. @item shape
  2471. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2472. Default value is @var{sinusoidal}.
  2473. @item phase
  2474. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2475. Default value is 25.
  2476. @item interp
  2477. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2478. Default is @var{linear}.
  2479. @end table
  2480. @section haas
  2481. Apply Haas effect to audio.
  2482. Note that this makes most sense to apply on mono signals.
  2483. With this filter applied to mono signals it give some directionality and
  2484. stretches its stereo image.
  2485. The filter accepts the following options:
  2486. @table @option
  2487. @item level_in
  2488. Set input level. By default is @var{1}, or 0dB
  2489. @item level_out
  2490. Set output level. By default is @var{1}, or 0dB.
  2491. @item side_gain
  2492. Set gain applied to side part of signal. By default is @var{1}.
  2493. @item middle_source
  2494. Set kind of middle source. Can be one of the following:
  2495. @table @samp
  2496. @item left
  2497. Pick left channel.
  2498. @item right
  2499. Pick right channel.
  2500. @item mid
  2501. Pick middle part signal of stereo image.
  2502. @item side
  2503. Pick side part signal of stereo image.
  2504. @end table
  2505. @item middle_phase
  2506. Change middle phase. By default is disabled.
  2507. @item left_delay
  2508. Set left channel delay. By default is @var{2.05} milliseconds.
  2509. @item left_balance
  2510. Set left channel balance. By default is @var{-1}.
  2511. @item left_gain
  2512. Set left channel gain. By default is @var{1}.
  2513. @item left_phase
  2514. Change left phase. By default is disabled.
  2515. @item right_delay
  2516. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2517. @item right_balance
  2518. Set right channel balance. By default is @var{1}.
  2519. @item right_gain
  2520. Set right channel gain. By default is @var{1}.
  2521. @item right_phase
  2522. Change right phase. By default is enabled.
  2523. @end table
  2524. @section hdcd
  2525. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2526. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2527. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2528. of HDCD, and detects the Transient Filter flag.
  2529. @example
  2530. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2531. @end example
  2532. When using the filter with wav, note the default encoding for wav is 16-bit,
  2533. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2534. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2535. @example
  2536. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2537. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2538. @end example
  2539. The filter accepts the following options:
  2540. @table @option
  2541. @item disable_autoconvert
  2542. Disable any automatic format conversion or resampling in the filter graph.
  2543. @item process_stereo
  2544. Process the stereo channels together. If target_gain does not match between
  2545. channels, consider it invalid and use the last valid target_gain.
  2546. @item cdt_ms
  2547. Set the code detect timer period in ms.
  2548. @item force_pe
  2549. Always extend peaks above -3dBFS even if PE isn't signaled.
  2550. @item analyze_mode
  2551. Replace audio with a solid tone and adjust the amplitude to signal some
  2552. specific aspect of the decoding process. The output file can be loaded in
  2553. an audio editor alongside the original to aid analysis.
  2554. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2555. Modes are:
  2556. @table @samp
  2557. @item 0, off
  2558. Disabled
  2559. @item 1, lle
  2560. Gain adjustment level at each sample
  2561. @item 2, pe
  2562. Samples where peak extend occurs
  2563. @item 3, cdt
  2564. Samples where the code detect timer is active
  2565. @item 4, tgm
  2566. Samples where the target gain does not match between channels
  2567. @end table
  2568. @end table
  2569. @section headphone
  2570. Apply head-related transfer functions (HRTFs) to create virtual
  2571. loudspeakers around the user for binaural listening via headphones.
  2572. The HRIRs are provided via additional streams, for each channel
  2573. one stereo input stream is needed.
  2574. The filter accepts the following options:
  2575. @table @option
  2576. @item map
  2577. Set mapping of input streams for convolution.
  2578. The argument is a '|'-separated list of channel names in order as they
  2579. are given as additional stream inputs for filter.
  2580. This also specify number of input streams. Number of input streams
  2581. must be not less than number of channels in first stream plus one.
  2582. @item gain
  2583. Set gain applied to audio. Value is in dB. Default is 0.
  2584. @item type
  2585. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2586. processing audio in time domain which is slow.
  2587. @var{freq} is processing audio in frequency domain which is fast.
  2588. Default is @var{freq}.
  2589. @item lfe
  2590. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2591. @item size
  2592. Set size of frame in number of samples which will be processed at once.
  2593. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2594. @item hrir
  2595. Set format of hrir stream.
  2596. Default value is @var{stereo}. Alternative value is @var{multich}.
  2597. If value is set to @var{stereo}, number of additional streams should
  2598. be greater or equal to number of input channels in first input stream.
  2599. Also each additional stream should have stereo number of channels.
  2600. If value is set to @var{multich}, number of additional streams should
  2601. be exactly one. Also number of input channels of additional stream
  2602. should be equal or greater than twice number of channels of first input
  2603. stream.
  2604. @end table
  2605. @subsection Examples
  2606. @itemize
  2607. @item
  2608. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2609. each amovie filter use stereo file with IR coefficients as input.
  2610. The files give coefficients for each position of virtual loudspeaker:
  2611. @example
  2612. ffmpeg -i input.wav -lavfi-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],[a:0][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
  2613. output.wav
  2614. @end example
  2615. @item
  2616. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2617. but now in @var{multich} @var{hrir} format.
  2618. @example
  2619. ffmpeg -i input.wav -lavfi-complex "amovie=minp.wav[hrirs],[a:0][hrirs]headphone=map=FL|FR|FC|LFE|BL|BR|SL|SR:hrir=multich"
  2620. output.wav
  2621. @end example
  2622. @end itemize
  2623. @section highpass
  2624. Apply a high-pass filter with 3dB point frequency.
  2625. The filter can be either single-pole, or double-pole (the default).
  2626. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2627. The filter accepts the following options:
  2628. @table @option
  2629. @item frequency, f
  2630. Set frequency in Hz. Default is 3000.
  2631. @item poles, p
  2632. Set number of poles. Default is 2.
  2633. @item width_type, t
  2634. Set method to specify band-width of filter.
  2635. @table @option
  2636. @item h
  2637. Hz
  2638. @item q
  2639. Q-Factor
  2640. @item o
  2641. octave
  2642. @item s
  2643. slope
  2644. @item k
  2645. kHz
  2646. @end table
  2647. @item width, w
  2648. Specify the band-width of a filter in width_type units.
  2649. Applies only to double-pole filter.
  2650. The default is 0.707q and gives a Butterworth response.
  2651. @item channels, c
  2652. Specify which channels to filter, by default all available are filtered.
  2653. @end table
  2654. @subsection Commands
  2655. This filter supports the following commands:
  2656. @table @option
  2657. @item frequency, f
  2658. Change highpass frequency.
  2659. Syntax for the command is : "@var{frequency}"
  2660. @item width_type, t
  2661. Change highpass width_type.
  2662. Syntax for the command is : "@var{width_type}"
  2663. @item width, w
  2664. Change highpass width.
  2665. Syntax for the command is : "@var{width}"
  2666. @end table
  2667. @section join
  2668. Join multiple input streams into one multi-channel stream.
  2669. It accepts the following parameters:
  2670. @table @option
  2671. @item inputs
  2672. The number of input streams. It defaults to 2.
  2673. @item channel_layout
  2674. The desired output channel layout. It defaults to stereo.
  2675. @item map
  2676. Map channels from inputs to output. The argument is a '|'-separated list of
  2677. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2678. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2679. can be either the name of the input channel (e.g. FL for front left) or its
  2680. index in the specified input stream. @var{out_channel} is the name of the output
  2681. channel.
  2682. @end table
  2683. The filter will attempt to guess the mappings when they are not specified
  2684. explicitly. It does so by first trying to find an unused matching input channel
  2685. and if that fails it picks the first unused input channel.
  2686. Join 3 inputs (with properly set channel layouts):
  2687. @example
  2688. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2689. @end example
  2690. Build a 5.1 output from 6 single-channel streams:
  2691. @example
  2692. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2693. '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'
  2694. out
  2695. @end example
  2696. @section ladspa
  2697. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2698. To enable compilation of this filter you need to configure FFmpeg with
  2699. @code{--enable-ladspa}.
  2700. @table @option
  2701. @item file, f
  2702. Specifies the name of LADSPA plugin library to load. If the environment
  2703. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2704. each one of the directories specified by the colon separated list in
  2705. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2706. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2707. @file{/usr/lib/ladspa/}.
  2708. @item plugin, p
  2709. Specifies the plugin within the library. Some libraries contain only
  2710. one plugin, but others contain many of them. If this is not set filter
  2711. will list all available plugins within the specified library.
  2712. @item controls, c
  2713. Set the '|' separated list of controls which are zero or more floating point
  2714. values that determine the behavior of the loaded plugin (for example delay,
  2715. threshold or gain).
  2716. Controls need to be defined using the following syntax:
  2717. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2718. @var{valuei} is the value set on the @var{i}-th control.
  2719. Alternatively they can be also defined using the following syntax:
  2720. @var{value0}|@var{value1}|@var{value2}|..., where
  2721. @var{valuei} is the value set on the @var{i}-th control.
  2722. If @option{controls} is set to @code{help}, all available controls and
  2723. their valid ranges are printed.
  2724. @item sample_rate, s
  2725. Specify the sample rate, default to 44100. Only used if plugin have
  2726. zero inputs.
  2727. @item nb_samples, n
  2728. Set the number of samples per channel per each output frame, default
  2729. is 1024. Only used if plugin have zero inputs.
  2730. @item duration, d
  2731. Set the minimum duration of the sourced audio. See
  2732. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2733. for the accepted syntax.
  2734. Note that the resulting duration may be greater than the specified duration,
  2735. as the generated audio is always cut at the end of a complete frame.
  2736. If not specified, or the expressed duration is negative, the audio is
  2737. supposed to be generated forever.
  2738. Only used if plugin have zero inputs.
  2739. @end table
  2740. @subsection Examples
  2741. @itemize
  2742. @item
  2743. List all available plugins within amp (LADSPA example plugin) library:
  2744. @example
  2745. ladspa=file=amp
  2746. @end example
  2747. @item
  2748. List all available controls and their valid ranges for @code{vcf_notch}
  2749. plugin from @code{VCF} library:
  2750. @example
  2751. ladspa=f=vcf:p=vcf_notch:c=help
  2752. @end example
  2753. @item
  2754. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2755. plugin library:
  2756. @example
  2757. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2758. @end example
  2759. @item
  2760. Add reverberation to the audio using TAP-plugins
  2761. (Tom's Audio Processing plugins):
  2762. @example
  2763. ladspa=file=tap_reverb:tap_reverb
  2764. @end example
  2765. @item
  2766. Generate white noise, with 0.2 amplitude:
  2767. @example
  2768. ladspa=file=cmt:noise_source_white:c=c0=.2
  2769. @end example
  2770. @item
  2771. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2772. @code{C* Audio Plugin Suite} (CAPS) library:
  2773. @example
  2774. ladspa=file=caps:Click:c=c1=20'
  2775. @end example
  2776. @item
  2777. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2778. @example
  2779. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2780. @end example
  2781. @item
  2782. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2783. @code{SWH Plugins} collection:
  2784. @example
  2785. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2786. @end example
  2787. @item
  2788. Attenuate low frequencies using Multiband EQ from Steve Harris
  2789. @code{SWH Plugins} collection:
  2790. @example
  2791. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2792. @end example
  2793. @item
  2794. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2795. (CAPS) library:
  2796. @example
  2797. ladspa=caps:Narrower
  2798. @end example
  2799. @item
  2800. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2801. @example
  2802. ladspa=caps:White:.2
  2803. @end example
  2804. @item
  2805. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2806. @example
  2807. ladspa=caps:Fractal:c=c1=1
  2808. @end example
  2809. @item
  2810. Dynamic volume normalization using @code{VLevel} plugin:
  2811. @example
  2812. ladspa=vlevel-ladspa:vlevel_mono
  2813. @end example
  2814. @end itemize
  2815. @subsection Commands
  2816. This filter supports the following commands:
  2817. @table @option
  2818. @item cN
  2819. Modify the @var{N}-th control value.
  2820. If the specified value is not valid, it is ignored and prior one is kept.
  2821. @end table
  2822. @section loudnorm
  2823. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2824. Support for both single pass (livestreams, files) and double pass (files) modes.
  2825. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2826. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2827. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2828. The filter accepts the following options:
  2829. @table @option
  2830. @item I, i
  2831. Set integrated loudness target.
  2832. Range is -70.0 - -5.0. Default value is -24.0.
  2833. @item LRA, lra
  2834. Set loudness range target.
  2835. Range is 1.0 - 20.0. Default value is 7.0.
  2836. @item TP, tp
  2837. Set maximum true peak.
  2838. Range is -9.0 - +0.0. Default value is -2.0.
  2839. @item measured_I, measured_i
  2840. Measured IL of input file.
  2841. Range is -99.0 - +0.0.
  2842. @item measured_LRA, measured_lra
  2843. Measured LRA of input file.
  2844. Range is 0.0 - 99.0.
  2845. @item measured_TP, measured_tp
  2846. Measured true peak of input file.
  2847. Range is -99.0 - +99.0.
  2848. @item measured_thresh
  2849. Measured threshold of input file.
  2850. Range is -99.0 - +0.0.
  2851. @item offset
  2852. Set offset gain. Gain is applied before the true-peak limiter.
  2853. Range is -99.0 - +99.0. Default is +0.0.
  2854. @item linear
  2855. Normalize linearly if possible.
  2856. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2857. to be specified in order to use this mode.
  2858. Options are true or false. Default is true.
  2859. @item dual_mono
  2860. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2861. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2862. If set to @code{true}, this option will compensate for this effect.
  2863. Multi-channel input files are not affected by this option.
  2864. Options are true or false. Default is false.
  2865. @item print_format
  2866. Set print format for stats. Options are summary, json, or none.
  2867. Default value is none.
  2868. @end table
  2869. @section lowpass
  2870. Apply a low-pass filter with 3dB point frequency.
  2871. The filter can be either single-pole or double-pole (the default).
  2872. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2873. The filter accepts the following options:
  2874. @table @option
  2875. @item frequency, f
  2876. Set frequency in Hz. Default is 500.
  2877. @item poles, p
  2878. Set number of poles. Default is 2.
  2879. @item width_type, t
  2880. Set method to specify band-width of filter.
  2881. @table @option
  2882. @item h
  2883. Hz
  2884. @item q
  2885. Q-Factor
  2886. @item o
  2887. octave
  2888. @item s
  2889. slope
  2890. @item k
  2891. kHz
  2892. @end table
  2893. @item width, w
  2894. Specify the band-width of a filter in width_type units.
  2895. Applies only to double-pole filter.
  2896. The default is 0.707q and gives a Butterworth response.
  2897. @item channels, c
  2898. Specify which channels to filter, by default all available are filtered.
  2899. @end table
  2900. @subsection Examples
  2901. @itemize
  2902. @item
  2903. Lowpass only LFE channel, it LFE is not present it does nothing:
  2904. @example
  2905. lowpass=c=LFE
  2906. @end example
  2907. @end itemize
  2908. @subsection Commands
  2909. This filter supports the following commands:
  2910. @table @option
  2911. @item frequency, f
  2912. Change lowpass frequency.
  2913. Syntax for the command is : "@var{frequency}"
  2914. @item width_type, t
  2915. Change lowpass width_type.
  2916. Syntax for the command is : "@var{width_type}"
  2917. @item width, w
  2918. Change lowpass width.
  2919. Syntax for the command is : "@var{width}"
  2920. @end table
  2921. @section lv2
  2922. Load a LV2 (LADSPA Version 2) plugin.
  2923. To enable compilation of this filter you need to configure FFmpeg with
  2924. @code{--enable-lv2}.
  2925. @table @option
  2926. @item plugin, p
  2927. Specifies the plugin URI. You may need to escape ':'.
  2928. @item controls, c
  2929. Set the '|' separated list of controls which are zero or more floating point
  2930. values that determine the behavior of the loaded plugin (for example delay,
  2931. threshold or gain).
  2932. If @option{controls} is set to @code{help}, all available controls and
  2933. their valid ranges are printed.
  2934. @item sample_rate, s
  2935. Specify the sample rate, default to 44100. Only used if plugin have
  2936. zero inputs.
  2937. @item nb_samples, n
  2938. Set the number of samples per channel per each output frame, default
  2939. is 1024. Only used if plugin have zero inputs.
  2940. @item duration, d
  2941. Set the minimum duration of the sourced audio. See
  2942. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2943. for the accepted syntax.
  2944. Note that the resulting duration may be greater than the specified duration,
  2945. as the generated audio is always cut at the end of a complete frame.
  2946. If not specified, or the expressed duration is negative, the audio is
  2947. supposed to be generated forever.
  2948. Only used if plugin have zero inputs.
  2949. @end table
  2950. @subsection Examples
  2951. @itemize
  2952. @item
  2953. Apply bass enhancer plugin from Calf:
  2954. @example
  2955. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  2956. @end example
  2957. @item
  2958. Apply vinyl plugin from Calf:
  2959. @example
  2960. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  2961. @end example
  2962. @item
  2963. Apply bit crusher plugin from ArtyFX:
  2964. @example
  2965. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  2966. @end example
  2967. @end itemize
  2968. @section mcompand
  2969. Multiband Compress or expand the audio's dynamic range.
  2970. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  2971. This is akin to the crossover of a loudspeaker, and results in flat frequency
  2972. response when absent compander action.
  2973. It accepts the following parameters:
  2974. @table @option
  2975. @item args
  2976. This option syntax is:
  2977. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  2978. For explanation of each item refer to compand filter documentation.
  2979. @end table
  2980. @anchor{pan}
  2981. @section pan
  2982. Mix channels with specific gain levels. The filter accepts the output
  2983. channel layout followed by a set of channels definitions.
  2984. This filter is also designed to efficiently remap the channels of an audio
  2985. stream.
  2986. The filter accepts parameters of the form:
  2987. "@var{l}|@var{outdef}|@var{outdef}|..."
  2988. @table @option
  2989. @item l
  2990. output channel layout or number of channels
  2991. @item outdef
  2992. output channel specification, of the form:
  2993. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2994. @item out_name
  2995. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2996. number (c0, c1, etc.)
  2997. @item gain
  2998. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2999. @item in_name
  3000. input channel to use, see out_name for details; it is not possible to mix
  3001. named and numbered input channels
  3002. @end table
  3003. If the `=' in a channel specification is replaced by `<', then the gains for
  3004. that specification will be renormalized so that the total is 1, thus
  3005. avoiding clipping noise.
  3006. @subsection Mixing examples
  3007. For example, if you want to down-mix from stereo to mono, but with a bigger
  3008. factor for the left channel:
  3009. @example
  3010. pan=1c|c0=0.9*c0+0.1*c1
  3011. @end example
  3012. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3013. 7-channels surround:
  3014. @example
  3015. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3016. @end example
  3017. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3018. that should be preferred (see "-ac" option) unless you have very specific
  3019. needs.
  3020. @subsection Remapping examples
  3021. The channel remapping will be effective if, and only if:
  3022. @itemize
  3023. @item gain coefficients are zeroes or ones,
  3024. @item only one input per channel output,
  3025. @end itemize
  3026. If all these conditions are satisfied, the filter will notify the user ("Pure
  3027. channel mapping detected"), and use an optimized and lossless method to do the
  3028. remapping.
  3029. For example, if you have a 5.1 source and want a stereo audio stream by
  3030. dropping the extra channels:
  3031. @example
  3032. pan="stereo| c0=FL | c1=FR"
  3033. @end example
  3034. Given the same source, you can also switch front left and front right channels
  3035. and keep the input channel layout:
  3036. @example
  3037. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3038. @end example
  3039. If the input is a stereo audio stream, you can mute the front left channel (and
  3040. still keep the stereo channel layout) with:
  3041. @example
  3042. pan="stereo|c1=c1"
  3043. @end example
  3044. Still with a stereo audio stream input, you can copy the right channel in both
  3045. front left and right:
  3046. @example
  3047. pan="stereo| c0=FR | c1=FR"
  3048. @end example
  3049. @section replaygain
  3050. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3051. outputs it unchanged.
  3052. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3053. @section resample
  3054. Convert the audio sample format, sample rate and channel layout. It is
  3055. not meant to be used directly.
  3056. @section rubberband
  3057. Apply time-stretching and pitch-shifting with librubberband.
  3058. To enable compilation of this filter, you need to configure FFmpeg with
  3059. @code{--enable-librubberband}.
  3060. The filter accepts the following options:
  3061. @table @option
  3062. @item tempo
  3063. Set tempo scale factor.
  3064. @item pitch
  3065. Set pitch scale factor.
  3066. @item transients
  3067. Set transients detector.
  3068. Possible values are:
  3069. @table @var
  3070. @item crisp
  3071. @item mixed
  3072. @item smooth
  3073. @end table
  3074. @item detector
  3075. Set detector.
  3076. Possible values are:
  3077. @table @var
  3078. @item compound
  3079. @item percussive
  3080. @item soft
  3081. @end table
  3082. @item phase
  3083. Set phase.
  3084. Possible values are:
  3085. @table @var
  3086. @item laminar
  3087. @item independent
  3088. @end table
  3089. @item window
  3090. Set processing window size.
  3091. Possible values are:
  3092. @table @var
  3093. @item standard
  3094. @item short
  3095. @item long
  3096. @end table
  3097. @item smoothing
  3098. Set smoothing.
  3099. Possible values are:
  3100. @table @var
  3101. @item off
  3102. @item on
  3103. @end table
  3104. @item formant
  3105. Enable formant preservation when shift pitching.
  3106. Possible values are:
  3107. @table @var
  3108. @item shifted
  3109. @item preserved
  3110. @end table
  3111. @item pitchq
  3112. Set pitch quality.
  3113. Possible values are:
  3114. @table @var
  3115. @item quality
  3116. @item speed
  3117. @item consistency
  3118. @end table
  3119. @item channels
  3120. Set channels.
  3121. Possible values are:
  3122. @table @var
  3123. @item apart
  3124. @item together
  3125. @end table
  3126. @end table
  3127. @section sidechaincompress
  3128. This filter acts like normal compressor but has the ability to compress
  3129. detected signal using second input signal.
  3130. It needs two input streams and returns one output stream.
  3131. First input stream will be processed depending on second stream signal.
  3132. The filtered signal then can be filtered with other filters in later stages of
  3133. processing. See @ref{pan} and @ref{amerge} filter.
  3134. The filter accepts the following options:
  3135. @table @option
  3136. @item level_in
  3137. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3138. @item threshold
  3139. If a signal of second stream raises above this level it will affect the gain
  3140. reduction of first stream.
  3141. By default is 0.125. Range is between 0.00097563 and 1.
  3142. @item ratio
  3143. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3144. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3145. Default is 2. Range is between 1 and 20.
  3146. @item attack
  3147. Amount of milliseconds the signal has to rise above the threshold before gain
  3148. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3149. @item release
  3150. Amount of milliseconds the signal has to fall below the threshold before
  3151. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3152. @item makeup
  3153. Set the amount by how much signal will be amplified after processing.
  3154. Default is 1. Range is from 1 to 64.
  3155. @item knee
  3156. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3157. Default is 2.82843. Range is between 1 and 8.
  3158. @item link
  3159. Choose if the @code{average} level between all channels of side-chain stream
  3160. or the louder(@code{maximum}) channel of side-chain stream affects the
  3161. reduction. Default is @code{average}.
  3162. @item detection
  3163. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3164. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3165. @item level_sc
  3166. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3167. @item mix
  3168. How much to use compressed signal in output. Default is 1.
  3169. Range is between 0 and 1.
  3170. @end table
  3171. @subsection Examples
  3172. @itemize
  3173. @item
  3174. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3175. depending on the signal of 2nd input and later compressed signal to be
  3176. merged with 2nd input:
  3177. @example
  3178. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3179. @end example
  3180. @end itemize
  3181. @section sidechaingate
  3182. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3183. filter the detected signal before sending it to the gain reduction stage.
  3184. Normally a gate uses the full range signal to detect a level above the
  3185. threshold.
  3186. For example: If you cut all lower frequencies from your sidechain signal
  3187. the gate will decrease the volume of your track only if not enough highs
  3188. appear. With this technique you are able to reduce the resonation of a
  3189. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3190. guitar.
  3191. It needs two input streams and returns one output stream.
  3192. First input stream will be processed depending on second stream signal.
  3193. The filter accepts the following options:
  3194. @table @option
  3195. @item level_in
  3196. Set input level before filtering.
  3197. Default is 1. Allowed range is from 0.015625 to 64.
  3198. @item range
  3199. Set the level of gain reduction when the signal is below the threshold.
  3200. Default is 0.06125. Allowed range is from 0 to 1.
  3201. @item threshold
  3202. If a signal rises above this level the gain reduction is released.
  3203. Default is 0.125. Allowed range is from 0 to 1.
  3204. @item ratio
  3205. Set a ratio about which the signal is reduced.
  3206. Default is 2. Allowed range is from 1 to 9000.
  3207. @item attack
  3208. Amount of milliseconds the signal has to rise above the threshold before gain
  3209. reduction stops.
  3210. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3211. @item release
  3212. Amount of milliseconds the signal has to fall below the threshold before the
  3213. reduction is increased again. Default is 250 milliseconds.
  3214. Allowed range is from 0.01 to 9000.
  3215. @item makeup
  3216. Set amount of amplification of signal after processing.
  3217. Default is 1. Allowed range is from 1 to 64.
  3218. @item knee
  3219. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3220. Default is 2.828427125. Allowed range is from 1 to 8.
  3221. @item detection
  3222. Choose if exact signal should be taken for detection or an RMS like one.
  3223. Default is rms. Can be peak or rms.
  3224. @item link
  3225. Choose if the average level between all channels or the louder channel affects
  3226. the reduction.
  3227. Default is average. Can be average or maximum.
  3228. @item level_sc
  3229. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3230. @end table
  3231. @section silencedetect
  3232. Detect silence in an audio stream.
  3233. This filter logs a message when it detects that the input audio volume is less
  3234. or equal to a noise tolerance value for a duration greater or equal to the
  3235. minimum detected noise duration.
  3236. The printed times and duration are expressed in seconds.
  3237. The filter accepts the following options:
  3238. @table @option
  3239. @item duration, d
  3240. Set silence duration until notification (default is 2 seconds).
  3241. @item noise, n
  3242. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3243. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3244. @end table
  3245. @subsection Examples
  3246. @itemize
  3247. @item
  3248. Detect 5 seconds of silence with -50dB noise tolerance:
  3249. @example
  3250. silencedetect=n=-50dB:d=5
  3251. @end example
  3252. @item
  3253. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3254. tolerance in @file{silence.mp3}:
  3255. @example
  3256. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3257. @end example
  3258. @end itemize
  3259. @section silenceremove
  3260. Remove silence from the beginning, middle or end of the audio.
  3261. The filter accepts the following options:
  3262. @table @option
  3263. @item start_periods
  3264. This value is used to indicate if audio should be trimmed at beginning of
  3265. the audio. A value of zero indicates no silence should be trimmed from the
  3266. beginning. When specifying a non-zero value, it trims audio up until it
  3267. finds non-silence. Normally, when trimming silence from beginning of audio
  3268. the @var{start_periods} will be @code{1} but it can be increased to higher
  3269. values to trim all audio up to specific count of non-silence periods.
  3270. Default value is @code{0}.
  3271. @item start_duration
  3272. Specify the amount of time that non-silence must be detected before it stops
  3273. trimming audio. By increasing the duration, bursts of noises can be treated
  3274. as silence and trimmed off. Default value is @code{0}.
  3275. @item start_threshold
  3276. This indicates what sample value should be treated as silence. For digital
  3277. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3278. you may wish to increase the value to account for background noise.
  3279. Can be specified in dB (in case "dB" is appended to the specified value)
  3280. or amplitude ratio. Default value is @code{0}.
  3281. @item stop_periods
  3282. Set the count for trimming silence from the end of audio.
  3283. To remove silence from the middle of a file, specify a @var{stop_periods}
  3284. that is negative. This value is then treated as a positive value and is
  3285. used to indicate the effect should restart processing as specified by
  3286. @var{start_periods}, making it suitable for removing periods of silence
  3287. in the middle of the audio.
  3288. Default value is @code{0}.
  3289. @item stop_duration
  3290. Specify a duration of silence that must exist before audio is not copied any
  3291. more. By specifying a higher duration, silence that is wanted can be left in
  3292. the audio.
  3293. Default value is @code{0}.
  3294. @item stop_threshold
  3295. This is the same as @option{start_threshold} but for trimming silence from
  3296. the end of audio.
  3297. Can be specified in dB (in case "dB" is appended to the specified value)
  3298. or amplitude ratio. Default value is @code{0}.
  3299. @item leave_silence
  3300. This indicates that @var{stop_duration} length of audio should be left intact
  3301. at the beginning of each period of silence.
  3302. For example, if you want to remove long pauses between words but do not want
  3303. to remove the pauses completely. Default value is @code{0}.
  3304. @item detection
  3305. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3306. and works better with digital silence which is exactly 0.
  3307. Default value is @code{rms}.
  3308. @item window
  3309. Set ratio used to calculate size of window for detecting silence.
  3310. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3311. @end table
  3312. @subsection Examples
  3313. @itemize
  3314. @item
  3315. The following example shows how this filter can be used to start a recording
  3316. that does not contain the delay at the start which usually occurs between
  3317. pressing the record button and the start of the performance:
  3318. @example
  3319. silenceremove=1:5:0.02
  3320. @end example
  3321. @item
  3322. Trim all silence encountered from beginning to end where there is more than 1
  3323. second of silence in audio:
  3324. @example
  3325. silenceremove=0:0:0:-1:1:-90dB
  3326. @end example
  3327. @end itemize
  3328. @section sofalizer
  3329. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3330. loudspeakers around the user for binaural listening via headphones (audio
  3331. formats up to 9 channels supported).
  3332. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3333. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3334. Austrian Academy of Sciences.
  3335. To enable compilation of this filter you need to configure FFmpeg with
  3336. @code{--enable-libmysofa}.
  3337. The filter accepts the following options:
  3338. @table @option
  3339. @item sofa
  3340. Set the SOFA file used for rendering.
  3341. @item gain
  3342. Set gain applied to audio. Value is in dB. Default is 0.
  3343. @item rotation
  3344. Set rotation of virtual loudspeakers in deg. Default is 0.
  3345. @item elevation
  3346. Set elevation of virtual speakers in deg. Default is 0.
  3347. @item radius
  3348. Set distance in meters between loudspeakers and the listener with near-field
  3349. HRTFs. Default is 1.
  3350. @item type
  3351. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3352. processing audio in time domain which is slow.
  3353. @var{freq} is processing audio in frequency domain which is fast.
  3354. Default is @var{freq}.
  3355. @item speakers
  3356. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3357. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3358. Each virtual loudspeaker is described with short channel name following with
  3359. azimuth and elevation in degrees.
  3360. Each virtual loudspeaker description is separated by '|'.
  3361. For example to override front left and front right channel positions use:
  3362. 'speakers=FL 45 15|FR 345 15'.
  3363. Descriptions with unrecognised channel names are ignored.
  3364. @item lfegain
  3365. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3366. @end table
  3367. @subsection Examples
  3368. @itemize
  3369. @item
  3370. Using ClubFritz6 sofa file:
  3371. @example
  3372. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3373. @end example
  3374. @item
  3375. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3376. @example
  3377. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3378. @end example
  3379. @item
  3380. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3381. and also with custom gain:
  3382. @example
  3383. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3384. @end example
  3385. @end itemize
  3386. @section stereotools
  3387. This filter has some handy utilities to manage stereo signals, for converting
  3388. M/S stereo recordings to L/R signal while having control over the parameters
  3389. or spreading the stereo image of master track.
  3390. The filter accepts the following options:
  3391. @table @option
  3392. @item level_in
  3393. Set input level before filtering for both channels. Defaults is 1.
  3394. Allowed range is from 0.015625 to 64.
  3395. @item level_out
  3396. Set output level after filtering for both channels. Defaults is 1.
  3397. Allowed range is from 0.015625 to 64.
  3398. @item balance_in
  3399. Set input balance between both channels. Default is 0.
  3400. Allowed range is from -1 to 1.
  3401. @item balance_out
  3402. Set output balance between both channels. Default is 0.
  3403. Allowed range is from -1 to 1.
  3404. @item softclip
  3405. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3406. clipping. Disabled by default.
  3407. @item mutel
  3408. Mute the left channel. Disabled by default.
  3409. @item muter
  3410. Mute the right channel. Disabled by default.
  3411. @item phasel
  3412. Change the phase of the left channel. Disabled by default.
  3413. @item phaser
  3414. Change the phase of the right channel. Disabled by default.
  3415. @item mode
  3416. Set stereo mode. Available values are:
  3417. @table @samp
  3418. @item lr>lr
  3419. Left/Right to Left/Right, this is default.
  3420. @item lr>ms
  3421. Left/Right to Mid/Side.
  3422. @item ms>lr
  3423. Mid/Side to Left/Right.
  3424. @item lr>ll
  3425. Left/Right to Left/Left.
  3426. @item lr>rr
  3427. Left/Right to Right/Right.
  3428. @item lr>l+r
  3429. Left/Right to Left + Right.
  3430. @item lr>rl
  3431. Left/Right to Right/Left.
  3432. @item ms>ll
  3433. Mid/Side to Left/Left.
  3434. @item ms>rr
  3435. Mid/Side to Right/Right.
  3436. @end table
  3437. @item slev
  3438. Set level of side signal. Default is 1.
  3439. Allowed range is from 0.015625 to 64.
  3440. @item sbal
  3441. Set balance of side signal. Default is 0.
  3442. Allowed range is from -1 to 1.
  3443. @item mlev
  3444. Set level of the middle signal. Default is 1.
  3445. Allowed range is from 0.015625 to 64.
  3446. @item mpan
  3447. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3448. @item base
  3449. Set stereo base between mono and inversed channels. Default is 0.
  3450. Allowed range is from -1 to 1.
  3451. @item delay
  3452. Set delay in milliseconds how much to delay left from right channel and
  3453. vice versa. Default is 0. Allowed range is from -20 to 20.
  3454. @item sclevel
  3455. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3456. @item phase
  3457. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3458. @item bmode_in, bmode_out
  3459. Set balance mode for balance_in/balance_out option.
  3460. Can be one of the following:
  3461. @table @samp
  3462. @item balance
  3463. Classic balance mode. Attenuate one channel at time.
  3464. Gain is raised up to 1.
  3465. @item amplitude
  3466. Similar as classic mode above but gain is raised up to 2.
  3467. @item power
  3468. Equal power distribution, from -6dB to +6dB range.
  3469. @end table
  3470. @end table
  3471. @subsection Examples
  3472. @itemize
  3473. @item
  3474. Apply karaoke like effect:
  3475. @example
  3476. stereotools=mlev=0.015625
  3477. @end example
  3478. @item
  3479. Convert M/S signal to L/R:
  3480. @example
  3481. "stereotools=mode=ms>lr"
  3482. @end example
  3483. @end itemize
  3484. @section stereowiden
  3485. This filter enhance the stereo effect by suppressing signal common to both
  3486. channels and by delaying the signal of left into right and vice versa,
  3487. thereby widening the stereo effect.
  3488. The filter accepts the following options:
  3489. @table @option
  3490. @item delay
  3491. Time in milliseconds of the delay of left signal into right and vice versa.
  3492. Default is 20 milliseconds.
  3493. @item feedback
  3494. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3495. effect of left signal in right output and vice versa which gives widening
  3496. effect. Default is 0.3.
  3497. @item crossfeed
  3498. Cross feed of left into right with inverted phase. This helps in suppressing
  3499. the mono. If the value is 1 it will cancel all the signal common to both
  3500. channels. Default is 0.3.
  3501. @item drymix
  3502. Set level of input signal of original channel. Default is 0.8.
  3503. @end table
  3504. @section superequalizer
  3505. Apply 18 band equalizer.
  3506. The filter accepts the following options:
  3507. @table @option
  3508. @item 1b
  3509. Set 65Hz band gain.
  3510. @item 2b
  3511. Set 92Hz band gain.
  3512. @item 3b
  3513. Set 131Hz band gain.
  3514. @item 4b
  3515. Set 185Hz band gain.
  3516. @item 5b
  3517. Set 262Hz band gain.
  3518. @item 6b
  3519. Set 370Hz band gain.
  3520. @item 7b
  3521. Set 523Hz band gain.
  3522. @item 8b
  3523. Set 740Hz band gain.
  3524. @item 9b
  3525. Set 1047Hz band gain.
  3526. @item 10b
  3527. Set 1480Hz band gain.
  3528. @item 11b
  3529. Set 2093Hz band gain.
  3530. @item 12b
  3531. Set 2960Hz band gain.
  3532. @item 13b
  3533. Set 4186Hz band gain.
  3534. @item 14b
  3535. Set 5920Hz band gain.
  3536. @item 15b
  3537. Set 8372Hz band gain.
  3538. @item 16b
  3539. Set 11840Hz band gain.
  3540. @item 17b
  3541. Set 16744Hz band gain.
  3542. @item 18b
  3543. Set 20000Hz band gain.
  3544. @end table
  3545. @section surround
  3546. Apply audio surround upmix filter.
  3547. This filter allows to produce multichannel output from audio stream.
  3548. The filter accepts the following options:
  3549. @table @option
  3550. @item chl_out
  3551. Set output channel layout. By default, this is @var{5.1}.
  3552. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3553. for the required syntax.
  3554. @item chl_in
  3555. Set input channel layout. By default, this is @var{stereo}.
  3556. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3557. for the required syntax.
  3558. @item level_in
  3559. Set input volume level. By default, this is @var{1}.
  3560. @item level_out
  3561. Set output volume level. By default, this is @var{1}.
  3562. @item lfe
  3563. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3564. @item lfe_low
  3565. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3566. @item lfe_high
  3567. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3568. @item fc_in
  3569. Set front center input volume. By default, this is @var{1}.
  3570. @item fc_out
  3571. Set front center output volume. By default, this is @var{1}.
  3572. @item lfe_in
  3573. Set LFE input volume. By default, this is @var{1}.
  3574. @item lfe_out
  3575. Set LFE output volume. By default, this is @var{1}.
  3576. @end table
  3577. @section treble, highshelf
  3578. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3579. shelving filter with a response similar to that of a standard
  3580. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3581. The filter accepts the following options:
  3582. @table @option
  3583. @item gain, g
  3584. Give the gain at whichever is the lower of ~22 kHz and the
  3585. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3586. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3587. @item frequency, f
  3588. Set the filter's central frequency and so can be used
  3589. to extend or reduce the frequency range to be boosted or cut.
  3590. The default value is @code{3000} Hz.
  3591. @item width_type, t
  3592. Set method to specify band-width of filter.
  3593. @table @option
  3594. @item h
  3595. Hz
  3596. @item q
  3597. Q-Factor
  3598. @item o
  3599. octave
  3600. @item s
  3601. slope
  3602. @item k
  3603. kHz
  3604. @end table
  3605. @item width, w
  3606. Determine how steep is the filter's shelf transition.
  3607. @item channels, c
  3608. Specify which channels to filter, by default all available are filtered.
  3609. @end table
  3610. @subsection Commands
  3611. This filter supports the following commands:
  3612. @table @option
  3613. @item frequency, f
  3614. Change treble frequency.
  3615. Syntax for the command is : "@var{frequency}"
  3616. @item width_type, t
  3617. Change treble width_type.
  3618. Syntax for the command is : "@var{width_type}"
  3619. @item width, w
  3620. Change treble width.
  3621. Syntax for the command is : "@var{width}"
  3622. @item gain, g
  3623. Change treble gain.
  3624. Syntax for the command is : "@var{gain}"
  3625. @end table
  3626. @section tremolo
  3627. Sinusoidal amplitude modulation.
  3628. The filter accepts the following options:
  3629. @table @option
  3630. @item f
  3631. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3632. (20 Hz or lower) will result in a tremolo effect.
  3633. This filter may also be used as a ring modulator by specifying
  3634. a modulation frequency higher than 20 Hz.
  3635. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3636. @item d
  3637. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3638. Default value is 0.5.
  3639. @end table
  3640. @section vibrato
  3641. Sinusoidal phase modulation.
  3642. The filter accepts the following options:
  3643. @table @option
  3644. @item f
  3645. Modulation frequency in Hertz.
  3646. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3647. @item d
  3648. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3649. Default value is 0.5.
  3650. @end table
  3651. @section volume
  3652. Adjust the input audio volume.
  3653. It accepts the following parameters:
  3654. @table @option
  3655. @item volume
  3656. Set audio volume expression.
  3657. Output values are clipped to the maximum value.
  3658. The output audio volume is given by the relation:
  3659. @example
  3660. @var{output_volume} = @var{volume} * @var{input_volume}
  3661. @end example
  3662. The default value for @var{volume} is "1.0".
  3663. @item precision
  3664. This parameter represents the mathematical precision.
  3665. It determines which input sample formats will be allowed, which affects the
  3666. precision of the volume scaling.
  3667. @table @option
  3668. @item fixed
  3669. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3670. @item float
  3671. 32-bit floating-point; this limits input sample format to FLT. (default)
  3672. @item double
  3673. 64-bit floating-point; this limits input sample format to DBL.
  3674. @end table
  3675. @item replaygain
  3676. Choose the behaviour on encountering ReplayGain side data in input frames.
  3677. @table @option
  3678. @item drop
  3679. Remove ReplayGain side data, ignoring its contents (the default).
  3680. @item ignore
  3681. Ignore ReplayGain side data, but leave it in the frame.
  3682. @item track
  3683. Prefer the track gain, if present.
  3684. @item album
  3685. Prefer the album gain, if present.
  3686. @end table
  3687. @item replaygain_preamp
  3688. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3689. Default value for @var{replaygain_preamp} is 0.0.
  3690. @item eval
  3691. Set when the volume expression is evaluated.
  3692. It accepts the following values:
  3693. @table @samp
  3694. @item once
  3695. only evaluate expression once during the filter initialization, or
  3696. when the @samp{volume} command is sent
  3697. @item frame
  3698. evaluate expression for each incoming frame
  3699. @end table
  3700. Default value is @samp{once}.
  3701. @end table
  3702. The volume expression can contain the following parameters.
  3703. @table @option
  3704. @item n
  3705. frame number (starting at zero)
  3706. @item nb_channels
  3707. number of channels
  3708. @item nb_consumed_samples
  3709. number of samples consumed by the filter
  3710. @item nb_samples
  3711. number of samples in the current frame
  3712. @item pos
  3713. original frame position in the file
  3714. @item pts
  3715. frame PTS
  3716. @item sample_rate
  3717. sample rate
  3718. @item startpts
  3719. PTS at start of stream
  3720. @item startt
  3721. time at start of stream
  3722. @item t
  3723. frame time
  3724. @item tb
  3725. timestamp timebase
  3726. @item volume
  3727. last set volume value
  3728. @end table
  3729. Note that when @option{eval} is set to @samp{once} only the
  3730. @var{sample_rate} and @var{tb} variables are available, all other
  3731. variables will evaluate to NAN.
  3732. @subsection Commands
  3733. This filter supports the following commands:
  3734. @table @option
  3735. @item volume
  3736. Modify the volume expression.
  3737. The command accepts the same syntax of the corresponding option.
  3738. If the specified expression is not valid, it is kept at its current
  3739. value.
  3740. @item replaygain_noclip
  3741. Prevent clipping by limiting the gain applied.
  3742. Default value for @var{replaygain_noclip} is 1.
  3743. @end table
  3744. @subsection Examples
  3745. @itemize
  3746. @item
  3747. Halve the input audio volume:
  3748. @example
  3749. volume=volume=0.5
  3750. volume=volume=1/2
  3751. volume=volume=-6.0206dB
  3752. @end example
  3753. In all the above example the named key for @option{volume} can be
  3754. omitted, for example like in:
  3755. @example
  3756. volume=0.5
  3757. @end example
  3758. @item
  3759. Increase input audio power by 6 decibels using fixed-point precision:
  3760. @example
  3761. volume=volume=6dB:precision=fixed
  3762. @end example
  3763. @item
  3764. Fade volume after time 10 with an annihilation period of 5 seconds:
  3765. @example
  3766. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3767. @end example
  3768. @end itemize
  3769. @section volumedetect
  3770. Detect the volume of the input video.
  3771. The filter has no parameters. The input is not modified. Statistics about
  3772. the volume will be printed in the log when the input stream end is reached.
  3773. In particular it will show the mean volume (root mean square), maximum
  3774. volume (on a per-sample basis), and the beginning of a histogram of the
  3775. registered volume values (from the maximum value to a cumulated 1/1000 of
  3776. the samples).
  3777. All volumes are in decibels relative to the maximum PCM value.
  3778. @subsection Examples
  3779. Here is an excerpt of the output:
  3780. @example
  3781. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3782. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3783. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3784. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3785. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3786. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3787. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3788. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3789. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3790. @end example
  3791. It means that:
  3792. @itemize
  3793. @item
  3794. The mean square energy is approximately -27 dB, or 10^-2.7.
  3795. @item
  3796. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3797. @item
  3798. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3799. @end itemize
  3800. In other words, raising the volume by +4 dB does not cause any clipping,
  3801. raising it by +5 dB causes clipping for 6 samples, etc.
  3802. @c man end AUDIO FILTERS
  3803. @chapter Audio Sources
  3804. @c man begin AUDIO SOURCES
  3805. Below is a description of the currently available audio sources.
  3806. @section abuffer
  3807. Buffer audio frames, and make them available to the filter chain.
  3808. This source is mainly intended for a programmatic use, in particular
  3809. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3810. It accepts the following parameters:
  3811. @table @option
  3812. @item time_base
  3813. The timebase which will be used for timestamps of submitted frames. It must be
  3814. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3815. @item sample_rate
  3816. The sample rate of the incoming audio buffers.
  3817. @item sample_fmt
  3818. The sample format of the incoming audio buffers.
  3819. Either a sample format name or its corresponding integer representation from
  3820. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3821. @item channel_layout
  3822. The channel layout of the incoming audio buffers.
  3823. Either a channel layout name from channel_layout_map in
  3824. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3825. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3826. @item channels
  3827. The number of channels of the incoming audio buffers.
  3828. If both @var{channels} and @var{channel_layout} are specified, then they
  3829. must be consistent.
  3830. @end table
  3831. @subsection Examples
  3832. @example
  3833. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3834. @end example
  3835. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3836. Since the sample format with name "s16p" corresponds to the number
  3837. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3838. equivalent to:
  3839. @example
  3840. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3841. @end example
  3842. @section aevalsrc
  3843. Generate an audio signal specified by an expression.
  3844. This source accepts in input one or more expressions (one for each
  3845. channel), which are evaluated and used to generate a corresponding
  3846. audio signal.
  3847. This source accepts the following options:
  3848. @table @option
  3849. @item exprs
  3850. Set the '|'-separated expressions list for each separate channel. In case the
  3851. @option{channel_layout} option is not specified, the selected channel layout
  3852. depends on the number of provided expressions. Otherwise the last
  3853. specified expression is applied to the remaining output channels.
  3854. @item channel_layout, c
  3855. Set the channel layout. The number of channels in the specified layout
  3856. must be equal to the number of specified expressions.
  3857. @item duration, d
  3858. Set the minimum duration of the sourced audio. See
  3859. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3860. for the accepted syntax.
  3861. Note that the resulting duration may be greater than the specified
  3862. duration, as the generated audio is always cut at the end of a
  3863. complete frame.
  3864. If not specified, or the expressed duration is negative, the audio is
  3865. supposed to be generated forever.
  3866. @item nb_samples, n
  3867. Set the number of samples per channel per each output frame,
  3868. default to 1024.
  3869. @item sample_rate, s
  3870. Specify the sample rate, default to 44100.
  3871. @end table
  3872. Each expression in @var{exprs} can contain the following constants:
  3873. @table @option
  3874. @item n
  3875. number of the evaluated sample, starting from 0
  3876. @item t
  3877. time of the evaluated sample expressed in seconds, starting from 0
  3878. @item s
  3879. sample rate
  3880. @end table
  3881. @subsection Examples
  3882. @itemize
  3883. @item
  3884. Generate silence:
  3885. @example
  3886. aevalsrc=0
  3887. @end example
  3888. @item
  3889. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3890. 8000 Hz:
  3891. @example
  3892. aevalsrc="sin(440*2*PI*t):s=8000"
  3893. @end example
  3894. @item
  3895. Generate a two channels signal, specify the channel layout (Front
  3896. Center + Back Center) explicitly:
  3897. @example
  3898. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3899. @end example
  3900. @item
  3901. Generate white noise:
  3902. @example
  3903. aevalsrc="-2+random(0)"
  3904. @end example
  3905. @item
  3906. Generate an amplitude modulated signal:
  3907. @example
  3908. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3909. @end example
  3910. @item
  3911. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3912. @example
  3913. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3914. @end example
  3915. @end itemize
  3916. @section anullsrc
  3917. The null audio source, return unprocessed audio frames. It is mainly useful
  3918. as a template and to be employed in analysis / debugging tools, or as
  3919. the source for filters which ignore the input data (for example the sox
  3920. synth filter).
  3921. This source accepts the following options:
  3922. @table @option
  3923. @item channel_layout, cl
  3924. Specifies the channel layout, and can be either an integer or a string
  3925. representing a channel layout. The default value of @var{channel_layout}
  3926. is "stereo".
  3927. Check the channel_layout_map definition in
  3928. @file{libavutil/channel_layout.c} for the mapping between strings and
  3929. channel layout values.
  3930. @item sample_rate, r
  3931. Specifies the sample rate, and defaults to 44100.
  3932. @item nb_samples, n
  3933. Set the number of samples per requested frames.
  3934. @end table
  3935. @subsection Examples
  3936. @itemize
  3937. @item
  3938. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3939. @example
  3940. anullsrc=r=48000:cl=4
  3941. @end example
  3942. @item
  3943. Do the same operation with a more obvious syntax:
  3944. @example
  3945. anullsrc=r=48000:cl=mono
  3946. @end example
  3947. @end itemize
  3948. All the parameters need to be explicitly defined.
  3949. @section flite
  3950. Synthesize a voice utterance using the libflite library.
  3951. To enable compilation of this filter you need to configure FFmpeg with
  3952. @code{--enable-libflite}.
  3953. Note that versions of the flite library prior to 2.0 are not thread-safe.
  3954. The filter accepts the following options:
  3955. @table @option
  3956. @item list_voices
  3957. If set to 1, list the names of the available voices and exit
  3958. immediately. Default value is 0.
  3959. @item nb_samples, n
  3960. Set the maximum number of samples per frame. Default value is 512.
  3961. @item textfile
  3962. Set the filename containing the text to speak.
  3963. @item text
  3964. Set the text to speak.
  3965. @item voice, v
  3966. Set the voice to use for the speech synthesis. Default value is
  3967. @code{kal}. See also the @var{list_voices} option.
  3968. @end table
  3969. @subsection Examples
  3970. @itemize
  3971. @item
  3972. Read from file @file{speech.txt}, and synthesize the text using the
  3973. standard flite voice:
  3974. @example
  3975. flite=textfile=speech.txt
  3976. @end example
  3977. @item
  3978. Read the specified text selecting the @code{slt} voice:
  3979. @example
  3980. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3981. @end example
  3982. @item
  3983. Input text to ffmpeg:
  3984. @example
  3985. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3986. @end example
  3987. @item
  3988. Make @file{ffplay} speak the specified text, using @code{flite} and
  3989. the @code{lavfi} device:
  3990. @example
  3991. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3992. @end example
  3993. @end itemize
  3994. For more information about libflite, check:
  3995. @url{http://www.festvox.org/flite/}
  3996. @section anoisesrc
  3997. Generate a noise audio signal.
  3998. The filter accepts the following options:
  3999. @table @option
  4000. @item sample_rate, r
  4001. Specify the sample rate. Default value is 48000 Hz.
  4002. @item amplitude, a
  4003. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4004. is 1.0.
  4005. @item duration, d
  4006. Specify the duration of the generated audio stream. Not specifying this option
  4007. results in noise with an infinite length.
  4008. @item color, colour, c
  4009. Specify the color of noise. Available noise colors are white, pink, brown,
  4010. blue and violet. Default color is white.
  4011. @item seed, s
  4012. Specify a value used to seed the PRNG.
  4013. @item nb_samples, n
  4014. Set the number of samples per each output frame, default is 1024.
  4015. @end table
  4016. @subsection Examples
  4017. @itemize
  4018. @item
  4019. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4020. @example
  4021. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4022. @end example
  4023. @end itemize
  4024. @section hilbert
  4025. Generate odd-tap Hilbert transform FIR coefficients.
  4026. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4027. the signal by 90 degrees.
  4028. This is used in many matrix coding schemes and for analytic signal generation.
  4029. The process is often written as a multiplication by i (or j), the imaginary unit.
  4030. The filter accepts the following options:
  4031. @table @option
  4032. @item sample_rate, s
  4033. Set sample rate, default is 44100.
  4034. @item taps, t
  4035. Set length of FIR filter, default is 22051.
  4036. @item nb_samples, n
  4037. Set number of samples per each frame.
  4038. @item win_func, w
  4039. Set window function to be used when generating FIR coefficients.
  4040. @end table
  4041. @section sine
  4042. Generate an audio signal made of a sine wave with amplitude 1/8.
  4043. The audio signal is bit-exact.
  4044. The filter accepts the following options:
  4045. @table @option
  4046. @item frequency, f
  4047. Set the carrier frequency. Default is 440 Hz.
  4048. @item beep_factor, b
  4049. Enable a periodic beep every second with frequency @var{beep_factor} times
  4050. the carrier frequency. Default is 0, meaning the beep is disabled.
  4051. @item sample_rate, r
  4052. Specify the sample rate, default is 44100.
  4053. @item duration, d
  4054. Specify the duration of the generated audio stream.
  4055. @item samples_per_frame
  4056. Set the number of samples per output frame.
  4057. The expression can contain the following constants:
  4058. @table @option
  4059. @item n
  4060. The (sequential) number of the output audio frame, starting from 0.
  4061. @item pts
  4062. The PTS (Presentation TimeStamp) of the output audio frame,
  4063. expressed in @var{TB} units.
  4064. @item t
  4065. The PTS of the output audio frame, expressed in seconds.
  4066. @item TB
  4067. The timebase of the output audio frames.
  4068. @end table
  4069. Default is @code{1024}.
  4070. @end table
  4071. @subsection Examples
  4072. @itemize
  4073. @item
  4074. Generate a simple 440 Hz sine wave:
  4075. @example
  4076. sine
  4077. @end example
  4078. @item
  4079. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4080. @example
  4081. sine=220:4:d=5
  4082. sine=f=220:b=4:d=5
  4083. sine=frequency=220:beep_factor=4:duration=5
  4084. @end example
  4085. @item
  4086. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4087. pattern:
  4088. @example
  4089. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4090. @end example
  4091. @end itemize
  4092. @c man end AUDIO SOURCES
  4093. @chapter Audio Sinks
  4094. @c man begin AUDIO SINKS
  4095. Below is a description of the currently available audio sinks.
  4096. @section abuffersink
  4097. Buffer audio frames, and make them available to the end of filter chain.
  4098. This sink is mainly intended for programmatic use, in particular
  4099. through the interface defined in @file{libavfilter/buffersink.h}
  4100. or the options system.
  4101. It accepts a pointer to an AVABufferSinkContext structure, which
  4102. defines the incoming buffers' formats, to be passed as the opaque
  4103. parameter to @code{avfilter_init_filter} for initialization.
  4104. @section anullsink
  4105. Null audio sink; do absolutely nothing with the input audio. It is
  4106. mainly useful as a template and for use in analysis / debugging
  4107. tools.
  4108. @c man end AUDIO SINKS
  4109. @chapter Video Filters
  4110. @c man begin VIDEO FILTERS
  4111. When you configure your FFmpeg build, you can disable any of the
  4112. existing filters using @code{--disable-filters}.
  4113. The configure output will show the video filters included in your
  4114. build.
  4115. Below is a description of the currently available video filters.
  4116. @section alphaextract
  4117. Extract the alpha component from the input as a grayscale video. This
  4118. is especially useful with the @var{alphamerge} filter.
  4119. @section alphamerge
  4120. Add or replace the alpha component of the primary input with the
  4121. grayscale value of a second input. This is intended for use with
  4122. @var{alphaextract} to allow the transmission or storage of frame
  4123. sequences that have alpha in a format that doesn't support an alpha
  4124. channel.
  4125. For example, to reconstruct full frames from a normal YUV-encoded video
  4126. and a separate video created with @var{alphaextract}, you might use:
  4127. @example
  4128. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4129. @end example
  4130. Since this filter is designed for reconstruction, it operates on frame
  4131. sequences without considering timestamps, and terminates when either
  4132. input reaches end of stream. This will cause problems if your encoding
  4133. pipeline drops frames. If you're trying to apply an image as an
  4134. overlay to a video stream, consider the @var{overlay} filter instead.
  4135. @section amplify
  4136. Amplify differences between current pixel and pixels of adjacent frames in
  4137. same pixel location.
  4138. This filter accepts the following options:
  4139. @table @option
  4140. @item radius
  4141. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4142. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4143. @item factor
  4144. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4145. @item threshold
  4146. Set threshold for difference amplification. Any differrence greater or equal to
  4147. this value will not alter source pixel. Default is 10.
  4148. Allowed range is from 0 to 65535.
  4149. @item low
  4150. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4151. This option controls maximum possible value that will decrease source pixel value.
  4152. @item high
  4153. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4154. This option controls maximum possible value that will increase source pixel value.
  4155. @item planes
  4156. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4157. @end table
  4158. @section ass
  4159. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4160. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4161. Substation Alpha) subtitles files.
  4162. This filter accepts the following option in addition to the common options from
  4163. the @ref{subtitles} filter:
  4164. @table @option
  4165. @item shaping
  4166. Set the shaping engine
  4167. Available values are:
  4168. @table @samp
  4169. @item auto
  4170. The default libass shaping engine, which is the best available.
  4171. @item simple
  4172. Fast, font-agnostic shaper that can do only substitutions
  4173. @item complex
  4174. Slower shaper using OpenType for substitutions and positioning
  4175. @end table
  4176. The default is @code{auto}.
  4177. @end table
  4178. @section atadenoise
  4179. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4180. The filter accepts the following options:
  4181. @table @option
  4182. @item 0a
  4183. Set threshold A for 1st plane. Default is 0.02.
  4184. Valid range is 0 to 0.3.
  4185. @item 0b
  4186. Set threshold B for 1st plane. Default is 0.04.
  4187. Valid range is 0 to 5.
  4188. @item 1a
  4189. Set threshold A for 2nd plane. Default is 0.02.
  4190. Valid range is 0 to 0.3.
  4191. @item 1b
  4192. Set threshold B for 2nd plane. Default is 0.04.
  4193. Valid range is 0 to 5.
  4194. @item 2a
  4195. Set threshold A for 3rd plane. Default is 0.02.
  4196. Valid range is 0 to 0.3.
  4197. @item 2b
  4198. Set threshold B for 3rd plane. Default is 0.04.
  4199. Valid range is 0 to 5.
  4200. Threshold A is designed to react on abrupt changes in the input signal and
  4201. threshold B is designed to react on continuous changes in the input signal.
  4202. @item s
  4203. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4204. number in range [5, 129].
  4205. @item p
  4206. Set what planes of frame filter will use for averaging. Default is all.
  4207. @end table
  4208. @section avgblur
  4209. Apply average blur filter.
  4210. The filter accepts the following options:
  4211. @table @option
  4212. @item sizeX
  4213. Set horizontal kernel size.
  4214. @item planes
  4215. Set which planes to filter. By default all planes are filtered.
  4216. @item sizeY
  4217. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  4218. Default is @code{0}.
  4219. @end table
  4220. @section bbox
  4221. Compute the bounding box for the non-black pixels in the input frame
  4222. luminance plane.
  4223. This filter computes the bounding box containing all the pixels with a
  4224. luminance value greater than the minimum allowed value.
  4225. The parameters describing the bounding box are printed on the filter
  4226. log.
  4227. The filter accepts the following option:
  4228. @table @option
  4229. @item min_val
  4230. Set the minimal luminance value. Default is @code{16}.
  4231. @end table
  4232. @section bitplanenoise
  4233. Show and measure bit plane noise.
  4234. The filter accepts the following options:
  4235. @table @option
  4236. @item bitplane
  4237. Set which plane to analyze. Default is @code{1}.
  4238. @item filter
  4239. Filter out noisy pixels from @code{bitplane} set above.
  4240. Default is disabled.
  4241. @end table
  4242. @section blackdetect
  4243. Detect video intervals that are (almost) completely black. Can be
  4244. useful to detect chapter transitions, commercials, or invalid
  4245. recordings. Output lines contains the time for the start, end and
  4246. duration of the detected black interval expressed in seconds.
  4247. In order to display the output lines, you need to set the loglevel at
  4248. least to the AV_LOG_INFO value.
  4249. The filter accepts the following options:
  4250. @table @option
  4251. @item black_min_duration, d
  4252. Set the minimum detected black duration expressed in seconds. It must
  4253. be a non-negative floating point number.
  4254. Default value is 2.0.
  4255. @item picture_black_ratio_th, pic_th
  4256. Set the threshold for considering a picture "black".
  4257. Express the minimum value for the ratio:
  4258. @example
  4259. @var{nb_black_pixels} / @var{nb_pixels}
  4260. @end example
  4261. for which a picture is considered black.
  4262. Default value is 0.98.
  4263. @item pixel_black_th, pix_th
  4264. Set the threshold for considering a pixel "black".
  4265. The threshold expresses the maximum pixel luminance value for which a
  4266. pixel is considered "black". The provided value is scaled according to
  4267. the following equation:
  4268. @example
  4269. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4270. @end example
  4271. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4272. the input video format, the range is [0-255] for YUV full-range
  4273. formats and [16-235] for YUV non full-range formats.
  4274. Default value is 0.10.
  4275. @end table
  4276. The following example sets the maximum pixel threshold to the minimum
  4277. value, and detects only black intervals of 2 or more seconds:
  4278. @example
  4279. blackdetect=d=2:pix_th=0.00
  4280. @end example
  4281. @section blackframe
  4282. Detect frames that are (almost) completely black. Can be useful to
  4283. detect chapter transitions or commercials. Output lines consist of
  4284. the frame number of the detected frame, the percentage of blackness,
  4285. the position in the file if known or -1 and the timestamp in seconds.
  4286. In order to display the output lines, you need to set the loglevel at
  4287. least to the AV_LOG_INFO value.
  4288. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4289. The value represents the percentage of pixels in the picture that
  4290. are below the threshold value.
  4291. It accepts the following parameters:
  4292. @table @option
  4293. @item amount
  4294. The percentage of the pixels that have to be below the threshold; it defaults to
  4295. @code{98}.
  4296. @item threshold, thresh
  4297. The threshold below which a pixel value is considered black; it defaults to
  4298. @code{32}.
  4299. @end table
  4300. @section blend, tblend
  4301. Blend two video frames into each other.
  4302. The @code{blend} filter takes two input streams and outputs one
  4303. stream, the first input is the "top" layer and second input is
  4304. "bottom" layer. By default, the output terminates when the longest input terminates.
  4305. The @code{tblend} (time blend) filter takes two consecutive frames
  4306. from one single stream, and outputs the result obtained by blending
  4307. the new frame on top of the old frame.
  4308. A description of the accepted options follows.
  4309. @table @option
  4310. @item c0_mode
  4311. @item c1_mode
  4312. @item c2_mode
  4313. @item c3_mode
  4314. @item all_mode
  4315. Set blend mode for specific pixel component or all pixel components in case
  4316. of @var{all_mode}. Default value is @code{normal}.
  4317. Available values for component modes are:
  4318. @table @samp
  4319. @item addition
  4320. @item grainmerge
  4321. @item and
  4322. @item average
  4323. @item burn
  4324. @item darken
  4325. @item difference
  4326. @item grainextract
  4327. @item divide
  4328. @item dodge
  4329. @item freeze
  4330. @item exclusion
  4331. @item extremity
  4332. @item glow
  4333. @item hardlight
  4334. @item hardmix
  4335. @item heat
  4336. @item lighten
  4337. @item linearlight
  4338. @item multiply
  4339. @item multiply128
  4340. @item negation
  4341. @item normal
  4342. @item or
  4343. @item overlay
  4344. @item phoenix
  4345. @item pinlight
  4346. @item reflect
  4347. @item screen
  4348. @item softlight
  4349. @item subtract
  4350. @item vividlight
  4351. @item xor
  4352. @end table
  4353. @item c0_opacity
  4354. @item c1_opacity
  4355. @item c2_opacity
  4356. @item c3_opacity
  4357. @item all_opacity
  4358. Set blend opacity for specific pixel component or all pixel components in case
  4359. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4360. @item c0_expr
  4361. @item c1_expr
  4362. @item c2_expr
  4363. @item c3_expr
  4364. @item all_expr
  4365. Set blend expression for specific pixel component or all pixel components in case
  4366. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4367. The expressions can use the following variables:
  4368. @table @option
  4369. @item N
  4370. The sequential number of the filtered frame, starting from @code{0}.
  4371. @item X
  4372. @item Y
  4373. the coordinates of the current sample
  4374. @item W
  4375. @item H
  4376. the width and height of currently filtered plane
  4377. @item SW
  4378. @item SH
  4379. Width and height scale depending on the currently filtered plane. It is the
  4380. ratio between the corresponding luma plane number of pixels and the current
  4381. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  4382. @code{0.5,0.5} for chroma planes.
  4383. @item T
  4384. Time of the current frame, expressed in seconds.
  4385. @item TOP, A
  4386. Value of pixel component at current location for first video frame (top layer).
  4387. @item BOTTOM, B
  4388. Value of pixel component at current location for second video frame (bottom layer).
  4389. @end table
  4390. @end table
  4391. The @code{blend} filter also supports the @ref{framesync} options.
  4392. @subsection Examples
  4393. @itemize
  4394. @item
  4395. Apply transition from bottom layer to top layer in first 10 seconds:
  4396. @example
  4397. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4398. @end example
  4399. @item
  4400. Apply linear horizontal transition from top layer to bottom layer:
  4401. @example
  4402. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4403. @end example
  4404. @item
  4405. Apply 1x1 checkerboard effect:
  4406. @example
  4407. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4408. @end example
  4409. @item
  4410. Apply uncover left effect:
  4411. @example
  4412. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4413. @end example
  4414. @item
  4415. Apply uncover down effect:
  4416. @example
  4417. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4418. @end example
  4419. @item
  4420. Apply uncover up-left effect:
  4421. @example
  4422. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4423. @end example
  4424. @item
  4425. Split diagonally video and shows top and bottom layer on each side:
  4426. @example
  4427. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4428. @end example
  4429. @item
  4430. Display differences between the current and the previous frame:
  4431. @example
  4432. tblend=all_mode=grainextract
  4433. @end example
  4434. @end itemize
  4435. @section boxblur
  4436. Apply a boxblur algorithm to the input video.
  4437. It accepts the following parameters:
  4438. @table @option
  4439. @item luma_radius, lr
  4440. @item luma_power, lp
  4441. @item chroma_radius, cr
  4442. @item chroma_power, cp
  4443. @item alpha_radius, ar
  4444. @item alpha_power, ap
  4445. @end table
  4446. A description of the accepted options follows.
  4447. @table @option
  4448. @item luma_radius, lr
  4449. @item chroma_radius, cr
  4450. @item alpha_radius, ar
  4451. Set an expression for the box radius in pixels used for blurring the
  4452. corresponding input plane.
  4453. The radius value must be a non-negative number, and must not be
  4454. greater than the value of the expression @code{min(w,h)/2} for the
  4455. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4456. planes.
  4457. Default value for @option{luma_radius} is "2". If not specified,
  4458. @option{chroma_radius} and @option{alpha_radius} default to the
  4459. corresponding value set for @option{luma_radius}.
  4460. The expressions can contain the following constants:
  4461. @table @option
  4462. @item w
  4463. @item h
  4464. The input width and height in pixels.
  4465. @item cw
  4466. @item ch
  4467. The input chroma image width and height in pixels.
  4468. @item hsub
  4469. @item vsub
  4470. The horizontal and vertical chroma subsample values. For example, for the
  4471. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4472. @end table
  4473. @item luma_power, lp
  4474. @item chroma_power, cp
  4475. @item alpha_power, ap
  4476. Specify how many times the boxblur filter is applied to the
  4477. corresponding plane.
  4478. Default value for @option{luma_power} is 2. If not specified,
  4479. @option{chroma_power} and @option{alpha_power} default to the
  4480. corresponding value set for @option{luma_power}.
  4481. A value of 0 will disable the effect.
  4482. @end table
  4483. @subsection Examples
  4484. @itemize
  4485. @item
  4486. Apply a boxblur filter with the luma, chroma, and alpha radii
  4487. set to 2:
  4488. @example
  4489. boxblur=luma_radius=2:luma_power=1
  4490. boxblur=2:1
  4491. @end example
  4492. @item
  4493. Set the luma radius to 2, and alpha and chroma radius to 0:
  4494. @example
  4495. boxblur=2:1:cr=0:ar=0
  4496. @end example
  4497. @item
  4498. Set the luma and chroma radii to a fraction of the video dimension:
  4499. @example
  4500. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4501. @end example
  4502. @end itemize
  4503. @section bwdif
  4504. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4505. Deinterlacing Filter").
  4506. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4507. interpolation algorithms.
  4508. It accepts the following parameters:
  4509. @table @option
  4510. @item mode
  4511. The interlacing mode to adopt. It accepts one of the following values:
  4512. @table @option
  4513. @item 0, send_frame
  4514. Output one frame for each frame.
  4515. @item 1, send_field
  4516. Output one frame for each field.
  4517. @end table
  4518. The default value is @code{send_field}.
  4519. @item parity
  4520. The picture field parity assumed for the input interlaced video. It accepts one
  4521. of the following values:
  4522. @table @option
  4523. @item 0, tff
  4524. Assume the top field is first.
  4525. @item 1, bff
  4526. Assume the bottom field is first.
  4527. @item -1, auto
  4528. Enable automatic detection of field parity.
  4529. @end table
  4530. The default value is @code{auto}.
  4531. If the interlacing is unknown or the decoder does not export this information,
  4532. top field first will be assumed.
  4533. @item deint
  4534. Specify which frames to deinterlace. Accept one of the following
  4535. values:
  4536. @table @option
  4537. @item 0, all
  4538. Deinterlace all frames.
  4539. @item 1, interlaced
  4540. Only deinterlace frames marked as interlaced.
  4541. @end table
  4542. The default value is @code{all}.
  4543. @end table
  4544. @section chromakey
  4545. YUV colorspace color/chroma keying.
  4546. The filter accepts the following options:
  4547. @table @option
  4548. @item color
  4549. The color which will be replaced with transparency.
  4550. @item similarity
  4551. Similarity percentage with the key color.
  4552. 0.01 matches only the exact key color, while 1.0 matches everything.
  4553. @item blend
  4554. Blend percentage.
  4555. 0.0 makes pixels either fully transparent, or not transparent at all.
  4556. Higher values result in semi-transparent pixels, with a higher transparency
  4557. the more similar the pixels color is to the key color.
  4558. @item yuv
  4559. Signals that the color passed is already in YUV instead of RGB.
  4560. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4561. This can be used to pass exact YUV values as hexadecimal numbers.
  4562. @end table
  4563. @subsection Examples
  4564. @itemize
  4565. @item
  4566. Make every green pixel in the input image transparent:
  4567. @example
  4568. ffmpeg -i input.png -vf chromakey=green out.png
  4569. @end example
  4570. @item
  4571. Overlay a greenscreen-video on top of a static black background.
  4572. @example
  4573. 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
  4574. @end example
  4575. @end itemize
  4576. @section ciescope
  4577. Display CIE color diagram with pixels overlaid onto it.
  4578. The filter accepts the following options:
  4579. @table @option
  4580. @item system
  4581. Set color system.
  4582. @table @samp
  4583. @item ntsc, 470m
  4584. @item ebu, 470bg
  4585. @item smpte
  4586. @item 240m
  4587. @item apple
  4588. @item widergb
  4589. @item cie1931
  4590. @item rec709, hdtv
  4591. @item uhdtv, rec2020
  4592. @end table
  4593. @item cie
  4594. Set CIE system.
  4595. @table @samp
  4596. @item xyy
  4597. @item ucs
  4598. @item luv
  4599. @end table
  4600. @item gamuts
  4601. Set what gamuts to draw.
  4602. See @code{system} option for available values.
  4603. @item size, s
  4604. Set ciescope size, by default set to 512.
  4605. @item intensity, i
  4606. Set intensity used to map input pixel values to CIE diagram.
  4607. @item contrast
  4608. Set contrast used to draw tongue colors that are out of active color system gamut.
  4609. @item corrgamma
  4610. Correct gamma displayed on scope, by default enabled.
  4611. @item showwhite
  4612. Show white point on CIE diagram, by default disabled.
  4613. @item gamma
  4614. Set input gamma. Used only with XYZ input color space.
  4615. @end table
  4616. @section codecview
  4617. Visualize information exported by some codecs.
  4618. Some codecs can export information through frames using side-data or other
  4619. means. For example, some MPEG based codecs export motion vectors through the
  4620. @var{export_mvs} flag in the codec @option{flags2} option.
  4621. The filter accepts the following option:
  4622. @table @option
  4623. @item mv
  4624. Set motion vectors to visualize.
  4625. Available flags for @var{mv} are:
  4626. @table @samp
  4627. @item pf
  4628. forward predicted MVs of P-frames
  4629. @item bf
  4630. forward predicted MVs of B-frames
  4631. @item bb
  4632. backward predicted MVs of B-frames
  4633. @end table
  4634. @item qp
  4635. Display quantization parameters using the chroma planes.
  4636. @item mv_type, mvt
  4637. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4638. Available flags for @var{mv_type} are:
  4639. @table @samp
  4640. @item fp
  4641. forward predicted MVs
  4642. @item bp
  4643. backward predicted MVs
  4644. @end table
  4645. @item frame_type, ft
  4646. Set frame type to visualize motion vectors of.
  4647. Available flags for @var{frame_type} are:
  4648. @table @samp
  4649. @item if
  4650. intra-coded frames (I-frames)
  4651. @item pf
  4652. predicted frames (P-frames)
  4653. @item bf
  4654. bi-directionally predicted frames (B-frames)
  4655. @end table
  4656. @end table
  4657. @subsection Examples
  4658. @itemize
  4659. @item
  4660. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4661. @example
  4662. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4663. @end example
  4664. @item
  4665. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4666. @example
  4667. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4668. @end example
  4669. @end itemize
  4670. @section colorbalance
  4671. Modify intensity of primary colors (red, green and blue) of input frames.
  4672. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4673. regions for the red-cyan, green-magenta or blue-yellow balance.
  4674. A positive adjustment value shifts the balance towards the primary color, a negative
  4675. value towards the complementary color.
  4676. The filter accepts the following options:
  4677. @table @option
  4678. @item rs
  4679. @item gs
  4680. @item bs
  4681. Adjust red, green and blue shadows (darkest pixels).
  4682. @item rm
  4683. @item gm
  4684. @item bm
  4685. Adjust red, green and blue midtones (medium pixels).
  4686. @item rh
  4687. @item gh
  4688. @item bh
  4689. Adjust red, green and blue highlights (brightest pixels).
  4690. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4691. @end table
  4692. @subsection Examples
  4693. @itemize
  4694. @item
  4695. Add red color cast to shadows:
  4696. @example
  4697. colorbalance=rs=.3
  4698. @end example
  4699. @end itemize
  4700. @section colorkey
  4701. RGB colorspace color keying.
  4702. The filter accepts the following options:
  4703. @table @option
  4704. @item color
  4705. The color which will be replaced with transparency.
  4706. @item similarity
  4707. Similarity percentage with the key color.
  4708. 0.01 matches only the exact key color, while 1.0 matches everything.
  4709. @item blend
  4710. Blend percentage.
  4711. 0.0 makes pixels either fully transparent, or not transparent at all.
  4712. Higher values result in semi-transparent pixels, with a higher transparency
  4713. the more similar the pixels color is to the key color.
  4714. @end table
  4715. @subsection Examples
  4716. @itemize
  4717. @item
  4718. Make every green pixel in the input image transparent:
  4719. @example
  4720. ffmpeg -i input.png -vf colorkey=green out.png
  4721. @end example
  4722. @item
  4723. Overlay a greenscreen-video on top of a static background image.
  4724. @example
  4725. 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
  4726. @end example
  4727. @end itemize
  4728. @section colorlevels
  4729. Adjust video input frames using levels.
  4730. The filter accepts the following options:
  4731. @table @option
  4732. @item rimin
  4733. @item gimin
  4734. @item bimin
  4735. @item aimin
  4736. Adjust red, green, blue and alpha input black point.
  4737. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4738. @item rimax
  4739. @item gimax
  4740. @item bimax
  4741. @item aimax
  4742. Adjust red, green, blue and alpha input white point.
  4743. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4744. Input levels are used to lighten highlights (bright tones), darken shadows
  4745. (dark tones), change the balance of bright and dark tones.
  4746. @item romin
  4747. @item gomin
  4748. @item bomin
  4749. @item aomin
  4750. Adjust red, green, blue and alpha output black point.
  4751. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4752. @item romax
  4753. @item gomax
  4754. @item bomax
  4755. @item aomax
  4756. Adjust red, green, blue and alpha output white point.
  4757. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4758. Output levels allows manual selection of a constrained output level range.
  4759. @end table
  4760. @subsection Examples
  4761. @itemize
  4762. @item
  4763. Make video output darker:
  4764. @example
  4765. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4766. @end example
  4767. @item
  4768. Increase contrast:
  4769. @example
  4770. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4771. @end example
  4772. @item
  4773. Make video output lighter:
  4774. @example
  4775. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4776. @end example
  4777. @item
  4778. Increase brightness:
  4779. @example
  4780. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4781. @end example
  4782. @end itemize
  4783. @section colorchannelmixer
  4784. Adjust video input frames by re-mixing color channels.
  4785. This filter modifies a color channel by adding the values associated to
  4786. the other channels of the same pixels. For example if the value to
  4787. modify is red, the output value will be:
  4788. @example
  4789. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4790. @end example
  4791. The filter accepts the following options:
  4792. @table @option
  4793. @item rr
  4794. @item rg
  4795. @item rb
  4796. @item ra
  4797. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4798. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4799. @item gr
  4800. @item gg
  4801. @item gb
  4802. @item ga
  4803. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4804. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4805. @item br
  4806. @item bg
  4807. @item bb
  4808. @item ba
  4809. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4810. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4811. @item ar
  4812. @item ag
  4813. @item ab
  4814. @item aa
  4815. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4816. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4817. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4818. @end table
  4819. @subsection Examples
  4820. @itemize
  4821. @item
  4822. Convert source to grayscale:
  4823. @example
  4824. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4825. @end example
  4826. @item
  4827. Simulate sepia tones:
  4828. @example
  4829. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4830. @end example
  4831. @end itemize
  4832. @section colormatrix
  4833. Convert color matrix.
  4834. The filter accepts the following options:
  4835. @table @option
  4836. @item src
  4837. @item dst
  4838. Specify the source and destination color matrix. Both values must be
  4839. specified.
  4840. The accepted values are:
  4841. @table @samp
  4842. @item bt709
  4843. BT.709
  4844. @item fcc
  4845. FCC
  4846. @item bt601
  4847. BT.601
  4848. @item bt470
  4849. BT.470
  4850. @item bt470bg
  4851. BT.470BG
  4852. @item smpte170m
  4853. SMPTE-170M
  4854. @item smpte240m
  4855. SMPTE-240M
  4856. @item bt2020
  4857. BT.2020
  4858. @end table
  4859. @end table
  4860. For example to convert from BT.601 to SMPTE-240M, use the command:
  4861. @example
  4862. colormatrix=bt601:smpte240m
  4863. @end example
  4864. @section colorspace
  4865. Convert colorspace, transfer characteristics or color primaries.
  4866. Input video needs to have an even size.
  4867. The filter accepts the following options:
  4868. @table @option
  4869. @anchor{all}
  4870. @item all
  4871. Specify all color properties at once.
  4872. The accepted values are:
  4873. @table @samp
  4874. @item bt470m
  4875. BT.470M
  4876. @item bt470bg
  4877. BT.470BG
  4878. @item bt601-6-525
  4879. BT.601-6 525
  4880. @item bt601-6-625
  4881. BT.601-6 625
  4882. @item bt709
  4883. BT.709
  4884. @item smpte170m
  4885. SMPTE-170M
  4886. @item smpte240m
  4887. SMPTE-240M
  4888. @item bt2020
  4889. BT.2020
  4890. @end table
  4891. @anchor{space}
  4892. @item space
  4893. Specify output colorspace.
  4894. The accepted values are:
  4895. @table @samp
  4896. @item bt709
  4897. BT.709
  4898. @item fcc
  4899. FCC
  4900. @item bt470bg
  4901. BT.470BG or BT.601-6 625
  4902. @item smpte170m
  4903. SMPTE-170M or BT.601-6 525
  4904. @item smpte240m
  4905. SMPTE-240M
  4906. @item ycgco
  4907. YCgCo
  4908. @item bt2020ncl
  4909. BT.2020 with non-constant luminance
  4910. @end table
  4911. @anchor{trc}
  4912. @item trc
  4913. Specify output transfer characteristics.
  4914. The accepted values are:
  4915. @table @samp
  4916. @item bt709
  4917. BT.709
  4918. @item bt470m
  4919. BT.470M
  4920. @item bt470bg
  4921. BT.470BG
  4922. @item gamma22
  4923. Constant gamma of 2.2
  4924. @item gamma28
  4925. Constant gamma of 2.8
  4926. @item smpte170m
  4927. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4928. @item smpte240m
  4929. SMPTE-240M
  4930. @item srgb
  4931. SRGB
  4932. @item iec61966-2-1
  4933. iec61966-2-1
  4934. @item iec61966-2-4
  4935. iec61966-2-4
  4936. @item xvycc
  4937. xvycc
  4938. @item bt2020-10
  4939. BT.2020 for 10-bits content
  4940. @item bt2020-12
  4941. BT.2020 for 12-bits content
  4942. @end table
  4943. @anchor{primaries}
  4944. @item primaries
  4945. Specify output color primaries.
  4946. The accepted values are:
  4947. @table @samp
  4948. @item bt709
  4949. BT.709
  4950. @item bt470m
  4951. BT.470M
  4952. @item bt470bg
  4953. BT.470BG or BT.601-6 625
  4954. @item smpte170m
  4955. SMPTE-170M or BT.601-6 525
  4956. @item smpte240m
  4957. SMPTE-240M
  4958. @item film
  4959. film
  4960. @item smpte431
  4961. SMPTE-431
  4962. @item smpte432
  4963. SMPTE-432
  4964. @item bt2020
  4965. BT.2020
  4966. @item jedec-p22
  4967. JEDEC P22 phosphors
  4968. @end table
  4969. @anchor{range}
  4970. @item range
  4971. Specify output color range.
  4972. The accepted values are:
  4973. @table @samp
  4974. @item tv
  4975. TV (restricted) range
  4976. @item mpeg
  4977. MPEG (restricted) range
  4978. @item pc
  4979. PC (full) range
  4980. @item jpeg
  4981. JPEG (full) range
  4982. @end table
  4983. @item format
  4984. Specify output color format.
  4985. The accepted values are:
  4986. @table @samp
  4987. @item yuv420p
  4988. YUV 4:2:0 planar 8-bits
  4989. @item yuv420p10
  4990. YUV 4:2:0 planar 10-bits
  4991. @item yuv420p12
  4992. YUV 4:2:0 planar 12-bits
  4993. @item yuv422p
  4994. YUV 4:2:2 planar 8-bits
  4995. @item yuv422p10
  4996. YUV 4:2:2 planar 10-bits
  4997. @item yuv422p12
  4998. YUV 4:2:2 planar 12-bits
  4999. @item yuv444p
  5000. YUV 4:4:4 planar 8-bits
  5001. @item yuv444p10
  5002. YUV 4:4:4 planar 10-bits
  5003. @item yuv444p12
  5004. YUV 4:4:4 planar 12-bits
  5005. @end table
  5006. @item fast
  5007. Do a fast conversion, which skips gamma/primary correction. This will take
  5008. significantly less CPU, but will be mathematically incorrect. To get output
  5009. compatible with that produced by the colormatrix filter, use fast=1.
  5010. @item dither
  5011. Specify dithering mode.
  5012. The accepted values are:
  5013. @table @samp
  5014. @item none
  5015. No dithering
  5016. @item fsb
  5017. Floyd-Steinberg dithering
  5018. @end table
  5019. @item wpadapt
  5020. Whitepoint adaptation mode.
  5021. The accepted values are:
  5022. @table @samp
  5023. @item bradford
  5024. Bradford whitepoint adaptation
  5025. @item vonkries
  5026. von Kries whitepoint adaptation
  5027. @item identity
  5028. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5029. @end table
  5030. @item iall
  5031. Override all input properties at once. Same accepted values as @ref{all}.
  5032. @item ispace
  5033. Override input colorspace. Same accepted values as @ref{space}.
  5034. @item iprimaries
  5035. Override input color primaries. Same accepted values as @ref{primaries}.
  5036. @item itrc
  5037. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5038. @item irange
  5039. Override input color range. Same accepted values as @ref{range}.
  5040. @end table
  5041. The filter converts the transfer characteristics, color space and color
  5042. primaries to the specified user values. The output value, if not specified,
  5043. is set to a default value based on the "all" property. If that property is
  5044. also not specified, the filter will log an error. The output color range and
  5045. format default to the same value as the input color range and format. The
  5046. input transfer characteristics, color space, color primaries and color range
  5047. should be set on the input data. If any of these are missing, the filter will
  5048. log an error and no conversion will take place.
  5049. For example to convert the input to SMPTE-240M, use the command:
  5050. @example
  5051. colorspace=smpte240m
  5052. @end example
  5053. @section convolution
  5054. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5055. The filter accepts the following options:
  5056. @table @option
  5057. @item 0m
  5058. @item 1m
  5059. @item 2m
  5060. @item 3m
  5061. Set matrix for each plane.
  5062. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5063. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5064. @item 0rdiv
  5065. @item 1rdiv
  5066. @item 2rdiv
  5067. @item 3rdiv
  5068. Set multiplier for calculated value for each plane.
  5069. If unset or 0, it will be sum of all matrix elements.
  5070. @item 0bias
  5071. @item 1bias
  5072. @item 2bias
  5073. @item 3bias
  5074. Set bias for each plane. This value is added to the result of the multiplication.
  5075. Useful for making the overall image brighter or darker. Default is 0.0.
  5076. @item 0mode
  5077. @item 1mode
  5078. @item 2mode
  5079. @item 3mode
  5080. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5081. Default is @var{square}.
  5082. @end table
  5083. @subsection Examples
  5084. @itemize
  5085. @item
  5086. Apply sharpen:
  5087. @example
  5088. 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"
  5089. @end example
  5090. @item
  5091. Apply blur:
  5092. @example
  5093. 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"
  5094. @end example
  5095. @item
  5096. Apply edge enhance:
  5097. @example
  5098. 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"
  5099. @end example
  5100. @item
  5101. Apply edge detect:
  5102. @example
  5103. 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"
  5104. @end example
  5105. @item
  5106. Apply laplacian edge detector which includes diagonals:
  5107. @example
  5108. 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"
  5109. @end example
  5110. @item
  5111. Apply emboss:
  5112. @example
  5113. 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"
  5114. @end example
  5115. @end itemize
  5116. @section convolve
  5117. Apply 2D convolution of video stream in frequency domain using second stream
  5118. as impulse.
  5119. The filter accepts the following options:
  5120. @table @option
  5121. @item planes
  5122. Set which planes to process.
  5123. @item impulse
  5124. Set which impulse video frames will be processed, can be @var{first}
  5125. or @var{all}. Default is @var{all}.
  5126. @end table
  5127. The @code{convolve} filter also supports the @ref{framesync} options.
  5128. @section copy
  5129. Copy the input video source unchanged to the output. This is mainly useful for
  5130. testing purposes.
  5131. @anchor{coreimage}
  5132. @section coreimage
  5133. Video filtering on GPU using Apple's CoreImage API on OSX.
  5134. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5135. processed by video hardware. However, software-based OpenGL implementations
  5136. exist which means there is no guarantee for hardware processing. It depends on
  5137. the respective OSX.
  5138. There are many filters and image generators provided by Apple that come with a
  5139. large variety of options. The filter has to be referenced by its name along
  5140. with its options.
  5141. The coreimage filter accepts the following options:
  5142. @table @option
  5143. @item list_filters
  5144. List all available filters and generators along with all their respective
  5145. options as well as possible minimum and maximum values along with the default
  5146. values.
  5147. @example
  5148. list_filters=true
  5149. @end example
  5150. @item filter
  5151. Specify all filters by their respective name and options.
  5152. Use @var{list_filters} to determine all valid filter names and options.
  5153. Numerical options are specified by a float value and are automatically clamped
  5154. to their respective value range. Vector and color options have to be specified
  5155. by a list of space separated float values. Character escaping has to be done.
  5156. A special option name @code{default} is available to use default options for a
  5157. filter.
  5158. It is required to specify either @code{default} or at least one of the filter options.
  5159. All omitted options are used with their default values.
  5160. The syntax of the filter string is as follows:
  5161. @example
  5162. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5163. @end example
  5164. @item output_rect
  5165. Specify a rectangle where the output of the filter chain is copied into the
  5166. input image. It is given by a list of space separated float values:
  5167. @example
  5168. output_rect=x\ y\ width\ height
  5169. @end example
  5170. If not given, the output rectangle equals the dimensions of the input image.
  5171. The output rectangle is automatically cropped at the borders of the input
  5172. image. Negative values are valid for each component.
  5173. @example
  5174. output_rect=25\ 25\ 100\ 100
  5175. @end example
  5176. @end table
  5177. Several filters can be chained for successive processing without GPU-HOST
  5178. transfers allowing for fast processing of complex filter chains.
  5179. Currently, only filters with zero (generators) or exactly one (filters) input
  5180. image and one output image are supported. Also, transition filters are not yet
  5181. usable as intended.
  5182. Some filters generate output images with additional padding depending on the
  5183. respective filter kernel. The padding is automatically removed to ensure the
  5184. filter output has the same size as the input image.
  5185. For image generators, the size of the output image is determined by the
  5186. previous output image of the filter chain or the input image of the whole
  5187. filterchain, respectively. The generators do not use the pixel information of
  5188. this image to generate their output. However, the generated output is
  5189. blended onto this image, resulting in partial or complete coverage of the
  5190. output image.
  5191. The @ref{coreimagesrc} video source can be used for generating input images
  5192. which are directly fed into the filter chain. By using it, providing input
  5193. images by another video source or an input video is not required.
  5194. @subsection Examples
  5195. @itemize
  5196. @item
  5197. List all filters available:
  5198. @example
  5199. coreimage=list_filters=true
  5200. @end example
  5201. @item
  5202. Use the CIBoxBlur filter with default options to blur an image:
  5203. @example
  5204. coreimage=filter=CIBoxBlur@@default
  5205. @end example
  5206. @item
  5207. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5208. its center at 100x100 and a radius of 50 pixels:
  5209. @example
  5210. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5211. @end example
  5212. @item
  5213. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5214. given as complete and escaped command-line for Apple's standard bash shell:
  5215. @example
  5216. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5217. @end example
  5218. @end itemize
  5219. @section crop
  5220. Crop the input video to given dimensions.
  5221. It accepts the following parameters:
  5222. @table @option
  5223. @item w, out_w
  5224. The width of the output video. It defaults to @code{iw}.
  5225. This expression is evaluated only once during the filter
  5226. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5227. @item h, out_h
  5228. The height of the output video. It defaults to @code{ih}.
  5229. This expression is evaluated only once during the filter
  5230. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5231. @item x
  5232. The horizontal position, in the input video, of the left edge of the output
  5233. video. It defaults to @code{(in_w-out_w)/2}.
  5234. This expression is evaluated per-frame.
  5235. @item y
  5236. The vertical position, in the input video, of the top edge of the output video.
  5237. It defaults to @code{(in_h-out_h)/2}.
  5238. This expression is evaluated per-frame.
  5239. @item keep_aspect
  5240. If set to 1 will force the output display aspect ratio
  5241. to be the same of the input, by changing the output sample aspect
  5242. ratio. It defaults to 0.
  5243. @item exact
  5244. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5245. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5246. It defaults to 0.
  5247. @end table
  5248. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5249. expressions containing the following constants:
  5250. @table @option
  5251. @item x
  5252. @item y
  5253. The computed values for @var{x} and @var{y}. They are evaluated for
  5254. each new frame.
  5255. @item in_w
  5256. @item in_h
  5257. The input width and height.
  5258. @item iw
  5259. @item ih
  5260. These are the same as @var{in_w} and @var{in_h}.
  5261. @item out_w
  5262. @item out_h
  5263. The output (cropped) width and height.
  5264. @item ow
  5265. @item oh
  5266. These are the same as @var{out_w} and @var{out_h}.
  5267. @item a
  5268. same as @var{iw} / @var{ih}
  5269. @item sar
  5270. input sample aspect ratio
  5271. @item dar
  5272. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5273. @item hsub
  5274. @item vsub
  5275. horizontal and vertical chroma subsample values. For example for the
  5276. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5277. @item n
  5278. The number of the input frame, starting from 0.
  5279. @item pos
  5280. the position in the file of the input frame, NAN if unknown
  5281. @item t
  5282. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5283. @end table
  5284. The expression for @var{out_w} may depend on the value of @var{out_h},
  5285. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5286. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5287. evaluated after @var{out_w} and @var{out_h}.
  5288. The @var{x} and @var{y} parameters specify the expressions for the
  5289. position of the top-left corner of the output (non-cropped) area. They
  5290. are evaluated for each frame. If the evaluated value is not valid, it
  5291. is approximated to the nearest valid value.
  5292. The expression for @var{x} may depend on @var{y}, and the expression
  5293. for @var{y} may depend on @var{x}.
  5294. @subsection Examples
  5295. @itemize
  5296. @item
  5297. Crop area with size 100x100 at position (12,34).
  5298. @example
  5299. crop=100:100:12:34
  5300. @end example
  5301. Using named options, the example above becomes:
  5302. @example
  5303. crop=w=100:h=100:x=12:y=34
  5304. @end example
  5305. @item
  5306. Crop the central input area with size 100x100:
  5307. @example
  5308. crop=100:100
  5309. @end example
  5310. @item
  5311. Crop the central input area with size 2/3 of the input video:
  5312. @example
  5313. crop=2/3*in_w:2/3*in_h
  5314. @end example
  5315. @item
  5316. Crop the input video central square:
  5317. @example
  5318. crop=out_w=in_h
  5319. crop=in_h
  5320. @end example
  5321. @item
  5322. Delimit the rectangle with the top-left corner placed at position
  5323. 100:100 and the right-bottom corner corresponding to the right-bottom
  5324. corner of the input image.
  5325. @example
  5326. crop=in_w-100:in_h-100:100:100
  5327. @end example
  5328. @item
  5329. Crop 10 pixels from the left and right borders, and 20 pixels from
  5330. the top and bottom borders
  5331. @example
  5332. crop=in_w-2*10:in_h-2*20
  5333. @end example
  5334. @item
  5335. Keep only the bottom right quarter of the input image:
  5336. @example
  5337. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5338. @end example
  5339. @item
  5340. Crop height for getting Greek harmony:
  5341. @example
  5342. crop=in_w:1/PHI*in_w
  5343. @end example
  5344. @item
  5345. Apply trembling effect:
  5346. @example
  5347. 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)
  5348. @end example
  5349. @item
  5350. Apply erratic camera effect depending on timestamp:
  5351. @example
  5352. 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)"
  5353. @end example
  5354. @item
  5355. Set x depending on the value of y:
  5356. @example
  5357. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5358. @end example
  5359. @end itemize
  5360. @subsection Commands
  5361. This filter supports the following commands:
  5362. @table @option
  5363. @item w, out_w
  5364. @item h, out_h
  5365. @item x
  5366. @item y
  5367. Set width/height of the output video and the horizontal/vertical position
  5368. in the input video.
  5369. The command accepts the same syntax of the corresponding option.
  5370. If the specified expression is not valid, it is kept at its current
  5371. value.
  5372. @end table
  5373. @section cropdetect
  5374. Auto-detect the crop size.
  5375. It calculates the necessary cropping parameters and prints the
  5376. recommended parameters via the logging system. The detected dimensions
  5377. correspond to the non-black area of the input video.
  5378. It accepts the following parameters:
  5379. @table @option
  5380. @item limit
  5381. Set higher black value threshold, which can be optionally specified
  5382. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5383. value greater to the set value is considered non-black. It defaults to 24.
  5384. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5385. on the bitdepth of the pixel format.
  5386. @item round
  5387. The value which the width/height should be divisible by. It defaults to
  5388. 16. The offset is automatically adjusted to center the video. Use 2 to
  5389. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5390. encoding to most video codecs.
  5391. @item reset_count, reset
  5392. Set the counter that determines after how many frames cropdetect will
  5393. reset the previously detected largest video area and start over to
  5394. detect the current optimal crop area. Default value is 0.
  5395. This can be useful when channel logos distort the video area. 0
  5396. indicates 'never reset', and returns the largest area encountered during
  5397. playback.
  5398. @end table
  5399. @anchor{curves}
  5400. @section curves
  5401. Apply color adjustments using curves.
  5402. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5403. component (red, green and blue) has its values defined by @var{N} key points
  5404. tied from each other using a smooth curve. The x-axis represents the pixel
  5405. values from the input frame, and the y-axis the new pixel values to be set for
  5406. the output frame.
  5407. By default, a component curve is defined by the two points @var{(0;0)} and
  5408. @var{(1;1)}. This creates a straight line where each original pixel value is
  5409. "adjusted" to its own value, which means no change to the image.
  5410. The filter allows you to redefine these two points and add some more. A new
  5411. curve (using a natural cubic spline interpolation) will be define to pass
  5412. smoothly through all these new coordinates. The new defined points needs to be
  5413. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5414. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5415. the vector spaces, the values will be clipped accordingly.
  5416. The filter accepts the following options:
  5417. @table @option
  5418. @item preset
  5419. Select one of the available color presets. This option can be used in addition
  5420. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5421. options takes priority on the preset values.
  5422. Available presets are:
  5423. @table @samp
  5424. @item none
  5425. @item color_negative
  5426. @item cross_process
  5427. @item darker
  5428. @item increase_contrast
  5429. @item lighter
  5430. @item linear_contrast
  5431. @item medium_contrast
  5432. @item negative
  5433. @item strong_contrast
  5434. @item vintage
  5435. @end table
  5436. Default is @code{none}.
  5437. @item master, m
  5438. Set the master key points. These points will define a second pass mapping. It
  5439. is sometimes called a "luminance" or "value" mapping. It can be used with
  5440. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5441. post-processing LUT.
  5442. @item red, r
  5443. Set the key points for the red component.
  5444. @item green, g
  5445. Set the key points for the green component.
  5446. @item blue, b
  5447. Set the key points for the blue component.
  5448. @item all
  5449. Set the key points for all components (not including master).
  5450. Can be used in addition to the other key points component
  5451. options. In this case, the unset component(s) will fallback on this
  5452. @option{all} setting.
  5453. @item psfile
  5454. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5455. @item plot
  5456. Save Gnuplot script of the curves in specified file.
  5457. @end table
  5458. To avoid some filtergraph syntax conflicts, each key points list need to be
  5459. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5460. @subsection Examples
  5461. @itemize
  5462. @item
  5463. Increase slightly the middle level of blue:
  5464. @example
  5465. curves=blue='0/0 0.5/0.58 1/1'
  5466. @end example
  5467. @item
  5468. Vintage effect:
  5469. @example
  5470. 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'
  5471. @end example
  5472. Here we obtain the following coordinates for each components:
  5473. @table @var
  5474. @item red
  5475. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5476. @item green
  5477. @code{(0;0) (0.50;0.48) (1;1)}
  5478. @item blue
  5479. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5480. @end table
  5481. @item
  5482. The previous example can also be achieved with the associated built-in preset:
  5483. @example
  5484. curves=preset=vintage
  5485. @end example
  5486. @item
  5487. Or simply:
  5488. @example
  5489. curves=vintage
  5490. @end example
  5491. @item
  5492. Use a Photoshop preset and redefine the points of the green component:
  5493. @example
  5494. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5495. @end example
  5496. @item
  5497. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5498. and @command{gnuplot}:
  5499. @example
  5500. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5501. gnuplot -p /tmp/curves.plt
  5502. @end example
  5503. @end itemize
  5504. @section datascope
  5505. Video data analysis filter.
  5506. This filter shows hexadecimal pixel values of part of video.
  5507. The filter accepts the following options:
  5508. @table @option
  5509. @item size, s
  5510. Set output video size.
  5511. @item x
  5512. Set x offset from where to pick pixels.
  5513. @item y
  5514. Set y offset from where to pick pixels.
  5515. @item mode
  5516. Set scope mode, can be one of the following:
  5517. @table @samp
  5518. @item mono
  5519. Draw hexadecimal pixel values with white color on black background.
  5520. @item color
  5521. Draw hexadecimal pixel values with input video pixel color on black
  5522. background.
  5523. @item color2
  5524. Draw hexadecimal pixel values on color background picked from input video,
  5525. the text color is picked in such way so its always visible.
  5526. @end table
  5527. @item axis
  5528. Draw rows and columns numbers on left and top of video.
  5529. @item opacity
  5530. Set background opacity.
  5531. @end table
  5532. @section dctdnoiz
  5533. Denoise frames using 2D DCT (frequency domain filtering).
  5534. This filter is not designed for real time.
  5535. The filter accepts the following options:
  5536. @table @option
  5537. @item sigma, s
  5538. Set the noise sigma constant.
  5539. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5540. coefficient (absolute value) below this threshold with be dropped.
  5541. If you need a more advanced filtering, see @option{expr}.
  5542. Default is @code{0}.
  5543. @item overlap
  5544. Set number overlapping pixels for each block. Since the filter can be slow, you
  5545. may want to reduce this value, at the cost of a less effective filter and the
  5546. risk of various artefacts.
  5547. If the overlapping value doesn't permit processing the whole input width or
  5548. height, a warning will be displayed and according borders won't be denoised.
  5549. Default value is @var{blocksize}-1, which is the best possible setting.
  5550. @item expr, e
  5551. Set the coefficient factor expression.
  5552. For each coefficient of a DCT block, this expression will be evaluated as a
  5553. multiplier value for the coefficient.
  5554. If this is option is set, the @option{sigma} option will be ignored.
  5555. The absolute value of the coefficient can be accessed through the @var{c}
  5556. variable.
  5557. @item n
  5558. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5559. @var{blocksize}, which is the width and height of the processed blocks.
  5560. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5561. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5562. on the speed processing. Also, a larger block size does not necessarily means a
  5563. better de-noising.
  5564. @end table
  5565. @subsection Examples
  5566. Apply a denoise with a @option{sigma} of @code{4.5}:
  5567. @example
  5568. dctdnoiz=4.5
  5569. @end example
  5570. The same operation can be achieved using the expression system:
  5571. @example
  5572. dctdnoiz=e='gte(c, 4.5*3)'
  5573. @end example
  5574. Violent denoise using a block size of @code{16x16}:
  5575. @example
  5576. dctdnoiz=15:n=4
  5577. @end example
  5578. @section deband
  5579. Remove banding artifacts from input video.
  5580. It works by replacing banded pixels with average value of referenced pixels.
  5581. The filter accepts the following options:
  5582. @table @option
  5583. @item 1thr
  5584. @item 2thr
  5585. @item 3thr
  5586. @item 4thr
  5587. Set banding detection threshold for each plane. Default is 0.02.
  5588. Valid range is 0.00003 to 0.5.
  5589. If difference between current pixel and reference pixel is less than threshold,
  5590. it will be considered as banded.
  5591. @item range, r
  5592. Banding detection range in pixels. Default is 16. If positive, random number
  5593. in range 0 to set value will be used. If negative, exact absolute value
  5594. will be used.
  5595. The range defines square of four pixels around current pixel.
  5596. @item direction, d
  5597. Set direction in radians from which four pixel will be compared. If positive,
  5598. random direction from 0 to set direction will be picked. If negative, exact of
  5599. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5600. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5601. column.
  5602. @item blur, b
  5603. If enabled, current pixel is compared with average value of all four
  5604. surrounding pixels. The default is enabled. If disabled current pixel is
  5605. compared with all four surrounding pixels. The pixel is considered banded
  5606. if only all four differences with surrounding pixels are less than threshold.
  5607. @item coupling, c
  5608. If enabled, current pixel is changed if and only if all pixel components are banded,
  5609. e.g. banding detection threshold is triggered for all color components.
  5610. The default is disabled.
  5611. @end table
  5612. @section deblock
  5613. Remove blocking artifacts from input video.
  5614. The filter accepts the following options:
  5615. @table @option
  5616. @item filter
  5617. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  5618. This controls what kind of deblocking is applied.
  5619. @item block
  5620. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  5621. @item alpha
  5622. @item beta
  5623. @item gamma
  5624. @item delta
  5625. Set blocking detection thresholds. Allowed range is 0 to 1.
  5626. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  5627. Using higher threshold gives more deblocking strength.
  5628. Setting @var{alpha} controls threshold detection at exact edge of block.
  5629. Remaining options controls threshold detection near the edge. Each one for
  5630. below/above or left/right. Setting any of those to @var{0} disables
  5631. deblocking.
  5632. @item planes
  5633. Set planes to filter. Default is to filter all available planes.
  5634. @end table
  5635. @subsection Examples
  5636. @itemize
  5637. @item
  5638. Deblock using weak filter and block size of 4 pixels.
  5639. @example
  5640. deblock=filter=weak:block=4
  5641. @end example
  5642. @item
  5643. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  5644. deblocking more edges.
  5645. @example
  5646. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  5647. @end example
  5648. @item
  5649. Similar as above, but filter only first plane.
  5650. @example
  5651. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  5652. @end example
  5653. @item
  5654. Similar as above, but filter only second and third plane.
  5655. @example
  5656. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  5657. @end example
  5658. @end itemize
  5659. @anchor{decimate}
  5660. @section decimate
  5661. Drop duplicated frames at regular intervals.
  5662. The filter accepts the following options:
  5663. @table @option
  5664. @item cycle
  5665. Set the number of frames from which one will be dropped. Setting this to
  5666. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5667. Default is @code{5}.
  5668. @item dupthresh
  5669. Set the threshold for duplicate detection. If the difference metric for a frame
  5670. is less than or equal to this value, then it is declared as duplicate. Default
  5671. is @code{1.1}
  5672. @item scthresh
  5673. Set scene change threshold. Default is @code{15}.
  5674. @item blockx
  5675. @item blocky
  5676. Set the size of the x and y-axis blocks used during metric calculations.
  5677. Larger blocks give better noise suppression, but also give worse detection of
  5678. small movements. Must be a power of two. Default is @code{32}.
  5679. @item ppsrc
  5680. Mark main input as a pre-processed input and activate clean source input
  5681. stream. This allows the input to be pre-processed with various filters to help
  5682. the metrics calculation while keeping the frame selection lossless. When set to
  5683. @code{1}, the first stream is for the pre-processed input, and the second
  5684. stream is the clean source from where the kept frames are chosen. Default is
  5685. @code{0}.
  5686. @item chroma
  5687. Set whether or not chroma is considered in the metric calculations. Default is
  5688. @code{1}.
  5689. @end table
  5690. @section deconvolve
  5691. Apply 2D deconvolution of video stream in frequency domain using second stream
  5692. as impulse.
  5693. The filter accepts the following options:
  5694. @table @option
  5695. @item planes
  5696. Set which planes to process.
  5697. @item impulse
  5698. Set which impulse video frames will be processed, can be @var{first}
  5699. or @var{all}. Default is @var{all}.
  5700. @item noise
  5701. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  5702. and height are not same and not power of 2 or if stream prior to convolving
  5703. had noise.
  5704. @end table
  5705. The @code{deconvolve} filter also supports the @ref{framesync} options.
  5706. @section deflate
  5707. Apply deflate effect to the video.
  5708. This filter replaces the pixel by the local(3x3) average by taking into account
  5709. only values lower than the pixel.
  5710. It accepts the following options:
  5711. @table @option
  5712. @item threshold0
  5713. @item threshold1
  5714. @item threshold2
  5715. @item threshold3
  5716. Limit the maximum change for each plane, default is 65535.
  5717. If 0, plane will remain unchanged.
  5718. @end table
  5719. @section deflicker
  5720. Remove temporal frame luminance variations.
  5721. It accepts the following options:
  5722. @table @option
  5723. @item size, s
  5724. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5725. @item mode, m
  5726. Set averaging mode to smooth temporal luminance variations.
  5727. Available values are:
  5728. @table @samp
  5729. @item am
  5730. Arithmetic mean
  5731. @item gm
  5732. Geometric mean
  5733. @item hm
  5734. Harmonic mean
  5735. @item qm
  5736. Quadratic mean
  5737. @item cm
  5738. Cubic mean
  5739. @item pm
  5740. Power mean
  5741. @item median
  5742. Median
  5743. @end table
  5744. @item bypass
  5745. Do not actually modify frame. Useful when one only wants metadata.
  5746. @end table
  5747. @section dejudder
  5748. Remove judder produced by partially interlaced telecined content.
  5749. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5750. source was partially telecined content then the output of @code{pullup,dejudder}
  5751. will have a variable frame rate. May change the recorded frame rate of the
  5752. container. Aside from that change, this filter will not affect constant frame
  5753. rate video.
  5754. The option available in this filter is:
  5755. @table @option
  5756. @item cycle
  5757. Specify the length of the window over which the judder repeats.
  5758. Accepts any integer greater than 1. Useful values are:
  5759. @table @samp
  5760. @item 4
  5761. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5762. @item 5
  5763. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5764. @item 20
  5765. If a mixture of the two.
  5766. @end table
  5767. The default is @samp{4}.
  5768. @end table
  5769. @section delogo
  5770. Suppress a TV station logo by a simple interpolation of the surrounding
  5771. pixels. Just set a rectangle covering the logo and watch it disappear
  5772. (and sometimes something even uglier appear - your mileage may vary).
  5773. It accepts the following parameters:
  5774. @table @option
  5775. @item x
  5776. @item y
  5777. Specify the top left corner coordinates of the logo. They must be
  5778. specified.
  5779. @item w
  5780. @item h
  5781. Specify the width and height of the logo to clear. They must be
  5782. specified.
  5783. @item band, t
  5784. Specify the thickness of the fuzzy edge of the rectangle (added to
  5785. @var{w} and @var{h}). The default value is 1. This option is
  5786. deprecated, setting higher values should no longer be necessary and
  5787. is not recommended.
  5788. @item show
  5789. When set to 1, a green rectangle is drawn on the screen to simplify
  5790. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5791. The default value is 0.
  5792. The rectangle is drawn on the outermost pixels which will be (partly)
  5793. replaced with interpolated values. The values of the next pixels
  5794. immediately outside this rectangle in each direction will be used to
  5795. compute the interpolated pixel values inside the rectangle.
  5796. @end table
  5797. @subsection Examples
  5798. @itemize
  5799. @item
  5800. Set a rectangle covering the area with top left corner coordinates 0,0
  5801. and size 100x77, and a band of size 10:
  5802. @example
  5803. delogo=x=0:y=0:w=100:h=77:band=10
  5804. @end example
  5805. @end itemize
  5806. @section deshake
  5807. Attempt to fix small changes in horizontal and/or vertical shift. This
  5808. filter helps remove camera shake from hand-holding a camera, bumping a
  5809. tripod, moving on a vehicle, etc.
  5810. The filter accepts the following options:
  5811. @table @option
  5812. @item x
  5813. @item y
  5814. @item w
  5815. @item h
  5816. Specify a rectangular area where to limit the search for motion
  5817. vectors.
  5818. If desired the search for motion vectors can be limited to a
  5819. rectangular area of the frame defined by its top left corner, width
  5820. and height. These parameters have the same meaning as the drawbox
  5821. filter which can be used to visualise the position of the bounding
  5822. box.
  5823. This is useful when simultaneous movement of subjects within the frame
  5824. might be confused for camera motion by the motion vector search.
  5825. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5826. then the full frame is used. This allows later options to be set
  5827. without specifying the bounding box for the motion vector search.
  5828. Default - search the whole frame.
  5829. @item rx
  5830. @item ry
  5831. Specify the maximum extent of movement in x and y directions in the
  5832. range 0-64 pixels. Default 16.
  5833. @item edge
  5834. Specify how to generate pixels to fill blanks at the edge of the
  5835. frame. Available values are:
  5836. @table @samp
  5837. @item blank, 0
  5838. Fill zeroes at blank locations
  5839. @item original, 1
  5840. Original image at blank locations
  5841. @item clamp, 2
  5842. Extruded edge value at blank locations
  5843. @item mirror, 3
  5844. Mirrored edge at blank locations
  5845. @end table
  5846. Default value is @samp{mirror}.
  5847. @item blocksize
  5848. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5849. default 8.
  5850. @item contrast
  5851. Specify the contrast threshold for blocks. Only blocks with more than
  5852. the specified contrast (difference between darkest and lightest
  5853. pixels) will be considered. Range 1-255, default 125.
  5854. @item search
  5855. Specify the search strategy. Available values are:
  5856. @table @samp
  5857. @item exhaustive, 0
  5858. Set exhaustive search
  5859. @item less, 1
  5860. Set less exhaustive search.
  5861. @end table
  5862. Default value is @samp{exhaustive}.
  5863. @item filename
  5864. If set then a detailed log of the motion search is written to the
  5865. specified file.
  5866. @end table
  5867. @section despill
  5868. Remove unwanted contamination of foreground colors, caused by reflected color of
  5869. greenscreen or bluescreen.
  5870. This filter accepts the following options:
  5871. @table @option
  5872. @item type
  5873. Set what type of despill to use.
  5874. @item mix
  5875. Set how spillmap will be generated.
  5876. @item expand
  5877. Set how much to get rid of still remaining spill.
  5878. @item red
  5879. Controls amount of red in spill area.
  5880. @item green
  5881. Controls amount of green in spill area.
  5882. Should be -1 for greenscreen.
  5883. @item blue
  5884. Controls amount of blue in spill area.
  5885. Should be -1 for bluescreen.
  5886. @item brightness
  5887. Controls brightness of spill area, preserving colors.
  5888. @item alpha
  5889. Modify alpha from generated spillmap.
  5890. @end table
  5891. @section detelecine
  5892. Apply an exact inverse of the telecine operation. It requires a predefined
  5893. pattern specified using the pattern option which must be the same as that passed
  5894. to the telecine filter.
  5895. This filter accepts the following options:
  5896. @table @option
  5897. @item first_field
  5898. @table @samp
  5899. @item top, t
  5900. top field first
  5901. @item bottom, b
  5902. bottom field first
  5903. The default value is @code{top}.
  5904. @end table
  5905. @item pattern
  5906. A string of numbers representing the pulldown pattern you wish to apply.
  5907. The default value is @code{23}.
  5908. @item start_frame
  5909. A number representing position of the first frame with respect to the telecine
  5910. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5911. @end table
  5912. @section dilation
  5913. Apply dilation effect to the video.
  5914. This filter replaces the pixel by the local(3x3) maximum.
  5915. It accepts the following options:
  5916. @table @option
  5917. @item threshold0
  5918. @item threshold1
  5919. @item threshold2
  5920. @item threshold3
  5921. Limit the maximum change for each plane, default is 65535.
  5922. If 0, plane will remain unchanged.
  5923. @item coordinates
  5924. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5925. pixels are used.
  5926. Flags to local 3x3 coordinates maps like this:
  5927. 1 2 3
  5928. 4 5
  5929. 6 7 8
  5930. @end table
  5931. @section displace
  5932. Displace pixels as indicated by second and third input stream.
  5933. It takes three input streams and outputs one stream, the first input is the
  5934. source, and second and third input are displacement maps.
  5935. The second input specifies how much to displace pixels along the
  5936. x-axis, while the third input specifies how much to displace pixels
  5937. along the y-axis.
  5938. If one of displacement map streams terminates, last frame from that
  5939. displacement map will be used.
  5940. Note that once generated, displacements maps can be reused over and over again.
  5941. A description of the accepted options follows.
  5942. @table @option
  5943. @item edge
  5944. Set displace behavior for pixels that are out of range.
  5945. Available values are:
  5946. @table @samp
  5947. @item blank
  5948. Missing pixels are replaced by black pixels.
  5949. @item smear
  5950. Adjacent pixels will spread out to replace missing pixels.
  5951. @item wrap
  5952. Out of range pixels are wrapped so they point to pixels of other side.
  5953. @item mirror
  5954. Out of range pixels will be replaced with mirrored pixels.
  5955. @end table
  5956. Default is @samp{smear}.
  5957. @end table
  5958. @subsection Examples
  5959. @itemize
  5960. @item
  5961. Add ripple effect to rgb input of video size hd720:
  5962. @example
  5963. 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
  5964. @end example
  5965. @item
  5966. Add wave effect to rgb input of video size hd720:
  5967. @example
  5968. 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
  5969. @end example
  5970. @end itemize
  5971. @section drawbox
  5972. Draw a colored box on the input image.
  5973. It accepts the following parameters:
  5974. @table @option
  5975. @item x
  5976. @item y
  5977. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5978. @item width, w
  5979. @item height, h
  5980. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5981. the input width and height. It defaults to 0.
  5982. @item color, c
  5983. Specify the color of the box to write. For the general syntax of this option,
  5984. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  5985. value @code{invert} is used, the box edge color is the same as the
  5986. video with inverted luma.
  5987. @item thickness, t
  5988. The expression which sets the thickness of the box edge.
  5989. A value of @code{fill} will create a filled box. Default value is @code{3}.
  5990. See below for the list of accepted constants.
  5991. @item replace
  5992. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  5993. will overwrite the video's color and alpha pixels.
  5994. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  5995. @end table
  5996. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5997. following constants:
  5998. @table @option
  5999. @item dar
  6000. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6001. @item hsub
  6002. @item vsub
  6003. horizontal and vertical chroma subsample values. For example for the
  6004. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6005. @item in_h, ih
  6006. @item in_w, iw
  6007. The input width and height.
  6008. @item sar
  6009. The input sample aspect ratio.
  6010. @item x
  6011. @item y
  6012. The x and y offset coordinates where the box is drawn.
  6013. @item w
  6014. @item h
  6015. The width and height of the drawn box.
  6016. @item t
  6017. The thickness of the drawn box.
  6018. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6019. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6020. @end table
  6021. @subsection Examples
  6022. @itemize
  6023. @item
  6024. Draw a black box around the edge of the input image:
  6025. @example
  6026. drawbox
  6027. @end example
  6028. @item
  6029. Draw a box with color red and an opacity of 50%:
  6030. @example
  6031. drawbox=10:20:200:60:red@@0.5
  6032. @end example
  6033. The previous example can be specified as:
  6034. @example
  6035. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6036. @end example
  6037. @item
  6038. Fill the box with pink color:
  6039. @example
  6040. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6041. @end example
  6042. @item
  6043. Draw a 2-pixel red 2.40:1 mask:
  6044. @example
  6045. 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
  6046. @end example
  6047. @end itemize
  6048. @section drawgrid
  6049. Draw a grid on the input image.
  6050. It accepts the following parameters:
  6051. @table @option
  6052. @item x
  6053. @item y
  6054. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6055. @item width, w
  6056. @item height, h
  6057. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6058. input width and height, respectively, minus @code{thickness}, so image gets
  6059. framed. Default to 0.
  6060. @item color, c
  6061. Specify the color of the grid. For the general syntax of this option,
  6062. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6063. value @code{invert} is used, the grid color is the same as the
  6064. video with inverted luma.
  6065. @item thickness, t
  6066. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6067. See below for the list of accepted constants.
  6068. @item replace
  6069. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6070. will overwrite the video's color and alpha pixels.
  6071. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6072. @end table
  6073. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6074. following constants:
  6075. @table @option
  6076. @item dar
  6077. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6078. @item hsub
  6079. @item vsub
  6080. horizontal and vertical chroma subsample values. For example for the
  6081. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6082. @item in_h, ih
  6083. @item in_w, iw
  6084. The input grid cell width and height.
  6085. @item sar
  6086. The input sample aspect ratio.
  6087. @item x
  6088. @item y
  6089. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6090. @item w
  6091. @item h
  6092. The width and height of the drawn cell.
  6093. @item t
  6094. The thickness of the drawn cell.
  6095. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6096. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6097. @end table
  6098. @subsection Examples
  6099. @itemize
  6100. @item
  6101. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6102. @example
  6103. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6104. @end example
  6105. @item
  6106. Draw a white 3x3 grid with an opacity of 50%:
  6107. @example
  6108. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6109. @end example
  6110. @end itemize
  6111. @anchor{drawtext}
  6112. @section drawtext
  6113. Draw a text string or text from a specified file on top of a video, using the
  6114. libfreetype library.
  6115. To enable compilation of this filter, you need to configure FFmpeg with
  6116. @code{--enable-libfreetype}.
  6117. To enable default font fallback and the @var{font} option you need to
  6118. configure FFmpeg with @code{--enable-libfontconfig}.
  6119. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6120. @code{--enable-libfribidi}.
  6121. @subsection Syntax
  6122. It accepts the following parameters:
  6123. @table @option
  6124. @item box
  6125. Used to draw a box around text using the background color.
  6126. The value must be either 1 (enable) or 0 (disable).
  6127. The default value of @var{box} is 0.
  6128. @item boxborderw
  6129. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6130. The default value of @var{boxborderw} is 0.
  6131. @item boxcolor
  6132. The color to be used for drawing box around text. For the syntax of this
  6133. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6134. The default value of @var{boxcolor} is "white".
  6135. @item line_spacing
  6136. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6137. The default value of @var{line_spacing} is 0.
  6138. @item borderw
  6139. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6140. The default value of @var{borderw} is 0.
  6141. @item bordercolor
  6142. Set the color to be used for drawing border around text. For the syntax of this
  6143. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6144. The default value of @var{bordercolor} is "black".
  6145. @item expansion
  6146. Select how the @var{text} is expanded. Can be either @code{none},
  6147. @code{strftime} (deprecated) or
  6148. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6149. below for details.
  6150. @item basetime
  6151. Set a start time for the count. Value is in microseconds. Only applied
  6152. in the deprecated strftime expansion mode. To emulate in normal expansion
  6153. mode use the @code{pts} function, supplying the start time (in seconds)
  6154. as the second argument.
  6155. @item fix_bounds
  6156. If true, check and fix text coords to avoid clipping.
  6157. @item fontcolor
  6158. The color to be used for drawing fonts. For the syntax of this option, check
  6159. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6160. The default value of @var{fontcolor} is "black".
  6161. @item fontcolor_expr
  6162. String which is expanded the same way as @var{text} to obtain dynamic
  6163. @var{fontcolor} value. By default this option has empty value and is not
  6164. processed. When this option is set, it overrides @var{fontcolor} option.
  6165. @item font
  6166. The font family to be used for drawing text. By default Sans.
  6167. @item fontfile
  6168. The font file to be used for drawing text. The path must be included.
  6169. This parameter is mandatory if the fontconfig support is disabled.
  6170. @item alpha
  6171. Draw the text applying alpha blending. The value can
  6172. be a number between 0.0 and 1.0.
  6173. The expression accepts the same variables @var{x, y} as well.
  6174. The default value is 1.
  6175. Please see @var{fontcolor_expr}.
  6176. @item fontsize
  6177. The font size to be used for drawing text.
  6178. The default value of @var{fontsize} is 16.
  6179. @item text_shaping
  6180. If set to 1, attempt to shape the text (for example, reverse the order of
  6181. right-to-left text and join Arabic characters) before drawing it.
  6182. Otherwise, just draw the text exactly as given.
  6183. By default 1 (if supported).
  6184. @item ft_load_flags
  6185. The flags to be used for loading the fonts.
  6186. The flags map the corresponding flags supported by libfreetype, and are
  6187. a combination of the following values:
  6188. @table @var
  6189. @item default
  6190. @item no_scale
  6191. @item no_hinting
  6192. @item render
  6193. @item no_bitmap
  6194. @item vertical_layout
  6195. @item force_autohint
  6196. @item crop_bitmap
  6197. @item pedantic
  6198. @item ignore_global_advance_width
  6199. @item no_recurse
  6200. @item ignore_transform
  6201. @item monochrome
  6202. @item linear_design
  6203. @item no_autohint
  6204. @end table
  6205. Default value is "default".
  6206. For more information consult the documentation for the FT_LOAD_*
  6207. libfreetype flags.
  6208. @item shadowcolor
  6209. The color to be used for drawing a shadow behind the drawn text. For the
  6210. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6211. ffmpeg-utils manual,ffmpeg-utils}.
  6212. The default value of @var{shadowcolor} is "black".
  6213. @item shadowx
  6214. @item shadowy
  6215. The x and y offsets for the text shadow position with respect to the
  6216. position of the text. They can be either positive or negative
  6217. values. The default value for both is "0".
  6218. @item start_number
  6219. The starting frame number for the n/frame_num variable. The default value
  6220. is "0".
  6221. @item tabsize
  6222. The size in number of spaces to use for rendering the tab.
  6223. Default value is 4.
  6224. @item timecode
  6225. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6226. format. It can be used with or without text parameter. @var{timecode_rate}
  6227. option must be specified.
  6228. @item timecode_rate, rate, r
  6229. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6230. integer. Minimum value is "1".
  6231. Drop-frame timecode is supported for frame rates 30 & 60.
  6232. @item tc24hmax
  6233. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6234. Default is 0 (disabled).
  6235. @item text
  6236. The text string to be drawn. The text must be a sequence of UTF-8
  6237. encoded characters.
  6238. This parameter is mandatory if no file is specified with the parameter
  6239. @var{textfile}.
  6240. @item textfile
  6241. A text file containing text to be drawn. The text must be a sequence
  6242. of UTF-8 encoded characters.
  6243. This parameter is mandatory if no text string is specified with the
  6244. parameter @var{text}.
  6245. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6246. @item reload
  6247. If set to 1, the @var{textfile} will be reloaded before each frame.
  6248. Be sure to update it atomically, or it may be read partially, or even fail.
  6249. @item x
  6250. @item y
  6251. The expressions which specify the offsets where text will be drawn
  6252. within the video frame. They are relative to the top/left border of the
  6253. output image.
  6254. The default value of @var{x} and @var{y} is "0".
  6255. See below for the list of accepted constants and functions.
  6256. @end table
  6257. The parameters for @var{x} and @var{y} are expressions containing the
  6258. following constants and functions:
  6259. @table @option
  6260. @item dar
  6261. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6262. @item hsub
  6263. @item vsub
  6264. horizontal and vertical chroma subsample values. For example for the
  6265. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6266. @item line_h, lh
  6267. the height of each text line
  6268. @item main_h, h, H
  6269. the input height
  6270. @item main_w, w, W
  6271. the input width
  6272. @item max_glyph_a, ascent
  6273. the maximum distance from the baseline to the highest/upper grid
  6274. coordinate used to place a glyph outline point, for all the rendered
  6275. glyphs.
  6276. It is a positive value, due to the grid's orientation with the Y axis
  6277. upwards.
  6278. @item max_glyph_d, descent
  6279. the maximum distance from the baseline to the lowest grid coordinate
  6280. used to place a glyph outline point, for all the rendered glyphs.
  6281. This is a negative value, due to the grid's orientation, with the Y axis
  6282. upwards.
  6283. @item max_glyph_h
  6284. maximum glyph height, that is the maximum height for all the glyphs
  6285. contained in the rendered text, it is equivalent to @var{ascent} -
  6286. @var{descent}.
  6287. @item max_glyph_w
  6288. maximum glyph width, that is the maximum width for all the glyphs
  6289. contained in the rendered text
  6290. @item n
  6291. the number of input frame, starting from 0
  6292. @item rand(min, max)
  6293. return a random number included between @var{min} and @var{max}
  6294. @item sar
  6295. The input sample aspect ratio.
  6296. @item t
  6297. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6298. @item text_h, th
  6299. the height of the rendered text
  6300. @item text_w, tw
  6301. the width of the rendered text
  6302. @item x
  6303. @item y
  6304. the x and y offset coordinates where the text is drawn.
  6305. These parameters allow the @var{x} and @var{y} expressions to refer
  6306. each other, so you can for example specify @code{y=x/dar}.
  6307. @end table
  6308. @anchor{drawtext_expansion}
  6309. @subsection Text expansion
  6310. If @option{expansion} is set to @code{strftime},
  6311. the filter recognizes strftime() sequences in the provided text and
  6312. expands them accordingly. Check the documentation of strftime(). This
  6313. feature is deprecated.
  6314. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6315. If @option{expansion} is set to @code{normal} (which is the default),
  6316. the following expansion mechanism is used.
  6317. The backslash character @samp{\}, followed by any character, always expands to
  6318. the second character.
  6319. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6320. braces is a function name, possibly followed by arguments separated by ':'.
  6321. If the arguments contain special characters or delimiters (':' or '@}'),
  6322. they should be escaped.
  6323. Note that they probably must also be escaped as the value for the
  6324. @option{text} option in the filter argument string and as the filter
  6325. argument in the filtergraph description, and possibly also for the shell,
  6326. that makes up to four levels of escaping; using a text file avoids these
  6327. problems.
  6328. The following functions are available:
  6329. @table @command
  6330. @item expr, e
  6331. The expression evaluation result.
  6332. It must take one argument specifying the expression to be evaluated,
  6333. which accepts the same constants and functions as the @var{x} and
  6334. @var{y} values. Note that not all constants should be used, for
  6335. example the text size is not known when evaluating the expression, so
  6336. the constants @var{text_w} and @var{text_h} will have an undefined
  6337. value.
  6338. @item expr_int_format, eif
  6339. Evaluate the expression's value and output as formatted integer.
  6340. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6341. The second argument specifies the output format. Allowed values are @samp{x},
  6342. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6343. @code{printf} function.
  6344. The third parameter is optional and sets the number of positions taken by the output.
  6345. It can be used to add padding with zeros from the left.
  6346. @item gmtime
  6347. The time at which the filter is running, expressed in UTC.
  6348. It can accept an argument: a strftime() format string.
  6349. @item localtime
  6350. The time at which the filter is running, expressed in the local time zone.
  6351. It can accept an argument: a strftime() format string.
  6352. @item metadata
  6353. Frame metadata. Takes one or two arguments.
  6354. The first argument is mandatory and specifies the metadata key.
  6355. The second argument is optional and specifies a default value, used when the
  6356. metadata key is not found or empty.
  6357. @item n, frame_num
  6358. The frame number, starting from 0.
  6359. @item pict_type
  6360. A 1 character description of the current picture type.
  6361. @item pts
  6362. The timestamp of the current frame.
  6363. It can take up to three arguments.
  6364. The first argument is the format of the timestamp; it defaults to @code{flt}
  6365. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6366. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6367. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6368. @code{localtime} stands for the timestamp of the frame formatted as
  6369. local time zone time.
  6370. The second argument is an offset added to the timestamp.
  6371. If the format is set to @code{hms}, a third argument @code{24HH} may be
  6372. supplied to present the hour part of the formatted timestamp in 24h format
  6373. (00-23).
  6374. If the format is set to @code{localtime} or @code{gmtime},
  6375. a third argument may be supplied: a strftime() format string.
  6376. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6377. @end table
  6378. @subsection Examples
  6379. @itemize
  6380. @item
  6381. Draw "Test Text" with font FreeSerif, using the default values for the
  6382. optional parameters.
  6383. @example
  6384. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6385. @end example
  6386. @item
  6387. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6388. and y=50 (counting from the top-left corner of the screen), text is
  6389. yellow with a red box around it. Both the text and the box have an
  6390. opacity of 20%.
  6391. @example
  6392. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6393. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6394. @end example
  6395. Note that the double quotes are not necessary if spaces are not used
  6396. within the parameter list.
  6397. @item
  6398. Show the text at the center of the video frame:
  6399. @example
  6400. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6401. @end example
  6402. @item
  6403. Show the text at a random position, switching to a new position every 30 seconds:
  6404. @example
  6405. 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)"
  6406. @end example
  6407. @item
  6408. Show a text line sliding from right to left in the last row of the video
  6409. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6410. with no newlines.
  6411. @example
  6412. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6413. @end example
  6414. @item
  6415. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6416. @example
  6417. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6418. @end example
  6419. @item
  6420. Draw a single green letter "g", at the center of the input video.
  6421. The glyph baseline is placed at half screen height.
  6422. @example
  6423. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6424. @end example
  6425. @item
  6426. Show text for 1 second every 3 seconds:
  6427. @example
  6428. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6429. @end example
  6430. @item
  6431. Use fontconfig to set the font. Note that the colons need to be escaped.
  6432. @example
  6433. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6434. @end example
  6435. @item
  6436. Print the date of a real-time encoding (see strftime(3)):
  6437. @example
  6438. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6439. @end example
  6440. @item
  6441. Show text fading in and out (appearing/disappearing):
  6442. @example
  6443. #!/bin/sh
  6444. DS=1.0 # display start
  6445. DE=10.0 # display end
  6446. FID=1.5 # fade in duration
  6447. FOD=5 # fade out duration
  6448. 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 @}"
  6449. @end example
  6450. @item
  6451. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6452. and the @option{fontsize} value are included in the @option{y} offset.
  6453. @example
  6454. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6455. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6456. @end example
  6457. @end itemize
  6458. For more information about libfreetype, check:
  6459. @url{http://www.freetype.org/}.
  6460. For more information about fontconfig, check:
  6461. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6462. For more information about libfribidi, check:
  6463. @url{http://fribidi.org/}.
  6464. @section edgedetect
  6465. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6466. The filter accepts the following options:
  6467. @table @option
  6468. @item low
  6469. @item high
  6470. Set low and high threshold values used by the Canny thresholding
  6471. algorithm.
  6472. The high threshold selects the "strong" edge pixels, which are then
  6473. connected through 8-connectivity with the "weak" edge pixels selected
  6474. by the low threshold.
  6475. @var{low} and @var{high} threshold values must be chosen in the range
  6476. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6477. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6478. is @code{50/255}.
  6479. @item mode
  6480. Define the drawing mode.
  6481. @table @samp
  6482. @item wires
  6483. Draw white/gray wires on black background.
  6484. @item colormix
  6485. Mix the colors to create a paint/cartoon effect.
  6486. @item canny
  6487. Apply Canny edge detector on all selected planes.
  6488. @end table
  6489. Default value is @var{wires}.
  6490. @item planes
  6491. Select planes for filtering. By default all available planes are filtered.
  6492. @end table
  6493. @subsection Examples
  6494. @itemize
  6495. @item
  6496. Standard edge detection with custom values for the hysteresis thresholding:
  6497. @example
  6498. edgedetect=low=0.1:high=0.4
  6499. @end example
  6500. @item
  6501. Painting effect without thresholding:
  6502. @example
  6503. edgedetect=mode=colormix:high=0
  6504. @end example
  6505. @end itemize
  6506. @section eq
  6507. Set brightness, contrast, saturation and approximate gamma adjustment.
  6508. The filter accepts the following options:
  6509. @table @option
  6510. @item contrast
  6511. Set the contrast expression. The value must be a float value in range
  6512. @code{-2.0} to @code{2.0}. The default value is "1".
  6513. @item brightness
  6514. Set the brightness expression. The value must be a float value in
  6515. range @code{-1.0} to @code{1.0}. The default value is "0".
  6516. @item saturation
  6517. Set the saturation expression. The value must be a float in
  6518. range @code{0.0} to @code{3.0}. The default value is "1".
  6519. @item gamma
  6520. Set the gamma expression. The value must be a float in range
  6521. @code{0.1} to @code{10.0}. The default value is "1".
  6522. @item gamma_r
  6523. Set the gamma expression for red. The value must be a float in
  6524. range @code{0.1} to @code{10.0}. The default value is "1".
  6525. @item gamma_g
  6526. Set the gamma expression for green. The value must be a float in range
  6527. @code{0.1} to @code{10.0}. The default value is "1".
  6528. @item gamma_b
  6529. Set the gamma expression for blue. The value must be a float in range
  6530. @code{0.1} to @code{10.0}. The default value is "1".
  6531. @item gamma_weight
  6532. Set the gamma weight expression. It can be used to reduce the effect
  6533. of a high gamma value on bright image areas, e.g. keep them from
  6534. getting overamplified and just plain white. The value must be a float
  6535. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6536. gamma correction all the way down while @code{1.0} leaves it at its
  6537. full strength. Default is "1".
  6538. @item eval
  6539. Set when the expressions for brightness, contrast, saturation and
  6540. gamma expressions are evaluated.
  6541. It accepts the following values:
  6542. @table @samp
  6543. @item init
  6544. only evaluate expressions once during the filter initialization or
  6545. when a command is processed
  6546. @item frame
  6547. evaluate expressions for each incoming frame
  6548. @end table
  6549. Default value is @samp{init}.
  6550. @end table
  6551. The expressions accept the following parameters:
  6552. @table @option
  6553. @item n
  6554. frame count of the input frame starting from 0
  6555. @item pos
  6556. byte position of the corresponding packet in the input file, NAN if
  6557. unspecified
  6558. @item r
  6559. frame rate of the input video, NAN if the input frame rate is unknown
  6560. @item t
  6561. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6562. @end table
  6563. @subsection Commands
  6564. The filter supports the following commands:
  6565. @table @option
  6566. @item contrast
  6567. Set the contrast expression.
  6568. @item brightness
  6569. Set the brightness expression.
  6570. @item saturation
  6571. Set the saturation expression.
  6572. @item gamma
  6573. Set the gamma expression.
  6574. @item gamma_r
  6575. Set the gamma_r expression.
  6576. @item gamma_g
  6577. Set gamma_g expression.
  6578. @item gamma_b
  6579. Set gamma_b expression.
  6580. @item gamma_weight
  6581. Set gamma_weight expression.
  6582. The command accepts the same syntax of the corresponding option.
  6583. If the specified expression is not valid, it is kept at its current
  6584. value.
  6585. @end table
  6586. @section erosion
  6587. Apply erosion effect to the video.
  6588. This filter replaces the pixel by the local(3x3) minimum.
  6589. It accepts the following options:
  6590. @table @option
  6591. @item threshold0
  6592. @item threshold1
  6593. @item threshold2
  6594. @item threshold3
  6595. Limit the maximum change for each plane, default is 65535.
  6596. If 0, plane will remain unchanged.
  6597. @item coordinates
  6598. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6599. pixels are used.
  6600. Flags to local 3x3 coordinates maps like this:
  6601. 1 2 3
  6602. 4 5
  6603. 6 7 8
  6604. @end table
  6605. @section extractplanes
  6606. Extract color channel components from input video stream into
  6607. separate grayscale video streams.
  6608. The filter accepts the following option:
  6609. @table @option
  6610. @item planes
  6611. Set plane(s) to extract.
  6612. Available values for planes are:
  6613. @table @samp
  6614. @item y
  6615. @item u
  6616. @item v
  6617. @item a
  6618. @item r
  6619. @item g
  6620. @item b
  6621. @end table
  6622. Choosing planes not available in the input will result in an error.
  6623. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6624. with @code{y}, @code{u}, @code{v} planes at same time.
  6625. @end table
  6626. @subsection Examples
  6627. @itemize
  6628. @item
  6629. Extract luma, u and v color channel component from input video frame
  6630. into 3 grayscale outputs:
  6631. @example
  6632. 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
  6633. @end example
  6634. @end itemize
  6635. @section elbg
  6636. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6637. For each input image, the filter will compute the optimal mapping from
  6638. the input to the output given the codebook length, that is the number
  6639. of distinct output colors.
  6640. This filter accepts the following options.
  6641. @table @option
  6642. @item codebook_length, l
  6643. Set codebook length. The value must be a positive integer, and
  6644. represents the number of distinct output colors. Default value is 256.
  6645. @item nb_steps, n
  6646. Set the maximum number of iterations to apply for computing the optimal
  6647. mapping. The higher the value the better the result and the higher the
  6648. computation time. Default value is 1.
  6649. @item seed, s
  6650. Set a random seed, must be an integer included between 0 and
  6651. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6652. will try to use a good random seed on a best effort basis.
  6653. @item pal8
  6654. Set pal8 output pixel format. This option does not work with codebook
  6655. length greater than 256.
  6656. @end table
  6657. @section entropy
  6658. Measure graylevel entropy in histogram of color channels of video frames.
  6659. It accepts the following parameters:
  6660. @table @option
  6661. @item mode
  6662. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  6663. @var{diff} mode measures entropy of histogram delta values, absolute differences
  6664. between neighbour histogram values.
  6665. @end table
  6666. @section fade
  6667. Apply a fade-in/out effect to the input video.
  6668. It accepts the following parameters:
  6669. @table @option
  6670. @item type, t
  6671. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6672. effect.
  6673. Default is @code{in}.
  6674. @item start_frame, s
  6675. Specify the number of the frame to start applying the fade
  6676. effect at. Default is 0.
  6677. @item nb_frames, n
  6678. The number of frames that the fade effect lasts. At the end of the
  6679. fade-in effect, the output video will have the same intensity as the input video.
  6680. At the end of the fade-out transition, the output video will be filled with the
  6681. selected @option{color}.
  6682. Default is 25.
  6683. @item alpha
  6684. If set to 1, fade only alpha channel, if one exists on the input.
  6685. Default value is 0.
  6686. @item start_time, st
  6687. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6688. effect. If both start_frame and start_time are specified, the fade will start at
  6689. whichever comes last. Default is 0.
  6690. @item duration, d
  6691. The number of seconds for which the fade effect has to last. At the end of the
  6692. fade-in effect the output video will have the same intensity as the input video,
  6693. at the end of the fade-out transition the output video will be filled with the
  6694. selected @option{color}.
  6695. If both duration and nb_frames are specified, duration is used. Default is 0
  6696. (nb_frames is used by default).
  6697. @item color, c
  6698. Specify the color of the fade. Default is "black".
  6699. @end table
  6700. @subsection Examples
  6701. @itemize
  6702. @item
  6703. Fade in the first 30 frames of video:
  6704. @example
  6705. fade=in:0:30
  6706. @end example
  6707. The command above is equivalent to:
  6708. @example
  6709. fade=t=in:s=0:n=30
  6710. @end example
  6711. @item
  6712. Fade out the last 45 frames of a 200-frame video:
  6713. @example
  6714. fade=out:155:45
  6715. fade=type=out:start_frame=155:nb_frames=45
  6716. @end example
  6717. @item
  6718. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6719. @example
  6720. fade=in:0:25, fade=out:975:25
  6721. @end example
  6722. @item
  6723. Make the first 5 frames yellow, then fade in from frame 5-24:
  6724. @example
  6725. fade=in:5:20:color=yellow
  6726. @end example
  6727. @item
  6728. Fade in alpha over first 25 frames of video:
  6729. @example
  6730. fade=in:0:25:alpha=1
  6731. @end example
  6732. @item
  6733. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6734. @example
  6735. fade=t=in:st=5.5:d=0.5
  6736. @end example
  6737. @end itemize
  6738. @section fftfilt
  6739. Apply arbitrary expressions to samples in frequency domain
  6740. @table @option
  6741. @item dc_Y
  6742. Adjust the dc value (gain) of the luma plane of the image. The filter
  6743. accepts an integer value in range @code{0} to @code{1000}. The default
  6744. value is set to @code{0}.
  6745. @item dc_U
  6746. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6747. filter accepts an integer value in range @code{0} to @code{1000}. The
  6748. default value is set to @code{0}.
  6749. @item dc_V
  6750. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6751. filter accepts an integer value in range @code{0} to @code{1000}. The
  6752. default value is set to @code{0}.
  6753. @item weight_Y
  6754. Set the frequency domain weight expression for the luma plane.
  6755. @item weight_U
  6756. Set the frequency domain weight expression for the 1st chroma plane.
  6757. @item weight_V
  6758. Set the frequency domain weight expression for the 2nd chroma plane.
  6759. @item eval
  6760. Set when the expressions are evaluated.
  6761. It accepts the following values:
  6762. @table @samp
  6763. @item init
  6764. Only evaluate expressions once during the filter initialization.
  6765. @item frame
  6766. Evaluate expressions for each incoming frame.
  6767. @end table
  6768. Default value is @samp{init}.
  6769. The filter accepts the following variables:
  6770. @item X
  6771. @item Y
  6772. The coordinates of the current sample.
  6773. @item W
  6774. @item H
  6775. The width and height of the image.
  6776. @item N
  6777. The number of input frame, starting from 0.
  6778. @end table
  6779. @subsection Examples
  6780. @itemize
  6781. @item
  6782. High-pass:
  6783. @example
  6784. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6785. @end example
  6786. @item
  6787. Low-pass:
  6788. @example
  6789. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6790. @end example
  6791. @item
  6792. Sharpen:
  6793. @example
  6794. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6795. @end example
  6796. @item
  6797. Blur:
  6798. @example
  6799. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6800. @end example
  6801. @end itemize
  6802. @section fftdnoiz
  6803. Denoise frames using 3D FFT (frequency domain filtering).
  6804. The filter accepts the following options:
  6805. @table @option
  6806. @item sigma
  6807. Set the noise sigma constant. This sets denoising strength.
  6808. Default value is 1. Allowed range is from 0 to 30.
  6809. Using very high sigma with low overlap may give blocking artifacts.
  6810. @item amount
  6811. Set amount of denoising. By default all detected noise is reduced.
  6812. Default value is 1. Allowed range is from 0 to 1.
  6813. @item block
  6814. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  6815. Actual size of block in pixels is 2 to power of @var{block}, so by default
  6816. block size in pixels is 2^4 which is 16.
  6817. @item overlap
  6818. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  6819. @item prev
  6820. Set number of previous frames to use for denoising. By default is set to 0.
  6821. @item next
  6822. Set number of next frames to to use for denoising. By default is set to 0.
  6823. @item planes
  6824. Set planes which will be filtered, by default are all available filtered
  6825. except alpha.
  6826. @end table
  6827. @section field
  6828. Extract a single field from an interlaced image using stride
  6829. arithmetic to avoid wasting CPU time. The output frames are marked as
  6830. non-interlaced.
  6831. The filter accepts the following options:
  6832. @table @option
  6833. @item type
  6834. Specify whether to extract the top (if the value is @code{0} or
  6835. @code{top}) or the bottom field (if the value is @code{1} or
  6836. @code{bottom}).
  6837. @end table
  6838. @section fieldhint
  6839. Create new frames by copying the top and bottom fields from surrounding frames
  6840. supplied as numbers by the hint file.
  6841. @table @option
  6842. @item hint
  6843. Set file containing hints: absolute/relative frame numbers.
  6844. There must be one line for each frame in a clip. Each line must contain two
  6845. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6846. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6847. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6848. for @code{relative} mode. First number tells from which frame to pick up top
  6849. field and second number tells from which frame to pick up bottom field.
  6850. If optionally followed by @code{+} output frame will be marked as interlaced,
  6851. else if followed by @code{-} output frame will be marked as progressive, else
  6852. it will be marked same as input frame.
  6853. If line starts with @code{#} or @code{;} that line is skipped.
  6854. @item mode
  6855. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6856. @end table
  6857. Example of first several lines of @code{hint} file for @code{relative} mode:
  6858. @example
  6859. 0,0 - # first frame
  6860. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6861. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6862. 1,0 -
  6863. 0,0 -
  6864. 0,0 -
  6865. 1,0 -
  6866. 1,0 -
  6867. 1,0 -
  6868. 0,0 -
  6869. 0,0 -
  6870. 1,0 -
  6871. 1,0 -
  6872. 1,0 -
  6873. 0,0 -
  6874. @end example
  6875. @section fieldmatch
  6876. Field matching filter for inverse telecine. It is meant to reconstruct the
  6877. progressive frames from a telecined stream. The filter does not drop duplicated
  6878. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6879. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6880. The separation of the field matching and the decimation is notably motivated by
  6881. the possibility of inserting a de-interlacing filter fallback between the two.
  6882. If the source has mixed telecined and real interlaced content,
  6883. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6884. But these remaining combed frames will be marked as interlaced, and thus can be
  6885. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6886. In addition to the various configuration options, @code{fieldmatch} can take an
  6887. optional second stream, activated through the @option{ppsrc} option. If
  6888. enabled, the frames reconstruction will be based on the fields and frames from
  6889. this second stream. This allows the first input to be pre-processed in order to
  6890. help the various algorithms of the filter, while keeping the output lossless
  6891. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6892. or brightness/contrast adjustments can help.
  6893. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6894. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6895. which @code{fieldmatch} is based on. While the semantic and usage are very
  6896. close, some behaviour and options names can differ.
  6897. The @ref{decimate} filter currently only works for constant frame rate input.
  6898. If your input has mixed telecined (30fps) and progressive content with a lower
  6899. framerate like 24fps use the following filterchain to produce the necessary cfr
  6900. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6901. The filter accepts the following options:
  6902. @table @option
  6903. @item order
  6904. Specify the assumed field order of the input stream. Available values are:
  6905. @table @samp
  6906. @item auto
  6907. Auto detect parity (use FFmpeg's internal parity value).
  6908. @item bff
  6909. Assume bottom field first.
  6910. @item tff
  6911. Assume top field first.
  6912. @end table
  6913. Note that it is sometimes recommended not to trust the parity announced by the
  6914. stream.
  6915. Default value is @var{auto}.
  6916. @item mode
  6917. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6918. sense that it won't risk creating jerkiness due to duplicate frames when
  6919. possible, but if there are bad edits or blended fields it will end up
  6920. outputting combed frames when a good match might actually exist. On the other
  6921. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6922. but will almost always find a good frame if there is one. The other values are
  6923. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6924. jerkiness and creating duplicate frames versus finding good matches in sections
  6925. with bad edits, orphaned fields, blended fields, etc.
  6926. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6927. Available values are:
  6928. @table @samp
  6929. @item pc
  6930. 2-way matching (p/c)
  6931. @item pc_n
  6932. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6933. @item pc_u
  6934. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6935. @item pc_n_ub
  6936. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6937. still combed (p/c + n + u/b)
  6938. @item pcn
  6939. 3-way matching (p/c/n)
  6940. @item pcn_ub
  6941. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6942. detected as combed (p/c/n + u/b)
  6943. @end table
  6944. The parenthesis at the end indicate the matches that would be used for that
  6945. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6946. @var{top}).
  6947. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6948. the slowest.
  6949. Default value is @var{pc_n}.
  6950. @item ppsrc
  6951. Mark the main input stream as a pre-processed input, and enable the secondary
  6952. input stream as the clean source to pick the fields from. See the filter
  6953. introduction for more details. It is similar to the @option{clip2} feature from
  6954. VFM/TFM.
  6955. Default value is @code{0} (disabled).
  6956. @item field
  6957. Set the field to match from. It is recommended to set this to the same value as
  6958. @option{order} unless you experience matching failures with that setting. In
  6959. certain circumstances changing the field that is used to match from can have a
  6960. large impact on matching performance. Available values are:
  6961. @table @samp
  6962. @item auto
  6963. Automatic (same value as @option{order}).
  6964. @item bottom
  6965. Match from the bottom field.
  6966. @item top
  6967. Match from the top field.
  6968. @end table
  6969. Default value is @var{auto}.
  6970. @item mchroma
  6971. Set whether or not chroma is included during the match comparisons. In most
  6972. cases it is recommended to leave this enabled. You should set this to @code{0}
  6973. only if your clip has bad chroma problems such as heavy rainbowing or other
  6974. artifacts. Setting this to @code{0} could also be used to speed things up at
  6975. the cost of some accuracy.
  6976. Default value is @code{1}.
  6977. @item y0
  6978. @item y1
  6979. These define an exclusion band which excludes the lines between @option{y0} and
  6980. @option{y1} from being included in the field matching decision. An exclusion
  6981. band can be used to ignore subtitles, a logo, or other things that may
  6982. interfere with the matching. @option{y0} sets the starting scan line and
  6983. @option{y1} sets the ending line; all lines in between @option{y0} and
  6984. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6985. @option{y0} and @option{y1} to the same value will disable the feature.
  6986. @option{y0} and @option{y1} defaults to @code{0}.
  6987. @item scthresh
  6988. Set the scene change detection threshold as a percentage of maximum change on
  6989. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6990. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6991. @option{scthresh} is @code{[0.0, 100.0]}.
  6992. Default value is @code{12.0}.
  6993. @item combmatch
  6994. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6995. account the combed scores of matches when deciding what match to use as the
  6996. final match. Available values are:
  6997. @table @samp
  6998. @item none
  6999. No final matching based on combed scores.
  7000. @item sc
  7001. Combed scores are only used when a scene change is detected.
  7002. @item full
  7003. Use combed scores all the time.
  7004. @end table
  7005. Default is @var{sc}.
  7006. @item combdbg
  7007. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7008. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7009. Available values are:
  7010. @table @samp
  7011. @item none
  7012. No forced calculation.
  7013. @item pcn
  7014. Force p/c/n calculations.
  7015. @item pcnub
  7016. Force p/c/n/u/b calculations.
  7017. @end table
  7018. Default value is @var{none}.
  7019. @item cthresh
  7020. This is the area combing threshold used for combed frame detection. This
  7021. essentially controls how "strong" or "visible" combing must be to be detected.
  7022. Larger values mean combing must be more visible and smaller values mean combing
  7023. can be less visible or strong and still be detected. Valid settings are from
  7024. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7025. be detected as combed). This is basically a pixel difference value. A good
  7026. range is @code{[8, 12]}.
  7027. Default value is @code{9}.
  7028. @item chroma
  7029. Sets whether or not chroma is considered in the combed frame decision. Only
  7030. disable this if your source has chroma problems (rainbowing, etc.) that are
  7031. causing problems for the combed frame detection with chroma enabled. Actually,
  7032. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7033. where there is chroma only combing in the source.
  7034. Default value is @code{0}.
  7035. @item blockx
  7036. @item blocky
  7037. Respectively set the x-axis and y-axis size of the window used during combed
  7038. frame detection. This has to do with the size of the area in which
  7039. @option{combpel} pixels are required to be detected as combed for a frame to be
  7040. declared combed. See the @option{combpel} parameter description for more info.
  7041. Possible values are any number that is a power of 2 starting at 4 and going up
  7042. to 512.
  7043. Default value is @code{16}.
  7044. @item combpel
  7045. The number of combed pixels inside any of the @option{blocky} by
  7046. @option{blockx} size blocks on the frame for the frame to be detected as
  7047. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7048. setting controls "how much" combing there must be in any localized area (a
  7049. window defined by the @option{blockx} and @option{blocky} settings) on the
  7050. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7051. which point no frames will ever be detected as combed). This setting is known
  7052. as @option{MI} in TFM/VFM vocabulary.
  7053. Default value is @code{80}.
  7054. @end table
  7055. @anchor{p/c/n/u/b meaning}
  7056. @subsection p/c/n/u/b meaning
  7057. @subsubsection p/c/n
  7058. We assume the following telecined stream:
  7059. @example
  7060. Top fields: 1 2 2 3 4
  7061. Bottom fields: 1 2 3 4 4
  7062. @end example
  7063. The numbers correspond to the progressive frame the fields relate to. Here, the
  7064. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7065. When @code{fieldmatch} is configured to run a matching from bottom
  7066. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7067. @example
  7068. Input stream:
  7069. T 1 2 2 3 4
  7070. B 1 2 3 4 4 <-- matching reference
  7071. Matches: c c n n c
  7072. Output stream:
  7073. T 1 2 3 4 4
  7074. B 1 2 3 4 4
  7075. @end example
  7076. As a result of the field matching, we can see that some frames get duplicated.
  7077. To perform a complete inverse telecine, you need to rely on a decimation filter
  7078. after this operation. See for instance the @ref{decimate} filter.
  7079. The same operation now matching from top fields (@option{field}=@var{top})
  7080. looks like this:
  7081. @example
  7082. Input stream:
  7083. T 1 2 2 3 4 <-- matching reference
  7084. B 1 2 3 4 4
  7085. Matches: c c p p c
  7086. Output stream:
  7087. T 1 2 2 3 4
  7088. B 1 2 2 3 4
  7089. @end example
  7090. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7091. basically, they refer to the frame and field of the opposite parity:
  7092. @itemize
  7093. @item @var{p} matches the field of the opposite parity in the previous frame
  7094. @item @var{c} matches the field of the opposite parity in the current frame
  7095. @item @var{n} matches the field of the opposite parity in the next frame
  7096. @end itemize
  7097. @subsubsection u/b
  7098. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7099. from the opposite parity flag. In the following examples, we assume that we are
  7100. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7101. 'x' is placed above and below each matched fields.
  7102. With bottom matching (@option{field}=@var{bottom}):
  7103. @example
  7104. Match: c p n b u
  7105. x x x x x
  7106. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7107. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7108. x x x x x
  7109. Output frames:
  7110. 2 1 2 2 2
  7111. 2 2 2 1 3
  7112. @end example
  7113. With top matching (@option{field}=@var{top}):
  7114. @example
  7115. Match: c p n b u
  7116. x x x x x
  7117. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7118. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7119. x x x x x
  7120. Output frames:
  7121. 2 2 2 1 2
  7122. 2 1 3 2 2
  7123. @end example
  7124. @subsection Examples
  7125. Simple IVTC of a top field first telecined stream:
  7126. @example
  7127. fieldmatch=order=tff:combmatch=none, decimate
  7128. @end example
  7129. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7130. @example
  7131. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7132. @end example
  7133. @section fieldorder
  7134. Transform the field order of the input video.
  7135. It accepts the following parameters:
  7136. @table @option
  7137. @item order
  7138. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7139. for bottom field first.
  7140. @end table
  7141. The default value is @samp{tff}.
  7142. The transformation is done by shifting the picture content up or down
  7143. by one line, and filling the remaining line with appropriate picture content.
  7144. This method is consistent with most broadcast field order converters.
  7145. If the input video is not flagged as being interlaced, or it is already
  7146. flagged as being of the required output field order, then this filter does
  7147. not alter the incoming video.
  7148. It is very useful when converting to or from PAL DV material,
  7149. which is bottom field first.
  7150. For example:
  7151. @example
  7152. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7153. @end example
  7154. @section fifo, afifo
  7155. Buffer input images and send them when they are requested.
  7156. It is mainly useful when auto-inserted by the libavfilter
  7157. framework.
  7158. It does not take parameters.
  7159. @section fillborders
  7160. Fill borders of the input video, without changing video stream dimensions.
  7161. Sometimes video can have garbage at the four edges and you may not want to
  7162. crop video input to keep size multiple of some number.
  7163. This filter accepts the following options:
  7164. @table @option
  7165. @item left
  7166. Number of pixels to fill from left border.
  7167. @item right
  7168. Number of pixels to fill from right border.
  7169. @item top
  7170. Number of pixels to fill from top border.
  7171. @item bottom
  7172. Number of pixels to fill from bottom border.
  7173. @item mode
  7174. Set fill mode.
  7175. It accepts the following values:
  7176. @table @samp
  7177. @item smear
  7178. fill pixels using outermost pixels
  7179. @item mirror
  7180. fill pixels using mirroring
  7181. @item fixed
  7182. fill pixels with constant value
  7183. @end table
  7184. Default is @var{smear}.
  7185. @item color
  7186. Set color for pixels in fixed mode. Default is @var{black}.
  7187. @end table
  7188. @section find_rect
  7189. Find a rectangular object
  7190. It accepts the following options:
  7191. @table @option
  7192. @item object
  7193. Filepath of the object image, needs to be in gray8.
  7194. @item threshold
  7195. Detection threshold, default is 0.5.
  7196. @item mipmaps
  7197. Number of mipmaps, default is 3.
  7198. @item xmin, ymin, xmax, ymax
  7199. Specifies the rectangle in which to search.
  7200. @end table
  7201. @subsection Examples
  7202. @itemize
  7203. @item
  7204. Generate a representative palette of a given video using @command{ffmpeg}:
  7205. @example
  7206. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7207. @end example
  7208. @end itemize
  7209. @section cover_rect
  7210. Cover a rectangular object
  7211. It accepts the following options:
  7212. @table @option
  7213. @item cover
  7214. Filepath of the optional cover image, needs to be in yuv420.
  7215. @item mode
  7216. Set covering mode.
  7217. It accepts the following values:
  7218. @table @samp
  7219. @item cover
  7220. cover it by the supplied image
  7221. @item blur
  7222. cover it by interpolating the surrounding pixels
  7223. @end table
  7224. Default value is @var{blur}.
  7225. @end table
  7226. @subsection Examples
  7227. @itemize
  7228. @item
  7229. Generate a representative palette of a given video using @command{ffmpeg}:
  7230. @example
  7231. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7232. @end example
  7233. @end itemize
  7234. @section floodfill
  7235. Flood area with values of same pixel components with another values.
  7236. It accepts the following options:
  7237. @table @option
  7238. @item x
  7239. Set pixel x coordinate.
  7240. @item y
  7241. Set pixel y coordinate.
  7242. @item s0
  7243. Set source #0 component value.
  7244. @item s1
  7245. Set source #1 component value.
  7246. @item s2
  7247. Set source #2 component value.
  7248. @item s3
  7249. Set source #3 component value.
  7250. @item d0
  7251. Set destination #0 component value.
  7252. @item d1
  7253. Set destination #1 component value.
  7254. @item d2
  7255. Set destination #2 component value.
  7256. @item d3
  7257. Set destination #3 component value.
  7258. @end table
  7259. @anchor{format}
  7260. @section format
  7261. Convert the input video to one of the specified pixel formats.
  7262. Libavfilter will try to pick one that is suitable as input to
  7263. the next filter.
  7264. It accepts the following parameters:
  7265. @table @option
  7266. @item pix_fmts
  7267. A '|'-separated list of pixel format names, such as
  7268. "pix_fmts=yuv420p|monow|rgb24".
  7269. @end table
  7270. @subsection Examples
  7271. @itemize
  7272. @item
  7273. Convert the input video to the @var{yuv420p} format
  7274. @example
  7275. format=pix_fmts=yuv420p
  7276. @end example
  7277. Convert the input video to any of the formats in the list
  7278. @example
  7279. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7280. @end example
  7281. @end itemize
  7282. @anchor{fps}
  7283. @section fps
  7284. Convert the video to specified constant frame rate by duplicating or dropping
  7285. frames as necessary.
  7286. It accepts the following parameters:
  7287. @table @option
  7288. @item fps
  7289. The desired output frame rate. The default is @code{25}.
  7290. @item start_time
  7291. Assume the first PTS should be the given value, in seconds. This allows for
  7292. padding/trimming at the start of stream. By default, no assumption is made
  7293. about the first frame's expected PTS, so no padding or trimming is done.
  7294. For example, this could be set to 0 to pad the beginning with duplicates of
  7295. the first frame if a video stream starts after the audio stream or to trim any
  7296. frames with a negative PTS.
  7297. @item round
  7298. Timestamp (PTS) rounding method.
  7299. Possible values are:
  7300. @table @option
  7301. @item zero
  7302. round towards 0
  7303. @item inf
  7304. round away from 0
  7305. @item down
  7306. round towards -infinity
  7307. @item up
  7308. round towards +infinity
  7309. @item near
  7310. round to nearest
  7311. @end table
  7312. The default is @code{near}.
  7313. @item eof_action
  7314. Action performed when reading the last frame.
  7315. Possible values are:
  7316. @table @option
  7317. @item round
  7318. Use same timestamp rounding method as used for other frames.
  7319. @item pass
  7320. Pass through last frame if input duration has not been reached yet.
  7321. @end table
  7322. The default is @code{round}.
  7323. @end table
  7324. Alternatively, the options can be specified as a flat string:
  7325. @var{fps}[:@var{start_time}[:@var{round}]].
  7326. See also the @ref{setpts} filter.
  7327. @subsection Examples
  7328. @itemize
  7329. @item
  7330. A typical usage in order to set the fps to 25:
  7331. @example
  7332. fps=fps=25
  7333. @end example
  7334. @item
  7335. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7336. @example
  7337. fps=fps=film:round=near
  7338. @end example
  7339. @end itemize
  7340. @section framepack
  7341. Pack two different video streams into a stereoscopic video, setting proper
  7342. metadata on supported codecs. The two views should have the same size and
  7343. framerate and processing will stop when the shorter video ends. Please note
  7344. that you may conveniently adjust view properties with the @ref{scale} and
  7345. @ref{fps} filters.
  7346. It accepts the following parameters:
  7347. @table @option
  7348. @item format
  7349. The desired packing format. Supported values are:
  7350. @table @option
  7351. @item sbs
  7352. The views are next to each other (default).
  7353. @item tab
  7354. The views are on top of each other.
  7355. @item lines
  7356. The views are packed by line.
  7357. @item columns
  7358. The views are packed by column.
  7359. @item frameseq
  7360. The views are temporally interleaved.
  7361. @end table
  7362. @end table
  7363. Some examples:
  7364. @example
  7365. # Convert left and right views into a frame-sequential video
  7366. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7367. # Convert views into a side-by-side video with the same output resolution as the input
  7368. 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
  7369. @end example
  7370. @section framerate
  7371. Change the frame rate by interpolating new video output frames from the source
  7372. frames.
  7373. This filter is not designed to function correctly with interlaced media. If
  7374. you wish to change the frame rate of interlaced media then you are required
  7375. to deinterlace before this filter and re-interlace after this filter.
  7376. A description of the accepted options follows.
  7377. @table @option
  7378. @item fps
  7379. Specify the output frames per second. This option can also be specified
  7380. as a value alone. The default is @code{50}.
  7381. @item interp_start
  7382. Specify the start of a range where the output frame will be created as a
  7383. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7384. the default is @code{15}.
  7385. @item interp_end
  7386. Specify the end of a range where the output frame will be created as a
  7387. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7388. the default is @code{240}.
  7389. @item scene
  7390. Specify the level at which a scene change is detected as a value between
  7391. 0 and 100 to indicate a new scene; a low value reflects a low
  7392. probability for the current frame to introduce a new scene, while a higher
  7393. value means the current frame is more likely to be one.
  7394. The default is @code{8.2}.
  7395. @item flags
  7396. Specify flags influencing the filter process.
  7397. Available value for @var{flags} is:
  7398. @table @option
  7399. @item scene_change_detect, scd
  7400. Enable scene change detection using the value of the option @var{scene}.
  7401. This flag is enabled by default.
  7402. @end table
  7403. @end table
  7404. @section framestep
  7405. Select one frame every N-th frame.
  7406. This filter accepts the following option:
  7407. @table @option
  7408. @item step
  7409. Select frame after every @code{step} frames.
  7410. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7411. @end table
  7412. @anchor{frei0r}
  7413. @section frei0r
  7414. Apply a frei0r effect to the input video.
  7415. To enable the compilation of this filter, you need to install the frei0r
  7416. header and configure FFmpeg with @code{--enable-frei0r}.
  7417. It accepts the following parameters:
  7418. @table @option
  7419. @item filter_name
  7420. The name of the frei0r effect to load. If the environment variable
  7421. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7422. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7423. Otherwise, the standard frei0r paths are searched, in this order:
  7424. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7425. @file{/usr/lib/frei0r-1/}.
  7426. @item filter_params
  7427. A '|'-separated list of parameters to pass to the frei0r effect.
  7428. @end table
  7429. A frei0r effect parameter can be a boolean (its value is either
  7430. "y" or "n"), a double, a color (specified as
  7431. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7432. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  7433. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  7434. a position (specified as @var{X}/@var{Y}, where
  7435. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7436. The number and types of parameters depend on the loaded effect. If an
  7437. effect parameter is not specified, the default value is set.
  7438. @subsection Examples
  7439. @itemize
  7440. @item
  7441. Apply the distort0r effect, setting the first two double parameters:
  7442. @example
  7443. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7444. @end example
  7445. @item
  7446. Apply the colordistance effect, taking a color as the first parameter:
  7447. @example
  7448. frei0r=colordistance:0.2/0.3/0.4
  7449. frei0r=colordistance:violet
  7450. frei0r=colordistance:0x112233
  7451. @end example
  7452. @item
  7453. Apply the perspective effect, specifying the top left and top right image
  7454. positions:
  7455. @example
  7456. frei0r=perspective:0.2/0.2|0.8/0.2
  7457. @end example
  7458. @end itemize
  7459. For more information, see
  7460. @url{http://frei0r.dyne.org}
  7461. @section fspp
  7462. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7463. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7464. processing filter, one of them is performed once per block, not per pixel.
  7465. This allows for much higher speed.
  7466. The filter accepts the following options:
  7467. @table @option
  7468. @item quality
  7469. Set quality. This option defines the number of levels for averaging. It accepts
  7470. an integer in the range 4-5. Default value is @code{4}.
  7471. @item qp
  7472. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7473. If not set, the filter will use the QP from the video stream (if available).
  7474. @item strength
  7475. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7476. more details but also more artifacts, while higher values make the image smoother
  7477. but also blurrier. Default value is @code{0} − PSNR optimal.
  7478. @item use_bframe_qp
  7479. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7480. option may cause flicker since the B-Frames have often larger QP. Default is
  7481. @code{0} (not enabled).
  7482. @end table
  7483. @section gblur
  7484. Apply Gaussian blur filter.
  7485. The filter accepts the following options:
  7486. @table @option
  7487. @item sigma
  7488. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7489. @item steps
  7490. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  7491. @item planes
  7492. Set which planes to filter. By default all planes are filtered.
  7493. @item sigmaV
  7494. Set vertical sigma, if negative it will be same as @code{sigma}.
  7495. Default is @code{-1}.
  7496. @end table
  7497. @section geq
  7498. The filter accepts the following options:
  7499. @table @option
  7500. @item lum_expr, lum
  7501. Set the luminance expression.
  7502. @item cb_expr, cb
  7503. Set the chrominance blue expression.
  7504. @item cr_expr, cr
  7505. Set the chrominance red expression.
  7506. @item alpha_expr, a
  7507. Set the alpha expression.
  7508. @item red_expr, r
  7509. Set the red expression.
  7510. @item green_expr, g
  7511. Set the green expression.
  7512. @item blue_expr, b
  7513. Set the blue expression.
  7514. @end table
  7515. The colorspace is selected according to the specified options. If one
  7516. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7517. options is specified, the filter will automatically select a YCbCr
  7518. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7519. @option{blue_expr} options is specified, it will select an RGB
  7520. colorspace.
  7521. If one of the chrominance expression is not defined, it falls back on the other
  7522. one. If no alpha expression is specified it will evaluate to opaque value.
  7523. If none of chrominance expressions are specified, they will evaluate
  7524. to the luminance expression.
  7525. The expressions can use the following variables and functions:
  7526. @table @option
  7527. @item N
  7528. The sequential number of the filtered frame, starting from @code{0}.
  7529. @item X
  7530. @item Y
  7531. The coordinates of the current sample.
  7532. @item W
  7533. @item H
  7534. The width and height of the image.
  7535. @item SW
  7536. @item SH
  7537. Width and height scale depending on the currently filtered plane. It is the
  7538. ratio between the corresponding luma plane number of pixels and the current
  7539. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7540. @code{0.5,0.5} for chroma planes.
  7541. @item T
  7542. Time of the current frame, expressed in seconds.
  7543. @item p(x, y)
  7544. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7545. plane.
  7546. @item lum(x, y)
  7547. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7548. plane.
  7549. @item cb(x, y)
  7550. Return the value of the pixel at location (@var{x},@var{y}) of the
  7551. blue-difference chroma plane. Return 0 if there is no such plane.
  7552. @item cr(x, y)
  7553. Return the value of the pixel at location (@var{x},@var{y}) of the
  7554. red-difference chroma plane. Return 0 if there is no such plane.
  7555. @item r(x, y)
  7556. @item g(x, y)
  7557. @item b(x, y)
  7558. Return the value of the pixel at location (@var{x},@var{y}) of the
  7559. red/green/blue component. Return 0 if there is no such component.
  7560. @item alpha(x, y)
  7561. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7562. plane. Return 0 if there is no such plane.
  7563. @end table
  7564. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7565. automatically clipped to the closer edge.
  7566. @subsection Examples
  7567. @itemize
  7568. @item
  7569. Flip the image horizontally:
  7570. @example
  7571. geq=p(W-X\,Y)
  7572. @end example
  7573. @item
  7574. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7575. wavelength of 100 pixels:
  7576. @example
  7577. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7578. @end example
  7579. @item
  7580. Generate a fancy enigmatic moving light:
  7581. @example
  7582. 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
  7583. @end example
  7584. @item
  7585. Generate a quick emboss effect:
  7586. @example
  7587. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7588. @end example
  7589. @item
  7590. Modify RGB components depending on pixel position:
  7591. @example
  7592. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7593. @end example
  7594. @item
  7595. Create a radial gradient that is the same size as the input (also see
  7596. the @ref{vignette} filter):
  7597. @example
  7598. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7599. @end example
  7600. @end itemize
  7601. @section gradfun
  7602. Fix the banding artifacts that are sometimes introduced into nearly flat
  7603. regions by truncation to 8-bit color depth.
  7604. Interpolate the gradients that should go where the bands are, and
  7605. dither them.
  7606. It is designed for playback only. Do not use it prior to
  7607. lossy compression, because compression tends to lose the dither and
  7608. bring back the bands.
  7609. It accepts the following parameters:
  7610. @table @option
  7611. @item strength
  7612. The maximum amount by which the filter will change any one pixel. This is also
  7613. the threshold for detecting nearly flat regions. Acceptable values range from
  7614. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7615. valid range.
  7616. @item radius
  7617. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7618. gradients, but also prevents the filter from modifying the pixels near detailed
  7619. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7620. values will be clipped to the valid range.
  7621. @end table
  7622. Alternatively, the options can be specified as a flat string:
  7623. @var{strength}[:@var{radius}]
  7624. @subsection Examples
  7625. @itemize
  7626. @item
  7627. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7628. @example
  7629. gradfun=3.5:8
  7630. @end example
  7631. @item
  7632. Specify radius, omitting the strength (which will fall-back to the default
  7633. value):
  7634. @example
  7635. gradfun=radius=8
  7636. @end example
  7637. @end itemize
  7638. @anchor{haldclut}
  7639. @section haldclut
  7640. Apply a Hald CLUT to a video stream.
  7641. First input is the video stream to process, and second one is the Hald CLUT.
  7642. The Hald CLUT input can be a simple picture or a complete video stream.
  7643. The filter accepts the following options:
  7644. @table @option
  7645. @item shortest
  7646. Force termination when the shortest input terminates. Default is @code{0}.
  7647. @item repeatlast
  7648. Continue applying the last CLUT after the end of the stream. A value of
  7649. @code{0} disable the filter after the last frame of the CLUT is reached.
  7650. Default is @code{1}.
  7651. @end table
  7652. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7653. filters share the same internals).
  7654. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7655. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7656. @subsection Workflow examples
  7657. @subsubsection Hald CLUT video stream
  7658. Generate an identity Hald CLUT stream altered with various effects:
  7659. @example
  7660. 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
  7661. @end example
  7662. Note: make sure you use a lossless codec.
  7663. Then use it with @code{haldclut} to apply it on some random stream:
  7664. @example
  7665. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  7666. @end example
  7667. The Hald CLUT will be applied to the 10 first seconds (duration of
  7668. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  7669. to the remaining frames of the @code{mandelbrot} stream.
  7670. @subsubsection Hald CLUT with preview
  7671. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  7672. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  7673. biggest possible square starting at the top left of the picture. The remaining
  7674. padding pixels (bottom or right) will be ignored. This area can be used to add
  7675. a preview of the Hald CLUT.
  7676. Typically, the following generated Hald CLUT will be supported by the
  7677. @code{haldclut} filter:
  7678. @example
  7679. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  7680. pad=iw+320 [padded_clut];
  7681. smptebars=s=320x256, split [a][b];
  7682. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  7683. [main][b] overlay=W-320" -frames:v 1 clut.png
  7684. @end example
  7685. It contains the original and a preview of the effect of the CLUT: SMPTE color
  7686. bars are displayed on the right-top, and below the same color bars processed by
  7687. the color changes.
  7688. Then, the effect of this Hald CLUT can be visualized with:
  7689. @example
  7690. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7691. @end example
  7692. @section hflip
  7693. Flip the input video horizontally.
  7694. For example, to horizontally flip the input video with @command{ffmpeg}:
  7695. @example
  7696. ffmpeg -i in.avi -vf "hflip" out.avi
  7697. @end example
  7698. @section histeq
  7699. This filter applies a global color histogram equalization on a
  7700. per-frame basis.
  7701. It can be used to correct video that has a compressed range of pixel
  7702. intensities. The filter redistributes the pixel intensities to
  7703. equalize their distribution across the intensity range. It may be
  7704. viewed as an "automatically adjusting contrast filter". This filter is
  7705. useful only for correcting degraded or poorly captured source
  7706. video.
  7707. The filter accepts the following options:
  7708. @table @option
  7709. @item strength
  7710. Determine the amount of equalization to be applied. As the strength
  7711. is reduced, the distribution of pixel intensities more-and-more
  7712. approaches that of the input frame. The value must be a float number
  7713. in the range [0,1] and defaults to 0.200.
  7714. @item intensity
  7715. Set the maximum intensity that can generated and scale the output
  7716. values appropriately. The strength should be set as desired and then
  7717. the intensity can be limited if needed to avoid washing-out. The value
  7718. must be a float number in the range [0,1] and defaults to 0.210.
  7719. @item antibanding
  7720. Set the antibanding level. If enabled the filter will randomly vary
  7721. the luminance of output pixels by a small amount to avoid banding of
  7722. the histogram. Possible values are @code{none}, @code{weak} or
  7723. @code{strong}. It defaults to @code{none}.
  7724. @end table
  7725. @section histogram
  7726. Compute and draw a color distribution histogram for the input video.
  7727. The computed histogram is a representation of the color component
  7728. distribution in an image.
  7729. Standard histogram displays the color components distribution in an image.
  7730. Displays color graph for each color component. Shows distribution of
  7731. the Y, U, V, A or R, G, B components, depending on input format, in the
  7732. current frame. Below each graph a color component scale meter is shown.
  7733. The filter accepts the following options:
  7734. @table @option
  7735. @item level_height
  7736. Set height of level. Default value is @code{200}.
  7737. Allowed range is [50, 2048].
  7738. @item scale_height
  7739. Set height of color scale. Default value is @code{12}.
  7740. Allowed range is [0, 40].
  7741. @item display_mode
  7742. Set display mode.
  7743. It accepts the following values:
  7744. @table @samp
  7745. @item stack
  7746. Per color component graphs are placed below each other.
  7747. @item parade
  7748. Per color component graphs are placed side by side.
  7749. @item overlay
  7750. Presents information identical to that in the @code{parade}, except
  7751. that the graphs representing color components are superimposed directly
  7752. over one another.
  7753. @end table
  7754. Default is @code{stack}.
  7755. @item levels_mode
  7756. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7757. Default is @code{linear}.
  7758. @item components
  7759. Set what color components to display.
  7760. Default is @code{7}.
  7761. @item fgopacity
  7762. Set foreground opacity. Default is @code{0.7}.
  7763. @item bgopacity
  7764. Set background opacity. Default is @code{0.5}.
  7765. @end table
  7766. @subsection Examples
  7767. @itemize
  7768. @item
  7769. Calculate and draw histogram:
  7770. @example
  7771. ffplay -i input -vf histogram
  7772. @end example
  7773. @end itemize
  7774. @anchor{hqdn3d}
  7775. @section hqdn3d
  7776. This is a high precision/quality 3d denoise filter. It aims to reduce
  7777. image noise, producing smooth images and making still images really
  7778. still. It should enhance compressibility.
  7779. It accepts the following optional parameters:
  7780. @table @option
  7781. @item luma_spatial
  7782. A non-negative floating point number which specifies spatial luma strength.
  7783. It defaults to 4.0.
  7784. @item chroma_spatial
  7785. A non-negative floating point number which specifies spatial chroma strength.
  7786. It defaults to 3.0*@var{luma_spatial}/4.0.
  7787. @item luma_tmp
  7788. A floating point number which specifies luma temporal strength. It defaults to
  7789. 6.0*@var{luma_spatial}/4.0.
  7790. @item chroma_tmp
  7791. A floating point number which specifies chroma temporal strength. It defaults to
  7792. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7793. @end table
  7794. @section hwdownload
  7795. Download hardware frames to system memory.
  7796. The input must be in hardware frames, and the output a non-hardware format.
  7797. Not all formats will be supported on the output - it may be necessary to insert
  7798. an additional @option{format} filter immediately following in the graph to get
  7799. the output in a supported format.
  7800. @section hwmap
  7801. Map hardware frames to system memory or to another device.
  7802. This filter has several different modes of operation; which one is used depends
  7803. on the input and output formats:
  7804. @itemize
  7805. @item
  7806. Hardware frame input, normal frame output
  7807. Map the input frames to system memory and pass them to the output. If the
  7808. original hardware frame is later required (for example, after overlaying
  7809. something else on part of it), the @option{hwmap} filter can be used again
  7810. in the next mode to retrieve it.
  7811. @item
  7812. Normal frame input, hardware frame output
  7813. If the input is actually a software-mapped hardware frame, then unmap it -
  7814. that is, return the original hardware frame.
  7815. Otherwise, a device must be provided. Create new hardware surfaces on that
  7816. device for the output, then map them back to the software format at the input
  7817. and give those frames to the preceding filter. This will then act like the
  7818. @option{hwupload} filter, but may be able to avoid an additional copy when
  7819. the input is already in a compatible format.
  7820. @item
  7821. Hardware frame input and output
  7822. A device must be supplied for the output, either directly or with the
  7823. @option{derive_device} option. The input and output devices must be of
  7824. different types and compatible - the exact meaning of this is
  7825. system-dependent, but typically it means that they must refer to the same
  7826. underlying hardware context (for example, refer to the same graphics card).
  7827. If the input frames were originally created on the output device, then unmap
  7828. to retrieve the original frames.
  7829. Otherwise, map the frames to the output device - create new hardware frames
  7830. on the output corresponding to the frames on the input.
  7831. @end itemize
  7832. The following additional parameters are accepted:
  7833. @table @option
  7834. @item mode
  7835. Set the frame mapping mode. Some combination of:
  7836. @table @var
  7837. @item read
  7838. The mapped frame should be readable.
  7839. @item write
  7840. The mapped frame should be writeable.
  7841. @item overwrite
  7842. The mapping will always overwrite the entire frame.
  7843. This may improve performance in some cases, as the original contents of the
  7844. frame need not be loaded.
  7845. @item direct
  7846. The mapping must not involve any copying.
  7847. Indirect mappings to copies of frames are created in some cases where either
  7848. direct mapping is not possible or it would have unexpected properties.
  7849. Setting this flag ensures that the mapping is direct and will fail if that is
  7850. not possible.
  7851. @end table
  7852. Defaults to @var{read+write} if not specified.
  7853. @item derive_device @var{type}
  7854. Rather than using the device supplied at initialisation, instead derive a new
  7855. device of type @var{type} from the device the input frames exist on.
  7856. @item reverse
  7857. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7858. and map them back to the source. This may be necessary in some cases where
  7859. a mapping in one direction is required but only the opposite direction is
  7860. supported by the devices being used.
  7861. This option is dangerous - it may break the preceding filter in undefined
  7862. ways if there are any additional constraints on that filter's output.
  7863. Do not use it without fully understanding the implications of its use.
  7864. @end table
  7865. @section hwupload
  7866. Upload system memory frames to hardware surfaces.
  7867. The device to upload to must be supplied when the filter is initialised. If
  7868. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7869. option.
  7870. @anchor{hwupload_cuda}
  7871. @section hwupload_cuda
  7872. Upload system memory frames to a CUDA device.
  7873. It accepts the following optional parameters:
  7874. @table @option
  7875. @item device
  7876. The number of the CUDA device to use
  7877. @end table
  7878. @section hqx
  7879. Apply a high-quality magnification filter designed for pixel art. This filter
  7880. was originally created by Maxim Stepin.
  7881. It accepts the following option:
  7882. @table @option
  7883. @item n
  7884. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7885. @code{hq3x} and @code{4} for @code{hq4x}.
  7886. Default is @code{3}.
  7887. @end table
  7888. @section hstack
  7889. Stack input videos horizontally.
  7890. All streams must be of same pixel format and of same height.
  7891. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7892. to create same output.
  7893. The filter accept the following option:
  7894. @table @option
  7895. @item inputs
  7896. Set number of input streams. Default is 2.
  7897. @item shortest
  7898. If set to 1, force the output to terminate when the shortest input
  7899. terminates. Default value is 0.
  7900. @end table
  7901. @section hue
  7902. Modify the hue and/or the saturation of the input.
  7903. It accepts the following parameters:
  7904. @table @option
  7905. @item h
  7906. Specify the hue angle as a number of degrees. It accepts an expression,
  7907. and defaults to "0".
  7908. @item s
  7909. Specify the saturation in the [-10,10] range. It accepts an expression and
  7910. defaults to "1".
  7911. @item H
  7912. Specify the hue angle as a number of radians. It accepts an
  7913. expression, and defaults to "0".
  7914. @item b
  7915. Specify the brightness in the [-10,10] range. It accepts an expression and
  7916. defaults to "0".
  7917. @end table
  7918. @option{h} and @option{H} are mutually exclusive, and can't be
  7919. specified at the same time.
  7920. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7921. expressions containing the following constants:
  7922. @table @option
  7923. @item n
  7924. frame count of the input frame starting from 0
  7925. @item pts
  7926. presentation timestamp of the input frame expressed in time base units
  7927. @item r
  7928. frame rate of the input video, NAN if the input frame rate is unknown
  7929. @item t
  7930. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7931. @item tb
  7932. time base of the input video
  7933. @end table
  7934. @subsection Examples
  7935. @itemize
  7936. @item
  7937. Set the hue to 90 degrees and the saturation to 1.0:
  7938. @example
  7939. hue=h=90:s=1
  7940. @end example
  7941. @item
  7942. Same command but expressing the hue in radians:
  7943. @example
  7944. hue=H=PI/2:s=1
  7945. @end example
  7946. @item
  7947. Rotate hue and make the saturation swing between 0
  7948. and 2 over a period of 1 second:
  7949. @example
  7950. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7951. @end example
  7952. @item
  7953. Apply a 3 seconds saturation fade-in effect starting at 0:
  7954. @example
  7955. hue="s=min(t/3\,1)"
  7956. @end example
  7957. The general fade-in expression can be written as:
  7958. @example
  7959. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7960. @end example
  7961. @item
  7962. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7963. @example
  7964. hue="s=max(0\, min(1\, (8-t)/3))"
  7965. @end example
  7966. The general fade-out expression can be written as:
  7967. @example
  7968. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7969. @end example
  7970. @end itemize
  7971. @subsection Commands
  7972. This filter supports the following commands:
  7973. @table @option
  7974. @item b
  7975. @item s
  7976. @item h
  7977. @item H
  7978. Modify the hue and/or the saturation and/or brightness of the input video.
  7979. The command accepts the same syntax of the corresponding option.
  7980. If the specified expression is not valid, it is kept at its current
  7981. value.
  7982. @end table
  7983. @section hysteresis
  7984. Grow first stream into second stream by connecting components.
  7985. This makes it possible to build more robust edge masks.
  7986. This filter accepts the following options:
  7987. @table @option
  7988. @item planes
  7989. Set which planes will be processed as bitmap, unprocessed planes will be
  7990. copied from first stream.
  7991. By default value 0xf, all planes will be processed.
  7992. @item threshold
  7993. Set threshold which is used in filtering. If pixel component value is higher than
  7994. this value filter algorithm for connecting components is activated.
  7995. By default value is 0.
  7996. @end table
  7997. @section idet
  7998. Detect video interlacing type.
  7999. This filter tries to detect if the input frames are interlaced, progressive,
  8000. top or bottom field first. It will also try to detect fields that are
  8001. repeated between adjacent frames (a sign of telecine).
  8002. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8003. Multiple frame detection incorporates the classification history of previous frames.
  8004. The filter will log these metadata values:
  8005. @table @option
  8006. @item single.current_frame
  8007. Detected type of current frame using single-frame detection. One of:
  8008. ``tff'' (top field first), ``bff'' (bottom field first),
  8009. ``progressive'', or ``undetermined''
  8010. @item single.tff
  8011. Cumulative number of frames detected as top field first using single-frame detection.
  8012. @item multiple.tff
  8013. Cumulative number of frames detected as top field first using multiple-frame detection.
  8014. @item single.bff
  8015. Cumulative number of frames detected as bottom field first using single-frame detection.
  8016. @item multiple.current_frame
  8017. Detected type of current frame using multiple-frame detection. One of:
  8018. ``tff'' (top field first), ``bff'' (bottom field first),
  8019. ``progressive'', or ``undetermined''
  8020. @item multiple.bff
  8021. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8022. @item single.progressive
  8023. Cumulative number of frames detected as progressive using single-frame detection.
  8024. @item multiple.progressive
  8025. Cumulative number of frames detected as progressive using multiple-frame detection.
  8026. @item single.undetermined
  8027. Cumulative number of frames that could not be classified using single-frame detection.
  8028. @item multiple.undetermined
  8029. Cumulative number of frames that could not be classified using multiple-frame detection.
  8030. @item repeated.current_frame
  8031. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8032. @item repeated.neither
  8033. Cumulative number of frames with no repeated field.
  8034. @item repeated.top
  8035. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8036. @item repeated.bottom
  8037. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8038. @end table
  8039. The filter accepts the following options:
  8040. @table @option
  8041. @item intl_thres
  8042. Set interlacing threshold.
  8043. @item prog_thres
  8044. Set progressive threshold.
  8045. @item rep_thres
  8046. Threshold for repeated field detection.
  8047. @item half_life
  8048. Number of frames after which a given frame's contribution to the
  8049. statistics is halved (i.e., it contributes only 0.5 to its
  8050. classification). The default of 0 means that all frames seen are given
  8051. full weight of 1.0 forever.
  8052. @item analyze_interlaced_flag
  8053. When this is not 0 then idet will use the specified number of frames to determine
  8054. if the interlaced flag is accurate, it will not count undetermined frames.
  8055. If the flag is found to be accurate it will be used without any further
  8056. computations, if it is found to be inaccurate it will be cleared without any
  8057. further computations. This allows inserting the idet filter as a low computational
  8058. method to clean up the interlaced flag
  8059. @end table
  8060. @section il
  8061. Deinterleave or interleave fields.
  8062. This filter allows one to process interlaced images fields without
  8063. deinterlacing them. Deinterleaving splits the input frame into 2
  8064. fields (so called half pictures). Odd lines are moved to the top
  8065. half of the output image, even lines to the bottom half.
  8066. You can process (filter) them independently and then re-interleave them.
  8067. The filter accepts the following options:
  8068. @table @option
  8069. @item luma_mode, l
  8070. @item chroma_mode, c
  8071. @item alpha_mode, a
  8072. Available values for @var{luma_mode}, @var{chroma_mode} and
  8073. @var{alpha_mode} are:
  8074. @table @samp
  8075. @item none
  8076. Do nothing.
  8077. @item deinterleave, d
  8078. Deinterleave fields, placing one above the other.
  8079. @item interleave, i
  8080. Interleave fields. Reverse the effect of deinterleaving.
  8081. @end table
  8082. Default value is @code{none}.
  8083. @item luma_swap, ls
  8084. @item chroma_swap, cs
  8085. @item alpha_swap, as
  8086. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  8087. @end table
  8088. @section inflate
  8089. Apply inflate effect to the video.
  8090. This filter replaces the pixel by the local(3x3) average by taking into account
  8091. only values higher than the pixel.
  8092. It accepts the following options:
  8093. @table @option
  8094. @item threshold0
  8095. @item threshold1
  8096. @item threshold2
  8097. @item threshold3
  8098. Limit the maximum change for each plane, default is 65535.
  8099. If 0, plane will remain unchanged.
  8100. @end table
  8101. @section interlace
  8102. Simple interlacing filter from progressive contents. This interleaves upper (or
  8103. lower) lines from odd frames with lower (or upper) lines from even frames,
  8104. halving the frame rate and preserving image height.
  8105. @example
  8106. Original Original New Frame
  8107. Frame 'j' Frame 'j+1' (tff)
  8108. ========== =========== ==================
  8109. Line 0 --------------------> Frame 'j' Line 0
  8110. Line 1 Line 1 ----> Frame 'j+1' Line 1
  8111. Line 2 ---------------------> Frame 'j' Line 2
  8112. Line 3 Line 3 ----> Frame 'j+1' Line 3
  8113. ... ... ...
  8114. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  8115. @end example
  8116. It accepts the following optional parameters:
  8117. @table @option
  8118. @item scan
  8119. This determines whether the interlaced frame is taken from the even
  8120. (tff - default) or odd (bff) lines of the progressive frame.
  8121. @item lowpass
  8122. Vertical lowpass filter to avoid twitter interlacing and
  8123. reduce moire patterns.
  8124. @table @samp
  8125. @item 0, off
  8126. Disable vertical lowpass filter
  8127. @item 1, linear
  8128. Enable linear filter (default)
  8129. @item 2, complex
  8130. Enable complex filter. This will slightly less reduce twitter and moire
  8131. but better retain detail and subjective sharpness impression.
  8132. @end table
  8133. @end table
  8134. @section kerndeint
  8135. Deinterlace input video by applying Donald Graft's adaptive kernel
  8136. deinterling. Work on interlaced parts of a video to produce
  8137. progressive frames.
  8138. The description of the accepted parameters follows.
  8139. @table @option
  8140. @item thresh
  8141. Set the threshold which affects the filter's tolerance when
  8142. determining if a pixel line must be processed. It must be an integer
  8143. in the range [0,255] and defaults to 10. A value of 0 will result in
  8144. applying the process on every pixels.
  8145. @item map
  8146. Paint pixels exceeding the threshold value to white if set to 1.
  8147. Default is 0.
  8148. @item order
  8149. Set the fields order. Swap fields if set to 1, leave fields alone if
  8150. 0. Default is 0.
  8151. @item sharp
  8152. Enable additional sharpening if set to 1. Default is 0.
  8153. @item twoway
  8154. Enable twoway sharpening if set to 1. Default is 0.
  8155. @end table
  8156. @subsection Examples
  8157. @itemize
  8158. @item
  8159. Apply default values:
  8160. @example
  8161. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  8162. @end example
  8163. @item
  8164. Enable additional sharpening:
  8165. @example
  8166. kerndeint=sharp=1
  8167. @end example
  8168. @item
  8169. Paint processed pixels in white:
  8170. @example
  8171. kerndeint=map=1
  8172. @end example
  8173. @end itemize
  8174. @section lenscorrection
  8175. Correct radial lens distortion
  8176. This filter can be used to correct for radial distortion as can result from the use
  8177. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  8178. one can use tools available for example as part of opencv or simply trial-and-error.
  8179. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  8180. and extract the k1 and k2 coefficients from the resulting matrix.
  8181. Note that effectively the same filter is available in the open-source tools Krita and
  8182. Digikam from the KDE project.
  8183. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  8184. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  8185. brightness distribution, so you may want to use both filters together in certain
  8186. cases, though you will have to take care of ordering, i.e. whether vignetting should
  8187. be applied before or after lens correction.
  8188. @subsection Options
  8189. The filter accepts the following options:
  8190. @table @option
  8191. @item cx
  8192. Relative x-coordinate of the focal point of the image, and thereby the center of the
  8193. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8194. width. Default is 0.5.
  8195. @item cy
  8196. Relative y-coordinate of the focal point of the image, and thereby the center of the
  8197. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8198. height. Default is 0.5.
  8199. @item k1
  8200. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  8201. no correction. Default is 0.
  8202. @item k2
  8203. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  8204. 0 means no correction. Default is 0.
  8205. @end table
  8206. The formula that generates the correction is:
  8207. @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)
  8208. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  8209. distances from the focal point in the source and target images, respectively.
  8210. @section libvmaf
  8211. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  8212. score between two input videos.
  8213. The obtained VMAF score is printed through the logging system.
  8214. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  8215. After installing the library it can be enabled using:
  8216. @code{./configure --enable-libvmaf}.
  8217. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  8218. The filter has following options:
  8219. @table @option
  8220. @item model_path
  8221. Set the model path which is to be used for SVM.
  8222. Default value: @code{"vmaf_v0.6.1.pkl"}
  8223. @item log_path
  8224. Set the file path to be used to store logs.
  8225. @item log_fmt
  8226. Set the format of the log file (xml or json).
  8227. @item enable_transform
  8228. Enables transform for computing vmaf.
  8229. @item phone_model
  8230. Invokes the phone model which will generate VMAF scores higher than in the
  8231. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  8232. @item psnr
  8233. Enables computing psnr along with vmaf.
  8234. @item ssim
  8235. Enables computing ssim along with vmaf.
  8236. @item ms_ssim
  8237. Enables computing ms_ssim along with vmaf.
  8238. @item pool
  8239. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  8240. @end table
  8241. This filter also supports the @ref{framesync} options.
  8242. On the below examples the input file @file{main.mpg} being processed is
  8243. compared with the reference file @file{ref.mpg}.
  8244. @example
  8245. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  8246. @end example
  8247. Example with options:
  8248. @example
  8249. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  8250. @end example
  8251. @section limiter
  8252. Limits the pixel components values to the specified range [min, max].
  8253. The filter accepts the following options:
  8254. @table @option
  8255. @item min
  8256. Lower bound. Defaults to the lowest allowed value for the input.
  8257. @item max
  8258. Upper bound. Defaults to the highest allowed value for the input.
  8259. @item planes
  8260. Specify which planes will be processed. Defaults to all available.
  8261. @end table
  8262. @section loop
  8263. Loop video frames.
  8264. The filter accepts the following options:
  8265. @table @option
  8266. @item loop
  8267. Set the number of loops. Setting this value to -1 will result in infinite loops.
  8268. Default is 0.
  8269. @item size
  8270. Set maximal size in number of frames. Default is 0.
  8271. @item start
  8272. Set first frame of loop. Default is 0.
  8273. @end table
  8274. @anchor{lut3d}
  8275. @section lut3d
  8276. Apply a 3D LUT to an input video.
  8277. The filter accepts the following options:
  8278. @table @option
  8279. @item file
  8280. Set the 3D LUT file name.
  8281. Currently supported formats:
  8282. @table @samp
  8283. @item 3dl
  8284. AfterEffects
  8285. @item cube
  8286. Iridas
  8287. @item dat
  8288. DaVinci
  8289. @item m3d
  8290. Pandora
  8291. @end table
  8292. @item interp
  8293. Select interpolation mode.
  8294. Available values are:
  8295. @table @samp
  8296. @item nearest
  8297. Use values from the nearest defined point.
  8298. @item trilinear
  8299. Interpolate values using the 8 points defining a cube.
  8300. @item tetrahedral
  8301. Interpolate values using a tetrahedron.
  8302. @end table
  8303. @end table
  8304. This filter also supports the @ref{framesync} options.
  8305. @section lumakey
  8306. Turn certain luma values into transparency.
  8307. The filter accepts the following options:
  8308. @table @option
  8309. @item threshold
  8310. Set the luma which will be used as base for transparency.
  8311. Default value is @code{0}.
  8312. @item tolerance
  8313. Set the range of luma values to be keyed out.
  8314. Default value is @code{0}.
  8315. @item softness
  8316. Set the range of softness. Default value is @code{0}.
  8317. Use this to control gradual transition from zero to full transparency.
  8318. @end table
  8319. @section lut, lutrgb, lutyuv
  8320. Compute a look-up table for binding each pixel component input value
  8321. to an output value, and apply it to the input video.
  8322. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  8323. to an RGB input video.
  8324. These filters accept the following parameters:
  8325. @table @option
  8326. @item c0
  8327. set first pixel component expression
  8328. @item c1
  8329. set second pixel component expression
  8330. @item c2
  8331. set third pixel component expression
  8332. @item c3
  8333. set fourth pixel component expression, corresponds to the alpha component
  8334. @item r
  8335. set red component expression
  8336. @item g
  8337. set green component expression
  8338. @item b
  8339. set blue component expression
  8340. @item a
  8341. alpha component expression
  8342. @item y
  8343. set Y/luminance component expression
  8344. @item u
  8345. set U/Cb component expression
  8346. @item v
  8347. set V/Cr component expression
  8348. @end table
  8349. Each of them specifies the expression to use for computing the lookup table for
  8350. the corresponding pixel component values.
  8351. The exact component associated to each of the @var{c*} options depends on the
  8352. format in input.
  8353. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  8354. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  8355. The expressions can contain the following constants and functions:
  8356. @table @option
  8357. @item w
  8358. @item h
  8359. The input width and height.
  8360. @item val
  8361. The input value for the pixel component.
  8362. @item clipval
  8363. The input value, clipped to the @var{minval}-@var{maxval} range.
  8364. @item maxval
  8365. The maximum value for the pixel component.
  8366. @item minval
  8367. The minimum value for the pixel component.
  8368. @item negval
  8369. The negated value for the pixel component value, clipped to the
  8370. @var{minval}-@var{maxval} range; it corresponds to the expression
  8371. "maxval-clipval+minval".
  8372. @item clip(val)
  8373. The computed value in @var{val}, clipped to the
  8374. @var{minval}-@var{maxval} range.
  8375. @item gammaval(gamma)
  8376. The computed gamma correction value of the pixel component value,
  8377. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  8378. expression
  8379. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  8380. @end table
  8381. All expressions default to "val".
  8382. @subsection Examples
  8383. @itemize
  8384. @item
  8385. Negate input video:
  8386. @example
  8387. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  8388. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  8389. @end example
  8390. The above is the same as:
  8391. @example
  8392. lutrgb="r=negval:g=negval:b=negval"
  8393. lutyuv="y=negval:u=negval:v=negval"
  8394. @end example
  8395. @item
  8396. Negate luminance:
  8397. @example
  8398. lutyuv=y=negval
  8399. @end example
  8400. @item
  8401. Remove chroma components, turning the video into a graytone image:
  8402. @example
  8403. lutyuv="u=128:v=128"
  8404. @end example
  8405. @item
  8406. Apply a luma burning effect:
  8407. @example
  8408. lutyuv="y=2*val"
  8409. @end example
  8410. @item
  8411. Remove green and blue components:
  8412. @example
  8413. lutrgb="g=0:b=0"
  8414. @end example
  8415. @item
  8416. Set a constant alpha channel value on input:
  8417. @example
  8418. format=rgba,lutrgb=a="maxval-minval/2"
  8419. @end example
  8420. @item
  8421. Correct luminance gamma by a factor of 0.5:
  8422. @example
  8423. lutyuv=y=gammaval(0.5)
  8424. @end example
  8425. @item
  8426. Discard least significant bits of luma:
  8427. @example
  8428. lutyuv=y='bitand(val, 128+64+32)'
  8429. @end example
  8430. @item
  8431. Technicolor like effect:
  8432. @example
  8433. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  8434. @end example
  8435. @end itemize
  8436. @section lut2, tlut2
  8437. The @code{lut2} filter takes two input streams and outputs one
  8438. stream.
  8439. The @code{tlut2} (time lut2) filter takes two consecutive frames
  8440. from one single stream.
  8441. This filter accepts the following parameters:
  8442. @table @option
  8443. @item c0
  8444. set first pixel component expression
  8445. @item c1
  8446. set second pixel component expression
  8447. @item c2
  8448. set third pixel component expression
  8449. @item c3
  8450. set fourth pixel component expression, corresponds to the alpha component
  8451. @end table
  8452. Each of them specifies the expression to use for computing the lookup table for
  8453. the corresponding pixel component values.
  8454. The exact component associated to each of the @var{c*} options depends on the
  8455. format in inputs.
  8456. The expressions can contain the following constants:
  8457. @table @option
  8458. @item w
  8459. @item h
  8460. The input width and height.
  8461. @item x
  8462. The first input value for the pixel component.
  8463. @item y
  8464. The second input value for the pixel component.
  8465. @item bdx
  8466. The first input video bit depth.
  8467. @item bdy
  8468. The second input video bit depth.
  8469. @end table
  8470. All expressions default to "x".
  8471. @subsection Examples
  8472. @itemize
  8473. @item
  8474. Highlight differences between two RGB video streams:
  8475. @example
  8476. 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)'
  8477. @end example
  8478. @item
  8479. Highlight differences between two YUV video streams:
  8480. @example
  8481. 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)'
  8482. @end example
  8483. @item
  8484. Show max difference between two video streams:
  8485. @example
  8486. 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)))'
  8487. @end example
  8488. @end itemize
  8489. @section maskedclamp
  8490. Clamp the first input stream with the second input and third input stream.
  8491. Returns the value of first stream to be between second input
  8492. stream - @code{undershoot} and third input stream + @code{overshoot}.
  8493. This filter accepts the following options:
  8494. @table @option
  8495. @item undershoot
  8496. Default value is @code{0}.
  8497. @item overshoot
  8498. Default value is @code{0}.
  8499. @item planes
  8500. Set which planes will be processed as bitmap, unprocessed planes will be
  8501. copied from first stream.
  8502. By default value 0xf, all planes will be processed.
  8503. @end table
  8504. @section maskedmerge
  8505. Merge the first input stream with the second input stream using per pixel
  8506. weights in the third input stream.
  8507. A value of 0 in the third stream pixel component means that pixel component
  8508. from first stream is returned unchanged, while maximum value (eg. 255 for
  8509. 8-bit videos) means that pixel component from second stream is returned
  8510. unchanged. Intermediate values define the amount of merging between both
  8511. input stream's pixel components.
  8512. This filter accepts the following options:
  8513. @table @option
  8514. @item planes
  8515. Set which planes will be processed as bitmap, unprocessed planes will be
  8516. copied from first stream.
  8517. By default value 0xf, all planes will be processed.
  8518. @end table
  8519. @section mcdeint
  8520. Apply motion-compensation deinterlacing.
  8521. It needs one field per frame as input and must thus be used together
  8522. with yadif=1/3 or equivalent.
  8523. This filter accepts the following options:
  8524. @table @option
  8525. @item mode
  8526. Set the deinterlacing mode.
  8527. It accepts one of the following values:
  8528. @table @samp
  8529. @item fast
  8530. @item medium
  8531. @item slow
  8532. use iterative motion estimation
  8533. @item extra_slow
  8534. like @samp{slow}, but use multiple reference frames.
  8535. @end table
  8536. Default value is @samp{fast}.
  8537. @item parity
  8538. Set the picture field parity assumed for the input video. It must be
  8539. one of the following values:
  8540. @table @samp
  8541. @item 0, tff
  8542. assume top field first
  8543. @item 1, bff
  8544. assume bottom field first
  8545. @end table
  8546. Default value is @samp{bff}.
  8547. @item qp
  8548. Set per-block quantization parameter (QP) used by the internal
  8549. encoder.
  8550. Higher values should result in a smoother motion vector field but less
  8551. optimal individual vectors. Default value is 1.
  8552. @end table
  8553. @section mergeplanes
  8554. Merge color channel components from several video streams.
  8555. The filter accepts up to 4 input streams, and merge selected input
  8556. planes to the output video.
  8557. This filter accepts the following options:
  8558. @table @option
  8559. @item mapping
  8560. Set input to output plane mapping. Default is @code{0}.
  8561. The mappings is specified as a bitmap. It should be specified as a
  8562. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  8563. mapping for the first plane of the output stream. 'A' sets the number of
  8564. the input stream to use (from 0 to 3), and 'a' the plane number of the
  8565. corresponding input to use (from 0 to 3). The rest of the mappings is
  8566. similar, 'Bb' describes the mapping for the output stream second
  8567. plane, 'Cc' describes the mapping for the output stream third plane and
  8568. 'Dd' describes the mapping for the output stream fourth plane.
  8569. @item format
  8570. Set output pixel format. Default is @code{yuva444p}.
  8571. @end table
  8572. @subsection Examples
  8573. @itemize
  8574. @item
  8575. Merge three gray video streams of same width and height into single video stream:
  8576. @example
  8577. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  8578. @end example
  8579. @item
  8580. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  8581. @example
  8582. [a0][a1]mergeplanes=0x00010210:yuva444p
  8583. @end example
  8584. @item
  8585. Swap Y and A plane in yuva444p stream:
  8586. @example
  8587. format=yuva444p,mergeplanes=0x03010200:yuva444p
  8588. @end example
  8589. @item
  8590. Swap U and V plane in yuv420p stream:
  8591. @example
  8592. format=yuv420p,mergeplanes=0x000201:yuv420p
  8593. @end example
  8594. @item
  8595. Cast a rgb24 clip to yuv444p:
  8596. @example
  8597. format=rgb24,mergeplanes=0x000102:yuv444p
  8598. @end example
  8599. @end itemize
  8600. @section mestimate
  8601. Estimate and export motion vectors using block matching algorithms.
  8602. Motion vectors are stored in frame side data to be used by other filters.
  8603. This filter accepts the following options:
  8604. @table @option
  8605. @item method
  8606. Specify the motion estimation method. Accepts one of the following values:
  8607. @table @samp
  8608. @item esa
  8609. Exhaustive search algorithm.
  8610. @item tss
  8611. Three step search algorithm.
  8612. @item tdls
  8613. Two dimensional logarithmic search algorithm.
  8614. @item ntss
  8615. New three step search algorithm.
  8616. @item fss
  8617. Four step search algorithm.
  8618. @item ds
  8619. Diamond search algorithm.
  8620. @item hexbs
  8621. Hexagon-based search algorithm.
  8622. @item epzs
  8623. Enhanced predictive zonal search algorithm.
  8624. @item umh
  8625. Uneven multi-hexagon search algorithm.
  8626. @end table
  8627. Default value is @samp{esa}.
  8628. @item mb_size
  8629. Macroblock size. Default @code{16}.
  8630. @item search_param
  8631. Search parameter. Default @code{7}.
  8632. @end table
  8633. @section midequalizer
  8634. Apply Midway Image Equalization effect using two video streams.
  8635. Midway Image Equalization adjusts a pair of images to have the same
  8636. histogram, while maintaining their dynamics as much as possible. It's
  8637. useful for e.g. matching exposures from a pair of stereo cameras.
  8638. This filter has two inputs and one output, which must be of same pixel format, but
  8639. may be of different sizes. The output of filter is first input adjusted with
  8640. midway histogram of both inputs.
  8641. This filter accepts the following option:
  8642. @table @option
  8643. @item planes
  8644. Set which planes to process. Default is @code{15}, which is all available planes.
  8645. @end table
  8646. @section minterpolate
  8647. Convert the video to specified frame rate using motion interpolation.
  8648. This filter accepts the following options:
  8649. @table @option
  8650. @item fps
  8651. 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}.
  8652. @item mi_mode
  8653. Motion interpolation mode. Following values are accepted:
  8654. @table @samp
  8655. @item dup
  8656. Duplicate previous or next frame for interpolating new ones.
  8657. @item blend
  8658. Blend source frames. Interpolated frame is mean of previous and next frames.
  8659. @item mci
  8660. Motion compensated interpolation. Following options are effective when this mode is selected:
  8661. @table @samp
  8662. @item mc_mode
  8663. Motion compensation mode. Following values are accepted:
  8664. @table @samp
  8665. @item obmc
  8666. Overlapped block motion compensation.
  8667. @item aobmc
  8668. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  8669. @end table
  8670. Default mode is @samp{obmc}.
  8671. @item me_mode
  8672. Motion estimation mode. Following values are accepted:
  8673. @table @samp
  8674. @item bidir
  8675. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  8676. @item bilat
  8677. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  8678. @end table
  8679. Default mode is @samp{bilat}.
  8680. @item me
  8681. The algorithm to be used for motion estimation. Following values are accepted:
  8682. @table @samp
  8683. @item esa
  8684. Exhaustive search algorithm.
  8685. @item tss
  8686. Three step search algorithm.
  8687. @item tdls
  8688. Two dimensional logarithmic search algorithm.
  8689. @item ntss
  8690. New three step search algorithm.
  8691. @item fss
  8692. Four step search algorithm.
  8693. @item ds
  8694. Diamond search algorithm.
  8695. @item hexbs
  8696. Hexagon-based search algorithm.
  8697. @item epzs
  8698. Enhanced predictive zonal search algorithm.
  8699. @item umh
  8700. Uneven multi-hexagon search algorithm.
  8701. @end table
  8702. Default algorithm is @samp{epzs}.
  8703. @item mb_size
  8704. Macroblock size. Default @code{16}.
  8705. @item search_param
  8706. Motion estimation search parameter. Default @code{32}.
  8707. @item vsbmc
  8708. 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).
  8709. @end table
  8710. @end table
  8711. @item scd
  8712. 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:
  8713. @table @samp
  8714. @item none
  8715. Disable scene change detection.
  8716. @item fdiff
  8717. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  8718. @end table
  8719. Default method is @samp{fdiff}.
  8720. @item scd_threshold
  8721. Scene change detection threshold. Default is @code{5.0}.
  8722. @end table
  8723. @section mix
  8724. Mix several video input streams into one video stream.
  8725. A description of the accepted options follows.
  8726. @table @option
  8727. @item nb_inputs
  8728. The number of inputs. If unspecified, it defaults to 2.
  8729. @item weights
  8730. Specify weight of each input video stream as sequence.
  8731. Each weight is separated by space. If number of weights
  8732. is smaller than number of @var{frames} last specified
  8733. weight will be used for all remaining unset weights.
  8734. @item scale
  8735. Specify scale, if it is set it will be multiplied with sum
  8736. of each weight multiplied with pixel values to give final destination
  8737. pixel value. By default @var{scale} is auto scaled to sum of weights.
  8738. @item duration
  8739. Specify how end of stream is determined.
  8740. @table @samp
  8741. @item longest
  8742. The duration of the longest input. (default)
  8743. @item shortest
  8744. The duration of the shortest input.
  8745. @item first
  8746. The duration of the first input.
  8747. @end table
  8748. @end table
  8749. @section mpdecimate
  8750. Drop frames that do not differ greatly from the previous frame in
  8751. order to reduce frame rate.
  8752. The main use of this filter is for very-low-bitrate encoding
  8753. (e.g. streaming over dialup modem), but it could in theory be used for
  8754. fixing movies that were inverse-telecined incorrectly.
  8755. A description of the accepted options follows.
  8756. @table @option
  8757. @item max
  8758. Set the maximum number of consecutive frames which can be dropped (if
  8759. positive), or the minimum interval between dropped frames (if
  8760. negative). If the value is 0, the frame is dropped disregarding the
  8761. number of previous sequentially dropped frames.
  8762. Default value is 0.
  8763. @item hi
  8764. @item lo
  8765. @item frac
  8766. Set the dropping threshold values.
  8767. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  8768. represent actual pixel value differences, so a threshold of 64
  8769. corresponds to 1 unit of difference for each pixel, or the same spread
  8770. out differently over the block.
  8771. A frame is a candidate for dropping if no 8x8 blocks differ by more
  8772. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  8773. meaning the whole image) differ by more than a threshold of @option{lo}.
  8774. Default value for @option{hi} is 64*12, default value for @option{lo} is
  8775. 64*5, and default value for @option{frac} is 0.33.
  8776. @end table
  8777. @section negate
  8778. Negate input video.
  8779. It accepts an integer in input; if non-zero it negates the
  8780. alpha component (if available). The default value in input is 0.
  8781. @section nlmeans
  8782. Denoise frames using Non-Local Means algorithm.
  8783. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8784. context similarity is defined by comparing their surrounding patches of size
  8785. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8786. around the pixel.
  8787. Note that the research area defines centers for patches, which means some
  8788. patches will be made of pixels outside that research area.
  8789. The filter accepts the following options.
  8790. @table @option
  8791. @item s
  8792. Set denoising strength.
  8793. @item p
  8794. Set patch size.
  8795. @item pc
  8796. Same as @option{p} but for chroma planes.
  8797. The default value is @var{0} and means automatic.
  8798. @item r
  8799. Set research size.
  8800. @item rc
  8801. Same as @option{r} but for chroma planes.
  8802. The default value is @var{0} and means automatic.
  8803. @end table
  8804. @section nnedi
  8805. Deinterlace video using neural network edge directed interpolation.
  8806. This filter accepts the following options:
  8807. @table @option
  8808. @item weights
  8809. Mandatory option, without binary file filter can not work.
  8810. Currently file can be found here:
  8811. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8812. @item deint
  8813. Set which frames to deinterlace, by default it is @code{all}.
  8814. Can be @code{all} or @code{interlaced}.
  8815. @item field
  8816. Set mode of operation.
  8817. Can be one of the following:
  8818. @table @samp
  8819. @item af
  8820. Use frame flags, both fields.
  8821. @item a
  8822. Use frame flags, single field.
  8823. @item t
  8824. Use top field only.
  8825. @item b
  8826. Use bottom field only.
  8827. @item tf
  8828. Use both fields, top first.
  8829. @item bf
  8830. Use both fields, bottom first.
  8831. @end table
  8832. @item planes
  8833. Set which planes to process, by default filter process all frames.
  8834. @item nsize
  8835. Set size of local neighborhood around each pixel, used by the predictor neural
  8836. network.
  8837. Can be one of the following:
  8838. @table @samp
  8839. @item s8x6
  8840. @item s16x6
  8841. @item s32x6
  8842. @item s48x6
  8843. @item s8x4
  8844. @item s16x4
  8845. @item s32x4
  8846. @end table
  8847. @item nns
  8848. Set the number of neurons in predictor neural network.
  8849. Can be one of the following:
  8850. @table @samp
  8851. @item n16
  8852. @item n32
  8853. @item n64
  8854. @item n128
  8855. @item n256
  8856. @end table
  8857. @item qual
  8858. Controls the number of different neural network predictions that are blended
  8859. together to compute the final output value. Can be @code{fast}, default or
  8860. @code{slow}.
  8861. @item etype
  8862. Set which set of weights to use in the predictor.
  8863. Can be one of the following:
  8864. @table @samp
  8865. @item a
  8866. weights trained to minimize absolute error
  8867. @item s
  8868. weights trained to minimize squared error
  8869. @end table
  8870. @item pscrn
  8871. Controls whether or not the prescreener neural network is used to decide
  8872. which pixels should be processed by the predictor neural network and which
  8873. can be handled by simple cubic interpolation.
  8874. The prescreener is trained to know whether cubic interpolation will be
  8875. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8876. The computational complexity of the prescreener nn is much less than that of
  8877. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8878. using the prescreener generally results in much faster processing.
  8879. The prescreener is pretty accurate, so the difference between using it and not
  8880. using it is almost always unnoticeable.
  8881. Can be one of the following:
  8882. @table @samp
  8883. @item none
  8884. @item original
  8885. @item new
  8886. @end table
  8887. Default is @code{new}.
  8888. @item fapprox
  8889. Set various debugging flags.
  8890. @end table
  8891. @section noformat
  8892. Force libavfilter not to use any of the specified pixel formats for the
  8893. input to the next filter.
  8894. It accepts the following parameters:
  8895. @table @option
  8896. @item pix_fmts
  8897. A '|'-separated list of pixel format names, such as
  8898. pix_fmts=yuv420p|monow|rgb24".
  8899. @end table
  8900. @subsection Examples
  8901. @itemize
  8902. @item
  8903. Force libavfilter to use a format different from @var{yuv420p} for the
  8904. input to the vflip filter:
  8905. @example
  8906. noformat=pix_fmts=yuv420p,vflip
  8907. @end example
  8908. @item
  8909. Convert the input video to any of the formats not contained in the list:
  8910. @example
  8911. noformat=yuv420p|yuv444p|yuv410p
  8912. @end example
  8913. @end itemize
  8914. @section noise
  8915. Add noise on video input frame.
  8916. The filter accepts the following options:
  8917. @table @option
  8918. @item all_seed
  8919. @item c0_seed
  8920. @item c1_seed
  8921. @item c2_seed
  8922. @item c3_seed
  8923. Set noise seed for specific pixel component or all pixel components in case
  8924. of @var{all_seed}. Default value is @code{123457}.
  8925. @item all_strength, alls
  8926. @item c0_strength, c0s
  8927. @item c1_strength, c1s
  8928. @item c2_strength, c2s
  8929. @item c3_strength, c3s
  8930. Set noise strength for specific pixel component or all pixel components in case
  8931. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8932. @item all_flags, allf
  8933. @item c0_flags, c0f
  8934. @item c1_flags, c1f
  8935. @item c2_flags, c2f
  8936. @item c3_flags, c3f
  8937. Set pixel component flags or set flags for all components if @var{all_flags}.
  8938. Available values for component flags are:
  8939. @table @samp
  8940. @item a
  8941. averaged temporal noise (smoother)
  8942. @item p
  8943. mix random noise with a (semi)regular pattern
  8944. @item t
  8945. temporal noise (noise pattern changes between frames)
  8946. @item u
  8947. uniform noise (gaussian otherwise)
  8948. @end table
  8949. @end table
  8950. @subsection Examples
  8951. Add temporal and uniform noise to input video:
  8952. @example
  8953. noise=alls=20:allf=t+u
  8954. @end example
  8955. @section normalize
  8956. Normalize RGB video (aka histogram stretching, contrast stretching).
  8957. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  8958. For each channel of each frame, the filter computes the input range and maps
  8959. it linearly to the user-specified output range. The output range defaults
  8960. to the full dynamic range from pure black to pure white.
  8961. Temporal smoothing can be used on the input range to reduce flickering (rapid
  8962. changes in brightness) caused when small dark or bright objects enter or leave
  8963. the scene. This is similar to the auto-exposure (automatic gain control) on a
  8964. video camera, and, like a video camera, it may cause a period of over- or
  8965. under-exposure of the video.
  8966. The R,G,B channels can be normalized independently, which may cause some
  8967. color shifting, or linked together as a single channel, which prevents
  8968. color shifting. Linked normalization preserves hue. Independent normalization
  8969. does not, so it can be used to remove some color casts. Independent and linked
  8970. normalization can be combined in any ratio.
  8971. The normalize filter accepts the following options:
  8972. @table @option
  8973. @item blackpt
  8974. @item whitept
  8975. Colors which define the output range. The minimum input value is mapped to
  8976. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  8977. The defaults are black and white respectively. Specifying white for
  8978. @var{blackpt} and black for @var{whitept} will give color-inverted,
  8979. normalized video. Shades of grey can be used to reduce the dynamic range
  8980. (contrast). Specifying saturated colors here can create some interesting
  8981. effects.
  8982. @item smoothing
  8983. The number of previous frames to use for temporal smoothing. The input range
  8984. of each channel is smoothed using a rolling average over the current frame
  8985. and the @var{smoothing} previous frames. The default is 0 (no temporal
  8986. smoothing).
  8987. @item independence
  8988. Controls the ratio of independent (color shifting) channel normalization to
  8989. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  8990. independent. Defaults to 1.0 (fully independent).
  8991. @item strength
  8992. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  8993. expensive no-op. Defaults to 1.0 (full strength).
  8994. @end table
  8995. @subsection Examples
  8996. Stretch video contrast to use the full dynamic range, with no temporal
  8997. smoothing; may flicker depending on the source content:
  8998. @example
  8999. normalize=blackpt=black:whitept=white:smoothing=0
  9000. @end example
  9001. As above, but with 50 frames of temporal smoothing; flicker should be
  9002. reduced, depending on the source content:
  9003. @example
  9004. normalize=blackpt=black:whitept=white:smoothing=50
  9005. @end example
  9006. As above, but with hue-preserving linked channel normalization:
  9007. @example
  9008. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  9009. @end example
  9010. As above, but with half strength:
  9011. @example
  9012. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  9013. @end example
  9014. Map the darkest input color to red, the brightest input color to cyan:
  9015. @example
  9016. normalize=blackpt=red:whitept=cyan
  9017. @end example
  9018. @section null
  9019. Pass the video source unchanged to the output.
  9020. @section ocr
  9021. Optical Character Recognition
  9022. This filter uses Tesseract for optical character recognition. To enable
  9023. compilation of this filter, you need to configure FFmpeg with
  9024. @code{--enable-libtesseract}.
  9025. It accepts the following options:
  9026. @table @option
  9027. @item datapath
  9028. Set datapath to tesseract data. Default is to use whatever was
  9029. set at installation.
  9030. @item language
  9031. Set language, default is "eng".
  9032. @item whitelist
  9033. Set character whitelist.
  9034. @item blacklist
  9035. Set character blacklist.
  9036. @end table
  9037. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  9038. @section ocv
  9039. Apply a video transform using libopencv.
  9040. To enable this filter, install the libopencv library and headers and
  9041. configure FFmpeg with @code{--enable-libopencv}.
  9042. It accepts the following parameters:
  9043. @table @option
  9044. @item filter_name
  9045. The name of the libopencv filter to apply.
  9046. @item filter_params
  9047. The parameters to pass to the libopencv filter. If not specified, the default
  9048. values are assumed.
  9049. @end table
  9050. Refer to the official libopencv documentation for more precise
  9051. information:
  9052. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  9053. Several libopencv filters are supported; see the following subsections.
  9054. @anchor{dilate}
  9055. @subsection dilate
  9056. Dilate an image by using a specific structuring element.
  9057. It corresponds to the libopencv function @code{cvDilate}.
  9058. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  9059. @var{struct_el} represents a structuring element, and has the syntax:
  9060. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  9061. @var{cols} and @var{rows} represent the number of columns and rows of
  9062. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  9063. point, and @var{shape} the shape for the structuring element. @var{shape}
  9064. must be "rect", "cross", "ellipse", or "custom".
  9065. If the value for @var{shape} is "custom", it must be followed by a
  9066. string of the form "=@var{filename}". The file with name
  9067. @var{filename} is assumed to represent a binary image, with each
  9068. printable character corresponding to a bright pixel. When a custom
  9069. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  9070. or columns and rows of the read file are assumed instead.
  9071. The default value for @var{struct_el} is "3x3+0x0/rect".
  9072. @var{nb_iterations} specifies the number of times the transform is
  9073. applied to the image, and defaults to 1.
  9074. Some examples:
  9075. @example
  9076. # Use the default values
  9077. ocv=dilate
  9078. # Dilate using a structuring element with a 5x5 cross, iterating two times
  9079. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  9080. # Read the shape from the file diamond.shape, iterating two times.
  9081. # The file diamond.shape may contain a pattern of characters like this
  9082. # *
  9083. # ***
  9084. # *****
  9085. # ***
  9086. # *
  9087. # The specified columns and rows are ignored
  9088. # but the anchor point coordinates are not
  9089. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  9090. @end example
  9091. @subsection erode
  9092. Erode an image by using a specific structuring element.
  9093. It corresponds to the libopencv function @code{cvErode}.
  9094. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  9095. with the same syntax and semantics as the @ref{dilate} filter.
  9096. @subsection smooth
  9097. Smooth the input video.
  9098. The filter takes the following parameters:
  9099. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  9100. @var{type} is the type of smooth filter to apply, and must be one of
  9101. the following values: "blur", "blur_no_scale", "median", "gaussian",
  9102. or "bilateral". The default value is "gaussian".
  9103. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  9104. depend on the smooth type. @var{param1} and
  9105. @var{param2} accept integer positive values or 0. @var{param3} and
  9106. @var{param4} accept floating point values.
  9107. The default value for @var{param1} is 3. The default value for the
  9108. other parameters is 0.
  9109. These parameters correspond to the parameters assigned to the
  9110. libopencv function @code{cvSmooth}.
  9111. @section oscilloscope
  9112. 2D Video Oscilloscope.
  9113. Useful to measure spatial impulse, step responses, chroma delays, etc.
  9114. It accepts the following parameters:
  9115. @table @option
  9116. @item x
  9117. Set scope center x position.
  9118. @item y
  9119. Set scope center y position.
  9120. @item s
  9121. Set scope size, relative to frame diagonal.
  9122. @item t
  9123. Set scope tilt/rotation.
  9124. @item o
  9125. Set trace opacity.
  9126. @item tx
  9127. Set trace center x position.
  9128. @item ty
  9129. Set trace center y position.
  9130. @item tw
  9131. Set trace width, relative to width of frame.
  9132. @item th
  9133. Set trace height, relative to height of frame.
  9134. @item c
  9135. Set which components to trace. By default it traces first three components.
  9136. @item g
  9137. Draw trace grid. By default is enabled.
  9138. @item st
  9139. Draw some statistics. By default is enabled.
  9140. @item sc
  9141. Draw scope. By default is enabled.
  9142. @end table
  9143. @subsection Examples
  9144. @itemize
  9145. @item
  9146. Inspect full first row of video frame.
  9147. @example
  9148. oscilloscope=x=0.5:y=0:s=1
  9149. @end example
  9150. @item
  9151. Inspect full last row of video frame.
  9152. @example
  9153. oscilloscope=x=0.5:y=1:s=1
  9154. @end example
  9155. @item
  9156. Inspect full 5th line of video frame of height 1080.
  9157. @example
  9158. oscilloscope=x=0.5:y=5/1080:s=1
  9159. @end example
  9160. @item
  9161. Inspect full last column of video frame.
  9162. @example
  9163. oscilloscope=x=1:y=0.5:s=1:t=1
  9164. @end example
  9165. @end itemize
  9166. @anchor{overlay}
  9167. @section overlay
  9168. Overlay one video on top of another.
  9169. It takes two inputs and has one output. The first input is the "main"
  9170. video on which the second input is overlaid.
  9171. It accepts the following parameters:
  9172. A description of the accepted options follows.
  9173. @table @option
  9174. @item x
  9175. @item y
  9176. Set the expression for the x and y coordinates of the overlaid video
  9177. on the main video. Default value is "0" for both expressions. In case
  9178. the expression is invalid, it is set to a huge value (meaning that the
  9179. overlay will not be displayed within the output visible area).
  9180. @item eof_action
  9181. See @ref{framesync}.
  9182. @item eval
  9183. Set when the expressions for @option{x}, and @option{y} are evaluated.
  9184. It accepts the following values:
  9185. @table @samp
  9186. @item init
  9187. only evaluate expressions once during the filter initialization or
  9188. when a command is processed
  9189. @item frame
  9190. evaluate expressions for each incoming frame
  9191. @end table
  9192. Default value is @samp{frame}.
  9193. @item shortest
  9194. See @ref{framesync}.
  9195. @item format
  9196. Set the format for the output video.
  9197. It accepts the following values:
  9198. @table @samp
  9199. @item yuv420
  9200. force YUV420 output
  9201. @item yuv422
  9202. force YUV422 output
  9203. @item yuv444
  9204. force YUV444 output
  9205. @item rgb
  9206. force packed RGB output
  9207. @item gbrp
  9208. force planar RGB output
  9209. @item auto
  9210. automatically pick format
  9211. @end table
  9212. Default value is @samp{yuv420}.
  9213. @item repeatlast
  9214. See @ref{framesync}.
  9215. @item alpha
  9216. Set format of alpha of the overlaid video, it can be @var{straight} or
  9217. @var{premultiplied}. Default is @var{straight}.
  9218. @end table
  9219. The @option{x}, and @option{y} expressions can contain the following
  9220. parameters.
  9221. @table @option
  9222. @item main_w, W
  9223. @item main_h, H
  9224. The main input width and height.
  9225. @item overlay_w, w
  9226. @item overlay_h, h
  9227. The overlay input width and height.
  9228. @item x
  9229. @item y
  9230. The computed values for @var{x} and @var{y}. They are evaluated for
  9231. each new frame.
  9232. @item hsub
  9233. @item vsub
  9234. horizontal and vertical chroma subsample values of the output
  9235. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  9236. @var{vsub} is 1.
  9237. @item n
  9238. the number of input frame, starting from 0
  9239. @item pos
  9240. the position in the file of the input frame, NAN if unknown
  9241. @item t
  9242. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  9243. @end table
  9244. This filter also supports the @ref{framesync} options.
  9245. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  9246. when evaluation is done @emph{per frame}, and will evaluate to NAN
  9247. when @option{eval} is set to @samp{init}.
  9248. Be aware that frames are taken from each input video in timestamp
  9249. order, hence, if their initial timestamps differ, it is a good idea
  9250. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  9251. have them begin in the same zero timestamp, as the example for
  9252. the @var{movie} filter does.
  9253. You can chain together more overlays but you should test the
  9254. efficiency of such approach.
  9255. @subsection Commands
  9256. This filter supports the following commands:
  9257. @table @option
  9258. @item x
  9259. @item y
  9260. Modify the x and y of the overlay input.
  9261. The command accepts the same syntax of the corresponding option.
  9262. If the specified expression is not valid, it is kept at its current
  9263. value.
  9264. @end table
  9265. @subsection Examples
  9266. @itemize
  9267. @item
  9268. Draw the overlay at 10 pixels from the bottom right corner of the main
  9269. video:
  9270. @example
  9271. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  9272. @end example
  9273. Using named options the example above becomes:
  9274. @example
  9275. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  9276. @end example
  9277. @item
  9278. Insert a transparent PNG logo in the bottom left corner of the input,
  9279. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  9280. @example
  9281. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  9282. @end example
  9283. @item
  9284. Insert 2 different transparent PNG logos (second logo on bottom
  9285. right corner) using the @command{ffmpeg} tool:
  9286. @example
  9287. 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
  9288. @end example
  9289. @item
  9290. Add a transparent color layer on top of the main video; @code{WxH}
  9291. must specify the size of the main input to the overlay filter:
  9292. @example
  9293. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  9294. @end example
  9295. @item
  9296. Play an original video and a filtered version (here with the deshake
  9297. filter) side by side using the @command{ffplay} tool:
  9298. @example
  9299. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  9300. @end example
  9301. The above command is the same as:
  9302. @example
  9303. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  9304. @end example
  9305. @item
  9306. Make a sliding overlay appearing from the left to the right top part of the
  9307. screen starting since time 2:
  9308. @example
  9309. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  9310. @end example
  9311. @item
  9312. Compose output by putting two input videos side to side:
  9313. @example
  9314. ffmpeg -i left.avi -i right.avi -filter_complex "
  9315. nullsrc=size=200x100 [background];
  9316. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  9317. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  9318. [background][left] overlay=shortest=1 [background+left];
  9319. [background+left][right] overlay=shortest=1:x=100 [left+right]
  9320. "
  9321. @end example
  9322. @item
  9323. Mask 10-20 seconds of a video by applying the delogo filter to a section
  9324. @example
  9325. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  9326. -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]'
  9327. masked.avi
  9328. @end example
  9329. @item
  9330. Chain several overlays in cascade:
  9331. @example
  9332. nullsrc=s=200x200 [bg];
  9333. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  9334. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  9335. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  9336. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  9337. [in3] null, [mid2] overlay=100:100 [out0]
  9338. @end example
  9339. @end itemize
  9340. @section owdenoise
  9341. Apply Overcomplete Wavelet denoiser.
  9342. The filter accepts the following options:
  9343. @table @option
  9344. @item depth
  9345. Set depth.
  9346. Larger depth values will denoise lower frequency components more, but
  9347. slow down filtering.
  9348. Must be an int in the range 8-16, default is @code{8}.
  9349. @item luma_strength, ls
  9350. Set luma strength.
  9351. Must be a double value in the range 0-1000, default is @code{1.0}.
  9352. @item chroma_strength, cs
  9353. Set chroma strength.
  9354. Must be a double value in the range 0-1000, default is @code{1.0}.
  9355. @end table
  9356. @anchor{pad}
  9357. @section pad
  9358. Add paddings to the input image, and place the original input at the
  9359. provided @var{x}, @var{y} coordinates.
  9360. It accepts the following parameters:
  9361. @table @option
  9362. @item width, w
  9363. @item height, h
  9364. Specify an expression for the size of the output image with the
  9365. paddings added. If the value for @var{width} or @var{height} is 0, the
  9366. corresponding input size is used for the output.
  9367. The @var{width} expression can reference the value set by the
  9368. @var{height} expression, and vice versa.
  9369. The default value of @var{width} and @var{height} is 0.
  9370. @item x
  9371. @item y
  9372. Specify the offsets to place the input image at within the padded area,
  9373. with respect to the top/left border of the output image.
  9374. The @var{x} expression can reference the value set by the @var{y}
  9375. expression, and vice versa.
  9376. The default value of @var{x} and @var{y} is 0.
  9377. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  9378. so the input image is centered on the padded area.
  9379. @item color
  9380. Specify the color of the padded area. For the syntax of this option,
  9381. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  9382. manual,ffmpeg-utils}.
  9383. The default value of @var{color} is "black".
  9384. @item eval
  9385. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  9386. It accepts the following values:
  9387. @table @samp
  9388. @item init
  9389. Only evaluate expressions once during the filter initialization or when
  9390. a command is processed.
  9391. @item frame
  9392. Evaluate expressions for each incoming frame.
  9393. @end table
  9394. Default value is @samp{init}.
  9395. @item aspect
  9396. Pad to aspect instead to a resolution.
  9397. @end table
  9398. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  9399. options are expressions containing the following constants:
  9400. @table @option
  9401. @item in_w
  9402. @item in_h
  9403. The input video width and height.
  9404. @item iw
  9405. @item ih
  9406. These are the same as @var{in_w} and @var{in_h}.
  9407. @item out_w
  9408. @item out_h
  9409. The output width and height (the size of the padded area), as
  9410. specified by the @var{width} and @var{height} expressions.
  9411. @item ow
  9412. @item oh
  9413. These are the same as @var{out_w} and @var{out_h}.
  9414. @item x
  9415. @item y
  9416. The x and y offsets as specified by the @var{x} and @var{y}
  9417. expressions, or NAN if not yet specified.
  9418. @item a
  9419. same as @var{iw} / @var{ih}
  9420. @item sar
  9421. input sample aspect ratio
  9422. @item dar
  9423. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  9424. @item hsub
  9425. @item vsub
  9426. The horizontal and vertical chroma subsample values. For example for the
  9427. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9428. @end table
  9429. @subsection Examples
  9430. @itemize
  9431. @item
  9432. Add paddings with the color "violet" to the input video. The output video
  9433. size is 640x480, and the top-left corner of the input video is placed at
  9434. column 0, row 40
  9435. @example
  9436. pad=640:480:0:40:violet
  9437. @end example
  9438. The example above is equivalent to the following command:
  9439. @example
  9440. pad=width=640:height=480:x=0:y=40:color=violet
  9441. @end example
  9442. @item
  9443. Pad the input to get an output with dimensions increased by 3/2,
  9444. and put the input video at the center of the padded area:
  9445. @example
  9446. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  9447. @end example
  9448. @item
  9449. Pad the input to get a squared output with size equal to the maximum
  9450. value between the input width and height, and put the input video at
  9451. the center of the padded area:
  9452. @example
  9453. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  9454. @end example
  9455. @item
  9456. Pad the input to get a final w/h ratio of 16:9:
  9457. @example
  9458. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  9459. @end example
  9460. @item
  9461. In case of anamorphic video, in order to set the output display aspect
  9462. correctly, it is necessary to use @var{sar} in the expression,
  9463. according to the relation:
  9464. @example
  9465. (ih * X / ih) * sar = output_dar
  9466. X = output_dar / sar
  9467. @end example
  9468. Thus the previous example needs to be modified to:
  9469. @example
  9470. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  9471. @end example
  9472. @item
  9473. Double the output size and put the input video in the bottom-right
  9474. corner of the output padded area:
  9475. @example
  9476. pad="2*iw:2*ih:ow-iw:oh-ih"
  9477. @end example
  9478. @end itemize
  9479. @anchor{palettegen}
  9480. @section palettegen
  9481. Generate one palette for a whole video stream.
  9482. It accepts the following options:
  9483. @table @option
  9484. @item max_colors
  9485. Set the maximum number of colors to quantize in the palette.
  9486. Note: the palette will still contain 256 colors; the unused palette entries
  9487. will be black.
  9488. @item reserve_transparent
  9489. Create a palette of 255 colors maximum and reserve the last one for
  9490. transparency. Reserving the transparency color is useful for GIF optimization.
  9491. If not set, the maximum of colors in the palette will be 256. You probably want
  9492. to disable this option for a standalone image.
  9493. Set by default.
  9494. @item transparency_color
  9495. Set the color that will be used as background for transparency.
  9496. @item stats_mode
  9497. Set statistics mode.
  9498. It accepts the following values:
  9499. @table @samp
  9500. @item full
  9501. Compute full frame histograms.
  9502. @item diff
  9503. Compute histograms only for the part that differs from previous frame. This
  9504. might be relevant to give more importance to the moving part of your input if
  9505. the background is static.
  9506. @item single
  9507. Compute new histogram for each frame.
  9508. @end table
  9509. Default value is @var{full}.
  9510. @end table
  9511. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  9512. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  9513. color quantization of the palette. This information is also visible at
  9514. @var{info} logging level.
  9515. @subsection Examples
  9516. @itemize
  9517. @item
  9518. Generate a representative palette of a given video using @command{ffmpeg}:
  9519. @example
  9520. ffmpeg -i input.mkv -vf palettegen palette.png
  9521. @end example
  9522. @end itemize
  9523. @section paletteuse
  9524. Use a palette to downsample an input video stream.
  9525. The filter takes two inputs: one video stream and a palette. The palette must
  9526. be a 256 pixels image.
  9527. It accepts the following options:
  9528. @table @option
  9529. @item dither
  9530. Select dithering mode. Available algorithms are:
  9531. @table @samp
  9532. @item bayer
  9533. Ordered 8x8 bayer dithering (deterministic)
  9534. @item heckbert
  9535. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  9536. Note: this dithering is sometimes considered "wrong" and is included as a
  9537. reference.
  9538. @item floyd_steinberg
  9539. Floyd and Steingberg dithering (error diffusion)
  9540. @item sierra2
  9541. Frankie Sierra dithering v2 (error diffusion)
  9542. @item sierra2_4a
  9543. Frankie Sierra dithering v2 "Lite" (error diffusion)
  9544. @end table
  9545. Default is @var{sierra2_4a}.
  9546. @item bayer_scale
  9547. When @var{bayer} dithering is selected, this option defines the scale of the
  9548. pattern (how much the crosshatch pattern is visible). A low value means more
  9549. visible pattern for less banding, and higher value means less visible pattern
  9550. at the cost of more banding.
  9551. The option must be an integer value in the range [0,5]. Default is @var{2}.
  9552. @item diff_mode
  9553. If set, define the zone to process
  9554. @table @samp
  9555. @item rectangle
  9556. Only the changing rectangle will be reprocessed. This is similar to GIF
  9557. cropping/offsetting compression mechanism. This option can be useful for speed
  9558. if only a part of the image is changing, and has use cases such as limiting the
  9559. scope of the error diffusal @option{dither} to the rectangle that bounds the
  9560. moving scene (it leads to more deterministic output if the scene doesn't change
  9561. much, and as a result less moving noise and better GIF compression).
  9562. @end table
  9563. Default is @var{none}.
  9564. @item new
  9565. Take new palette for each output frame.
  9566. @item alpha_threshold
  9567. Sets the alpha threshold for transparency. Alpha values above this threshold
  9568. will be treated as completely opaque, and values below this threshold will be
  9569. treated as completely transparent.
  9570. The option must be an integer value in the range [0,255]. Default is @var{128}.
  9571. @end table
  9572. @subsection Examples
  9573. @itemize
  9574. @item
  9575. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  9576. using @command{ffmpeg}:
  9577. @example
  9578. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  9579. @end example
  9580. @end itemize
  9581. @section perspective
  9582. Correct perspective of video not recorded perpendicular to the screen.
  9583. A description of the accepted parameters follows.
  9584. @table @option
  9585. @item x0
  9586. @item y0
  9587. @item x1
  9588. @item y1
  9589. @item x2
  9590. @item y2
  9591. @item x3
  9592. @item y3
  9593. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  9594. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  9595. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  9596. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  9597. then the corners of the source will be sent to the specified coordinates.
  9598. The expressions can use the following variables:
  9599. @table @option
  9600. @item W
  9601. @item H
  9602. the width and height of video frame.
  9603. @item in
  9604. Input frame count.
  9605. @item on
  9606. Output frame count.
  9607. @end table
  9608. @item interpolation
  9609. Set interpolation for perspective correction.
  9610. It accepts the following values:
  9611. @table @samp
  9612. @item linear
  9613. @item cubic
  9614. @end table
  9615. Default value is @samp{linear}.
  9616. @item sense
  9617. Set interpretation of coordinate options.
  9618. It accepts the following values:
  9619. @table @samp
  9620. @item 0, source
  9621. Send point in the source specified by the given coordinates to
  9622. the corners of the destination.
  9623. @item 1, destination
  9624. Send the corners of the source to the point in the destination specified
  9625. by the given coordinates.
  9626. Default value is @samp{source}.
  9627. @end table
  9628. @item eval
  9629. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  9630. It accepts the following values:
  9631. @table @samp
  9632. @item init
  9633. only evaluate expressions once during the filter initialization or
  9634. when a command is processed
  9635. @item frame
  9636. evaluate expressions for each incoming frame
  9637. @end table
  9638. Default value is @samp{init}.
  9639. @end table
  9640. @section phase
  9641. Delay interlaced video by one field time so that the field order changes.
  9642. The intended use is to fix PAL movies that have been captured with the
  9643. opposite field order to the film-to-video transfer.
  9644. A description of the accepted parameters follows.
  9645. @table @option
  9646. @item mode
  9647. Set phase mode.
  9648. It accepts the following values:
  9649. @table @samp
  9650. @item t
  9651. Capture field order top-first, transfer bottom-first.
  9652. Filter will delay the bottom field.
  9653. @item b
  9654. Capture field order bottom-first, transfer top-first.
  9655. Filter will delay the top field.
  9656. @item p
  9657. Capture and transfer with the same field order. This mode only exists
  9658. for the documentation of the other options to refer to, but if you
  9659. actually select it, the filter will faithfully do nothing.
  9660. @item a
  9661. Capture field order determined automatically by field flags, transfer
  9662. opposite.
  9663. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  9664. basis using field flags. If no field information is available,
  9665. then this works just like @samp{u}.
  9666. @item u
  9667. Capture unknown or varying, transfer opposite.
  9668. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  9669. analyzing the images and selecting the alternative that produces best
  9670. match between the fields.
  9671. @item T
  9672. Capture top-first, transfer unknown or varying.
  9673. Filter selects among @samp{t} and @samp{p} using image analysis.
  9674. @item B
  9675. Capture bottom-first, transfer unknown or varying.
  9676. Filter selects among @samp{b} and @samp{p} using image analysis.
  9677. @item A
  9678. Capture determined by field flags, transfer unknown or varying.
  9679. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  9680. image analysis. If no field information is available, then this works just
  9681. like @samp{U}. This is the default mode.
  9682. @item U
  9683. Both capture and transfer unknown or varying.
  9684. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  9685. @end table
  9686. @end table
  9687. @section pixdesctest
  9688. Pixel format descriptor test filter, mainly useful for internal
  9689. testing. The output video should be equal to the input video.
  9690. For example:
  9691. @example
  9692. format=monow, pixdesctest
  9693. @end example
  9694. can be used to test the monowhite pixel format descriptor definition.
  9695. @section pixscope
  9696. Display sample values of color channels. Mainly useful for checking color
  9697. and levels. Minimum supported resolution is 640x480.
  9698. The filters accept the following options:
  9699. @table @option
  9700. @item x
  9701. Set scope X position, relative offset on X axis.
  9702. @item y
  9703. Set scope Y position, relative offset on Y axis.
  9704. @item w
  9705. Set scope width.
  9706. @item h
  9707. Set scope height.
  9708. @item o
  9709. Set window opacity. This window also holds statistics about pixel area.
  9710. @item wx
  9711. Set window X position, relative offset on X axis.
  9712. @item wy
  9713. Set window Y position, relative offset on Y axis.
  9714. @end table
  9715. @section pp
  9716. Enable the specified chain of postprocessing subfilters using libpostproc. This
  9717. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  9718. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  9719. Each subfilter and some options have a short and a long name that can be used
  9720. interchangeably, i.e. dr/dering are the same.
  9721. The filters accept the following options:
  9722. @table @option
  9723. @item subfilters
  9724. Set postprocessing subfilters string.
  9725. @end table
  9726. All subfilters share common options to determine their scope:
  9727. @table @option
  9728. @item a/autoq
  9729. Honor the quality commands for this subfilter.
  9730. @item c/chrom
  9731. Do chrominance filtering, too (default).
  9732. @item y/nochrom
  9733. Do luminance filtering only (no chrominance).
  9734. @item n/noluma
  9735. Do chrominance filtering only (no luminance).
  9736. @end table
  9737. These options can be appended after the subfilter name, separated by a '|'.
  9738. Available subfilters are:
  9739. @table @option
  9740. @item hb/hdeblock[|difference[|flatness]]
  9741. Horizontal deblocking filter
  9742. @table @option
  9743. @item difference
  9744. Difference factor where higher values mean more deblocking (default: @code{32}).
  9745. @item flatness
  9746. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9747. @end table
  9748. @item vb/vdeblock[|difference[|flatness]]
  9749. Vertical deblocking filter
  9750. @table @option
  9751. @item difference
  9752. Difference factor where higher values mean more deblocking (default: @code{32}).
  9753. @item flatness
  9754. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9755. @end table
  9756. @item ha/hadeblock[|difference[|flatness]]
  9757. Accurate horizontal deblocking filter
  9758. @table @option
  9759. @item difference
  9760. Difference factor where higher values mean more deblocking (default: @code{32}).
  9761. @item flatness
  9762. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9763. @end table
  9764. @item va/vadeblock[|difference[|flatness]]
  9765. Accurate vertical deblocking filter
  9766. @table @option
  9767. @item difference
  9768. Difference factor where higher values mean more deblocking (default: @code{32}).
  9769. @item flatness
  9770. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9771. @end table
  9772. @end table
  9773. The horizontal and vertical deblocking filters share the difference and
  9774. flatness values so you cannot set different horizontal and vertical
  9775. thresholds.
  9776. @table @option
  9777. @item h1/x1hdeblock
  9778. Experimental horizontal deblocking filter
  9779. @item v1/x1vdeblock
  9780. Experimental vertical deblocking filter
  9781. @item dr/dering
  9782. Deringing filter
  9783. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  9784. @table @option
  9785. @item threshold1
  9786. larger -> stronger filtering
  9787. @item threshold2
  9788. larger -> stronger filtering
  9789. @item threshold3
  9790. larger -> stronger filtering
  9791. @end table
  9792. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  9793. @table @option
  9794. @item f/fullyrange
  9795. Stretch luminance to @code{0-255}.
  9796. @end table
  9797. @item lb/linblenddeint
  9798. Linear blend deinterlacing filter that deinterlaces the given block by
  9799. filtering all lines with a @code{(1 2 1)} filter.
  9800. @item li/linipoldeint
  9801. Linear interpolating deinterlacing filter that deinterlaces the given block by
  9802. linearly interpolating every second line.
  9803. @item ci/cubicipoldeint
  9804. Cubic interpolating deinterlacing filter deinterlaces the given block by
  9805. cubically interpolating every second line.
  9806. @item md/mediandeint
  9807. Median deinterlacing filter that deinterlaces the given block by applying a
  9808. median filter to every second line.
  9809. @item fd/ffmpegdeint
  9810. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  9811. second line with a @code{(-1 4 2 4 -1)} filter.
  9812. @item l5/lowpass5
  9813. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  9814. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  9815. @item fq/forceQuant[|quantizer]
  9816. Overrides the quantizer table from the input with the constant quantizer you
  9817. specify.
  9818. @table @option
  9819. @item quantizer
  9820. Quantizer to use
  9821. @end table
  9822. @item de/default
  9823. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  9824. @item fa/fast
  9825. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  9826. @item ac
  9827. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  9828. @end table
  9829. @subsection Examples
  9830. @itemize
  9831. @item
  9832. Apply horizontal and vertical deblocking, deringing and automatic
  9833. brightness/contrast:
  9834. @example
  9835. pp=hb/vb/dr/al
  9836. @end example
  9837. @item
  9838. Apply default filters without brightness/contrast correction:
  9839. @example
  9840. pp=de/-al
  9841. @end example
  9842. @item
  9843. Apply default filters and temporal denoiser:
  9844. @example
  9845. pp=default/tmpnoise|1|2|3
  9846. @end example
  9847. @item
  9848. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9849. automatically depending on available CPU time:
  9850. @example
  9851. pp=hb|y/vb|a
  9852. @end example
  9853. @end itemize
  9854. @section pp7
  9855. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9856. similar to spp = 6 with 7 point DCT, where only the center sample is
  9857. used after IDCT.
  9858. The filter accepts the following options:
  9859. @table @option
  9860. @item qp
  9861. Force a constant quantization parameter. It accepts an integer in range
  9862. 0 to 63. If not set, the filter will use the QP from the video stream
  9863. (if available).
  9864. @item mode
  9865. Set thresholding mode. Available modes are:
  9866. @table @samp
  9867. @item hard
  9868. Set hard thresholding.
  9869. @item soft
  9870. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9871. @item medium
  9872. Set medium thresholding (good results, default).
  9873. @end table
  9874. @end table
  9875. @section premultiply
  9876. Apply alpha premultiply effect to input video stream using first plane
  9877. of second stream as alpha.
  9878. Both streams must have same dimensions and same pixel format.
  9879. The filter accepts the following option:
  9880. @table @option
  9881. @item planes
  9882. Set which planes will be processed, unprocessed planes will be copied.
  9883. By default value 0xf, all planes will be processed.
  9884. @item inplace
  9885. Do not require 2nd input for processing, instead use alpha plane from input stream.
  9886. @end table
  9887. @section prewitt
  9888. Apply prewitt operator to input video stream.
  9889. The filter accepts the following option:
  9890. @table @option
  9891. @item planes
  9892. Set which planes will be processed, unprocessed planes will be copied.
  9893. By default value 0xf, all planes will be processed.
  9894. @item scale
  9895. Set value which will be multiplied with filtered result.
  9896. @item delta
  9897. Set value which will be added to filtered result.
  9898. @end table
  9899. @anchor{program_opencl}
  9900. @section program_opencl
  9901. Filter video using an OpenCL program.
  9902. @table @option
  9903. @item source
  9904. OpenCL program source file.
  9905. @item kernel
  9906. Kernel name in program.
  9907. @item inputs
  9908. Number of inputs to the filter. Defaults to 1.
  9909. @item size, s
  9910. Size of output frames. Defaults to the same as the first input.
  9911. @end table
  9912. The program source file must contain a kernel function with the given name,
  9913. which will be run once for each plane of the output. Each run on a plane
  9914. gets enqueued as a separate 2D global NDRange with one work-item for each
  9915. pixel to be generated. The global ID offset for each work-item is therefore
  9916. the coordinates of a pixel in the destination image.
  9917. The kernel function needs to take the following arguments:
  9918. @itemize
  9919. @item
  9920. Destination image, @var{__write_only image2d_t}.
  9921. This image will become the output; the kernel should write all of it.
  9922. @item
  9923. Frame index, @var{unsigned int}.
  9924. This is a counter starting from zero and increasing by one for each frame.
  9925. @item
  9926. Source images, @var{__read_only image2d_t}.
  9927. These are the most recent images on each input. The kernel may read from
  9928. them to generate the output, but they can't be written to.
  9929. @end itemize
  9930. Example programs:
  9931. @itemize
  9932. @item
  9933. Copy the input to the output (output must be the same size as the input).
  9934. @verbatim
  9935. __kernel void copy(__write_only image2d_t destination,
  9936. unsigned int index,
  9937. __read_only image2d_t source)
  9938. {
  9939. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  9940. int2 location = (int2)(get_global_id(0), get_global_id(1));
  9941. float4 value = read_imagef(source, sampler, location);
  9942. write_imagef(destination, location, value);
  9943. }
  9944. @end verbatim
  9945. @item
  9946. Apply a simple transformation, rotating the input by an amount increasing
  9947. with the index counter. Pixel values are linearly interpolated by the
  9948. sampler, and the output need not have the same dimensions as the input.
  9949. @verbatim
  9950. __kernel void rotate_image(__write_only image2d_t dst,
  9951. unsigned int index,
  9952. __read_only image2d_t src)
  9953. {
  9954. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  9955. CLK_FILTER_LINEAR);
  9956. float angle = (float)index / 100.0f;
  9957. float2 dst_dim = convert_float2(get_image_dim(dst));
  9958. float2 src_dim = convert_float2(get_image_dim(src));
  9959. float2 dst_cen = dst_dim / 2.0f;
  9960. float2 src_cen = src_dim / 2.0f;
  9961. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  9962. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  9963. float2 src_pos = {
  9964. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  9965. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  9966. };
  9967. src_pos = src_pos * src_dim / dst_dim;
  9968. float2 src_loc = src_pos + src_cen;
  9969. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  9970. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  9971. write_imagef(dst, dst_loc, 0.5f);
  9972. else
  9973. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  9974. }
  9975. @end verbatim
  9976. @item
  9977. Blend two inputs together, with the amount of each input used varying
  9978. with the index counter.
  9979. @verbatim
  9980. __kernel void blend_images(__write_only image2d_t dst,
  9981. unsigned int index,
  9982. __read_only image2d_t src1,
  9983. __read_only image2d_t src2)
  9984. {
  9985. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  9986. CLK_FILTER_LINEAR);
  9987. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  9988. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  9989. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  9990. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  9991. float4 val1 = read_imagef(src1, sampler, src1_loc);
  9992. float4 val2 = read_imagef(src2, sampler, src2_loc);
  9993. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  9994. }
  9995. @end verbatim
  9996. @end itemize
  9997. @section pseudocolor
  9998. Alter frame colors in video with pseudocolors.
  9999. This filter accept the following options:
  10000. @table @option
  10001. @item c0
  10002. set pixel first component expression
  10003. @item c1
  10004. set pixel second component expression
  10005. @item c2
  10006. set pixel third component expression
  10007. @item c3
  10008. set pixel fourth component expression, corresponds to the alpha component
  10009. @item i
  10010. set component to use as base for altering colors
  10011. @end table
  10012. Each of them specifies the expression to use for computing the lookup table for
  10013. the corresponding pixel component values.
  10014. The expressions can contain the following constants and functions:
  10015. @table @option
  10016. @item w
  10017. @item h
  10018. The input width and height.
  10019. @item val
  10020. The input value for the pixel component.
  10021. @item ymin, umin, vmin, amin
  10022. The minimum allowed component value.
  10023. @item ymax, umax, vmax, amax
  10024. The maximum allowed component value.
  10025. @end table
  10026. All expressions default to "val".
  10027. @subsection Examples
  10028. @itemize
  10029. @item
  10030. Change too high luma values to gradient:
  10031. @example
  10032. 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'"
  10033. @end example
  10034. @end itemize
  10035. @section psnr
  10036. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  10037. Ratio) between two input videos.
  10038. This filter takes in input two input videos, the first input is
  10039. considered the "main" source and is passed unchanged to the
  10040. output. The second input is used as a "reference" video for computing
  10041. the PSNR.
  10042. Both video inputs must have the same resolution and pixel format for
  10043. this filter to work correctly. Also it assumes that both inputs
  10044. have the same number of frames, which are compared one by one.
  10045. The obtained average PSNR is printed through the logging system.
  10046. The filter stores the accumulated MSE (mean squared error) of each
  10047. frame, and at the end of the processing it is averaged across all frames
  10048. equally, and the following formula is applied to obtain the PSNR:
  10049. @example
  10050. PSNR = 10*log10(MAX^2/MSE)
  10051. @end example
  10052. Where MAX is the average of the maximum values of each component of the
  10053. image.
  10054. The description of the accepted parameters follows.
  10055. @table @option
  10056. @item stats_file, f
  10057. If specified the filter will use the named file to save the PSNR of
  10058. each individual frame. When filename equals "-" the data is sent to
  10059. standard output.
  10060. @item stats_version
  10061. Specifies which version of the stats file format to use. Details of
  10062. each format are written below.
  10063. Default value is 1.
  10064. @item stats_add_max
  10065. Determines whether the max value is output to the stats log.
  10066. Default value is 0.
  10067. Requires stats_version >= 2. If this is set and stats_version < 2,
  10068. the filter will return an error.
  10069. @end table
  10070. This filter also supports the @ref{framesync} options.
  10071. The file printed if @var{stats_file} is selected, contains a sequence of
  10072. key/value pairs of the form @var{key}:@var{value} for each compared
  10073. couple of frames.
  10074. If a @var{stats_version} greater than 1 is specified, a header line precedes
  10075. the list of per-frame-pair stats, with key value pairs following the frame
  10076. format with the following parameters:
  10077. @table @option
  10078. @item psnr_log_version
  10079. The version of the log file format. Will match @var{stats_version}.
  10080. @item fields
  10081. A comma separated list of the per-frame-pair parameters included in
  10082. the log.
  10083. @end table
  10084. A description of each shown per-frame-pair parameter follows:
  10085. @table @option
  10086. @item n
  10087. sequential number of the input frame, starting from 1
  10088. @item mse_avg
  10089. Mean Square Error pixel-by-pixel average difference of the compared
  10090. frames, averaged over all the image components.
  10091. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  10092. Mean Square Error pixel-by-pixel average difference of the compared
  10093. frames for the component specified by the suffix.
  10094. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  10095. Peak Signal to Noise ratio of the compared frames for the component
  10096. specified by the suffix.
  10097. @item max_avg, max_y, max_u, max_v
  10098. Maximum allowed value for each channel, and average over all
  10099. channels.
  10100. @end table
  10101. For example:
  10102. @example
  10103. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10104. [main][ref] psnr="stats_file=stats.log" [out]
  10105. @end example
  10106. On this example the input file being processed is compared with the
  10107. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  10108. is stored in @file{stats.log}.
  10109. @anchor{pullup}
  10110. @section pullup
  10111. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  10112. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  10113. content.
  10114. The pullup filter is designed to take advantage of future context in making
  10115. its decisions. This filter is stateless in the sense that it does not lock
  10116. onto a pattern to follow, but it instead looks forward to the following
  10117. fields in order to identify matches and rebuild progressive frames.
  10118. To produce content with an even framerate, insert the fps filter after
  10119. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  10120. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  10121. The filter accepts the following options:
  10122. @table @option
  10123. @item jl
  10124. @item jr
  10125. @item jt
  10126. @item jb
  10127. These options set the amount of "junk" to ignore at the left, right, top, and
  10128. bottom of the image, respectively. Left and right are in units of 8 pixels,
  10129. while top and bottom are in units of 2 lines.
  10130. The default is 8 pixels on each side.
  10131. @item sb
  10132. Set the strict breaks. Setting this option to 1 will reduce the chances of
  10133. filter generating an occasional mismatched frame, but it may also cause an
  10134. excessive number of frames to be dropped during high motion sequences.
  10135. Conversely, setting it to -1 will make filter match fields more easily.
  10136. This may help processing of video where there is slight blurring between
  10137. the fields, but may also cause there to be interlaced frames in the output.
  10138. Default value is @code{0}.
  10139. @item mp
  10140. Set the metric plane to use. It accepts the following values:
  10141. @table @samp
  10142. @item l
  10143. Use luma plane.
  10144. @item u
  10145. Use chroma blue plane.
  10146. @item v
  10147. Use chroma red plane.
  10148. @end table
  10149. This option may be set to use chroma plane instead of the default luma plane
  10150. for doing filter's computations. This may improve accuracy on very clean
  10151. source material, but more likely will decrease accuracy, especially if there
  10152. is chroma noise (rainbow effect) or any grayscale video.
  10153. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  10154. load and make pullup usable in realtime on slow machines.
  10155. @end table
  10156. For best results (without duplicated frames in the output file) it is
  10157. necessary to change the output frame rate. For example, to inverse
  10158. telecine NTSC input:
  10159. @example
  10160. ffmpeg -i input -vf pullup -r 24000/1001 ...
  10161. @end example
  10162. @section qp
  10163. Change video quantization parameters (QP).
  10164. The filter accepts the following option:
  10165. @table @option
  10166. @item qp
  10167. Set expression for quantization parameter.
  10168. @end table
  10169. The expression is evaluated through the eval API and can contain, among others,
  10170. the following constants:
  10171. @table @var
  10172. @item known
  10173. 1 if index is not 129, 0 otherwise.
  10174. @item qp
  10175. Sequential index starting from -129 to 128.
  10176. @end table
  10177. @subsection Examples
  10178. @itemize
  10179. @item
  10180. Some equation like:
  10181. @example
  10182. qp=2+2*sin(PI*qp)
  10183. @end example
  10184. @end itemize
  10185. @section random
  10186. Flush video frames from internal cache of frames into a random order.
  10187. No frame is discarded.
  10188. Inspired by @ref{frei0r} nervous filter.
  10189. @table @option
  10190. @item frames
  10191. Set size in number of frames of internal cache, in range from @code{2} to
  10192. @code{512}. Default is @code{30}.
  10193. @item seed
  10194. Set seed for random number generator, must be an integer included between
  10195. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10196. less than @code{0}, the filter will try to use a good random seed on a
  10197. best effort basis.
  10198. @end table
  10199. @section readeia608
  10200. Read closed captioning (EIA-608) information from the top lines of a video frame.
  10201. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  10202. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  10203. with EIA-608 data (starting from 0). A description of each metadata value follows:
  10204. @table @option
  10205. @item lavfi.readeia608.X.cc
  10206. The two bytes stored as EIA-608 data (printed in hexadecimal).
  10207. @item lavfi.readeia608.X.line
  10208. The number of the line on which the EIA-608 data was identified and read.
  10209. @end table
  10210. This filter accepts the following options:
  10211. @table @option
  10212. @item scan_min
  10213. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  10214. @item scan_max
  10215. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  10216. @item mac
  10217. Set minimal acceptable amplitude change for sync codes detection.
  10218. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  10219. @item spw
  10220. Set the ratio of width reserved for sync code detection.
  10221. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  10222. @item mhd
  10223. Set the max peaks height difference for sync code detection.
  10224. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10225. @item mpd
  10226. Set max peaks period difference for sync code detection.
  10227. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10228. @item msd
  10229. Set the first two max start code bits differences.
  10230. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  10231. @item bhd
  10232. Set the minimum ratio of bits height compared to 3rd start code bit.
  10233. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  10234. @item th_w
  10235. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  10236. @item th_b
  10237. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  10238. @item chp
  10239. Enable checking the parity bit. In the event of a parity error, the filter will output
  10240. @code{0x00} for that character. Default is false.
  10241. @end table
  10242. @subsection Examples
  10243. @itemize
  10244. @item
  10245. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  10246. @example
  10247. 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
  10248. @end example
  10249. @end itemize
  10250. @section readvitc
  10251. Read vertical interval timecode (VITC) information from the top lines of a
  10252. video frame.
  10253. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  10254. timecode value, if a valid timecode has been detected. Further metadata key
  10255. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  10256. timecode data has been found or not.
  10257. This filter accepts the following options:
  10258. @table @option
  10259. @item scan_max
  10260. Set the maximum number of lines to scan for VITC data. If the value is set to
  10261. @code{-1} the full video frame is scanned. Default is @code{45}.
  10262. @item thr_b
  10263. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  10264. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  10265. @item thr_w
  10266. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  10267. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  10268. @end table
  10269. @subsection Examples
  10270. @itemize
  10271. @item
  10272. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  10273. draw @code{--:--:--:--} as a placeholder:
  10274. @example
  10275. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  10276. @end example
  10277. @end itemize
  10278. @section remap
  10279. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  10280. Destination pixel at position (X, Y) will be picked from source (x, y) position
  10281. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  10282. value for pixel will be used for destination pixel.
  10283. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  10284. will have Xmap/Ymap video stream dimensions.
  10285. Xmap and Ymap input video streams are 16bit depth, single channel.
  10286. @section removegrain
  10287. The removegrain filter is a spatial denoiser for progressive video.
  10288. @table @option
  10289. @item m0
  10290. Set mode for the first plane.
  10291. @item m1
  10292. Set mode for the second plane.
  10293. @item m2
  10294. Set mode for the third plane.
  10295. @item m3
  10296. Set mode for the fourth plane.
  10297. @end table
  10298. Range of mode is from 0 to 24. Description of each mode follows:
  10299. @table @var
  10300. @item 0
  10301. Leave input plane unchanged. Default.
  10302. @item 1
  10303. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  10304. @item 2
  10305. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  10306. @item 3
  10307. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  10308. @item 4
  10309. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  10310. This is equivalent to a median filter.
  10311. @item 5
  10312. Line-sensitive clipping giving the minimal change.
  10313. @item 6
  10314. Line-sensitive clipping, intermediate.
  10315. @item 7
  10316. Line-sensitive clipping, intermediate.
  10317. @item 8
  10318. Line-sensitive clipping, intermediate.
  10319. @item 9
  10320. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  10321. @item 10
  10322. Replaces the target pixel with the closest neighbour.
  10323. @item 11
  10324. [1 2 1] horizontal and vertical kernel blur.
  10325. @item 12
  10326. Same as mode 11.
  10327. @item 13
  10328. Bob mode, interpolates top field from the line where the neighbours
  10329. pixels are the closest.
  10330. @item 14
  10331. Bob mode, interpolates bottom field from the line where the neighbours
  10332. pixels are the closest.
  10333. @item 15
  10334. Bob mode, interpolates top field. Same as 13 but with a more complicated
  10335. interpolation formula.
  10336. @item 16
  10337. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  10338. interpolation formula.
  10339. @item 17
  10340. Clips the pixel with the minimum and maximum of respectively the maximum and
  10341. minimum of each pair of opposite neighbour pixels.
  10342. @item 18
  10343. Line-sensitive clipping using opposite neighbours whose greatest distance from
  10344. the current pixel is minimal.
  10345. @item 19
  10346. Replaces the pixel with the average of its 8 neighbours.
  10347. @item 20
  10348. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  10349. @item 21
  10350. Clips pixels using the averages of opposite neighbour.
  10351. @item 22
  10352. Same as mode 21 but simpler and faster.
  10353. @item 23
  10354. Small edge and halo removal, but reputed useless.
  10355. @item 24
  10356. Similar as 23.
  10357. @end table
  10358. @section removelogo
  10359. Suppress a TV station logo, using an image file to determine which
  10360. pixels comprise the logo. It works by filling in the pixels that
  10361. comprise the logo with neighboring pixels.
  10362. The filter accepts the following options:
  10363. @table @option
  10364. @item filename, f
  10365. Set the filter bitmap file, which can be any image format supported by
  10366. libavformat. The width and height of the image file must match those of the
  10367. video stream being processed.
  10368. @end table
  10369. Pixels in the provided bitmap image with a value of zero are not
  10370. considered part of the logo, non-zero pixels are considered part of
  10371. the logo. If you use white (255) for the logo and black (0) for the
  10372. rest, you will be safe. For making the filter bitmap, it is
  10373. recommended to take a screen capture of a black frame with the logo
  10374. visible, and then using a threshold filter followed by the erode
  10375. filter once or twice.
  10376. If needed, little splotches can be fixed manually. Remember that if
  10377. logo pixels are not covered, the filter quality will be much
  10378. reduced. Marking too many pixels as part of the logo does not hurt as
  10379. much, but it will increase the amount of blurring needed to cover over
  10380. the image and will destroy more information than necessary, and extra
  10381. pixels will slow things down on a large logo.
  10382. @section repeatfields
  10383. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  10384. fields based on its value.
  10385. @section reverse
  10386. Reverse a video clip.
  10387. Warning: This filter requires memory to buffer the entire clip, so trimming
  10388. is suggested.
  10389. @subsection Examples
  10390. @itemize
  10391. @item
  10392. Take the first 5 seconds of a clip, and reverse it.
  10393. @example
  10394. trim=end=5,reverse
  10395. @end example
  10396. @end itemize
  10397. @section roberts
  10398. Apply roberts cross operator to input video stream.
  10399. The filter accepts the following option:
  10400. @table @option
  10401. @item planes
  10402. Set which planes will be processed, unprocessed planes will be copied.
  10403. By default value 0xf, all planes will be processed.
  10404. @item scale
  10405. Set value which will be multiplied with filtered result.
  10406. @item delta
  10407. Set value which will be added to filtered result.
  10408. @end table
  10409. @section rotate
  10410. Rotate video by an arbitrary angle expressed in radians.
  10411. The filter accepts the following options:
  10412. A description of the optional parameters follows.
  10413. @table @option
  10414. @item angle, a
  10415. Set an expression for the angle by which to rotate the input video
  10416. clockwise, expressed as a number of radians. A negative value will
  10417. result in a counter-clockwise rotation. By default it is set to "0".
  10418. This expression is evaluated for each frame.
  10419. @item out_w, ow
  10420. Set the output width expression, default value is "iw".
  10421. This expression is evaluated just once during configuration.
  10422. @item out_h, oh
  10423. Set the output height expression, default value is "ih".
  10424. This expression is evaluated just once during configuration.
  10425. @item bilinear
  10426. Enable bilinear interpolation if set to 1, a value of 0 disables
  10427. it. Default value is 1.
  10428. @item fillcolor, c
  10429. Set the color used to fill the output area not covered by the rotated
  10430. image. For the general syntax of this option, check the
  10431. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10432. If the special value "none" is selected then no
  10433. background is printed (useful for example if the background is never shown).
  10434. Default value is "black".
  10435. @end table
  10436. The expressions for the angle and the output size can contain the
  10437. following constants and functions:
  10438. @table @option
  10439. @item n
  10440. sequential number of the input frame, starting from 0. It is always NAN
  10441. before the first frame is filtered.
  10442. @item t
  10443. time in seconds of the input frame, it is set to 0 when the filter is
  10444. configured. It is always NAN before the first frame is filtered.
  10445. @item hsub
  10446. @item vsub
  10447. horizontal and vertical chroma subsample values. For example for the
  10448. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10449. @item in_w, iw
  10450. @item in_h, ih
  10451. the input video width and height
  10452. @item out_w, ow
  10453. @item out_h, oh
  10454. the output width and height, that is the size of the padded area as
  10455. specified by the @var{width} and @var{height} expressions
  10456. @item rotw(a)
  10457. @item roth(a)
  10458. the minimal width/height required for completely containing the input
  10459. video rotated by @var{a} radians.
  10460. These are only available when computing the @option{out_w} and
  10461. @option{out_h} expressions.
  10462. @end table
  10463. @subsection Examples
  10464. @itemize
  10465. @item
  10466. Rotate the input by PI/6 radians clockwise:
  10467. @example
  10468. rotate=PI/6
  10469. @end example
  10470. @item
  10471. Rotate the input by PI/6 radians counter-clockwise:
  10472. @example
  10473. rotate=-PI/6
  10474. @end example
  10475. @item
  10476. Rotate the input by 45 degrees clockwise:
  10477. @example
  10478. rotate=45*PI/180
  10479. @end example
  10480. @item
  10481. Apply a constant rotation with period T, starting from an angle of PI/3:
  10482. @example
  10483. rotate=PI/3+2*PI*t/T
  10484. @end example
  10485. @item
  10486. Make the input video rotation oscillating with a period of T
  10487. seconds and an amplitude of A radians:
  10488. @example
  10489. rotate=A*sin(2*PI/T*t)
  10490. @end example
  10491. @item
  10492. Rotate the video, output size is chosen so that the whole rotating
  10493. input video is always completely contained in the output:
  10494. @example
  10495. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  10496. @end example
  10497. @item
  10498. Rotate the video, reduce the output size so that no background is ever
  10499. shown:
  10500. @example
  10501. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  10502. @end example
  10503. @end itemize
  10504. @subsection Commands
  10505. The filter supports the following commands:
  10506. @table @option
  10507. @item a, angle
  10508. Set the angle expression.
  10509. The command accepts the same syntax of the corresponding option.
  10510. If the specified expression is not valid, it is kept at its current
  10511. value.
  10512. @end table
  10513. @section sab
  10514. Apply Shape Adaptive Blur.
  10515. The filter accepts the following options:
  10516. @table @option
  10517. @item luma_radius, lr
  10518. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  10519. value is 1.0. A greater value will result in a more blurred image, and
  10520. in slower processing.
  10521. @item luma_pre_filter_radius, lpfr
  10522. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  10523. value is 1.0.
  10524. @item luma_strength, ls
  10525. Set luma maximum difference between pixels to still be considered, must
  10526. be a value in the 0.1-100.0 range, default value is 1.0.
  10527. @item chroma_radius, cr
  10528. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  10529. greater value will result in a more blurred image, and in slower
  10530. processing.
  10531. @item chroma_pre_filter_radius, cpfr
  10532. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  10533. @item chroma_strength, cs
  10534. Set chroma maximum difference between pixels to still be considered,
  10535. must be a value in the -0.9-100.0 range.
  10536. @end table
  10537. Each chroma option value, if not explicitly specified, is set to the
  10538. corresponding luma option value.
  10539. @anchor{scale}
  10540. @section scale
  10541. Scale (resize) the input video, using the libswscale library.
  10542. The scale filter forces the output display aspect ratio to be the same
  10543. of the input, by changing the output sample aspect ratio.
  10544. If the input image format is different from the format requested by
  10545. the next filter, the scale filter will convert the input to the
  10546. requested format.
  10547. @subsection Options
  10548. The filter accepts the following options, or any of the options
  10549. supported by the libswscale scaler.
  10550. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  10551. the complete list of scaler options.
  10552. @table @option
  10553. @item width, w
  10554. @item height, h
  10555. Set the output video dimension expression. Default value is the input
  10556. dimension.
  10557. If the @var{width} or @var{w} value is 0, the input width is used for
  10558. the output. If the @var{height} or @var{h} value is 0, the input height
  10559. is used for the output.
  10560. If one and only one of the values is -n with n >= 1, the scale filter
  10561. will use a value that maintains the aspect ratio of the input image,
  10562. calculated from the other specified dimension. After that it will,
  10563. however, make sure that the calculated dimension is divisible by n and
  10564. adjust the value if necessary.
  10565. If both values are -n with n >= 1, the behavior will be identical to
  10566. both values being set to 0 as previously detailed.
  10567. See below for the list of accepted constants for use in the dimension
  10568. expression.
  10569. @item eval
  10570. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  10571. @table @samp
  10572. @item init
  10573. Only evaluate expressions once during the filter initialization or when a command is processed.
  10574. @item frame
  10575. Evaluate expressions for each incoming frame.
  10576. @end table
  10577. Default value is @samp{init}.
  10578. @item interl
  10579. Set the interlacing mode. It accepts the following values:
  10580. @table @samp
  10581. @item 1
  10582. Force interlaced aware scaling.
  10583. @item 0
  10584. Do not apply interlaced scaling.
  10585. @item -1
  10586. Select interlaced aware scaling depending on whether the source frames
  10587. are flagged as interlaced or not.
  10588. @end table
  10589. Default value is @samp{0}.
  10590. @item flags
  10591. Set libswscale scaling flags. See
  10592. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10593. complete list of values. If not explicitly specified the filter applies
  10594. the default flags.
  10595. @item param0, param1
  10596. Set libswscale input parameters for scaling algorithms that need them. See
  10597. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10598. complete documentation. If not explicitly specified the filter applies
  10599. empty parameters.
  10600. @item size, s
  10601. Set the video size. For the syntax of this option, check the
  10602. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10603. @item in_color_matrix
  10604. @item out_color_matrix
  10605. Set in/output YCbCr color space type.
  10606. This allows the autodetected value to be overridden as well as allows forcing
  10607. a specific value used for the output and encoder.
  10608. If not specified, the color space type depends on the pixel format.
  10609. Possible values:
  10610. @table @samp
  10611. @item auto
  10612. Choose automatically.
  10613. @item bt709
  10614. Format conforming to International Telecommunication Union (ITU)
  10615. Recommendation BT.709.
  10616. @item fcc
  10617. Set color space conforming to the United States Federal Communications
  10618. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  10619. @item bt601
  10620. Set color space conforming to:
  10621. @itemize
  10622. @item
  10623. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  10624. @item
  10625. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  10626. @item
  10627. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  10628. @end itemize
  10629. @item smpte240m
  10630. Set color space conforming to SMPTE ST 240:1999.
  10631. @end table
  10632. @item in_range
  10633. @item out_range
  10634. Set in/output YCbCr sample range.
  10635. This allows the autodetected value to be overridden as well as allows forcing
  10636. a specific value used for the output and encoder. If not specified, the
  10637. range depends on the pixel format. Possible values:
  10638. @table @samp
  10639. @item auto/unknown
  10640. Choose automatically.
  10641. @item jpeg/full/pc
  10642. Set full range (0-255 in case of 8-bit luma).
  10643. @item mpeg/limited/tv
  10644. Set "MPEG" range (16-235 in case of 8-bit luma).
  10645. @end table
  10646. @item force_original_aspect_ratio
  10647. Enable decreasing or increasing output video width or height if necessary to
  10648. keep the original aspect ratio. Possible values:
  10649. @table @samp
  10650. @item disable
  10651. Scale the video as specified and disable this feature.
  10652. @item decrease
  10653. The output video dimensions will automatically be decreased if needed.
  10654. @item increase
  10655. The output video dimensions will automatically be increased if needed.
  10656. @end table
  10657. One useful instance of this option is that when you know a specific device's
  10658. maximum allowed resolution, you can use this to limit the output video to
  10659. that, while retaining the aspect ratio. For example, device A allows
  10660. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  10661. decrease) and specifying 1280x720 to the command line makes the output
  10662. 1280x533.
  10663. Please note that this is a different thing than specifying -1 for @option{w}
  10664. or @option{h}, you still need to specify the output resolution for this option
  10665. to work.
  10666. @end table
  10667. The values of the @option{w} and @option{h} options are expressions
  10668. containing the following constants:
  10669. @table @var
  10670. @item in_w
  10671. @item in_h
  10672. The input width and height
  10673. @item iw
  10674. @item ih
  10675. These are the same as @var{in_w} and @var{in_h}.
  10676. @item out_w
  10677. @item out_h
  10678. The output (scaled) width and height
  10679. @item ow
  10680. @item oh
  10681. These are the same as @var{out_w} and @var{out_h}
  10682. @item a
  10683. The same as @var{iw} / @var{ih}
  10684. @item sar
  10685. input sample aspect ratio
  10686. @item dar
  10687. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10688. @item hsub
  10689. @item vsub
  10690. horizontal and vertical input chroma subsample values. For example for the
  10691. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10692. @item ohsub
  10693. @item ovsub
  10694. horizontal and vertical output chroma subsample values. For example for the
  10695. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10696. @end table
  10697. @subsection Examples
  10698. @itemize
  10699. @item
  10700. Scale the input video to a size of 200x100
  10701. @example
  10702. scale=w=200:h=100
  10703. @end example
  10704. This is equivalent to:
  10705. @example
  10706. scale=200:100
  10707. @end example
  10708. or:
  10709. @example
  10710. scale=200x100
  10711. @end example
  10712. @item
  10713. Specify a size abbreviation for the output size:
  10714. @example
  10715. scale=qcif
  10716. @end example
  10717. which can also be written as:
  10718. @example
  10719. scale=size=qcif
  10720. @end example
  10721. @item
  10722. Scale the input to 2x:
  10723. @example
  10724. scale=w=2*iw:h=2*ih
  10725. @end example
  10726. @item
  10727. The above is the same as:
  10728. @example
  10729. scale=2*in_w:2*in_h
  10730. @end example
  10731. @item
  10732. Scale the input to 2x with forced interlaced scaling:
  10733. @example
  10734. scale=2*iw:2*ih:interl=1
  10735. @end example
  10736. @item
  10737. Scale the input to half size:
  10738. @example
  10739. scale=w=iw/2:h=ih/2
  10740. @end example
  10741. @item
  10742. Increase the width, and set the height to the same size:
  10743. @example
  10744. scale=3/2*iw:ow
  10745. @end example
  10746. @item
  10747. Seek Greek harmony:
  10748. @example
  10749. scale=iw:1/PHI*iw
  10750. scale=ih*PHI:ih
  10751. @end example
  10752. @item
  10753. Increase the height, and set the width to 3/2 of the height:
  10754. @example
  10755. scale=w=3/2*oh:h=3/5*ih
  10756. @end example
  10757. @item
  10758. Increase the size, making the size a multiple of the chroma
  10759. subsample values:
  10760. @example
  10761. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  10762. @end example
  10763. @item
  10764. Increase the width to a maximum of 500 pixels,
  10765. keeping the same aspect ratio as the input:
  10766. @example
  10767. scale=w='min(500\, iw*3/2):h=-1'
  10768. @end example
  10769. @item
  10770. Make pixels square by combining scale and setsar:
  10771. @example
  10772. scale='trunc(ih*dar):ih',setsar=1/1
  10773. @end example
  10774. @item
  10775. Make pixels square by combining scale and setsar,
  10776. making sure the resulting resolution is even (required by some codecs):
  10777. @example
  10778. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  10779. @end example
  10780. @end itemize
  10781. @subsection Commands
  10782. This filter supports the following commands:
  10783. @table @option
  10784. @item width, w
  10785. @item height, h
  10786. Set the output video dimension expression.
  10787. The command accepts the same syntax of the corresponding option.
  10788. If the specified expression is not valid, it is kept at its current
  10789. value.
  10790. @end table
  10791. @section scale_npp
  10792. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  10793. format conversion on CUDA video frames. Setting the output width and height
  10794. works in the same way as for the @var{scale} filter.
  10795. The following additional options are accepted:
  10796. @table @option
  10797. @item format
  10798. The pixel format of the output CUDA frames. If set to the string "same" (the
  10799. default), the input format will be kept. Note that automatic format negotiation
  10800. and conversion is not yet supported for hardware frames
  10801. @item interp_algo
  10802. The interpolation algorithm used for resizing. One of the following:
  10803. @table @option
  10804. @item nn
  10805. Nearest neighbour.
  10806. @item linear
  10807. @item cubic
  10808. @item cubic2p_bspline
  10809. 2-parameter cubic (B=1, C=0)
  10810. @item cubic2p_catmullrom
  10811. 2-parameter cubic (B=0, C=1/2)
  10812. @item cubic2p_b05c03
  10813. 2-parameter cubic (B=1/2, C=3/10)
  10814. @item super
  10815. Supersampling
  10816. @item lanczos
  10817. @end table
  10818. @end table
  10819. @section scale2ref
  10820. Scale (resize) the input video, based on a reference video.
  10821. See the scale filter for available options, scale2ref supports the same but
  10822. uses the reference video instead of the main input as basis. scale2ref also
  10823. supports the following additional constants for the @option{w} and
  10824. @option{h} options:
  10825. @table @var
  10826. @item main_w
  10827. @item main_h
  10828. The main input video's width and height
  10829. @item main_a
  10830. The same as @var{main_w} / @var{main_h}
  10831. @item main_sar
  10832. The main input video's sample aspect ratio
  10833. @item main_dar, mdar
  10834. The main input video's display aspect ratio. Calculated from
  10835. @code{(main_w / main_h) * main_sar}.
  10836. @item main_hsub
  10837. @item main_vsub
  10838. The main input video's horizontal and vertical chroma subsample values.
  10839. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  10840. is 1.
  10841. @end table
  10842. @subsection Examples
  10843. @itemize
  10844. @item
  10845. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  10846. @example
  10847. 'scale2ref[b][a];[a][b]overlay'
  10848. @end example
  10849. @end itemize
  10850. @anchor{selectivecolor}
  10851. @section selectivecolor
  10852. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10853. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10854. by the "purity" of the color (that is, how saturated it already is).
  10855. This filter is similar to the Adobe Photoshop Selective Color tool.
  10856. The filter accepts the following options:
  10857. @table @option
  10858. @item correction_method
  10859. Select color correction method.
  10860. Available values are:
  10861. @table @samp
  10862. @item absolute
  10863. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10864. component value).
  10865. @item relative
  10866. Specified adjustments are relative to the original component value.
  10867. @end table
  10868. Default is @code{absolute}.
  10869. @item reds
  10870. Adjustments for red pixels (pixels where the red component is the maximum)
  10871. @item yellows
  10872. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10873. @item greens
  10874. Adjustments for green pixels (pixels where the green component is the maximum)
  10875. @item cyans
  10876. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10877. @item blues
  10878. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10879. @item magentas
  10880. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10881. @item whites
  10882. Adjustments for white pixels (pixels where all components are greater than 128)
  10883. @item neutrals
  10884. Adjustments for all pixels except pure black and pure white
  10885. @item blacks
  10886. Adjustments for black pixels (pixels where all components are lesser than 128)
  10887. @item psfile
  10888. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10889. @end table
  10890. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10891. 4 space separated floating point adjustment values in the [-1,1] range,
  10892. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10893. pixels of its range.
  10894. @subsection Examples
  10895. @itemize
  10896. @item
  10897. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10898. increase magenta by 27% in blue areas:
  10899. @example
  10900. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10901. @end example
  10902. @item
  10903. Use a Photoshop selective color preset:
  10904. @example
  10905. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10906. @end example
  10907. @end itemize
  10908. @anchor{separatefields}
  10909. @section separatefields
  10910. The @code{separatefields} takes a frame-based video input and splits
  10911. each frame into its components fields, producing a new half height clip
  10912. with twice the frame rate and twice the frame count.
  10913. This filter use field-dominance information in frame to decide which
  10914. of each pair of fields to place first in the output.
  10915. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  10916. @section setdar, setsar
  10917. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  10918. output video.
  10919. This is done by changing the specified Sample (aka Pixel) Aspect
  10920. Ratio, according to the following equation:
  10921. @example
  10922. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  10923. @end example
  10924. Keep in mind that the @code{setdar} filter does not modify the pixel
  10925. dimensions of the video frame. Also, the display aspect ratio set by
  10926. this filter may be changed by later filters in the filterchain,
  10927. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  10928. applied.
  10929. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  10930. the filter output video.
  10931. Note that as a consequence of the application of this filter, the
  10932. output display aspect ratio will change according to the equation
  10933. above.
  10934. Keep in mind that the sample aspect ratio set by the @code{setsar}
  10935. filter may be changed by later filters in the filterchain, e.g. if
  10936. another "setsar" or a "setdar" filter is applied.
  10937. It accepts the following parameters:
  10938. @table @option
  10939. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  10940. Set the aspect ratio used by the filter.
  10941. The parameter can be a floating point number string, an expression, or
  10942. a string of the form @var{num}:@var{den}, where @var{num} and
  10943. @var{den} are the numerator and denominator of the aspect ratio. If
  10944. the parameter is not specified, it is assumed the value "0".
  10945. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  10946. should be escaped.
  10947. @item max
  10948. Set the maximum integer value to use for expressing numerator and
  10949. denominator when reducing the expressed aspect ratio to a rational.
  10950. Default value is @code{100}.
  10951. @end table
  10952. The parameter @var{sar} is an expression containing
  10953. the following constants:
  10954. @table @option
  10955. @item E, PI, PHI
  10956. These are approximated values for the mathematical constants e
  10957. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  10958. @item w, h
  10959. The input width and height.
  10960. @item a
  10961. These are the same as @var{w} / @var{h}.
  10962. @item sar
  10963. The input sample aspect ratio.
  10964. @item dar
  10965. The input display aspect ratio. It is the same as
  10966. (@var{w} / @var{h}) * @var{sar}.
  10967. @item hsub, vsub
  10968. Horizontal and vertical chroma subsample values. For example, for the
  10969. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10970. @end table
  10971. @subsection Examples
  10972. @itemize
  10973. @item
  10974. To change the display aspect ratio to 16:9, specify one of the following:
  10975. @example
  10976. setdar=dar=1.77777
  10977. setdar=dar=16/9
  10978. @end example
  10979. @item
  10980. To change the sample aspect ratio to 10:11, specify:
  10981. @example
  10982. setsar=sar=10/11
  10983. @end example
  10984. @item
  10985. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  10986. 1000 in the aspect ratio reduction, use the command:
  10987. @example
  10988. setdar=ratio=16/9:max=1000
  10989. @end example
  10990. @end itemize
  10991. @anchor{setfield}
  10992. @section setfield
  10993. Force field for the output video frame.
  10994. The @code{setfield} filter marks the interlace type field for the
  10995. output frames. It does not change the input frame, but only sets the
  10996. corresponding property, which affects how the frame is treated by
  10997. following filters (e.g. @code{fieldorder} or @code{yadif}).
  10998. The filter accepts the following options:
  10999. @table @option
  11000. @item mode
  11001. Available values are:
  11002. @table @samp
  11003. @item auto
  11004. Keep the same field property.
  11005. @item bff
  11006. Mark the frame as bottom-field-first.
  11007. @item tff
  11008. Mark the frame as top-field-first.
  11009. @item prog
  11010. Mark the frame as progressive.
  11011. @end table
  11012. @end table
  11013. @section showinfo
  11014. Show a line containing various information for each input video frame.
  11015. The input video is not modified.
  11016. The shown line contains a sequence of key/value pairs of the form
  11017. @var{key}:@var{value}.
  11018. The following values are shown in the output:
  11019. @table @option
  11020. @item n
  11021. The (sequential) number of the input frame, starting from 0.
  11022. @item pts
  11023. The Presentation TimeStamp of the input frame, expressed as a number of
  11024. time base units. The time base unit depends on the filter input pad.
  11025. @item pts_time
  11026. The Presentation TimeStamp of the input frame, expressed as a number of
  11027. seconds.
  11028. @item pos
  11029. The position of the frame in the input stream, or -1 if this information is
  11030. unavailable and/or meaningless (for example in case of synthetic video).
  11031. @item fmt
  11032. The pixel format name.
  11033. @item sar
  11034. The sample aspect ratio of the input frame, expressed in the form
  11035. @var{num}/@var{den}.
  11036. @item s
  11037. The size of the input frame. For the syntax of this option, check the
  11038. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11039. @item i
  11040. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  11041. for bottom field first).
  11042. @item iskey
  11043. This is 1 if the frame is a key frame, 0 otherwise.
  11044. @item type
  11045. The picture type of the input frame ("I" for an I-frame, "P" for a
  11046. P-frame, "B" for a B-frame, or "?" for an unknown type).
  11047. Also refer to the documentation of the @code{AVPictureType} enum and of
  11048. the @code{av_get_picture_type_char} function defined in
  11049. @file{libavutil/avutil.h}.
  11050. @item checksum
  11051. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  11052. @item plane_checksum
  11053. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  11054. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  11055. @end table
  11056. @section showpalette
  11057. Displays the 256 colors palette of each frame. This filter is only relevant for
  11058. @var{pal8} pixel format frames.
  11059. It accepts the following option:
  11060. @table @option
  11061. @item s
  11062. Set the size of the box used to represent one palette color entry. Default is
  11063. @code{30} (for a @code{30x30} pixel box).
  11064. @end table
  11065. @section shuffleframes
  11066. Reorder and/or duplicate and/or drop video frames.
  11067. It accepts the following parameters:
  11068. @table @option
  11069. @item mapping
  11070. Set the destination indexes of input frames.
  11071. This is space or '|' separated list of indexes that maps input frames to output
  11072. frames. Number of indexes also sets maximal value that each index may have.
  11073. '-1' index have special meaning and that is to drop frame.
  11074. @end table
  11075. The first frame has the index 0. The default is to keep the input unchanged.
  11076. @subsection Examples
  11077. @itemize
  11078. @item
  11079. Swap second and third frame of every three frames of the input:
  11080. @example
  11081. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  11082. @end example
  11083. @item
  11084. Swap 10th and 1st frame of every ten frames of the input:
  11085. @example
  11086. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  11087. @end example
  11088. @end itemize
  11089. @section shuffleplanes
  11090. Reorder and/or duplicate video planes.
  11091. It accepts the following parameters:
  11092. @table @option
  11093. @item map0
  11094. The index of the input plane to be used as the first output plane.
  11095. @item map1
  11096. The index of the input plane to be used as the second output plane.
  11097. @item map2
  11098. The index of the input plane to be used as the third output plane.
  11099. @item map3
  11100. The index of the input plane to be used as the fourth output plane.
  11101. @end table
  11102. The first plane has the index 0. The default is to keep the input unchanged.
  11103. @subsection Examples
  11104. @itemize
  11105. @item
  11106. Swap the second and third planes of the input:
  11107. @example
  11108. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  11109. @end example
  11110. @end itemize
  11111. @anchor{signalstats}
  11112. @section signalstats
  11113. Evaluate various visual metrics that assist in determining issues associated
  11114. with the digitization of analog video media.
  11115. By default the filter will log these metadata values:
  11116. @table @option
  11117. @item YMIN
  11118. Display the minimal Y value contained within the input frame. Expressed in
  11119. range of [0-255].
  11120. @item YLOW
  11121. Display the Y value at the 10% percentile within the input frame. Expressed in
  11122. range of [0-255].
  11123. @item YAVG
  11124. Display the average Y value within the input frame. Expressed in range of
  11125. [0-255].
  11126. @item YHIGH
  11127. Display the Y value at the 90% percentile within the input frame. Expressed in
  11128. range of [0-255].
  11129. @item YMAX
  11130. Display the maximum Y value contained within the input frame. Expressed in
  11131. range of [0-255].
  11132. @item UMIN
  11133. Display the minimal U value contained within the input frame. Expressed in
  11134. range of [0-255].
  11135. @item ULOW
  11136. Display the U value at the 10% percentile within the input frame. Expressed in
  11137. range of [0-255].
  11138. @item UAVG
  11139. Display the average U value within the input frame. Expressed in range of
  11140. [0-255].
  11141. @item UHIGH
  11142. Display the U value at the 90% percentile within the input frame. Expressed in
  11143. range of [0-255].
  11144. @item UMAX
  11145. Display the maximum U value contained within the input frame. Expressed in
  11146. range of [0-255].
  11147. @item VMIN
  11148. Display the minimal V value contained within the input frame. Expressed in
  11149. range of [0-255].
  11150. @item VLOW
  11151. Display the V value at the 10% percentile within the input frame. Expressed in
  11152. range of [0-255].
  11153. @item VAVG
  11154. Display the average V value within the input frame. Expressed in range of
  11155. [0-255].
  11156. @item VHIGH
  11157. Display the V value at the 90% percentile within the input frame. Expressed in
  11158. range of [0-255].
  11159. @item VMAX
  11160. Display the maximum V value contained within the input frame. Expressed in
  11161. range of [0-255].
  11162. @item SATMIN
  11163. Display the minimal saturation value contained within the input frame.
  11164. Expressed in range of [0-~181.02].
  11165. @item SATLOW
  11166. Display the saturation value at the 10% percentile within the input frame.
  11167. Expressed in range of [0-~181.02].
  11168. @item SATAVG
  11169. Display the average saturation value within the input frame. Expressed in range
  11170. of [0-~181.02].
  11171. @item SATHIGH
  11172. Display the saturation value at the 90% percentile within the input frame.
  11173. Expressed in range of [0-~181.02].
  11174. @item SATMAX
  11175. Display the maximum saturation value contained within the input frame.
  11176. Expressed in range of [0-~181.02].
  11177. @item HUEMED
  11178. Display the median value for hue within the input frame. Expressed in range of
  11179. [0-360].
  11180. @item HUEAVG
  11181. Display the average value for hue within the input frame. Expressed in range of
  11182. [0-360].
  11183. @item YDIF
  11184. Display the average of sample value difference between all values of the Y
  11185. plane in the current frame and corresponding values of the previous input frame.
  11186. Expressed in range of [0-255].
  11187. @item UDIF
  11188. Display the average of sample value difference between all values of the U
  11189. plane in the current frame and corresponding values of the previous input frame.
  11190. Expressed in range of [0-255].
  11191. @item VDIF
  11192. Display the average of sample value difference between all values of the V
  11193. plane in the current frame and corresponding values of the previous input frame.
  11194. Expressed in range of [0-255].
  11195. @item YBITDEPTH
  11196. Display bit depth of Y plane in current frame.
  11197. Expressed in range of [0-16].
  11198. @item UBITDEPTH
  11199. Display bit depth of U plane in current frame.
  11200. Expressed in range of [0-16].
  11201. @item VBITDEPTH
  11202. Display bit depth of V plane in current frame.
  11203. Expressed in range of [0-16].
  11204. @end table
  11205. The filter accepts the following options:
  11206. @table @option
  11207. @item stat
  11208. @item out
  11209. @option{stat} specify an additional form of image analysis.
  11210. @option{out} output video with the specified type of pixel highlighted.
  11211. Both options accept the following values:
  11212. @table @samp
  11213. @item tout
  11214. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  11215. unlike the neighboring pixels of the same field. Examples of temporal outliers
  11216. include the results of video dropouts, head clogs, or tape tracking issues.
  11217. @item vrep
  11218. Identify @var{vertical line repetition}. Vertical line repetition includes
  11219. similar rows of pixels within a frame. In born-digital video vertical line
  11220. repetition is common, but this pattern is uncommon in video digitized from an
  11221. analog source. When it occurs in video that results from the digitization of an
  11222. analog source it can indicate concealment from a dropout compensator.
  11223. @item brng
  11224. Identify pixels that fall outside of legal broadcast range.
  11225. @end table
  11226. @item color, c
  11227. Set the highlight color for the @option{out} option. The default color is
  11228. yellow.
  11229. @end table
  11230. @subsection Examples
  11231. @itemize
  11232. @item
  11233. Output data of various video metrics:
  11234. @example
  11235. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  11236. @end example
  11237. @item
  11238. Output specific data about the minimum and maximum values of the Y plane per frame:
  11239. @example
  11240. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  11241. @end example
  11242. @item
  11243. Playback video while highlighting pixels that are outside of broadcast range in red.
  11244. @example
  11245. ffplay example.mov -vf signalstats="out=brng:color=red"
  11246. @end example
  11247. @item
  11248. Playback video with signalstats metadata drawn over the frame.
  11249. @example
  11250. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  11251. @end example
  11252. The contents of signalstat_drawtext.txt used in the command are:
  11253. @example
  11254. time %@{pts:hms@}
  11255. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  11256. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  11257. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  11258. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  11259. @end example
  11260. @end itemize
  11261. @anchor{signature}
  11262. @section signature
  11263. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  11264. input. In this case the matching between the inputs can be calculated additionally.
  11265. The filter always passes through the first input. The signature of each stream can
  11266. be written into a file.
  11267. It accepts the following options:
  11268. @table @option
  11269. @item detectmode
  11270. Enable or disable the matching process.
  11271. Available values are:
  11272. @table @samp
  11273. @item off
  11274. Disable the calculation of a matching (default).
  11275. @item full
  11276. Calculate the matching for the whole video and output whether the whole video
  11277. matches or only parts.
  11278. @item fast
  11279. Calculate only until a matching is found or the video ends. Should be faster in
  11280. some cases.
  11281. @end table
  11282. @item nb_inputs
  11283. Set the number of inputs. The option value must be a non negative integer.
  11284. Default value is 1.
  11285. @item filename
  11286. Set the path to which the output is written. If there is more than one input,
  11287. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  11288. integer), that will be replaced with the input number. If no filename is
  11289. specified, no output will be written. This is the default.
  11290. @item format
  11291. Choose the output format.
  11292. Available values are:
  11293. @table @samp
  11294. @item binary
  11295. Use the specified binary representation (default).
  11296. @item xml
  11297. Use the specified xml representation.
  11298. @end table
  11299. @item th_d
  11300. Set threshold to detect one word as similar. The option value must be an integer
  11301. greater than zero. The default value is 9000.
  11302. @item th_dc
  11303. Set threshold to detect all words as similar. The option value must be an integer
  11304. greater than zero. The default value is 60000.
  11305. @item th_xh
  11306. Set threshold to detect frames as similar. The option value must be an integer
  11307. greater than zero. The default value is 116.
  11308. @item th_di
  11309. Set the minimum length of a sequence in frames to recognize it as matching
  11310. sequence. The option value must be a non negative integer value.
  11311. The default value is 0.
  11312. @item th_it
  11313. Set the minimum relation, that matching frames to all frames must have.
  11314. The option value must be a double value between 0 and 1. The default value is 0.5.
  11315. @end table
  11316. @subsection Examples
  11317. @itemize
  11318. @item
  11319. To calculate the signature of an input video and store it in signature.bin:
  11320. @example
  11321. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  11322. @end example
  11323. @item
  11324. To detect whether two videos match and store the signatures in XML format in
  11325. signature0.xml and signature1.xml:
  11326. @example
  11327. 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 -
  11328. @end example
  11329. @end itemize
  11330. @anchor{smartblur}
  11331. @section smartblur
  11332. Blur the input video without impacting the outlines.
  11333. It accepts the following options:
  11334. @table @option
  11335. @item luma_radius, lr
  11336. Set the luma radius. The option value must be a float number in
  11337. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11338. used to blur the image (slower if larger). Default value is 1.0.
  11339. @item luma_strength, ls
  11340. Set the luma strength. The option value must be a float number
  11341. in the range [-1.0,1.0] that configures the blurring. A value included
  11342. in [0.0,1.0] will blur the image whereas a value included in
  11343. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  11344. @item luma_threshold, lt
  11345. Set the luma threshold used as a coefficient to determine
  11346. whether a pixel should be blurred or not. The option value must be an
  11347. integer in the range [-30,30]. A value of 0 will filter all the image,
  11348. a value included in [0,30] will filter flat areas and a value included
  11349. in [-30,0] will filter edges. Default value is 0.
  11350. @item chroma_radius, cr
  11351. Set the chroma radius. The option value must be a float number in
  11352. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11353. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  11354. @item chroma_strength, cs
  11355. Set the chroma strength. The option value must be a float number
  11356. in the range [-1.0,1.0] that configures the blurring. A value included
  11357. in [0.0,1.0] will blur the image whereas a value included in
  11358. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  11359. @item chroma_threshold, ct
  11360. Set the chroma threshold used as a coefficient to determine
  11361. whether a pixel should be blurred or not. The option value must be an
  11362. integer in the range [-30,30]. A value of 0 will filter all the image,
  11363. a value included in [0,30] will filter flat areas and a value included
  11364. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  11365. @end table
  11366. If a chroma option is not explicitly set, the corresponding luma value
  11367. is set.
  11368. @section ssim
  11369. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  11370. This filter takes in input two input videos, the first input is
  11371. considered the "main" source and is passed unchanged to the
  11372. output. The second input is used as a "reference" video for computing
  11373. the SSIM.
  11374. Both video inputs must have the same resolution and pixel format for
  11375. this filter to work correctly. Also it assumes that both inputs
  11376. have the same number of frames, which are compared one by one.
  11377. The filter stores the calculated SSIM of each frame.
  11378. The description of the accepted parameters follows.
  11379. @table @option
  11380. @item stats_file, f
  11381. If specified the filter will use the named file to save the SSIM of
  11382. each individual frame. When filename equals "-" the data is sent to
  11383. standard output.
  11384. @end table
  11385. The file printed if @var{stats_file} is selected, contains a sequence of
  11386. key/value pairs of the form @var{key}:@var{value} for each compared
  11387. couple of frames.
  11388. A description of each shown parameter follows:
  11389. @table @option
  11390. @item n
  11391. sequential number of the input frame, starting from 1
  11392. @item Y, U, V, R, G, B
  11393. SSIM of the compared frames for the component specified by the suffix.
  11394. @item All
  11395. SSIM of the compared frames for the whole frame.
  11396. @item dB
  11397. Same as above but in dB representation.
  11398. @end table
  11399. This filter also supports the @ref{framesync} options.
  11400. For example:
  11401. @example
  11402. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11403. [main][ref] ssim="stats_file=stats.log" [out]
  11404. @end example
  11405. On this example the input file being processed is compared with the
  11406. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  11407. is stored in @file{stats.log}.
  11408. Another example with both psnr and ssim at same time:
  11409. @example
  11410. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  11411. @end example
  11412. @section stereo3d
  11413. Convert between different stereoscopic image formats.
  11414. The filters accept the following options:
  11415. @table @option
  11416. @item in
  11417. Set stereoscopic image format of input.
  11418. Available values for input image formats are:
  11419. @table @samp
  11420. @item sbsl
  11421. side by side parallel (left eye left, right eye right)
  11422. @item sbsr
  11423. side by side crosseye (right eye left, left eye right)
  11424. @item sbs2l
  11425. side by side parallel with half width resolution
  11426. (left eye left, right eye right)
  11427. @item sbs2r
  11428. side by side crosseye with half width resolution
  11429. (right eye left, left eye right)
  11430. @item abl
  11431. above-below (left eye above, right eye below)
  11432. @item abr
  11433. above-below (right eye above, left eye below)
  11434. @item ab2l
  11435. above-below with half height resolution
  11436. (left eye above, right eye below)
  11437. @item ab2r
  11438. above-below with half height resolution
  11439. (right eye above, left eye below)
  11440. @item al
  11441. alternating frames (left eye first, right eye second)
  11442. @item ar
  11443. alternating frames (right eye first, left eye second)
  11444. @item irl
  11445. interleaved rows (left eye has top row, right eye starts on next row)
  11446. @item irr
  11447. interleaved rows (right eye has top row, left eye starts on next row)
  11448. @item icl
  11449. interleaved columns, left eye first
  11450. @item icr
  11451. interleaved columns, right eye first
  11452. Default value is @samp{sbsl}.
  11453. @end table
  11454. @item out
  11455. Set stereoscopic image format of output.
  11456. @table @samp
  11457. @item sbsl
  11458. side by side parallel (left eye left, right eye right)
  11459. @item sbsr
  11460. side by side crosseye (right eye left, left eye right)
  11461. @item sbs2l
  11462. side by side parallel with half width resolution
  11463. (left eye left, right eye right)
  11464. @item sbs2r
  11465. side by side crosseye with half width resolution
  11466. (right eye left, left eye right)
  11467. @item abl
  11468. above-below (left eye above, right eye below)
  11469. @item abr
  11470. above-below (right eye above, left eye below)
  11471. @item ab2l
  11472. above-below with half height resolution
  11473. (left eye above, right eye below)
  11474. @item ab2r
  11475. above-below with half height resolution
  11476. (right eye above, left eye below)
  11477. @item al
  11478. alternating frames (left eye first, right eye second)
  11479. @item ar
  11480. alternating frames (right eye first, left eye second)
  11481. @item irl
  11482. interleaved rows (left eye has top row, right eye starts on next row)
  11483. @item irr
  11484. interleaved rows (right eye has top row, left eye starts on next row)
  11485. @item arbg
  11486. anaglyph red/blue gray
  11487. (red filter on left eye, blue filter on right eye)
  11488. @item argg
  11489. anaglyph red/green gray
  11490. (red filter on left eye, green filter on right eye)
  11491. @item arcg
  11492. anaglyph red/cyan gray
  11493. (red filter on left eye, cyan filter on right eye)
  11494. @item arch
  11495. anaglyph red/cyan half colored
  11496. (red filter on left eye, cyan filter on right eye)
  11497. @item arcc
  11498. anaglyph red/cyan color
  11499. (red filter on left eye, cyan filter on right eye)
  11500. @item arcd
  11501. anaglyph red/cyan color optimized with the least squares projection of dubois
  11502. (red filter on left eye, cyan filter on right eye)
  11503. @item agmg
  11504. anaglyph green/magenta gray
  11505. (green filter on left eye, magenta filter on right eye)
  11506. @item agmh
  11507. anaglyph green/magenta half colored
  11508. (green filter on left eye, magenta filter on right eye)
  11509. @item agmc
  11510. anaglyph green/magenta colored
  11511. (green filter on left eye, magenta filter on right eye)
  11512. @item agmd
  11513. anaglyph green/magenta color optimized with the least squares projection of dubois
  11514. (green filter on left eye, magenta filter on right eye)
  11515. @item aybg
  11516. anaglyph yellow/blue gray
  11517. (yellow filter on left eye, blue filter on right eye)
  11518. @item aybh
  11519. anaglyph yellow/blue half colored
  11520. (yellow filter on left eye, blue filter on right eye)
  11521. @item aybc
  11522. anaglyph yellow/blue colored
  11523. (yellow filter on left eye, blue filter on right eye)
  11524. @item aybd
  11525. anaglyph yellow/blue color optimized with the least squares projection of dubois
  11526. (yellow filter on left eye, blue filter on right eye)
  11527. @item ml
  11528. mono output (left eye only)
  11529. @item mr
  11530. mono output (right eye only)
  11531. @item chl
  11532. checkerboard, left eye first
  11533. @item chr
  11534. checkerboard, right eye first
  11535. @item icl
  11536. interleaved columns, left eye first
  11537. @item icr
  11538. interleaved columns, right eye first
  11539. @item hdmi
  11540. HDMI frame pack
  11541. @end table
  11542. Default value is @samp{arcd}.
  11543. @end table
  11544. @subsection Examples
  11545. @itemize
  11546. @item
  11547. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  11548. @example
  11549. stereo3d=sbsl:aybd
  11550. @end example
  11551. @item
  11552. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  11553. @example
  11554. stereo3d=abl:sbsr
  11555. @end example
  11556. @end itemize
  11557. @section streamselect, astreamselect
  11558. Select video or audio streams.
  11559. The filter accepts the following options:
  11560. @table @option
  11561. @item inputs
  11562. Set number of inputs. Default is 2.
  11563. @item map
  11564. Set input indexes to remap to outputs.
  11565. @end table
  11566. @subsection Commands
  11567. The @code{streamselect} and @code{astreamselect} filter supports the following
  11568. commands:
  11569. @table @option
  11570. @item map
  11571. Set input indexes to remap to outputs.
  11572. @end table
  11573. @subsection Examples
  11574. @itemize
  11575. @item
  11576. Select first 5 seconds 1st stream and rest of time 2nd stream:
  11577. @example
  11578. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  11579. @end example
  11580. @item
  11581. Same as above, but for audio:
  11582. @example
  11583. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  11584. @end example
  11585. @end itemize
  11586. @section sobel
  11587. Apply sobel operator to input video stream.
  11588. The filter accepts the following option:
  11589. @table @option
  11590. @item planes
  11591. Set which planes will be processed, unprocessed planes will be copied.
  11592. By default value 0xf, all planes will be processed.
  11593. @item scale
  11594. Set value which will be multiplied with filtered result.
  11595. @item delta
  11596. Set value which will be added to filtered result.
  11597. @end table
  11598. @anchor{spp}
  11599. @section spp
  11600. Apply a simple postprocessing filter that compresses and decompresses the image
  11601. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  11602. and average the results.
  11603. The filter accepts the following options:
  11604. @table @option
  11605. @item quality
  11606. Set quality. This option defines the number of levels for averaging. It accepts
  11607. an integer in the range 0-6. If set to @code{0}, the filter will have no
  11608. effect. A value of @code{6} means the higher quality. For each increment of
  11609. that value the speed drops by a factor of approximately 2. Default value is
  11610. @code{3}.
  11611. @item qp
  11612. Force a constant quantization parameter. If not set, the filter will use the QP
  11613. from the video stream (if available).
  11614. @item mode
  11615. Set thresholding mode. Available modes are:
  11616. @table @samp
  11617. @item hard
  11618. Set hard thresholding (default).
  11619. @item soft
  11620. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11621. @end table
  11622. @item use_bframe_qp
  11623. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  11624. option may cause flicker since the B-Frames have often larger QP. Default is
  11625. @code{0} (not enabled).
  11626. @end table
  11627. @anchor{subtitles}
  11628. @section subtitles
  11629. Draw subtitles on top of input video using the libass library.
  11630. To enable compilation of this filter you need to configure FFmpeg with
  11631. @code{--enable-libass}. This filter also requires a build with libavcodec and
  11632. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  11633. Alpha) subtitles format.
  11634. The filter accepts the following options:
  11635. @table @option
  11636. @item filename, f
  11637. Set the filename of the subtitle file to read. It must be specified.
  11638. @item original_size
  11639. Specify the size of the original video, the video for which the ASS file
  11640. was composed. For the syntax of this option, check the
  11641. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11642. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  11643. correctly scale the fonts if the aspect ratio has been changed.
  11644. @item fontsdir
  11645. Set a directory path containing fonts that can be used by the filter.
  11646. These fonts will be used in addition to whatever the font provider uses.
  11647. @item alpha
  11648. Process alpha channel, by default alpha channel is untouched.
  11649. @item charenc
  11650. Set subtitles input character encoding. @code{subtitles} filter only. Only
  11651. useful if not UTF-8.
  11652. @item stream_index, si
  11653. Set subtitles stream index. @code{subtitles} filter only.
  11654. @item force_style
  11655. Override default style or script info parameters of the subtitles. It accepts a
  11656. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  11657. @end table
  11658. If the first key is not specified, it is assumed that the first value
  11659. specifies the @option{filename}.
  11660. For example, to render the file @file{sub.srt} on top of the input
  11661. video, use the command:
  11662. @example
  11663. subtitles=sub.srt
  11664. @end example
  11665. which is equivalent to:
  11666. @example
  11667. subtitles=filename=sub.srt
  11668. @end example
  11669. To render the default subtitles stream from file @file{video.mkv}, use:
  11670. @example
  11671. subtitles=video.mkv
  11672. @end example
  11673. To render the second subtitles stream from that file, use:
  11674. @example
  11675. subtitles=video.mkv:si=1
  11676. @end example
  11677. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  11678. @code{DejaVu Serif}, use:
  11679. @example
  11680. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  11681. @end example
  11682. @section super2xsai
  11683. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  11684. Interpolate) pixel art scaling algorithm.
  11685. Useful for enlarging pixel art images without reducing sharpness.
  11686. @section swaprect
  11687. Swap two rectangular objects in video.
  11688. This filter accepts the following options:
  11689. @table @option
  11690. @item w
  11691. Set object width.
  11692. @item h
  11693. Set object height.
  11694. @item x1
  11695. Set 1st rect x coordinate.
  11696. @item y1
  11697. Set 1st rect y coordinate.
  11698. @item x2
  11699. Set 2nd rect x coordinate.
  11700. @item y2
  11701. Set 2nd rect y coordinate.
  11702. All expressions are evaluated once for each frame.
  11703. @end table
  11704. The all options are expressions containing the following constants:
  11705. @table @option
  11706. @item w
  11707. @item h
  11708. The input width and height.
  11709. @item a
  11710. same as @var{w} / @var{h}
  11711. @item sar
  11712. input sample aspect ratio
  11713. @item dar
  11714. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  11715. @item n
  11716. The number of the input frame, starting from 0.
  11717. @item t
  11718. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  11719. @item pos
  11720. the position in the file of the input frame, NAN if unknown
  11721. @end table
  11722. @section swapuv
  11723. Swap U & V plane.
  11724. @section telecine
  11725. Apply telecine process to the video.
  11726. This filter accepts the following options:
  11727. @table @option
  11728. @item first_field
  11729. @table @samp
  11730. @item top, t
  11731. top field first
  11732. @item bottom, b
  11733. bottom field first
  11734. The default value is @code{top}.
  11735. @end table
  11736. @item pattern
  11737. A string of numbers representing the pulldown pattern you wish to apply.
  11738. The default value is @code{23}.
  11739. @end table
  11740. @example
  11741. Some typical patterns:
  11742. NTSC output (30i):
  11743. 27.5p: 32222
  11744. 24p: 23 (classic)
  11745. 24p: 2332 (preferred)
  11746. 20p: 33
  11747. 18p: 334
  11748. 16p: 3444
  11749. PAL output (25i):
  11750. 27.5p: 12222
  11751. 24p: 222222222223 ("Euro pulldown")
  11752. 16.67p: 33
  11753. 16p: 33333334
  11754. @end example
  11755. @section threshold
  11756. Apply threshold effect to video stream.
  11757. This filter needs four video streams to perform thresholding.
  11758. First stream is stream we are filtering.
  11759. Second stream is holding threshold values, third stream is holding min values,
  11760. and last, fourth stream is holding max values.
  11761. The filter accepts the following option:
  11762. @table @option
  11763. @item planes
  11764. Set which planes will be processed, unprocessed planes will be copied.
  11765. By default value 0xf, all planes will be processed.
  11766. @end table
  11767. For example if first stream pixel's component value is less then threshold value
  11768. of pixel component from 2nd threshold stream, third stream value will picked,
  11769. otherwise fourth stream pixel component value will be picked.
  11770. Using color source filter one can perform various types of thresholding:
  11771. @subsection Examples
  11772. @itemize
  11773. @item
  11774. Binary threshold, using gray color as threshold:
  11775. @example
  11776. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  11777. @end example
  11778. @item
  11779. Inverted binary threshold, using gray color as threshold:
  11780. @example
  11781. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  11782. @end example
  11783. @item
  11784. Truncate binary threshold, using gray color as threshold:
  11785. @example
  11786. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  11787. @end example
  11788. @item
  11789. Threshold to zero, using gray color as threshold:
  11790. @example
  11791. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  11792. @end example
  11793. @item
  11794. Inverted threshold to zero, using gray color as threshold:
  11795. @example
  11796. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  11797. @end example
  11798. @end itemize
  11799. @section thumbnail
  11800. Select the most representative frame in a given sequence of consecutive frames.
  11801. The filter accepts the following options:
  11802. @table @option
  11803. @item n
  11804. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  11805. will pick one of them, and then handle the next batch of @var{n} frames until
  11806. the end. Default is @code{100}.
  11807. @end table
  11808. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  11809. value will result in a higher memory usage, so a high value is not recommended.
  11810. @subsection Examples
  11811. @itemize
  11812. @item
  11813. Extract one picture each 50 frames:
  11814. @example
  11815. thumbnail=50
  11816. @end example
  11817. @item
  11818. Complete example of a thumbnail creation with @command{ffmpeg}:
  11819. @example
  11820. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  11821. @end example
  11822. @end itemize
  11823. @section tile
  11824. Tile several successive frames together.
  11825. The filter accepts the following options:
  11826. @table @option
  11827. @item layout
  11828. Set the grid size (i.e. the number of lines and columns). For the syntax of
  11829. this option, check the
  11830. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11831. @item nb_frames
  11832. Set the maximum number of frames to render in the given area. It must be less
  11833. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  11834. the area will be used.
  11835. @item margin
  11836. Set the outer border margin in pixels.
  11837. @item padding
  11838. Set the inner border thickness (i.e. the number of pixels between frames). For
  11839. more advanced padding options (such as having different values for the edges),
  11840. refer to the pad video filter.
  11841. @item color
  11842. Specify the color of the unused area. For the syntax of this option, check the
  11843. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11844. The default value of @var{color} is "black".
  11845. @item overlap
  11846. Set the number of frames to overlap when tiling several successive frames together.
  11847. The value must be between @code{0} and @var{nb_frames - 1}.
  11848. @item init_padding
  11849. Set the number of frames to initially be empty before displaying first output frame.
  11850. This controls how soon will one get first output frame.
  11851. The value must be between @code{0} and @var{nb_frames - 1}.
  11852. @end table
  11853. @subsection Examples
  11854. @itemize
  11855. @item
  11856. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  11857. @example
  11858. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  11859. @end example
  11860. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  11861. duplicating each output frame to accommodate the originally detected frame
  11862. rate.
  11863. @item
  11864. Display @code{5} pictures in an area of @code{3x2} frames,
  11865. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  11866. mixed flat and named options:
  11867. @example
  11868. tile=3x2:nb_frames=5:padding=7:margin=2
  11869. @end example
  11870. @end itemize
  11871. @section tinterlace
  11872. Perform various types of temporal field interlacing.
  11873. Frames are counted starting from 1, so the first input frame is
  11874. considered odd.
  11875. The filter accepts the following options:
  11876. @table @option
  11877. @item mode
  11878. Specify the mode of the interlacing. This option can also be specified
  11879. as a value alone. See below for a list of values for this option.
  11880. Available values are:
  11881. @table @samp
  11882. @item merge, 0
  11883. Move odd frames into the upper field, even into the lower field,
  11884. generating a double height frame at half frame rate.
  11885. @example
  11886. ------> time
  11887. Input:
  11888. Frame 1 Frame 2 Frame 3 Frame 4
  11889. 11111 22222 33333 44444
  11890. 11111 22222 33333 44444
  11891. 11111 22222 33333 44444
  11892. 11111 22222 33333 44444
  11893. Output:
  11894. 11111 33333
  11895. 22222 44444
  11896. 11111 33333
  11897. 22222 44444
  11898. 11111 33333
  11899. 22222 44444
  11900. 11111 33333
  11901. 22222 44444
  11902. @end example
  11903. @item drop_even, 1
  11904. Only output odd frames, even frames are dropped, generating a frame with
  11905. unchanged height at half frame rate.
  11906. @example
  11907. ------> time
  11908. Input:
  11909. Frame 1 Frame 2 Frame 3 Frame 4
  11910. 11111 22222 33333 44444
  11911. 11111 22222 33333 44444
  11912. 11111 22222 33333 44444
  11913. 11111 22222 33333 44444
  11914. Output:
  11915. 11111 33333
  11916. 11111 33333
  11917. 11111 33333
  11918. 11111 33333
  11919. @end example
  11920. @item drop_odd, 2
  11921. Only output even frames, odd frames are dropped, generating a frame with
  11922. unchanged height at half frame rate.
  11923. @example
  11924. ------> time
  11925. Input:
  11926. Frame 1 Frame 2 Frame 3 Frame 4
  11927. 11111 22222 33333 44444
  11928. 11111 22222 33333 44444
  11929. 11111 22222 33333 44444
  11930. 11111 22222 33333 44444
  11931. Output:
  11932. 22222 44444
  11933. 22222 44444
  11934. 22222 44444
  11935. 22222 44444
  11936. @end example
  11937. @item pad, 3
  11938. Expand each frame to full height, but pad alternate lines with black,
  11939. generating a frame with double height at the same input frame rate.
  11940. @example
  11941. ------> time
  11942. Input:
  11943. Frame 1 Frame 2 Frame 3 Frame 4
  11944. 11111 22222 33333 44444
  11945. 11111 22222 33333 44444
  11946. 11111 22222 33333 44444
  11947. 11111 22222 33333 44444
  11948. Output:
  11949. 11111 ..... 33333 .....
  11950. ..... 22222 ..... 44444
  11951. 11111 ..... 33333 .....
  11952. ..... 22222 ..... 44444
  11953. 11111 ..... 33333 .....
  11954. ..... 22222 ..... 44444
  11955. 11111 ..... 33333 .....
  11956. ..... 22222 ..... 44444
  11957. @end example
  11958. @item interleave_top, 4
  11959. Interleave the upper field from odd frames with the lower field from
  11960. even frames, generating a frame with unchanged height at half frame rate.
  11961. @example
  11962. ------> time
  11963. Input:
  11964. Frame 1 Frame 2 Frame 3 Frame 4
  11965. 11111<- 22222 33333<- 44444
  11966. 11111 22222<- 33333 44444<-
  11967. 11111<- 22222 33333<- 44444
  11968. 11111 22222<- 33333 44444<-
  11969. Output:
  11970. 11111 33333
  11971. 22222 44444
  11972. 11111 33333
  11973. 22222 44444
  11974. @end example
  11975. @item interleave_bottom, 5
  11976. Interleave the lower field from odd frames with the upper field from
  11977. even frames, generating a frame with unchanged height at half frame rate.
  11978. @example
  11979. ------> time
  11980. Input:
  11981. Frame 1 Frame 2 Frame 3 Frame 4
  11982. 11111 22222<- 33333 44444<-
  11983. 11111<- 22222 33333<- 44444
  11984. 11111 22222<- 33333 44444<-
  11985. 11111<- 22222 33333<- 44444
  11986. Output:
  11987. 22222 44444
  11988. 11111 33333
  11989. 22222 44444
  11990. 11111 33333
  11991. @end example
  11992. @item interlacex2, 6
  11993. Double frame rate with unchanged height. Frames are inserted each
  11994. containing the second temporal field from the previous input frame and
  11995. the first temporal field from the next input frame. This mode relies on
  11996. the top_field_first flag. Useful for interlaced video displays with no
  11997. field synchronisation.
  11998. @example
  11999. ------> time
  12000. Input:
  12001. Frame 1 Frame 2 Frame 3 Frame 4
  12002. 11111 22222 33333 44444
  12003. 11111 22222 33333 44444
  12004. 11111 22222 33333 44444
  12005. 11111 22222 33333 44444
  12006. Output:
  12007. 11111 22222 22222 33333 33333 44444 44444
  12008. 11111 11111 22222 22222 33333 33333 44444
  12009. 11111 22222 22222 33333 33333 44444 44444
  12010. 11111 11111 22222 22222 33333 33333 44444
  12011. @end example
  12012. @item mergex2, 7
  12013. Move odd frames into the upper field, even into the lower field,
  12014. generating a double height frame at same frame rate.
  12015. @example
  12016. ------> time
  12017. Input:
  12018. Frame 1 Frame 2 Frame 3 Frame 4
  12019. 11111 22222 33333 44444
  12020. 11111 22222 33333 44444
  12021. 11111 22222 33333 44444
  12022. 11111 22222 33333 44444
  12023. Output:
  12024. 11111 33333 33333 55555
  12025. 22222 22222 44444 44444
  12026. 11111 33333 33333 55555
  12027. 22222 22222 44444 44444
  12028. 11111 33333 33333 55555
  12029. 22222 22222 44444 44444
  12030. 11111 33333 33333 55555
  12031. 22222 22222 44444 44444
  12032. @end example
  12033. @end table
  12034. Numeric values are deprecated but are accepted for backward
  12035. compatibility reasons.
  12036. Default mode is @code{merge}.
  12037. @item flags
  12038. Specify flags influencing the filter process.
  12039. Available value for @var{flags} is:
  12040. @table @option
  12041. @item low_pass_filter, vlfp
  12042. Enable linear vertical low-pass filtering in the filter.
  12043. Vertical low-pass filtering is required when creating an interlaced
  12044. destination from a progressive source which contains high-frequency
  12045. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  12046. patterning.
  12047. @item complex_filter, cvlfp
  12048. Enable complex vertical low-pass filtering.
  12049. This will slightly less reduce interlace 'twitter' and Moire
  12050. patterning but better retain detail and subjective sharpness impression.
  12051. @end table
  12052. Vertical low-pass filtering can only be enabled for @option{mode}
  12053. @var{interleave_top} and @var{interleave_bottom}.
  12054. @end table
  12055. @section tmix
  12056. Mix successive video frames.
  12057. A description of the accepted options follows.
  12058. @table @option
  12059. @item frames
  12060. The number of successive frames to mix. If unspecified, it defaults to 3.
  12061. @item weights
  12062. Specify weight of each input video frame.
  12063. Each weight is separated by space. If number of weights is smaller than
  12064. number of @var{frames} last specified weight will be used for all remaining
  12065. unset weights.
  12066. @item scale
  12067. Specify scale, if it is set it will be multiplied with sum
  12068. of each weight multiplied with pixel values to give final destination
  12069. pixel value. By default @var{scale} is auto scaled to sum of weights.
  12070. @end table
  12071. @subsection Examples
  12072. @itemize
  12073. @item
  12074. Average 7 successive frames:
  12075. @example
  12076. tmix=frames=7:weights="1 1 1 1 1 1 1"
  12077. @end example
  12078. @item
  12079. Apply simple temporal convolution:
  12080. @example
  12081. tmix=frames=3:weights="-1 3 -1"
  12082. @end example
  12083. @item
  12084. Similar as above but only showing temporal differences:
  12085. @example
  12086. tmix=frames=3:weights="-1 2 -1":scale=1
  12087. @end example
  12088. @end itemize
  12089. @section tonemap
  12090. Tone map colors from different dynamic ranges.
  12091. This filter expects data in single precision floating point, as it needs to
  12092. operate on (and can output) out-of-range values. Another filter, such as
  12093. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  12094. The tonemapping algorithms implemented only work on linear light, so input
  12095. data should be linearized beforehand (and possibly correctly tagged).
  12096. @example
  12097. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  12098. @end example
  12099. @subsection Options
  12100. The filter accepts the following options.
  12101. @table @option
  12102. @item tonemap
  12103. Set the tone map algorithm to use.
  12104. Possible values are:
  12105. @table @var
  12106. @item none
  12107. Do not apply any tone map, only desaturate overbright pixels.
  12108. @item clip
  12109. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  12110. in-range values, while distorting out-of-range values.
  12111. @item linear
  12112. Stretch the entire reference gamut to a linear multiple of the display.
  12113. @item gamma
  12114. Fit a logarithmic transfer between the tone curves.
  12115. @item reinhard
  12116. Preserve overall image brightness with a simple curve, using nonlinear
  12117. contrast, which results in flattening details and degrading color accuracy.
  12118. @item hable
  12119. Preserve both dark and bright details better than @var{reinhard}, at the cost
  12120. of slightly darkening everything. Use it when detail preservation is more
  12121. important than color and brightness accuracy.
  12122. @item mobius
  12123. Smoothly map out-of-range values, while retaining contrast and colors for
  12124. in-range material as much as possible. Use it when color accuracy is more
  12125. important than detail preservation.
  12126. @end table
  12127. Default is none.
  12128. @item param
  12129. Tune the tone mapping algorithm.
  12130. This affects the following algorithms:
  12131. @table @var
  12132. @item none
  12133. Ignored.
  12134. @item linear
  12135. Specifies the scale factor to use while stretching.
  12136. Default to 1.0.
  12137. @item gamma
  12138. Specifies the exponent of the function.
  12139. Default to 1.8.
  12140. @item clip
  12141. Specify an extra linear coefficient to multiply into the signal before clipping.
  12142. Default to 1.0.
  12143. @item reinhard
  12144. Specify the local contrast coefficient at the display peak.
  12145. Default to 0.5, which means that in-gamut values will be about half as bright
  12146. as when clipping.
  12147. @item hable
  12148. Ignored.
  12149. @item mobius
  12150. Specify the transition point from linear to mobius transform. Every value
  12151. below this point is guaranteed to be mapped 1:1. The higher the value, the
  12152. more accurate the result will be, at the cost of losing bright details.
  12153. Default to 0.3, which due to the steep initial slope still preserves in-range
  12154. colors fairly accurately.
  12155. @end table
  12156. @item desat
  12157. Apply desaturation for highlights that exceed this level of brightness. The
  12158. higher the parameter, the more color information will be preserved. This
  12159. setting helps prevent unnaturally blown-out colors for super-highlights, by
  12160. (smoothly) turning into white instead. This makes images feel more natural,
  12161. at the cost of reducing information about out-of-range colors.
  12162. The default of 2.0 is somewhat conservative and will mostly just apply to
  12163. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  12164. This option works only if the input frame has a supported color tag.
  12165. @item peak
  12166. Override signal/nominal/reference peak with this value. Useful when the
  12167. embedded peak information in display metadata is not reliable or when tone
  12168. mapping from a lower range to a higher range.
  12169. @end table
  12170. @section transpose
  12171. Transpose rows with columns in the input video and optionally flip it.
  12172. It accepts the following parameters:
  12173. @table @option
  12174. @item dir
  12175. Specify the transposition direction.
  12176. Can assume the following values:
  12177. @table @samp
  12178. @item 0, 4, cclock_flip
  12179. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  12180. @example
  12181. L.R L.l
  12182. . . -> . .
  12183. l.r R.r
  12184. @end example
  12185. @item 1, 5, clock
  12186. Rotate by 90 degrees clockwise, that is:
  12187. @example
  12188. L.R l.L
  12189. . . -> . .
  12190. l.r r.R
  12191. @end example
  12192. @item 2, 6, cclock
  12193. Rotate by 90 degrees counterclockwise, that is:
  12194. @example
  12195. L.R R.r
  12196. . . -> . .
  12197. l.r L.l
  12198. @end example
  12199. @item 3, 7, clock_flip
  12200. Rotate by 90 degrees clockwise and vertically flip, that is:
  12201. @example
  12202. L.R r.R
  12203. . . -> . .
  12204. l.r l.L
  12205. @end example
  12206. @end table
  12207. For values between 4-7, the transposition is only done if the input
  12208. video geometry is portrait and not landscape. These values are
  12209. deprecated, the @code{passthrough} option should be used instead.
  12210. Numerical values are deprecated, and should be dropped in favor of
  12211. symbolic constants.
  12212. @item passthrough
  12213. Do not apply the transposition if the input geometry matches the one
  12214. specified by the specified value. It accepts the following values:
  12215. @table @samp
  12216. @item none
  12217. Always apply transposition.
  12218. @item portrait
  12219. Preserve portrait geometry (when @var{height} >= @var{width}).
  12220. @item landscape
  12221. Preserve landscape geometry (when @var{width} >= @var{height}).
  12222. @end table
  12223. Default value is @code{none}.
  12224. @end table
  12225. For example to rotate by 90 degrees clockwise and preserve portrait
  12226. layout:
  12227. @example
  12228. transpose=dir=1:passthrough=portrait
  12229. @end example
  12230. The command above can also be specified as:
  12231. @example
  12232. transpose=1:portrait
  12233. @end example
  12234. @section trim
  12235. Trim the input so that the output contains one continuous subpart of the input.
  12236. It accepts the following parameters:
  12237. @table @option
  12238. @item start
  12239. Specify the time of the start of the kept section, i.e. the frame with the
  12240. timestamp @var{start} will be the first frame in the output.
  12241. @item end
  12242. Specify the time of the first frame that will be dropped, i.e. the frame
  12243. immediately preceding the one with the timestamp @var{end} will be the last
  12244. frame in the output.
  12245. @item start_pts
  12246. This is the same as @var{start}, except this option sets the start timestamp
  12247. in timebase units instead of seconds.
  12248. @item end_pts
  12249. This is the same as @var{end}, except this option sets the end timestamp
  12250. in timebase units instead of seconds.
  12251. @item duration
  12252. The maximum duration of the output in seconds.
  12253. @item start_frame
  12254. The number of the first frame that should be passed to the output.
  12255. @item end_frame
  12256. The number of the first frame that should be dropped.
  12257. @end table
  12258. @option{start}, @option{end}, and @option{duration} are expressed as time
  12259. duration specifications; see
  12260. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12261. for the accepted syntax.
  12262. Note that the first two sets of the start/end options and the @option{duration}
  12263. option look at the frame timestamp, while the _frame variants simply count the
  12264. frames that pass through the filter. Also note that this filter does not modify
  12265. the timestamps. If you wish for the output timestamps to start at zero, insert a
  12266. setpts filter after the trim filter.
  12267. If multiple start or end options are set, this filter tries to be greedy and
  12268. keep all the frames that match at least one of the specified constraints. To keep
  12269. only the part that matches all the constraints at once, chain multiple trim
  12270. filters.
  12271. The defaults are such that all the input is kept. So it is possible to set e.g.
  12272. just the end values to keep everything before the specified time.
  12273. Examples:
  12274. @itemize
  12275. @item
  12276. Drop everything except the second minute of input:
  12277. @example
  12278. ffmpeg -i INPUT -vf trim=60:120
  12279. @end example
  12280. @item
  12281. Keep only the first second:
  12282. @example
  12283. ffmpeg -i INPUT -vf trim=duration=1
  12284. @end example
  12285. @end itemize
  12286. @section unpremultiply
  12287. Apply alpha unpremultiply effect to input video stream using first plane
  12288. of second stream as alpha.
  12289. Both streams must have same dimensions and same pixel format.
  12290. The filter accepts the following option:
  12291. @table @option
  12292. @item planes
  12293. Set which planes will be processed, unprocessed planes will be copied.
  12294. By default value 0xf, all planes will be processed.
  12295. If the format has 1 or 2 components, then luma is bit 0.
  12296. If the format has 3 or 4 components:
  12297. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  12298. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  12299. If present, the alpha channel is always the last bit.
  12300. @item inplace
  12301. Do not require 2nd input for processing, instead use alpha plane from input stream.
  12302. @end table
  12303. @anchor{unsharp}
  12304. @section unsharp
  12305. Sharpen or blur the input video.
  12306. It accepts the following parameters:
  12307. @table @option
  12308. @item luma_msize_x, lx
  12309. Set the luma matrix horizontal size. It must be an odd integer between
  12310. 3 and 23. The default value is 5.
  12311. @item luma_msize_y, ly
  12312. Set the luma matrix vertical size. It must be an odd integer between 3
  12313. and 23. The default value is 5.
  12314. @item luma_amount, la
  12315. Set the luma effect strength. It must be a floating point number, reasonable
  12316. values lay between -1.5 and 1.5.
  12317. Negative values will blur the input video, while positive values will
  12318. sharpen it, a value of zero will disable the effect.
  12319. Default value is 1.0.
  12320. @item chroma_msize_x, cx
  12321. Set the chroma matrix horizontal size. It must be an odd integer
  12322. between 3 and 23. The default value is 5.
  12323. @item chroma_msize_y, cy
  12324. Set the chroma matrix vertical size. It must be an odd integer
  12325. between 3 and 23. The default value is 5.
  12326. @item chroma_amount, ca
  12327. Set the chroma effect strength. It must be a floating point number, reasonable
  12328. values lay between -1.5 and 1.5.
  12329. Negative values will blur the input video, while positive values will
  12330. sharpen it, a value of zero will disable the effect.
  12331. Default value is 0.0.
  12332. @end table
  12333. All parameters are optional and default to the equivalent of the
  12334. string '5:5:1.0:5:5:0.0'.
  12335. @subsection Examples
  12336. @itemize
  12337. @item
  12338. Apply strong luma sharpen effect:
  12339. @example
  12340. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  12341. @end example
  12342. @item
  12343. Apply a strong blur of both luma and chroma parameters:
  12344. @example
  12345. unsharp=7:7:-2:7:7:-2
  12346. @end example
  12347. @end itemize
  12348. @section uspp
  12349. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  12350. the image at several (or - in the case of @option{quality} level @code{8} - all)
  12351. shifts and average the results.
  12352. The way this differs from the behavior of spp is that uspp actually encodes &
  12353. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  12354. DCT similar to MJPEG.
  12355. The filter accepts the following options:
  12356. @table @option
  12357. @item quality
  12358. Set quality. This option defines the number of levels for averaging. It accepts
  12359. an integer in the range 0-8. If set to @code{0}, the filter will have no
  12360. effect. A value of @code{8} means the higher quality. For each increment of
  12361. that value the speed drops by a factor of approximately 2. Default value is
  12362. @code{3}.
  12363. @item qp
  12364. Force a constant quantization parameter. If not set, the filter will use the QP
  12365. from the video stream (if available).
  12366. @end table
  12367. @section vaguedenoiser
  12368. Apply a wavelet based denoiser.
  12369. It transforms each frame from the video input into the wavelet domain,
  12370. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  12371. the obtained coefficients. It does an inverse wavelet transform after.
  12372. Due to wavelet properties, it should give a nice smoothed result, and
  12373. reduced noise, without blurring picture features.
  12374. This filter accepts the following options:
  12375. @table @option
  12376. @item threshold
  12377. The filtering strength. The higher, the more filtered the video will be.
  12378. Hard thresholding can use a higher threshold than soft thresholding
  12379. before the video looks overfiltered. Default value is 2.
  12380. @item method
  12381. The filtering method the filter will use.
  12382. It accepts the following values:
  12383. @table @samp
  12384. @item hard
  12385. All values under the threshold will be zeroed.
  12386. @item soft
  12387. All values under the threshold will be zeroed. All values above will be
  12388. reduced by the threshold.
  12389. @item garrote
  12390. Scales or nullifies coefficients - intermediary between (more) soft and
  12391. (less) hard thresholding.
  12392. @end table
  12393. Default is garrote.
  12394. @item nsteps
  12395. Number of times, the wavelet will decompose the picture. Picture can't
  12396. be decomposed beyond a particular point (typically, 8 for a 640x480
  12397. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  12398. @item percent
  12399. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  12400. @item planes
  12401. A list of the planes to process. By default all planes are processed.
  12402. @end table
  12403. @section vectorscope
  12404. Display 2 color component values in the two dimensional graph (which is called
  12405. a vectorscope).
  12406. This filter accepts the following options:
  12407. @table @option
  12408. @item mode, m
  12409. Set vectorscope mode.
  12410. It accepts the following values:
  12411. @table @samp
  12412. @item gray
  12413. Gray values are displayed on graph, higher brightness means more pixels have
  12414. same component color value on location in graph. This is the default mode.
  12415. @item color
  12416. Gray values are displayed on graph. Surrounding pixels values which are not
  12417. present in video frame are drawn in gradient of 2 color components which are
  12418. set by option @code{x} and @code{y}. The 3rd color component is static.
  12419. @item color2
  12420. Actual color components values present in video frame are displayed on graph.
  12421. @item color3
  12422. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  12423. on graph increases value of another color component, which is luminance by
  12424. default values of @code{x} and @code{y}.
  12425. @item color4
  12426. Actual colors present in video frame are displayed on graph. If two different
  12427. colors map to same position on graph then color with higher value of component
  12428. not present in graph is picked.
  12429. @item color5
  12430. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  12431. component picked from radial gradient.
  12432. @end table
  12433. @item x
  12434. Set which color component will be represented on X-axis. Default is @code{1}.
  12435. @item y
  12436. Set which color component will be represented on Y-axis. Default is @code{2}.
  12437. @item intensity, i
  12438. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  12439. of color component which represents frequency of (X, Y) location in graph.
  12440. @item envelope, e
  12441. @table @samp
  12442. @item none
  12443. No envelope, this is default.
  12444. @item instant
  12445. Instant envelope, even darkest single pixel will be clearly highlighted.
  12446. @item peak
  12447. Hold maximum and minimum values presented in graph over time. This way you
  12448. can still spot out of range values without constantly looking at vectorscope.
  12449. @item peak+instant
  12450. Peak and instant envelope combined together.
  12451. @end table
  12452. @item graticule, g
  12453. Set what kind of graticule to draw.
  12454. @table @samp
  12455. @item none
  12456. @item green
  12457. @item color
  12458. @end table
  12459. @item opacity, o
  12460. Set graticule opacity.
  12461. @item flags, f
  12462. Set graticule flags.
  12463. @table @samp
  12464. @item white
  12465. Draw graticule for white point.
  12466. @item black
  12467. Draw graticule for black point.
  12468. @item name
  12469. Draw color points short names.
  12470. @end table
  12471. @item bgopacity, b
  12472. Set background opacity.
  12473. @item lthreshold, l
  12474. Set low threshold for color component not represented on X or Y axis.
  12475. Values lower than this value will be ignored. Default is 0.
  12476. Note this value is multiplied with actual max possible value one pixel component
  12477. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  12478. is 0.1 * 255 = 25.
  12479. @item hthreshold, h
  12480. Set high threshold for color component not represented on X or Y axis.
  12481. Values higher than this value will be ignored. Default is 1.
  12482. Note this value is multiplied with actual max possible value one pixel component
  12483. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  12484. is 0.9 * 255 = 230.
  12485. @item colorspace, c
  12486. Set what kind of colorspace to use when drawing graticule.
  12487. @table @samp
  12488. @item auto
  12489. @item 601
  12490. @item 709
  12491. @end table
  12492. Default is auto.
  12493. @end table
  12494. @anchor{vidstabdetect}
  12495. @section vidstabdetect
  12496. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  12497. @ref{vidstabtransform} for pass 2.
  12498. This filter generates a file with relative translation and rotation
  12499. transform information about subsequent frames, which is then used by
  12500. the @ref{vidstabtransform} filter.
  12501. To enable compilation of this filter you need to configure FFmpeg with
  12502. @code{--enable-libvidstab}.
  12503. This filter accepts the following options:
  12504. @table @option
  12505. @item result
  12506. Set the path to the file used to write the transforms information.
  12507. Default value is @file{transforms.trf}.
  12508. @item shakiness
  12509. Set how shaky the video is and how quick the camera is. It accepts an
  12510. integer in the range 1-10, a value of 1 means little shakiness, a
  12511. value of 10 means strong shakiness. Default value is 5.
  12512. @item accuracy
  12513. Set the accuracy of the detection process. It must be a value in the
  12514. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  12515. accuracy. Default value is 15.
  12516. @item stepsize
  12517. Set stepsize of the search process. The region around minimum is
  12518. scanned with 1 pixel resolution. Default value is 6.
  12519. @item mincontrast
  12520. Set minimum contrast. Below this value a local measurement field is
  12521. discarded. Must be a floating point value in the range 0-1. Default
  12522. value is 0.3.
  12523. @item tripod
  12524. Set reference frame number for tripod mode.
  12525. If enabled, the motion of the frames is compared to a reference frame
  12526. in the filtered stream, identified by the specified number. The idea
  12527. is to compensate all movements in a more-or-less static scene and keep
  12528. the camera view absolutely still.
  12529. If set to 0, it is disabled. The frames are counted starting from 1.
  12530. @item show
  12531. Show fields and transforms in the resulting frames. It accepts an
  12532. integer in the range 0-2. Default value is 0, which disables any
  12533. visualization.
  12534. @end table
  12535. @subsection Examples
  12536. @itemize
  12537. @item
  12538. Use default values:
  12539. @example
  12540. vidstabdetect
  12541. @end example
  12542. @item
  12543. Analyze strongly shaky movie and put the results in file
  12544. @file{mytransforms.trf}:
  12545. @example
  12546. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  12547. @end example
  12548. @item
  12549. Visualize the result of internal transformations in the resulting
  12550. video:
  12551. @example
  12552. vidstabdetect=show=1
  12553. @end example
  12554. @item
  12555. Analyze a video with medium shakiness using @command{ffmpeg}:
  12556. @example
  12557. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  12558. @end example
  12559. @end itemize
  12560. @anchor{vidstabtransform}
  12561. @section vidstabtransform
  12562. Video stabilization/deshaking: pass 2 of 2,
  12563. see @ref{vidstabdetect} for pass 1.
  12564. Read a file with transform information for each frame and
  12565. apply/compensate them. Together with the @ref{vidstabdetect}
  12566. filter this can be used to deshake videos. See also
  12567. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  12568. the @ref{unsharp} filter, see below.
  12569. To enable compilation of this filter you need to configure FFmpeg with
  12570. @code{--enable-libvidstab}.
  12571. @subsection Options
  12572. @table @option
  12573. @item input
  12574. Set path to the file used to read the transforms. Default value is
  12575. @file{transforms.trf}.
  12576. @item smoothing
  12577. Set the number of frames (value*2 + 1) used for lowpass filtering the
  12578. camera movements. Default value is 10.
  12579. For example a number of 10 means that 21 frames are used (10 in the
  12580. past and 10 in the future) to smoothen the motion in the video. A
  12581. larger value leads to a smoother video, but limits the acceleration of
  12582. the camera (pan/tilt movements). 0 is a special case where a static
  12583. camera is simulated.
  12584. @item optalgo
  12585. Set the camera path optimization algorithm.
  12586. Accepted values are:
  12587. @table @samp
  12588. @item gauss
  12589. gaussian kernel low-pass filter on camera motion (default)
  12590. @item avg
  12591. averaging on transformations
  12592. @end table
  12593. @item maxshift
  12594. Set maximal number of pixels to translate frames. Default value is -1,
  12595. meaning no limit.
  12596. @item maxangle
  12597. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  12598. value is -1, meaning no limit.
  12599. @item crop
  12600. Specify how to deal with borders that may be visible due to movement
  12601. compensation.
  12602. Available values are:
  12603. @table @samp
  12604. @item keep
  12605. keep image information from previous frame (default)
  12606. @item black
  12607. fill the border black
  12608. @end table
  12609. @item invert
  12610. Invert transforms if set to 1. Default value is 0.
  12611. @item relative
  12612. Consider transforms as relative to previous frame if set to 1,
  12613. absolute if set to 0. Default value is 0.
  12614. @item zoom
  12615. Set percentage to zoom. A positive value will result in a zoom-in
  12616. effect, a negative value in a zoom-out effect. Default value is 0 (no
  12617. zoom).
  12618. @item optzoom
  12619. Set optimal zooming to avoid borders.
  12620. Accepted values are:
  12621. @table @samp
  12622. @item 0
  12623. disabled
  12624. @item 1
  12625. optimal static zoom value is determined (only very strong movements
  12626. will lead to visible borders) (default)
  12627. @item 2
  12628. optimal adaptive zoom value is determined (no borders will be
  12629. visible), see @option{zoomspeed}
  12630. @end table
  12631. Note that the value given at zoom is added to the one calculated here.
  12632. @item zoomspeed
  12633. Set percent to zoom maximally each frame (enabled when
  12634. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  12635. 0.25.
  12636. @item interpol
  12637. Specify type of interpolation.
  12638. Available values are:
  12639. @table @samp
  12640. @item no
  12641. no interpolation
  12642. @item linear
  12643. linear only horizontal
  12644. @item bilinear
  12645. linear in both directions (default)
  12646. @item bicubic
  12647. cubic in both directions (slow)
  12648. @end table
  12649. @item tripod
  12650. Enable virtual tripod mode if set to 1, which is equivalent to
  12651. @code{relative=0:smoothing=0}. Default value is 0.
  12652. Use also @code{tripod} option of @ref{vidstabdetect}.
  12653. @item debug
  12654. Increase log verbosity if set to 1. Also the detected global motions
  12655. are written to the temporary file @file{global_motions.trf}. Default
  12656. value is 0.
  12657. @end table
  12658. @subsection Examples
  12659. @itemize
  12660. @item
  12661. Use @command{ffmpeg} for a typical stabilization with default values:
  12662. @example
  12663. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  12664. @end example
  12665. Note the use of the @ref{unsharp} filter which is always recommended.
  12666. @item
  12667. Zoom in a bit more and load transform data from a given file:
  12668. @example
  12669. vidstabtransform=zoom=5:input="mytransforms.trf"
  12670. @end example
  12671. @item
  12672. Smoothen the video even more:
  12673. @example
  12674. vidstabtransform=smoothing=30
  12675. @end example
  12676. @end itemize
  12677. @section vflip
  12678. Flip the input video vertically.
  12679. For example, to vertically flip a video with @command{ffmpeg}:
  12680. @example
  12681. ffmpeg -i in.avi -vf "vflip" out.avi
  12682. @end example
  12683. @section vfrdet
  12684. Detect variable frame rate video.
  12685. This filter tries to detect if the input is variable or constant frame rate.
  12686. At end it will output number of frames detected as having variable delta pts,
  12687. and ones with constant delta pts.
  12688. If there was frames with variable delta, than it will also show min and max delta
  12689. encountered.
  12690. @anchor{vignette}
  12691. @section vignette
  12692. Make or reverse a natural vignetting effect.
  12693. The filter accepts the following options:
  12694. @table @option
  12695. @item angle, a
  12696. Set lens angle expression as a number of radians.
  12697. The value is clipped in the @code{[0,PI/2]} range.
  12698. Default value: @code{"PI/5"}
  12699. @item x0
  12700. @item y0
  12701. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  12702. by default.
  12703. @item mode
  12704. Set forward/backward mode.
  12705. Available modes are:
  12706. @table @samp
  12707. @item forward
  12708. The larger the distance from the central point, the darker the image becomes.
  12709. @item backward
  12710. The larger the distance from the central point, the brighter the image becomes.
  12711. This can be used to reverse a vignette effect, though there is no automatic
  12712. detection to extract the lens @option{angle} and other settings (yet). It can
  12713. also be used to create a burning effect.
  12714. @end table
  12715. Default value is @samp{forward}.
  12716. @item eval
  12717. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  12718. It accepts the following values:
  12719. @table @samp
  12720. @item init
  12721. Evaluate expressions only once during the filter initialization.
  12722. @item frame
  12723. Evaluate expressions for each incoming frame. This is way slower than the
  12724. @samp{init} mode since it requires all the scalers to be re-computed, but it
  12725. allows advanced dynamic expressions.
  12726. @end table
  12727. Default value is @samp{init}.
  12728. @item dither
  12729. Set dithering to reduce the circular banding effects. Default is @code{1}
  12730. (enabled).
  12731. @item aspect
  12732. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  12733. Setting this value to the SAR of the input will make a rectangular vignetting
  12734. following the dimensions of the video.
  12735. Default is @code{1/1}.
  12736. @end table
  12737. @subsection Expressions
  12738. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  12739. following parameters.
  12740. @table @option
  12741. @item w
  12742. @item h
  12743. input width and height
  12744. @item n
  12745. the number of input frame, starting from 0
  12746. @item pts
  12747. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  12748. @var{TB} units, NAN if undefined
  12749. @item r
  12750. frame rate of the input video, NAN if the input frame rate is unknown
  12751. @item t
  12752. the PTS (Presentation TimeStamp) of the filtered video frame,
  12753. expressed in seconds, NAN if undefined
  12754. @item tb
  12755. time base of the input video
  12756. @end table
  12757. @subsection Examples
  12758. @itemize
  12759. @item
  12760. Apply simple strong vignetting effect:
  12761. @example
  12762. vignette=PI/4
  12763. @end example
  12764. @item
  12765. Make a flickering vignetting:
  12766. @example
  12767. vignette='PI/4+random(1)*PI/50':eval=frame
  12768. @end example
  12769. @end itemize
  12770. @section vmafmotion
  12771. Obtain the average vmaf motion score of a video.
  12772. It is one of the component filters of VMAF.
  12773. The obtained average motion score is printed through the logging system.
  12774. In the below example the input file @file{ref.mpg} is being processed and score
  12775. is computed.
  12776. @example
  12777. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  12778. @end example
  12779. @section vstack
  12780. Stack input videos vertically.
  12781. All streams must be of same pixel format and of same width.
  12782. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  12783. to create same output.
  12784. The filter accept the following option:
  12785. @table @option
  12786. @item inputs
  12787. Set number of input streams. Default is 2.
  12788. @item shortest
  12789. If set to 1, force the output to terminate when the shortest input
  12790. terminates. Default value is 0.
  12791. @end table
  12792. @section w3fdif
  12793. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  12794. Deinterlacing Filter").
  12795. Based on the process described by Martin Weston for BBC R&D, and
  12796. implemented based on the de-interlace algorithm written by Jim
  12797. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  12798. uses filter coefficients calculated by BBC R&D.
  12799. There are two sets of filter coefficients, so called "simple":
  12800. and "complex". Which set of filter coefficients is used can
  12801. be set by passing an optional parameter:
  12802. @table @option
  12803. @item filter
  12804. Set the interlacing filter coefficients. Accepts one of the following values:
  12805. @table @samp
  12806. @item simple
  12807. Simple filter coefficient set.
  12808. @item complex
  12809. More-complex filter coefficient set.
  12810. @end table
  12811. Default value is @samp{complex}.
  12812. @item deint
  12813. Specify which frames to deinterlace. Accept one of the following values:
  12814. @table @samp
  12815. @item all
  12816. Deinterlace all frames,
  12817. @item interlaced
  12818. Only deinterlace frames marked as interlaced.
  12819. @end table
  12820. Default value is @samp{all}.
  12821. @end table
  12822. @section waveform
  12823. Video waveform monitor.
  12824. The waveform monitor plots color component intensity. By default luminance
  12825. only. Each column of the waveform corresponds to a column of pixels in the
  12826. source video.
  12827. It accepts the following options:
  12828. @table @option
  12829. @item mode, m
  12830. Can be either @code{row}, or @code{column}. Default is @code{column}.
  12831. In row mode, the graph on the left side represents color component value 0 and
  12832. the right side represents value = 255. In column mode, the top side represents
  12833. color component value = 0 and bottom side represents value = 255.
  12834. @item intensity, i
  12835. Set intensity. Smaller values are useful to find out how many values of the same
  12836. luminance are distributed across input rows/columns.
  12837. Default value is @code{0.04}. Allowed range is [0, 1].
  12838. @item mirror, r
  12839. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  12840. In mirrored mode, higher values will be represented on the left
  12841. side for @code{row} mode and at the top for @code{column} mode. Default is
  12842. @code{1} (mirrored).
  12843. @item display, d
  12844. Set display mode.
  12845. It accepts the following values:
  12846. @table @samp
  12847. @item overlay
  12848. Presents information identical to that in the @code{parade}, except
  12849. that the graphs representing color components are superimposed directly
  12850. over one another.
  12851. This display mode makes it easier to spot relative differences or similarities
  12852. in overlapping areas of the color components that are supposed to be identical,
  12853. such as neutral whites, grays, or blacks.
  12854. @item stack
  12855. Display separate graph for the color components side by side in
  12856. @code{row} mode or one below the other in @code{column} mode.
  12857. @item parade
  12858. Display separate graph for the color components side by side in
  12859. @code{column} mode or one below the other in @code{row} mode.
  12860. Using this display mode makes it easy to spot color casts in the highlights
  12861. and shadows of an image, by comparing the contours of the top and the bottom
  12862. graphs of each waveform. Since whites, grays, and blacks are characterized
  12863. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  12864. should display three waveforms of roughly equal width/height. If not, the
  12865. correction is easy to perform by making level adjustments the three waveforms.
  12866. @end table
  12867. Default is @code{stack}.
  12868. @item components, c
  12869. Set which color components to display. Default is 1, which means only luminance
  12870. or red color component if input is in RGB colorspace. If is set for example to
  12871. 7 it will display all 3 (if) available color components.
  12872. @item envelope, e
  12873. @table @samp
  12874. @item none
  12875. No envelope, this is default.
  12876. @item instant
  12877. Instant envelope, minimum and maximum values presented in graph will be easily
  12878. visible even with small @code{step} value.
  12879. @item peak
  12880. Hold minimum and maximum values presented in graph across time. This way you
  12881. can still spot out of range values without constantly looking at waveforms.
  12882. @item peak+instant
  12883. Peak and instant envelope combined together.
  12884. @end table
  12885. @item filter, f
  12886. @table @samp
  12887. @item lowpass
  12888. No filtering, this is default.
  12889. @item flat
  12890. Luma and chroma combined together.
  12891. @item aflat
  12892. Similar as above, but shows difference between blue and red chroma.
  12893. @item xflat
  12894. Similar as above, but use different colors.
  12895. @item chroma
  12896. Displays only chroma.
  12897. @item color
  12898. Displays actual color value on waveform.
  12899. @item acolor
  12900. Similar as above, but with luma showing frequency of chroma values.
  12901. @end table
  12902. @item graticule, g
  12903. Set which graticule to display.
  12904. @table @samp
  12905. @item none
  12906. Do not display graticule.
  12907. @item green
  12908. Display green graticule showing legal broadcast ranges.
  12909. @item orange
  12910. Display orange graticule showing legal broadcast ranges.
  12911. @end table
  12912. @item opacity, o
  12913. Set graticule opacity.
  12914. @item flags, fl
  12915. Set graticule flags.
  12916. @table @samp
  12917. @item numbers
  12918. Draw numbers above lines. By default enabled.
  12919. @item dots
  12920. Draw dots instead of lines.
  12921. @end table
  12922. @item scale, s
  12923. Set scale used for displaying graticule.
  12924. @table @samp
  12925. @item digital
  12926. @item millivolts
  12927. @item ire
  12928. @end table
  12929. Default is digital.
  12930. @item bgopacity, b
  12931. Set background opacity.
  12932. @end table
  12933. @section weave, doubleweave
  12934. The @code{weave} takes a field-based video input and join
  12935. each two sequential fields into single frame, producing a new double
  12936. height clip with half the frame rate and half the frame count.
  12937. The @code{doubleweave} works same as @code{weave} but without
  12938. halving frame rate and frame count.
  12939. It accepts the following option:
  12940. @table @option
  12941. @item first_field
  12942. Set first field. Available values are:
  12943. @table @samp
  12944. @item top, t
  12945. Set the frame as top-field-first.
  12946. @item bottom, b
  12947. Set the frame as bottom-field-first.
  12948. @end table
  12949. @end table
  12950. @subsection Examples
  12951. @itemize
  12952. @item
  12953. Interlace video using @ref{select} and @ref{separatefields} filter:
  12954. @example
  12955. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  12956. @end example
  12957. @end itemize
  12958. @section xbr
  12959. Apply the xBR high-quality magnification filter which is designed for pixel
  12960. art. It follows a set of edge-detection rules, see
  12961. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  12962. It accepts the following option:
  12963. @table @option
  12964. @item n
  12965. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  12966. @code{3xBR} and @code{4} for @code{4xBR}.
  12967. Default is @code{3}.
  12968. @end table
  12969. @anchor{yadif}
  12970. @section yadif
  12971. Deinterlace the input video ("yadif" means "yet another deinterlacing
  12972. filter").
  12973. It accepts the following parameters:
  12974. @table @option
  12975. @item mode
  12976. The interlacing mode to adopt. It accepts one of the following values:
  12977. @table @option
  12978. @item 0, send_frame
  12979. Output one frame for each frame.
  12980. @item 1, send_field
  12981. Output one frame for each field.
  12982. @item 2, send_frame_nospatial
  12983. Like @code{send_frame}, but it skips the spatial interlacing check.
  12984. @item 3, send_field_nospatial
  12985. Like @code{send_field}, but it skips the spatial interlacing check.
  12986. @end table
  12987. The default value is @code{send_frame}.
  12988. @item parity
  12989. The picture field parity assumed for the input interlaced video. It accepts one
  12990. of the following values:
  12991. @table @option
  12992. @item 0, tff
  12993. Assume the top field is first.
  12994. @item 1, bff
  12995. Assume the bottom field is first.
  12996. @item -1, auto
  12997. Enable automatic detection of field parity.
  12998. @end table
  12999. The default value is @code{auto}.
  13000. If the interlacing is unknown or the decoder does not export this information,
  13001. top field first will be assumed.
  13002. @item deint
  13003. Specify which frames to deinterlace. Accept one of the following
  13004. values:
  13005. @table @option
  13006. @item 0, all
  13007. Deinterlace all frames.
  13008. @item 1, interlaced
  13009. Only deinterlace frames marked as interlaced.
  13010. @end table
  13011. The default value is @code{all}.
  13012. @end table
  13013. @section zoompan
  13014. Apply Zoom & Pan effect.
  13015. This filter accepts the following options:
  13016. @table @option
  13017. @item zoom, z
  13018. Set the zoom expression. Default is 1.
  13019. @item x
  13020. @item y
  13021. Set the x and y expression. Default is 0.
  13022. @item d
  13023. Set the duration expression in number of frames.
  13024. This sets for how many number of frames effect will last for
  13025. single input image.
  13026. @item s
  13027. Set the output image size, default is 'hd720'.
  13028. @item fps
  13029. Set the output frame rate, default is '25'.
  13030. @end table
  13031. Each expression can contain the following constants:
  13032. @table @option
  13033. @item in_w, iw
  13034. Input width.
  13035. @item in_h, ih
  13036. Input height.
  13037. @item out_w, ow
  13038. Output width.
  13039. @item out_h, oh
  13040. Output height.
  13041. @item in
  13042. Input frame count.
  13043. @item on
  13044. Output frame count.
  13045. @item x
  13046. @item y
  13047. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  13048. for current input frame.
  13049. @item px
  13050. @item py
  13051. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  13052. not yet such frame (first input frame).
  13053. @item zoom
  13054. Last calculated zoom from 'z' expression for current input frame.
  13055. @item pzoom
  13056. Last calculated zoom of last output frame of previous input frame.
  13057. @item duration
  13058. Number of output frames for current input frame. Calculated from 'd' expression
  13059. for each input frame.
  13060. @item pduration
  13061. number of output frames created for previous input frame
  13062. @item a
  13063. Rational number: input width / input height
  13064. @item sar
  13065. sample aspect ratio
  13066. @item dar
  13067. display aspect ratio
  13068. @end table
  13069. @subsection Examples
  13070. @itemize
  13071. @item
  13072. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  13073. @example
  13074. 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
  13075. @end example
  13076. @item
  13077. Zoom-in up to 1.5 and pan always at center of picture:
  13078. @example
  13079. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  13080. @end example
  13081. @item
  13082. Same as above but without pausing:
  13083. @example
  13084. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  13085. @end example
  13086. @end itemize
  13087. @anchor{zscale}
  13088. @section zscale
  13089. Scale (resize) the input video, using the z.lib library:
  13090. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  13091. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  13092. The zscale filter forces the output display aspect ratio to be the same
  13093. as the input, by changing the output sample aspect ratio.
  13094. If the input image format is different from the format requested by
  13095. the next filter, the zscale filter will convert the input to the
  13096. requested format.
  13097. @subsection Options
  13098. The filter accepts the following options.
  13099. @table @option
  13100. @item width, w
  13101. @item height, h
  13102. Set the output video dimension expression. Default value is the input
  13103. dimension.
  13104. If the @var{width} or @var{w} value is 0, the input width is used for
  13105. the output. If the @var{height} or @var{h} value is 0, the input height
  13106. is used for the output.
  13107. If one and only one of the values is -n with n >= 1, the zscale filter
  13108. will use a value that maintains the aspect ratio of the input image,
  13109. calculated from the other specified dimension. After that it will,
  13110. however, make sure that the calculated dimension is divisible by n and
  13111. adjust the value if necessary.
  13112. If both values are -n with n >= 1, the behavior will be identical to
  13113. both values being set to 0 as previously detailed.
  13114. See below for the list of accepted constants for use in the dimension
  13115. expression.
  13116. @item size, s
  13117. Set the video size. For the syntax of this option, check the
  13118. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13119. @item dither, d
  13120. Set the dither type.
  13121. Possible values are:
  13122. @table @var
  13123. @item none
  13124. @item ordered
  13125. @item random
  13126. @item error_diffusion
  13127. @end table
  13128. Default is none.
  13129. @item filter, f
  13130. Set the resize filter type.
  13131. Possible values are:
  13132. @table @var
  13133. @item point
  13134. @item bilinear
  13135. @item bicubic
  13136. @item spline16
  13137. @item spline36
  13138. @item lanczos
  13139. @end table
  13140. Default is bilinear.
  13141. @item range, r
  13142. Set the color range.
  13143. Possible values are:
  13144. @table @var
  13145. @item input
  13146. @item limited
  13147. @item full
  13148. @end table
  13149. Default is same as input.
  13150. @item primaries, p
  13151. Set the color primaries.
  13152. Possible values are:
  13153. @table @var
  13154. @item input
  13155. @item 709
  13156. @item unspecified
  13157. @item 170m
  13158. @item 240m
  13159. @item 2020
  13160. @end table
  13161. Default is same as input.
  13162. @item transfer, t
  13163. Set the transfer characteristics.
  13164. Possible values are:
  13165. @table @var
  13166. @item input
  13167. @item 709
  13168. @item unspecified
  13169. @item 601
  13170. @item linear
  13171. @item 2020_10
  13172. @item 2020_12
  13173. @item smpte2084
  13174. @item iec61966-2-1
  13175. @item arib-std-b67
  13176. @end table
  13177. Default is same as input.
  13178. @item matrix, m
  13179. Set the colorspace matrix.
  13180. Possible value are:
  13181. @table @var
  13182. @item input
  13183. @item 709
  13184. @item unspecified
  13185. @item 470bg
  13186. @item 170m
  13187. @item 2020_ncl
  13188. @item 2020_cl
  13189. @end table
  13190. Default is same as input.
  13191. @item rangein, rin
  13192. Set the input color range.
  13193. Possible values are:
  13194. @table @var
  13195. @item input
  13196. @item limited
  13197. @item full
  13198. @end table
  13199. Default is same as input.
  13200. @item primariesin, pin
  13201. Set the input color primaries.
  13202. Possible values are:
  13203. @table @var
  13204. @item input
  13205. @item 709
  13206. @item unspecified
  13207. @item 170m
  13208. @item 240m
  13209. @item 2020
  13210. @end table
  13211. Default is same as input.
  13212. @item transferin, tin
  13213. Set the input transfer characteristics.
  13214. Possible values are:
  13215. @table @var
  13216. @item input
  13217. @item 709
  13218. @item unspecified
  13219. @item 601
  13220. @item linear
  13221. @item 2020_10
  13222. @item 2020_12
  13223. @end table
  13224. Default is same as input.
  13225. @item matrixin, min
  13226. Set the input colorspace matrix.
  13227. Possible value are:
  13228. @table @var
  13229. @item input
  13230. @item 709
  13231. @item unspecified
  13232. @item 470bg
  13233. @item 170m
  13234. @item 2020_ncl
  13235. @item 2020_cl
  13236. @end table
  13237. @item chromal, c
  13238. Set the output chroma location.
  13239. Possible values are:
  13240. @table @var
  13241. @item input
  13242. @item left
  13243. @item center
  13244. @item topleft
  13245. @item top
  13246. @item bottomleft
  13247. @item bottom
  13248. @end table
  13249. @item chromalin, cin
  13250. Set the input chroma location.
  13251. Possible values are:
  13252. @table @var
  13253. @item input
  13254. @item left
  13255. @item center
  13256. @item topleft
  13257. @item top
  13258. @item bottomleft
  13259. @item bottom
  13260. @end table
  13261. @item npl
  13262. Set the nominal peak luminance.
  13263. @end table
  13264. The values of the @option{w} and @option{h} options are expressions
  13265. containing the following constants:
  13266. @table @var
  13267. @item in_w
  13268. @item in_h
  13269. The input width and height
  13270. @item iw
  13271. @item ih
  13272. These are the same as @var{in_w} and @var{in_h}.
  13273. @item out_w
  13274. @item out_h
  13275. The output (scaled) width and height
  13276. @item ow
  13277. @item oh
  13278. These are the same as @var{out_w} and @var{out_h}
  13279. @item a
  13280. The same as @var{iw} / @var{ih}
  13281. @item sar
  13282. input sample aspect ratio
  13283. @item dar
  13284. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  13285. @item hsub
  13286. @item vsub
  13287. horizontal and vertical input chroma subsample values. For example for the
  13288. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13289. @item ohsub
  13290. @item ovsub
  13291. horizontal and vertical output chroma subsample values. For example for the
  13292. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13293. @end table
  13294. @table @option
  13295. @end table
  13296. @c man end VIDEO FILTERS
  13297. @chapter Video Sources
  13298. @c man begin VIDEO SOURCES
  13299. Below is a description of the currently available video sources.
  13300. @section buffer
  13301. Buffer video frames, and make them available to the filter chain.
  13302. This source is mainly intended for a programmatic use, in particular
  13303. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  13304. It accepts the following parameters:
  13305. @table @option
  13306. @item video_size
  13307. Specify the size (width and height) of the buffered video frames. For the
  13308. syntax of this option, check the
  13309. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13310. @item width
  13311. The input video width.
  13312. @item height
  13313. The input video height.
  13314. @item pix_fmt
  13315. A string representing the pixel format of the buffered video frames.
  13316. It may be a number corresponding to a pixel format, or a pixel format
  13317. name.
  13318. @item time_base
  13319. Specify the timebase assumed by the timestamps of the buffered frames.
  13320. @item frame_rate
  13321. Specify the frame rate expected for the video stream.
  13322. @item pixel_aspect, sar
  13323. The sample (pixel) aspect ratio of the input video.
  13324. @item sws_param
  13325. Specify the optional parameters to be used for the scale filter which
  13326. is automatically inserted when an input change is detected in the
  13327. input size or format.
  13328. @item hw_frames_ctx
  13329. When using a hardware pixel format, this should be a reference to an
  13330. AVHWFramesContext describing input frames.
  13331. @end table
  13332. For example:
  13333. @example
  13334. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  13335. @end example
  13336. will instruct the source to accept video frames with size 320x240 and
  13337. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  13338. square pixels (1:1 sample aspect ratio).
  13339. Since the pixel format with name "yuv410p" corresponds to the number 6
  13340. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  13341. this example corresponds to:
  13342. @example
  13343. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  13344. @end example
  13345. Alternatively, the options can be specified as a flat string, but this
  13346. syntax is deprecated:
  13347. @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}]
  13348. @section cellauto
  13349. Create a pattern generated by an elementary cellular automaton.
  13350. The initial state of the cellular automaton can be defined through the
  13351. @option{filename} and @option{pattern} options. If such options are
  13352. not specified an initial state is created randomly.
  13353. At each new frame a new row in the video is filled with the result of
  13354. the cellular automaton next generation. The behavior when the whole
  13355. frame is filled is defined by the @option{scroll} option.
  13356. This source accepts the following options:
  13357. @table @option
  13358. @item filename, f
  13359. Read the initial cellular automaton state, i.e. the starting row, from
  13360. the specified file.
  13361. In the file, each non-whitespace character is considered an alive
  13362. cell, a newline will terminate the row, and further characters in the
  13363. file will be ignored.
  13364. @item pattern, p
  13365. Read the initial cellular automaton state, i.e. the starting row, from
  13366. the specified string.
  13367. Each non-whitespace character in the string is considered an alive
  13368. cell, a newline will terminate the row, and further characters in the
  13369. string will be ignored.
  13370. @item rate, r
  13371. Set the video rate, that is the number of frames generated per second.
  13372. Default is 25.
  13373. @item random_fill_ratio, ratio
  13374. Set the random fill ratio for the initial cellular automaton row. It
  13375. is a floating point number value ranging from 0 to 1, defaults to
  13376. 1/PHI.
  13377. This option is ignored when a file or a pattern is specified.
  13378. @item random_seed, seed
  13379. Set the seed for filling randomly the initial row, must be an integer
  13380. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13381. set to -1, the filter will try to use a good random seed on a best
  13382. effort basis.
  13383. @item rule
  13384. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  13385. Default value is 110.
  13386. @item size, s
  13387. Set the size of the output video. For the syntax of this option, check the
  13388. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13389. If @option{filename} or @option{pattern} is specified, the size is set
  13390. by default to the width of the specified initial state row, and the
  13391. height is set to @var{width} * PHI.
  13392. If @option{size} is set, it must contain the width of the specified
  13393. pattern string, and the specified pattern will be centered in the
  13394. larger row.
  13395. If a filename or a pattern string is not specified, the size value
  13396. defaults to "320x518" (used for a randomly generated initial state).
  13397. @item scroll
  13398. If set to 1, scroll the output upward when all the rows in the output
  13399. have been already filled. If set to 0, the new generated row will be
  13400. written over the top row just after the bottom row is filled.
  13401. Defaults to 1.
  13402. @item start_full, full
  13403. If set to 1, completely fill the output with generated rows before
  13404. outputting the first frame.
  13405. This is the default behavior, for disabling set the value to 0.
  13406. @item stitch
  13407. If set to 1, stitch the left and right row edges together.
  13408. This is the default behavior, for disabling set the value to 0.
  13409. @end table
  13410. @subsection Examples
  13411. @itemize
  13412. @item
  13413. Read the initial state from @file{pattern}, and specify an output of
  13414. size 200x400.
  13415. @example
  13416. cellauto=f=pattern:s=200x400
  13417. @end example
  13418. @item
  13419. Generate a random initial row with a width of 200 cells, with a fill
  13420. ratio of 2/3:
  13421. @example
  13422. cellauto=ratio=2/3:s=200x200
  13423. @end example
  13424. @item
  13425. Create a pattern generated by rule 18 starting by a single alive cell
  13426. centered on an initial row with width 100:
  13427. @example
  13428. cellauto=p=@@:s=100x400:full=0:rule=18
  13429. @end example
  13430. @item
  13431. Specify a more elaborated initial pattern:
  13432. @example
  13433. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  13434. @end example
  13435. @end itemize
  13436. @anchor{coreimagesrc}
  13437. @section coreimagesrc
  13438. Video source generated on GPU using Apple's CoreImage API on OSX.
  13439. This video source is a specialized version of the @ref{coreimage} video filter.
  13440. Use a core image generator at the beginning of the applied filterchain to
  13441. generate the content.
  13442. The coreimagesrc video source accepts the following options:
  13443. @table @option
  13444. @item list_generators
  13445. List all available generators along with all their respective options as well as
  13446. possible minimum and maximum values along with the default values.
  13447. @example
  13448. list_generators=true
  13449. @end example
  13450. @item size, s
  13451. Specify the size of the sourced video. For the syntax of this option, check the
  13452. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13453. The default value is @code{320x240}.
  13454. @item rate, r
  13455. Specify the frame rate of the sourced video, as the number of frames
  13456. generated per second. It has to be a string in the format
  13457. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13458. number or a valid video frame rate abbreviation. The default value is
  13459. "25".
  13460. @item sar
  13461. Set the sample aspect ratio of the sourced video.
  13462. @item duration, d
  13463. Set the duration of the sourced video. See
  13464. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13465. for the accepted syntax.
  13466. If not specified, or the expressed duration is negative, the video is
  13467. supposed to be generated forever.
  13468. @end table
  13469. Additionally, all options of the @ref{coreimage} video filter are accepted.
  13470. A complete filterchain can be used for further processing of the
  13471. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  13472. and examples for details.
  13473. @subsection Examples
  13474. @itemize
  13475. @item
  13476. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  13477. given as complete and escaped command-line for Apple's standard bash shell:
  13478. @example
  13479. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  13480. @end example
  13481. This example is equivalent to the QRCode example of @ref{coreimage} without the
  13482. need for a nullsrc video source.
  13483. @end itemize
  13484. @section mandelbrot
  13485. Generate a Mandelbrot set fractal, and progressively zoom towards the
  13486. point specified with @var{start_x} and @var{start_y}.
  13487. This source accepts the following options:
  13488. @table @option
  13489. @item end_pts
  13490. Set the terminal pts value. Default value is 400.
  13491. @item end_scale
  13492. Set the terminal scale value.
  13493. Must be a floating point value. Default value is 0.3.
  13494. @item inner
  13495. Set the inner coloring mode, that is the algorithm used to draw the
  13496. Mandelbrot fractal internal region.
  13497. It shall assume one of the following values:
  13498. @table @option
  13499. @item black
  13500. Set black mode.
  13501. @item convergence
  13502. Show time until convergence.
  13503. @item mincol
  13504. Set color based on point closest to the origin of the iterations.
  13505. @item period
  13506. Set period mode.
  13507. @end table
  13508. Default value is @var{mincol}.
  13509. @item bailout
  13510. Set the bailout value. Default value is 10.0.
  13511. @item maxiter
  13512. Set the maximum of iterations performed by the rendering
  13513. algorithm. Default value is 7189.
  13514. @item outer
  13515. Set outer coloring mode.
  13516. It shall assume one of following values:
  13517. @table @option
  13518. @item iteration_count
  13519. Set iteration cound mode.
  13520. @item normalized_iteration_count
  13521. set normalized iteration count mode.
  13522. @end table
  13523. Default value is @var{normalized_iteration_count}.
  13524. @item rate, r
  13525. Set frame rate, expressed as number of frames per second. Default
  13526. value is "25".
  13527. @item size, s
  13528. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  13529. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  13530. @item start_scale
  13531. Set the initial scale value. Default value is 3.0.
  13532. @item start_x
  13533. Set the initial x position. Must be a floating point value between
  13534. -100 and 100. Default value is -0.743643887037158704752191506114774.
  13535. @item start_y
  13536. Set the initial y position. Must be a floating point value between
  13537. -100 and 100. Default value is -0.131825904205311970493132056385139.
  13538. @end table
  13539. @section mptestsrc
  13540. Generate various test patterns, as generated by the MPlayer test filter.
  13541. The size of the generated video is fixed, and is 256x256.
  13542. This source is useful in particular for testing encoding features.
  13543. This source accepts the following options:
  13544. @table @option
  13545. @item rate, r
  13546. Specify the frame rate of the sourced video, as the number of frames
  13547. generated per second. It has to be a string in the format
  13548. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13549. number or a valid video frame rate abbreviation. The default value is
  13550. "25".
  13551. @item duration, d
  13552. Set the duration of the sourced video. See
  13553. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13554. for the accepted syntax.
  13555. If not specified, or the expressed duration is negative, the video is
  13556. supposed to be generated forever.
  13557. @item test, t
  13558. Set the number or the name of the test to perform. Supported tests are:
  13559. @table @option
  13560. @item dc_luma
  13561. @item dc_chroma
  13562. @item freq_luma
  13563. @item freq_chroma
  13564. @item amp_luma
  13565. @item amp_chroma
  13566. @item cbp
  13567. @item mv
  13568. @item ring1
  13569. @item ring2
  13570. @item all
  13571. @end table
  13572. Default value is "all", which will cycle through the list of all tests.
  13573. @end table
  13574. Some examples:
  13575. @example
  13576. mptestsrc=t=dc_luma
  13577. @end example
  13578. will generate a "dc_luma" test pattern.
  13579. @section frei0r_src
  13580. Provide a frei0r source.
  13581. To enable compilation of this filter you need to install the frei0r
  13582. header and configure FFmpeg with @code{--enable-frei0r}.
  13583. This source accepts the following parameters:
  13584. @table @option
  13585. @item size
  13586. The size of the video to generate. For the syntax of this option, check the
  13587. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13588. @item framerate
  13589. The framerate of the generated video. It may be a string of the form
  13590. @var{num}/@var{den} or a frame rate abbreviation.
  13591. @item filter_name
  13592. The name to the frei0r source to load. For more information regarding frei0r and
  13593. how to set the parameters, read the @ref{frei0r} section in the video filters
  13594. documentation.
  13595. @item filter_params
  13596. A '|'-separated list of parameters to pass to the frei0r source.
  13597. @end table
  13598. For example, to generate a frei0r partik0l source with size 200x200
  13599. and frame rate 10 which is overlaid on the overlay filter main input:
  13600. @example
  13601. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  13602. @end example
  13603. @section life
  13604. Generate a life pattern.
  13605. This source is based on a generalization of John Conway's life game.
  13606. The sourced input represents a life grid, each pixel represents a cell
  13607. which can be in one of two possible states, alive or dead. Every cell
  13608. interacts with its eight neighbours, which are the cells that are
  13609. horizontally, vertically, or diagonally adjacent.
  13610. At each interaction the grid evolves according to the adopted rule,
  13611. which specifies the number of neighbor alive cells which will make a
  13612. cell stay alive or born. The @option{rule} option allows one to specify
  13613. the rule to adopt.
  13614. This source accepts the following options:
  13615. @table @option
  13616. @item filename, f
  13617. Set the file from which to read the initial grid state. In the file,
  13618. each non-whitespace character is considered an alive cell, and newline
  13619. is used to delimit the end of each row.
  13620. If this option is not specified, the initial grid is generated
  13621. randomly.
  13622. @item rate, r
  13623. Set the video rate, that is the number of frames generated per second.
  13624. Default is 25.
  13625. @item random_fill_ratio, ratio
  13626. Set the random fill ratio for the initial random grid. It is a
  13627. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  13628. It is ignored when a file is specified.
  13629. @item random_seed, seed
  13630. Set the seed for filling the initial random grid, must be an integer
  13631. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13632. set to -1, the filter will try to use a good random seed on a best
  13633. effort basis.
  13634. @item rule
  13635. Set the life rule.
  13636. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  13637. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  13638. @var{NS} specifies the number of alive neighbor cells which make a
  13639. live cell stay alive, and @var{NB} the number of alive neighbor cells
  13640. which make a dead cell to become alive (i.e. to "born").
  13641. "s" and "b" can be used in place of "S" and "B", respectively.
  13642. Alternatively a rule can be specified by an 18-bits integer. The 9
  13643. high order bits are used to encode the next cell state if it is alive
  13644. for each number of neighbor alive cells, the low order bits specify
  13645. the rule for "borning" new cells. Higher order bits encode for an
  13646. higher number of neighbor cells.
  13647. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  13648. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  13649. Default value is "S23/B3", which is the original Conway's game of life
  13650. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  13651. cells, and will born a new cell if there are three alive cells around
  13652. a dead cell.
  13653. @item size, s
  13654. Set the size of the output video. For the syntax of this option, check the
  13655. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13656. If @option{filename} is specified, the size is set by default to the
  13657. same size of the input file. If @option{size} is set, it must contain
  13658. the size specified in the input file, and the initial grid defined in
  13659. that file is centered in the larger resulting area.
  13660. If a filename is not specified, the size value defaults to "320x240"
  13661. (used for a randomly generated initial grid).
  13662. @item stitch
  13663. If set to 1, stitch the left and right grid edges together, and the
  13664. top and bottom edges also. Defaults to 1.
  13665. @item mold
  13666. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  13667. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  13668. value from 0 to 255.
  13669. @item life_color
  13670. Set the color of living (or new born) cells.
  13671. @item death_color
  13672. Set the color of dead cells. If @option{mold} is set, this is the first color
  13673. used to represent a dead cell.
  13674. @item mold_color
  13675. Set mold color, for definitely dead and moldy cells.
  13676. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  13677. ffmpeg-utils manual,ffmpeg-utils}.
  13678. @end table
  13679. @subsection Examples
  13680. @itemize
  13681. @item
  13682. Read a grid from @file{pattern}, and center it on a grid of size
  13683. 300x300 pixels:
  13684. @example
  13685. life=f=pattern:s=300x300
  13686. @end example
  13687. @item
  13688. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  13689. @example
  13690. life=ratio=2/3:s=200x200
  13691. @end example
  13692. @item
  13693. Specify a custom rule for evolving a randomly generated grid:
  13694. @example
  13695. life=rule=S14/B34
  13696. @end example
  13697. @item
  13698. Full example with slow death effect (mold) using @command{ffplay}:
  13699. @example
  13700. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  13701. @end example
  13702. @end itemize
  13703. @anchor{allrgb}
  13704. @anchor{allyuv}
  13705. @anchor{color}
  13706. @anchor{haldclutsrc}
  13707. @anchor{nullsrc}
  13708. @anchor{pal75bars}
  13709. @anchor{pal100bars}
  13710. @anchor{rgbtestsrc}
  13711. @anchor{smptebars}
  13712. @anchor{smptehdbars}
  13713. @anchor{testsrc}
  13714. @anchor{testsrc2}
  13715. @anchor{yuvtestsrc}
  13716. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  13717. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  13718. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  13719. The @code{color} source provides an uniformly colored input.
  13720. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  13721. @ref{haldclut} filter.
  13722. The @code{nullsrc} source returns unprocessed video frames. It is
  13723. mainly useful to be employed in analysis / debugging tools, or as the
  13724. source for filters which ignore the input data.
  13725. The @code{pal75bars} source generates a color bars pattern, based on
  13726. EBU PAL recommendations with 75% color levels.
  13727. The @code{pal100bars} source generates a color bars pattern, based on
  13728. EBU PAL recommendations with 100% color levels.
  13729. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  13730. detecting RGB vs BGR issues. You should see a red, green and blue
  13731. stripe from top to bottom.
  13732. The @code{smptebars} source generates a color bars pattern, based on
  13733. the SMPTE Engineering Guideline EG 1-1990.
  13734. The @code{smptehdbars} source generates a color bars pattern, based on
  13735. the SMPTE RP 219-2002.
  13736. The @code{testsrc} source generates a test video pattern, showing a
  13737. color pattern, a scrolling gradient and a timestamp. This is mainly
  13738. intended for testing purposes.
  13739. The @code{testsrc2} source is similar to testsrc, but supports more
  13740. pixel formats instead of just @code{rgb24}. This allows using it as an
  13741. input for other tests without requiring a format conversion.
  13742. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  13743. see a y, cb and cr stripe from top to bottom.
  13744. The sources accept the following parameters:
  13745. @table @option
  13746. @item level
  13747. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  13748. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  13749. pixels to be used as identity matrix for 3D lookup tables. Each component is
  13750. coded on a @code{1/(N*N)} scale.
  13751. @item color, c
  13752. Specify the color of the source, only available in the @code{color}
  13753. source. For the syntax of this option, check the
  13754. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13755. @item size, s
  13756. Specify the size of the sourced video. For the syntax of this option, check the
  13757. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13758. The default value is @code{320x240}.
  13759. This option is not available with the @code{allrgb}, @code{allyuv}, and
  13760. @code{haldclutsrc} filters.
  13761. @item rate, r
  13762. Specify the frame rate of the sourced video, as the number of frames
  13763. generated per second. It has to be a string in the format
  13764. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13765. number or a valid video frame rate abbreviation. The default value is
  13766. "25".
  13767. @item duration, d
  13768. Set the duration of the sourced video. See
  13769. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13770. for the accepted syntax.
  13771. If not specified, or the expressed duration is negative, the video is
  13772. supposed to be generated forever.
  13773. @item sar
  13774. Set the sample aspect ratio of the sourced video.
  13775. @item alpha
  13776. Specify the alpha (opacity) of the background, only available in the
  13777. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  13778. 255 (fully opaque, the default).
  13779. @item decimals, n
  13780. Set the number of decimals to show in the timestamp, only available in the
  13781. @code{testsrc} source.
  13782. The displayed timestamp value will correspond to the original
  13783. timestamp value multiplied by the power of 10 of the specified
  13784. value. Default value is 0.
  13785. @end table
  13786. @subsection Examples
  13787. @itemize
  13788. @item
  13789. Generate a video with a duration of 5.3 seconds, with size
  13790. 176x144 and a frame rate of 10 frames per second:
  13791. @example
  13792. testsrc=duration=5.3:size=qcif:rate=10
  13793. @end example
  13794. @item
  13795. The following graph description will generate a red source
  13796. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  13797. frames per second:
  13798. @example
  13799. color=c=red@@0.2:s=qcif:r=10
  13800. @end example
  13801. @item
  13802. If the input content is to be ignored, @code{nullsrc} can be used. The
  13803. following command generates noise in the luminance plane by employing
  13804. the @code{geq} filter:
  13805. @example
  13806. nullsrc=s=256x256, geq=random(1)*255:128:128
  13807. @end example
  13808. @end itemize
  13809. @subsection Commands
  13810. The @code{color} source supports the following commands:
  13811. @table @option
  13812. @item c, color
  13813. Set the color of the created image. Accepts the same syntax of the
  13814. corresponding @option{color} option.
  13815. @end table
  13816. @section openclsrc
  13817. Generate video using an OpenCL program.
  13818. @table @option
  13819. @item source
  13820. OpenCL program source file.
  13821. @item kernel
  13822. Kernel name in program.
  13823. @item size, s
  13824. Size of frames to generate. This must be set.
  13825. @item format
  13826. Pixel format to use for the generated frames. This must be set.
  13827. @item rate, r
  13828. Number of frames generated every second. Default value is '25'.
  13829. @end table
  13830. For details of how the program loading works, see the @ref{program_opencl}
  13831. filter.
  13832. Example programs:
  13833. @itemize
  13834. @item
  13835. Generate a colour ramp by setting pixel values from the position of the pixel
  13836. in the output image. (Note that this will work with all pixel formats, but
  13837. the generated output will not be the same.)
  13838. @verbatim
  13839. __kernel void ramp(__write_only image2d_t dst,
  13840. unsigned int index)
  13841. {
  13842. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  13843. float4 val;
  13844. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  13845. write_imagef(dst, loc, val);
  13846. }
  13847. @end verbatim
  13848. @item
  13849. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  13850. @verbatim
  13851. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  13852. unsigned int index)
  13853. {
  13854. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  13855. float4 value = 0.0f;
  13856. int x = loc.x + index;
  13857. int y = loc.y + index;
  13858. while (x > 0 || y > 0) {
  13859. if (x % 3 == 1 && y % 3 == 1) {
  13860. value = 1.0f;
  13861. break;
  13862. }
  13863. x /= 3;
  13864. y /= 3;
  13865. }
  13866. write_imagef(dst, loc, value);
  13867. }
  13868. @end verbatim
  13869. @end itemize
  13870. @c man end VIDEO SOURCES
  13871. @chapter Video Sinks
  13872. @c man begin VIDEO SINKS
  13873. Below is a description of the currently available video sinks.
  13874. @section buffersink
  13875. Buffer video frames, and make them available to the end of the filter
  13876. graph.
  13877. This sink is mainly intended for programmatic use, in particular
  13878. through the interface defined in @file{libavfilter/buffersink.h}
  13879. or the options system.
  13880. It accepts a pointer to an AVBufferSinkContext structure, which
  13881. defines the incoming buffers' formats, to be passed as the opaque
  13882. parameter to @code{avfilter_init_filter} for initialization.
  13883. @section nullsink
  13884. Null video sink: do absolutely nothing with the input video. It is
  13885. mainly useful as a template and for use in analysis / debugging
  13886. tools.
  13887. @c man end VIDEO SINKS
  13888. @chapter Multimedia Filters
  13889. @c man begin MULTIMEDIA FILTERS
  13890. Below is a description of the currently available multimedia filters.
  13891. @section abitscope
  13892. Convert input audio to a video output, displaying the audio bit scope.
  13893. The filter accepts the following options:
  13894. @table @option
  13895. @item rate, r
  13896. Set frame rate, expressed as number of frames per second. Default
  13897. value is "25".
  13898. @item size, s
  13899. Specify the video size for the output. For the syntax of this option, check the
  13900. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13901. Default value is @code{1024x256}.
  13902. @item colors
  13903. Specify list of colors separated by space or by '|' which will be used to
  13904. draw channels. Unrecognized or missing colors will be replaced
  13905. by white color.
  13906. @end table
  13907. @section ahistogram
  13908. Convert input audio to a video output, displaying the volume histogram.
  13909. The filter accepts the following options:
  13910. @table @option
  13911. @item dmode
  13912. Specify how histogram is calculated.
  13913. It accepts the following values:
  13914. @table @samp
  13915. @item single
  13916. Use single histogram for all channels.
  13917. @item separate
  13918. Use separate histogram for each channel.
  13919. @end table
  13920. Default is @code{single}.
  13921. @item rate, r
  13922. Set frame rate, expressed as number of frames per second. Default
  13923. value is "25".
  13924. @item size, s
  13925. Specify the video size for the output. For the syntax of this option, check the
  13926. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13927. Default value is @code{hd720}.
  13928. @item scale
  13929. Set display scale.
  13930. It accepts the following values:
  13931. @table @samp
  13932. @item log
  13933. logarithmic
  13934. @item sqrt
  13935. square root
  13936. @item cbrt
  13937. cubic root
  13938. @item lin
  13939. linear
  13940. @item rlog
  13941. reverse logarithmic
  13942. @end table
  13943. Default is @code{log}.
  13944. @item ascale
  13945. Set amplitude scale.
  13946. It accepts the following values:
  13947. @table @samp
  13948. @item log
  13949. logarithmic
  13950. @item lin
  13951. linear
  13952. @end table
  13953. Default is @code{log}.
  13954. @item acount
  13955. Set how much frames to accumulate in histogram.
  13956. Defauls is 1. Setting this to -1 accumulates all frames.
  13957. @item rheight
  13958. Set histogram ratio of window height.
  13959. @item slide
  13960. Set sonogram sliding.
  13961. It accepts the following values:
  13962. @table @samp
  13963. @item replace
  13964. replace old rows with new ones.
  13965. @item scroll
  13966. scroll from top to bottom.
  13967. @end table
  13968. Default is @code{replace}.
  13969. @end table
  13970. @section aphasemeter
  13971. Convert input audio to a video output, displaying the audio phase.
  13972. The filter accepts the following options:
  13973. @table @option
  13974. @item rate, r
  13975. Set the output frame rate. Default value is @code{25}.
  13976. @item size, s
  13977. Set the video size for the output. For the syntax of this option, check the
  13978. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13979. Default value is @code{800x400}.
  13980. @item rc
  13981. @item gc
  13982. @item bc
  13983. Specify the red, green, blue contrast. Default values are @code{2},
  13984. @code{7} and @code{1}.
  13985. Allowed range is @code{[0, 255]}.
  13986. @item mpc
  13987. Set color which will be used for drawing median phase. If color is
  13988. @code{none} which is default, no median phase value will be drawn.
  13989. @item video
  13990. Enable video output. Default is enabled.
  13991. @end table
  13992. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  13993. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  13994. The @code{-1} means left and right channels are completely out of phase and
  13995. @code{1} means channels are in phase.
  13996. @section avectorscope
  13997. Convert input audio to a video output, representing the audio vector
  13998. scope.
  13999. The filter is used to measure the difference between channels of stereo
  14000. audio stream. A monoaural signal, consisting of identical left and right
  14001. signal, results in straight vertical line. Any stereo separation is visible
  14002. as a deviation from this line, creating a Lissajous figure.
  14003. If the straight (or deviation from it) but horizontal line appears this
  14004. indicates that the left and right channels are out of phase.
  14005. The filter accepts the following options:
  14006. @table @option
  14007. @item mode, m
  14008. Set the vectorscope mode.
  14009. Available values are:
  14010. @table @samp
  14011. @item lissajous
  14012. Lissajous rotated by 45 degrees.
  14013. @item lissajous_xy
  14014. Same as above but not rotated.
  14015. @item polar
  14016. Shape resembling half of circle.
  14017. @end table
  14018. Default value is @samp{lissajous}.
  14019. @item size, s
  14020. Set the video size for the output. For the syntax of this option, check the
  14021. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14022. Default value is @code{400x400}.
  14023. @item rate, r
  14024. Set the output frame rate. Default value is @code{25}.
  14025. @item rc
  14026. @item gc
  14027. @item bc
  14028. @item ac
  14029. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  14030. @code{160}, @code{80} and @code{255}.
  14031. Allowed range is @code{[0, 255]}.
  14032. @item rf
  14033. @item gf
  14034. @item bf
  14035. @item af
  14036. Specify the red, green, blue and alpha fade. Default values are @code{15},
  14037. @code{10}, @code{5} and @code{5}.
  14038. Allowed range is @code{[0, 255]}.
  14039. @item zoom
  14040. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  14041. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  14042. @item draw
  14043. Set the vectorscope drawing mode.
  14044. Available values are:
  14045. @table @samp
  14046. @item dot
  14047. Draw dot for each sample.
  14048. @item line
  14049. Draw line between previous and current sample.
  14050. @end table
  14051. Default value is @samp{dot}.
  14052. @item scale
  14053. Specify amplitude scale of audio samples.
  14054. Available values are:
  14055. @table @samp
  14056. @item lin
  14057. Linear.
  14058. @item sqrt
  14059. Square root.
  14060. @item cbrt
  14061. Cubic root.
  14062. @item log
  14063. Logarithmic.
  14064. @end table
  14065. @item swap
  14066. Swap left channel axis with right channel axis.
  14067. @item mirror
  14068. Mirror axis.
  14069. @table @samp
  14070. @item none
  14071. No mirror.
  14072. @item x
  14073. Mirror only x axis.
  14074. @item y
  14075. Mirror only y axis.
  14076. @item xy
  14077. Mirror both axis.
  14078. @end table
  14079. @end table
  14080. @subsection Examples
  14081. @itemize
  14082. @item
  14083. Complete example using @command{ffplay}:
  14084. @example
  14085. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  14086. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  14087. @end example
  14088. @end itemize
  14089. @section bench, abench
  14090. Benchmark part of a filtergraph.
  14091. The filter accepts the following options:
  14092. @table @option
  14093. @item action
  14094. Start or stop a timer.
  14095. Available values are:
  14096. @table @samp
  14097. @item start
  14098. Get the current time, set it as frame metadata (using the key
  14099. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  14100. @item stop
  14101. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  14102. the input frame metadata to get the time difference. Time difference, average,
  14103. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  14104. @code{min}) are then printed. The timestamps are expressed in seconds.
  14105. @end table
  14106. @end table
  14107. @subsection Examples
  14108. @itemize
  14109. @item
  14110. Benchmark @ref{selectivecolor} filter:
  14111. @example
  14112. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  14113. @end example
  14114. @end itemize
  14115. @section concat
  14116. Concatenate audio and video streams, joining them together one after the
  14117. other.
  14118. The filter works on segments of synchronized video and audio streams. All
  14119. segments must have the same number of streams of each type, and that will
  14120. also be the number of streams at output.
  14121. The filter accepts the following options:
  14122. @table @option
  14123. @item n
  14124. Set the number of segments. Default is 2.
  14125. @item v
  14126. Set the number of output video streams, that is also the number of video
  14127. streams in each segment. Default is 1.
  14128. @item a
  14129. Set the number of output audio streams, that is also the number of audio
  14130. streams in each segment. Default is 0.
  14131. @item unsafe
  14132. Activate unsafe mode: do not fail if segments have a different format.
  14133. @end table
  14134. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  14135. @var{a} audio outputs.
  14136. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  14137. segment, in the same order as the outputs, then the inputs for the second
  14138. segment, etc.
  14139. Related streams do not always have exactly the same duration, for various
  14140. reasons including codec frame size or sloppy authoring. For that reason,
  14141. related synchronized streams (e.g. a video and its audio track) should be
  14142. concatenated at once. The concat filter will use the duration of the longest
  14143. stream in each segment (except the last one), and if necessary pad shorter
  14144. audio streams with silence.
  14145. For this filter to work correctly, all segments must start at timestamp 0.
  14146. All corresponding streams must have the same parameters in all segments; the
  14147. filtering system will automatically select a common pixel format for video
  14148. streams, and a common sample format, sample rate and channel layout for
  14149. audio streams, but other settings, such as resolution, must be converted
  14150. explicitly by the user.
  14151. Different frame rates are acceptable but will result in variable frame rate
  14152. at output; be sure to configure the output file to handle it.
  14153. @subsection Examples
  14154. @itemize
  14155. @item
  14156. Concatenate an opening, an episode and an ending, all in bilingual version
  14157. (video in stream 0, audio in streams 1 and 2):
  14158. @example
  14159. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  14160. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  14161. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  14162. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  14163. @end example
  14164. @item
  14165. Concatenate two parts, handling audio and video separately, using the
  14166. (a)movie sources, and adjusting the resolution:
  14167. @example
  14168. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  14169. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  14170. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  14171. @end example
  14172. Note that a desync will happen at the stitch if the audio and video streams
  14173. do not have exactly the same duration in the first file.
  14174. @end itemize
  14175. @subsection Commands
  14176. This filter supports the following commands:
  14177. @table @option
  14178. @item next
  14179. Close the current segment and step to the next one
  14180. @end table
  14181. @section drawgraph, adrawgraph
  14182. Draw a graph using input video or audio metadata.
  14183. It accepts the following parameters:
  14184. @table @option
  14185. @item m1
  14186. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  14187. @item fg1
  14188. Set 1st foreground color expression.
  14189. @item m2
  14190. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  14191. @item fg2
  14192. Set 2nd foreground color expression.
  14193. @item m3
  14194. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  14195. @item fg3
  14196. Set 3rd foreground color expression.
  14197. @item m4
  14198. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  14199. @item fg4
  14200. Set 4th foreground color expression.
  14201. @item min
  14202. Set minimal value of metadata value.
  14203. @item max
  14204. Set maximal value of metadata value.
  14205. @item bg
  14206. Set graph background color. Default is white.
  14207. @item mode
  14208. Set graph mode.
  14209. Available values for mode is:
  14210. @table @samp
  14211. @item bar
  14212. @item dot
  14213. @item line
  14214. @end table
  14215. Default is @code{line}.
  14216. @item slide
  14217. Set slide mode.
  14218. Available values for slide is:
  14219. @table @samp
  14220. @item frame
  14221. Draw new frame when right border is reached.
  14222. @item replace
  14223. Replace old columns with new ones.
  14224. @item scroll
  14225. Scroll from right to left.
  14226. @item rscroll
  14227. Scroll from left to right.
  14228. @item picture
  14229. Draw single picture.
  14230. @end table
  14231. Default is @code{frame}.
  14232. @item size
  14233. Set size of graph video. For the syntax of this option, check the
  14234. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14235. The default value is @code{900x256}.
  14236. The foreground color expressions can use the following variables:
  14237. @table @option
  14238. @item MIN
  14239. Minimal value of metadata value.
  14240. @item MAX
  14241. Maximal value of metadata value.
  14242. @item VAL
  14243. Current metadata key value.
  14244. @end table
  14245. The color is defined as 0xAABBGGRR.
  14246. @end table
  14247. Example using metadata from @ref{signalstats} filter:
  14248. @example
  14249. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  14250. @end example
  14251. Example using metadata from @ref{ebur128} filter:
  14252. @example
  14253. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  14254. @end example
  14255. @anchor{ebur128}
  14256. @section ebur128
  14257. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  14258. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  14259. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  14260. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  14261. The filter also has a video output (see the @var{video} option) with a real
  14262. time graph to observe the loudness evolution. The graphic contains the logged
  14263. message mentioned above, so it is not printed anymore when this option is set,
  14264. unless the verbose logging is set. The main graphing area contains the
  14265. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  14266. the momentary loudness (400 milliseconds).
  14267. More information about the Loudness Recommendation EBU R128 on
  14268. @url{http://tech.ebu.ch/loudness}.
  14269. The filter accepts the following options:
  14270. @table @option
  14271. @item video
  14272. Activate the video output. The audio stream is passed unchanged whether this
  14273. option is set or no. The video stream will be the first output stream if
  14274. activated. Default is @code{0}.
  14275. @item size
  14276. Set the video size. This option is for video only. For the syntax of this
  14277. option, check the
  14278. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14279. Default and minimum resolution is @code{640x480}.
  14280. @item meter
  14281. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  14282. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  14283. other integer value between this range is allowed.
  14284. @item metadata
  14285. Set metadata injection. If set to @code{1}, the audio input will be segmented
  14286. into 100ms output frames, each of them containing various loudness information
  14287. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  14288. Default is @code{0}.
  14289. @item framelog
  14290. Force the frame logging level.
  14291. Available values are:
  14292. @table @samp
  14293. @item info
  14294. information logging level
  14295. @item verbose
  14296. verbose logging level
  14297. @end table
  14298. By default, the logging level is set to @var{info}. If the @option{video} or
  14299. the @option{metadata} options are set, it switches to @var{verbose}.
  14300. @item peak
  14301. Set peak mode(s).
  14302. Available modes can be cumulated (the option is a @code{flag} type). Possible
  14303. values are:
  14304. @table @samp
  14305. @item none
  14306. Disable any peak mode (default).
  14307. @item sample
  14308. Enable sample-peak mode.
  14309. Simple peak mode looking for the higher sample value. It logs a message
  14310. for sample-peak (identified by @code{SPK}).
  14311. @item true
  14312. Enable true-peak mode.
  14313. If enabled, the peak lookup is done on an over-sampled version of the input
  14314. stream for better peak accuracy. It logs a message for true-peak.
  14315. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  14316. This mode requires a build with @code{libswresample}.
  14317. @end table
  14318. @item dualmono
  14319. Treat mono input files as "dual mono". If a mono file is intended for playback
  14320. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  14321. If set to @code{true}, this option will compensate for this effect.
  14322. Multi-channel input files are not affected by this option.
  14323. @item panlaw
  14324. Set a specific pan law to be used for the measurement of dual mono files.
  14325. This parameter is optional, and has a default value of -3.01dB.
  14326. @end table
  14327. @subsection Examples
  14328. @itemize
  14329. @item
  14330. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  14331. @example
  14332. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  14333. @end example
  14334. @item
  14335. Run an analysis with @command{ffmpeg}:
  14336. @example
  14337. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  14338. @end example
  14339. @end itemize
  14340. @section interleave, ainterleave
  14341. Temporally interleave frames from several inputs.
  14342. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  14343. These filters read frames from several inputs and send the oldest
  14344. queued frame to the output.
  14345. Input streams must have well defined, monotonically increasing frame
  14346. timestamp values.
  14347. In order to submit one frame to output, these filters need to enqueue
  14348. at least one frame for each input, so they cannot work in case one
  14349. input is not yet terminated and will not receive incoming frames.
  14350. For example consider the case when one input is a @code{select} filter
  14351. which always drops input frames. The @code{interleave} filter will keep
  14352. reading from that input, but it will never be able to send new frames
  14353. to output until the input sends an end-of-stream signal.
  14354. Also, depending on inputs synchronization, the filters will drop
  14355. frames in case one input receives more frames than the other ones, and
  14356. the queue is already filled.
  14357. These filters accept the following options:
  14358. @table @option
  14359. @item nb_inputs, n
  14360. Set the number of different inputs, it is 2 by default.
  14361. @end table
  14362. @subsection Examples
  14363. @itemize
  14364. @item
  14365. Interleave frames belonging to different streams using @command{ffmpeg}:
  14366. @example
  14367. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  14368. @end example
  14369. @item
  14370. Add flickering blur effect:
  14371. @example
  14372. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  14373. @end example
  14374. @end itemize
  14375. @section metadata, ametadata
  14376. Manipulate frame metadata.
  14377. This filter accepts the following options:
  14378. @table @option
  14379. @item mode
  14380. Set mode of operation of the filter.
  14381. Can be one of the following:
  14382. @table @samp
  14383. @item select
  14384. If both @code{value} and @code{key} is set, select frames
  14385. which have such metadata. If only @code{key} is set, select
  14386. every frame that has such key in metadata.
  14387. @item add
  14388. Add new metadata @code{key} and @code{value}. If key is already available
  14389. do nothing.
  14390. @item modify
  14391. Modify value of already present key.
  14392. @item delete
  14393. If @code{value} is set, delete only keys that have such value.
  14394. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  14395. the frame.
  14396. @item print
  14397. Print key and its value if metadata was found. If @code{key} is not set print all
  14398. metadata values available in frame.
  14399. @end table
  14400. @item key
  14401. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  14402. @item value
  14403. Set metadata value which will be used. This option is mandatory for
  14404. @code{modify} and @code{add} mode.
  14405. @item function
  14406. Which function to use when comparing metadata value and @code{value}.
  14407. Can be one of following:
  14408. @table @samp
  14409. @item same_str
  14410. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  14411. @item starts_with
  14412. Values are interpreted as strings, returns true if metadata value starts with
  14413. the @code{value} option string.
  14414. @item less
  14415. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  14416. @item equal
  14417. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  14418. @item greater
  14419. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  14420. @item expr
  14421. Values are interpreted as floats, returns true if expression from option @code{expr}
  14422. evaluates to true.
  14423. @end table
  14424. @item expr
  14425. Set expression which is used when @code{function} is set to @code{expr}.
  14426. The expression is evaluated through the eval API and can contain the following
  14427. constants:
  14428. @table @option
  14429. @item VALUE1
  14430. Float representation of @code{value} from metadata key.
  14431. @item VALUE2
  14432. Float representation of @code{value} as supplied by user in @code{value} option.
  14433. @end table
  14434. @item file
  14435. If specified in @code{print} mode, output is written to the named file. Instead of
  14436. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  14437. for standard output. If @code{file} option is not set, output is written to the log
  14438. with AV_LOG_INFO loglevel.
  14439. @end table
  14440. @subsection Examples
  14441. @itemize
  14442. @item
  14443. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  14444. between 0 and 1.
  14445. @example
  14446. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  14447. @end example
  14448. @item
  14449. Print silencedetect output to file @file{metadata.txt}.
  14450. @example
  14451. silencedetect,ametadata=mode=print:file=metadata.txt
  14452. @end example
  14453. @item
  14454. Direct all metadata to a pipe with file descriptor 4.
  14455. @example
  14456. metadata=mode=print:file='pipe\:4'
  14457. @end example
  14458. @end itemize
  14459. @section perms, aperms
  14460. Set read/write permissions for the output frames.
  14461. These filters are mainly aimed at developers to test direct path in the
  14462. following filter in the filtergraph.
  14463. The filters accept the following options:
  14464. @table @option
  14465. @item mode
  14466. Select the permissions mode.
  14467. It accepts the following values:
  14468. @table @samp
  14469. @item none
  14470. Do nothing. This is the default.
  14471. @item ro
  14472. Set all the output frames read-only.
  14473. @item rw
  14474. Set all the output frames directly writable.
  14475. @item toggle
  14476. Make the frame read-only if writable, and writable if read-only.
  14477. @item random
  14478. Set each output frame read-only or writable randomly.
  14479. @end table
  14480. @item seed
  14481. Set the seed for the @var{random} mode, must be an integer included between
  14482. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  14483. @code{-1}, the filter will try to use a good random seed on a best effort
  14484. basis.
  14485. @end table
  14486. Note: in case of auto-inserted filter between the permission filter and the
  14487. following one, the permission might not be received as expected in that
  14488. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  14489. perms/aperms filter can avoid this problem.
  14490. @section realtime, arealtime
  14491. Slow down filtering to match real time approximately.
  14492. These filters will pause the filtering for a variable amount of time to
  14493. match the output rate with the input timestamps.
  14494. They are similar to the @option{re} option to @code{ffmpeg}.
  14495. They accept the following options:
  14496. @table @option
  14497. @item limit
  14498. Time limit for the pauses. Any pause longer than that will be considered
  14499. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  14500. @end table
  14501. @anchor{select}
  14502. @section select, aselect
  14503. Select frames to pass in output.
  14504. This filter accepts the following options:
  14505. @table @option
  14506. @item expr, e
  14507. Set expression, which is evaluated for each input frame.
  14508. If the expression is evaluated to zero, the frame is discarded.
  14509. If the evaluation result is negative or NaN, the frame is sent to the
  14510. first output; otherwise it is sent to the output with index
  14511. @code{ceil(val)-1}, assuming that the input index starts from 0.
  14512. For example a value of @code{1.2} corresponds to the output with index
  14513. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  14514. @item outputs, n
  14515. Set the number of outputs. The output to which to send the selected
  14516. frame is based on the result of the evaluation. Default value is 1.
  14517. @end table
  14518. The expression can contain the following constants:
  14519. @table @option
  14520. @item n
  14521. The (sequential) number of the filtered frame, starting from 0.
  14522. @item selected_n
  14523. The (sequential) number of the selected frame, starting from 0.
  14524. @item prev_selected_n
  14525. The sequential number of the last selected frame. It's NAN if undefined.
  14526. @item TB
  14527. The timebase of the input timestamps.
  14528. @item pts
  14529. The PTS (Presentation TimeStamp) of the filtered video frame,
  14530. expressed in @var{TB} units. It's NAN if undefined.
  14531. @item t
  14532. The PTS of the filtered video frame,
  14533. expressed in seconds. It's NAN if undefined.
  14534. @item prev_pts
  14535. The PTS of the previously filtered video frame. It's NAN if undefined.
  14536. @item prev_selected_pts
  14537. The PTS of the last previously filtered video frame. It's NAN if undefined.
  14538. @item prev_selected_t
  14539. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  14540. @item start_pts
  14541. The PTS of the first video frame in the video. It's NAN if undefined.
  14542. @item start_t
  14543. The time of the first video frame in the video. It's NAN if undefined.
  14544. @item pict_type @emph{(video only)}
  14545. The type of the filtered frame. It can assume one of the following
  14546. values:
  14547. @table @option
  14548. @item I
  14549. @item P
  14550. @item B
  14551. @item S
  14552. @item SI
  14553. @item SP
  14554. @item BI
  14555. @end table
  14556. @item interlace_type @emph{(video only)}
  14557. The frame interlace type. It can assume one of the following values:
  14558. @table @option
  14559. @item PROGRESSIVE
  14560. The frame is progressive (not interlaced).
  14561. @item TOPFIRST
  14562. The frame is top-field-first.
  14563. @item BOTTOMFIRST
  14564. The frame is bottom-field-first.
  14565. @end table
  14566. @item consumed_sample_n @emph{(audio only)}
  14567. the number of selected samples before the current frame
  14568. @item samples_n @emph{(audio only)}
  14569. the number of samples in the current frame
  14570. @item sample_rate @emph{(audio only)}
  14571. the input sample rate
  14572. @item key
  14573. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  14574. @item pos
  14575. the position in the file of the filtered frame, -1 if the information
  14576. is not available (e.g. for synthetic video)
  14577. @item scene @emph{(video only)}
  14578. value between 0 and 1 to indicate a new scene; a low value reflects a low
  14579. probability for the current frame to introduce a new scene, while a higher
  14580. value means the current frame is more likely to be one (see the example below)
  14581. @item concatdec_select
  14582. The concat demuxer can select only part of a concat input file by setting an
  14583. inpoint and an outpoint, but the output packets may not be entirely contained
  14584. in the selected interval. By using this variable, it is possible to skip frames
  14585. generated by the concat demuxer which are not exactly contained in the selected
  14586. interval.
  14587. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  14588. and the @var{lavf.concat.duration} packet metadata values which are also
  14589. present in the decoded frames.
  14590. The @var{concatdec_select} variable is -1 if the frame pts is at least
  14591. start_time and either the duration metadata is missing or the frame pts is less
  14592. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  14593. missing.
  14594. That basically means that an input frame is selected if its pts is within the
  14595. interval set by the concat demuxer.
  14596. @end table
  14597. The default value of the select expression is "1".
  14598. @subsection Examples
  14599. @itemize
  14600. @item
  14601. Select all frames in input:
  14602. @example
  14603. select
  14604. @end example
  14605. The example above is the same as:
  14606. @example
  14607. select=1
  14608. @end example
  14609. @item
  14610. Skip all frames:
  14611. @example
  14612. select=0
  14613. @end example
  14614. @item
  14615. Select only I-frames:
  14616. @example
  14617. select='eq(pict_type\,I)'
  14618. @end example
  14619. @item
  14620. Select one frame every 100:
  14621. @example
  14622. select='not(mod(n\,100))'
  14623. @end example
  14624. @item
  14625. Select only frames contained in the 10-20 time interval:
  14626. @example
  14627. select=between(t\,10\,20)
  14628. @end example
  14629. @item
  14630. Select only I-frames contained in the 10-20 time interval:
  14631. @example
  14632. select=between(t\,10\,20)*eq(pict_type\,I)
  14633. @end example
  14634. @item
  14635. Select frames with a minimum distance of 10 seconds:
  14636. @example
  14637. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  14638. @end example
  14639. @item
  14640. Use aselect to select only audio frames with samples number > 100:
  14641. @example
  14642. aselect='gt(samples_n\,100)'
  14643. @end example
  14644. @item
  14645. Create a mosaic of the first scenes:
  14646. @example
  14647. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  14648. @end example
  14649. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  14650. choice.
  14651. @item
  14652. Send even and odd frames to separate outputs, and compose them:
  14653. @example
  14654. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  14655. @end example
  14656. @item
  14657. Select useful frames from an ffconcat file which is using inpoints and
  14658. outpoints but where the source files are not intra frame only.
  14659. @example
  14660. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  14661. @end example
  14662. @end itemize
  14663. @section sendcmd, asendcmd
  14664. Send commands to filters in the filtergraph.
  14665. These filters read commands to be sent to other filters in the
  14666. filtergraph.
  14667. @code{sendcmd} must be inserted between two video filters,
  14668. @code{asendcmd} must be inserted between two audio filters, but apart
  14669. from that they act the same way.
  14670. The specification of commands can be provided in the filter arguments
  14671. with the @var{commands} option, or in a file specified by the
  14672. @var{filename} option.
  14673. These filters accept the following options:
  14674. @table @option
  14675. @item commands, c
  14676. Set the commands to be read and sent to the other filters.
  14677. @item filename, f
  14678. Set the filename of the commands to be read and sent to the other
  14679. filters.
  14680. @end table
  14681. @subsection Commands syntax
  14682. A commands description consists of a sequence of interval
  14683. specifications, comprising a list of commands to be executed when a
  14684. particular event related to that interval occurs. The occurring event
  14685. is typically the current frame time entering or leaving a given time
  14686. interval.
  14687. An interval is specified by the following syntax:
  14688. @example
  14689. @var{START}[-@var{END}] @var{COMMANDS};
  14690. @end example
  14691. The time interval is specified by the @var{START} and @var{END} times.
  14692. @var{END} is optional and defaults to the maximum time.
  14693. The current frame time is considered within the specified interval if
  14694. it is included in the interval [@var{START}, @var{END}), that is when
  14695. the time is greater or equal to @var{START} and is lesser than
  14696. @var{END}.
  14697. @var{COMMANDS} consists of a sequence of one or more command
  14698. specifications, separated by ",", relating to that interval. The
  14699. syntax of a command specification is given by:
  14700. @example
  14701. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  14702. @end example
  14703. @var{FLAGS} is optional and specifies the type of events relating to
  14704. the time interval which enable sending the specified command, and must
  14705. be a non-null sequence of identifier flags separated by "+" or "|" and
  14706. enclosed between "[" and "]".
  14707. The following flags are recognized:
  14708. @table @option
  14709. @item enter
  14710. The command is sent when the current frame timestamp enters the
  14711. specified interval. In other words, the command is sent when the
  14712. previous frame timestamp was not in the given interval, and the
  14713. current is.
  14714. @item leave
  14715. The command is sent when the current frame timestamp leaves the
  14716. specified interval. In other words, the command is sent when the
  14717. previous frame timestamp was in the given interval, and the
  14718. current is not.
  14719. @end table
  14720. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  14721. assumed.
  14722. @var{TARGET} specifies the target of the command, usually the name of
  14723. the filter class or a specific filter instance name.
  14724. @var{COMMAND} specifies the name of the command for the target filter.
  14725. @var{ARG} is optional and specifies the optional list of argument for
  14726. the given @var{COMMAND}.
  14727. Between one interval specification and another, whitespaces, or
  14728. sequences of characters starting with @code{#} until the end of line,
  14729. are ignored and can be used to annotate comments.
  14730. A simplified BNF description of the commands specification syntax
  14731. follows:
  14732. @example
  14733. @var{COMMAND_FLAG} ::= "enter" | "leave"
  14734. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  14735. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  14736. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  14737. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  14738. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  14739. @end example
  14740. @subsection Examples
  14741. @itemize
  14742. @item
  14743. Specify audio tempo change at second 4:
  14744. @example
  14745. asendcmd=c='4.0 atempo tempo 1.5',atempo
  14746. @end example
  14747. @item
  14748. Target a specific filter instance:
  14749. @example
  14750. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  14751. @end example
  14752. @item
  14753. Specify a list of drawtext and hue commands in a file.
  14754. @example
  14755. # show text in the interval 5-10
  14756. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  14757. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  14758. # desaturate the image in the interval 15-20
  14759. 15.0-20.0 [enter] hue s 0,
  14760. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  14761. [leave] hue s 1,
  14762. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  14763. # apply an exponential saturation fade-out effect, starting from time 25
  14764. 25 [enter] hue s exp(25-t)
  14765. @end example
  14766. A filtergraph allowing to read and process the above command list
  14767. stored in a file @file{test.cmd}, can be specified with:
  14768. @example
  14769. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  14770. @end example
  14771. @end itemize
  14772. @anchor{setpts}
  14773. @section setpts, asetpts
  14774. Change the PTS (presentation timestamp) of the input frames.
  14775. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  14776. This filter accepts the following options:
  14777. @table @option
  14778. @item expr
  14779. The expression which is evaluated for each frame to construct its timestamp.
  14780. @end table
  14781. The expression is evaluated through the eval API and can contain the following
  14782. constants:
  14783. @table @option
  14784. @item FRAME_RATE
  14785. frame rate, only defined for constant frame-rate video
  14786. @item PTS
  14787. The presentation timestamp in input
  14788. @item N
  14789. The count of the input frame for video or the number of consumed samples,
  14790. not including the current frame for audio, starting from 0.
  14791. @item NB_CONSUMED_SAMPLES
  14792. The number of consumed samples, not including the current frame (only
  14793. audio)
  14794. @item NB_SAMPLES, S
  14795. The number of samples in the current frame (only audio)
  14796. @item SAMPLE_RATE, SR
  14797. The audio sample rate.
  14798. @item STARTPTS
  14799. The PTS of the first frame.
  14800. @item STARTT
  14801. the time in seconds of the first frame
  14802. @item INTERLACED
  14803. State whether the current frame is interlaced.
  14804. @item T
  14805. the time in seconds of the current frame
  14806. @item POS
  14807. original position in the file of the frame, or undefined if undefined
  14808. for the current frame
  14809. @item PREV_INPTS
  14810. The previous input PTS.
  14811. @item PREV_INT
  14812. previous input time in seconds
  14813. @item PREV_OUTPTS
  14814. The previous output PTS.
  14815. @item PREV_OUTT
  14816. previous output time in seconds
  14817. @item RTCTIME
  14818. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  14819. instead.
  14820. @item RTCSTART
  14821. The wallclock (RTC) time at the start of the movie in microseconds.
  14822. @item TB
  14823. The timebase of the input timestamps.
  14824. @end table
  14825. @subsection Examples
  14826. @itemize
  14827. @item
  14828. Start counting PTS from zero
  14829. @example
  14830. setpts=PTS-STARTPTS
  14831. @end example
  14832. @item
  14833. Apply fast motion effect:
  14834. @example
  14835. setpts=0.5*PTS
  14836. @end example
  14837. @item
  14838. Apply slow motion effect:
  14839. @example
  14840. setpts=2.0*PTS
  14841. @end example
  14842. @item
  14843. Set fixed rate of 25 frames per second:
  14844. @example
  14845. setpts=N/(25*TB)
  14846. @end example
  14847. @item
  14848. Set fixed rate 25 fps with some jitter:
  14849. @example
  14850. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  14851. @end example
  14852. @item
  14853. Apply an offset of 10 seconds to the input PTS:
  14854. @example
  14855. setpts=PTS+10/TB
  14856. @end example
  14857. @item
  14858. Generate timestamps from a "live source" and rebase onto the current timebase:
  14859. @example
  14860. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  14861. @end example
  14862. @item
  14863. Generate timestamps by counting samples:
  14864. @example
  14865. asetpts=N/SR/TB
  14866. @end example
  14867. @end itemize
  14868. @section setrange
  14869. Force color range for the output video frame.
  14870. The @code{setrange} filter marks the color range property for the
  14871. output frames. It does not change the input frame, but only sets the
  14872. corresponding property, which affects how the frame is treated by
  14873. following filters.
  14874. The filter accepts the following options:
  14875. @table @option
  14876. @item range
  14877. Available values are:
  14878. @table @samp
  14879. @item auto
  14880. Keep the same color range property.
  14881. @item unspecified, unknown
  14882. Set the color range as unspecified.
  14883. @item limited, tv, mpeg
  14884. Set the color range as limited.
  14885. @item full, pc, jpeg
  14886. Set the color range as full.
  14887. @end table
  14888. @end table
  14889. @section settb, asettb
  14890. Set the timebase to use for the output frames timestamps.
  14891. It is mainly useful for testing timebase configuration.
  14892. It accepts the following parameters:
  14893. @table @option
  14894. @item expr, tb
  14895. The expression which is evaluated into the output timebase.
  14896. @end table
  14897. The value for @option{tb} is an arithmetic expression representing a
  14898. rational. The expression can contain the constants "AVTB" (the default
  14899. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  14900. audio only). Default value is "intb".
  14901. @subsection Examples
  14902. @itemize
  14903. @item
  14904. Set the timebase to 1/25:
  14905. @example
  14906. settb=expr=1/25
  14907. @end example
  14908. @item
  14909. Set the timebase to 1/10:
  14910. @example
  14911. settb=expr=0.1
  14912. @end example
  14913. @item
  14914. Set the timebase to 1001/1000:
  14915. @example
  14916. settb=1+0.001
  14917. @end example
  14918. @item
  14919. Set the timebase to 2*intb:
  14920. @example
  14921. settb=2*intb
  14922. @end example
  14923. @item
  14924. Set the default timebase value:
  14925. @example
  14926. settb=AVTB
  14927. @end example
  14928. @end itemize
  14929. @section showcqt
  14930. Convert input audio to a video output representing frequency spectrum
  14931. logarithmically using Brown-Puckette constant Q transform algorithm with
  14932. direct frequency domain coefficient calculation (but the transform itself
  14933. is not really constant Q, instead the Q factor is actually variable/clamped),
  14934. with musical tone scale, from E0 to D#10.
  14935. The filter accepts the following options:
  14936. @table @option
  14937. @item size, s
  14938. Specify the video size for the output. It must be even. For the syntax of this option,
  14939. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14940. Default value is @code{1920x1080}.
  14941. @item fps, rate, r
  14942. Set the output frame rate. Default value is @code{25}.
  14943. @item bar_h
  14944. Set the bargraph height. It must be even. Default value is @code{-1} which
  14945. computes the bargraph height automatically.
  14946. @item axis_h
  14947. Set the axis height. It must be even. Default value is @code{-1} which computes
  14948. the axis height automatically.
  14949. @item sono_h
  14950. Set the sonogram height. It must be even. Default value is @code{-1} which
  14951. computes the sonogram height automatically.
  14952. @item fullhd
  14953. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  14954. instead. Default value is @code{1}.
  14955. @item sono_v, volume
  14956. Specify the sonogram volume expression. It can contain variables:
  14957. @table @option
  14958. @item bar_v
  14959. the @var{bar_v} evaluated expression
  14960. @item frequency, freq, f
  14961. the frequency where it is evaluated
  14962. @item timeclamp, tc
  14963. the value of @var{timeclamp} option
  14964. @end table
  14965. and functions:
  14966. @table @option
  14967. @item a_weighting(f)
  14968. A-weighting of equal loudness
  14969. @item b_weighting(f)
  14970. B-weighting of equal loudness
  14971. @item c_weighting(f)
  14972. C-weighting of equal loudness.
  14973. @end table
  14974. Default value is @code{16}.
  14975. @item bar_v, volume2
  14976. Specify the bargraph volume expression. It can contain variables:
  14977. @table @option
  14978. @item sono_v
  14979. the @var{sono_v} evaluated expression
  14980. @item frequency, freq, f
  14981. the frequency where it is evaluated
  14982. @item timeclamp, tc
  14983. the value of @var{timeclamp} option
  14984. @end table
  14985. and functions:
  14986. @table @option
  14987. @item a_weighting(f)
  14988. A-weighting of equal loudness
  14989. @item b_weighting(f)
  14990. B-weighting of equal loudness
  14991. @item c_weighting(f)
  14992. C-weighting of equal loudness.
  14993. @end table
  14994. Default value is @code{sono_v}.
  14995. @item sono_g, gamma
  14996. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  14997. higher gamma makes the spectrum having more range. Default value is @code{3}.
  14998. Acceptable range is @code{[1, 7]}.
  14999. @item bar_g, gamma2
  15000. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  15001. @code{[1, 7]}.
  15002. @item bar_t
  15003. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  15004. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  15005. @item timeclamp, tc
  15006. Specify the transform timeclamp. At low frequency, there is trade-off between
  15007. accuracy in time domain and frequency domain. If timeclamp is lower,
  15008. event in time domain is represented more accurately (such as fast bass drum),
  15009. otherwise event in frequency domain is represented more accurately
  15010. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  15011. @item attack
  15012. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  15013. limits future samples by applying asymmetric windowing in time domain, useful
  15014. when low latency is required. Accepted range is @code{[0, 1]}.
  15015. @item basefreq
  15016. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  15017. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  15018. @item endfreq
  15019. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  15020. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  15021. @item coeffclamp
  15022. This option is deprecated and ignored.
  15023. @item tlength
  15024. Specify the transform length in time domain. Use this option to control accuracy
  15025. trade-off between time domain and frequency domain at every frequency sample.
  15026. It can contain variables:
  15027. @table @option
  15028. @item frequency, freq, f
  15029. the frequency where it is evaluated
  15030. @item timeclamp, tc
  15031. the value of @var{timeclamp} option.
  15032. @end table
  15033. Default value is @code{384*tc/(384+tc*f)}.
  15034. @item count
  15035. Specify the transform count for every video frame. Default value is @code{6}.
  15036. Acceptable range is @code{[1, 30]}.
  15037. @item fcount
  15038. Specify the transform count for every single pixel. Default value is @code{0},
  15039. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  15040. @item fontfile
  15041. Specify font file for use with freetype to draw the axis. If not specified,
  15042. use embedded font. Note that drawing with font file or embedded font is not
  15043. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  15044. option instead.
  15045. @item font
  15046. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  15047. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  15048. @item fontcolor
  15049. Specify font color expression. This is arithmetic expression that should return
  15050. integer value 0xRRGGBB. It can contain variables:
  15051. @table @option
  15052. @item frequency, freq, f
  15053. the frequency where it is evaluated
  15054. @item timeclamp, tc
  15055. the value of @var{timeclamp} option
  15056. @end table
  15057. and functions:
  15058. @table @option
  15059. @item midi(f)
  15060. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  15061. @item r(x), g(x), b(x)
  15062. red, green, and blue value of intensity x.
  15063. @end table
  15064. Default value is @code{st(0, (midi(f)-59.5)/12);
  15065. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  15066. r(1-ld(1)) + b(ld(1))}.
  15067. @item axisfile
  15068. Specify image file to draw the axis. This option override @var{fontfile} and
  15069. @var{fontcolor} option.
  15070. @item axis, text
  15071. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  15072. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  15073. Default value is @code{1}.
  15074. @item csp
  15075. Set colorspace. The accepted values are:
  15076. @table @samp
  15077. @item unspecified
  15078. Unspecified (default)
  15079. @item bt709
  15080. BT.709
  15081. @item fcc
  15082. FCC
  15083. @item bt470bg
  15084. BT.470BG or BT.601-6 625
  15085. @item smpte170m
  15086. SMPTE-170M or BT.601-6 525
  15087. @item smpte240m
  15088. SMPTE-240M
  15089. @item bt2020ncl
  15090. BT.2020 with non-constant luminance
  15091. @end table
  15092. @item cscheme
  15093. Set spectrogram color scheme. This is list of floating point values with format
  15094. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  15095. The default is @code{1|0.5|0|0|0.5|1}.
  15096. @end table
  15097. @subsection Examples
  15098. @itemize
  15099. @item
  15100. Playing audio while showing the spectrum:
  15101. @example
  15102. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  15103. @end example
  15104. @item
  15105. Same as above, but with frame rate 30 fps:
  15106. @example
  15107. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  15108. @end example
  15109. @item
  15110. Playing at 1280x720:
  15111. @example
  15112. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  15113. @end example
  15114. @item
  15115. Disable sonogram display:
  15116. @example
  15117. sono_h=0
  15118. @end example
  15119. @item
  15120. A1 and its harmonics: A1, A2, (near)E3, A3:
  15121. @example
  15122. 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),
  15123. asplit[a][out1]; [a] showcqt [out0]'
  15124. @end example
  15125. @item
  15126. Same as above, but with more accuracy in frequency domain:
  15127. @example
  15128. 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),
  15129. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  15130. @end example
  15131. @item
  15132. Custom volume:
  15133. @example
  15134. bar_v=10:sono_v=bar_v*a_weighting(f)
  15135. @end example
  15136. @item
  15137. Custom gamma, now spectrum is linear to the amplitude.
  15138. @example
  15139. bar_g=2:sono_g=2
  15140. @end example
  15141. @item
  15142. Custom tlength equation:
  15143. @example
  15144. 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)))'
  15145. @end example
  15146. @item
  15147. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  15148. @example
  15149. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  15150. @end example
  15151. @item
  15152. Custom font using fontconfig:
  15153. @example
  15154. font='Courier New,Monospace,mono|bold'
  15155. @end example
  15156. @item
  15157. Custom frequency range with custom axis using image file:
  15158. @example
  15159. axisfile=myaxis.png:basefreq=40:endfreq=10000
  15160. @end example
  15161. @end itemize
  15162. @section showfreqs
  15163. Convert input audio to video output representing the audio power spectrum.
  15164. Audio amplitude is on Y-axis while frequency is on X-axis.
  15165. The filter accepts the following options:
  15166. @table @option
  15167. @item size, s
  15168. Specify size of video. For the syntax of this option, check the
  15169. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15170. Default is @code{1024x512}.
  15171. @item mode
  15172. Set display mode.
  15173. This set how each frequency bin will be represented.
  15174. It accepts the following values:
  15175. @table @samp
  15176. @item line
  15177. @item bar
  15178. @item dot
  15179. @end table
  15180. Default is @code{bar}.
  15181. @item ascale
  15182. Set amplitude scale.
  15183. It accepts the following values:
  15184. @table @samp
  15185. @item lin
  15186. Linear scale.
  15187. @item sqrt
  15188. Square root scale.
  15189. @item cbrt
  15190. Cubic root scale.
  15191. @item log
  15192. Logarithmic scale.
  15193. @end table
  15194. Default is @code{log}.
  15195. @item fscale
  15196. Set frequency scale.
  15197. It accepts the following values:
  15198. @table @samp
  15199. @item lin
  15200. Linear scale.
  15201. @item log
  15202. Logarithmic scale.
  15203. @item rlog
  15204. Reverse logarithmic scale.
  15205. @end table
  15206. Default is @code{lin}.
  15207. @item win_size
  15208. Set window size.
  15209. It accepts the following values:
  15210. @table @samp
  15211. @item w16
  15212. @item w32
  15213. @item w64
  15214. @item w128
  15215. @item w256
  15216. @item w512
  15217. @item w1024
  15218. @item w2048
  15219. @item w4096
  15220. @item w8192
  15221. @item w16384
  15222. @item w32768
  15223. @item w65536
  15224. @end table
  15225. Default is @code{w2048}
  15226. @item win_func
  15227. Set windowing function.
  15228. It accepts the following values:
  15229. @table @samp
  15230. @item rect
  15231. @item bartlett
  15232. @item hanning
  15233. @item hamming
  15234. @item blackman
  15235. @item welch
  15236. @item flattop
  15237. @item bharris
  15238. @item bnuttall
  15239. @item bhann
  15240. @item sine
  15241. @item nuttall
  15242. @item lanczos
  15243. @item gauss
  15244. @item tukey
  15245. @item dolph
  15246. @item cauchy
  15247. @item parzen
  15248. @item poisson
  15249. @end table
  15250. Default is @code{hanning}.
  15251. @item overlap
  15252. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  15253. which means optimal overlap for selected window function will be picked.
  15254. @item averaging
  15255. Set time averaging. Setting this to 0 will display current maximal peaks.
  15256. Default is @code{1}, which means time averaging is disabled.
  15257. @item colors
  15258. Specify list of colors separated by space or by '|' which will be used to
  15259. draw channel frequencies. Unrecognized or missing colors will be replaced
  15260. by white color.
  15261. @item cmode
  15262. Set channel display mode.
  15263. It accepts the following values:
  15264. @table @samp
  15265. @item combined
  15266. @item separate
  15267. @end table
  15268. Default is @code{combined}.
  15269. @item minamp
  15270. Set minimum amplitude used in @code{log} amplitude scaler.
  15271. @end table
  15272. @anchor{showspectrum}
  15273. @section showspectrum
  15274. Convert input audio to a video output, representing the audio frequency
  15275. spectrum.
  15276. The filter accepts the following options:
  15277. @table @option
  15278. @item size, s
  15279. Specify the video size for the output. For the syntax of this option, check the
  15280. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15281. Default value is @code{640x512}.
  15282. @item slide
  15283. Specify how the spectrum should slide along the window.
  15284. It accepts the following values:
  15285. @table @samp
  15286. @item replace
  15287. the samples start again on the left when they reach the right
  15288. @item scroll
  15289. the samples scroll from right to left
  15290. @item fullframe
  15291. frames are only produced when the samples reach the right
  15292. @item rscroll
  15293. the samples scroll from left to right
  15294. @end table
  15295. Default value is @code{replace}.
  15296. @item mode
  15297. Specify display mode.
  15298. It accepts the following values:
  15299. @table @samp
  15300. @item combined
  15301. all channels are displayed in the same row
  15302. @item separate
  15303. all channels are displayed in separate rows
  15304. @end table
  15305. Default value is @samp{combined}.
  15306. @item color
  15307. Specify display color mode.
  15308. It accepts the following values:
  15309. @table @samp
  15310. @item channel
  15311. each channel is displayed in a separate color
  15312. @item intensity
  15313. each channel is displayed using the same color scheme
  15314. @item rainbow
  15315. each channel is displayed using the rainbow color scheme
  15316. @item moreland
  15317. each channel is displayed using the moreland color scheme
  15318. @item nebulae
  15319. each channel is displayed using the nebulae color scheme
  15320. @item fire
  15321. each channel is displayed using the fire color scheme
  15322. @item fiery
  15323. each channel is displayed using the fiery color scheme
  15324. @item fruit
  15325. each channel is displayed using the fruit color scheme
  15326. @item cool
  15327. each channel is displayed using the cool color scheme
  15328. @end table
  15329. Default value is @samp{channel}.
  15330. @item scale
  15331. Specify scale used for calculating intensity color values.
  15332. It accepts the following values:
  15333. @table @samp
  15334. @item lin
  15335. linear
  15336. @item sqrt
  15337. square root, default
  15338. @item cbrt
  15339. cubic root
  15340. @item log
  15341. logarithmic
  15342. @item 4thrt
  15343. 4th root
  15344. @item 5thrt
  15345. 5th root
  15346. @end table
  15347. Default value is @samp{sqrt}.
  15348. @item saturation
  15349. Set saturation modifier for displayed colors. Negative values provide
  15350. alternative color scheme. @code{0} is no saturation at all.
  15351. Saturation must be in [-10.0, 10.0] range.
  15352. Default value is @code{1}.
  15353. @item win_func
  15354. Set window function.
  15355. It accepts the following values:
  15356. @table @samp
  15357. @item rect
  15358. @item bartlett
  15359. @item hann
  15360. @item hanning
  15361. @item hamming
  15362. @item blackman
  15363. @item welch
  15364. @item flattop
  15365. @item bharris
  15366. @item bnuttall
  15367. @item bhann
  15368. @item sine
  15369. @item nuttall
  15370. @item lanczos
  15371. @item gauss
  15372. @item tukey
  15373. @item dolph
  15374. @item cauchy
  15375. @item parzen
  15376. @item poisson
  15377. @end table
  15378. Default value is @code{hann}.
  15379. @item orientation
  15380. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15381. @code{horizontal}. Default is @code{vertical}.
  15382. @item overlap
  15383. Set ratio of overlap window. Default value is @code{0}.
  15384. When value is @code{1} overlap is set to recommended size for specific
  15385. window function currently used.
  15386. @item gain
  15387. Set scale gain for calculating intensity color values.
  15388. Default value is @code{1}.
  15389. @item data
  15390. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  15391. @item rotation
  15392. Set color rotation, must be in [-1.0, 1.0] range.
  15393. Default value is @code{0}.
  15394. @end table
  15395. The usage is very similar to the showwaves filter; see the examples in that
  15396. section.
  15397. @subsection Examples
  15398. @itemize
  15399. @item
  15400. Large window with logarithmic color scaling:
  15401. @example
  15402. showspectrum=s=1280x480:scale=log
  15403. @end example
  15404. @item
  15405. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  15406. @example
  15407. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15408. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  15409. @end example
  15410. @end itemize
  15411. @section showspectrumpic
  15412. Convert input audio to a single video frame, representing the audio frequency
  15413. spectrum.
  15414. The filter accepts the following options:
  15415. @table @option
  15416. @item size, s
  15417. Specify the video size for the output. For the syntax of this option, check the
  15418. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15419. Default value is @code{4096x2048}.
  15420. @item mode
  15421. Specify display mode.
  15422. It accepts the following values:
  15423. @table @samp
  15424. @item combined
  15425. all channels are displayed in the same row
  15426. @item separate
  15427. all channels are displayed in separate rows
  15428. @end table
  15429. Default value is @samp{combined}.
  15430. @item color
  15431. Specify display color mode.
  15432. It accepts the following values:
  15433. @table @samp
  15434. @item channel
  15435. each channel is displayed in a separate color
  15436. @item intensity
  15437. each channel is displayed using the same color scheme
  15438. @item rainbow
  15439. each channel is displayed using the rainbow color scheme
  15440. @item moreland
  15441. each channel is displayed using the moreland color scheme
  15442. @item nebulae
  15443. each channel is displayed using the nebulae color scheme
  15444. @item fire
  15445. each channel is displayed using the fire color scheme
  15446. @item fiery
  15447. each channel is displayed using the fiery color scheme
  15448. @item fruit
  15449. each channel is displayed using the fruit color scheme
  15450. @item cool
  15451. each channel is displayed using the cool color scheme
  15452. @end table
  15453. Default value is @samp{intensity}.
  15454. @item scale
  15455. Specify scale used for calculating intensity color values.
  15456. It accepts the following values:
  15457. @table @samp
  15458. @item lin
  15459. linear
  15460. @item sqrt
  15461. square root, default
  15462. @item cbrt
  15463. cubic root
  15464. @item log
  15465. logarithmic
  15466. @item 4thrt
  15467. 4th root
  15468. @item 5thrt
  15469. 5th root
  15470. @end table
  15471. Default value is @samp{log}.
  15472. @item saturation
  15473. Set saturation modifier for displayed colors. Negative values provide
  15474. alternative color scheme. @code{0} is no saturation at all.
  15475. Saturation must be in [-10.0, 10.0] range.
  15476. Default value is @code{1}.
  15477. @item win_func
  15478. Set window function.
  15479. It accepts the following values:
  15480. @table @samp
  15481. @item rect
  15482. @item bartlett
  15483. @item hann
  15484. @item hanning
  15485. @item hamming
  15486. @item blackman
  15487. @item welch
  15488. @item flattop
  15489. @item bharris
  15490. @item bnuttall
  15491. @item bhann
  15492. @item sine
  15493. @item nuttall
  15494. @item lanczos
  15495. @item gauss
  15496. @item tukey
  15497. @item dolph
  15498. @item cauchy
  15499. @item parzen
  15500. @item poisson
  15501. @end table
  15502. Default value is @code{hann}.
  15503. @item orientation
  15504. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15505. @code{horizontal}. Default is @code{vertical}.
  15506. @item gain
  15507. Set scale gain for calculating intensity color values.
  15508. Default value is @code{1}.
  15509. @item legend
  15510. Draw time and frequency axes and legends. Default is enabled.
  15511. @item rotation
  15512. Set color rotation, must be in [-1.0, 1.0] range.
  15513. Default value is @code{0}.
  15514. @end table
  15515. @subsection Examples
  15516. @itemize
  15517. @item
  15518. Extract an audio spectrogram of a whole audio track
  15519. in a 1024x1024 picture using @command{ffmpeg}:
  15520. @example
  15521. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  15522. @end example
  15523. @end itemize
  15524. @section showvolume
  15525. Convert input audio volume to a video output.
  15526. The filter accepts the following options:
  15527. @table @option
  15528. @item rate, r
  15529. Set video rate.
  15530. @item b
  15531. Set border width, allowed range is [0, 5]. Default is 1.
  15532. @item w
  15533. Set channel width, allowed range is [80, 8192]. Default is 400.
  15534. @item h
  15535. Set channel height, allowed range is [1, 900]. Default is 20.
  15536. @item f
  15537. Set fade, allowed range is [0, 1]. Default is 0.95.
  15538. @item c
  15539. Set volume color expression.
  15540. The expression can use the following variables:
  15541. @table @option
  15542. @item VOLUME
  15543. Current max volume of channel in dB.
  15544. @item PEAK
  15545. Current peak.
  15546. @item CHANNEL
  15547. Current channel number, starting from 0.
  15548. @end table
  15549. @item t
  15550. If set, displays channel names. Default is enabled.
  15551. @item v
  15552. If set, displays volume values. Default is enabled.
  15553. @item o
  15554. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  15555. default is @code{h}.
  15556. @item s
  15557. Set step size, allowed range is [0, 5]. Default is 0, which means
  15558. step is disabled.
  15559. @item p
  15560. Set background opacity, allowed range is [0, 1]. Default is 0.
  15561. @item m
  15562. Set metering mode, can be peak: @code{p} or rms: @code{r},
  15563. default is @code{p}.
  15564. @item ds
  15565. Set display scale, can be linear: @code{lin} or log: @code{log},
  15566. default is @code{lin}.
  15567. @item dm
  15568. In second.
  15569. If set to > 0., display a line for the max level
  15570. in the previous seconds.
  15571. default is disabled: @code{0.}
  15572. @item dmc
  15573. The color of the max line. Use when @code{dm} option is set to > 0.
  15574. default is: @code{orange}
  15575. @end table
  15576. @section showwaves
  15577. Convert input audio to a video output, representing the samples waves.
  15578. The filter accepts the following options:
  15579. @table @option
  15580. @item size, s
  15581. Specify the video size for the output. For the syntax of this option, check the
  15582. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15583. Default value is @code{600x240}.
  15584. @item mode
  15585. Set display mode.
  15586. Available values are:
  15587. @table @samp
  15588. @item point
  15589. Draw a point for each sample.
  15590. @item line
  15591. Draw a vertical line for each sample.
  15592. @item p2p
  15593. Draw a point for each sample and a line between them.
  15594. @item cline
  15595. Draw a centered vertical line for each sample.
  15596. @end table
  15597. Default value is @code{point}.
  15598. @item n
  15599. Set the number of samples which are printed on the same column. A
  15600. larger value will decrease the frame rate. Must be a positive
  15601. integer. This option can be set only if the value for @var{rate}
  15602. is not explicitly specified.
  15603. @item rate, r
  15604. Set the (approximate) output frame rate. This is done by setting the
  15605. option @var{n}. Default value is "25".
  15606. @item split_channels
  15607. Set if channels should be drawn separately or overlap. Default value is 0.
  15608. @item colors
  15609. Set colors separated by '|' which are going to be used for drawing of each channel.
  15610. @item scale
  15611. Set amplitude scale.
  15612. Available values are:
  15613. @table @samp
  15614. @item lin
  15615. Linear.
  15616. @item log
  15617. Logarithmic.
  15618. @item sqrt
  15619. Square root.
  15620. @item cbrt
  15621. Cubic root.
  15622. @end table
  15623. Default is linear.
  15624. @item draw
  15625. Set the draw mode. This is mostly useful to set for high @var{n}.
  15626. Available values are:
  15627. @table @samp
  15628. @item scale
  15629. Scale pixel values for each drawn sample.
  15630. @item full
  15631. Draw every sample directly.
  15632. @end table
  15633. Default value is @code{scale}.
  15634. @end table
  15635. @subsection Examples
  15636. @itemize
  15637. @item
  15638. Output the input file audio and the corresponding video representation
  15639. at the same time:
  15640. @example
  15641. amovie=a.mp3,asplit[out0],showwaves[out1]
  15642. @end example
  15643. @item
  15644. Create a synthetic signal and show it with showwaves, forcing a
  15645. frame rate of 30 frames per second:
  15646. @example
  15647. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  15648. @end example
  15649. @end itemize
  15650. @section showwavespic
  15651. Convert input audio to a single video frame, representing the samples waves.
  15652. The filter accepts the following options:
  15653. @table @option
  15654. @item size, s
  15655. Specify the video size for the output. For the syntax of this option, check the
  15656. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15657. Default value is @code{600x240}.
  15658. @item split_channels
  15659. Set if channels should be drawn separately or overlap. Default value is 0.
  15660. @item colors
  15661. Set colors separated by '|' which are going to be used for drawing of each channel.
  15662. @item scale
  15663. Set amplitude scale.
  15664. Available values are:
  15665. @table @samp
  15666. @item lin
  15667. Linear.
  15668. @item log
  15669. Logarithmic.
  15670. @item sqrt
  15671. Square root.
  15672. @item cbrt
  15673. Cubic root.
  15674. @end table
  15675. Default is linear.
  15676. @end table
  15677. @subsection Examples
  15678. @itemize
  15679. @item
  15680. Extract a channel split representation of the wave form of a whole audio track
  15681. in a 1024x800 picture using @command{ffmpeg}:
  15682. @example
  15683. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  15684. @end example
  15685. @end itemize
  15686. @section sidedata, asidedata
  15687. Delete frame side data, or select frames based on it.
  15688. This filter accepts the following options:
  15689. @table @option
  15690. @item mode
  15691. Set mode of operation of the filter.
  15692. Can be one of the following:
  15693. @table @samp
  15694. @item select
  15695. Select every frame with side data of @code{type}.
  15696. @item delete
  15697. Delete side data of @code{type}. If @code{type} is not set, delete all side
  15698. data in the frame.
  15699. @end table
  15700. @item type
  15701. Set side data type used with all modes. Must be set for @code{select} mode. For
  15702. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  15703. in @file{libavutil/frame.h}. For example, to choose
  15704. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  15705. @end table
  15706. @section spectrumsynth
  15707. Sythesize audio from 2 input video spectrums, first input stream represents
  15708. magnitude across time and second represents phase across time.
  15709. The filter will transform from frequency domain as displayed in videos back
  15710. to time domain as presented in audio output.
  15711. This filter is primarily created for reversing processed @ref{showspectrum}
  15712. filter outputs, but can synthesize sound from other spectrograms too.
  15713. But in such case results are going to be poor if the phase data is not
  15714. available, because in such cases phase data need to be recreated, usually
  15715. its just recreated from random noise.
  15716. For best results use gray only output (@code{channel} color mode in
  15717. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  15718. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  15719. @code{data} option. Inputs videos should generally use @code{fullframe}
  15720. slide mode as that saves resources needed for decoding video.
  15721. The filter accepts the following options:
  15722. @table @option
  15723. @item sample_rate
  15724. Specify sample rate of output audio, the sample rate of audio from which
  15725. spectrum was generated may differ.
  15726. @item channels
  15727. Set number of channels represented in input video spectrums.
  15728. @item scale
  15729. Set scale which was used when generating magnitude input spectrum.
  15730. Can be @code{lin} or @code{log}. Default is @code{log}.
  15731. @item slide
  15732. Set slide which was used when generating inputs spectrums.
  15733. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  15734. Default is @code{fullframe}.
  15735. @item win_func
  15736. Set window function used for resynthesis.
  15737. @item overlap
  15738. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  15739. which means optimal overlap for selected window function will be picked.
  15740. @item orientation
  15741. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  15742. Default is @code{vertical}.
  15743. @end table
  15744. @subsection Examples
  15745. @itemize
  15746. @item
  15747. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  15748. then resynthesize videos back to audio with spectrumsynth:
  15749. @example
  15750. 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
  15751. 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
  15752. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  15753. @end example
  15754. @end itemize
  15755. @section split, asplit
  15756. Split input into several identical outputs.
  15757. @code{asplit} works with audio input, @code{split} with video.
  15758. The filter accepts a single parameter which specifies the number of outputs. If
  15759. unspecified, it defaults to 2.
  15760. @subsection Examples
  15761. @itemize
  15762. @item
  15763. Create two separate outputs from the same input:
  15764. @example
  15765. [in] split [out0][out1]
  15766. @end example
  15767. @item
  15768. To create 3 or more outputs, you need to specify the number of
  15769. outputs, like in:
  15770. @example
  15771. [in] asplit=3 [out0][out1][out2]
  15772. @end example
  15773. @item
  15774. Create two separate outputs from the same input, one cropped and
  15775. one padded:
  15776. @example
  15777. [in] split [splitout1][splitout2];
  15778. [splitout1] crop=100:100:0:0 [cropout];
  15779. [splitout2] pad=200:200:100:100 [padout];
  15780. @end example
  15781. @item
  15782. Create 5 copies of the input audio with @command{ffmpeg}:
  15783. @example
  15784. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  15785. @end example
  15786. @end itemize
  15787. @section zmq, azmq
  15788. Receive commands sent through a libzmq client, and forward them to
  15789. filters in the filtergraph.
  15790. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  15791. must be inserted between two video filters, @code{azmq} between two
  15792. audio filters. Both are capable to send messages to any filter type.
  15793. To enable these filters you need to install the libzmq library and
  15794. headers and configure FFmpeg with @code{--enable-libzmq}.
  15795. For more information about libzmq see:
  15796. @url{http://www.zeromq.org/}
  15797. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  15798. receives messages sent through a network interface defined by the
  15799. @option{bind_address} (or the abbreviation "@option{b}") option.
  15800. Default value of this option is @file{tcp://localhost:5555}. You may
  15801. want to alter this value to your needs, but do not forget to escape any
  15802. ':' signs (see @ref{filtergraph escaping}).
  15803. The received message must be in the form:
  15804. @example
  15805. @var{TARGET} @var{COMMAND} [@var{ARG}]
  15806. @end example
  15807. @var{TARGET} specifies the target of the command, usually the name of
  15808. the filter class or a specific filter instance name. The default
  15809. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  15810. but you can override this by using the @samp{filter_name@@id} syntax
  15811. (see @ref{Filtergraph syntax}).
  15812. @var{COMMAND} specifies the name of the command for the target filter.
  15813. @var{ARG} is optional and specifies the optional argument list for the
  15814. given @var{COMMAND}.
  15815. Upon reception, the message is processed and the corresponding command
  15816. is injected into the filtergraph. Depending on the result, the filter
  15817. will send a reply to the client, adopting the format:
  15818. @example
  15819. @var{ERROR_CODE} @var{ERROR_REASON}
  15820. @var{MESSAGE}
  15821. @end example
  15822. @var{MESSAGE} is optional.
  15823. @subsection Examples
  15824. Look at @file{tools/zmqsend} for an example of a zmq client which can
  15825. be used to send commands processed by these filters.
  15826. Consider the following filtergraph generated by @command{ffplay}.
  15827. In this example the last overlay filter has an instance name. All other
  15828. filters will have default instance names.
  15829. @example
  15830. ffplay -dumpgraph 1 -f lavfi "
  15831. color=s=100x100:c=red [l];
  15832. color=s=100x100:c=blue [r];
  15833. nullsrc=s=200x100, zmq [bg];
  15834. [bg][l] overlay [bg+l];
  15835. [bg+l][r] overlay@@my=x=100 "
  15836. @end example
  15837. To change the color of the left side of the video, the following
  15838. command can be used:
  15839. @example
  15840. echo Parsed_color_0 c yellow | tools/zmqsend
  15841. @end example
  15842. To change the right side:
  15843. @example
  15844. echo Parsed_color_1 c pink | tools/zmqsend
  15845. @end example
  15846. To change the position of the right side:
  15847. @example
  15848. echo overlay@@my x 150 | tools/zmqsend
  15849. @end example
  15850. @c man end MULTIMEDIA FILTERS
  15851. @chapter Multimedia Sources
  15852. @c man begin MULTIMEDIA SOURCES
  15853. Below is a description of the currently available multimedia sources.
  15854. @section amovie
  15855. This is the same as @ref{movie} source, except it selects an audio
  15856. stream by default.
  15857. @anchor{movie}
  15858. @section movie
  15859. Read audio and/or video stream(s) from a movie container.
  15860. It accepts the following parameters:
  15861. @table @option
  15862. @item filename
  15863. The name of the resource to read (not necessarily a file; it can also be a
  15864. device or a stream accessed through some protocol).
  15865. @item format_name, f
  15866. Specifies the format assumed for the movie to read, and can be either
  15867. the name of a container or an input device. If not specified, the
  15868. format is guessed from @var{movie_name} or by probing.
  15869. @item seek_point, sp
  15870. Specifies the seek point in seconds. The frames will be output
  15871. starting from this seek point. The parameter is evaluated with
  15872. @code{av_strtod}, so the numerical value may be suffixed by an IS
  15873. postfix. The default value is "0".
  15874. @item streams, s
  15875. Specifies the streams to read. Several streams can be specified,
  15876. separated by "+". The source will then have as many outputs, in the
  15877. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  15878. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  15879. respectively the default (best suited) video and audio stream. Default
  15880. is "dv", or "da" if the filter is called as "amovie".
  15881. @item stream_index, si
  15882. Specifies the index of the video stream to read. If the value is -1,
  15883. the most suitable video stream will be automatically selected. The default
  15884. value is "-1". Deprecated. If the filter is called "amovie", it will select
  15885. audio instead of video.
  15886. @item loop
  15887. Specifies how many times to read the stream in sequence.
  15888. If the value is 0, the stream will be looped infinitely.
  15889. Default value is "1".
  15890. Note that when the movie is looped the source timestamps are not
  15891. changed, so it will generate non monotonically increasing timestamps.
  15892. @item discontinuity
  15893. Specifies the time difference between frames above which the point is
  15894. considered a timestamp discontinuity which is removed by adjusting the later
  15895. timestamps.
  15896. @end table
  15897. It allows overlaying a second video on top of the main input of
  15898. a filtergraph, as shown in this graph:
  15899. @example
  15900. input -----------> deltapts0 --> overlay --> output
  15901. ^
  15902. |
  15903. movie --> scale--> deltapts1 -------+
  15904. @end example
  15905. @subsection Examples
  15906. @itemize
  15907. @item
  15908. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  15909. on top of the input labelled "in":
  15910. @example
  15911. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15912. [in] setpts=PTS-STARTPTS [main];
  15913. [main][over] overlay=16:16 [out]
  15914. @end example
  15915. @item
  15916. Read from a video4linux2 device, and overlay it on top of the input
  15917. labelled "in":
  15918. @example
  15919. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15920. [in] setpts=PTS-STARTPTS [main];
  15921. [main][over] overlay=16:16 [out]
  15922. @end example
  15923. @item
  15924. Read the first video stream and the audio stream with id 0x81 from
  15925. dvd.vob; the video is connected to the pad named "video" and the audio is
  15926. connected to the pad named "audio":
  15927. @example
  15928. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  15929. @end example
  15930. @end itemize
  15931. @subsection Commands
  15932. Both movie and amovie support the following commands:
  15933. @table @option
  15934. @item seek
  15935. Perform seek using "av_seek_frame".
  15936. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  15937. @itemize
  15938. @item
  15939. @var{stream_index}: If stream_index is -1, a default
  15940. stream is selected, and @var{timestamp} is automatically converted
  15941. from AV_TIME_BASE units to the stream specific time_base.
  15942. @item
  15943. @var{timestamp}: Timestamp in AVStream.time_base units
  15944. or, if no stream is specified, in AV_TIME_BASE units.
  15945. @item
  15946. @var{flags}: Flags which select direction and seeking mode.
  15947. @end itemize
  15948. @item get_duration
  15949. Get movie duration in AV_TIME_BASE units.
  15950. @end table
  15951. @c man end MULTIMEDIA SOURCES