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.

22788 lines
607KB

  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 compression/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 acrossover
  392. Split audio stream into several bands.
  393. This filter splits audio stream into two or more frequency ranges.
  394. Summing all streams back will give flat output.
  395. The filter accepts the following options:
  396. @table @option
  397. @item split
  398. Set split frequencies. Those must be positive and increasing.
  399. @item order
  400. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  401. Default is @var{4th}.
  402. @end table
  403. @section acrusher
  404. Reduce audio bit resolution.
  405. This filter is bit crusher with enhanced functionality. A bit crusher
  406. is used to audibly reduce number of bits an audio signal is sampled
  407. with. This doesn't change the bit depth at all, it just produces the
  408. effect. Material reduced in bit depth sounds more harsh and "digital".
  409. This filter is able to even round to continuous values instead of discrete
  410. bit depths.
  411. Additionally it has a D/C offset which results in different crushing of
  412. the lower and the upper half of the signal.
  413. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  414. Another feature of this filter is the logarithmic mode.
  415. This setting switches from linear distances between bits to logarithmic ones.
  416. The result is a much more "natural" sounding crusher which doesn't gate low
  417. signals for example. The human ear has a logarithmic perception,
  418. so this kind of crushing is much more pleasant.
  419. Logarithmic crushing is also able to get anti-aliased.
  420. The filter accepts the following options:
  421. @table @option
  422. @item level_in
  423. Set level in.
  424. @item level_out
  425. Set level out.
  426. @item bits
  427. Set bit reduction.
  428. @item mix
  429. Set mixing amount.
  430. @item mode
  431. Can be linear: @code{lin} or logarithmic: @code{log}.
  432. @item dc
  433. Set DC.
  434. @item aa
  435. Set anti-aliasing.
  436. @item samples
  437. Set sample reduction.
  438. @item lfo
  439. Enable LFO. By default disabled.
  440. @item lforange
  441. Set LFO range.
  442. @item lforate
  443. Set LFO rate.
  444. @end table
  445. @section acue
  446. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  447. filter.
  448. @section adeclick
  449. Remove impulsive noise from input audio.
  450. Samples detected as impulsive noise are replaced by interpolated samples using
  451. autoregressive modelling.
  452. @table @option
  453. @item w
  454. Set window size, in milliseconds. Allowed range is from @code{10} to
  455. @code{100}. Default value is @code{55} milliseconds.
  456. This sets size of window which will be processed at once.
  457. @item o
  458. Set window overlap, in percentage of window size. Allowed range is from
  459. @code{50} to @code{95}. Default value is @code{75} percent.
  460. Setting this to a very high value increases impulsive noise removal but makes
  461. whole process much slower.
  462. @item a
  463. Set autoregression order, in percentage of window size. Allowed range is from
  464. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  465. controls quality of interpolated samples using neighbour good samples.
  466. @item t
  467. Set threshold value. Allowed range is from @code{1} to @code{100}.
  468. Default value is @code{2}.
  469. This controls the strength of impulsive noise which is going to be removed.
  470. The lower value, the more samples will be detected as impulsive noise.
  471. @item b
  472. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  473. @code{10}. Default value is @code{2}.
  474. If any two samples detected as noise are spaced less than this value then any
  475. sample between those two samples will be also detected as noise.
  476. @item m
  477. Set overlap method.
  478. It accepts the following values:
  479. @table @option
  480. @item a
  481. Select overlap-add method. Even not interpolated samples are slightly
  482. changed with this method.
  483. @item s
  484. Select overlap-save method. Not interpolated samples remain unchanged.
  485. @end table
  486. Default value is @code{a}.
  487. @end table
  488. @section adeclip
  489. Remove clipped samples from input audio.
  490. Samples detected as clipped are replaced by interpolated samples using
  491. autoregressive modelling.
  492. @table @option
  493. @item w
  494. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  495. Default value is @code{55} milliseconds.
  496. This sets size of window which will be processed at once.
  497. @item o
  498. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  499. to @code{95}. Default value is @code{75} percent.
  500. @item a
  501. Set autoregression order, in percentage of window size. Allowed range is from
  502. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  503. quality of interpolated samples using neighbour good samples.
  504. @item t
  505. Set threshold value. Allowed range is from @code{1} to @code{100}.
  506. Default value is @code{10}. Higher values make clip detection less aggressive.
  507. @item n
  508. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  509. Default value is @code{1000}. Higher values make clip detection less aggressive.
  510. @item m
  511. Set overlap method.
  512. It accepts the following values:
  513. @table @option
  514. @item a
  515. Select overlap-add method. Even not interpolated samples are slightly changed
  516. with this method.
  517. @item s
  518. Select overlap-save method. Not interpolated samples remain unchanged.
  519. @end table
  520. Default value is @code{a}.
  521. @end table
  522. @section adelay
  523. Delay one or more audio channels.
  524. Samples in delayed channel are filled with silence.
  525. The filter accepts the following option:
  526. @table @option
  527. @item delays
  528. Set list of delays in milliseconds for each channel separated by '|'.
  529. Unused delays will be silently ignored. If number of given delays is
  530. smaller than number of channels all remaining channels will not be delayed.
  531. If you want to delay exact number of samples, append 'S' to number.
  532. If you want instead to delay in seconds, append 's' to number.
  533. @end table
  534. @subsection Examples
  535. @itemize
  536. @item
  537. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  538. the second channel (and any other channels that may be present) unchanged.
  539. @example
  540. adelay=1500|0|500
  541. @end example
  542. @item
  543. Delay second channel by 500 samples, the third channel by 700 samples and leave
  544. the first channel (and any other channels that may be present) unchanged.
  545. @example
  546. adelay=0|500S|700S
  547. @end example
  548. @end itemize
  549. @section aderivative, aintegral
  550. Compute derivative/integral of audio stream.
  551. Applying both filters one after another produces original audio.
  552. @section aecho
  553. Apply echoing to the input audio.
  554. Echoes are reflected sound and can occur naturally amongst mountains
  555. (and sometimes large buildings) when talking or shouting; digital echo
  556. effects emulate this behaviour and are often used to help fill out the
  557. sound of a single instrument or vocal. The time difference between the
  558. original signal and the reflection is the @code{delay}, and the
  559. loudness of the reflected signal is the @code{decay}.
  560. Multiple echoes can have different delays and decays.
  561. A description of the accepted parameters follows.
  562. @table @option
  563. @item in_gain
  564. Set input gain of reflected signal. Default is @code{0.6}.
  565. @item out_gain
  566. Set output gain of reflected signal. Default is @code{0.3}.
  567. @item delays
  568. Set list of time intervals in milliseconds between original signal and reflections
  569. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  570. Default is @code{1000}.
  571. @item decays
  572. Set list of loudness of reflected signals separated by '|'.
  573. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  574. Default is @code{0.5}.
  575. @end table
  576. @subsection Examples
  577. @itemize
  578. @item
  579. Make it sound as if there are twice as many instruments as are actually playing:
  580. @example
  581. aecho=0.8:0.88:60:0.4
  582. @end example
  583. @item
  584. If delay is very short, then it sound like a (metallic) robot playing music:
  585. @example
  586. aecho=0.8:0.88:6:0.4
  587. @end example
  588. @item
  589. A longer delay will sound like an open air concert in the mountains:
  590. @example
  591. aecho=0.8:0.9:1000:0.3
  592. @end example
  593. @item
  594. Same as above but with one more mountain:
  595. @example
  596. aecho=0.8:0.9:1000|1800:0.3|0.25
  597. @end example
  598. @end itemize
  599. @section aemphasis
  600. Audio emphasis filter creates or restores material directly taken from LPs or
  601. emphased CDs with different filter curves. E.g. to store music on vinyl the
  602. signal has to be altered by a filter first to even out the disadvantages of
  603. this recording medium.
  604. Once the material is played back the inverse filter has to be applied to
  605. restore the distortion of the frequency response.
  606. The filter accepts the following options:
  607. @table @option
  608. @item level_in
  609. Set input gain.
  610. @item level_out
  611. Set output gain.
  612. @item mode
  613. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  614. use @code{production} mode. Default is @code{reproduction} mode.
  615. @item type
  616. Set filter type. Selects medium. Can be one of the following:
  617. @table @option
  618. @item col
  619. select Columbia.
  620. @item emi
  621. select EMI.
  622. @item bsi
  623. select BSI (78RPM).
  624. @item riaa
  625. select RIAA.
  626. @item cd
  627. select Compact Disc (CD).
  628. @item 50fm
  629. select 50µs (FM).
  630. @item 75fm
  631. select 75µs (FM).
  632. @item 50kf
  633. select 50µs (FM-KF).
  634. @item 75kf
  635. select 75µs (FM-KF).
  636. @end table
  637. @end table
  638. @section aeval
  639. Modify an audio signal according to the specified expressions.
  640. This filter accepts one or more expressions (one for each channel),
  641. which are evaluated and used to modify a corresponding audio signal.
  642. It accepts the following parameters:
  643. @table @option
  644. @item exprs
  645. Set the '|'-separated expressions list for each separate channel. If
  646. the number of input channels is greater than the number of
  647. expressions, the last specified expression is used for the remaining
  648. output channels.
  649. @item channel_layout, c
  650. Set output channel layout. If not specified, the channel layout is
  651. specified by the number of expressions. If set to @samp{same}, it will
  652. use by default the same input channel layout.
  653. @end table
  654. Each expression in @var{exprs} can contain the following constants and functions:
  655. @table @option
  656. @item ch
  657. channel number of the current expression
  658. @item n
  659. number of the evaluated sample, starting from 0
  660. @item s
  661. sample rate
  662. @item t
  663. time of the evaluated sample expressed in seconds
  664. @item nb_in_channels
  665. @item nb_out_channels
  666. input and output number of channels
  667. @item val(CH)
  668. the value of input channel with number @var{CH}
  669. @end table
  670. Note: this filter is slow. For faster processing you should use a
  671. dedicated filter.
  672. @subsection Examples
  673. @itemize
  674. @item
  675. Half volume:
  676. @example
  677. aeval=val(ch)/2:c=same
  678. @end example
  679. @item
  680. Invert phase of the second channel:
  681. @example
  682. aeval=val(0)|-val(1)
  683. @end example
  684. @end itemize
  685. @anchor{afade}
  686. @section afade
  687. Apply fade-in/out effect to input audio.
  688. A description of the accepted parameters follows.
  689. @table @option
  690. @item type, t
  691. Specify the effect type, can be either @code{in} for fade-in, or
  692. @code{out} for a fade-out effect. Default is @code{in}.
  693. @item start_sample, ss
  694. Specify the number of the start sample for starting to apply the fade
  695. effect. Default is 0.
  696. @item nb_samples, ns
  697. Specify the number of samples for which the fade effect has to last. At
  698. the end of the fade-in effect the output audio will have the same
  699. volume as the input audio, at the end of the fade-out transition
  700. the output audio will be silence. Default is 44100.
  701. @item start_time, st
  702. Specify the start time of the fade effect. Default is 0.
  703. The value must be specified as a time duration; see
  704. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  705. for the accepted syntax.
  706. If set this option is used instead of @var{start_sample}.
  707. @item duration, d
  708. Specify the duration of the fade effect. See
  709. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  710. for the accepted syntax.
  711. At the end of the fade-in effect the output audio will have the same
  712. volume as the input audio, at the end of the fade-out transition
  713. the output audio will be silence.
  714. By default the duration is determined by @var{nb_samples}.
  715. If set this option is used instead of @var{nb_samples}.
  716. @item curve
  717. Set curve for fade transition.
  718. It accepts the following values:
  719. @table @option
  720. @item tri
  721. select triangular, linear slope (default)
  722. @item qsin
  723. select quarter of sine wave
  724. @item hsin
  725. select half of sine wave
  726. @item esin
  727. select exponential sine wave
  728. @item log
  729. select logarithmic
  730. @item ipar
  731. select inverted parabola
  732. @item qua
  733. select quadratic
  734. @item cub
  735. select cubic
  736. @item squ
  737. select square root
  738. @item cbr
  739. select cubic root
  740. @item par
  741. select parabola
  742. @item exp
  743. select exponential
  744. @item iqsin
  745. select inverted quarter of sine wave
  746. @item ihsin
  747. select inverted half of sine wave
  748. @item dese
  749. select double-exponential seat
  750. @item desi
  751. select double-exponential sigmoid
  752. @item losi
  753. select logistic sigmoid
  754. @item nofade
  755. no fade applied
  756. @end table
  757. @end table
  758. @subsection Examples
  759. @itemize
  760. @item
  761. Fade in first 15 seconds of audio:
  762. @example
  763. afade=t=in:ss=0:d=15
  764. @end example
  765. @item
  766. Fade out last 25 seconds of a 900 seconds audio:
  767. @example
  768. afade=t=out:st=875:d=25
  769. @end example
  770. @end itemize
  771. @section afftdn
  772. Denoise audio samples with FFT.
  773. A description of the accepted parameters follows.
  774. @table @option
  775. @item nr
  776. Set the noise reduction in dB, allowed range is 0.01 to 97.
  777. Default value is 12 dB.
  778. @item nf
  779. Set the noise floor in dB, allowed range is -80 to -20.
  780. Default value is -50 dB.
  781. @item nt
  782. Set the noise type.
  783. It accepts the following values:
  784. @table @option
  785. @item w
  786. Select white noise.
  787. @item v
  788. Select vinyl noise.
  789. @item s
  790. Select shellac noise.
  791. @item c
  792. Select custom noise, defined in @code{bn} option.
  793. Default value is white noise.
  794. @end table
  795. @item bn
  796. Set custom band noise for every one of 15 bands.
  797. Bands are separated by ' ' or '|'.
  798. @item rf
  799. Set the residual floor in dB, allowed range is -80 to -20.
  800. Default value is -38 dB.
  801. @item tn
  802. Enable noise tracking. By default is disabled.
  803. With this enabled, noise floor is automatically adjusted.
  804. @item tr
  805. Enable residual tracking. By default is disabled.
  806. @item om
  807. Set the output mode.
  808. It accepts the following values:
  809. @table @option
  810. @item i
  811. Pass input unchanged.
  812. @item o
  813. Pass noise filtered out.
  814. @item n
  815. Pass only noise.
  816. Default value is @var{o}.
  817. @end table
  818. @end table
  819. @subsection Commands
  820. This filter supports the following commands:
  821. @table @option
  822. @item sample_noise, sn
  823. Start or stop measuring noise profile.
  824. Syntax for the command is : "start" or "stop" string.
  825. After measuring noise profile is stopped it will be
  826. automatically applied in filtering.
  827. @item noise_reduction, nr
  828. Change noise reduction. Argument is single float number.
  829. Syntax for the command is : "@var{noise_reduction}"
  830. @item noise_floor, nf
  831. Change noise floor. Argument is single float number.
  832. Syntax for the command is : "@var{noise_floor}"
  833. @item output_mode, om
  834. Change output mode operation.
  835. Syntax for the command is : "i", "o" or "n" string.
  836. @end table
  837. @section afftfilt
  838. Apply arbitrary expressions to samples in frequency domain.
  839. @table @option
  840. @item real
  841. Set frequency domain real expression for each separate channel separated
  842. by '|'. Default is "re".
  843. If the number of input channels is greater than the number of
  844. expressions, the last specified expression is used for the remaining
  845. output channels.
  846. @item imag
  847. Set frequency domain imaginary expression for each separate channel
  848. separated by '|'. Default is "im".
  849. Each expression in @var{real} and @var{imag} can contain the following
  850. constants and functions:
  851. @table @option
  852. @item sr
  853. sample rate
  854. @item b
  855. current frequency bin number
  856. @item nb
  857. number of available bins
  858. @item ch
  859. channel number of the current expression
  860. @item chs
  861. number of channels
  862. @item pts
  863. current frame pts
  864. @item re
  865. current real part of frequency bin of current channel
  866. @item im
  867. current imaginary part of frequency bin of current channel
  868. @item real(b, ch)
  869. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  870. @item imag(b, ch)
  871. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  872. @end table
  873. @item win_size
  874. Set window size.
  875. It accepts the following values:
  876. @table @samp
  877. @item w16
  878. @item w32
  879. @item w64
  880. @item w128
  881. @item w256
  882. @item w512
  883. @item w1024
  884. @item w2048
  885. @item w4096
  886. @item w8192
  887. @item w16384
  888. @item w32768
  889. @item w65536
  890. @end table
  891. Default is @code{w4096}
  892. @item win_func
  893. Set window function. Default is @code{hann}.
  894. @item overlap
  895. Set window overlap. If set to 1, the recommended overlap for selected
  896. window function will be picked. Default is @code{0.75}.
  897. @end table
  898. @subsection Examples
  899. @itemize
  900. @item
  901. Leave almost only low frequencies in audio:
  902. @example
  903. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  904. @end example
  905. @end itemize
  906. @anchor{afir}
  907. @section afir
  908. Apply an arbitrary Frequency Impulse Response filter.
  909. This filter is designed for applying long FIR filters,
  910. up to 60 seconds long.
  911. It can be used as component for digital crossover filters,
  912. room equalization, cross talk cancellation, wavefield synthesis,
  913. auralization, ambiophonics, ambisonics and spatialization.
  914. This filter uses second stream as FIR coefficients.
  915. If second stream holds single channel, it will be used
  916. for all input channels in first stream, otherwise
  917. number of channels in second stream must be same as
  918. number of channels in first stream.
  919. It accepts the following parameters:
  920. @table @option
  921. @item dry
  922. Set dry gain. This sets input gain.
  923. @item wet
  924. Set wet gain. This sets final output gain.
  925. @item length
  926. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  927. @item gtype
  928. Enable applying gain measured from power of IR.
  929. Set which approach to use for auto gain measurement.
  930. @table @option
  931. @item none
  932. Do not apply any gain.
  933. @item peak
  934. select peak gain, very conservative approach. This is default value.
  935. @item dc
  936. select DC gain, limited application.
  937. @item gn
  938. select gain to noise approach, this is most popular one.
  939. @end table
  940. @item irgain
  941. Set gain to be applied to IR coefficients before filtering.
  942. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  943. @item irfmt
  944. Set format of IR stream. Can be @code{mono} or @code{input}.
  945. Default is @code{input}.
  946. @item maxir
  947. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  948. Allowed range is 0.1 to 60 seconds.
  949. @item response
  950. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  951. By default it is disabled.
  952. @item channel
  953. Set for which IR channel to display frequency response. By default is first channel
  954. displayed. This option is used only when @var{response} is enabled.
  955. @item size
  956. Set video stream size. This option is used only when @var{response} is enabled.
  957. @item rate
  958. Set video stream frame rate. This option is used only when @var{response} is enabled.
  959. @item minp
  960. Set minimal partition size used for convolution. Default is @var{8192}.
  961. Allowed range is from @var{8} to @var{32768}.
  962. Lower values decreases latency at cost of higher CPU usage.
  963. @item maxp
  964. Set maximal partition size used for convolution. Default is @var{8192}.
  965. Allowed range is from @var{8} to @var{32768}.
  966. Lower values may increase CPU usage.
  967. @end table
  968. @subsection Examples
  969. @itemize
  970. @item
  971. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  972. @example
  973. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  974. @end example
  975. @end itemize
  976. @anchor{aformat}
  977. @section aformat
  978. Set output format constraints for the input audio. The framework will
  979. negotiate the most appropriate format to minimize conversions.
  980. It accepts the following parameters:
  981. @table @option
  982. @item sample_fmts
  983. A '|'-separated list of requested sample formats.
  984. @item sample_rates
  985. A '|'-separated list of requested sample rates.
  986. @item channel_layouts
  987. A '|'-separated list of requested channel layouts.
  988. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  989. for the required syntax.
  990. @end table
  991. If a parameter is omitted, all values are allowed.
  992. Force the output to either unsigned 8-bit or signed 16-bit stereo
  993. @example
  994. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  995. @end example
  996. @section agate
  997. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  998. processing reduces disturbing noise between useful signals.
  999. Gating is done by detecting the volume below a chosen level @var{threshold}
  1000. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1001. floor is set via @var{range}. Because an exact manipulation of the signal
  1002. would cause distortion of the waveform the reduction can be levelled over
  1003. time. This is done by setting @var{attack} and @var{release}.
  1004. @var{attack} determines how long the signal has to fall below the threshold
  1005. before any reduction will occur and @var{release} sets the time the signal
  1006. has to rise above the threshold to reduce the reduction again.
  1007. Shorter signals than the chosen attack time will be left untouched.
  1008. @table @option
  1009. @item level_in
  1010. Set input level before filtering.
  1011. Default is 1. Allowed range is from 0.015625 to 64.
  1012. @item range
  1013. Set the level of gain reduction when the signal is below the threshold.
  1014. Default is 0.06125. Allowed range is from 0 to 1.
  1015. @item threshold
  1016. If a signal rises above this level the gain reduction is released.
  1017. Default is 0.125. Allowed range is from 0 to 1.
  1018. @item ratio
  1019. Set a ratio by which the signal is reduced.
  1020. Default is 2. Allowed range is from 1 to 9000.
  1021. @item attack
  1022. Amount of milliseconds the signal has to rise above the threshold before gain
  1023. reduction stops.
  1024. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1025. @item release
  1026. Amount of milliseconds the signal has to fall below the threshold before the
  1027. reduction is increased again. Default is 250 milliseconds.
  1028. Allowed range is from 0.01 to 9000.
  1029. @item makeup
  1030. Set amount of amplification of signal after processing.
  1031. Default is 1. Allowed range is from 1 to 64.
  1032. @item knee
  1033. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1034. Default is 2.828427125. Allowed range is from 1 to 8.
  1035. @item detection
  1036. Choose if exact signal should be taken for detection or an RMS like one.
  1037. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1038. @item link
  1039. Choose if the average level between all channels or the louder channel affects
  1040. the reduction.
  1041. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1042. @end table
  1043. @section aiir
  1044. Apply an arbitrary Infinite Impulse Response filter.
  1045. It accepts the following parameters:
  1046. @table @option
  1047. @item z
  1048. Set numerator/zeros coefficients.
  1049. @item p
  1050. Set denominator/poles coefficients.
  1051. @item k
  1052. Set channels gains.
  1053. @item dry_gain
  1054. Set input gain.
  1055. @item wet_gain
  1056. Set output gain.
  1057. @item f
  1058. Set coefficients format.
  1059. @table @samp
  1060. @item tf
  1061. transfer function
  1062. @item zp
  1063. Z-plane zeros/poles, cartesian (default)
  1064. @item pr
  1065. Z-plane zeros/poles, polar radians
  1066. @item pd
  1067. Z-plane zeros/poles, polar degrees
  1068. @end table
  1069. @item r
  1070. Set kind of processing.
  1071. Can be @code{d} - direct or @code{s} - serial cascading. Default is @code{s}.
  1072. @item e
  1073. Set filtering precision.
  1074. @table @samp
  1075. @item dbl
  1076. double-precision floating-point (default)
  1077. @item flt
  1078. single-precision floating-point
  1079. @item i32
  1080. 32-bit integers
  1081. @item i16
  1082. 16-bit integers
  1083. @end table
  1084. @item response
  1085. Show IR frequency response, magnitude and phase in additional video stream.
  1086. By default it is disabled.
  1087. @item channel
  1088. Set for which IR channel to display frequency response. By default is first channel
  1089. displayed. This option is used only when @var{response} is enabled.
  1090. @item size
  1091. Set video stream size. This option is used only when @var{response} is enabled.
  1092. @end table
  1093. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1094. order.
  1095. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1096. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1097. imaginary unit.
  1098. Different coefficients and gains can be provided for every channel, in such case
  1099. use '|' to separate coefficients or gains. Last provided coefficients will be
  1100. used for all remaining channels.
  1101. @subsection Examples
  1102. @itemize
  1103. @item
  1104. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1105. @example
  1106. 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
  1107. @end example
  1108. @item
  1109. Same as above but in @code{zp} format:
  1110. @example
  1111. 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
  1112. @end example
  1113. @end itemize
  1114. @section alimiter
  1115. The limiter prevents an input signal from rising over a desired threshold.
  1116. This limiter uses lookahead technology to prevent your signal from distorting.
  1117. It means that there is a small delay after the signal is processed. Keep in mind
  1118. that the delay it produces is the attack time you set.
  1119. The filter accepts the following options:
  1120. @table @option
  1121. @item level_in
  1122. Set input gain. Default is 1.
  1123. @item level_out
  1124. Set output gain. Default is 1.
  1125. @item limit
  1126. Don't let signals above this level pass the limiter. Default is 1.
  1127. @item attack
  1128. The limiter will reach its attenuation level in this amount of time in
  1129. milliseconds. Default is 5 milliseconds.
  1130. @item release
  1131. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1132. Default is 50 milliseconds.
  1133. @item asc
  1134. When gain reduction is always needed ASC takes care of releasing to an
  1135. average reduction level rather than reaching a reduction of 0 in the release
  1136. time.
  1137. @item asc_level
  1138. Select how much the release time is affected by ASC, 0 means nearly no changes
  1139. in release time while 1 produces higher release times.
  1140. @item level
  1141. Auto level output signal. Default is enabled.
  1142. This normalizes audio back to 0dB if enabled.
  1143. @end table
  1144. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1145. with @ref{aresample} before applying this filter.
  1146. @section allpass
  1147. Apply a two-pole all-pass filter with central frequency (in Hz)
  1148. @var{frequency}, and filter-width @var{width}.
  1149. An all-pass filter changes the audio's frequency to phase relationship
  1150. without changing its frequency to amplitude relationship.
  1151. The filter accepts the following options:
  1152. @table @option
  1153. @item frequency, f
  1154. Set frequency in Hz.
  1155. @item width_type, t
  1156. Set method to specify band-width of filter.
  1157. @table @option
  1158. @item h
  1159. Hz
  1160. @item q
  1161. Q-Factor
  1162. @item o
  1163. octave
  1164. @item s
  1165. slope
  1166. @item k
  1167. kHz
  1168. @end table
  1169. @item width, w
  1170. Specify the band-width of a filter in width_type units.
  1171. @item channels, c
  1172. Specify which channels to filter, by default all available are filtered.
  1173. @end table
  1174. @subsection Commands
  1175. This filter supports the following commands:
  1176. @table @option
  1177. @item frequency, f
  1178. Change allpass frequency.
  1179. Syntax for the command is : "@var{frequency}"
  1180. @item width_type, t
  1181. Change allpass width_type.
  1182. Syntax for the command is : "@var{width_type}"
  1183. @item width, w
  1184. Change allpass width.
  1185. Syntax for the command is : "@var{width}"
  1186. @end table
  1187. @section aloop
  1188. Loop audio samples.
  1189. The filter accepts the following options:
  1190. @table @option
  1191. @item loop
  1192. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1193. Default is 0.
  1194. @item size
  1195. Set maximal number of samples. Default is 0.
  1196. @item start
  1197. Set first sample of loop. Default is 0.
  1198. @end table
  1199. @anchor{amerge}
  1200. @section amerge
  1201. Merge two or more audio streams into a single multi-channel stream.
  1202. The filter accepts the following options:
  1203. @table @option
  1204. @item inputs
  1205. Set the number of inputs. Default is 2.
  1206. @end table
  1207. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1208. the channel layout of the output will be set accordingly and the channels
  1209. will be reordered as necessary. If the channel layouts of the inputs are not
  1210. disjoint, the output will have all the channels of the first input then all
  1211. the channels of the second input, in that order, and the channel layout of
  1212. the output will be the default value corresponding to the total number of
  1213. channels.
  1214. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1215. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1216. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1217. first input, b1 is the first channel of the second input).
  1218. On the other hand, if both input are in stereo, the output channels will be
  1219. in the default order: a1, a2, b1, b2, and the channel layout will be
  1220. arbitrarily set to 4.0, which may or may not be the expected value.
  1221. All inputs must have the same sample rate, and format.
  1222. If inputs do not have the same duration, the output will stop with the
  1223. shortest.
  1224. @subsection Examples
  1225. @itemize
  1226. @item
  1227. Merge two mono files into a stereo stream:
  1228. @example
  1229. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1230. @end example
  1231. @item
  1232. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1233. @example
  1234. 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
  1235. @end example
  1236. @end itemize
  1237. @section amix
  1238. Mixes multiple audio inputs into a single output.
  1239. Note that this filter only supports float samples (the @var{amerge}
  1240. and @var{pan} audio filters support many formats). If the @var{amix}
  1241. input has integer samples then @ref{aresample} will be automatically
  1242. inserted to perform the conversion to float samples.
  1243. For example
  1244. @example
  1245. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1246. @end example
  1247. will mix 3 input audio streams to a single output with the same duration as the
  1248. first input and a dropout transition time of 3 seconds.
  1249. It accepts the following parameters:
  1250. @table @option
  1251. @item inputs
  1252. The number of inputs. If unspecified, it defaults to 2.
  1253. @item duration
  1254. How to determine the end-of-stream.
  1255. @table @option
  1256. @item longest
  1257. The duration of the longest input. (default)
  1258. @item shortest
  1259. The duration of the shortest input.
  1260. @item first
  1261. The duration of the first input.
  1262. @end table
  1263. @item dropout_transition
  1264. The transition time, in seconds, for volume renormalization when an input
  1265. stream ends. The default value is 2 seconds.
  1266. @item weights
  1267. Specify weight of each input audio stream as sequence.
  1268. Each weight is separated by space. By default all inputs have same weight.
  1269. @end table
  1270. @section amultiply
  1271. Multiply first audio stream with second audio stream and store result
  1272. in output audio stream. Multiplication is done by multiplying each
  1273. sample from first stream with sample at same position from second stream.
  1274. With this element-wise multiplication one can create amplitude fades and
  1275. amplitude modulations.
  1276. @section anequalizer
  1277. High-order parametric multiband equalizer for each channel.
  1278. It accepts the following parameters:
  1279. @table @option
  1280. @item params
  1281. This option string is in format:
  1282. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1283. Each equalizer band is separated by '|'.
  1284. @table @option
  1285. @item chn
  1286. Set channel number to which equalization will be applied.
  1287. If input doesn't have that channel the entry is ignored.
  1288. @item f
  1289. Set central frequency for band.
  1290. If input doesn't have that frequency the entry is ignored.
  1291. @item w
  1292. Set band width in hertz.
  1293. @item g
  1294. Set band gain in dB.
  1295. @item t
  1296. Set filter type for band, optional, can be:
  1297. @table @samp
  1298. @item 0
  1299. Butterworth, this is default.
  1300. @item 1
  1301. Chebyshev type 1.
  1302. @item 2
  1303. Chebyshev type 2.
  1304. @end table
  1305. @end table
  1306. @item curves
  1307. With this option activated frequency response of anequalizer is displayed
  1308. in video stream.
  1309. @item size
  1310. Set video stream size. Only useful if curves option is activated.
  1311. @item mgain
  1312. Set max gain that will be displayed. Only useful if curves option is activated.
  1313. Setting this to a reasonable value makes it possible to display gain which is derived from
  1314. neighbour bands which are too close to each other and thus produce higher gain
  1315. when both are activated.
  1316. @item fscale
  1317. Set frequency scale used to draw frequency response in video output.
  1318. Can be linear or logarithmic. Default is logarithmic.
  1319. @item colors
  1320. Set color for each channel curve which is going to be displayed in video stream.
  1321. This is list of color names separated by space or by '|'.
  1322. Unrecognised or missing colors will be replaced by white color.
  1323. @end table
  1324. @subsection Examples
  1325. @itemize
  1326. @item
  1327. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1328. for first 2 channels using Chebyshev type 1 filter:
  1329. @example
  1330. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1331. @end example
  1332. @end itemize
  1333. @subsection Commands
  1334. This filter supports the following commands:
  1335. @table @option
  1336. @item change
  1337. Alter existing filter parameters.
  1338. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1339. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1340. error is returned.
  1341. @var{freq} set new frequency parameter.
  1342. @var{width} set new width parameter in herz.
  1343. @var{gain} set new gain parameter in dB.
  1344. Full filter invocation with asendcmd may look like this:
  1345. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1346. @end table
  1347. @section anlmdn
  1348. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1349. Each sample is adjusted by looking for other samples with similar contexts. This
  1350. context similarity is defined by comparing their surrounding patches of size
  1351. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1352. The filter accepts the following options.
  1353. @table @option
  1354. @item s
  1355. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1356. @item p
  1357. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1358. Default value is 2 milliseconds.
  1359. @item r
  1360. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1361. Default value is 6 milliseconds.
  1362. @end table
  1363. @section anull
  1364. Pass the audio source unchanged to the output.
  1365. @section apad
  1366. Pad the end of an audio stream with silence.
  1367. This can be used together with @command{ffmpeg} @option{-shortest} to
  1368. extend audio streams to the same length as the video stream.
  1369. A description of the accepted options follows.
  1370. @table @option
  1371. @item packet_size
  1372. Set silence packet size. Default value is 4096.
  1373. @item pad_len
  1374. Set the number of samples of silence to add to the end. After the
  1375. value is reached, the stream is terminated. This option is mutually
  1376. exclusive with @option{whole_len}.
  1377. @item whole_len
  1378. Set the minimum total number of samples in the output audio stream. If
  1379. the value is longer than the input audio length, silence is added to
  1380. the end, until the value is reached. This option is mutually exclusive
  1381. with @option{pad_len}.
  1382. @item pad_dur
  1383. Specify the duration of samples of silence to add. See
  1384. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1385. for the accepted syntax. Used only if set to non-zero value.
  1386. @item whole_dur
  1387. Specify the minimum total duration in the output audio stream. See
  1388. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1389. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1390. the input audio length, silence is added to the end, until the value is reached.
  1391. This option is mutually exclusive with @option{pad_dur}
  1392. @end table
  1393. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1394. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1395. the input stream indefinitely.
  1396. @subsection Examples
  1397. @itemize
  1398. @item
  1399. Add 1024 samples of silence to the end of the input:
  1400. @example
  1401. apad=pad_len=1024
  1402. @end example
  1403. @item
  1404. Make sure the audio output will contain at least 10000 samples, pad
  1405. the input with silence if required:
  1406. @example
  1407. apad=whole_len=10000
  1408. @end example
  1409. @item
  1410. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1411. video stream will always result the shortest and will be converted
  1412. until the end in the output file when using the @option{shortest}
  1413. option:
  1414. @example
  1415. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1416. @end example
  1417. @end itemize
  1418. @section aphaser
  1419. Add a phasing effect to the input audio.
  1420. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1421. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1422. A description of the accepted parameters follows.
  1423. @table @option
  1424. @item in_gain
  1425. Set input gain. Default is 0.4.
  1426. @item out_gain
  1427. Set output gain. Default is 0.74
  1428. @item delay
  1429. Set delay in milliseconds. Default is 3.0.
  1430. @item decay
  1431. Set decay. Default is 0.4.
  1432. @item speed
  1433. Set modulation speed in Hz. Default is 0.5.
  1434. @item type
  1435. Set modulation type. Default is triangular.
  1436. It accepts the following values:
  1437. @table @samp
  1438. @item triangular, t
  1439. @item sinusoidal, s
  1440. @end table
  1441. @end table
  1442. @section apulsator
  1443. Audio pulsator is something between an autopanner and a tremolo.
  1444. But it can produce funny stereo effects as well. Pulsator changes the volume
  1445. of the left and right channel based on a LFO (low frequency oscillator) with
  1446. different waveforms and shifted phases.
  1447. This filter have the ability to define an offset between left and right
  1448. channel. An offset of 0 means that both LFO shapes match each other.
  1449. The left and right channel are altered equally - a conventional tremolo.
  1450. An offset of 50% means that the shape of the right channel is exactly shifted
  1451. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1452. an autopanner. At 1 both curves match again. Every setting in between moves the
  1453. phase shift gapless between all stages and produces some "bypassing" sounds with
  1454. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1455. the 0.5) the faster the signal passes from the left to the right speaker.
  1456. The filter accepts the following options:
  1457. @table @option
  1458. @item level_in
  1459. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1460. @item level_out
  1461. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1462. @item mode
  1463. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1464. sawup or sawdown. Default is sine.
  1465. @item amount
  1466. Set modulation. Define how much of original signal is affected by the LFO.
  1467. @item offset_l
  1468. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1469. @item offset_r
  1470. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1471. @item width
  1472. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1473. @item timing
  1474. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1475. @item bpm
  1476. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1477. is set to bpm.
  1478. @item ms
  1479. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1480. is set to ms.
  1481. @item hz
  1482. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1483. if timing is set to hz.
  1484. @end table
  1485. @anchor{aresample}
  1486. @section aresample
  1487. Resample the input audio to the specified parameters, using the
  1488. libswresample library. If none are specified then the filter will
  1489. automatically convert between its input and output.
  1490. This filter is also able to stretch/squeeze the audio data to make it match
  1491. the timestamps or to inject silence / cut out audio to make it match the
  1492. timestamps, do a combination of both or do neither.
  1493. The filter accepts the syntax
  1494. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1495. expresses a sample rate and @var{resampler_options} is a list of
  1496. @var{key}=@var{value} pairs, separated by ":". See the
  1497. @ref{Resampler Options,,"Resampler Options" section in the
  1498. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1499. for the complete list of supported options.
  1500. @subsection Examples
  1501. @itemize
  1502. @item
  1503. Resample the input audio to 44100Hz:
  1504. @example
  1505. aresample=44100
  1506. @end example
  1507. @item
  1508. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1509. samples per second compensation:
  1510. @example
  1511. aresample=async=1000
  1512. @end example
  1513. @end itemize
  1514. @section areverse
  1515. Reverse an audio clip.
  1516. Warning: This filter requires memory to buffer the entire clip, so trimming
  1517. is suggested.
  1518. @subsection Examples
  1519. @itemize
  1520. @item
  1521. Take the first 5 seconds of a clip, and reverse it.
  1522. @example
  1523. atrim=end=5,areverse
  1524. @end example
  1525. @end itemize
  1526. @section asetnsamples
  1527. Set the number of samples per each output audio frame.
  1528. The last output packet may contain a different number of samples, as
  1529. the filter will flush all the remaining samples when the input audio
  1530. signals its end.
  1531. The filter accepts the following options:
  1532. @table @option
  1533. @item nb_out_samples, n
  1534. Set the number of frames per each output audio frame. The number is
  1535. intended as the number of samples @emph{per each channel}.
  1536. Default value is 1024.
  1537. @item pad, p
  1538. If set to 1, the filter will pad the last audio frame with zeroes, so
  1539. that the last frame will contain the same number of samples as the
  1540. previous ones. Default value is 1.
  1541. @end table
  1542. For example, to set the number of per-frame samples to 1234 and
  1543. disable padding for the last frame, use:
  1544. @example
  1545. asetnsamples=n=1234:p=0
  1546. @end example
  1547. @section asetrate
  1548. Set the sample rate without altering the PCM data.
  1549. This will result in a change of speed and pitch.
  1550. The filter accepts the following options:
  1551. @table @option
  1552. @item sample_rate, r
  1553. Set the output sample rate. Default is 44100 Hz.
  1554. @end table
  1555. @section ashowinfo
  1556. Show a line containing various information for each input audio frame.
  1557. The input audio is not modified.
  1558. The shown line contains a sequence of key/value pairs of the form
  1559. @var{key}:@var{value}.
  1560. The following values are shown in the output:
  1561. @table @option
  1562. @item n
  1563. The (sequential) number of the input frame, starting from 0.
  1564. @item pts
  1565. The presentation timestamp of the input frame, in time base units; the time base
  1566. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1567. @item pts_time
  1568. The presentation timestamp of the input frame in seconds.
  1569. @item pos
  1570. position of the frame in the input stream, -1 if this information in
  1571. unavailable and/or meaningless (for example in case of synthetic audio)
  1572. @item fmt
  1573. The sample format.
  1574. @item chlayout
  1575. The channel layout.
  1576. @item rate
  1577. The sample rate for the audio frame.
  1578. @item nb_samples
  1579. The number of samples (per channel) in the frame.
  1580. @item checksum
  1581. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1582. audio, the data is treated as if all the planes were concatenated.
  1583. @item plane_checksums
  1584. A list of Adler-32 checksums for each data plane.
  1585. @end table
  1586. @anchor{astats}
  1587. @section astats
  1588. Display time domain statistical information about the audio channels.
  1589. Statistics are calculated and displayed for each audio channel and,
  1590. where applicable, an overall figure is also given.
  1591. It accepts the following option:
  1592. @table @option
  1593. @item length
  1594. Short window length in seconds, used for peak and trough RMS measurement.
  1595. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1596. @item metadata
  1597. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1598. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1599. disabled.
  1600. Available keys for each channel are:
  1601. DC_offset
  1602. Min_level
  1603. Max_level
  1604. Min_difference
  1605. Max_difference
  1606. Mean_difference
  1607. RMS_difference
  1608. Peak_level
  1609. RMS_peak
  1610. RMS_trough
  1611. Crest_factor
  1612. Flat_factor
  1613. Peak_count
  1614. Bit_depth
  1615. Dynamic_range
  1616. Zero_crossings
  1617. Zero_crossings_rate
  1618. and for Overall:
  1619. DC_offset
  1620. Min_level
  1621. Max_level
  1622. Min_difference
  1623. Max_difference
  1624. Mean_difference
  1625. RMS_difference
  1626. Peak_level
  1627. RMS_level
  1628. RMS_peak
  1629. RMS_trough
  1630. Flat_factor
  1631. Peak_count
  1632. Bit_depth
  1633. Number_of_samples
  1634. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1635. this @code{lavfi.astats.Overall.Peak_count}.
  1636. For description what each key means read below.
  1637. @item reset
  1638. Set number of frame after which stats are going to be recalculated.
  1639. Default is disabled.
  1640. @end table
  1641. A description of each shown parameter follows:
  1642. @table @option
  1643. @item DC offset
  1644. Mean amplitude displacement from zero.
  1645. @item Min level
  1646. Minimal sample level.
  1647. @item Max level
  1648. Maximal sample level.
  1649. @item Min difference
  1650. Minimal difference between two consecutive samples.
  1651. @item Max difference
  1652. Maximal difference between two consecutive samples.
  1653. @item Mean difference
  1654. Mean difference between two consecutive samples.
  1655. The average of each difference between two consecutive samples.
  1656. @item RMS difference
  1657. Root Mean Square difference between two consecutive samples.
  1658. @item Peak level dB
  1659. @item RMS level dB
  1660. Standard peak and RMS level measured in dBFS.
  1661. @item RMS peak dB
  1662. @item RMS trough dB
  1663. Peak and trough values for RMS level measured over a short window.
  1664. @item Crest factor
  1665. Standard ratio of peak to RMS level (note: not in dB).
  1666. @item Flat factor
  1667. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1668. (i.e. either @var{Min level} or @var{Max level}).
  1669. @item Peak count
  1670. Number of occasions (not the number of samples) that the signal attained either
  1671. @var{Min level} or @var{Max level}.
  1672. @item Bit depth
  1673. Overall bit depth of audio. Number of bits used for each sample.
  1674. @item Dynamic range
  1675. Measured dynamic range of audio in dB.
  1676. @item Zero crossings
  1677. Number of points where the waveform crosses the zero level axis.
  1678. @item Zero crossings rate
  1679. Rate of Zero crossings and number of audio samples.
  1680. @end table
  1681. @section atempo
  1682. Adjust audio tempo.
  1683. The filter accepts exactly one parameter, the audio tempo. If not
  1684. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1685. be in the [0.5, 100.0] range.
  1686. Note that tempo greater than 2 will skip some samples rather than
  1687. blend them in. If for any reason this is a concern it is always
  1688. possible to daisy-chain several instances of atempo to achieve the
  1689. desired product tempo.
  1690. @subsection Examples
  1691. @itemize
  1692. @item
  1693. Slow down audio to 80% tempo:
  1694. @example
  1695. atempo=0.8
  1696. @end example
  1697. @item
  1698. To speed up audio to 300% tempo:
  1699. @example
  1700. atempo=3
  1701. @end example
  1702. @item
  1703. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1704. @example
  1705. atempo=sqrt(3),atempo=sqrt(3)
  1706. @end example
  1707. @end itemize
  1708. @section atrim
  1709. Trim the input so that the output contains one continuous subpart of the input.
  1710. It accepts the following parameters:
  1711. @table @option
  1712. @item start
  1713. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1714. sample with the timestamp @var{start} will be the first sample in the output.
  1715. @item end
  1716. Specify time of the first audio sample that will be dropped, i.e. the
  1717. audio sample immediately preceding the one with the timestamp @var{end} will be
  1718. the last sample in the output.
  1719. @item start_pts
  1720. Same as @var{start}, except this option sets the start timestamp in samples
  1721. instead of seconds.
  1722. @item end_pts
  1723. Same as @var{end}, except this option sets the end timestamp in samples instead
  1724. of seconds.
  1725. @item duration
  1726. The maximum duration of the output in seconds.
  1727. @item start_sample
  1728. The number of the first sample that should be output.
  1729. @item end_sample
  1730. The number of the first sample that should be dropped.
  1731. @end table
  1732. @option{start}, @option{end}, and @option{duration} are expressed as time
  1733. duration specifications; see
  1734. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1735. Note that the first two sets of the start/end options and the @option{duration}
  1736. option look at the frame timestamp, while the _sample options simply count the
  1737. samples that pass through the filter. So start/end_pts and start/end_sample will
  1738. give different results when the timestamps are wrong, inexact or do not start at
  1739. zero. Also note that this filter does not modify the timestamps. If you wish
  1740. to have the output timestamps start at zero, insert the asetpts filter after the
  1741. atrim filter.
  1742. If multiple start or end options are set, this filter tries to be greedy and
  1743. keep all samples that match at least one of the specified constraints. To keep
  1744. only the part that matches all the constraints at once, chain multiple atrim
  1745. filters.
  1746. The defaults are such that all the input is kept. So it is possible to set e.g.
  1747. just the end values to keep everything before the specified time.
  1748. Examples:
  1749. @itemize
  1750. @item
  1751. Drop everything except the second minute of input:
  1752. @example
  1753. ffmpeg -i INPUT -af atrim=60:120
  1754. @end example
  1755. @item
  1756. Keep only the first 1000 samples:
  1757. @example
  1758. ffmpeg -i INPUT -af atrim=end_sample=1000
  1759. @end example
  1760. @end itemize
  1761. @section bandpass
  1762. Apply a two-pole Butterworth band-pass filter with central
  1763. frequency @var{frequency}, and (3dB-point) band-width width.
  1764. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1765. instead of the default: constant 0dB peak gain.
  1766. The filter roll off at 6dB per octave (20dB per decade).
  1767. The filter accepts the following options:
  1768. @table @option
  1769. @item frequency, f
  1770. Set the filter's central frequency. Default is @code{3000}.
  1771. @item csg
  1772. Constant skirt gain if set to 1. Defaults to 0.
  1773. @item width_type, t
  1774. Set method to specify band-width of filter.
  1775. @table @option
  1776. @item h
  1777. Hz
  1778. @item q
  1779. Q-Factor
  1780. @item o
  1781. octave
  1782. @item s
  1783. slope
  1784. @item k
  1785. kHz
  1786. @end table
  1787. @item width, w
  1788. Specify the band-width of a filter in width_type units.
  1789. @item channels, c
  1790. Specify which channels to filter, by default all available are filtered.
  1791. @end table
  1792. @subsection Commands
  1793. This filter supports the following commands:
  1794. @table @option
  1795. @item frequency, f
  1796. Change bandpass frequency.
  1797. Syntax for the command is : "@var{frequency}"
  1798. @item width_type, t
  1799. Change bandpass width_type.
  1800. Syntax for the command is : "@var{width_type}"
  1801. @item width, w
  1802. Change bandpass width.
  1803. Syntax for the command is : "@var{width}"
  1804. @end table
  1805. @section bandreject
  1806. Apply a two-pole Butterworth band-reject filter with central
  1807. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1808. The filter roll off at 6dB per octave (20dB per decade).
  1809. The filter accepts the following options:
  1810. @table @option
  1811. @item frequency, f
  1812. Set the filter's central frequency. Default is @code{3000}.
  1813. @item width_type, t
  1814. Set method to specify band-width of filter.
  1815. @table @option
  1816. @item h
  1817. Hz
  1818. @item q
  1819. Q-Factor
  1820. @item o
  1821. octave
  1822. @item s
  1823. slope
  1824. @item k
  1825. kHz
  1826. @end table
  1827. @item width, w
  1828. Specify the band-width of a filter in width_type units.
  1829. @item channels, c
  1830. Specify which channels to filter, by default all available are filtered.
  1831. @end table
  1832. @subsection Commands
  1833. This filter supports the following commands:
  1834. @table @option
  1835. @item frequency, f
  1836. Change bandreject frequency.
  1837. Syntax for the command is : "@var{frequency}"
  1838. @item width_type, t
  1839. Change bandreject width_type.
  1840. Syntax for the command is : "@var{width_type}"
  1841. @item width, w
  1842. Change bandreject width.
  1843. Syntax for the command is : "@var{width}"
  1844. @end table
  1845. @section bass, lowshelf
  1846. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1847. shelving filter with a response similar to that of a standard
  1848. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1849. The filter accepts the following options:
  1850. @table @option
  1851. @item gain, g
  1852. Give the gain at 0 Hz. Its useful range is about -20
  1853. (for a large cut) to +20 (for a large boost).
  1854. Beware of clipping when using a positive gain.
  1855. @item frequency, f
  1856. Set the filter's central frequency and so can be used
  1857. to extend or reduce the frequency range to be boosted or cut.
  1858. The default value is @code{100} Hz.
  1859. @item width_type, t
  1860. Set method to specify band-width of filter.
  1861. @table @option
  1862. @item h
  1863. Hz
  1864. @item q
  1865. Q-Factor
  1866. @item o
  1867. octave
  1868. @item s
  1869. slope
  1870. @item k
  1871. kHz
  1872. @end table
  1873. @item width, w
  1874. Determine how steep is the filter's shelf transition.
  1875. @item channels, c
  1876. Specify which channels to filter, by default all available are filtered.
  1877. @end table
  1878. @subsection Commands
  1879. This filter supports the following commands:
  1880. @table @option
  1881. @item frequency, f
  1882. Change bass frequency.
  1883. Syntax for the command is : "@var{frequency}"
  1884. @item width_type, t
  1885. Change bass width_type.
  1886. Syntax for the command is : "@var{width_type}"
  1887. @item width, w
  1888. Change bass width.
  1889. Syntax for the command is : "@var{width}"
  1890. @item gain, g
  1891. Change bass gain.
  1892. Syntax for the command is : "@var{gain}"
  1893. @end table
  1894. @section biquad
  1895. Apply a biquad IIR filter with the given coefficients.
  1896. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1897. are the numerator and denominator coefficients respectively.
  1898. and @var{channels}, @var{c} specify which channels to filter, by default all
  1899. available are filtered.
  1900. @subsection Commands
  1901. This filter supports the following commands:
  1902. @table @option
  1903. @item a0
  1904. @item a1
  1905. @item a2
  1906. @item b0
  1907. @item b1
  1908. @item b2
  1909. Change biquad parameter.
  1910. Syntax for the command is : "@var{value}"
  1911. @end table
  1912. @section bs2b
  1913. Bauer stereo to binaural transformation, which improves headphone listening of
  1914. stereo audio records.
  1915. To enable compilation of this filter you need to configure FFmpeg with
  1916. @code{--enable-libbs2b}.
  1917. It accepts the following parameters:
  1918. @table @option
  1919. @item profile
  1920. Pre-defined crossfeed level.
  1921. @table @option
  1922. @item default
  1923. Default level (fcut=700, feed=50).
  1924. @item cmoy
  1925. Chu Moy circuit (fcut=700, feed=60).
  1926. @item jmeier
  1927. Jan Meier circuit (fcut=650, feed=95).
  1928. @end table
  1929. @item fcut
  1930. Cut frequency (in Hz).
  1931. @item feed
  1932. Feed level (in Hz).
  1933. @end table
  1934. @section channelmap
  1935. Remap input channels to new locations.
  1936. It accepts the following parameters:
  1937. @table @option
  1938. @item map
  1939. Map channels from input to output. The argument is a '|'-separated list of
  1940. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1941. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1942. channel (e.g. FL for front left) or its index in the input channel layout.
  1943. @var{out_channel} is the name of the output channel or its index in the output
  1944. channel layout. If @var{out_channel} is not given then it is implicitly an
  1945. index, starting with zero and increasing by one for each mapping.
  1946. @item channel_layout
  1947. The channel layout of the output stream.
  1948. @end table
  1949. If no mapping is present, the filter will implicitly map input channels to
  1950. output channels, preserving indices.
  1951. @subsection Examples
  1952. @itemize
  1953. @item
  1954. For example, assuming a 5.1+downmix input MOV file,
  1955. @example
  1956. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1957. @end example
  1958. will create an output WAV file tagged as stereo from the downmix channels of
  1959. the input.
  1960. @item
  1961. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1962. @example
  1963. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1964. @end example
  1965. @end itemize
  1966. @section channelsplit
  1967. Split each channel from an input audio stream into a separate output stream.
  1968. It accepts the following parameters:
  1969. @table @option
  1970. @item channel_layout
  1971. The channel layout of the input stream. The default is "stereo".
  1972. @item channels
  1973. A channel layout describing the channels to be extracted as separate output streams
  1974. or "all" to extract each input channel as a separate stream. The default is "all".
  1975. Choosing channels not present in channel layout in the input will result in an error.
  1976. @end table
  1977. @subsection Examples
  1978. @itemize
  1979. @item
  1980. For example, assuming a stereo input MP3 file,
  1981. @example
  1982. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1983. @end example
  1984. will create an output Matroska file with two audio streams, one containing only
  1985. the left channel and the other the right channel.
  1986. @item
  1987. Split a 5.1 WAV file into per-channel files:
  1988. @example
  1989. ffmpeg -i in.wav -filter_complex
  1990. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1991. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1992. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1993. side_right.wav
  1994. @end example
  1995. @item
  1996. Extract only LFE from a 5.1 WAV file:
  1997. @example
  1998. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  1999. -map '[LFE]' lfe.wav
  2000. @end example
  2001. @end itemize
  2002. @section chorus
  2003. Add a chorus effect to the audio.
  2004. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2005. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2006. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2007. The modulation depth defines the range the modulated delay is played before or after
  2008. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2009. sound tuned around the original one, like in a chorus where some vocals are slightly
  2010. off key.
  2011. It accepts the following parameters:
  2012. @table @option
  2013. @item in_gain
  2014. Set input gain. Default is 0.4.
  2015. @item out_gain
  2016. Set output gain. Default is 0.4.
  2017. @item delays
  2018. Set delays. A typical delay is around 40ms to 60ms.
  2019. @item decays
  2020. Set decays.
  2021. @item speeds
  2022. Set speeds.
  2023. @item depths
  2024. Set depths.
  2025. @end table
  2026. @subsection Examples
  2027. @itemize
  2028. @item
  2029. A single delay:
  2030. @example
  2031. chorus=0.7:0.9:55:0.4:0.25:2
  2032. @end example
  2033. @item
  2034. Two delays:
  2035. @example
  2036. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2037. @end example
  2038. @item
  2039. Fuller sounding chorus with three delays:
  2040. @example
  2041. 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
  2042. @end example
  2043. @end itemize
  2044. @section compand
  2045. Compress or expand the audio's dynamic range.
  2046. It accepts the following parameters:
  2047. @table @option
  2048. @item attacks
  2049. @item decays
  2050. A list of times in seconds for each channel over which the instantaneous level
  2051. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2052. increase of volume and @var{decays} refers to decrease of volume. For most
  2053. situations, the attack time (response to the audio getting louder) should be
  2054. shorter than the decay time, because the human ear is more sensitive to sudden
  2055. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2056. a typical value for decay is 0.8 seconds.
  2057. If specified number of attacks & decays is lower than number of channels, the last
  2058. set attack/decay will be used for all remaining channels.
  2059. @item points
  2060. A list of points for the transfer function, specified in dB relative to the
  2061. maximum possible signal amplitude. Each key points list must be defined using
  2062. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2063. @code{x0/y0 x1/y1 x2/y2 ....}
  2064. The input values must be in strictly increasing order but the transfer function
  2065. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2066. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2067. function are @code{-70/-70|-60/-20|1/0}.
  2068. @item soft-knee
  2069. Set the curve radius in dB for all joints. It defaults to 0.01.
  2070. @item gain
  2071. Set the additional gain in dB to be applied at all points on the transfer
  2072. function. This allows for easy adjustment of the overall gain.
  2073. It defaults to 0.
  2074. @item volume
  2075. Set an initial volume, in dB, to be assumed for each channel when filtering
  2076. starts. This permits the user to supply a nominal level initially, so that, for
  2077. example, a very large gain is not applied to initial signal levels before the
  2078. companding has begun to operate. A typical value for audio which is initially
  2079. quiet is -90 dB. It defaults to 0.
  2080. @item delay
  2081. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2082. delayed before being fed to the volume adjuster. Specifying a delay
  2083. approximately equal to the attack/decay times allows the filter to effectively
  2084. operate in predictive rather than reactive mode. It defaults to 0.
  2085. @end table
  2086. @subsection Examples
  2087. @itemize
  2088. @item
  2089. Make music with both quiet and loud passages suitable for listening to in a
  2090. noisy environment:
  2091. @example
  2092. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2093. @end example
  2094. Another example for audio with whisper and explosion parts:
  2095. @example
  2096. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2097. @end example
  2098. @item
  2099. A noise gate for when the noise is at a lower level than the signal:
  2100. @example
  2101. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2102. @end example
  2103. @item
  2104. Here is another noise gate, this time for when the noise is at a higher level
  2105. than the signal (making it, in some ways, similar to squelch):
  2106. @example
  2107. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2108. @end example
  2109. @item
  2110. 2:1 compression starting at -6dB:
  2111. @example
  2112. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2113. @end example
  2114. @item
  2115. 2:1 compression starting at -9dB:
  2116. @example
  2117. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2118. @end example
  2119. @item
  2120. 2:1 compression starting at -12dB:
  2121. @example
  2122. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2123. @end example
  2124. @item
  2125. 2:1 compression starting at -18dB:
  2126. @example
  2127. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2128. @end example
  2129. @item
  2130. 3:1 compression starting at -15dB:
  2131. @example
  2132. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2133. @end example
  2134. @item
  2135. Compressor/Gate:
  2136. @example
  2137. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2138. @end example
  2139. @item
  2140. Expander:
  2141. @example
  2142. 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
  2143. @end example
  2144. @item
  2145. Hard limiter at -6dB:
  2146. @example
  2147. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2148. @end example
  2149. @item
  2150. Hard limiter at -12dB:
  2151. @example
  2152. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2153. @end example
  2154. @item
  2155. Hard noise gate at -35 dB:
  2156. @example
  2157. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2158. @end example
  2159. @item
  2160. Soft limiter:
  2161. @example
  2162. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2163. @end example
  2164. @end itemize
  2165. @section compensationdelay
  2166. Compensation Delay Line is a metric based delay to compensate differing
  2167. positions of microphones or speakers.
  2168. For example, you have recorded guitar with two microphones placed in
  2169. different location. Because the front of sound wave has fixed speed in
  2170. normal conditions, the phasing of microphones can vary and depends on
  2171. their location and interposition. The best sound mix can be achieved when
  2172. these microphones are in phase (synchronized). Note that distance of
  2173. ~30 cm between microphones makes one microphone to capture signal in
  2174. antiphase to another microphone. That makes the final mix sounding moody.
  2175. This filter helps to solve phasing problems by adding different delays
  2176. to each microphone track and make them synchronized.
  2177. The best result can be reached when you take one track as base and
  2178. synchronize other tracks one by one with it.
  2179. Remember that synchronization/delay tolerance depends on sample rate, too.
  2180. Higher sample rates will give more tolerance.
  2181. It accepts the following parameters:
  2182. @table @option
  2183. @item mm
  2184. Set millimeters distance. This is compensation distance for fine tuning.
  2185. Default is 0.
  2186. @item cm
  2187. Set cm distance. This is compensation distance for tightening distance setup.
  2188. Default is 0.
  2189. @item m
  2190. Set meters distance. This is compensation distance for hard distance setup.
  2191. Default is 0.
  2192. @item dry
  2193. Set dry amount. Amount of unprocessed (dry) signal.
  2194. Default is 0.
  2195. @item wet
  2196. Set wet amount. Amount of processed (wet) signal.
  2197. Default is 1.
  2198. @item temp
  2199. Set temperature degree in Celsius. This is the temperature of the environment.
  2200. Default is 20.
  2201. @end table
  2202. @section crossfeed
  2203. Apply headphone crossfeed filter.
  2204. Crossfeed is the process of blending the left and right channels of stereo
  2205. audio recording.
  2206. It is mainly used to reduce extreme stereo separation of low frequencies.
  2207. The intent is to produce more speaker like sound to the listener.
  2208. The filter accepts the following options:
  2209. @table @option
  2210. @item strength
  2211. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2212. This sets gain of low shelf filter for side part of stereo image.
  2213. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2214. @item range
  2215. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2216. This sets cut off frequency of low shelf filter. Default is cut off near
  2217. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2218. @item level_in
  2219. Set input gain. Default is 0.9.
  2220. @item level_out
  2221. Set output gain. Default is 1.
  2222. @end table
  2223. @section crystalizer
  2224. Simple algorithm to expand audio dynamic range.
  2225. The filter accepts the following options:
  2226. @table @option
  2227. @item i
  2228. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2229. (unchanged sound) to 10.0 (maximum effect).
  2230. @item c
  2231. Enable clipping. By default is enabled.
  2232. @end table
  2233. @section dcshift
  2234. Apply a DC shift to the audio.
  2235. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2236. in the recording chain) from the audio. The effect of a DC offset is reduced
  2237. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2238. a signal has a DC offset.
  2239. @table @option
  2240. @item shift
  2241. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2242. the audio.
  2243. @item limitergain
  2244. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2245. used to prevent clipping.
  2246. @end table
  2247. @section drmeter
  2248. Measure audio dynamic range.
  2249. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2250. is found in transition material. And anything less that 8 have very poor dynamics
  2251. and is very compressed.
  2252. The filter accepts the following options:
  2253. @table @option
  2254. @item length
  2255. Set window length in seconds used to split audio into segments of equal length.
  2256. Default is 3 seconds.
  2257. @end table
  2258. @section dynaudnorm
  2259. Dynamic Audio Normalizer.
  2260. This filter applies a certain amount of gain to the input audio in order
  2261. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2262. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2263. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2264. This allows for applying extra gain to the "quiet" sections of the audio
  2265. while avoiding distortions or clipping the "loud" sections. In other words:
  2266. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2267. sections, in the sense that the volume of each section is brought to the
  2268. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2269. this goal *without* applying "dynamic range compressing". It will retain 100%
  2270. of the dynamic range *within* each section of the audio file.
  2271. @table @option
  2272. @item f
  2273. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2274. Default is 500 milliseconds.
  2275. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2276. referred to as frames. This is required, because a peak magnitude has no
  2277. meaning for just a single sample value. Instead, we need to determine the
  2278. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2279. normalizer would simply use the peak magnitude of the complete file, the
  2280. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2281. frame. The length of a frame is specified in milliseconds. By default, the
  2282. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2283. been found to give good results with most files.
  2284. Note that the exact frame length, in number of samples, will be determined
  2285. automatically, based on the sampling rate of the individual input audio file.
  2286. @item g
  2287. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2288. number. Default is 31.
  2289. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2290. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2291. is specified in frames, centered around the current frame. For the sake of
  2292. simplicity, this must be an odd number. Consequently, the default value of 31
  2293. takes into account the current frame, as well as the 15 preceding frames and
  2294. the 15 subsequent frames. Using a larger window results in a stronger
  2295. smoothing effect and thus in less gain variation, i.e. slower gain
  2296. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2297. effect and thus in more gain variation, i.e. faster gain adaptation.
  2298. In other words, the more you increase this value, the more the Dynamic Audio
  2299. Normalizer will behave like a "traditional" normalization filter. On the
  2300. contrary, the more you decrease this value, the more the Dynamic Audio
  2301. Normalizer will behave like a dynamic range compressor.
  2302. @item p
  2303. Set the target peak value. This specifies the highest permissible magnitude
  2304. level for the normalized audio input. This filter will try to approach the
  2305. target peak magnitude as closely as possible, but at the same time it also
  2306. makes sure that the normalized signal will never exceed the peak magnitude.
  2307. A frame's maximum local gain factor is imposed directly by the target peak
  2308. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2309. It is not recommended to go above this value.
  2310. @item m
  2311. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2312. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2313. factor for each input frame, i.e. the maximum gain factor that does not
  2314. result in clipping or distortion. The maximum gain factor is determined by
  2315. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2316. additionally bounds the frame's maximum gain factor by a predetermined
  2317. (global) maximum gain factor. This is done in order to avoid excessive gain
  2318. factors in "silent" or almost silent frames. By default, the maximum gain
  2319. factor is 10.0, For most inputs the default value should be sufficient and
  2320. it usually is not recommended to increase this value. Though, for input
  2321. with an extremely low overall volume level, it may be necessary to allow even
  2322. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2323. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2324. Instead, a "sigmoid" threshold function will be applied. This way, the
  2325. gain factors will smoothly approach the threshold value, but never exceed that
  2326. value.
  2327. @item r
  2328. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2329. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2330. This means that the maximum local gain factor for each frame is defined
  2331. (only) by the frame's highest magnitude sample. This way, the samples can
  2332. be amplified as much as possible without exceeding the maximum signal
  2333. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2334. Normalizer can also take into account the frame's root mean square,
  2335. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2336. determine the power of a time-varying signal. It is therefore considered
  2337. that the RMS is a better approximation of the "perceived loudness" than
  2338. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2339. frames to a constant RMS value, a uniform "perceived loudness" can be
  2340. established. If a target RMS value has been specified, a frame's local gain
  2341. factor is defined as the factor that would result in exactly that RMS value.
  2342. Note, however, that the maximum local gain factor is still restricted by the
  2343. frame's highest magnitude sample, in order to prevent clipping.
  2344. @item n
  2345. Enable channels coupling. By default is enabled.
  2346. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2347. amount. This means the same gain factor will be applied to all channels, i.e.
  2348. the maximum possible gain factor is determined by the "loudest" channel.
  2349. However, in some recordings, it may happen that the volume of the different
  2350. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2351. In this case, this option can be used to disable the channel coupling. This way,
  2352. the gain factor will be determined independently for each channel, depending
  2353. only on the individual channel's highest magnitude sample. This allows for
  2354. harmonizing the volume of the different channels.
  2355. @item c
  2356. Enable DC bias correction. By default is disabled.
  2357. An audio signal (in the time domain) is a sequence of sample values.
  2358. In the Dynamic Audio Normalizer these sample values are represented in the
  2359. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2360. audio signal, or "waveform", should be centered around the zero point.
  2361. That means if we calculate the mean value of all samples in a file, or in a
  2362. single frame, then the result should be 0.0 or at least very close to that
  2363. value. If, however, there is a significant deviation of the mean value from
  2364. 0.0, in either positive or negative direction, this is referred to as a
  2365. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2366. Audio Normalizer provides optional DC bias correction.
  2367. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2368. the mean value, or "DC correction" offset, of each input frame and subtract
  2369. that value from all of the frame's sample values which ensures those samples
  2370. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2371. boundaries, the DC correction offset values will be interpolated smoothly
  2372. between neighbouring frames.
  2373. @item b
  2374. Enable alternative boundary mode. By default is disabled.
  2375. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2376. around each frame. This includes the preceding frames as well as the
  2377. subsequent frames. However, for the "boundary" frames, located at the very
  2378. beginning and at the very end of the audio file, not all neighbouring
  2379. frames are available. In particular, for the first few frames in the audio
  2380. file, the preceding frames are not known. And, similarly, for the last few
  2381. frames in the audio file, the subsequent frames are not known. Thus, the
  2382. question arises which gain factors should be assumed for the missing frames
  2383. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2384. to deal with this situation. The default boundary mode assumes a gain factor
  2385. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2386. "fade out" at the beginning and at the end of the input, respectively.
  2387. @item s
  2388. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2389. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2390. compression. This means that signal peaks will not be pruned and thus the
  2391. full dynamic range will be retained within each local neighbourhood. However,
  2392. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2393. normalization algorithm with a more "traditional" compression.
  2394. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2395. (thresholding) function. If (and only if) the compression feature is enabled,
  2396. all input frames will be processed by a soft knee thresholding function prior
  2397. to the actual normalization process. Put simply, the thresholding function is
  2398. going to prune all samples whose magnitude exceeds a certain threshold value.
  2399. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2400. value. Instead, the threshold value will be adjusted for each individual
  2401. frame.
  2402. In general, smaller parameters result in stronger compression, and vice versa.
  2403. Values below 3.0 are not recommended, because audible distortion may appear.
  2404. @end table
  2405. @section earwax
  2406. Make audio easier to listen to on headphones.
  2407. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2408. so that when listened to on headphones the stereo image is moved from
  2409. inside your head (standard for headphones) to outside and in front of
  2410. the listener (standard for speakers).
  2411. Ported from SoX.
  2412. @section equalizer
  2413. Apply a two-pole peaking equalisation (EQ) filter. With this
  2414. filter, the signal-level at and around a selected frequency can
  2415. be increased or decreased, whilst (unlike bandpass and bandreject
  2416. filters) that at all other frequencies is unchanged.
  2417. In order to produce complex equalisation curves, this filter can
  2418. be given several times, each with a different central frequency.
  2419. The filter accepts the following options:
  2420. @table @option
  2421. @item frequency, f
  2422. Set the filter's central frequency in Hz.
  2423. @item width_type, t
  2424. Set method to specify band-width of filter.
  2425. @table @option
  2426. @item h
  2427. Hz
  2428. @item q
  2429. Q-Factor
  2430. @item o
  2431. octave
  2432. @item s
  2433. slope
  2434. @item k
  2435. kHz
  2436. @end table
  2437. @item width, w
  2438. Specify the band-width of a filter in width_type units.
  2439. @item gain, g
  2440. Set the required gain or attenuation in dB.
  2441. Beware of clipping when using a positive gain.
  2442. @item channels, c
  2443. Specify which channels to filter, by default all available are filtered.
  2444. @end table
  2445. @subsection Examples
  2446. @itemize
  2447. @item
  2448. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2449. @example
  2450. equalizer=f=1000:t=h:width=200:g=-10
  2451. @end example
  2452. @item
  2453. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2454. @example
  2455. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2456. @end example
  2457. @end itemize
  2458. @subsection Commands
  2459. This filter supports the following commands:
  2460. @table @option
  2461. @item frequency, f
  2462. Change equalizer frequency.
  2463. Syntax for the command is : "@var{frequency}"
  2464. @item width_type, t
  2465. Change equalizer width_type.
  2466. Syntax for the command is : "@var{width_type}"
  2467. @item width, w
  2468. Change equalizer width.
  2469. Syntax for the command is : "@var{width}"
  2470. @item gain, g
  2471. Change equalizer gain.
  2472. Syntax for the command is : "@var{gain}"
  2473. @end table
  2474. @section extrastereo
  2475. Linearly increases the difference between left and right channels which
  2476. adds some sort of "live" effect to playback.
  2477. The filter accepts the following options:
  2478. @table @option
  2479. @item m
  2480. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2481. (average of both channels), with 1.0 sound will be unchanged, with
  2482. -1.0 left and right channels will be swapped.
  2483. @item c
  2484. Enable clipping. By default is enabled.
  2485. @end table
  2486. @section firequalizer
  2487. Apply FIR Equalization using arbitrary frequency response.
  2488. The filter accepts the following option:
  2489. @table @option
  2490. @item gain
  2491. Set gain curve equation (in dB). The expression can contain variables:
  2492. @table @option
  2493. @item f
  2494. the evaluated frequency
  2495. @item sr
  2496. sample rate
  2497. @item ch
  2498. channel number, set to 0 when multichannels evaluation is disabled
  2499. @item chid
  2500. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2501. multichannels evaluation is disabled
  2502. @item chs
  2503. number of channels
  2504. @item chlayout
  2505. channel_layout, see libavutil/channel_layout.h
  2506. @end table
  2507. and functions:
  2508. @table @option
  2509. @item gain_interpolate(f)
  2510. interpolate gain on frequency f based on gain_entry
  2511. @item cubic_interpolate(f)
  2512. same as gain_interpolate, but smoother
  2513. @end table
  2514. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2515. @item gain_entry
  2516. Set gain entry for gain_interpolate function. The expression can
  2517. contain functions:
  2518. @table @option
  2519. @item entry(f, g)
  2520. store gain entry at frequency f with value g
  2521. @end table
  2522. This option is also available as command.
  2523. @item delay
  2524. Set filter delay in seconds. Higher value means more accurate.
  2525. Default is @code{0.01}.
  2526. @item accuracy
  2527. Set filter accuracy in Hz. Lower value means more accurate.
  2528. Default is @code{5}.
  2529. @item wfunc
  2530. Set window function. Acceptable values are:
  2531. @table @option
  2532. @item rectangular
  2533. rectangular window, useful when gain curve is already smooth
  2534. @item hann
  2535. hann window (default)
  2536. @item hamming
  2537. hamming window
  2538. @item blackman
  2539. blackman window
  2540. @item nuttall3
  2541. 3-terms continuous 1st derivative nuttall window
  2542. @item mnuttall3
  2543. minimum 3-terms discontinuous nuttall window
  2544. @item nuttall
  2545. 4-terms continuous 1st derivative nuttall window
  2546. @item bnuttall
  2547. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2548. @item bharris
  2549. blackman-harris window
  2550. @item tukey
  2551. tukey window
  2552. @end table
  2553. @item fixed
  2554. If enabled, use fixed number of audio samples. This improves speed when
  2555. filtering with large delay. Default is disabled.
  2556. @item multi
  2557. Enable multichannels evaluation on gain. Default is disabled.
  2558. @item zero_phase
  2559. Enable zero phase mode by subtracting timestamp to compensate delay.
  2560. Default is disabled.
  2561. @item scale
  2562. Set scale used by gain. Acceptable values are:
  2563. @table @option
  2564. @item linlin
  2565. linear frequency, linear gain
  2566. @item linlog
  2567. linear frequency, logarithmic (in dB) gain (default)
  2568. @item loglin
  2569. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2570. @item loglog
  2571. logarithmic frequency, logarithmic gain
  2572. @end table
  2573. @item dumpfile
  2574. Set file for dumping, suitable for gnuplot.
  2575. @item dumpscale
  2576. Set scale for dumpfile. Acceptable values are same with scale option.
  2577. Default is linlog.
  2578. @item fft2
  2579. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2580. Default is disabled.
  2581. @item min_phase
  2582. Enable minimum phase impulse response. Default is disabled.
  2583. @end table
  2584. @subsection Examples
  2585. @itemize
  2586. @item
  2587. lowpass at 1000 Hz:
  2588. @example
  2589. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2590. @end example
  2591. @item
  2592. lowpass at 1000 Hz with gain_entry:
  2593. @example
  2594. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2595. @end example
  2596. @item
  2597. custom equalization:
  2598. @example
  2599. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2600. @end example
  2601. @item
  2602. higher delay with zero phase to compensate delay:
  2603. @example
  2604. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2605. @end example
  2606. @item
  2607. lowpass on left channel, highpass on right channel:
  2608. @example
  2609. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2610. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2611. @end example
  2612. @end itemize
  2613. @section flanger
  2614. Apply a flanging effect to the audio.
  2615. The filter accepts the following options:
  2616. @table @option
  2617. @item delay
  2618. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2619. @item depth
  2620. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2621. @item regen
  2622. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2623. Default value is 0.
  2624. @item width
  2625. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2626. Default value is 71.
  2627. @item speed
  2628. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2629. @item shape
  2630. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2631. Default value is @var{sinusoidal}.
  2632. @item phase
  2633. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2634. Default value is 25.
  2635. @item interp
  2636. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2637. Default is @var{linear}.
  2638. @end table
  2639. @section haas
  2640. Apply Haas effect to audio.
  2641. Note that this makes most sense to apply on mono signals.
  2642. With this filter applied to mono signals it give some directionality and
  2643. stretches its stereo image.
  2644. The filter accepts the following options:
  2645. @table @option
  2646. @item level_in
  2647. Set input level. By default is @var{1}, or 0dB
  2648. @item level_out
  2649. Set output level. By default is @var{1}, or 0dB.
  2650. @item side_gain
  2651. Set gain applied to side part of signal. By default is @var{1}.
  2652. @item middle_source
  2653. Set kind of middle source. Can be one of the following:
  2654. @table @samp
  2655. @item left
  2656. Pick left channel.
  2657. @item right
  2658. Pick right channel.
  2659. @item mid
  2660. Pick middle part signal of stereo image.
  2661. @item side
  2662. Pick side part signal of stereo image.
  2663. @end table
  2664. @item middle_phase
  2665. Change middle phase. By default is disabled.
  2666. @item left_delay
  2667. Set left channel delay. By default is @var{2.05} milliseconds.
  2668. @item left_balance
  2669. Set left channel balance. By default is @var{-1}.
  2670. @item left_gain
  2671. Set left channel gain. By default is @var{1}.
  2672. @item left_phase
  2673. Change left phase. By default is disabled.
  2674. @item right_delay
  2675. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2676. @item right_balance
  2677. Set right channel balance. By default is @var{1}.
  2678. @item right_gain
  2679. Set right channel gain. By default is @var{1}.
  2680. @item right_phase
  2681. Change right phase. By default is enabled.
  2682. @end table
  2683. @section hdcd
  2684. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2685. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2686. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2687. of HDCD, and detects the Transient Filter flag.
  2688. @example
  2689. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2690. @end example
  2691. When using the filter with wav, note the default encoding for wav is 16-bit,
  2692. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2693. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2694. @example
  2695. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2696. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2697. @end example
  2698. The filter accepts the following options:
  2699. @table @option
  2700. @item disable_autoconvert
  2701. Disable any automatic format conversion or resampling in the filter graph.
  2702. @item process_stereo
  2703. Process the stereo channels together. If target_gain does not match between
  2704. channels, consider it invalid and use the last valid target_gain.
  2705. @item cdt_ms
  2706. Set the code detect timer period in ms.
  2707. @item force_pe
  2708. Always extend peaks above -3dBFS even if PE isn't signaled.
  2709. @item analyze_mode
  2710. Replace audio with a solid tone and adjust the amplitude to signal some
  2711. specific aspect of the decoding process. The output file can be loaded in
  2712. an audio editor alongside the original to aid analysis.
  2713. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2714. Modes are:
  2715. @table @samp
  2716. @item 0, off
  2717. Disabled
  2718. @item 1, lle
  2719. Gain adjustment level at each sample
  2720. @item 2, pe
  2721. Samples where peak extend occurs
  2722. @item 3, cdt
  2723. Samples where the code detect timer is active
  2724. @item 4, tgm
  2725. Samples where the target gain does not match between channels
  2726. @end table
  2727. @end table
  2728. @section headphone
  2729. Apply head-related transfer functions (HRTFs) to create virtual
  2730. loudspeakers around the user for binaural listening via headphones.
  2731. The HRIRs are provided via additional streams, for each channel
  2732. one stereo input stream is needed.
  2733. The filter accepts the following options:
  2734. @table @option
  2735. @item map
  2736. Set mapping of input streams for convolution.
  2737. The argument is a '|'-separated list of channel names in order as they
  2738. are given as additional stream inputs for filter.
  2739. This also specify number of input streams. Number of input streams
  2740. must be not less than number of channels in first stream plus one.
  2741. @item gain
  2742. Set gain applied to audio. Value is in dB. Default is 0.
  2743. @item type
  2744. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2745. processing audio in time domain which is slow.
  2746. @var{freq} is processing audio in frequency domain which is fast.
  2747. Default is @var{freq}.
  2748. @item lfe
  2749. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2750. @item size
  2751. Set size of frame in number of samples which will be processed at once.
  2752. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2753. @item hrir
  2754. Set format of hrir stream.
  2755. Default value is @var{stereo}. Alternative value is @var{multich}.
  2756. If value is set to @var{stereo}, number of additional streams should
  2757. be greater or equal to number of input channels in first input stream.
  2758. Also each additional stream should have stereo number of channels.
  2759. If value is set to @var{multich}, number of additional streams should
  2760. be exactly one. Also number of input channels of additional stream
  2761. should be equal or greater than twice number of channels of first input
  2762. stream.
  2763. @end table
  2764. @subsection Examples
  2765. @itemize
  2766. @item
  2767. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2768. each amovie filter use stereo file with IR coefficients as input.
  2769. The files give coefficients for each position of virtual loudspeaker:
  2770. @example
  2771. ffmpeg -i input.wav
  2772. -filter_complex "amovie=azi_270_ele_0_DFC.wav[sr];amovie=azi_90_ele_0_DFC.wav[sl];amovie=azi_225_ele_0_DFC.wav[br];amovie=azi_135_ele_0_DFC.wav[bl];amovie=azi_0_ele_0_DFC.wav,asplit[fc][lfe];amovie=azi_35_ele_0_DFC.wav[fl];amovie=azi_325_ele_0_DFC.wav[fr];[0:a][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
  2773. output.wav
  2774. @end example
  2775. @item
  2776. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2777. but now in @var{multich} @var{hrir} format.
  2778. @example
  2779. ffmpeg -i input.wav -filter_complex "amovie=minp.wav[hrirs];[0:a][hrirs]headphone=map=FL|FR|FC|LFE|BL|BR|SL|SR:hrir=multich"
  2780. output.wav
  2781. @end example
  2782. @end itemize
  2783. @section highpass
  2784. Apply a high-pass filter with 3dB point frequency.
  2785. The filter can be either single-pole, or double-pole (the default).
  2786. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2787. The filter accepts the following options:
  2788. @table @option
  2789. @item frequency, f
  2790. Set frequency in Hz. Default is 3000.
  2791. @item poles, p
  2792. Set number of poles. Default is 2.
  2793. @item width_type, t
  2794. Set method to specify band-width of filter.
  2795. @table @option
  2796. @item h
  2797. Hz
  2798. @item q
  2799. Q-Factor
  2800. @item o
  2801. octave
  2802. @item s
  2803. slope
  2804. @item k
  2805. kHz
  2806. @end table
  2807. @item width, w
  2808. Specify the band-width of a filter in width_type units.
  2809. Applies only to double-pole filter.
  2810. The default is 0.707q and gives a Butterworth response.
  2811. @item channels, c
  2812. Specify which channels to filter, by default all available are filtered.
  2813. @end table
  2814. @subsection Commands
  2815. This filter supports the following commands:
  2816. @table @option
  2817. @item frequency, f
  2818. Change highpass frequency.
  2819. Syntax for the command is : "@var{frequency}"
  2820. @item width_type, t
  2821. Change highpass width_type.
  2822. Syntax for the command is : "@var{width_type}"
  2823. @item width, w
  2824. Change highpass width.
  2825. Syntax for the command is : "@var{width}"
  2826. @end table
  2827. @section join
  2828. Join multiple input streams into one multi-channel stream.
  2829. It accepts the following parameters:
  2830. @table @option
  2831. @item inputs
  2832. The number of input streams. It defaults to 2.
  2833. @item channel_layout
  2834. The desired output channel layout. It defaults to stereo.
  2835. @item map
  2836. Map channels from inputs to output. The argument is a '|'-separated list of
  2837. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2838. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2839. can be either the name of the input channel (e.g. FL for front left) or its
  2840. index in the specified input stream. @var{out_channel} is the name of the output
  2841. channel.
  2842. @end table
  2843. The filter will attempt to guess the mappings when they are not specified
  2844. explicitly. It does so by first trying to find an unused matching input channel
  2845. and if that fails it picks the first unused input channel.
  2846. Join 3 inputs (with properly set channel layouts):
  2847. @example
  2848. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2849. @end example
  2850. Build a 5.1 output from 6 single-channel streams:
  2851. @example
  2852. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2853. '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'
  2854. out
  2855. @end example
  2856. @section ladspa
  2857. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2858. To enable compilation of this filter you need to configure FFmpeg with
  2859. @code{--enable-ladspa}.
  2860. @table @option
  2861. @item file, f
  2862. Specifies the name of LADSPA plugin library to load. If the environment
  2863. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2864. each one of the directories specified by the colon separated list in
  2865. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2866. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2867. @file{/usr/lib/ladspa/}.
  2868. @item plugin, p
  2869. Specifies the plugin within the library. Some libraries contain only
  2870. one plugin, but others contain many of them. If this is not set filter
  2871. will list all available plugins within the specified library.
  2872. @item controls, c
  2873. Set the '|' separated list of controls which are zero or more floating point
  2874. values that determine the behavior of the loaded plugin (for example delay,
  2875. threshold or gain).
  2876. Controls need to be defined using the following syntax:
  2877. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2878. @var{valuei} is the value set on the @var{i}-th control.
  2879. Alternatively they can be also defined using the following syntax:
  2880. @var{value0}|@var{value1}|@var{value2}|..., where
  2881. @var{valuei} is the value set on the @var{i}-th control.
  2882. If @option{controls} is set to @code{help}, all available controls and
  2883. their valid ranges are printed.
  2884. @item sample_rate, s
  2885. Specify the sample rate, default to 44100. Only used if plugin have
  2886. zero inputs.
  2887. @item nb_samples, n
  2888. Set the number of samples per channel per each output frame, default
  2889. is 1024. Only used if plugin have zero inputs.
  2890. @item duration, d
  2891. Set the minimum duration of the sourced audio. See
  2892. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2893. for the accepted syntax.
  2894. Note that the resulting duration may be greater than the specified duration,
  2895. as the generated audio is always cut at the end of a complete frame.
  2896. If not specified, or the expressed duration is negative, the audio is
  2897. supposed to be generated forever.
  2898. Only used if plugin have zero inputs.
  2899. @end table
  2900. @subsection Examples
  2901. @itemize
  2902. @item
  2903. List all available plugins within amp (LADSPA example plugin) library:
  2904. @example
  2905. ladspa=file=amp
  2906. @end example
  2907. @item
  2908. List all available controls and their valid ranges for @code{vcf_notch}
  2909. plugin from @code{VCF} library:
  2910. @example
  2911. ladspa=f=vcf:p=vcf_notch:c=help
  2912. @end example
  2913. @item
  2914. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2915. plugin library:
  2916. @example
  2917. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2918. @end example
  2919. @item
  2920. Add reverberation to the audio using TAP-plugins
  2921. (Tom's Audio Processing plugins):
  2922. @example
  2923. ladspa=file=tap_reverb:tap_reverb
  2924. @end example
  2925. @item
  2926. Generate white noise, with 0.2 amplitude:
  2927. @example
  2928. ladspa=file=cmt:noise_source_white:c=c0=.2
  2929. @end example
  2930. @item
  2931. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2932. @code{C* Audio Plugin Suite} (CAPS) library:
  2933. @example
  2934. ladspa=file=caps:Click:c=c1=20'
  2935. @end example
  2936. @item
  2937. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2938. @example
  2939. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2940. @end example
  2941. @item
  2942. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2943. @code{SWH Plugins} collection:
  2944. @example
  2945. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2946. @end example
  2947. @item
  2948. Attenuate low frequencies using Multiband EQ from Steve Harris
  2949. @code{SWH Plugins} collection:
  2950. @example
  2951. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2952. @end example
  2953. @item
  2954. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2955. (CAPS) library:
  2956. @example
  2957. ladspa=caps:Narrower
  2958. @end example
  2959. @item
  2960. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2961. @example
  2962. ladspa=caps:White:.2
  2963. @end example
  2964. @item
  2965. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2966. @example
  2967. ladspa=caps:Fractal:c=c1=1
  2968. @end example
  2969. @item
  2970. Dynamic volume normalization using @code{VLevel} plugin:
  2971. @example
  2972. ladspa=vlevel-ladspa:vlevel_mono
  2973. @end example
  2974. @end itemize
  2975. @subsection Commands
  2976. This filter supports the following commands:
  2977. @table @option
  2978. @item cN
  2979. Modify the @var{N}-th control value.
  2980. If the specified value is not valid, it is ignored and prior one is kept.
  2981. @end table
  2982. @section loudnorm
  2983. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2984. Support for both single pass (livestreams, files) and double pass (files) modes.
  2985. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2986. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2987. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2988. The filter accepts the following options:
  2989. @table @option
  2990. @item I, i
  2991. Set integrated loudness target.
  2992. Range is -70.0 - -5.0. Default value is -24.0.
  2993. @item LRA, lra
  2994. Set loudness range target.
  2995. Range is 1.0 - 20.0. Default value is 7.0.
  2996. @item TP, tp
  2997. Set maximum true peak.
  2998. Range is -9.0 - +0.0. Default value is -2.0.
  2999. @item measured_I, measured_i
  3000. Measured IL of input file.
  3001. Range is -99.0 - +0.0.
  3002. @item measured_LRA, measured_lra
  3003. Measured LRA of input file.
  3004. Range is 0.0 - 99.0.
  3005. @item measured_TP, measured_tp
  3006. Measured true peak of input file.
  3007. Range is -99.0 - +99.0.
  3008. @item measured_thresh
  3009. Measured threshold of input file.
  3010. Range is -99.0 - +0.0.
  3011. @item offset
  3012. Set offset gain. Gain is applied before the true-peak limiter.
  3013. Range is -99.0 - +99.0. Default is +0.0.
  3014. @item linear
  3015. Normalize linearly if possible.
  3016. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  3017. to be specified in order to use this mode.
  3018. Options are true or false. Default is true.
  3019. @item dual_mono
  3020. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3021. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3022. If set to @code{true}, this option will compensate for this effect.
  3023. Multi-channel input files are not affected by this option.
  3024. Options are true or false. Default is false.
  3025. @item print_format
  3026. Set print format for stats. Options are summary, json, or none.
  3027. Default value is none.
  3028. @end table
  3029. @section lowpass
  3030. Apply a low-pass filter with 3dB point frequency.
  3031. The filter can be either single-pole or double-pole (the default).
  3032. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3033. The filter accepts the following options:
  3034. @table @option
  3035. @item frequency, f
  3036. Set frequency in Hz. Default is 500.
  3037. @item poles, p
  3038. Set number of poles. Default is 2.
  3039. @item width_type, t
  3040. Set method to specify band-width of filter.
  3041. @table @option
  3042. @item h
  3043. Hz
  3044. @item q
  3045. Q-Factor
  3046. @item o
  3047. octave
  3048. @item s
  3049. slope
  3050. @item k
  3051. kHz
  3052. @end table
  3053. @item width, w
  3054. Specify the band-width of a filter in width_type units.
  3055. Applies only to double-pole filter.
  3056. The default is 0.707q and gives a Butterworth response.
  3057. @item channels, c
  3058. Specify which channels to filter, by default all available are filtered.
  3059. @end table
  3060. @subsection Examples
  3061. @itemize
  3062. @item
  3063. Lowpass only LFE channel, it LFE is not present it does nothing:
  3064. @example
  3065. lowpass=c=LFE
  3066. @end example
  3067. @end itemize
  3068. @subsection Commands
  3069. This filter supports the following commands:
  3070. @table @option
  3071. @item frequency, f
  3072. Change lowpass frequency.
  3073. Syntax for the command is : "@var{frequency}"
  3074. @item width_type, t
  3075. Change lowpass width_type.
  3076. Syntax for the command is : "@var{width_type}"
  3077. @item width, w
  3078. Change lowpass width.
  3079. Syntax for the command is : "@var{width}"
  3080. @end table
  3081. @section lv2
  3082. Load a LV2 (LADSPA Version 2) plugin.
  3083. To enable compilation of this filter you need to configure FFmpeg with
  3084. @code{--enable-lv2}.
  3085. @table @option
  3086. @item plugin, p
  3087. Specifies the plugin URI. You may need to escape ':'.
  3088. @item controls, c
  3089. Set the '|' separated list of controls which are zero or more floating point
  3090. values that determine the behavior of the loaded plugin (for example delay,
  3091. threshold or gain).
  3092. If @option{controls} is set to @code{help}, all available controls and
  3093. their valid ranges are printed.
  3094. @item sample_rate, s
  3095. Specify the sample rate, default to 44100. Only used if plugin have
  3096. zero inputs.
  3097. @item nb_samples, n
  3098. Set the number of samples per channel per each output frame, default
  3099. is 1024. Only used if plugin have zero inputs.
  3100. @item duration, d
  3101. Set the minimum duration of the sourced audio. See
  3102. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3103. for the accepted syntax.
  3104. Note that the resulting duration may be greater than the specified duration,
  3105. as the generated audio is always cut at the end of a complete frame.
  3106. If not specified, or the expressed duration is negative, the audio is
  3107. supposed to be generated forever.
  3108. Only used if plugin have zero inputs.
  3109. @end table
  3110. @subsection Examples
  3111. @itemize
  3112. @item
  3113. Apply bass enhancer plugin from Calf:
  3114. @example
  3115. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3116. @end example
  3117. @item
  3118. Apply vinyl plugin from Calf:
  3119. @example
  3120. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3121. @end example
  3122. @item
  3123. Apply bit crusher plugin from ArtyFX:
  3124. @example
  3125. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3126. @end example
  3127. @end itemize
  3128. @section mcompand
  3129. Multiband Compress or expand the audio's dynamic range.
  3130. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3131. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3132. response when absent compander action.
  3133. It accepts the following parameters:
  3134. @table @option
  3135. @item args
  3136. This option syntax is:
  3137. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3138. For explanation of each item refer to compand filter documentation.
  3139. @end table
  3140. @anchor{pan}
  3141. @section pan
  3142. Mix channels with specific gain levels. The filter accepts the output
  3143. channel layout followed by a set of channels definitions.
  3144. This filter is also designed to efficiently remap the channels of an audio
  3145. stream.
  3146. The filter accepts parameters of the form:
  3147. "@var{l}|@var{outdef}|@var{outdef}|..."
  3148. @table @option
  3149. @item l
  3150. output channel layout or number of channels
  3151. @item outdef
  3152. output channel specification, of the form:
  3153. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3154. @item out_name
  3155. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3156. number (c0, c1, etc.)
  3157. @item gain
  3158. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3159. @item in_name
  3160. input channel to use, see out_name for details; it is not possible to mix
  3161. named and numbered input channels
  3162. @end table
  3163. If the `=' in a channel specification is replaced by `<', then the gains for
  3164. that specification will be renormalized so that the total is 1, thus
  3165. avoiding clipping noise.
  3166. @subsection Mixing examples
  3167. For example, if you want to down-mix from stereo to mono, but with a bigger
  3168. factor for the left channel:
  3169. @example
  3170. pan=1c|c0=0.9*c0+0.1*c1
  3171. @end example
  3172. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3173. 7-channels surround:
  3174. @example
  3175. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3176. @end example
  3177. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3178. that should be preferred (see "-ac" option) unless you have very specific
  3179. needs.
  3180. @subsection Remapping examples
  3181. The channel remapping will be effective if, and only if:
  3182. @itemize
  3183. @item gain coefficients are zeroes or ones,
  3184. @item only one input per channel output,
  3185. @end itemize
  3186. If all these conditions are satisfied, the filter will notify the user ("Pure
  3187. channel mapping detected"), and use an optimized and lossless method to do the
  3188. remapping.
  3189. For example, if you have a 5.1 source and want a stereo audio stream by
  3190. dropping the extra channels:
  3191. @example
  3192. pan="stereo| c0=FL | c1=FR"
  3193. @end example
  3194. Given the same source, you can also switch front left and front right channels
  3195. and keep the input channel layout:
  3196. @example
  3197. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3198. @end example
  3199. If the input is a stereo audio stream, you can mute the front left channel (and
  3200. still keep the stereo channel layout) with:
  3201. @example
  3202. pan="stereo|c1=c1"
  3203. @end example
  3204. Still with a stereo audio stream input, you can copy the right channel in both
  3205. front left and right:
  3206. @example
  3207. pan="stereo| c0=FR | c1=FR"
  3208. @end example
  3209. @section replaygain
  3210. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3211. outputs it unchanged.
  3212. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3213. @section resample
  3214. Convert the audio sample format, sample rate and channel layout. It is
  3215. not meant to be used directly.
  3216. @section rubberband
  3217. Apply time-stretching and pitch-shifting with librubberband.
  3218. To enable compilation of this filter, you need to configure FFmpeg with
  3219. @code{--enable-librubberband}.
  3220. The filter accepts the following options:
  3221. @table @option
  3222. @item tempo
  3223. Set tempo scale factor.
  3224. @item pitch
  3225. Set pitch scale factor.
  3226. @item transients
  3227. Set transients detector.
  3228. Possible values are:
  3229. @table @var
  3230. @item crisp
  3231. @item mixed
  3232. @item smooth
  3233. @end table
  3234. @item detector
  3235. Set detector.
  3236. Possible values are:
  3237. @table @var
  3238. @item compound
  3239. @item percussive
  3240. @item soft
  3241. @end table
  3242. @item phase
  3243. Set phase.
  3244. Possible values are:
  3245. @table @var
  3246. @item laminar
  3247. @item independent
  3248. @end table
  3249. @item window
  3250. Set processing window size.
  3251. Possible values are:
  3252. @table @var
  3253. @item standard
  3254. @item short
  3255. @item long
  3256. @end table
  3257. @item smoothing
  3258. Set smoothing.
  3259. Possible values are:
  3260. @table @var
  3261. @item off
  3262. @item on
  3263. @end table
  3264. @item formant
  3265. Enable formant preservation when shift pitching.
  3266. Possible values are:
  3267. @table @var
  3268. @item shifted
  3269. @item preserved
  3270. @end table
  3271. @item pitchq
  3272. Set pitch quality.
  3273. Possible values are:
  3274. @table @var
  3275. @item quality
  3276. @item speed
  3277. @item consistency
  3278. @end table
  3279. @item channels
  3280. Set channels.
  3281. Possible values are:
  3282. @table @var
  3283. @item apart
  3284. @item together
  3285. @end table
  3286. @end table
  3287. @section sidechaincompress
  3288. This filter acts like normal compressor but has the ability to compress
  3289. detected signal using second input signal.
  3290. It needs two input streams and returns one output stream.
  3291. First input stream will be processed depending on second stream signal.
  3292. The filtered signal then can be filtered with other filters in later stages of
  3293. processing. See @ref{pan} and @ref{amerge} filter.
  3294. The filter accepts the following options:
  3295. @table @option
  3296. @item level_in
  3297. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3298. @item threshold
  3299. If a signal of second stream raises above this level it will affect the gain
  3300. reduction of first stream.
  3301. By default is 0.125. Range is between 0.00097563 and 1.
  3302. @item ratio
  3303. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3304. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3305. Default is 2. Range is between 1 and 20.
  3306. @item attack
  3307. Amount of milliseconds the signal has to rise above the threshold before gain
  3308. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3309. @item release
  3310. Amount of milliseconds the signal has to fall below the threshold before
  3311. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3312. @item makeup
  3313. Set the amount by how much signal will be amplified after processing.
  3314. Default is 1. Range is from 1 to 64.
  3315. @item knee
  3316. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3317. Default is 2.82843. Range is between 1 and 8.
  3318. @item link
  3319. Choose if the @code{average} level between all channels of side-chain stream
  3320. or the louder(@code{maximum}) channel of side-chain stream affects the
  3321. reduction. Default is @code{average}.
  3322. @item detection
  3323. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3324. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3325. @item level_sc
  3326. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3327. @item mix
  3328. How much to use compressed signal in output. Default is 1.
  3329. Range is between 0 and 1.
  3330. @end table
  3331. @subsection Examples
  3332. @itemize
  3333. @item
  3334. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3335. depending on the signal of 2nd input and later compressed signal to be
  3336. merged with 2nd input:
  3337. @example
  3338. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3339. @end example
  3340. @end itemize
  3341. @section sidechaingate
  3342. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3343. filter the detected signal before sending it to the gain reduction stage.
  3344. Normally a gate uses the full range signal to detect a level above the
  3345. threshold.
  3346. For example: If you cut all lower frequencies from your sidechain signal
  3347. the gate will decrease the volume of your track only if not enough highs
  3348. appear. With this technique you are able to reduce the resonation of a
  3349. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3350. guitar.
  3351. It needs two input streams and returns one output stream.
  3352. First input stream will be processed depending on second stream signal.
  3353. The filter accepts the following options:
  3354. @table @option
  3355. @item level_in
  3356. Set input level before filtering.
  3357. Default is 1. Allowed range is from 0.015625 to 64.
  3358. @item range
  3359. Set the level of gain reduction when the signal is below the threshold.
  3360. Default is 0.06125. Allowed range is from 0 to 1.
  3361. @item threshold
  3362. If a signal rises above this level the gain reduction is released.
  3363. Default is 0.125. Allowed range is from 0 to 1.
  3364. @item ratio
  3365. Set a ratio about which the signal is reduced.
  3366. Default is 2. Allowed range is from 1 to 9000.
  3367. @item attack
  3368. Amount of milliseconds the signal has to rise above the threshold before gain
  3369. reduction stops.
  3370. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3371. @item release
  3372. Amount of milliseconds the signal has to fall below the threshold before the
  3373. reduction is increased again. Default is 250 milliseconds.
  3374. Allowed range is from 0.01 to 9000.
  3375. @item makeup
  3376. Set amount of amplification of signal after processing.
  3377. Default is 1. Allowed range is from 1 to 64.
  3378. @item knee
  3379. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3380. Default is 2.828427125. Allowed range is from 1 to 8.
  3381. @item detection
  3382. Choose if exact signal should be taken for detection or an RMS like one.
  3383. Default is rms. Can be peak or rms.
  3384. @item link
  3385. Choose if the average level between all channels or the louder channel affects
  3386. the reduction.
  3387. Default is average. Can be average or maximum.
  3388. @item level_sc
  3389. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3390. @end table
  3391. @section silencedetect
  3392. Detect silence in an audio stream.
  3393. This filter logs a message when it detects that the input audio volume is less
  3394. or equal to a noise tolerance value for a duration greater or equal to the
  3395. minimum detected noise duration.
  3396. The printed times and duration are expressed in seconds.
  3397. The filter accepts the following options:
  3398. @table @option
  3399. @item noise, n
  3400. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3401. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3402. @item duration, d
  3403. Set silence duration until notification (default is 2 seconds).
  3404. @item mono, m
  3405. Process each channel separately, instead of combined. By default is disabled.
  3406. @end table
  3407. @subsection Examples
  3408. @itemize
  3409. @item
  3410. Detect 5 seconds of silence with -50dB noise tolerance:
  3411. @example
  3412. silencedetect=n=-50dB:d=5
  3413. @end example
  3414. @item
  3415. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3416. tolerance in @file{silence.mp3}:
  3417. @example
  3418. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3419. @end example
  3420. @end itemize
  3421. @section silenceremove
  3422. Remove silence from the beginning, middle or end of the audio.
  3423. The filter accepts the following options:
  3424. @table @option
  3425. @item start_periods
  3426. This value is used to indicate if audio should be trimmed at beginning of
  3427. the audio. A value of zero indicates no silence should be trimmed from the
  3428. beginning. When specifying a non-zero value, it trims audio up until it
  3429. finds non-silence. Normally, when trimming silence from beginning of audio
  3430. the @var{start_periods} will be @code{1} but it can be increased to higher
  3431. values to trim all audio up to specific count of non-silence periods.
  3432. Default value is @code{0}.
  3433. @item start_duration
  3434. Specify the amount of time that non-silence must be detected before it stops
  3435. trimming audio. By increasing the duration, bursts of noises can be treated
  3436. as silence and trimmed off. Default value is @code{0}.
  3437. @item start_threshold
  3438. This indicates what sample value should be treated as silence. For digital
  3439. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3440. you may wish to increase the value to account for background noise.
  3441. Can be specified in dB (in case "dB" is appended to the specified value)
  3442. or amplitude ratio. Default value is @code{0}.
  3443. @item start_silence
  3444. Specify max duration of silence at beginning that will be kept after
  3445. trimming. Default is 0, which is equal to trimming all samples detected
  3446. as silence.
  3447. @item start_mode
  3448. Specify mode of detection of silence end in start of multi-channel audio.
  3449. Can be @var{any} or @var{all}. Default is @var{any}.
  3450. With @var{any}, any sample that is detected as non-silence will cause
  3451. stopped trimming of silence.
  3452. With @var{all}, only if all channels are detected as non-silence will cause
  3453. stopped trimming of silence.
  3454. @item stop_periods
  3455. Set the count for trimming silence from the end of audio.
  3456. To remove silence from the middle of a file, specify a @var{stop_periods}
  3457. that is negative. This value is then treated as a positive value and is
  3458. used to indicate the effect should restart processing as specified by
  3459. @var{start_periods}, making it suitable for removing periods of silence
  3460. in the middle of the audio.
  3461. Default value is @code{0}.
  3462. @item stop_duration
  3463. Specify a duration of silence that must exist before audio is not copied any
  3464. more. By specifying a higher duration, silence that is wanted can be left in
  3465. the audio.
  3466. Default value is @code{0}.
  3467. @item stop_threshold
  3468. This is the same as @option{start_threshold} but for trimming silence from
  3469. the end of audio.
  3470. Can be specified in dB (in case "dB" is appended to the specified value)
  3471. or amplitude ratio. Default value is @code{0}.
  3472. @item stop_silence
  3473. Specify max duration of silence at end that will be kept after
  3474. trimming. Default is 0, which is equal to trimming all samples detected
  3475. as silence.
  3476. @item stop_mode
  3477. Specify mode of detection of silence start in end of multi-channel audio.
  3478. Can be @var{any} or @var{all}. Default is @var{any}.
  3479. With @var{any}, any sample that is detected as non-silence will cause
  3480. stopped trimming of silence.
  3481. With @var{all}, only if all channels are detected as non-silence will cause
  3482. stopped trimming of silence.
  3483. @item detection
  3484. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3485. and works better with digital silence which is exactly 0.
  3486. Default value is @code{rms}.
  3487. @item window
  3488. Set duration in number of seconds used to calculate size of window in number
  3489. of samples for detecting silence.
  3490. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3491. @end table
  3492. @subsection Examples
  3493. @itemize
  3494. @item
  3495. The following example shows how this filter can be used to start a recording
  3496. that does not contain the delay at the start which usually occurs between
  3497. pressing the record button and the start of the performance:
  3498. @example
  3499. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3500. @end example
  3501. @item
  3502. Trim all silence encountered from beginning to end where there is more than 1
  3503. second of silence in audio:
  3504. @example
  3505. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3506. @end example
  3507. @end itemize
  3508. @section sofalizer
  3509. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3510. loudspeakers around the user for binaural listening via headphones (audio
  3511. formats up to 9 channels supported).
  3512. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3513. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3514. Austrian Academy of Sciences.
  3515. To enable compilation of this filter you need to configure FFmpeg with
  3516. @code{--enable-libmysofa}.
  3517. The filter accepts the following options:
  3518. @table @option
  3519. @item sofa
  3520. Set the SOFA file used for rendering.
  3521. @item gain
  3522. Set gain applied to audio. Value is in dB. Default is 0.
  3523. @item rotation
  3524. Set rotation of virtual loudspeakers in deg. Default is 0.
  3525. @item elevation
  3526. Set elevation of virtual speakers in deg. Default is 0.
  3527. @item radius
  3528. Set distance in meters between loudspeakers and the listener with near-field
  3529. HRTFs. Default is 1.
  3530. @item type
  3531. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3532. processing audio in time domain which is slow.
  3533. @var{freq} is processing audio in frequency domain which is fast.
  3534. Default is @var{freq}.
  3535. @item speakers
  3536. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3537. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3538. Each virtual loudspeaker is described with short channel name following with
  3539. azimuth and elevation in degrees.
  3540. Each virtual loudspeaker description is separated by '|'.
  3541. For example to override front left and front right channel positions use:
  3542. 'speakers=FL 45 15|FR 345 15'.
  3543. Descriptions with unrecognised channel names are ignored.
  3544. @item lfegain
  3545. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3546. @item framesize
  3547. Set custom frame size in number of samples. Default is 1024.
  3548. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3549. is set to @var{freq}.
  3550. @item normalize
  3551. Should all IRs be normalized upon importing SOFA file.
  3552. By default is enabled.
  3553. @item interpolate
  3554. Should nearest IRs be interpolated with neighbor IRs if exact position
  3555. does not match. By default is disabled.
  3556. @item minphase
  3557. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3558. @item anglestep
  3559. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3560. @item radstep
  3561. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3562. @end table
  3563. @subsection Examples
  3564. @itemize
  3565. @item
  3566. Using ClubFritz6 sofa file:
  3567. @example
  3568. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3569. @end example
  3570. @item
  3571. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3572. @example
  3573. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3574. @end example
  3575. @item
  3576. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3577. and also with custom gain:
  3578. @example
  3579. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3580. @end example
  3581. @end itemize
  3582. @section stereotools
  3583. This filter has some handy utilities to manage stereo signals, for converting
  3584. M/S stereo recordings to L/R signal while having control over the parameters
  3585. or spreading the stereo image of master track.
  3586. The filter accepts the following options:
  3587. @table @option
  3588. @item level_in
  3589. Set input level before filtering for both channels. Defaults is 1.
  3590. Allowed range is from 0.015625 to 64.
  3591. @item level_out
  3592. Set output level after filtering for both channels. Defaults is 1.
  3593. Allowed range is from 0.015625 to 64.
  3594. @item balance_in
  3595. Set input balance between both channels. Default is 0.
  3596. Allowed range is from -1 to 1.
  3597. @item balance_out
  3598. Set output balance between both channels. Default is 0.
  3599. Allowed range is from -1 to 1.
  3600. @item softclip
  3601. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3602. clipping. Disabled by default.
  3603. @item mutel
  3604. Mute the left channel. Disabled by default.
  3605. @item muter
  3606. Mute the right channel. Disabled by default.
  3607. @item phasel
  3608. Change the phase of the left channel. Disabled by default.
  3609. @item phaser
  3610. Change the phase of the right channel. Disabled by default.
  3611. @item mode
  3612. Set stereo mode. Available values are:
  3613. @table @samp
  3614. @item lr>lr
  3615. Left/Right to Left/Right, this is default.
  3616. @item lr>ms
  3617. Left/Right to Mid/Side.
  3618. @item ms>lr
  3619. Mid/Side to Left/Right.
  3620. @item lr>ll
  3621. Left/Right to Left/Left.
  3622. @item lr>rr
  3623. Left/Right to Right/Right.
  3624. @item lr>l+r
  3625. Left/Right to Left + Right.
  3626. @item lr>rl
  3627. Left/Right to Right/Left.
  3628. @item ms>ll
  3629. Mid/Side to Left/Left.
  3630. @item ms>rr
  3631. Mid/Side to Right/Right.
  3632. @end table
  3633. @item slev
  3634. Set level of side signal. Default is 1.
  3635. Allowed range is from 0.015625 to 64.
  3636. @item sbal
  3637. Set balance of side signal. Default is 0.
  3638. Allowed range is from -1 to 1.
  3639. @item mlev
  3640. Set level of the middle signal. Default is 1.
  3641. Allowed range is from 0.015625 to 64.
  3642. @item mpan
  3643. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3644. @item base
  3645. Set stereo base between mono and inversed channels. Default is 0.
  3646. Allowed range is from -1 to 1.
  3647. @item delay
  3648. Set delay in milliseconds how much to delay left from right channel and
  3649. vice versa. Default is 0. Allowed range is from -20 to 20.
  3650. @item sclevel
  3651. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3652. @item phase
  3653. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3654. @item bmode_in, bmode_out
  3655. Set balance mode for balance_in/balance_out option.
  3656. Can be one of the following:
  3657. @table @samp
  3658. @item balance
  3659. Classic balance mode. Attenuate one channel at time.
  3660. Gain is raised up to 1.
  3661. @item amplitude
  3662. Similar as classic mode above but gain is raised up to 2.
  3663. @item power
  3664. Equal power distribution, from -6dB to +6dB range.
  3665. @end table
  3666. @end table
  3667. @subsection Examples
  3668. @itemize
  3669. @item
  3670. Apply karaoke like effect:
  3671. @example
  3672. stereotools=mlev=0.015625
  3673. @end example
  3674. @item
  3675. Convert M/S signal to L/R:
  3676. @example
  3677. "stereotools=mode=ms>lr"
  3678. @end example
  3679. @end itemize
  3680. @section stereowiden
  3681. This filter enhance the stereo effect by suppressing signal common to both
  3682. channels and by delaying the signal of left into right and vice versa,
  3683. thereby widening the stereo effect.
  3684. The filter accepts the following options:
  3685. @table @option
  3686. @item delay
  3687. Time in milliseconds of the delay of left signal into right and vice versa.
  3688. Default is 20 milliseconds.
  3689. @item feedback
  3690. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3691. effect of left signal in right output and vice versa which gives widening
  3692. effect. Default is 0.3.
  3693. @item crossfeed
  3694. Cross feed of left into right with inverted phase. This helps in suppressing
  3695. the mono. If the value is 1 it will cancel all the signal common to both
  3696. channels. Default is 0.3.
  3697. @item drymix
  3698. Set level of input signal of original channel. Default is 0.8.
  3699. @end table
  3700. @section superequalizer
  3701. Apply 18 band equalizer.
  3702. The filter accepts the following options:
  3703. @table @option
  3704. @item 1b
  3705. Set 65Hz band gain.
  3706. @item 2b
  3707. Set 92Hz band gain.
  3708. @item 3b
  3709. Set 131Hz band gain.
  3710. @item 4b
  3711. Set 185Hz band gain.
  3712. @item 5b
  3713. Set 262Hz band gain.
  3714. @item 6b
  3715. Set 370Hz band gain.
  3716. @item 7b
  3717. Set 523Hz band gain.
  3718. @item 8b
  3719. Set 740Hz band gain.
  3720. @item 9b
  3721. Set 1047Hz band gain.
  3722. @item 10b
  3723. Set 1480Hz band gain.
  3724. @item 11b
  3725. Set 2093Hz band gain.
  3726. @item 12b
  3727. Set 2960Hz band gain.
  3728. @item 13b
  3729. Set 4186Hz band gain.
  3730. @item 14b
  3731. Set 5920Hz band gain.
  3732. @item 15b
  3733. Set 8372Hz band gain.
  3734. @item 16b
  3735. Set 11840Hz band gain.
  3736. @item 17b
  3737. Set 16744Hz band gain.
  3738. @item 18b
  3739. Set 20000Hz band gain.
  3740. @end table
  3741. @section surround
  3742. Apply audio surround upmix filter.
  3743. This filter allows to produce multichannel output from audio stream.
  3744. The filter accepts the following options:
  3745. @table @option
  3746. @item chl_out
  3747. Set output channel layout. By default, this is @var{5.1}.
  3748. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3749. for the required syntax.
  3750. @item chl_in
  3751. Set input channel layout. By default, this is @var{stereo}.
  3752. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3753. for the required syntax.
  3754. @item level_in
  3755. Set input volume level. By default, this is @var{1}.
  3756. @item level_out
  3757. Set output volume level. By default, this is @var{1}.
  3758. @item lfe
  3759. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3760. @item lfe_low
  3761. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3762. @item lfe_high
  3763. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3764. @item fc_in
  3765. Set front center input volume. By default, this is @var{1}.
  3766. @item fc_out
  3767. Set front center output volume. By default, this is @var{1}.
  3768. @item lfe_in
  3769. Set LFE input volume. By default, this is @var{1}.
  3770. @item lfe_out
  3771. Set LFE output volume. By default, this is @var{1}.
  3772. @end table
  3773. @section treble, highshelf
  3774. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3775. shelving filter with a response similar to that of a standard
  3776. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3777. The filter accepts the following options:
  3778. @table @option
  3779. @item gain, g
  3780. Give the gain at whichever is the lower of ~22 kHz and the
  3781. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3782. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3783. @item frequency, f
  3784. Set the filter's central frequency and so can be used
  3785. to extend or reduce the frequency range to be boosted or cut.
  3786. The default value is @code{3000} Hz.
  3787. @item width_type, t
  3788. Set method to specify band-width of filter.
  3789. @table @option
  3790. @item h
  3791. Hz
  3792. @item q
  3793. Q-Factor
  3794. @item o
  3795. octave
  3796. @item s
  3797. slope
  3798. @item k
  3799. kHz
  3800. @end table
  3801. @item width, w
  3802. Determine how steep is the filter's shelf transition.
  3803. @item channels, c
  3804. Specify which channels to filter, by default all available are filtered.
  3805. @end table
  3806. @subsection Commands
  3807. This filter supports the following commands:
  3808. @table @option
  3809. @item frequency, f
  3810. Change treble frequency.
  3811. Syntax for the command is : "@var{frequency}"
  3812. @item width_type, t
  3813. Change treble width_type.
  3814. Syntax for the command is : "@var{width_type}"
  3815. @item width, w
  3816. Change treble width.
  3817. Syntax for the command is : "@var{width}"
  3818. @item gain, g
  3819. Change treble gain.
  3820. Syntax for the command is : "@var{gain}"
  3821. @end table
  3822. @section tremolo
  3823. Sinusoidal amplitude modulation.
  3824. The filter accepts the following options:
  3825. @table @option
  3826. @item f
  3827. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3828. (20 Hz or lower) will result in a tremolo effect.
  3829. This filter may also be used as a ring modulator by specifying
  3830. a modulation frequency higher than 20 Hz.
  3831. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3832. @item d
  3833. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3834. Default value is 0.5.
  3835. @end table
  3836. @section vibrato
  3837. Sinusoidal phase modulation.
  3838. The filter accepts the following options:
  3839. @table @option
  3840. @item f
  3841. Modulation frequency in Hertz.
  3842. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3843. @item d
  3844. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3845. Default value is 0.5.
  3846. @end table
  3847. @section volume
  3848. Adjust the input audio volume.
  3849. It accepts the following parameters:
  3850. @table @option
  3851. @item volume
  3852. Set audio volume expression.
  3853. Output values are clipped to the maximum value.
  3854. The output audio volume is given by the relation:
  3855. @example
  3856. @var{output_volume} = @var{volume} * @var{input_volume}
  3857. @end example
  3858. The default value for @var{volume} is "1.0".
  3859. @item precision
  3860. This parameter represents the mathematical precision.
  3861. It determines which input sample formats will be allowed, which affects the
  3862. precision of the volume scaling.
  3863. @table @option
  3864. @item fixed
  3865. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3866. @item float
  3867. 32-bit floating-point; this limits input sample format to FLT. (default)
  3868. @item double
  3869. 64-bit floating-point; this limits input sample format to DBL.
  3870. @end table
  3871. @item replaygain
  3872. Choose the behaviour on encountering ReplayGain side data in input frames.
  3873. @table @option
  3874. @item drop
  3875. Remove ReplayGain side data, ignoring its contents (the default).
  3876. @item ignore
  3877. Ignore ReplayGain side data, but leave it in the frame.
  3878. @item track
  3879. Prefer the track gain, if present.
  3880. @item album
  3881. Prefer the album gain, if present.
  3882. @end table
  3883. @item replaygain_preamp
  3884. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3885. Default value for @var{replaygain_preamp} is 0.0.
  3886. @item eval
  3887. Set when the volume expression is evaluated.
  3888. It accepts the following values:
  3889. @table @samp
  3890. @item once
  3891. only evaluate expression once during the filter initialization, or
  3892. when the @samp{volume} command is sent
  3893. @item frame
  3894. evaluate expression for each incoming frame
  3895. @end table
  3896. Default value is @samp{once}.
  3897. @end table
  3898. The volume expression can contain the following parameters.
  3899. @table @option
  3900. @item n
  3901. frame number (starting at zero)
  3902. @item nb_channels
  3903. number of channels
  3904. @item nb_consumed_samples
  3905. number of samples consumed by the filter
  3906. @item nb_samples
  3907. number of samples in the current frame
  3908. @item pos
  3909. original frame position in the file
  3910. @item pts
  3911. frame PTS
  3912. @item sample_rate
  3913. sample rate
  3914. @item startpts
  3915. PTS at start of stream
  3916. @item startt
  3917. time at start of stream
  3918. @item t
  3919. frame time
  3920. @item tb
  3921. timestamp timebase
  3922. @item volume
  3923. last set volume value
  3924. @end table
  3925. Note that when @option{eval} is set to @samp{once} only the
  3926. @var{sample_rate} and @var{tb} variables are available, all other
  3927. variables will evaluate to NAN.
  3928. @subsection Commands
  3929. This filter supports the following commands:
  3930. @table @option
  3931. @item volume
  3932. Modify the volume expression.
  3933. The command accepts the same syntax of the corresponding option.
  3934. If the specified expression is not valid, it is kept at its current
  3935. value.
  3936. @item replaygain_noclip
  3937. Prevent clipping by limiting the gain applied.
  3938. Default value for @var{replaygain_noclip} is 1.
  3939. @end table
  3940. @subsection Examples
  3941. @itemize
  3942. @item
  3943. Halve the input audio volume:
  3944. @example
  3945. volume=volume=0.5
  3946. volume=volume=1/2
  3947. volume=volume=-6.0206dB
  3948. @end example
  3949. In all the above example the named key for @option{volume} can be
  3950. omitted, for example like in:
  3951. @example
  3952. volume=0.5
  3953. @end example
  3954. @item
  3955. Increase input audio power by 6 decibels using fixed-point precision:
  3956. @example
  3957. volume=volume=6dB:precision=fixed
  3958. @end example
  3959. @item
  3960. Fade volume after time 10 with an annihilation period of 5 seconds:
  3961. @example
  3962. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3963. @end example
  3964. @end itemize
  3965. @section volumedetect
  3966. Detect the volume of the input video.
  3967. The filter has no parameters. The input is not modified. Statistics about
  3968. the volume will be printed in the log when the input stream end is reached.
  3969. In particular it will show the mean volume (root mean square), maximum
  3970. volume (on a per-sample basis), and the beginning of a histogram of the
  3971. registered volume values (from the maximum value to a cumulated 1/1000 of
  3972. the samples).
  3973. All volumes are in decibels relative to the maximum PCM value.
  3974. @subsection Examples
  3975. Here is an excerpt of the output:
  3976. @example
  3977. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3978. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3979. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3980. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3981. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3982. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3983. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3984. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3985. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3986. @end example
  3987. It means that:
  3988. @itemize
  3989. @item
  3990. The mean square energy is approximately -27 dB, or 10^-2.7.
  3991. @item
  3992. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3993. @item
  3994. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3995. @end itemize
  3996. In other words, raising the volume by +4 dB does not cause any clipping,
  3997. raising it by +5 dB causes clipping for 6 samples, etc.
  3998. @c man end AUDIO FILTERS
  3999. @chapter Audio Sources
  4000. @c man begin AUDIO SOURCES
  4001. Below is a description of the currently available audio sources.
  4002. @section abuffer
  4003. Buffer audio frames, and make them available to the filter chain.
  4004. This source is mainly intended for a programmatic use, in particular
  4005. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4006. It accepts the following parameters:
  4007. @table @option
  4008. @item time_base
  4009. The timebase which will be used for timestamps of submitted frames. It must be
  4010. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4011. @item sample_rate
  4012. The sample rate of the incoming audio buffers.
  4013. @item sample_fmt
  4014. The sample format of the incoming audio buffers.
  4015. Either a sample format name or its corresponding integer representation from
  4016. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4017. @item channel_layout
  4018. The channel layout of the incoming audio buffers.
  4019. Either a channel layout name from channel_layout_map in
  4020. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4021. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4022. @item channels
  4023. The number of channels of the incoming audio buffers.
  4024. If both @var{channels} and @var{channel_layout} are specified, then they
  4025. must be consistent.
  4026. @end table
  4027. @subsection Examples
  4028. @example
  4029. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4030. @end example
  4031. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4032. Since the sample format with name "s16p" corresponds to the number
  4033. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4034. equivalent to:
  4035. @example
  4036. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4037. @end example
  4038. @section aevalsrc
  4039. Generate an audio signal specified by an expression.
  4040. This source accepts in input one or more expressions (one for each
  4041. channel), which are evaluated and used to generate a corresponding
  4042. audio signal.
  4043. This source accepts the following options:
  4044. @table @option
  4045. @item exprs
  4046. Set the '|'-separated expressions list for each separate channel. In case the
  4047. @option{channel_layout} option is not specified, the selected channel layout
  4048. depends on the number of provided expressions. Otherwise the last
  4049. specified expression is applied to the remaining output channels.
  4050. @item channel_layout, c
  4051. Set the channel layout. The number of channels in the specified layout
  4052. must be equal to the number of specified expressions.
  4053. @item duration, d
  4054. Set the minimum duration of the sourced audio. See
  4055. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4056. for the accepted syntax.
  4057. Note that the resulting duration may be greater than the specified
  4058. duration, as the generated audio is always cut at the end of a
  4059. complete frame.
  4060. If not specified, or the expressed duration is negative, the audio is
  4061. supposed to be generated forever.
  4062. @item nb_samples, n
  4063. Set the number of samples per channel per each output frame,
  4064. default to 1024.
  4065. @item sample_rate, s
  4066. Specify the sample rate, default to 44100.
  4067. @end table
  4068. Each expression in @var{exprs} can contain the following constants:
  4069. @table @option
  4070. @item n
  4071. number of the evaluated sample, starting from 0
  4072. @item t
  4073. time of the evaluated sample expressed in seconds, starting from 0
  4074. @item s
  4075. sample rate
  4076. @end table
  4077. @subsection Examples
  4078. @itemize
  4079. @item
  4080. Generate silence:
  4081. @example
  4082. aevalsrc=0
  4083. @end example
  4084. @item
  4085. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4086. 8000 Hz:
  4087. @example
  4088. aevalsrc="sin(440*2*PI*t):s=8000"
  4089. @end example
  4090. @item
  4091. Generate a two channels signal, specify the channel layout (Front
  4092. Center + Back Center) explicitly:
  4093. @example
  4094. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4095. @end example
  4096. @item
  4097. Generate white noise:
  4098. @example
  4099. aevalsrc="-2+random(0)"
  4100. @end example
  4101. @item
  4102. Generate an amplitude modulated signal:
  4103. @example
  4104. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4105. @end example
  4106. @item
  4107. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4108. @example
  4109. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4110. @end example
  4111. @end itemize
  4112. @section anullsrc
  4113. The null audio source, return unprocessed audio frames. It is mainly useful
  4114. as a template and to be employed in analysis / debugging tools, or as
  4115. the source for filters which ignore the input data (for example the sox
  4116. synth filter).
  4117. This source accepts the following options:
  4118. @table @option
  4119. @item channel_layout, cl
  4120. Specifies the channel layout, and can be either an integer or a string
  4121. representing a channel layout. The default value of @var{channel_layout}
  4122. is "stereo".
  4123. Check the channel_layout_map definition in
  4124. @file{libavutil/channel_layout.c} for the mapping between strings and
  4125. channel layout values.
  4126. @item sample_rate, r
  4127. Specifies the sample rate, and defaults to 44100.
  4128. @item nb_samples, n
  4129. Set the number of samples per requested frames.
  4130. @end table
  4131. @subsection Examples
  4132. @itemize
  4133. @item
  4134. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4135. @example
  4136. anullsrc=r=48000:cl=4
  4137. @end example
  4138. @item
  4139. Do the same operation with a more obvious syntax:
  4140. @example
  4141. anullsrc=r=48000:cl=mono
  4142. @end example
  4143. @end itemize
  4144. All the parameters need to be explicitly defined.
  4145. @section flite
  4146. Synthesize a voice utterance using the libflite library.
  4147. To enable compilation of this filter you need to configure FFmpeg with
  4148. @code{--enable-libflite}.
  4149. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4150. The filter accepts the following options:
  4151. @table @option
  4152. @item list_voices
  4153. If set to 1, list the names of the available voices and exit
  4154. immediately. Default value is 0.
  4155. @item nb_samples, n
  4156. Set the maximum number of samples per frame. Default value is 512.
  4157. @item textfile
  4158. Set the filename containing the text to speak.
  4159. @item text
  4160. Set the text to speak.
  4161. @item voice, v
  4162. Set the voice to use for the speech synthesis. Default value is
  4163. @code{kal}. See also the @var{list_voices} option.
  4164. @end table
  4165. @subsection Examples
  4166. @itemize
  4167. @item
  4168. Read from file @file{speech.txt}, and synthesize the text using the
  4169. standard flite voice:
  4170. @example
  4171. flite=textfile=speech.txt
  4172. @end example
  4173. @item
  4174. Read the specified text selecting the @code{slt} voice:
  4175. @example
  4176. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4177. @end example
  4178. @item
  4179. Input text to ffmpeg:
  4180. @example
  4181. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4182. @end example
  4183. @item
  4184. Make @file{ffplay} speak the specified text, using @code{flite} and
  4185. the @code{lavfi} device:
  4186. @example
  4187. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4188. @end example
  4189. @end itemize
  4190. For more information about libflite, check:
  4191. @url{http://www.festvox.org/flite/}
  4192. @section anoisesrc
  4193. Generate a noise audio signal.
  4194. The filter accepts the following options:
  4195. @table @option
  4196. @item sample_rate, r
  4197. Specify the sample rate. Default value is 48000 Hz.
  4198. @item amplitude, a
  4199. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4200. is 1.0.
  4201. @item duration, d
  4202. Specify the duration of the generated audio stream. Not specifying this option
  4203. results in noise with an infinite length.
  4204. @item color, colour, c
  4205. Specify the color of noise. Available noise colors are white, pink, brown,
  4206. blue and violet. Default color is white.
  4207. @item seed, s
  4208. Specify a value used to seed the PRNG.
  4209. @item nb_samples, n
  4210. Set the number of samples per each output frame, default is 1024.
  4211. @end table
  4212. @subsection Examples
  4213. @itemize
  4214. @item
  4215. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4216. @example
  4217. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4218. @end example
  4219. @end itemize
  4220. @section hilbert
  4221. Generate odd-tap Hilbert transform FIR coefficients.
  4222. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4223. the signal by 90 degrees.
  4224. This is used in many matrix coding schemes and for analytic signal generation.
  4225. The process is often written as a multiplication by i (or j), the imaginary unit.
  4226. The filter accepts the following options:
  4227. @table @option
  4228. @item sample_rate, s
  4229. Set sample rate, default is 44100.
  4230. @item taps, t
  4231. Set length of FIR filter, default is 22051.
  4232. @item nb_samples, n
  4233. Set number of samples per each frame.
  4234. @item win_func, w
  4235. Set window function to be used when generating FIR coefficients.
  4236. @end table
  4237. @section sinc
  4238. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4239. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4240. The filter accepts the following options:
  4241. @table @option
  4242. @item sample_rate, r
  4243. Set sample rate, default is 44100.
  4244. @item nb_samples, n
  4245. Set number of samples per each frame. Default is 1024.
  4246. @item hp
  4247. Set high-pass frequency. Default is 0.
  4248. @item lp
  4249. Set low-pass frequency. Default is 0.
  4250. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4251. is higher than 0 then filter will create band-pass filter coefficients,
  4252. otherwise band-reject filter coefficients.
  4253. @item phase
  4254. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4255. @item beta
  4256. Set Kaiser window beta.
  4257. @item att
  4258. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4259. @item round
  4260. Enable rounding, by default is disabled.
  4261. @item hptaps
  4262. Set number of taps for high-pass filter.
  4263. @item lptaps
  4264. Set number of taps for low-pass filter.
  4265. @end table
  4266. @section sine
  4267. Generate an audio signal made of a sine wave with amplitude 1/8.
  4268. The audio signal is bit-exact.
  4269. The filter accepts the following options:
  4270. @table @option
  4271. @item frequency, f
  4272. Set the carrier frequency. Default is 440 Hz.
  4273. @item beep_factor, b
  4274. Enable a periodic beep every second with frequency @var{beep_factor} times
  4275. the carrier frequency. Default is 0, meaning the beep is disabled.
  4276. @item sample_rate, r
  4277. Specify the sample rate, default is 44100.
  4278. @item duration, d
  4279. Specify the duration of the generated audio stream.
  4280. @item samples_per_frame
  4281. Set the number of samples per output frame.
  4282. The expression can contain the following constants:
  4283. @table @option
  4284. @item n
  4285. The (sequential) number of the output audio frame, starting from 0.
  4286. @item pts
  4287. The PTS (Presentation TimeStamp) of the output audio frame,
  4288. expressed in @var{TB} units.
  4289. @item t
  4290. The PTS of the output audio frame, expressed in seconds.
  4291. @item TB
  4292. The timebase of the output audio frames.
  4293. @end table
  4294. Default is @code{1024}.
  4295. @end table
  4296. @subsection Examples
  4297. @itemize
  4298. @item
  4299. Generate a simple 440 Hz sine wave:
  4300. @example
  4301. sine
  4302. @end example
  4303. @item
  4304. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4305. @example
  4306. sine=220:4:d=5
  4307. sine=f=220:b=4:d=5
  4308. sine=frequency=220:beep_factor=4:duration=5
  4309. @end example
  4310. @item
  4311. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4312. pattern:
  4313. @example
  4314. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4315. @end example
  4316. @end itemize
  4317. @c man end AUDIO SOURCES
  4318. @chapter Audio Sinks
  4319. @c man begin AUDIO SINKS
  4320. Below is a description of the currently available audio sinks.
  4321. @section abuffersink
  4322. Buffer audio frames, and make them available to the end of filter chain.
  4323. This sink is mainly intended for programmatic use, in particular
  4324. through the interface defined in @file{libavfilter/buffersink.h}
  4325. or the options system.
  4326. It accepts a pointer to an AVABufferSinkContext structure, which
  4327. defines the incoming buffers' formats, to be passed as the opaque
  4328. parameter to @code{avfilter_init_filter} for initialization.
  4329. @section anullsink
  4330. Null audio sink; do absolutely nothing with the input audio. It is
  4331. mainly useful as a template and for use in analysis / debugging
  4332. tools.
  4333. @c man end AUDIO SINKS
  4334. @chapter Video Filters
  4335. @c man begin VIDEO FILTERS
  4336. When you configure your FFmpeg build, you can disable any of the
  4337. existing filters using @code{--disable-filters}.
  4338. The configure output will show the video filters included in your
  4339. build.
  4340. Below is a description of the currently available video filters.
  4341. @section alphaextract
  4342. Extract the alpha component from the input as a grayscale video. This
  4343. is especially useful with the @var{alphamerge} filter.
  4344. @section alphamerge
  4345. Add or replace the alpha component of the primary input with the
  4346. grayscale value of a second input. This is intended for use with
  4347. @var{alphaextract} to allow the transmission or storage of frame
  4348. sequences that have alpha in a format that doesn't support an alpha
  4349. channel.
  4350. For example, to reconstruct full frames from a normal YUV-encoded video
  4351. and a separate video created with @var{alphaextract}, you might use:
  4352. @example
  4353. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4354. @end example
  4355. Since this filter is designed for reconstruction, it operates on frame
  4356. sequences without considering timestamps, and terminates when either
  4357. input reaches end of stream. This will cause problems if your encoding
  4358. pipeline drops frames. If you're trying to apply an image as an
  4359. overlay to a video stream, consider the @var{overlay} filter instead.
  4360. @section amplify
  4361. Amplify differences between current pixel and pixels of adjacent frames in
  4362. same pixel location.
  4363. This filter accepts the following options:
  4364. @table @option
  4365. @item radius
  4366. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4367. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4368. @item factor
  4369. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4370. @item threshold
  4371. Set threshold for difference amplification. Any difference greater or equal to
  4372. this value will not alter source pixel. Default is 10.
  4373. Allowed range is from 0 to 65535.
  4374. @item tolerance
  4375. Set tolerance for difference amplification. Any difference lower to
  4376. this value will not alter source pixel. Default is 0.
  4377. Allowed range is from 0 to 65535.
  4378. @item low
  4379. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4380. This option controls maximum possible value that will decrease source pixel value.
  4381. @item high
  4382. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4383. This option controls maximum possible value that will increase source pixel value.
  4384. @item planes
  4385. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4386. @end table
  4387. @section ass
  4388. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4389. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4390. Substation Alpha) subtitles files.
  4391. This filter accepts the following option in addition to the common options from
  4392. the @ref{subtitles} filter:
  4393. @table @option
  4394. @item shaping
  4395. Set the shaping engine
  4396. Available values are:
  4397. @table @samp
  4398. @item auto
  4399. The default libass shaping engine, which is the best available.
  4400. @item simple
  4401. Fast, font-agnostic shaper that can do only substitutions
  4402. @item complex
  4403. Slower shaper using OpenType for substitutions and positioning
  4404. @end table
  4405. The default is @code{auto}.
  4406. @end table
  4407. @section atadenoise
  4408. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4409. The filter accepts the following options:
  4410. @table @option
  4411. @item 0a
  4412. Set threshold A for 1st plane. Default is 0.02.
  4413. Valid range is 0 to 0.3.
  4414. @item 0b
  4415. Set threshold B for 1st plane. Default is 0.04.
  4416. Valid range is 0 to 5.
  4417. @item 1a
  4418. Set threshold A for 2nd plane. Default is 0.02.
  4419. Valid range is 0 to 0.3.
  4420. @item 1b
  4421. Set threshold B for 2nd plane. Default is 0.04.
  4422. Valid range is 0 to 5.
  4423. @item 2a
  4424. Set threshold A for 3rd plane. Default is 0.02.
  4425. Valid range is 0 to 0.3.
  4426. @item 2b
  4427. Set threshold B for 3rd plane. Default is 0.04.
  4428. Valid range is 0 to 5.
  4429. Threshold A is designed to react on abrupt changes in the input signal and
  4430. threshold B is designed to react on continuous changes in the input signal.
  4431. @item s
  4432. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4433. number in range [5, 129].
  4434. @item p
  4435. Set what planes of frame filter will use for averaging. Default is all.
  4436. @end table
  4437. @section avgblur
  4438. Apply average blur filter.
  4439. The filter accepts the following options:
  4440. @table @option
  4441. @item sizeX
  4442. Set horizontal radius size.
  4443. @item planes
  4444. Set which planes to filter. By default all planes are filtered.
  4445. @item sizeY
  4446. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4447. Default is @code{0}.
  4448. @end table
  4449. @section bbox
  4450. Compute the bounding box for the non-black pixels in the input frame
  4451. luminance plane.
  4452. This filter computes the bounding box containing all the pixels with a
  4453. luminance value greater than the minimum allowed value.
  4454. The parameters describing the bounding box are printed on the filter
  4455. log.
  4456. The filter accepts the following option:
  4457. @table @option
  4458. @item min_val
  4459. Set the minimal luminance value. Default is @code{16}.
  4460. @end table
  4461. @section bitplanenoise
  4462. Show and measure bit plane noise.
  4463. The filter accepts the following options:
  4464. @table @option
  4465. @item bitplane
  4466. Set which plane to analyze. Default is @code{1}.
  4467. @item filter
  4468. Filter out noisy pixels from @code{bitplane} set above.
  4469. Default is disabled.
  4470. @end table
  4471. @section blackdetect
  4472. Detect video intervals that are (almost) completely black. Can be
  4473. useful to detect chapter transitions, commercials, or invalid
  4474. recordings. Output lines contains the time for the start, end and
  4475. duration of the detected black interval expressed in seconds.
  4476. In order to display the output lines, you need to set the loglevel at
  4477. least to the AV_LOG_INFO value.
  4478. The filter accepts the following options:
  4479. @table @option
  4480. @item black_min_duration, d
  4481. Set the minimum detected black duration expressed in seconds. It must
  4482. be a non-negative floating point number.
  4483. Default value is 2.0.
  4484. @item picture_black_ratio_th, pic_th
  4485. Set the threshold for considering a picture "black".
  4486. Express the minimum value for the ratio:
  4487. @example
  4488. @var{nb_black_pixels} / @var{nb_pixels}
  4489. @end example
  4490. for which a picture is considered black.
  4491. Default value is 0.98.
  4492. @item pixel_black_th, pix_th
  4493. Set the threshold for considering a pixel "black".
  4494. The threshold expresses the maximum pixel luminance value for which a
  4495. pixel is considered "black". The provided value is scaled according to
  4496. the following equation:
  4497. @example
  4498. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4499. @end example
  4500. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4501. the input video format, the range is [0-255] for YUV full-range
  4502. formats and [16-235] for YUV non full-range formats.
  4503. Default value is 0.10.
  4504. @end table
  4505. The following example sets the maximum pixel threshold to the minimum
  4506. value, and detects only black intervals of 2 or more seconds:
  4507. @example
  4508. blackdetect=d=2:pix_th=0.00
  4509. @end example
  4510. @section blackframe
  4511. Detect frames that are (almost) completely black. Can be useful to
  4512. detect chapter transitions or commercials. Output lines consist of
  4513. the frame number of the detected frame, the percentage of blackness,
  4514. the position in the file if known or -1 and the timestamp in seconds.
  4515. In order to display the output lines, you need to set the loglevel at
  4516. least to the AV_LOG_INFO value.
  4517. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4518. The value represents the percentage of pixels in the picture that
  4519. are below the threshold value.
  4520. It accepts the following parameters:
  4521. @table @option
  4522. @item amount
  4523. The percentage of the pixels that have to be below the threshold; it defaults to
  4524. @code{98}.
  4525. @item threshold, thresh
  4526. The threshold below which a pixel value is considered black; it defaults to
  4527. @code{32}.
  4528. @end table
  4529. @section blend, tblend
  4530. Blend two video frames into each other.
  4531. The @code{blend} filter takes two input streams and outputs one
  4532. stream, the first input is the "top" layer and second input is
  4533. "bottom" layer. By default, the output terminates when the longest input terminates.
  4534. The @code{tblend} (time blend) filter takes two consecutive frames
  4535. from one single stream, and outputs the result obtained by blending
  4536. the new frame on top of the old frame.
  4537. A description of the accepted options follows.
  4538. @table @option
  4539. @item c0_mode
  4540. @item c1_mode
  4541. @item c2_mode
  4542. @item c3_mode
  4543. @item all_mode
  4544. Set blend mode for specific pixel component or all pixel components in case
  4545. of @var{all_mode}. Default value is @code{normal}.
  4546. Available values for component modes are:
  4547. @table @samp
  4548. @item addition
  4549. @item grainmerge
  4550. @item and
  4551. @item average
  4552. @item burn
  4553. @item darken
  4554. @item difference
  4555. @item grainextract
  4556. @item divide
  4557. @item dodge
  4558. @item freeze
  4559. @item exclusion
  4560. @item extremity
  4561. @item glow
  4562. @item hardlight
  4563. @item hardmix
  4564. @item heat
  4565. @item lighten
  4566. @item linearlight
  4567. @item multiply
  4568. @item multiply128
  4569. @item negation
  4570. @item normal
  4571. @item or
  4572. @item overlay
  4573. @item phoenix
  4574. @item pinlight
  4575. @item reflect
  4576. @item screen
  4577. @item softlight
  4578. @item subtract
  4579. @item vividlight
  4580. @item xor
  4581. @end table
  4582. @item c0_opacity
  4583. @item c1_opacity
  4584. @item c2_opacity
  4585. @item c3_opacity
  4586. @item all_opacity
  4587. Set blend opacity for specific pixel component or all pixel components in case
  4588. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4589. @item c0_expr
  4590. @item c1_expr
  4591. @item c2_expr
  4592. @item c3_expr
  4593. @item all_expr
  4594. Set blend expression for specific pixel component or all pixel components in case
  4595. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4596. The expressions can use the following variables:
  4597. @table @option
  4598. @item N
  4599. The sequential number of the filtered frame, starting from @code{0}.
  4600. @item X
  4601. @item Y
  4602. the coordinates of the current sample
  4603. @item W
  4604. @item H
  4605. the width and height of currently filtered plane
  4606. @item SW
  4607. @item SH
  4608. Width and height scale for the plane being filtered. It is the
  4609. ratio between the dimensions of the current plane to the luma plane,
  4610. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4611. the luma plane and @code{0.5,0.5} for the chroma planes.
  4612. @item T
  4613. Time of the current frame, expressed in seconds.
  4614. @item TOP, A
  4615. Value of pixel component at current location for first video frame (top layer).
  4616. @item BOTTOM, B
  4617. Value of pixel component at current location for second video frame (bottom layer).
  4618. @end table
  4619. @end table
  4620. The @code{blend} filter also supports the @ref{framesync} options.
  4621. @subsection Examples
  4622. @itemize
  4623. @item
  4624. Apply transition from bottom layer to top layer in first 10 seconds:
  4625. @example
  4626. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4627. @end example
  4628. @item
  4629. Apply linear horizontal transition from top layer to bottom layer:
  4630. @example
  4631. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4632. @end example
  4633. @item
  4634. Apply 1x1 checkerboard effect:
  4635. @example
  4636. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4637. @end example
  4638. @item
  4639. Apply uncover left effect:
  4640. @example
  4641. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4642. @end example
  4643. @item
  4644. Apply uncover down effect:
  4645. @example
  4646. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4647. @end example
  4648. @item
  4649. Apply uncover up-left effect:
  4650. @example
  4651. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4652. @end example
  4653. @item
  4654. Split diagonally video and shows top and bottom layer on each side:
  4655. @example
  4656. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4657. @end example
  4658. @item
  4659. Display differences between the current and the previous frame:
  4660. @example
  4661. tblend=all_mode=grainextract
  4662. @end example
  4663. @end itemize
  4664. @section bm3d
  4665. Denoise frames using Block-Matching 3D algorithm.
  4666. The filter accepts the following options.
  4667. @table @option
  4668. @item sigma
  4669. Set denoising strength. Default value is 1.
  4670. Allowed range is from 0 to 999.9.
  4671. The denoising algorithm is very sensitive to sigma, so adjust it
  4672. according to the source.
  4673. @item block
  4674. Set local patch size. This sets dimensions in 2D.
  4675. @item bstep
  4676. Set sliding step for processing blocks. Default value is 4.
  4677. Allowed range is from 1 to 64.
  4678. Smaller values allows processing more reference blocks and is slower.
  4679. @item group
  4680. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  4681. When set to 1, no block matching is done. Larger values allows more blocks
  4682. in single group.
  4683. Allowed range is from 1 to 256.
  4684. @item range
  4685. Set radius for search block matching. Default is 9.
  4686. Allowed range is from 1 to INT32_MAX.
  4687. @item mstep
  4688. Set step between two search locations for block matching. Default is 1.
  4689. Allowed range is from 1 to 64. Smaller is slower.
  4690. @item thmse
  4691. Set threshold of mean square error for block matching. Valid range is 0 to
  4692. INT32_MAX.
  4693. @item hdthr
  4694. Set thresholding parameter for hard thresholding in 3D transformed domain.
  4695. Larger values results in stronger hard-thresholding filtering in frequency
  4696. domain.
  4697. @item estim
  4698. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  4699. Default is @code{basic}.
  4700. @item ref
  4701. If enabled, filter will use 2nd stream for block matching.
  4702. Default is disabled for @code{basic} value of @var{estim} option,
  4703. and always enabled if value of @var{estim} is @code{final}.
  4704. @item planes
  4705. Set planes to filter. Default is all available except alpha.
  4706. @end table
  4707. @subsection Examples
  4708. @itemize
  4709. @item
  4710. Basic filtering with bm3d:
  4711. @example
  4712. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  4713. @end example
  4714. @item
  4715. Same as above, but filtering only luma:
  4716. @example
  4717. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  4718. @end example
  4719. @item
  4720. Same as above, but with both estimation modes:
  4721. @example
  4722. split[a][b],[a]bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic[a],[b][a]bm3d=sigma=3:block=4:bstep=2:group=16:estim=final:ref=1
  4723. @end example
  4724. @item
  4725. Same as above, but prefilter with @ref{nlmeans} filter instead:
  4726. @example
  4727. split[a][b],[a]nlmeans=s=3:r=7:p=3[a],[b][a]bm3d=sigma=3:block=4:bstep=2:group=16:estim=final:ref=1
  4728. @end example
  4729. @end itemize
  4730. @section boxblur
  4731. Apply a boxblur algorithm to the input video.
  4732. It accepts the following parameters:
  4733. @table @option
  4734. @item luma_radius, lr
  4735. @item luma_power, lp
  4736. @item chroma_radius, cr
  4737. @item chroma_power, cp
  4738. @item alpha_radius, ar
  4739. @item alpha_power, ap
  4740. @end table
  4741. A description of the accepted options follows.
  4742. @table @option
  4743. @item luma_radius, lr
  4744. @item chroma_radius, cr
  4745. @item alpha_radius, ar
  4746. Set an expression for the box radius in pixels used for blurring the
  4747. corresponding input plane.
  4748. The radius value must be a non-negative number, and must not be
  4749. greater than the value of the expression @code{min(w,h)/2} for the
  4750. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4751. planes.
  4752. Default value for @option{luma_radius} is "2". If not specified,
  4753. @option{chroma_radius} and @option{alpha_radius} default to the
  4754. corresponding value set for @option{luma_radius}.
  4755. The expressions can contain the following constants:
  4756. @table @option
  4757. @item w
  4758. @item h
  4759. The input width and height in pixels.
  4760. @item cw
  4761. @item ch
  4762. The input chroma image width and height in pixels.
  4763. @item hsub
  4764. @item vsub
  4765. The horizontal and vertical chroma subsample values. For example, for the
  4766. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4767. @end table
  4768. @item luma_power, lp
  4769. @item chroma_power, cp
  4770. @item alpha_power, ap
  4771. Specify how many times the boxblur filter is applied to the
  4772. corresponding plane.
  4773. Default value for @option{luma_power} is 2. If not specified,
  4774. @option{chroma_power} and @option{alpha_power} default to the
  4775. corresponding value set for @option{luma_power}.
  4776. A value of 0 will disable the effect.
  4777. @end table
  4778. @subsection Examples
  4779. @itemize
  4780. @item
  4781. Apply a boxblur filter with the luma, chroma, and alpha radii
  4782. set to 2:
  4783. @example
  4784. boxblur=luma_radius=2:luma_power=1
  4785. boxblur=2:1
  4786. @end example
  4787. @item
  4788. Set the luma radius to 2, and alpha and chroma radius to 0:
  4789. @example
  4790. boxblur=2:1:cr=0:ar=0
  4791. @end example
  4792. @item
  4793. Set the luma and chroma radii to a fraction of the video dimension:
  4794. @example
  4795. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4796. @end example
  4797. @end itemize
  4798. @section bwdif
  4799. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4800. Deinterlacing Filter").
  4801. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4802. interpolation algorithms.
  4803. It accepts the following parameters:
  4804. @table @option
  4805. @item mode
  4806. The interlacing mode to adopt. It accepts one of the following values:
  4807. @table @option
  4808. @item 0, send_frame
  4809. Output one frame for each frame.
  4810. @item 1, send_field
  4811. Output one frame for each field.
  4812. @end table
  4813. The default value is @code{send_field}.
  4814. @item parity
  4815. The picture field parity assumed for the input interlaced video. It accepts one
  4816. of the following values:
  4817. @table @option
  4818. @item 0, tff
  4819. Assume the top field is first.
  4820. @item 1, bff
  4821. Assume the bottom field is first.
  4822. @item -1, auto
  4823. Enable automatic detection of field parity.
  4824. @end table
  4825. The default value is @code{auto}.
  4826. If the interlacing is unknown or the decoder does not export this information,
  4827. top field first will be assumed.
  4828. @item deint
  4829. Specify which frames to deinterlace. Accept one of the following
  4830. values:
  4831. @table @option
  4832. @item 0, all
  4833. Deinterlace all frames.
  4834. @item 1, interlaced
  4835. Only deinterlace frames marked as interlaced.
  4836. @end table
  4837. The default value is @code{all}.
  4838. @end table
  4839. @section chromahold
  4840. Remove all color information for all colors except for certain one.
  4841. The filter accepts the following options:
  4842. @table @option
  4843. @item color
  4844. The color which will not be replaced with neutral chroma.
  4845. @item similarity
  4846. Similarity percentage with the above color.
  4847. 0.01 matches only the exact key color, while 1.0 matches everything.
  4848. @item yuv
  4849. Signals that the color passed is already in YUV instead of RGB.
  4850. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4851. This can be used to pass exact YUV values as hexadecimal numbers.
  4852. @end table
  4853. @section chromakey
  4854. YUV colorspace color/chroma keying.
  4855. The filter accepts the following options:
  4856. @table @option
  4857. @item color
  4858. The color which will be replaced with transparency.
  4859. @item similarity
  4860. Similarity percentage with the key color.
  4861. 0.01 matches only the exact key color, while 1.0 matches everything.
  4862. @item blend
  4863. Blend percentage.
  4864. 0.0 makes pixels either fully transparent, or not transparent at all.
  4865. Higher values result in semi-transparent pixels, with a higher transparency
  4866. the more similar the pixels color is to the key color.
  4867. @item yuv
  4868. Signals that the color passed is already in YUV instead of RGB.
  4869. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4870. This can be used to pass exact YUV values as hexadecimal numbers.
  4871. @end table
  4872. @subsection Examples
  4873. @itemize
  4874. @item
  4875. Make every green pixel in the input image transparent:
  4876. @example
  4877. ffmpeg -i input.png -vf chromakey=green out.png
  4878. @end example
  4879. @item
  4880. Overlay a greenscreen-video on top of a static black background.
  4881. @example
  4882. 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
  4883. @end example
  4884. @end itemize
  4885. @section chromashift
  4886. Shift chroma pixels horizontally and/or vertically.
  4887. The filter accepts the following options:
  4888. @table @option
  4889. @item cbh
  4890. Set amount to shift chroma-blue horizontally.
  4891. @item cbv
  4892. Set amount to shift chroma-blue vertically.
  4893. @item crh
  4894. Set amount to shift chroma-red horizontally.
  4895. @item crv
  4896. Set amount to shift chroma-red vertically.
  4897. @item edge
  4898. Set edge mode, can be @var{smear}, default, or @var{warp}.
  4899. @end table
  4900. @section ciescope
  4901. Display CIE color diagram with pixels overlaid onto it.
  4902. The filter accepts the following options:
  4903. @table @option
  4904. @item system
  4905. Set color system.
  4906. @table @samp
  4907. @item ntsc, 470m
  4908. @item ebu, 470bg
  4909. @item smpte
  4910. @item 240m
  4911. @item apple
  4912. @item widergb
  4913. @item cie1931
  4914. @item rec709, hdtv
  4915. @item uhdtv, rec2020
  4916. @end table
  4917. @item cie
  4918. Set CIE system.
  4919. @table @samp
  4920. @item xyy
  4921. @item ucs
  4922. @item luv
  4923. @end table
  4924. @item gamuts
  4925. Set what gamuts to draw.
  4926. See @code{system} option for available values.
  4927. @item size, s
  4928. Set ciescope size, by default set to 512.
  4929. @item intensity, i
  4930. Set intensity used to map input pixel values to CIE diagram.
  4931. @item contrast
  4932. Set contrast used to draw tongue colors that are out of active color system gamut.
  4933. @item corrgamma
  4934. Correct gamma displayed on scope, by default enabled.
  4935. @item showwhite
  4936. Show white point on CIE diagram, by default disabled.
  4937. @item gamma
  4938. Set input gamma. Used only with XYZ input color space.
  4939. @end table
  4940. @section codecview
  4941. Visualize information exported by some codecs.
  4942. Some codecs can export information through frames using side-data or other
  4943. means. For example, some MPEG based codecs export motion vectors through the
  4944. @var{export_mvs} flag in the codec @option{flags2} option.
  4945. The filter accepts the following option:
  4946. @table @option
  4947. @item mv
  4948. Set motion vectors to visualize.
  4949. Available flags for @var{mv} are:
  4950. @table @samp
  4951. @item pf
  4952. forward predicted MVs of P-frames
  4953. @item bf
  4954. forward predicted MVs of B-frames
  4955. @item bb
  4956. backward predicted MVs of B-frames
  4957. @end table
  4958. @item qp
  4959. Display quantization parameters using the chroma planes.
  4960. @item mv_type, mvt
  4961. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4962. Available flags for @var{mv_type} are:
  4963. @table @samp
  4964. @item fp
  4965. forward predicted MVs
  4966. @item bp
  4967. backward predicted MVs
  4968. @end table
  4969. @item frame_type, ft
  4970. Set frame type to visualize motion vectors of.
  4971. Available flags for @var{frame_type} are:
  4972. @table @samp
  4973. @item if
  4974. intra-coded frames (I-frames)
  4975. @item pf
  4976. predicted frames (P-frames)
  4977. @item bf
  4978. bi-directionally predicted frames (B-frames)
  4979. @end table
  4980. @end table
  4981. @subsection Examples
  4982. @itemize
  4983. @item
  4984. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4985. @example
  4986. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4987. @end example
  4988. @item
  4989. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4990. @example
  4991. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4992. @end example
  4993. @end itemize
  4994. @section colorbalance
  4995. Modify intensity of primary colors (red, green and blue) of input frames.
  4996. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4997. regions for the red-cyan, green-magenta or blue-yellow balance.
  4998. A positive adjustment value shifts the balance towards the primary color, a negative
  4999. value towards the complementary color.
  5000. The filter accepts the following options:
  5001. @table @option
  5002. @item rs
  5003. @item gs
  5004. @item bs
  5005. Adjust red, green and blue shadows (darkest pixels).
  5006. @item rm
  5007. @item gm
  5008. @item bm
  5009. Adjust red, green and blue midtones (medium pixels).
  5010. @item rh
  5011. @item gh
  5012. @item bh
  5013. Adjust red, green and blue highlights (brightest pixels).
  5014. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5015. @end table
  5016. @subsection Examples
  5017. @itemize
  5018. @item
  5019. Add red color cast to shadows:
  5020. @example
  5021. colorbalance=rs=.3
  5022. @end example
  5023. @end itemize
  5024. @section colorkey
  5025. RGB colorspace color keying.
  5026. The filter accepts the following options:
  5027. @table @option
  5028. @item color
  5029. The color which will be replaced with transparency.
  5030. @item similarity
  5031. Similarity percentage with the key color.
  5032. 0.01 matches only the exact key color, while 1.0 matches everything.
  5033. @item blend
  5034. Blend percentage.
  5035. 0.0 makes pixels either fully transparent, or not transparent at all.
  5036. Higher values result in semi-transparent pixels, with a higher transparency
  5037. the more similar the pixels color is to the key color.
  5038. @end table
  5039. @subsection Examples
  5040. @itemize
  5041. @item
  5042. Make every green pixel in the input image transparent:
  5043. @example
  5044. ffmpeg -i input.png -vf colorkey=green out.png
  5045. @end example
  5046. @item
  5047. Overlay a greenscreen-video on top of a static background image.
  5048. @example
  5049. 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
  5050. @end example
  5051. @end itemize
  5052. @section colorlevels
  5053. Adjust video input frames using levels.
  5054. The filter accepts the following options:
  5055. @table @option
  5056. @item rimin
  5057. @item gimin
  5058. @item bimin
  5059. @item aimin
  5060. Adjust red, green, blue and alpha input black point.
  5061. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5062. @item rimax
  5063. @item gimax
  5064. @item bimax
  5065. @item aimax
  5066. Adjust red, green, blue and alpha input white point.
  5067. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5068. Input levels are used to lighten highlights (bright tones), darken shadows
  5069. (dark tones), change the balance of bright and dark tones.
  5070. @item romin
  5071. @item gomin
  5072. @item bomin
  5073. @item aomin
  5074. Adjust red, green, blue and alpha output black point.
  5075. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5076. @item romax
  5077. @item gomax
  5078. @item bomax
  5079. @item aomax
  5080. Adjust red, green, blue and alpha output white point.
  5081. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5082. Output levels allows manual selection of a constrained output level range.
  5083. @end table
  5084. @subsection Examples
  5085. @itemize
  5086. @item
  5087. Make video output darker:
  5088. @example
  5089. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5090. @end example
  5091. @item
  5092. Increase contrast:
  5093. @example
  5094. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5095. @end example
  5096. @item
  5097. Make video output lighter:
  5098. @example
  5099. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5100. @end example
  5101. @item
  5102. Increase brightness:
  5103. @example
  5104. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5105. @end example
  5106. @end itemize
  5107. @section colorchannelmixer
  5108. Adjust video input frames by re-mixing color channels.
  5109. This filter modifies a color channel by adding the values associated to
  5110. the other channels of the same pixels. For example if the value to
  5111. modify is red, the output value will be:
  5112. @example
  5113. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5114. @end example
  5115. The filter accepts the following options:
  5116. @table @option
  5117. @item rr
  5118. @item rg
  5119. @item rb
  5120. @item ra
  5121. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5122. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5123. @item gr
  5124. @item gg
  5125. @item gb
  5126. @item ga
  5127. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5128. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5129. @item br
  5130. @item bg
  5131. @item bb
  5132. @item ba
  5133. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5134. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5135. @item ar
  5136. @item ag
  5137. @item ab
  5138. @item aa
  5139. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5140. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5141. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5142. @end table
  5143. @subsection Examples
  5144. @itemize
  5145. @item
  5146. Convert source to grayscale:
  5147. @example
  5148. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5149. @end example
  5150. @item
  5151. Simulate sepia tones:
  5152. @example
  5153. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5154. @end example
  5155. @end itemize
  5156. @section colormatrix
  5157. Convert color matrix.
  5158. The filter accepts the following options:
  5159. @table @option
  5160. @item src
  5161. @item dst
  5162. Specify the source and destination color matrix. Both values must be
  5163. specified.
  5164. The accepted values are:
  5165. @table @samp
  5166. @item bt709
  5167. BT.709
  5168. @item fcc
  5169. FCC
  5170. @item bt601
  5171. BT.601
  5172. @item bt470
  5173. BT.470
  5174. @item bt470bg
  5175. BT.470BG
  5176. @item smpte170m
  5177. SMPTE-170M
  5178. @item smpte240m
  5179. SMPTE-240M
  5180. @item bt2020
  5181. BT.2020
  5182. @end table
  5183. @end table
  5184. For example to convert from BT.601 to SMPTE-240M, use the command:
  5185. @example
  5186. colormatrix=bt601:smpte240m
  5187. @end example
  5188. @section colorspace
  5189. Convert colorspace, transfer characteristics or color primaries.
  5190. Input video needs to have an even size.
  5191. The filter accepts the following options:
  5192. @table @option
  5193. @anchor{all}
  5194. @item all
  5195. Specify all color properties at once.
  5196. The accepted values are:
  5197. @table @samp
  5198. @item bt470m
  5199. BT.470M
  5200. @item bt470bg
  5201. BT.470BG
  5202. @item bt601-6-525
  5203. BT.601-6 525
  5204. @item bt601-6-625
  5205. BT.601-6 625
  5206. @item bt709
  5207. BT.709
  5208. @item smpte170m
  5209. SMPTE-170M
  5210. @item smpte240m
  5211. SMPTE-240M
  5212. @item bt2020
  5213. BT.2020
  5214. @end table
  5215. @anchor{space}
  5216. @item space
  5217. Specify output colorspace.
  5218. The accepted values are:
  5219. @table @samp
  5220. @item bt709
  5221. BT.709
  5222. @item fcc
  5223. FCC
  5224. @item bt470bg
  5225. BT.470BG or BT.601-6 625
  5226. @item smpte170m
  5227. SMPTE-170M or BT.601-6 525
  5228. @item smpte240m
  5229. SMPTE-240M
  5230. @item ycgco
  5231. YCgCo
  5232. @item bt2020ncl
  5233. BT.2020 with non-constant luminance
  5234. @end table
  5235. @anchor{trc}
  5236. @item trc
  5237. Specify output transfer characteristics.
  5238. The accepted values are:
  5239. @table @samp
  5240. @item bt709
  5241. BT.709
  5242. @item bt470m
  5243. BT.470M
  5244. @item bt470bg
  5245. BT.470BG
  5246. @item gamma22
  5247. Constant gamma of 2.2
  5248. @item gamma28
  5249. Constant gamma of 2.8
  5250. @item smpte170m
  5251. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5252. @item smpte240m
  5253. SMPTE-240M
  5254. @item srgb
  5255. SRGB
  5256. @item iec61966-2-1
  5257. iec61966-2-1
  5258. @item iec61966-2-4
  5259. iec61966-2-4
  5260. @item xvycc
  5261. xvycc
  5262. @item bt2020-10
  5263. BT.2020 for 10-bits content
  5264. @item bt2020-12
  5265. BT.2020 for 12-bits content
  5266. @end table
  5267. @anchor{primaries}
  5268. @item primaries
  5269. Specify output color primaries.
  5270. The accepted values are:
  5271. @table @samp
  5272. @item bt709
  5273. BT.709
  5274. @item bt470m
  5275. BT.470M
  5276. @item bt470bg
  5277. BT.470BG or BT.601-6 625
  5278. @item smpte170m
  5279. SMPTE-170M or BT.601-6 525
  5280. @item smpte240m
  5281. SMPTE-240M
  5282. @item film
  5283. film
  5284. @item smpte431
  5285. SMPTE-431
  5286. @item smpte432
  5287. SMPTE-432
  5288. @item bt2020
  5289. BT.2020
  5290. @item jedec-p22
  5291. JEDEC P22 phosphors
  5292. @end table
  5293. @anchor{range}
  5294. @item range
  5295. Specify output color range.
  5296. The accepted values are:
  5297. @table @samp
  5298. @item tv
  5299. TV (restricted) range
  5300. @item mpeg
  5301. MPEG (restricted) range
  5302. @item pc
  5303. PC (full) range
  5304. @item jpeg
  5305. JPEG (full) range
  5306. @end table
  5307. @item format
  5308. Specify output color format.
  5309. The accepted values are:
  5310. @table @samp
  5311. @item yuv420p
  5312. YUV 4:2:0 planar 8-bits
  5313. @item yuv420p10
  5314. YUV 4:2:0 planar 10-bits
  5315. @item yuv420p12
  5316. YUV 4:2:0 planar 12-bits
  5317. @item yuv422p
  5318. YUV 4:2:2 planar 8-bits
  5319. @item yuv422p10
  5320. YUV 4:2:2 planar 10-bits
  5321. @item yuv422p12
  5322. YUV 4:2:2 planar 12-bits
  5323. @item yuv444p
  5324. YUV 4:4:4 planar 8-bits
  5325. @item yuv444p10
  5326. YUV 4:4:4 planar 10-bits
  5327. @item yuv444p12
  5328. YUV 4:4:4 planar 12-bits
  5329. @end table
  5330. @item fast
  5331. Do a fast conversion, which skips gamma/primary correction. This will take
  5332. significantly less CPU, but will be mathematically incorrect. To get output
  5333. compatible with that produced by the colormatrix filter, use fast=1.
  5334. @item dither
  5335. Specify dithering mode.
  5336. The accepted values are:
  5337. @table @samp
  5338. @item none
  5339. No dithering
  5340. @item fsb
  5341. Floyd-Steinberg dithering
  5342. @end table
  5343. @item wpadapt
  5344. Whitepoint adaptation mode.
  5345. The accepted values are:
  5346. @table @samp
  5347. @item bradford
  5348. Bradford whitepoint adaptation
  5349. @item vonkries
  5350. von Kries whitepoint adaptation
  5351. @item identity
  5352. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5353. @end table
  5354. @item iall
  5355. Override all input properties at once. Same accepted values as @ref{all}.
  5356. @item ispace
  5357. Override input colorspace. Same accepted values as @ref{space}.
  5358. @item iprimaries
  5359. Override input color primaries. Same accepted values as @ref{primaries}.
  5360. @item itrc
  5361. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5362. @item irange
  5363. Override input color range. Same accepted values as @ref{range}.
  5364. @end table
  5365. The filter converts the transfer characteristics, color space and color
  5366. primaries to the specified user values. The output value, if not specified,
  5367. is set to a default value based on the "all" property. If that property is
  5368. also not specified, the filter will log an error. The output color range and
  5369. format default to the same value as the input color range and format. The
  5370. input transfer characteristics, color space, color primaries and color range
  5371. should be set on the input data. If any of these are missing, the filter will
  5372. log an error and no conversion will take place.
  5373. For example to convert the input to SMPTE-240M, use the command:
  5374. @example
  5375. colorspace=smpte240m
  5376. @end example
  5377. @section convolution
  5378. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5379. The filter accepts the following options:
  5380. @table @option
  5381. @item 0m
  5382. @item 1m
  5383. @item 2m
  5384. @item 3m
  5385. Set matrix for each plane.
  5386. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5387. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5388. @item 0rdiv
  5389. @item 1rdiv
  5390. @item 2rdiv
  5391. @item 3rdiv
  5392. Set multiplier for calculated value for each plane.
  5393. If unset or 0, it will be sum of all matrix elements.
  5394. @item 0bias
  5395. @item 1bias
  5396. @item 2bias
  5397. @item 3bias
  5398. Set bias for each plane. This value is added to the result of the multiplication.
  5399. Useful for making the overall image brighter or darker. Default is 0.0.
  5400. @item 0mode
  5401. @item 1mode
  5402. @item 2mode
  5403. @item 3mode
  5404. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5405. Default is @var{square}.
  5406. @end table
  5407. @subsection Examples
  5408. @itemize
  5409. @item
  5410. Apply sharpen:
  5411. @example
  5412. 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"
  5413. @end example
  5414. @item
  5415. Apply blur:
  5416. @example
  5417. 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"
  5418. @end example
  5419. @item
  5420. Apply edge enhance:
  5421. @example
  5422. 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"
  5423. @end example
  5424. @item
  5425. Apply edge detect:
  5426. @example
  5427. 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"
  5428. @end example
  5429. @item
  5430. Apply laplacian edge detector which includes diagonals:
  5431. @example
  5432. 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"
  5433. @end example
  5434. @item
  5435. Apply emboss:
  5436. @example
  5437. 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"
  5438. @end example
  5439. @end itemize
  5440. @section convolve
  5441. Apply 2D convolution of video stream in frequency domain using second stream
  5442. as impulse.
  5443. The filter accepts the following options:
  5444. @table @option
  5445. @item planes
  5446. Set which planes to process.
  5447. @item impulse
  5448. Set which impulse video frames will be processed, can be @var{first}
  5449. or @var{all}. Default is @var{all}.
  5450. @end table
  5451. The @code{convolve} filter also supports the @ref{framesync} options.
  5452. @section copy
  5453. Copy the input video source unchanged to the output. This is mainly useful for
  5454. testing purposes.
  5455. @anchor{coreimage}
  5456. @section coreimage
  5457. Video filtering on GPU using Apple's CoreImage API on OSX.
  5458. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5459. processed by video hardware. However, software-based OpenGL implementations
  5460. exist which means there is no guarantee for hardware processing. It depends on
  5461. the respective OSX.
  5462. There are many filters and image generators provided by Apple that come with a
  5463. large variety of options. The filter has to be referenced by its name along
  5464. with its options.
  5465. The coreimage filter accepts the following options:
  5466. @table @option
  5467. @item list_filters
  5468. List all available filters and generators along with all their respective
  5469. options as well as possible minimum and maximum values along with the default
  5470. values.
  5471. @example
  5472. list_filters=true
  5473. @end example
  5474. @item filter
  5475. Specify all filters by their respective name and options.
  5476. Use @var{list_filters} to determine all valid filter names and options.
  5477. Numerical options are specified by a float value and are automatically clamped
  5478. to their respective value range. Vector and color options have to be specified
  5479. by a list of space separated float values. Character escaping has to be done.
  5480. A special option name @code{default} is available to use default options for a
  5481. filter.
  5482. It is required to specify either @code{default} or at least one of the filter options.
  5483. All omitted options are used with their default values.
  5484. The syntax of the filter string is as follows:
  5485. @example
  5486. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5487. @end example
  5488. @item output_rect
  5489. Specify a rectangle where the output of the filter chain is copied into the
  5490. input image. It is given by a list of space separated float values:
  5491. @example
  5492. output_rect=x\ y\ width\ height
  5493. @end example
  5494. If not given, the output rectangle equals the dimensions of the input image.
  5495. The output rectangle is automatically cropped at the borders of the input
  5496. image. Negative values are valid for each component.
  5497. @example
  5498. output_rect=25\ 25\ 100\ 100
  5499. @end example
  5500. @end table
  5501. Several filters can be chained for successive processing without GPU-HOST
  5502. transfers allowing for fast processing of complex filter chains.
  5503. Currently, only filters with zero (generators) or exactly one (filters) input
  5504. image and one output image are supported. Also, transition filters are not yet
  5505. usable as intended.
  5506. Some filters generate output images with additional padding depending on the
  5507. respective filter kernel. The padding is automatically removed to ensure the
  5508. filter output has the same size as the input image.
  5509. For image generators, the size of the output image is determined by the
  5510. previous output image of the filter chain or the input image of the whole
  5511. filterchain, respectively. The generators do not use the pixel information of
  5512. this image to generate their output. However, the generated output is
  5513. blended onto this image, resulting in partial or complete coverage of the
  5514. output image.
  5515. The @ref{coreimagesrc} video source can be used for generating input images
  5516. which are directly fed into the filter chain. By using it, providing input
  5517. images by another video source or an input video is not required.
  5518. @subsection Examples
  5519. @itemize
  5520. @item
  5521. List all filters available:
  5522. @example
  5523. coreimage=list_filters=true
  5524. @end example
  5525. @item
  5526. Use the CIBoxBlur filter with default options to blur an image:
  5527. @example
  5528. coreimage=filter=CIBoxBlur@@default
  5529. @end example
  5530. @item
  5531. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5532. its center at 100x100 and a radius of 50 pixels:
  5533. @example
  5534. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5535. @end example
  5536. @item
  5537. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5538. given as complete and escaped command-line for Apple's standard bash shell:
  5539. @example
  5540. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5541. @end example
  5542. @end itemize
  5543. @section crop
  5544. Crop the input video to given dimensions.
  5545. It accepts the following parameters:
  5546. @table @option
  5547. @item w, out_w
  5548. The width of the output video. It defaults to @code{iw}.
  5549. This expression is evaluated only once during the filter
  5550. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5551. @item h, out_h
  5552. The height of the output video. It defaults to @code{ih}.
  5553. This expression is evaluated only once during the filter
  5554. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5555. @item x
  5556. The horizontal position, in the input video, of the left edge of the output
  5557. video. It defaults to @code{(in_w-out_w)/2}.
  5558. This expression is evaluated per-frame.
  5559. @item y
  5560. The vertical position, in the input video, of the top edge of the output video.
  5561. It defaults to @code{(in_h-out_h)/2}.
  5562. This expression is evaluated per-frame.
  5563. @item keep_aspect
  5564. If set to 1 will force the output display aspect ratio
  5565. to be the same of the input, by changing the output sample aspect
  5566. ratio. It defaults to 0.
  5567. @item exact
  5568. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5569. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5570. It defaults to 0.
  5571. @end table
  5572. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5573. expressions containing the following constants:
  5574. @table @option
  5575. @item x
  5576. @item y
  5577. The computed values for @var{x} and @var{y}. They are evaluated for
  5578. each new frame.
  5579. @item in_w
  5580. @item in_h
  5581. The input width and height.
  5582. @item iw
  5583. @item ih
  5584. These are the same as @var{in_w} and @var{in_h}.
  5585. @item out_w
  5586. @item out_h
  5587. The output (cropped) width and height.
  5588. @item ow
  5589. @item oh
  5590. These are the same as @var{out_w} and @var{out_h}.
  5591. @item a
  5592. same as @var{iw} / @var{ih}
  5593. @item sar
  5594. input sample aspect ratio
  5595. @item dar
  5596. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5597. @item hsub
  5598. @item vsub
  5599. horizontal and vertical chroma subsample values. For example for the
  5600. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5601. @item n
  5602. The number of the input frame, starting from 0.
  5603. @item pos
  5604. the position in the file of the input frame, NAN if unknown
  5605. @item t
  5606. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5607. @end table
  5608. The expression for @var{out_w} may depend on the value of @var{out_h},
  5609. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5610. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5611. evaluated after @var{out_w} and @var{out_h}.
  5612. The @var{x} and @var{y} parameters specify the expressions for the
  5613. position of the top-left corner of the output (non-cropped) area. They
  5614. are evaluated for each frame. If the evaluated value is not valid, it
  5615. is approximated to the nearest valid value.
  5616. The expression for @var{x} may depend on @var{y}, and the expression
  5617. for @var{y} may depend on @var{x}.
  5618. @subsection Examples
  5619. @itemize
  5620. @item
  5621. Crop area with size 100x100 at position (12,34).
  5622. @example
  5623. crop=100:100:12:34
  5624. @end example
  5625. Using named options, the example above becomes:
  5626. @example
  5627. crop=w=100:h=100:x=12:y=34
  5628. @end example
  5629. @item
  5630. Crop the central input area with size 100x100:
  5631. @example
  5632. crop=100:100
  5633. @end example
  5634. @item
  5635. Crop the central input area with size 2/3 of the input video:
  5636. @example
  5637. crop=2/3*in_w:2/3*in_h
  5638. @end example
  5639. @item
  5640. Crop the input video central square:
  5641. @example
  5642. crop=out_w=in_h
  5643. crop=in_h
  5644. @end example
  5645. @item
  5646. Delimit the rectangle with the top-left corner placed at position
  5647. 100:100 and the right-bottom corner corresponding to the right-bottom
  5648. corner of the input image.
  5649. @example
  5650. crop=in_w-100:in_h-100:100:100
  5651. @end example
  5652. @item
  5653. Crop 10 pixels from the left and right borders, and 20 pixels from
  5654. the top and bottom borders
  5655. @example
  5656. crop=in_w-2*10:in_h-2*20
  5657. @end example
  5658. @item
  5659. Keep only the bottom right quarter of the input image:
  5660. @example
  5661. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5662. @end example
  5663. @item
  5664. Crop height for getting Greek harmony:
  5665. @example
  5666. crop=in_w:1/PHI*in_w
  5667. @end example
  5668. @item
  5669. Apply trembling effect:
  5670. @example
  5671. 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)
  5672. @end example
  5673. @item
  5674. Apply erratic camera effect depending on timestamp:
  5675. @example
  5676. 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)"
  5677. @end example
  5678. @item
  5679. Set x depending on the value of y:
  5680. @example
  5681. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5682. @end example
  5683. @end itemize
  5684. @subsection Commands
  5685. This filter supports the following commands:
  5686. @table @option
  5687. @item w, out_w
  5688. @item h, out_h
  5689. @item x
  5690. @item y
  5691. Set width/height of the output video and the horizontal/vertical position
  5692. in the input video.
  5693. The command accepts the same syntax of the corresponding option.
  5694. If the specified expression is not valid, it is kept at its current
  5695. value.
  5696. @end table
  5697. @section cropdetect
  5698. Auto-detect the crop size.
  5699. It calculates the necessary cropping parameters and prints the
  5700. recommended parameters via the logging system. The detected dimensions
  5701. correspond to the non-black area of the input video.
  5702. It accepts the following parameters:
  5703. @table @option
  5704. @item limit
  5705. Set higher black value threshold, which can be optionally specified
  5706. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5707. value greater to the set value is considered non-black. It defaults to 24.
  5708. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5709. on the bitdepth of the pixel format.
  5710. @item round
  5711. The value which the width/height should be divisible by. It defaults to
  5712. 16. The offset is automatically adjusted to center the video. Use 2 to
  5713. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5714. encoding to most video codecs.
  5715. @item reset_count, reset
  5716. Set the counter that determines after how many frames cropdetect will
  5717. reset the previously detected largest video area and start over to
  5718. detect the current optimal crop area. Default value is 0.
  5719. This can be useful when channel logos distort the video area. 0
  5720. indicates 'never reset', and returns the largest area encountered during
  5721. playback.
  5722. @end table
  5723. @anchor{cue}
  5724. @section cue
  5725. Delay video filtering until a given wallclock timestamp. The filter first
  5726. passes on @option{preroll} amount of frames, then it buffers at most
  5727. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  5728. it forwards the buffered frames and also any subsequent frames coming in its
  5729. input.
  5730. The filter can be used synchronize the output of multiple ffmpeg processes for
  5731. realtime output devices like decklink. By putting the delay in the filtering
  5732. chain and pre-buffering frames the process can pass on data to output almost
  5733. immediately after the target wallclock timestamp is reached.
  5734. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  5735. some use cases.
  5736. @table @option
  5737. @item cue
  5738. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  5739. @item preroll
  5740. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  5741. @item buffer
  5742. The maximum duration of content to buffer before waiting for the cue expressed
  5743. in seconds. Default is 0.
  5744. @end table
  5745. @anchor{curves}
  5746. @section curves
  5747. Apply color adjustments using curves.
  5748. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5749. component (red, green and blue) has its values defined by @var{N} key points
  5750. tied from each other using a smooth curve. The x-axis represents the pixel
  5751. values from the input frame, and the y-axis the new pixel values to be set for
  5752. the output frame.
  5753. By default, a component curve is defined by the two points @var{(0;0)} and
  5754. @var{(1;1)}. This creates a straight line where each original pixel value is
  5755. "adjusted" to its own value, which means no change to the image.
  5756. The filter allows you to redefine these two points and add some more. A new
  5757. curve (using a natural cubic spline interpolation) will be define to pass
  5758. smoothly through all these new coordinates. The new defined points needs to be
  5759. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5760. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5761. the vector spaces, the values will be clipped accordingly.
  5762. The filter accepts the following options:
  5763. @table @option
  5764. @item preset
  5765. Select one of the available color presets. This option can be used in addition
  5766. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5767. options takes priority on the preset values.
  5768. Available presets are:
  5769. @table @samp
  5770. @item none
  5771. @item color_negative
  5772. @item cross_process
  5773. @item darker
  5774. @item increase_contrast
  5775. @item lighter
  5776. @item linear_contrast
  5777. @item medium_contrast
  5778. @item negative
  5779. @item strong_contrast
  5780. @item vintage
  5781. @end table
  5782. Default is @code{none}.
  5783. @item master, m
  5784. Set the master key points. These points will define a second pass mapping. It
  5785. is sometimes called a "luminance" or "value" mapping. It can be used with
  5786. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5787. post-processing LUT.
  5788. @item red, r
  5789. Set the key points for the red component.
  5790. @item green, g
  5791. Set the key points for the green component.
  5792. @item blue, b
  5793. Set the key points for the blue component.
  5794. @item all
  5795. Set the key points for all components (not including master).
  5796. Can be used in addition to the other key points component
  5797. options. In this case, the unset component(s) will fallback on this
  5798. @option{all} setting.
  5799. @item psfile
  5800. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5801. @item plot
  5802. Save Gnuplot script of the curves in specified file.
  5803. @end table
  5804. To avoid some filtergraph syntax conflicts, each key points list need to be
  5805. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5806. @subsection Examples
  5807. @itemize
  5808. @item
  5809. Increase slightly the middle level of blue:
  5810. @example
  5811. curves=blue='0/0 0.5/0.58 1/1'
  5812. @end example
  5813. @item
  5814. Vintage effect:
  5815. @example
  5816. 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'
  5817. @end example
  5818. Here we obtain the following coordinates for each components:
  5819. @table @var
  5820. @item red
  5821. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5822. @item green
  5823. @code{(0;0) (0.50;0.48) (1;1)}
  5824. @item blue
  5825. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5826. @end table
  5827. @item
  5828. The previous example can also be achieved with the associated built-in preset:
  5829. @example
  5830. curves=preset=vintage
  5831. @end example
  5832. @item
  5833. Or simply:
  5834. @example
  5835. curves=vintage
  5836. @end example
  5837. @item
  5838. Use a Photoshop preset and redefine the points of the green component:
  5839. @example
  5840. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5841. @end example
  5842. @item
  5843. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5844. and @command{gnuplot}:
  5845. @example
  5846. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5847. gnuplot -p /tmp/curves.plt
  5848. @end example
  5849. @end itemize
  5850. @section datascope
  5851. Video data analysis filter.
  5852. This filter shows hexadecimal pixel values of part of video.
  5853. The filter accepts the following options:
  5854. @table @option
  5855. @item size, s
  5856. Set output video size.
  5857. @item x
  5858. Set x offset from where to pick pixels.
  5859. @item y
  5860. Set y offset from where to pick pixels.
  5861. @item mode
  5862. Set scope mode, can be one of the following:
  5863. @table @samp
  5864. @item mono
  5865. Draw hexadecimal pixel values with white color on black background.
  5866. @item color
  5867. Draw hexadecimal pixel values with input video pixel color on black
  5868. background.
  5869. @item color2
  5870. Draw hexadecimal pixel values on color background picked from input video,
  5871. the text color is picked in such way so its always visible.
  5872. @end table
  5873. @item axis
  5874. Draw rows and columns numbers on left and top of video.
  5875. @item opacity
  5876. Set background opacity.
  5877. @end table
  5878. @section dctdnoiz
  5879. Denoise frames using 2D DCT (frequency domain filtering).
  5880. This filter is not designed for real time.
  5881. The filter accepts the following options:
  5882. @table @option
  5883. @item sigma, s
  5884. Set the noise sigma constant.
  5885. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5886. coefficient (absolute value) below this threshold with be dropped.
  5887. If you need a more advanced filtering, see @option{expr}.
  5888. Default is @code{0}.
  5889. @item overlap
  5890. Set number overlapping pixels for each block. Since the filter can be slow, you
  5891. may want to reduce this value, at the cost of a less effective filter and the
  5892. risk of various artefacts.
  5893. If the overlapping value doesn't permit processing the whole input width or
  5894. height, a warning will be displayed and according borders won't be denoised.
  5895. Default value is @var{blocksize}-1, which is the best possible setting.
  5896. @item expr, e
  5897. Set the coefficient factor expression.
  5898. For each coefficient of a DCT block, this expression will be evaluated as a
  5899. multiplier value for the coefficient.
  5900. If this is option is set, the @option{sigma} option will be ignored.
  5901. The absolute value of the coefficient can be accessed through the @var{c}
  5902. variable.
  5903. @item n
  5904. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5905. @var{blocksize}, which is the width and height of the processed blocks.
  5906. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5907. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5908. on the speed processing. Also, a larger block size does not necessarily means a
  5909. better de-noising.
  5910. @end table
  5911. @subsection Examples
  5912. Apply a denoise with a @option{sigma} of @code{4.5}:
  5913. @example
  5914. dctdnoiz=4.5
  5915. @end example
  5916. The same operation can be achieved using the expression system:
  5917. @example
  5918. dctdnoiz=e='gte(c, 4.5*3)'
  5919. @end example
  5920. Violent denoise using a block size of @code{16x16}:
  5921. @example
  5922. dctdnoiz=15:n=4
  5923. @end example
  5924. @section deband
  5925. Remove banding artifacts from input video.
  5926. It works by replacing banded pixels with average value of referenced pixels.
  5927. The filter accepts the following options:
  5928. @table @option
  5929. @item 1thr
  5930. @item 2thr
  5931. @item 3thr
  5932. @item 4thr
  5933. Set banding detection threshold for each plane. Default is 0.02.
  5934. Valid range is 0.00003 to 0.5.
  5935. If difference between current pixel and reference pixel is less than threshold,
  5936. it will be considered as banded.
  5937. @item range, r
  5938. Banding detection range in pixels. Default is 16. If positive, random number
  5939. in range 0 to set value will be used. If negative, exact absolute value
  5940. will be used.
  5941. The range defines square of four pixels around current pixel.
  5942. @item direction, d
  5943. Set direction in radians from which four pixel will be compared. If positive,
  5944. random direction from 0 to set direction will be picked. If negative, exact of
  5945. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5946. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5947. column.
  5948. @item blur, b
  5949. If enabled, current pixel is compared with average value of all four
  5950. surrounding pixels. The default is enabled. If disabled current pixel is
  5951. compared with all four surrounding pixels. The pixel is considered banded
  5952. if only all four differences with surrounding pixels are less than threshold.
  5953. @item coupling, c
  5954. If enabled, current pixel is changed if and only if all pixel components are banded,
  5955. e.g. banding detection threshold is triggered for all color components.
  5956. The default is disabled.
  5957. @end table
  5958. @section deblock
  5959. Remove blocking artifacts from input video.
  5960. The filter accepts the following options:
  5961. @table @option
  5962. @item filter
  5963. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  5964. This controls what kind of deblocking is applied.
  5965. @item block
  5966. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  5967. @item alpha
  5968. @item beta
  5969. @item gamma
  5970. @item delta
  5971. Set blocking detection thresholds. Allowed range is 0 to 1.
  5972. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  5973. Using higher threshold gives more deblocking strength.
  5974. Setting @var{alpha} controls threshold detection at exact edge of block.
  5975. Remaining options controls threshold detection near the edge. Each one for
  5976. below/above or left/right. Setting any of those to @var{0} disables
  5977. deblocking.
  5978. @item planes
  5979. Set planes to filter. Default is to filter all available planes.
  5980. @end table
  5981. @subsection Examples
  5982. @itemize
  5983. @item
  5984. Deblock using weak filter and block size of 4 pixels.
  5985. @example
  5986. deblock=filter=weak:block=4
  5987. @end example
  5988. @item
  5989. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  5990. deblocking more edges.
  5991. @example
  5992. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  5993. @end example
  5994. @item
  5995. Similar as above, but filter only first plane.
  5996. @example
  5997. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  5998. @end example
  5999. @item
  6000. Similar as above, but filter only second and third plane.
  6001. @example
  6002. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6003. @end example
  6004. @end itemize
  6005. @anchor{decimate}
  6006. @section decimate
  6007. Drop duplicated frames at regular intervals.
  6008. The filter accepts the following options:
  6009. @table @option
  6010. @item cycle
  6011. Set the number of frames from which one will be dropped. Setting this to
  6012. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6013. Default is @code{5}.
  6014. @item dupthresh
  6015. Set the threshold for duplicate detection. If the difference metric for a frame
  6016. is less than or equal to this value, then it is declared as duplicate. Default
  6017. is @code{1.1}
  6018. @item scthresh
  6019. Set scene change threshold. Default is @code{15}.
  6020. @item blockx
  6021. @item blocky
  6022. Set the size of the x and y-axis blocks used during metric calculations.
  6023. Larger blocks give better noise suppression, but also give worse detection of
  6024. small movements. Must be a power of two. Default is @code{32}.
  6025. @item ppsrc
  6026. Mark main input as a pre-processed input and activate clean source input
  6027. stream. This allows the input to be pre-processed with various filters to help
  6028. the metrics calculation while keeping the frame selection lossless. When set to
  6029. @code{1}, the first stream is for the pre-processed input, and the second
  6030. stream is the clean source from where the kept frames are chosen. Default is
  6031. @code{0}.
  6032. @item chroma
  6033. Set whether or not chroma is considered in the metric calculations. Default is
  6034. @code{1}.
  6035. @end table
  6036. @section deconvolve
  6037. Apply 2D deconvolution of video stream in frequency domain using second stream
  6038. as impulse.
  6039. The filter accepts the following options:
  6040. @table @option
  6041. @item planes
  6042. Set which planes to process.
  6043. @item impulse
  6044. Set which impulse video frames will be processed, can be @var{first}
  6045. or @var{all}. Default is @var{all}.
  6046. @item noise
  6047. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6048. and height are not same and not power of 2 or if stream prior to convolving
  6049. had noise.
  6050. @end table
  6051. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6052. @section dedot
  6053. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6054. It accepts the following options:
  6055. @table @option
  6056. @item m
  6057. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6058. @var{rainbows} for cross-color reduction.
  6059. @item lt
  6060. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6061. @item tl
  6062. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6063. @item tc
  6064. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6065. @item ct
  6066. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6067. @end table
  6068. @section deflate
  6069. Apply deflate effect to the video.
  6070. This filter replaces the pixel by the local(3x3) average by taking into account
  6071. only values lower than the pixel.
  6072. It accepts the following options:
  6073. @table @option
  6074. @item threshold0
  6075. @item threshold1
  6076. @item threshold2
  6077. @item threshold3
  6078. Limit the maximum change for each plane, default is 65535.
  6079. If 0, plane will remain unchanged.
  6080. @end table
  6081. @section deflicker
  6082. Remove temporal frame luminance variations.
  6083. It accepts the following options:
  6084. @table @option
  6085. @item size, s
  6086. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6087. @item mode, m
  6088. Set averaging mode to smooth temporal luminance variations.
  6089. Available values are:
  6090. @table @samp
  6091. @item am
  6092. Arithmetic mean
  6093. @item gm
  6094. Geometric mean
  6095. @item hm
  6096. Harmonic mean
  6097. @item qm
  6098. Quadratic mean
  6099. @item cm
  6100. Cubic mean
  6101. @item pm
  6102. Power mean
  6103. @item median
  6104. Median
  6105. @end table
  6106. @item bypass
  6107. Do not actually modify frame. Useful when one only wants metadata.
  6108. @end table
  6109. @section dejudder
  6110. Remove judder produced by partially interlaced telecined content.
  6111. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6112. source was partially telecined content then the output of @code{pullup,dejudder}
  6113. will have a variable frame rate. May change the recorded frame rate of the
  6114. container. Aside from that change, this filter will not affect constant frame
  6115. rate video.
  6116. The option available in this filter is:
  6117. @table @option
  6118. @item cycle
  6119. Specify the length of the window over which the judder repeats.
  6120. Accepts any integer greater than 1. Useful values are:
  6121. @table @samp
  6122. @item 4
  6123. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6124. @item 5
  6125. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6126. @item 20
  6127. If a mixture of the two.
  6128. @end table
  6129. The default is @samp{4}.
  6130. @end table
  6131. @section delogo
  6132. Suppress a TV station logo by a simple interpolation of the surrounding
  6133. pixels. Just set a rectangle covering the logo and watch it disappear
  6134. (and sometimes something even uglier appear - your mileage may vary).
  6135. It accepts the following parameters:
  6136. @table @option
  6137. @item x
  6138. @item y
  6139. Specify the top left corner coordinates of the logo. They must be
  6140. specified.
  6141. @item w
  6142. @item h
  6143. Specify the width and height of the logo to clear. They must be
  6144. specified.
  6145. @item band, t
  6146. Specify the thickness of the fuzzy edge of the rectangle (added to
  6147. @var{w} and @var{h}). The default value is 1. This option is
  6148. deprecated, setting higher values should no longer be necessary and
  6149. is not recommended.
  6150. @item show
  6151. When set to 1, a green rectangle is drawn on the screen to simplify
  6152. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6153. The default value is 0.
  6154. The rectangle is drawn on the outermost pixels which will be (partly)
  6155. replaced with interpolated values. The values of the next pixels
  6156. immediately outside this rectangle in each direction will be used to
  6157. compute the interpolated pixel values inside the rectangle.
  6158. @end table
  6159. @subsection Examples
  6160. @itemize
  6161. @item
  6162. Set a rectangle covering the area with top left corner coordinates 0,0
  6163. and size 100x77, and a band of size 10:
  6164. @example
  6165. delogo=x=0:y=0:w=100:h=77:band=10
  6166. @end example
  6167. @end itemize
  6168. @section deshake
  6169. Attempt to fix small changes in horizontal and/or vertical shift. This
  6170. filter helps remove camera shake from hand-holding a camera, bumping a
  6171. tripod, moving on a vehicle, etc.
  6172. The filter accepts the following options:
  6173. @table @option
  6174. @item x
  6175. @item y
  6176. @item w
  6177. @item h
  6178. Specify a rectangular area where to limit the search for motion
  6179. vectors.
  6180. If desired the search for motion vectors can be limited to a
  6181. rectangular area of the frame defined by its top left corner, width
  6182. and height. These parameters have the same meaning as the drawbox
  6183. filter which can be used to visualise the position of the bounding
  6184. box.
  6185. This is useful when simultaneous movement of subjects within the frame
  6186. might be confused for camera motion by the motion vector search.
  6187. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6188. then the full frame is used. This allows later options to be set
  6189. without specifying the bounding box for the motion vector search.
  6190. Default - search the whole frame.
  6191. @item rx
  6192. @item ry
  6193. Specify the maximum extent of movement in x and y directions in the
  6194. range 0-64 pixels. Default 16.
  6195. @item edge
  6196. Specify how to generate pixels to fill blanks at the edge of the
  6197. frame. Available values are:
  6198. @table @samp
  6199. @item blank, 0
  6200. Fill zeroes at blank locations
  6201. @item original, 1
  6202. Original image at blank locations
  6203. @item clamp, 2
  6204. Extruded edge value at blank locations
  6205. @item mirror, 3
  6206. Mirrored edge at blank locations
  6207. @end table
  6208. Default value is @samp{mirror}.
  6209. @item blocksize
  6210. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6211. default 8.
  6212. @item contrast
  6213. Specify the contrast threshold for blocks. Only blocks with more than
  6214. the specified contrast (difference between darkest and lightest
  6215. pixels) will be considered. Range 1-255, default 125.
  6216. @item search
  6217. Specify the search strategy. Available values are:
  6218. @table @samp
  6219. @item exhaustive, 0
  6220. Set exhaustive search
  6221. @item less, 1
  6222. Set less exhaustive search.
  6223. @end table
  6224. Default value is @samp{exhaustive}.
  6225. @item filename
  6226. If set then a detailed log of the motion search is written to the
  6227. specified file.
  6228. @end table
  6229. @section despill
  6230. Remove unwanted contamination of foreground colors, caused by reflected color of
  6231. greenscreen or bluescreen.
  6232. This filter accepts the following options:
  6233. @table @option
  6234. @item type
  6235. Set what type of despill to use.
  6236. @item mix
  6237. Set how spillmap will be generated.
  6238. @item expand
  6239. Set how much to get rid of still remaining spill.
  6240. @item red
  6241. Controls amount of red in spill area.
  6242. @item green
  6243. Controls amount of green in spill area.
  6244. Should be -1 for greenscreen.
  6245. @item blue
  6246. Controls amount of blue in spill area.
  6247. Should be -1 for bluescreen.
  6248. @item brightness
  6249. Controls brightness of spill area, preserving colors.
  6250. @item alpha
  6251. Modify alpha from generated spillmap.
  6252. @end table
  6253. @section detelecine
  6254. Apply an exact inverse of the telecine operation. It requires a predefined
  6255. pattern specified using the pattern option which must be the same as that passed
  6256. to the telecine filter.
  6257. This filter accepts the following options:
  6258. @table @option
  6259. @item first_field
  6260. @table @samp
  6261. @item top, t
  6262. top field first
  6263. @item bottom, b
  6264. bottom field first
  6265. The default value is @code{top}.
  6266. @end table
  6267. @item pattern
  6268. A string of numbers representing the pulldown pattern you wish to apply.
  6269. The default value is @code{23}.
  6270. @item start_frame
  6271. A number representing position of the first frame with respect to the telecine
  6272. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6273. @end table
  6274. @section dilation
  6275. Apply dilation effect to the video.
  6276. This filter replaces the pixel by the local(3x3) maximum.
  6277. It accepts the following options:
  6278. @table @option
  6279. @item threshold0
  6280. @item threshold1
  6281. @item threshold2
  6282. @item threshold3
  6283. Limit the maximum change for each plane, default is 65535.
  6284. If 0, plane will remain unchanged.
  6285. @item coordinates
  6286. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6287. pixels are used.
  6288. Flags to local 3x3 coordinates maps like this:
  6289. 1 2 3
  6290. 4 5
  6291. 6 7 8
  6292. @end table
  6293. @section displace
  6294. Displace pixels as indicated by second and third input stream.
  6295. It takes three input streams and outputs one stream, the first input is the
  6296. source, and second and third input are displacement maps.
  6297. The second input specifies how much to displace pixels along the
  6298. x-axis, while the third input specifies how much to displace pixels
  6299. along the y-axis.
  6300. If one of displacement map streams terminates, last frame from that
  6301. displacement map will be used.
  6302. Note that once generated, displacements maps can be reused over and over again.
  6303. A description of the accepted options follows.
  6304. @table @option
  6305. @item edge
  6306. Set displace behavior for pixels that are out of range.
  6307. Available values are:
  6308. @table @samp
  6309. @item blank
  6310. Missing pixels are replaced by black pixels.
  6311. @item smear
  6312. Adjacent pixels will spread out to replace missing pixels.
  6313. @item wrap
  6314. Out of range pixels are wrapped so they point to pixels of other side.
  6315. @item mirror
  6316. Out of range pixels will be replaced with mirrored pixels.
  6317. @end table
  6318. Default is @samp{smear}.
  6319. @end table
  6320. @subsection Examples
  6321. @itemize
  6322. @item
  6323. Add ripple effect to rgb input of video size hd720:
  6324. @example
  6325. 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
  6326. @end example
  6327. @item
  6328. Add wave effect to rgb input of video size hd720:
  6329. @example
  6330. 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
  6331. @end example
  6332. @end itemize
  6333. @section drawbox
  6334. Draw a colored box on the input image.
  6335. It accepts the following parameters:
  6336. @table @option
  6337. @item x
  6338. @item y
  6339. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6340. @item width, w
  6341. @item height, h
  6342. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6343. the input width and height. It defaults to 0.
  6344. @item color, c
  6345. Specify the color of the box to write. For the general syntax of this option,
  6346. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6347. value @code{invert} is used, the box edge color is the same as the
  6348. video with inverted luma.
  6349. @item thickness, t
  6350. The expression which sets the thickness of the box edge.
  6351. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6352. See below for the list of accepted constants.
  6353. @item replace
  6354. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6355. will overwrite the video's color and alpha pixels.
  6356. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6357. @end table
  6358. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6359. following constants:
  6360. @table @option
  6361. @item dar
  6362. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6363. @item hsub
  6364. @item vsub
  6365. horizontal and vertical chroma subsample values. For example for the
  6366. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6367. @item in_h, ih
  6368. @item in_w, iw
  6369. The input width and height.
  6370. @item sar
  6371. The input sample aspect ratio.
  6372. @item x
  6373. @item y
  6374. The x and y offset coordinates where the box is drawn.
  6375. @item w
  6376. @item h
  6377. The width and height of the drawn box.
  6378. @item t
  6379. The thickness of the drawn box.
  6380. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6381. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6382. @end table
  6383. @subsection Examples
  6384. @itemize
  6385. @item
  6386. Draw a black box around the edge of the input image:
  6387. @example
  6388. drawbox
  6389. @end example
  6390. @item
  6391. Draw a box with color red and an opacity of 50%:
  6392. @example
  6393. drawbox=10:20:200:60:red@@0.5
  6394. @end example
  6395. The previous example can be specified as:
  6396. @example
  6397. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6398. @end example
  6399. @item
  6400. Fill the box with pink color:
  6401. @example
  6402. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6403. @end example
  6404. @item
  6405. Draw a 2-pixel red 2.40:1 mask:
  6406. @example
  6407. 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
  6408. @end example
  6409. @end itemize
  6410. @section drawgrid
  6411. Draw a grid on the input image.
  6412. It accepts the following parameters:
  6413. @table @option
  6414. @item x
  6415. @item y
  6416. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6417. @item width, w
  6418. @item height, h
  6419. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6420. input width and height, respectively, minus @code{thickness}, so image gets
  6421. framed. Default to 0.
  6422. @item color, c
  6423. Specify the color of the grid. For the general syntax of this option,
  6424. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6425. value @code{invert} is used, the grid color is the same as the
  6426. video with inverted luma.
  6427. @item thickness, t
  6428. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6429. See below for the list of accepted constants.
  6430. @item replace
  6431. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6432. will overwrite the video's color and alpha pixels.
  6433. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6434. @end table
  6435. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6436. following constants:
  6437. @table @option
  6438. @item dar
  6439. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6440. @item hsub
  6441. @item vsub
  6442. horizontal and vertical chroma subsample values. For example for the
  6443. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6444. @item in_h, ih
  6445. @item in_w, iw
  6446. The input grid cell width and height.
  6447. @item sar
  6448. The input sample aspect ratio.
  6449. @item x
  6450. @item y
  6451. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6452. @item w
  6453. @item h
  6454. The width and height of the drawn cell.
  6455. @item t
  6456. The thickness of the drawn cell.
  6457. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6458. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6459. @end table
  6460. @subsection Examples
  6461. @itemize
  6462. @item
  6463. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6464. @example
  6465. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6466. @end example
  6467. @item
  6468. Draw a white 3x3 grid with an opacity of 50%:
  6469. @example
  6470. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6471. @end example
  6472. @end itemize
  6473. @anchor{drawtext}
  6474. @section drawtext
  6475. Draw a text string or text from a specified file on top of a video, using the
  6476. libfreetype library.
  6477. To enable compilation of this filter, you need to configure FFmpeg with
  6478. @code{--enable-libfreetype}.
  6479. To enable default font fallback and the @var{font} option you need to
  6480. configure FFmpeg with @code{--enable-libfontconfig}.
  6481. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6482. @code{--enable-libfribidi}.
  6483. @subsection Syntax
  6484. It accepts the following parameters:
  6485. @table @option
  6486. @item box
  6487. Used to draw a box around text using the background color.
  6488. The value must be either 1 (enable) or 0 (disable).
  6489. The default value of @var{box} is 0.
  6490. @item boxborderw
  6491. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6492. The default value of @var{boxborderw} is 0.
  6493. @item boxcolor
  6494. The color to be used for drawing box around text. For the syntax of this
  6495. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6496. The default value of @var{boxcolor} is "white".
  6497. @item line_spacing
  6498. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6499. The default value of @var{line_spacing} is 0.
  6500. @item borderw
  6501. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6502. The default value of @var{borderw} is 0.
  6503. @item bordercolor
  6504. Set the color to be used for drawing border around text. For the syntax of this
  6505. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6506. The default value of @var{bordercolor} is "black".
  6507. @item expansion
  6508. Select how the @var{text} is expanded. Can be either @code{none},
  6509. @code{strftime} (deprecated) or
  6510. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6511. below for details.
  6512. @item basetime
  6513. Set a start time for the count. Value is in microseconds. Only applied
  6514. in the deprecated strftime expansion mode. To emulate in normal expansion
  6515. mode use the @code{pts} function, supplying the start time (in seconds)
  6516. as the second argument.
  6517. @item fix_bounds
  6518. If true, check and fix text coords to avoid clipping.
  6519. @item fontcolor
  6520. The color to be used for drawing fonts. For the syntax of this option, check
  6521. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6522. The default value of @var{fontcolor} is "black".
  6523. @item fontcolor_expr
  6524. String which is expanded the same way as @var{text} to obtain dynamic
  6525. @var{fontcolor} value. By default this option has empty value and is not
  6526. processed. When this option is set, it overrides @var{fontcolor} option.
  6527. @item font
  6528. The font family to be used for drawing text. By default Sans.
  6529. @item fontfile
  6530. The font file to be used for drawing text. The path must be included.
  6531. This parameter is mandatory if the fontconfig support is disabled.
  6532. @item alpha
  6533. Draw the text applying alpha blending. The value can
  6534. be a number between 0.0 and 1.0.
  6535. The expression accepts the same variables @var{x, y} as well.
  6536. The default value is 1.
  6537. Please see @var{fontcolor_expr}.
  6538. @item fontsize
  6539. The font size to be used for drawing text.
  6540. The default value of @var{fontsize} is 16.
  6541. @item text_shaping
  6542. If set to 1, attempt to shape the text (for example, reverse the order of
  6543. right-to-left text and join Arabic characters) before drawing it.
  6544. Otherwise, just draw the text exactly as given.
  6545. By default 1 (if supported).
  6546. @item ft_load_flags
  6547. The flags to be used for loading the fonts.
  6548. The flags map the corresponding flags supported by libfreetype, and are
  6549. a combination of the following values:
  6550. @table @var
  6551. @item default
  6552. @item no_scale
  6553. @item no_hinting
  6554. @item render
  6555. @item no_bitmap
  6556. @item vertical_layout
  6557. @item force_autohint
  6558. @item crop_bitmap
  6559. @item pedantic
  6560. @item ignore_global_advance_width
  6561. @item no_recurse
  6562. @item ignore_transform
  6563. @item monochrome
  6564. @item linear_design
  6565. @item no_autohint
  6566. @end table
  6567. Default value is "default".
  6568. For more information consult the documentation for the FT_LOAD_*
  6569. libfreetype flags.
  6570. @item shadowcolor
  6571. The color to be used for drawing a shadow behind the drawn text. For the
  6572. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6573. ffmpeg-utils manual,ffmpeg-utils}.
  6574. The default value of @var{shadowcolor} is "black".
  6575. @item shadowx
  6576. @item shadowy
  6577. The x and y offsets for the text shadow position with respect to the
  6578. position of the text. They can be either positive or negative
  6579. values. The default value for both is "0".
  6580. @item start_number
  6581. The starting frame number for the n/frame_num variable. The default value
  6582. is "0".
  6583. @item tabsize
  6584. The size in number of spaces to use for rendering the tab.
  6585. Default value is 4.
  6586. @item timecode
  6587. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6588. format. It can be used with or without text parameter. @var{timecode_rate}
  6589. option must be specified.
  6590. @item timecode_rate, rate, r
  6591. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6592. integer. Minimum value is "1".
  6593. Drop-frame timecode is supported for frame rates 30 & 60.
  6594. @item tc24hmax
  6595. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6596. Default is 0 (disabled).
  6597. @item text
  6598. The text string to be drawn. The text must be a sequence of UTF-8
  6599. encoded characters.
  6600. This parameter is mandatory if no file is specified with the parameter
  6601. @var{textfile}.
  6602. @item textfile
  6603. A text file containing text to be drawn. The text must be a sequence
  6604. of UTF-8 encoded characters.
  6605. This parameter is mandatory if no text string is specified with the
  6606. parameter @var{text}.
  6607. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6608. @item reload
  6609. If set to 1, the @var{textfile} will be reloaded before each frame.
  6610. Be sure to update it atomically, or it may be read partially, or even fail.
  6611. @item x
  6612. @item y
  6613. The expressions which specify the offsets where text will be drawn
  6614. within the video frame. They are relative to the top/left border of the
  6615. output image.
  6616. The default value of @var{x} and @var{y} is "0".
  6617. See below for the list of accepted constants and functions.
  6618. @end table
  6619. The parameters for @var{x} and @var{y} are expressions containing the
  6620. following constants and functions:
  6621. @table @option
  6622. @item dar
  6623. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6624. @item hsub
  6625. @item vsub
  6626. horizontal and vertical chroma subsample values. For example for the
  6627. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6628. @item line_h, lh
  6629. the height of each text line
  6630. @item main_h, h, H
  6631. the input height
  6632. @item main_w, w, W
  6633. the input width
  6634. @item max_glyph_a, ascent
  6635. the maximum distance from the baseline to the highest/upper grid
  6636. coordinate used to place a glyph outline point, for all the rendered
  6637. glyphs.
  6638. It is a positive value, due to the grid's orientation with the Y axis
  6639. upwards.
  6640. @item max_glyph_d, descent
  6641. the maximum distance from the baseline to the lowest grid coordinate
  6642. used to place a glyph outline point, for all the rendered glyphs.
  6643. This is a negative value, due to the grid's orientation, with the Y axis
  6644. upwards.
  6645. @item max_glyph_h
  6646. maximum glyph height, that is the maximum height for all the glyphs
  6647. contained in the rendered text, it is equivalent to @var{ascent} -
  6648. @var{descent}.
  6649. @item max_glyph_w
  6650. maximum glyph width, that is the maximum width for all the glyphs
  6651. contained in the rendered text
  6652. @item n
  6653. the number of input frame, starting from 0
  6654. @item rand(min, max)
  6655. return a random number included between @var{min} and @var{max}
  6656. @item sar
  6657. The input sample aspect ratio.
  6658. @item t
  6659. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6660. @item text_h, th
  6661. the height of the rendered text
  6662. @item text_w, tw
  6663. the width of the rendered text
  6664. @item x
  6665. @item y
  6666. the x and y offset coordinates where the text is drawn.
  6667. These parameters allow the @var{x} and @var{y} expressions to refer
  6668. each other, so you can for example specify @code{y=x/dar}.
  6669. @end table
  6670. @anchor{drawtext_expansion}
  6671. @subsection Text expansion
  6672. If @option{expansion} is set to @code{strftime},
  6673. the filter recognizes strftime() sequences in the provided text and
  6674. expands them accordingly. Check the documentation of strftime(). This
  6675. feature is deprecated.
  6676. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6677. If @option{expansion} is set to @code{normal} (which is the default),
  6678. the following expansion mechanism is used.
  6679. The backslash character @samp{\}, followed by any character, always expands to
  6680. the second character.
  6681. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6682. braces is a function name, possibly followed by arguments separated by ':'.
  6683. If the arguments contain special characters or delimiters (':' or '@}'),
  6684. they should be escaped.
  6685. Note that they probably must also be escaped as the value for the
  6686. @option{text} option in the filter argument string and as the filter
  6687. argument in the filtergraph description, and possibly also for the shell,
  6688. that makes up to four levels of escaping; using a text file avoids these
  6689. problems.
  6690. The following functions are available:
  6691. @table @command
  6692. @item expr, e
  6693. The expression evaluation result.
  6694. It must take one argument specifying the expression to be evaluated,
  6695. which accepts the same constants and functions as the @var{x} and
  6696. @var{y} values. Note that not all constants should be used, for
  6697. example the text size is not known when evaluating the expression, so
  6698. the constants @var{text_w} and @var{text_h} will have an undefined
  6699. value.
  6700. @item expr_int_format, eif
  6701. Evaluate the expression's value and output as formatted integer.
  6702. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6703. The second argument specifies the output format. Allowed values are @samp{x},
  6704. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6705. @code{printf} function.
  6706. The third parameter is optional and sets the number of positions taken by the output.
  6707. It can be used to add padding with zeros from the left.
  6708. @item gmtime
  6709. The time at which the filter is running, expressed in UTC.
  6710. It can accept an argument: a strftime() format string.
  6711. @item localtime
  6712. The time at which the filter is running, expressed in the local time zone.
  6713. It can accept an argument: a strftime() format string.
  6714. @item metadata
  6715. Frame metadata. Takes one or two arguments.
  6716. The first argument is mandatory and specifies the metadata key.
  6717. The second argument is optional and specifies a default value, used when the
  6718. metadata key is not found or empty.
  6719. @item n, frame_num
  6720. The frame number, starting from 0.
  6721. @item pict_type
  6722. A 1 character description of the current picture type.
  6723. @item pts
  6724. The timestamp of the current frame.
  6725. It can take up to three arguments.
  6726. The first argument is the format of the timestamp; it defaults to @code{flt}
  6727. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6728. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6729. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6730. @code{localtime} stands for the timestamp of the frame formatted as
  6731. local time zone time.
  6732. The second argument is an offset added to the timestamp.
  6733. If the format is set to @code{hms}, a third argument @code{24HH} may be
  6734. supplied to present the hour part of the formatted timestamp in 24h format
  6735. (00-23).
  6736. If the format is set to @code{localtime} or @code{gmtime},
  6737. a third argument may be supplied: a strftime() format string.
  6738. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6739. @end table
  6740. @subsection Examples
  6741. @itemize
  6742. @item
  6743. Draw "Test Text" with font FreeSerif, using the default values for the
  6744. optional parameters.
  6745. @example
  6746. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6747. @end example
  6748. @item
  6749. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6750. and y=50 (counting from the top-left corner of the screen), text is
  6751. yellow with a red box around it. Both the text and the box have an
  6752. opacity of 20%.
  6753. @example
  6754. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6755. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6756. @end example
  6757. Note that the double quotes are not necessary if spaces are not used
  6758. within the parameter list.
  6759. @item
  6760. Show the text at the center of the video frame:
  6761. @example
  6762. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6763. @end example
  6764. @item
  6765. Show the text at a random position, switching to a new position every 30 seconds:
  6766. @example
  6767. 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)"
  6768. @end example
  6769. @item
  6770. Show a text line sliding from right to left in the last row of the video
  6771. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6772. with no newlines.
  6773. @example
  6774. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6775. @end example
  6776. @item
  6777. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6778. @example
  6779. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6780. @end example
  6781. @item
  6782. Draw a single green letter "g", at the center of the input video.
  6783. The glyph baseline is placed at half screen height.
  6784. @example
  6785. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6786. @end example
  6787. @item
  6788. Show text for 1 second every 3 seconds:
  6789. @example
  6790. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6791. @end example
  6792. @item
  6793. Use fontconfig to set the font. Note that the colons need to be escaped.
  6794. @example
  6795. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6796. @end example
  6797. @item
  6798. Print the date of a real-time encoding (see strftime(3)):
  6799. @example
  6800. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6801. @end example
  6802. @item
  6803. Show text fading in and out (appearing/disappearing):
  6804. @example
  6805. #!/bin/sh
  6806. DS=1.0 # display start
  6807. DE=10.0 # display end
  6808. FID=1.5 # fade in duration
  6809. FOD=5 # fade out duration
  6810. 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 @}"
  6811. @end example
  6812. @item
  6813. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6814. and the @option{fontsize} value are included in the @option{y} offset.
  6815. @example
  6816. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6817. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6818. @end example
  6819. @end itemize
  6820. For more information about libfreetype, check:
  6821. @url{http://www.freetype.org/}.
  6822. For more information about fontconfig, check:
  6823. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6824. For more information about libfribidi, check:
  6825. @url{http://fribidi.org/}.
  6826. @section edgedetect
  6827. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6828. The filter accepts the following options:
  6829. @table @option
  6830. @item low
  6831. @item high
  6832. Set low and high threshold values used by the Canny thresholding
  6833. algorithm.
  6834. The high threshold selects the "strong" edge pixels, which are then
  6835. connected through 8-connectivity with the "weak" edge pixels selected
  6836. by the low threshold.
  6837. @var{low} and @var{high} threshold values must be chosen in the range
  6838. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6839. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6840. is @code{50/255}.
  6841. @item mode
  6842. Define the drawing mode.
  6843. @table @samp
  6844. @item wires
  6845. Draw white/gray wires on black background.
  6846. @item colormix
  6847. Mix the colors to create a paint/cartoon effect.
  6848. @item canny
  6849. Apply Canny edge detector on all selected planes.
  6850. @end table
  6851. Default value is @var{wires}.
  6852. @item planes
  6853. Select planes for filtering. By default all available planes are filtered.
  6854. @end table
  6855. @subsection Examples
  6856. @itemize
  6857. @item
  6858. Standard edge detection with custom values for the hysteresis thresholding:
  6859. @example
  6860. edgedetect=low=0.1:high=0.4
  6861. @end example
  6862. @item
  6863. Painting effect without thresholding:
  6864. @example
  6865. edgedetect=mode=colormix:high=0
  6866. @end example
  6867. @end itemize
  6868. @section eq
  6869. Set brightness, contrast, saturation and approximate gamma adjustment.
  6870. The filter accepts the following options:
  6871. @table @option
  6872. @item contrast
  6873. Set the contrast expression. The value must be a float value in range
  6874. @code{-2.0} to @code{2.0}. The default value is "1".
  6875. @item brightness
  6876. Set the brightness expression. The value must be a float value in
  6877. range @code{-1.0} to @code{1.0}. The default value is "0".
  6878. @item saturation
  6879. Set the saturation expression. The value must be a float in
  6880. range @code{0.0} to @code{3.0}. The default value is "1".
  6881. @item gamma
  6882. Set the gamma expression. The value must be a float in range
  6883. @code{0.1} to @code{10.0}. The default value is "1".
  6884. @item gamma_r
  6885. Set the gamma expression for red. The value must be a float in
  6886. range @code{0.1} to @code{10.0}. The default value is "1".
  6887. @item gamma_g
  6888. Set the gamma expression for green. The value must be a float in range
  6889. @code{0.1} to @code{10.0}. The default value is "1".
  6890. @item gamma_b
  6891. Set the gamma expression for blue. The value must be a float in range
  6892. @code{0.1} to @code{10.0}. The default value is "1".
  6893. @item gamma_weight
  6894. Set the gamma weight expression. It can be used to reduce the effect
  6895. of a high gamma value on bright image areas, e.g. keep them from
  6896. getting overamplified and just plain white. The value must be a float
  6897. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6898. gamma correction all the way down while @code{1.0} leaves it at its
  6899. full strength. Default is "1".
  6900. @item eval
  6901. Set when the expressions for brightness, contrast, saturation and
  6902. gamma expressions are evaluated.
  6903. It accepts the following values:
  6904. @table @samp
  6905. @item init
  6906. only evaluate expressions once during the filter initialization or
  6907. when a command is processed
  6908. @item frame
  6909. evaluate expressions for each incoming frame
  6910. @end table
  6911. Default value is @samp{init}.
  6912. @end table
  6913. The expressions accept the following parameters:
  6914. @table @option
  6915. @item n
  6916. frame count of the input frame starting from 0
  6917. @item pos
  6918. byte position of the corresponding packet in the input file, NAN if
  6919. unspecified
  6920. @item r
  6921. frame rate of the input video, NAN if the input frame rate is unknown
  6922. @item t
  6923. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6924. @end table
  6925. @subsection Commands
  6926. The filter supports the following commands:
  6927. @table @option
  6928. @item contrast
  6929. Set the contrast expression.
  6930. @item brightness
  6931. Set the brightness expression.
  6932. @item saturation
  6933. Set the saturation expression.
  6934. @item gamma
  6935. Set the gamma expression.
  6936. @item gamma_r
  6937. Set the gamma_r expression.
  6938. @item gamma_g
  6939. Set gamma_g expression.
  6940. @item gamma_b
  6941. Set gamma_b expression.
  6942. @item gamma_weight
  6943. Set gamma_weight expression.
  6944. The command accepts the same syntax of the corresponding option.
  6945. If the specified expression is not valid, it is kept at its current
  6946. value.
  6947. @end table
  6948. @section erosion
  6949. Apply erosion effect to the video.
  6950. This filter replaces the pixel by the local(3x3) minimum.
  6951. It accepts the following options:
  6952. @table @option
  6953. @item threshold0
  6954. @item threshold1
  6955. @item threshold2
  6956. @item threshold3
  6957. Limit the maximum change for each plane, default is 65535.
  6958. If 0, plane will remain unchanged.
  6959. @item coordinates
  6960. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6961. pixels are used.
  6962. Flags to local 3x3 coordinates maps like this:
  6963. 1 2 3
  6964. 4 5
  6965. 6 7 8
  6966. @end table
  6967. @section extractplanes
  6968. Extract color channel components from input video stream into
  6969. separate grayscale video streams.
  6970. The filter accepts the following option:
  6971. @table @option
  6972. @item planes
  6973. Set plane(s) to extract.
  6974. Available values for planes are:
  6975. @table @samp
  6976. @item y
  6977. @item u
  6978. @item v
  6979. @item a
  6980. @item r
  6981. @item g
  6982. @item b
  6983. @end table
  6984. Choosing planes not available in the input will result in an error.
  6985. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6986. with @code{y}, @code{u}, @code{v} planes at same time.
  6987. @end table
  6988. @subsection Examples
  6989. @itemize
  6990. @item
  6991. Extract luma, u and v color channel component from input video frame
  6992. into 3 grayscale outputs:
  6993. @example
  6994. 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
  6995. @end example
  6996. @end itemize
  6997. @section elbg
  6998. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6999. For each input image, the filter will compute the optimal mapping from
  7000. the input to the output given the codebook length, that is the number
  7001. of distinct output colors.
  7002. This filter accepts the following options.
  7003. @table @option
  7004. @item codebook_length, l
  7005. Set codebook length. The value must be a positive integer, and
  7006. represents the number of distinct output colors. Default value is 256.
  7007. @item nb_steps, n
  7008. Set the maximum number of iterations to apply for computing the optimal
  7009. mapping. The higher the value the better the result and the higher the
  7010. computation time. Default value is 1.
  7011. @item seed, s
  7012. Set a random seed, must be an integer included between 0 and
  7013. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7014. will try to use a good random seed on a best effort basis.
  7015. @item pal8
  7016. Set pal8 output pixel format. This option does not work with codebook
  7017. length greater than 256.
  7018. @end table
  7019. @section entropy
  7020. Measure graylevel entropy in histogram of color channels of video frames.
  7021. It accepts the following parameters:
  7022. @table @option
  7023. @item mode
  7024. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7025. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7026. between neighbour histogram values.
  7027. @end table
  7028. @section fade
  7029. Apply a fade-in/out effect to the input video.
  7030. It accepts the following parameters:
  7031. @table @option
  7032. @item type, t
  7033. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7034. effect.
  7035. Default is @code{in}.
  7036. @item start_frame, s
  7037. Specify the number of the frame to start applying the fade
  7038. effect at. Default is 0.
  7039. @item nb_frames, n
  7040. The number of frames that the fade effect lasts. At the end of the
  7041. fade-in effect, the output video will have the same intensity as the input video.
  7042. At the end of the fade-out transition, the output video will be filled with the
  7043. selected @option{color}.
  7044. Default is 25.
  7045. @item alpha
  7046. If set to 1, fade only alpha channel, if one exists on the input.
  7047. Default value is 0.
  7048. @item start_time, st
  7049. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7050. effect. If both start_frame and start_time are specified, the fade will start at
  7051. whichever comes last. Default is 0.
  7052. @item duration, d
  7053. The number of seconds for which the fade effect has to last. At the end of the
  7054. fade-in effect the output video will have the same intensity as the input video,
  7055. at the end of the fade-out transition the output video will be filled with the
  7056. selected @option{color}.
  7057. If both duration and nb_frames are specified, duration is used. Default is 0
  7058. (nb_frames is used by default).
  7059. @item color, c
  7060. Specify the color of the fade. Default is "black".
  7061. @end table
  7062. @subsection Examples
  7063. @itemize
  7064. @item
  7065. Fade in the first 30 frames of video:
  7066. @example
  7067. fade=in:0:30
  7068. @end example
  7069. The command above is equivalent to:
  7070. @example
  7071. fade=t=in:s=0:n=30
  7072. @end example
  7073. @item
  7074. Fade out the last 45 frames of a 200-frame video:
  7075. @example
  7076. fade=out:155:45
  7077. fade=type=out:start_frame=155:nb_frames=45
  7078. @end example
  7079. @item
  7080. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7081. @example
  7082. fade=in:0:25, fade=out:975:25
  7083. @end example
  7084. @item
  7085. Make the first 5 frames yellow, then fade in from frame 5-24:
  7086. @example
  7087. fade=in:5:20:color=yellow
  7088. @end example
  7089. @item
  7090. Fade in alpha over first 25 frames of video:
  7091. @example
  7092. fade=in:0:25:alpha=1
  7093. @end example
  7094. @item
  7095. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7096. @example
  7097. fade=t=in:st=5.5:d=0.5
  7098. @end example
  7099. @end itemize
  7100. @section fftfilt
  7101. Apply arbitrary expressions to samples in frequency domain
  7102. @table @option
  7103. @item dc_Y
  7104. Adjust the dc value (gain) of the luma plane of the image. The filter
  7105. accepts an integer value in range @code{0} to @code{1000}. The default
  7106. value is set to @code{0}.
  7107. @item dc_U
  7108. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7109. filter accepts an integer value in range @code{0} to @code{1000}. The
  7110. default value is set to @code{0}.
  7111. @item dc_V
  7112. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7113. filter accepts an integer value in range @code{0} to @code{1000}. The
  7114. default value is set to @code{0}.
  7115. @item weight_Y
  7116. Set the frequency domain weight expression for the luma plane.
  7117. @item weight_U
  7118. Set the frequency domain weight expression for the 1st chroma plane.
  7119. @item weight_V
  7120. Set the frequency domain weight expression for the 2nd chroma plane.
  7121. @item eval
  7122. Set when the expressions are evaluated.
  7123. It accepts the following values:
  7124. @table @samp
  7125. @item init
  7126. Only evaluate expressions once during the filter initialization.
  7127. @item frame
  7128. Evaluate expressions for each incoming frame.
  7129. @end table
  7130. Default value is @samp{init}.
  7131. The filter accepts the following variables:
  7132. @item X
  7133. @item Y
  7134. The coordinates of the current sample.
  7135. @item W
  7136. @item H
  7137. The width and height of the image.
  7138. @item N
  7139. The number of input frame, starting from 0.
  7140. @end table
  7141. @subsection Examples
  7142. @itemize
  7143. @item
  7144. High-pass:
  7145. @example
  7146. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7147. @end example
  7148. @item
  7149. Low-pass:
  7150. @example
  7151. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7152. @end example
  7153. @item
  7154. Sharpen:
  7155. @example
  7156. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7157. @end example
  7158. @item
  7159. Blur:
  7160. @example
  7161. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7162. @end example
  7163. @end itemize
  7164. @section fftdnoiz
  7165. Denoise frames using 3D FFT (frequency domain filtering).
  7166. The filter accepts the following options:
  7167. @table @option
  7168. @item sigma
  7169. Set the noise sigma constant. This sets denoising strength.
  7170. Default value is 1. Allowed range is from 0 to 30.
  7171. Using very high sigma with low overlap may give blocking artifacts.
  7172. @item amount
  7173. Set amount of denoising. By default all detected noise is reduced.
  7174. Default value is 1. Allowed range is from 0 to 1.
  7175. @item block
  7176. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7177. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7178. block size in pixels is 2^4 which is 16.
  7179. @item overlap
  7180. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7181. @item prev
  7182. Set number of previous frames to use for denoising. By default is set to 0.
  7183. @item next
  7184. Set number of next frames to to use for denoising. By default is set to 0.
  7185. @item planes
  7186. Set planes which will be filtered, by default are all available filtered
  7187. except alpha.
  7188. @end table
  7189. @section field
  7190. Extract a single field from an interlaced image using stride
  7191. arithmetic to avoid wasting CPU time. The output frames are marked as
  7192. non-interlaced.
  7193. The filter accepts the following options:
  7194. @table @option
  7195. @item type
  7196. Specify whether to extract the top (if the value is @code{0} or
  7197. @code{top}) or the bottom field (if the value is @code{1} or
  7198. @code{bottom}).
  7199. @end table
  7200. @section fieldhint
  7201. Create new frames by copying the top and bottom fields from surrounding frames
  7202. supplied as numbers by the hint file.
  7203. @table @option
  7204. @item hint
  7205. Set file containing hints: absolute/relative frame numbers.
  7206. There must be one line for each frame in a clip. Each line must contain two
  7207. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7208. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7209. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7210. for @code{relative} mode. First number tells from which frame to pick up top
  7211. field and second number tells from which frame to pick up bottom field.
  7212. If optionally followed by @code{+} output frame will be marked as interlaced,
  7213. else if followed by @code{-} output frame will be marked as progressive, else
  7214. it will be marked same as input frame.
  7215. If line starts with @code{#} or @code{;} that line is skipped.
  7216. @item mode
  7217. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7218. @end table
  7219. Example of first several lines of @code{hint} file for @code{relative} mode:
  7220. @example
  7221. 0,0 - # first frame
  7222. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7223. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7224. 1,0 -
  7225. 0,0 -
  7226. 0,0 -
  7227. 1,0 -
  7228. 1,0 -
  7229. 1,0 -
  7230. 0,0 -
  7231. 0,0 -
  7232. 1,0 -
  7233. 1,0 -
  7234. 1,0 -
  7235. 0,0 -
  7236. @end example
  7237. @section fieldmatch
  7238. Field matching filter for inverse telecine. It is meant to reconstruct the
  7239. progressive frames from a telecined stream. The filter does not drop duplicated
  7240. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7241. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7242. The separation of the field matching and the decimation is notably motivated by
  7243. the possibility of inserting a de-interlacing filter fallback between the two.
  7244. If the source has mixed telecined and real interlaced content,
  7245. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7246. But these remaining combed frames will be marked as interlaced, and thus can be
  7247. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7248. In addition to the various configuration options, @code{fieldmatch} can take an
  7249. optional second stream, activated through the @option{ppsrc} option. If
  7250. enabled, the frames reconstruction will be based on the fields and frames from
  7251. this second stream. This allows the first input to be pre-processed in order to
  7252. help the various algorithms of the filter, while keeping the output lossless
  7253. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7254. or brightness/contrast adjustments can help.
  7255. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7256. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7257. which @code{fieldmatch} is based on. While the semantic and usage are very
  7258. close, some behaviour and options names can differ.
  7259. The @ref{decimate} filter currently only works for constant frame rate input.
  7260. If your input has mixed telecined (30fps) and progressive content with a lower
  7261. framerate like 24fps use the following filterchain to produce the necessary cfr
  7262. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7263. The filter accepts the following options:
  7264. @table @option
  7265. @item order
  7266. Specify the assumed field order of the input stream. Available values are:
  7267. @table @samp
  7268. @item auto
  7269. Auto detect parity (use FFmpeg's internal parity value).
  7270. @item bff
  7271. Assume bottom field first.
  7272. @item tff
  7273. Assume top field first.
  7274. @end table
  7275. Note that it is sometimes recommended not to trust the parity announced by the
  7276. stream.
  7277. Default value is @var{auto}.
  7278. @item mode
  7279. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7280. sense that it won't risk creating jerkiness due to duplicate frames when
  7281. possible, but if there are bad edits or blended fields it will end up
  7282. outputting combed frames when a good match might actually exist. On the other
  7283. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7284. but will almost always find a good frame if there is one. The other values are
  7285. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7286. jerkiness and creating duplicate frames versus finding good matches in sections
  7287. with bad edits, orphaned fields, blended fields, etc.
  7288. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7289. Available values are:
  7290. @table @samp
  7291. @item pc
  7292. 2-way matching (p/c)
  7293. @item pc_n
  7294. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7295. @item pc_u
  7296. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7297. @item pc_n_ub
  7298. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7299. still combed (p/c + n + u/b)
  7300. @item pcn
  7301. 3-way matching (p/c/n)
  7302. @item pcn_ub
  7303. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7304. detected as combed (p/c/n + u/b)
  7305. @end table
  7306. The parenthesis at the end indicate the matches that would be used for that
  7307. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7308. @var{top}).
  7309. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7310. the slowest.
  7311. Default value is @var{pc_n}.
  7312. @item ppsrc
  7313. Mark the main input stream as a pre-processed input, and enable the secondary
  7314. input stream as the clean source to pick the fields from. See the filter
  7315. introduction for more details. It is similar to the @option{clip2} feature from
  7316. VFM/TFM.
  7317. Default value is @code{0} (disabled).
  7318. @item field
  7319. Set the field to match from. It is recommended to set this to the same value as
  7320. @option{order} unless you experience matching failures with that setting. In
  7321. certain circumstances changing the field that is used to match from can have a
  7322. large impact on matching performance. Available values are:
  7323. @table @samp
  7324. @item auto
  7325. Automatic (same value as @option{order}).
  7326. @item bottom
  7327. Match from the bottom field.
  7328. @item top
  7329. Match from the top field.
  7330. @end table
  7331. Default value is @var{auto}.
  7332. @item mchroma
  7333. Set whether or not chroma is included during the match comparisons. In most
  7334. cases it is recommended to leave this enabled. You should set this to @code{0}
  7335. only if your clip has bad chroma problems such as heavy rainbowing or other
  7336. artifacts. Setting this to @code{0} could also be used to speed things up at
  7337. the cost of some accuracy.
  7338. Default value is @code{1}.
  7339. @item y0
  7340. @item y1
  7341. These define an exclusion band which excludes the lines between @option{y0} and
  7342. @option{y1} from being included in the field matching decision. An exclusion
  7343. band can be used to ignore subtitles, a logo, or other things that may
  7344. interfere with the matching. @option{y0} sets the starting scan line and
  7345. @option{y1} sets the ending line; all lines in between @option{y0} and
  7346. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7347. @option{y0} and @option{y1} to the same value will disable the feature.
  7348. @option{y0} and @option{y1} defaults to @code{0}.
  7349. @item scthresh
  7350. Set the scene change detection threshold as a percentage of maximum change on
  7351. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7352. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7353. @option{scthresh} is @code{[0.0, 100.0]}.
  7354. Default value is @code{12.0}.
  7355. @item combmatch
  7356. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7357. account the combed scores of matches when deciding what match to use as the
  7358. final match. Available values are:
  7359. @table @samp
  7360. @item none
  7361. No final matching based on combed scores.
  7362. @item sc
  7363. Combed scores are only used when a scene change is detected.
  7364. @item full
  7365. Use combed scores all the time.
  7366. @end table
  7367. Default is @var{sc}.
  7368. @item combdbg
  7369. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7370. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7371. Available values are:
  7372. @table @samp
  7373. @item none
  7374. No forced calculation.
  7375. @item pcn
  7376. Force p/c/n calculations.
  7377. @item pcnub
  7378. Force p/c/n/u/b calculations.
  7379. @end table
  7380. Default value is @var{none}.
  7381. @item cthresh
  7382. This is the area combing threshold used for combed frame detection. This
  7383. essentially controls how "strong" or "visible" combing must be to be detected.
  7384. Larger values mean combing must be more visible and smaller values mean combing
  7385. can be less visible or strong and still be detected. Valid settings are from
  7386. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7387. be detected as combed). This is basically a pixel difference value. A good
  7388. range is @code{[8, 12]}.
  7389. Default value is @code{9}.
  7390. @item chroma
  7391. Sets whether or not chroma is considered in the combed frame decision. Only
  7392. disable this if your source has chroma problems (rainbowing, etc.) that are
  7393. causing problems for the combed frame detection with chroma enabled. Actually,
  7394. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7395. where there is chroma only combing in the source.
  7396. Default value is @code{0}.
  7397. @item blockx
  7398. @item blocky
  7399. Respectively set the x-axis and y-axis size of the window used during combed
  7400. frame detection. This has to do with the size of the area in which
  7401. @option{combpel} pixels are required to be detected as combed for a frame to be
  7402. declared combed. See the @option{combpel} parameter description for more info.
  7403. Possible values are any number that is a power of 2 starting at 4 and going up
  7404. to 512.
  7405. Default value is @code{16}.
  7406. @item combpel
  7407. The number of combed pixels inside any of the @option{blocky} by
  7408. @option{blockx} size blocks on the frame for the frame to be detected as
  7409. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7410. setting controls "how much" combing there must be in any localized area (a
  7411. window defined by the @option{blockx} and @option{blocky} settings) on the
  7412. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7413. which point no frames will ever be detected as combed). This setting is known
  7414. as @option{MI} in TFM/VFM vocabulary.
  7415. Default value is @code{80}.
  7416. @end table
  7417. @anchor{p/c/n/u/b meaning}
  7418. @subsection p/c/n/u/b meaning
  7419. @subsubsection p/c/n
  7420. We assume the following telecined stream:
  7421. @example
  7422. Top fields: 1 2 2 3 4
  7423. Bottom fields: 1 2 3 4 4
  7424. @end example
  7425. The numbers correspond to the progressive frame the fields relate to. Here, the
  7426. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7427. When @code{fieldmatch} is configured to run a matching from bottom
  7428. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7429. @example
  7430. Input stream:
  7431. T 1 2 2 3 4
  7432. B 1 2 3 4 4 <-- matching reference
  7433. Matches: c c n n c
  7434. Output stream:
  7435. T 1 2 3 4 4
  7436. B 1 2 3 4 4
  7437. @end example
  7438. As a result of the field matching, we can see that some frames get duplicated.
  7439. To perform a complete inverse telecine, you need to rely on a decimation filter
  7440. after this operation. See for instance the @ref{decimate} filter.
  7441. The same operation now matching from top fields (@option{field}=@var{top})
  7442. looks like this:
  7443. @example
  7444. Input stream:
  7445. T 1 2 2 3 4 <-- matching reference
  7446. B 1 2 3 4 4
  7447. Matches: c c p p c
  7448. Output stream:
  7449. T 1 2 2 3 4
  7450. B 1 2 2 3 4
  7451. @end example
  7452. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7453. basically, they refer to the frame and field of the opposite parity:
  7454. @itemize
  7455. @item @var{p} matches the field of the opposite parity in the previous frame
  7456. @item @var{c} matches the field of the opposite parity in the current frame
  7457. @item @var{n} matches the field of the opposite parity in the next frame
  7458. @end itemize
  7459. @subsubsection u/b
  7460. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7461. from the opposite parity flag. In the following examples, we assume that we are
  7462. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7463. 'x' is placed above and below each matched fields.
  7464. With bottom matching (@option{field}=@var{bottom}):
  7465. @example
  7466. Match: c p n b u
  7467. x x x x x
  7468. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7469. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7470. x x x x x
  7471. Output frames:
  7472. 2 1 2 2 2
  7473. 2 2 2 1 3
  7474. @end example
  7475. With top matching (@option{field}=@var{top}):
  7476. @example
  7477. Match: c p n b u
  7478. x x x x x
  7479. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7480. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7481. x x x x x
  7482. Output frames:
  7483. 2 2 2 1 2
  7484. 2 1 3 2 2
  7485. @end example
  7486. @subsection Examples
  7487. Simple IVTC of a top field first telecined stream:
  7488. @example
  7489. fieldmatch=order=tff:combmatch=none, decimate
  7490. @end example
  7491. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7492. @example
  7493. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7494. @end example
  7495. @section fieldorder
  7496. Transform the field order of the input video.
  7497. It accepts the following parameters:
  7498. @table @option
  7499. @item order
  7500. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7501. for bottom field first.
  7502. @end table
  7503. The default value is @samp{tff}.
  7504. The transformation is done by shifting the picture content up or down
  7505. by one line, and filling the remaining line with appropriate picture content.
  7506. This method is consistent with most broadcast field order converters.
  7507. If the input video is not flagged as being interlaced, or it is already
  7508. flagged as being of the required output field order, then this filter does
  7509. not alter the incoming video.
  7510. It is very useful when converting to or from PAL DV material,
  7511. which is bottom field first.
  7512. For example:
  7513. @example
  7514. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7515. @end example
  7516. @section fifo, afifo
  7517. Buffer input images and send them when they are requested.
  7518. It is mainly useful when auto-inserted by the libavfilter
  7519. framework.
  7520. It does not take parameters.
  7521. @section fillborders
  7522. Fill borders of the input video, without changing video stream dimensions.
  7523. Sometimes video can have garbage at the four edges and you may not want to
  7524. crop video input to keep size multiple of some number.
  7525. This filter accepts the following options:
  7526. @table @option
  7527. @item left
  7528. Number of pixels to fill from left border.
  7529. @item right
  7530. Number of pixels to fill from right border.
  7531. @item top
  7532. Number of pixels to fill from top border.
  7533. @item bottom
  7534. Number of pixels to fill from bottom border.
  7535. @item mode
  7536. Set fill mode.
  7537. It accepts the following values:
  7538. @table @samp
  7539. @item smear
  7540. fill pixels using outermost pixels
  7541. @item mirror
  7542. fill pixels using mirroring
  7543. @item fixed
  7544. fill pixels with constant value
  7545. @end table
  7546. Default is @var{smear}.
  7547. @item color
  7548. Set color for pixels in fixed mode. Default is @var{black}.
  7549. @end table
  7550. @section find_rect
  7551. Find a rectangular object
  7552. It accepts the following options:
  7553. @table @option
  7554. @item object
  7555. Filepath of the object image, needs to be in gray8.
  7556. @item threshold
  7557. Detection threshold, default is 0.5.
  7558. @item mipmaps
  7559. Number of mipmaps, default is 3.
  7560. @item xmin, ymin, xmax, ymax
  7561. Specifies the rectangle in which to search.
  7562. @end table
  7563. @subsection Examples
  7564. @itemize
  7565. @item
  7566. Generate a representative palette of a given video using @command{ffmpeg}:
  7567. @example
  7568. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7569. @end example
  7570. @end itemize
  7571. @section cover_rect
  7572. Cover a rectangular object
  7573. It accepts the following options:
  7574. @table @option
  7575. @item cover
  7576. Filepath of the optional cover image, needs to be in yuv420.
  7577. @item mode
  7578. Set covering mode.
  7579. It accepts the following values:
  7580. @table @samp
  7581. @item cover
  7582. cover it by the supplied image
  7583. @item blur
  7584. cover it by interpolating the surrounding pixels
  7585. @end table
  7586. Default value is @var{blur}.
  7587. @end table
  7588. @subsection Examples
  7589. @itemize
  7590. @item
  7591. Generate a representative palette of a given video using @command{ffmpeg}:
  7592. @example
  7593. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7594. @end example
  7595. @end itemize
  7596. @section floodfill
  7597. Flood area with values of same pixel components with another values.
  7598. It accepts the following options:
  7599. @table @option
  7600. @item x
  7601. Set pixel x coordinate.
  7602. @item y
  7603. Set pixel y coordinate.
  7604. @item s0
  7605. Set source #0 component value.
  7606. @item s1
  7607. Set source #1 component value.
  7608. @item s2
  7609. Set source #2 component value.
  7610. @item s3
  7611. Set source #3 component value.
  7612. @item d0
  7613. Set destination #0 component value.
  7614. @item d1
  7615. Set destination #1 component value.
  7616. @item d2
  7617. Set destination #2 component value.
  7618. @item d3
  7619. Set destination #3 component value.
  7620. @end table
  7621. @anchor{format}
  7622. @section format
  7623. Convert the input video to one of the specified pixel formats.
  7624. Libavfilter will try to pick one that is suitable as input to
  7625. the next filter.
  7626. It accepts the following parameters:
  7627. @table @option
  7628. @item pix_fmts
  7629. A '|'-separated list of pixel format names, such as
  7630. "pix_fmts=yuv420p|monow|rgb24".
  7631. @end table
  7632. @subsection Examples
  7633. @itemize
  7634. @item
  7635. Convert the input video to the @var{yuv420p} format
  7636. @example
  7637. format=pix_fmts=yuv420p
  7638. @end example
  7639. Convert the input video to any of the formats in the list
  7640. @example
  7641. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7642. @end example
  7643. @end itemize
  7644. @anchor{fps}
  7645. @section fps
  7646. Convert the video to specified constant frame rate by duplicating or dropping
  7647. frames as necessary.
  7648. It accepts the following parameters:
  7649. @table @option
  7650. @item fps
  7651. The desired output frame rate. The default is @code{25}.
  7652. @item start_time
  7653. Assume the first PTS should be the given value, in seconds. This allows for
  7654. padding/trimming at the start of stream. By default, no assumption is made
  7655. about the first frame's expected PTS, so no padding or trimming is done.
  7656. For example, this could be set to 0 to pad the beginning with duplicates of
  7657. the first frame if a video stream starts after the audio stream or to trim any
  7658. frames with a negative PTS.
  7659. @item round
  7660. Timestamp (PTS) rounding method.
  7661. Possible values are:
  7662. @table @option
  7663. @item zero
  7664. round towards 0
  7665. @item inf
  7666. round away from 0
  7667. @item down
  7668. round towards -infinity
  7669. @item up
  7670. round towards +infinity
  7671. @item near
  7672. round to nearest
  7673. @end table
  7674. The default is @code{near}.
  7675. @item eof_action
  7676. Action performed when reading the last frame.
  7677. Possible values are:
  7678. @table @option
  7679. @item round
  7680. Use same timestamp rounding method as used for other frames.
  7681. @item pass
  7682. Pass through last frame if input duration has not been reached yet.
  7683. @end table
  7684. The default is @code{round}.
  7685. @end table
  7686. Alternatively, the options can be specified as a flat string:
  7687. @var{fps}[:@var{start_time}[:@var{round}]].
  7688. See also the @ref{setpts} filter.
  7689. @subsection Examples
  7690. @itemize
  7691. @item
  7692. A typical usage in order to set the fps to 25:
  7693. @example
  7694. fps=fps=25
  7695. @end example
  7696. @item
  7697. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7698. @example
  7699. fps=fps=film:round=near
  7700. @end example
  7701. @end itemize
  7702. @section framepack
  7703. Pack two different video streams into a stereoscopic video, setting proper
  7704. metadata on supported codecs. The two views should have the same size and
  7705. framerate and processing will stop when the shorter video ends. Please note
  7706. that you may conveniently adjust view properties with the @ref{scale} and
  7707. @ref{fps} filters.
  7708. It accepts the following parameters:
  7709. @table @option
  7710. @item format
  7711. The desired packing format. Supported values are:
  7712. @table @option
  7713. @item sbs
  7714. The views are next to each other (default).
  7715. @item tab
  7716. The views are on top of each other.
  7717. @item lines
  7718. The views are packed by line.
  7719. @item columns
  7720. The views are packed by column.
  7721. @item frameseq
  7722. The views are temporally interleaved.
  7723. @end table
  7724. @end table
  7725. Some examples:
  7726. @example
  7727. # Convert left and right views into a frame-sequential video
  7728. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7729. # Convert views into a side-by-side video with the same output resolution as the input
  7730. 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
  7731. @end example
  7732. @section framerate
  7733. Change the frame rate by interpolating new video output frames from the source
  7734. frames.
  7735. This filter is not designed to function correctly with interlaced media. If
  7736. you wish to change the frame rate of interlaced media then you are required
  7737. to deinterlace before this filter and re-interlace after this filter.
  7738. A description of the accepted options follows.
  7739. @table @option
  7740. @item fps
  7741. Specify the output frames per second. This option can also be specified
  7742. as a value alone. The default is @code{50}.
  7743. @item interp_start
  7744. Specify the start of a range where the output frame will be created as a
  7745. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7746. the default is @code{15}.
  7747. @item interp_end
  7748. Specify the end of a range where the output frame will be created as a
  7749. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7750. the default is @code{240}.
  7751. @item scene
  7752. Specify the level at which a scene change is detected as a value between
  7753. 0 and 100 to indicate a new scene; a low value reflects a low
  7754. probability for the current frame to introduce a new scene, while a higher
  7755. value means the current frame is more likely to be one.
  7756. The default is @code{8.2}.
  7757. @item flags
  7758. Specify flags influencing the filter process.
  7759. Available value for @var{flags} is:
  7760. @table @option
  7761. @item scene_change_detect, scd
  7762. Enable scene change detection using the value of the option @var{scene}.
  7763. This flag is enabled by default.
  7764. @end table
  7765. @end table
  7766. @section framestep
  7767. Select one frame every N-th frame.
  7768. This filter accepts the following option:
  7769. @table @option
  7770. @item step
  7771. Select frame after every @code{step} frames.
  7772. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7773. @end table
  7774. @section freezedetect
  7775. Detect frozen video.
  7776. This filter logs a message and sets frame metadata when it detects that the
  7777. input video has no significant change in content during a specified duration.
  7778. Video freeze detection calculates the mean average absolute difference of all
  7779. the components of video frames and compares it to a noise floor.
  7780. The printed times and duration are expressed in seconds. The
  7781. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  7782. whose timestamp equals or exceeds the detection duration and it contains the
  7783. timestamp of the first frame of the freeze. The
  7784. @code{lavfi.freezedetect.freeze_duration} and
  7785. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  7786. after the freeze.
  7787. The filter accepts the following options:
  7788. @table @option
  7789. @item noise, n
  7790. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  7791. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  7792. 0.001.
  7793. @item duration, d
  7794. Set freeze duration until notification (default is 2 seconds).
  7795. @end table
  7796. @anchor{frei0r}
  7797. @section frei0r
  7798. Apply a frei0r effect to the input video.
  7799. To enable the compilation of this filter, you need to install the frei0r
  7800. header and configure FFmpeg with @code{--enable-frei0r}.
  7801. It accepts the following parameters:
  7802. @table @option
  7803. @item filter_name
  7804. The name of the frei0r effect to load. If the environment variable
  7805. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7806. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7807. Otherwise, the standard frei0r paths are searched, in this order:
  7808. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7809. @file{/usr/lib/frei0r-1/}.
  7810. @item filter_params
  7811. A '|'-separated list of parameters to pass to the frei0r effect.
  7812. @end table
  7813. A frei0r effect parameter can be a boolean (its value is either
  7814. "y" or "n"), a double, a color (specified as
  7815. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7816. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  7817. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  7818. a position (specified as @var{X}/@var{Y}, where
  7819. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7820. The number and types of parameters depend on the loaded effect. If an
  7821. effect parameter is not specified, the default value is set.
  7822. @subsection Examples
  7823. @itemize
  7824. @item
  7825. Apply the distort0r effect, setting the first two double parameters:
  7826. @example
  7827. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7828. @end example
  7829. @item
  7830. Apply the colordistance effect, taking a color as the first parameter:
  7831. @example
  7832. frei0r=colordistance:0.2/0.3/0.4
  7833. frei0r=colordistance:violet
  7834. frei0r=colordistance:0x112233
  7835. @end example
  7836. @item
  7837. Apply the perspective effect, specifying the top left and top right image
  7838. positions:
  7839. @example
  7840. frei0r=perspective:0.2/0.2|0.8/0.2
  7841. @end example
  7842. @end itemize
  7843. For more information, see
  7844. @url{http://frei0r.dyne.org}
  7845. @section fspp
  7846. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7847. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7848. processing filter, one of them is performed once per block, not per pixel.
  7849. This allows for much higher speed.
  7850. The filter accepts the following options:
  7851. @table @option
  7852. @item quality
  7853. Set quality. This option defines the number of levels for averaging. It accepts
  7854. an integer in the range 4-5. Default value is @code{4}.
  7855. @item qp
  7856. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7857. If not set, the filter will use the QP from the video stream (if available).
  7858. @item strength
  7859. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7860. more details but also more artifacts, while higher values make the image smoother
  7861. but also blurrier. Default value is @code{0} − PSNR optimal.
  7862. @item use_bframe_qp
  7863. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7864. option may cause flicker since the B-Frames have often larger QP. Default is
  7865. @code{0} (not enabled).
  7866. @end table
  7867. @section gblur
  7868. Apply Gaussian blur filter.
  7869. The filter accepts the following options:
  7870. @table @option
  7871. @item sigma
  7872. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7873. @item steps
  7874. Set number of steps for Gaussian approximation. Default is @code{1}.
  7875. @item planes
  7876. Set which planes to filter. By default all planes are filtered.
  7877. @item sigmaV
  7878. Set vertical sigma, if negative it will be same as @code{sigma}.
  7879. Default is @code{-1}.
  7880. @end table
  7881. @section geq
  7882. Apply generic equation to each pixel.
  7883. The filter accepts the following options:
  7884. @table @option
  7885. @item lum_expr, lum
  7886. Set the luminance expression.
  7887. @item cb_expr, cb
  7888. Set the chrominance blue expression.
  7889. @item cr_expr, cr
  7890. Set the chrominance red expression.
  7891. @item alpha_expr, a
  7892. Set the alpha expression.
  7893. @item red_expr, r
  7894. Set the red expression.
  7895. @item green_expr, g
  7896. Set the green expression.
  7897. @item blue_expr, b
  7898. Set the blue expression.
  7899. @end table
  7900. The colorspace is selected according to the specified options. If one
  7901. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7902. options is specified, the filter will automatically select a YCbCr
  7903. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7904. @option{blue_expr} options is specified, it will select an RGB
  7905. colorspace.
  7906. If one of the chrominance expression is not defined, it falls back on the other
  7907. one. If no alpha expression is specified it will evaluate to opaque value.
  7908. If none of chrominance expressions are specified, they will evaluate
  7909. to the luminance expression.
  7910. The expressions can use the following variables and functions:
  7911. @table @option
  7912. @item N
  7913. The sequential number of the filtered frame, starting from @code{0}.
  7914. @item X
  7915. @item Y
  7916. The coordinates of the current sample.
  7917. @item W
  7918. @item H
  7919. The width and height of the image.
  7920. @item SW
  7921. @item SH
  7922. Width and height scale depending on the currently filtered plane. It is the
  7923. ratio between the corresponding luma plane number of pixels and the current
  7924. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7925. @code{0.5,0.5} for chroma planes.
  7926. @item T
  7927. Time of the current frame, expressed in seconds.
  7928. @item p(x, y)
  7929. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7930. plane.
  7931. @item lum(x, y)
  7932. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7933. plane.
  7934. @item cb(x, y)
  7935. Return the value of the pixel at location (@var{x},@var{y}) of the
  7936. blue-difference chroma plane. Return 0 if there is no such plane.
  7937. @item cr(x, y)
  7938. Return the value of the pixel at location (@var{x},@var{y}) of the
  7939. red-difference chroma plane. Return 0 if there is no such plane.
  7940. @item r(x, y)
  7941. @item g(x, y)
  7942. @item b(x, y)
  7943. Return the value of the pixel at location (@var{x},@var{y}) of the
  7944. red/green/blue component. Return 0 if there is no such component.
  7945. @item alpha(x, y)
  7946. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7947. plane. Return 0 if there is no such plane.
  7948. @end table
  7949. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7950. automatically clipped to the closer edge.
  7951. @subsection Examples
  7952. @itemize
  7953. @item
  7954. Flip the image horizontally:
  7955. @example
  7956. geq=p(W-X\,Y)
  7957. @end example
  7958. @item
  7959. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7960. wavelength of 100 pixels:
  7961. @example
  7962. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7963. @end example
  7964. @item
  7965. Generate a fancy enigmatic moving light:
  7966. @example
  7967. 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
  7968. @end example
  7969. @item
  7970. Generate a quick emboss effect:
  7971. @example
  7972. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7973. @end example
  7974. @item
  7975. Modify RGB components depending on pixel position:
  7976. @example
  7977. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7978. @end example
  7979. @item
  7980. Create a radial gradient that is the same size as the input (also see
  7981. the @ref{vignette} filter):
  7982. @example
  7983. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7984. @end example
  7985. @end itemize
  7986. @section gradfun
  7987. Fix the banding artifacts that are sometimes introduced into nearly flat
  7988. regions by truncation to 8-bit color depth.
  7989. Interpolate the gradients that should go where the bands are, and
  7990. dither them.
  7991. It is designed for playback only. Do not use it prior to
  7992. lossy compression, because compression tends to lose the dither and
  7993. bring back the bands.
  7994. It accepts the following parameters:
  7995. @table @option
  7996. @item strength
  7997. The maximum amount by which the filter will change any one pixel. This is also
  7998. the threshold for detecting nearly flat regions. Acceptable values range from
  7999. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8000. valid range.
  8001. @item radius
  8002. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8003. gradients, but also prevents the filter from modifying the pixels near detailed
  8004. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8005. values will be clipped to the valid range.
  8006. @end table
  8007. Alternatively, the options can be specified as a flat string:
  8008. @var{strength}[:@var{radius}]
  8009. @subsection Examples
  8010. @itemize
  8011. @item
  8012. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8013. @example
  8014. gradfun=3.5:8
  8015. @end example
  8016. @item
  8017. Specify radius, omitting the strength (which will fall-back to the default
  8018. value):
  8019. @example
  8020. gradfun=radius=8
  8021. @end example
  8022. @end itemize
  8023. @section graphmonitor, agraphmonitor
  8024. Show various filtergraph stats.
  8025. With this filter one can debug complete filtergraph.
  8026. Especially issues with links filling with queued frames.
  8027. The filter accepts the following options:
  8028. @table @option
  8029. @item size, s
  8030. Set video output size. Default is @var{hd720}.
  8031. @item opacity, o
  8032. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8033. @item mode, m
  8034. Set output mode, can be @var{fulll} or @var{compact}.
  8035. In @var{compact} mode only filters with some queued frames have displayed stats.
  8036. @item flags, f
  8037. Set flags which enable which stats are shown in video.
  8038. Available values for flags are:
  8039. @table @samp
  8040. @item queue
  8041. Display number of queued frames in each link.
  8042. @item frame_count_in
  8043. Display number of frames taken from filter.
  8044. @item frame_count_out
  8045. Display number of frames given out from filter.
  8046. @item pts
  8047. Display current filtered frame pts.
  8048. @item time
  8049. Display current filtered frame time.
  8050. @item timebase
  8051. Display time base for filter link.
  8052. @item format
  8053. Display used format for filter link.
  8054. @item size
  8055. Display video size or number of audio channels in case of audio used by filter link.
  8056. @item rate
  8057. Display video frame rate or sample rate in case of audio used by filter link.
  8058. @end table
  8059. @item rate, r
  8060. Set upper limit for video rate of output stream, Default value is @var{25}.
  8061. This guarantee that output video frame rate will not be higher than this value.
  8062. @end table
  8063. @section greyedge
  8064. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8065. and corrects the scene colors accordingly.
  8066. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8067. The filter accepts the following options:
  8068. @table @option
  8069. @item difford
  8070. The order of differentiation to be applied on the scene. Must be chosen in the range
  8071. [0,2] and default value is 1.
  8072. @item minknorm
  8073. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8074. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8075. max value instead of calculating Minkowski distance.
  8076. @item sigma
  8077. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8078. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8079. can't be equal to 0 if @var{difford} is greater than 0.
  8080. @end table
  8081. @subsection Examples
  8082. @itemize
  8083. @item
  8084. Grey Edge:
  8085. @example
  8086. greyedge=difford=1:minknorm=5:sigma=2
  8087. @end example
  8088. @item
  8089. Max Edge:
  8090. @example
  8091. greyedge=difford=1:minknorm=0:sigma=2
  8092. @end example
  8093. @end itemize
  8094. @anchor{haldclut}
  8095. @section haldclut
  8096. Apply a Hald CLUT to a video stream.
  8097. First input is the video stream to process, and second one is the Hald CLUT.
  8098. The Hald CLUT input can be a simple picture or a complete video stream.
  8099. The filter accepts the following options:
  8100. @table @option
  8101. @item shortest
  8102. Force termination when the shortest input terminates. Default is @code{0}.
  8103. @item repeatlast
  8104. Continue applying the last CLUT after the end of the stream. A value of
  8105. @code{0} disable the filter after the last frame of the CLUT is reached.
  8106. Default is @code{1}.
  8107. @end table
  8108. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8109. filters share the same internals).
  8110. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8111. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8112. @subsection Workflow examples
  8113. @subsubsection Hald CLUT video stream
  8114. Generate an identity Hald CLUT stream altered with various effects:
  8115. @example
  8116. 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
  8117. @end example
  8118. Note: make sure you use a lossless codec.
  8119. Then use it with @code{haldclut} to apply it on some random stream:
  8120. @example
  8121. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8122. @end example
  8123. The Hald CLUT will be applied to the 10 first seconds (duration of
  8124. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8125. to the remaining frames of the @code{mandelbrot} stream.
  8126. @subsubsection Hald CLUT with preview
  8127. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8128. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8129. biggest possible square starting at the top left of the picture. The remaining
  8130. padding pixels (bottom or right) will be ignored. This area can be used to add
  8131. a preview of the Hald CLUT.
  8132. Typically, the following generated Hald CLUT will be supported by the
  8133. @code{haldclut} filter:
  8134. @example
  8135. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8136. pad=iw+320 [padded_clut];
  8137. smptebars=s=320x256, split [a][b];
  8138. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8139. [main][b] overlay=W-320" -frames:v 1 clut.png
  8140. @end example
  8141. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8142. bars are displayed on the right-top, and below the same color bars processed by
  8143. the color changes.
  8144. Then, the effect of this Hald CLUT can be visualized with:
  8145. @example
  8146. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8147. @end example
  8148. @section hflip
  8149. Flip the input video horizontally.
  8150. For example, to horizontally flip the input video with @command{ffmpeg}:
  8151. @example
  8152. ffmpeg -i in.avi -vf "hflip" out.avi
  8153. @end example
  8154. @section histeq
  8155. This filter applies a global color histogram equalization on a
  8156. per-frame basis.
  8157. It can be used to correct video that has a compressed range of pixel
  8158. intensities. The filter redistributes the pixel intensities to
  8159. equalize their distribution across the intensity range. It may be
  8160. viewed as an "automatically adjusting contrast filter". This filter is
  8161. useful only for correcting degraded or poorly captured source
  8162. video.
  8163. The filter accepts the following options:
  8164. @table @option
  8165. @item strength
  8166. Determine the amount of equalization to be applied. As the strength
  8167. is reduced, the distribution of pixel intensities more-and-more
  8168. approaches that of the input frame. The value must be a float number
  8169. in the range [0,1] and defaults to 0.200.
  8170. @item intensity
  8171. Set the maximum intensity that can generated and scale the output
  8172. values appropriately. The strength should be set as desired and then
  8173. the intensity can be limited if needed to avoid washing-out. The value
  8174. must be a float number in the range [0,1] and defaults to 0.210.
  8175. @item antibanding
  8176. Set the antibanding level. If enabled the filter will randomly vary
  8177. the luminance of output pixels by a small amount to avoid banding of
  8178. the histogram. Possible values are @code{none}, @code{weak} or
  8179. @code{strong}. It defaults to @code{none}.
  8180. @end table
  8181. @section histogram
  8182. Compute and draw a color distribution histogram for the input video.
  8183. The computed histogram is a representation of the color component
  8184. distribution in an image.
  8185. Standard histogram displays the color components distribution in an image.
  8186. Displays color graph for each color component. Shows distribution of
  8187. the Y, U, V, A or R, G, B components, depending on input format, in the
  8188. current frame. Below each graph a color component scale meter is shown.
  8189. The filter accepts the following options:
  8190. @table @option
  8191. @item level_height
  8192. Set height of level. Default value is @code{200}.
  8193. Allowed range is [50, 2048].
  8194. @item scale_height
  8195. Set height of color scale. Default value is @code{12}.
  8196. Allowed range is [0, 40].
  8197. @item display_mode
  8198. Set display mode.
  8199. It accepts the following values:
  8200. @table @samp
  8201. @item stack
  8202. Per color component graphs are placed below each other.
  8203. @item parade
  8204. Per color component graphs are placed side by side.
  8205. @item overlay
  8206. Presents information identical to that in the @code{parade}, except
  8207. that the graphs representing color components are superimposed directly
  8208. over one another.
  8209. @end table
  8210. Default is @code{stack}.
  8211. @item levels_mode
  8212. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8213. Default is @code{linear}.
  8214. @item components
  8215. Set what color components to display.
  8216. Default is @code{7}.
  8217. @item fgopacity
  8218. Set foreground opacity. Default is @code{0.7}.
  8219. @item bgopacity
  8220. Set background opacity. Default is @code{0.5}.
  8221. @end table
  8222. @subsection Examples
  8223. @itemize
  8224. @item
  8225. Calculate and draw histogram:
  8226. @example
  8227. ffplay -i input -vf histogram
  8228. @end example
  8229. @end itemize
  8230. @anchor{hqdn3d}
  8231. @section hqdn3d
  8232. This is a high precision/quality 3d denoise filter. It aims to reduce
  8233. image noise, producing smooth images and making still images really
  8234. still. It should enhance compressibility.
  8235. It accepts the following optional parameters:
  8236. @table @option
  8237. @item luma_spatial
  8238. A non-negative floating point number which specifies spatial luma strength.
  8239. It defaults to 4.0.
  8240. @item chroma_spatial
  8241. A non-negative floating point number which specifies spatial chroma strength.
  8242. It defaults to 3.0*@var{luma_spatial}/4.0.
  8243. @item luma_tmp
  8244. A floating point number which specifies luma temporal strength. It defaults to
  8245. 6.0*@var{luma_spatial}/4.0.
  8246. @item chroma_tmp
  8247. A floating point number which specifies chroma temporal strength. It defaults to
  8248. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8249. @end table
  8250. @anchor{hwdownload}
  8251. @section hwdownload
  8252. Download hardware frames to system memory.
  8253. The input must be in hardware frames, and the output a non-hardware format.
  8254. Not all formats will be supported on the output - it may be necessary to insert
  8255. an additional @option{format} filter immediately following in the graph to get
  8256. the output in a supported format.
  8257. @section hwmap
  8258. Map hardware frames to system memory or to another device.
  8259. This filter has several different modes of operation; which one is used depends
  8260. on the input and output formats:
  8261. @itemize
  8262. @item
  8263. Hardware frame input, normal frame output
  8264. Map the input frames to system memory and pass them to the output. If the
  8265. original hardware frame is later required (for example, after overlaying
  8266. something else on part of it), the @option{hwmap} filter can be used again
  8267. in the next mode to retrieve it.
  8268. @item
  8269. Normal frame input, hardware frame output
  8270. If the input is actually a software-mapped hardware frame, then unmap it -
  8271. that is, return the original hardware frame.
  8272. Otherwise, a device must be provided. Create new hardware surfaces on that
  8273. device for the output, then map them back to the software format at the input
  8274. and give those frames to the preceding filter. This will then act like the
  8275. @option{hwupload} filter, but may be able to avoid an additional copy when
  8276. the input is already in a compatible format.
  8277. @item
  8278. Hardware frame input and output
  8279. A device must be supplied for the output, either directly or with the
  8280. @option{derive_device} option. The input and output devices must be of
  8281. different types and compatible - the exact meaning of this is
  8282. system-dependent, but typically it means that they must refer to the same
  8283. underlying hardware context (for example, refer to the same graphics card).
  8284. If the input frames were originally created on the output device, then unmap
  8285. to retrieve the original frames.
  8286. Otherwise, map the frames to the output device - create new hardware frames
  8287. on the output corresponding to the frames on the input.
  8288. @end itemize
  8289. The following additional parameters are accepted:
  8290. @table @option
  8291. @item mode
  8292. Set the frame mapping mode. Some combination of:
  8293. @table @var
  8294. @item read
  8295. The mapped frame should be readable.
  8296. @item write
  8297. The mapped frame should be writeable.
  8298. @item overwrite
  8299. The mapping will always overwrite the entire frame.
  8300. This may improve performance in some cases, as the original contents of the
  8301. frame need not be loaded.
  8302. @item direct
  8303. The mapping must not involve any copying.
  8304. Indirect mappings to copies of frames are created in some cases where either
  8305. direct mapping is not possible or it would have unexpected properties.
  8306. Setting this flag ensures that the mapping is direct and will fail if that is
  8307. not possible.
  8308. @end table
  8309. Defaults to @var{read+write} if not specified.
  8310. @item derive_device @var{type}
  8311. Rather than using the device supplied at initialisation, instead derive a new
  8312. device of type @var{type} from the device the input frames exist on.
  8313. @item reverse
  8314. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8315. and map them back to the source. This may be necessary in some cases where
  8316. a mapping in one direction is required but only the opposite direction is
  8317. supported by the devices being used.
  8318. This option is dangerous - it may break the preceding filter in undefined
  8319. ways if there are any additional constraints on that filter's output.
  8320. Do not use it without fully understanding the implications of its use.
  8321. @end table
  8322. @anchor{hwupload}
  8323. @section hwupload
  8324. Upload system memory frames to hardware surfaces.
  8325. The device to upload to must be supplied when the filter is initialised. If
  8326. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8327. option.
  8328. @anchor{hwupload_cuda}
  8329. @section hwupload_cuda
  8330. Upload system memory frames to a CUDA device.
  8331. It accepts the following optional parameters:
  8332. @table @option
  8333. @item device
  8334. The number of the CUDA device to use
  8335. @end table
  8336. @section hqx
  8337. Apply a high-quality magnification filter designed for pixel art. This filter
  8338. was originally created by Maxim Stepin.
  8339. It accepts the following option:
  8340. @table @option
  8341. @item n
  8342. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8343. @code{hq3x} and @code{4} for @code{hq4x}.
  8344. Default is @code{3}.
  8345. @end table
  8346. @section hstack
  8347. Stack input videos horizontally.
  8348. All streams must be of same pixel format and of same height.
  8349. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8350. to create same output.
  8351. The filter accept the following option:
  8352. @table @option
  8353. @item inputs
  8354. Set number of input streams. Default is 2.
  8355. @item shortest
  8356. If set to 1, force the output to terminate when the shortest input
  8357. terminates. Default value is 0.
  8358. @end table
  8359. @section hue
  8360. Modify the hue and/or the saturation of the input.
  8361. It accepts the following parameters:
  8362. @table @option
  8363. @item h
  8364. Specify the hue angle as a number of degrees. It accepts an expression,
  8365. and defaults to "0".
  8366. @item s
  8367. Specify the saturation in the [-10,10] range. It accepts an expression and
  8368. defaults to "1".
  8369. @item H
  8370. Specify the hue angle as a number of radians. It accepts an
  8371. expression, and defaults to "0".
  8372. @item b
  8373. Specify the brightness in the [-10,10] range. It accepts an expression and
  8374. defaults to "0".
  8375. @end table
  8376. @option{h} and @option{H} are mutually exclusive, and can't be
  8377. specified at the same time.
  8378. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8379. expressions containing the following constants:
  8380. @table @option
  8381. @item n
  8382. frame count of the input frame starting from 0
  8383. @item pts
  8384. presentation timestamp of the input frame expressed in time base units
  8385. @item r
  8386. frame rate of the input video, NAN if the input frame rate is unknown
  8387. @item t
  8388. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8389. @item tb
  8390. time base of the input video
  8391. @end table
  8392. @subsection Examples
  8393. @itemize
  8394. @item
  8395. Set the hue to 90 degrees and the saturation to 1.0:
  8396. @example
  8397. hue=h=90:s=1
  8398. @end example
  8399. @item
  8400. Same command but expressing the hue in radians:
  8401. @example
  8402. hue=H=PI/2:s=1
  8403. @end example
  8404. @item
  8405. Rotate hue and make the saturation swing between 0
  8406. and 2 over a period of 1 second:
  8407. @example
  8408. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8409. @end example
  8410. @item
  8411. Apply a 3 seconds saturation fade-in effect starting at 0:
  8412. @example
  8413. hue="s=min(t/3\,1)"
  8414. @end example
  8415. The general fade-in expression can be written as:
  8416. @example
  8417. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8418. @end example
  8419. @item
  8420. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8421. @example
  8422. hue="s=max(0\, min(1\, (8-t)/3))"
  8423. @end example
  8424. The general fade-out expression can be written as:
  8425. @example
  8426. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8427. @end example
  8428. @end itemize
  8429. @subsection Commands
  8430. This filter supports the following commands:
  8431. @table @option
  8432. @item b
  8433. @item s
  8434. @item h
  8435. @item H
  8436. Modify the hue and/or the saturation and/or brightness of the input video.
  8437. The command accepts the same syntax of the corresponding option.
  8438. If the specified expression is not valid, it is kept at its current
  8439. value.
  8440. @end table
  8441. @section hysteresis
  8442. Grow first stream into second stream by connecting components.
  8443. This makes it possible to build more robust edge masks.
  8444. This filter accepts the following options:
  8445. @table @option
  8446. @item planes
  8447. Set which planes will be processed as bitmap, unprocessed planes will be
  8448. copied from first stream.
  8449. By default value 0xf, all planes will be processed.
  8450. @item threshold
  8451. Set threshold which is used in filtering. If pixel component value is higher than
  8452. this value filter algorithm for connecting components is activated.
  8453. By default value is 0.
  8454. @end table
  8455. @section idet
  8456. Detect video interlacing type.
  8457. This filter tries to detect if the input frames are interlaced, progressive,
  8458. top or bottom field first. It will also try to detect fields that are
  8459. repeated between adjacent frames (a sign of telecine).
  8460. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8461. Multiple frame detection incorporates the classification history of previous frames.
  8462. The filter will log these metadata values:
  8463. @table @option
  8464. @item single.current_frame
  8465. Detected type of current frame using single-frame detection. One of:
  8466. ``tff'' (top field first), ``bff'' (bottom field first),
  8467. ``progressive'', or ``undetermined''
  8468. @item single.tff
  8469. Cumulative number of frames detected as top field first using single-frame detection.
  8470. @item multiple.tff
  8471. Cumulative number of frames detected as top field first using multiple-frame detection.
  8472. @item single.bff
  8473. Cumulative number of frames detected as bottom field first using single-frame detection.
  8474. @item multiple.current_frame
  8475. Detected type of current frame using multiple-frame detection. One of:
  8476. ``tff'' (top field first), ``bff'' (bottom field first),
  8477. ``progressive'', or ``undetermined''
  8478. @item multiple.bff
  8479. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8480. @item single.progressive
  8481. Cumulative number of frames detected as progressive using single-frame detection.
  8482. @item multiple.progressive
  8483. Cumulative number of frames detected as progressive using multiple-frame detection.
  8484. @item single.undetermined
  8485. Cumulative number of frames that could not be classified using single-frame detection.
  8486. @item multiple.undetermined
  8487. Cumulative number of frames that could not be classified using multiple-frame detection.
  8488. @item repeated.current_frame
  8489. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8490. @item repeated.neither
  8491. Cumulative number of frames with no repeated field.
  8492. @item repeated.top
  8493. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8494. @item repeated.bottom
  8495. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8496. @end table
  8497. The filter accepts the following options:
  8498. @table @option
  8499. @item intl_thres
  8500. Set interlacing threshold.
  8501. @item prog_thres
  8502. Set progressive threshold.
  8503. @item rep_thres
  8504. Threshold for repeated field detection.
  8505. @item half_life
  8506. Number of frames after which a given frame's contribution to the
  8507. statistics is halved (i.e., it contributes only 0.5 to its
  8508. classification). The default of 0 means that all frames seen are given
  8509. full weight of 1.0 forever.
  8510. @item analyze_interlaced_flag
  8511. When this is not 0 then idet will use the specified number of frames to determine
  8512. if the interlaced flag is accurate, it will not count undetermined frames.
  8513. If the flag is found to be accurate it will be used without any further
  8514. computations, if it is found to be inaccurate it will be cleared without any
  8515. further computations. This allows inserting the idet filter as a low computational
  8516. method to clean up the interlaced flag
  8517. @end table
  8518. @section il
  8519. Deinterleave or interleave fields.
  8520. This filter allows one to process interlaced images fields without
  8521. deinterlacing them. Deinterleaving splits the input frame into 2
  8522. fields (so called half pictures). Odd lines are moved to the top
  8523. half of the output image, even lines to the bottom half.
  8524. You can process (filter) them independently and then re-interleave them.
  8525. The filter accepts the following options:
  8526. @table @option
  8527. @item luma_mode, l
  8528. @item chroma_mode, c
  8529. @item alpha_mode, a
  8530. Available values for @var{luma_mode}, @var{chroma_mode} and
  8531. @var{alpha_mode} are:
  8532. @table @samp
  8533. @item none
  8534. Do nothing.
  8535. @item deinterleave, d
  8536. Deinterleave fields, placing one above the other.
  8537. @item interleave, i
  8538. Interleave fields. Reverse the effect of deinterleaving.
  8539. @end table
  8540. Default value is @code{none}.
  8541. @item luma_swap, ls
  8542. @item chroma_swap, cs
  8543. @item alpha_swap, as
  8544. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  8545. @end table
  8546. @section inflate
  8547. Apply inflate effect to the video.
  8548. This filter replaces the pixel by the local(3x3) average by taking into account
  8549. only values higher than the pixel.
  8550. It accepts the following options:
  8551. @table @option
  8552. @item threshold0
  8553. @item threshold1
  8554. @item threshold2
  8555. @item threshold3
  8556. Limit the maximum change for each plane, default is 65535.
  8557. If 0, plane will remain unchanged.
  8558. @end table
  8559. @section interlace
  8560. Simple interlacing filter from progressive contents. This interleaves upper (or
  8561. lower) lines from odd frames with lower (or upper) lines from even frames,
  8562. halving the frame rate and preserving image height.
  8563. @example
  8564. Original Original New Frame
  8565. Frame 'j' Frame 'j+1' (tff)
  8566. ========== =========== ==================
  8567. Line 0 --------------------> Frame 'j' Line 0
  8568. Line 1 Line 1 ----> Frame 'j+1' Line 1
  8569. Line 2 ---------------------> Frame 'j' Line 2
  8570. Line 3 Line 3 ----> Frame 'j+1' Line 3
  8571. ... ... ...
  8572. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  8573. @end example
  8574. It accepts the following optional parameters:
  8575. @table @option
  8576. @item scan
  8577. This determines whether the interlaced frame is taken from the even
  8578. (tff - default) or odd (bff) lines of the progressive frame.
  8579. @item lowpass
  8580. Vertical lowpass filter to avoid twitter interlacing and
  8581. reduce moire patterns.
  8582. @table @samp
  8583. @item 0, off
  8584. Disable vertical lowpass filter
  8585. @item 1, linear
  8586. Enable linear filter (default)
  8587. @item 2, complex
  8588. Enable complex filter. This will slightly less reduce twitter and moire
  8589. but better retain detail and subjective sharpness impression.
  8590. @end table
  8591. @end table
  8592. @section kerndeint
  8593. Deinterlace input video by applying Donald Graft's adaptive kernel
  8594. deinterling. Work on interlaced parts of a video to produce
  8595. progressive frames.
  8596. The description of the accepted parameters follows.
  8597. @table @option
  8598. @item thresh
  8599. Set the threshold which affects the filter's tolerance when
  8600. determining if a pixel line must be processed. It must be an integer
  8601. in the range [0,255] and defaults to 10. A value of 0 will result in
  8602. applying the process on every pixels.
  8603. @item map
  8604. Paint pixels exceeding the threshold value to white if set to 1.
  8605. Default is 0.
  8606. @item order
  8607. Set the fields order. Swap fields if set to 1, leave fields alone if
  8608. 0. Default is 0.
  8609. @item sharp
  8610. Enable additional sharpening if set to 1. Default is 0.
  8611. @item twoway
  8612. Enable twoway sharpening if set to 1. Default is 0.
  8613. @end table
  8614. @subsection Examples
  8615. @itemize
  8616. @item
  8617. Apply default values:
  8618. @example
  8619. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  8620. @end example
  8621. @item
  8622. Enable additional sharpening:
  8623. @example
  8624. kerndeint=sharp=1
  8625. @end example
  8626. @item
  8627. Paint processed pixels in white:
  8628. @example
  8629. kerndeint=map=1
  8630. @end example
  8631. @end itemize
  8632. @section lenscorrection
  8633. Correct radial lens distortion
  8634. This filter can be used to correct for radial distortion as can result from the use
  8635. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  8636. one can use tools available for example as part of opencv or simply trial-and-error.
  8637. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  8638. and extract the k1 and k2 coefficients from the resulting matrix.
  8639. Note that effectively the same filter is available in the open-source tools Krita and
  8640. Digikam from the KDE project.
  8641. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  8642. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  8643. brightness distribution, so you may want to use both filters together in certain
  8644. cases, though you will have to take care of ordering, i.e. whether vignetting should
  8645. be applied before or after lens correction.
  8646. @subsection Options
  8647. The filter accepts the following options:
  8648. @table @option
  8649. @item cx
  8650. Relative x-coordinate of the focal point of the image, and thereby the center of the
  8651. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8652. width. Default is 0.5.
  8653. @item cy
  8654. Relative y-coordinate of the focal point of the image, and thereby the center of the
  8655. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8656. height. Default is 0.5.
  8657. @item k1
  8658. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  8659. no correction. Default is 0.
  8660. @item k2
  8661. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  8662. 0 means no correction. Default is 0.
  8663. @end table
  8664. The formula that generates the correction is:
  8665. @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)
  8666. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  8667. distances from the focal point in the source and target images, respectively.
  8668. @section lensfun
  8669. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  8670. The @code{lensfun} filter requires the camera make, camera model, and lens model
  8671. to apply the lens correction. The filter will load the lensfun database and
  8672. query it to find the corresponding camera and lens entries in the database. As
  8673. long as these entries can be found with the given options, the filter can
  8674. perform corrections on frames. Note that incomplete strings will result in the
  8675. filter choosing the best match with the given options, and the filter will
  8676. output the chosen camera and lens models (logged with level "info"). You must
  8677. provide the make, camera model, and lens model as they are required.
  8678. The filter accepts the following options:
  8679. @table @option
  8680. @item make
  8681. The make of the camera (for example, "Canon"). This option is required.
  8682. @item model
  8683. The model of the camera (for example, "Canon EOS 100D"). This option is
  8684. required.
  8685. @item lens_model
  8686. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  8687. option is required.
  8688. @item mode
  8689. The type of correction to apply. The following values are valid options:
  8690. @table @samp
  8691. @item vignetting
  8692. Enables fixing lens vignetting.
  8693. @item geometry
  8694. Enables fixing lens geometry. This is the default.
  8695. @item subpixel
  8696. Enables fixing chromatic aberrations.
  8697. @item vig_geo
  8698. Enables fixing lens vignetting and lens geometry.
  8699. @item vig_subpixel
  8700. Enables fixing lens vignetting and chromatic aberrations.
  8701. @item distortion
  8702. Enables fixing both lens geometry and chromatic aberrations.
  8703. @item all
  8704. Enables all possible corrections.
  8705. @end table
  8706. @item focal_length
  8707. The focal length of the image/video (zoom; expected constant for video). For
  8708. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  8709. range should be chosen when using that lens. Default 18.
  8710. @item aperture
  8711. The aperture of the image/video (expected constant for video). Note that
  8712. aperture is only used for vignetting correction. Default 3.5.
  8713. @item focus_distance
  8714. The focus distance of the image/video (expected constant for video). Note that
  8715. focus distance is only used for vignetting and only slightly affects the
  8716. vignetting correction process. If unknown, leave it at the default value (which
  8717. is 1000).
  8718. @item target_geometry
  8719. The target geometry of the output image/video. The following values are valid
  8720. options:
  8721. @table @samp
  8722. @item rectilinear (default)
  8723. @item fisheye
  8724. @item panoramic
  8725. @item equirectangular
  8726. @item fisheye_orthographic
  8727. @item fisheye_stereographic
  8728. @item fisheye_equisolid
  8729. @item fisheye_thoby
  8730. @end table
  8731. @item reverse
  8732. Apply the reverse of image correction (instead of correcting distortion, apply
  8733. it).
  8734. @item interpolation
  8735. The type of interpolation used when correcting distortion. The following values
  8736. are valid options:
  8737. @table @samp
  8738. @item nearest
  8739. @item linear (default)
  8740. @item lanczos
  8741. @end table
  8742. @end table
  8743. @subsection Examples
  8744. @itemize
  8745. @item
  8746. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  8747. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  8748. aperture of "8.0".
  8749. @example
  8750. ffmpeg -i input.mov -vf lensfun=make=Canon:model="Canon EOS 100D":lens_model="Canon EF-S 18-55mm f/3.5-5.6 IS STM":focal_length=18:aperture=8 -c:v h264 -b:v 8000k output.mov
  8751. @end example
  8752. @item
  8753. Apply the same as before, but only for the first 5 seconds of video.
  8754. @example
  8755. ffmpeg -i input.mov -vf lensfun=make=Canon:model="Canon EOS 100D":lens_model="Canon EF-S 18-55mm f/3.5-5.6 IS STM":focal_length=18:aperture=8:enable='lte(t\,5)' -c:v h264 -b:v 8000k output.mov
  8756. @end example
  8757. @end itemize
  8758. @section libvmaf
  8759. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  8760. score between two input videos.
  8761. The obtained VMAF score is printed through the logging system.
  8762. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  8763. After installing the library it can be enabled using:
  8764. @code{./configure --enable-libvmaf --enable-version3}.
  8765. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  8766. The filter has following options:
  8767. @table @option
  8768. @item model_path
  8769. Set the model path which is to be used for SVM.
  8770. Default value: @code{"vmaf_v0.6.1.pkl"}
  8771. @item log_path
  8772. Set the file path to be used to store logs.
  8773. @item log_fmt
  8774. Set the format of the log file (xml or json).
  8775. @item enable_transform
  8776. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  8777. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  8778. Default value: @code{false}
  8779. @item phone_model
  8780. Invokes the phone model which will generate VMAF scores higher than in the
  8781. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  8782. @item psnr
  8783. Enables computing psnr along with vmaf.
  8784. @item ssim
  8785. Enables computing ssim along with vmaf.
  8786. @item ms_ssim
  8787. Enables computing ms_ssim along with vmaf.
  8788. @item pool
  8789. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  8790. @item n_threads
  8791. Set number of threads to be used when computing vmaf.
  8792. @item n_subsample
  8793. Set interval for frame subsampling used when computing vmaf.
  8794. @item enable_conf_interval
  8795. Enables confidence interval.
  8796. @end table
  8797. This filter also supports the @ref{framesync} options.
  8798. On the below examples the input file @file{main.mpg} being processed is
  8799. compared with the reference file @file{ref.mpg}.
  8800. @example
  8801. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  8802. @end example
  8803. Example with options:
  8804. @example
  8805. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  8806. @end example
  8807. @section limiter
  8808. Limits the pixel components values to the specified range [min, max].
  8809. The filter accepts the following options:
  8810. @table @option
  8811. @item min
  8812. Lower bound. Defaults to the lowest allowed value for the input.
  8813. @item max
  8814. Upper bound. Defaults to the highest allowed value for the input.
  8815. @item planes
  8816. Specify which planes will be processed. Defaults to all available.
  8817. @end table
  8818. @section loop
  8819. Loop video frames.
  8820. The filter accepts the following options:
  8821. @table @option
  8822. @item loop
  8823. Set the number of loops. Setting this value to -1 will result in infinite loops.
  8824. Default is 0.
  8825. @item size
  8826. Set maximal size in number of frames. Default is 0.
  8827. @item start
  8828. Set first frame of loop. Default is 0.
  8829. @end table
  8830. @subsection Examples
  8831. @itemize
  8832. @item
  8833. Loop single first frame infinitely:
  8834. @example
  8835. loop=loop=-1:size=1:start=0
  8836. @end example
  8837. @item
  8838. Loop single first frame 10 times:
  8839. @example
  8840. loop=loop=10:size=1:start=0
  8841. @end example
  8842. @item
  8843. Loop 10 first frames 5 times:
  8844. @example
  8845. loop=loop=5:size=10:start=0
  8846. @end example
  8847. @end itemize
  8848. @section lut1d
  8849. Apply a 1D LUT to an input video.
  8850. The filter accepts the following options:
  8851. @table @option
  8852. @item file
  8853. Set the 1D LUT file name.
  8854. Currently supported formats:
  8855. @table @samp
  8856. @item cube
  8857. Iridas
  8858. @end table
  8859. @item interp
  8860. Select interpolation mode.
  8861. Available values are:
  8862. @table @samp
  8863. @item nearest
  8864. Use values from the nearest defined point.
  8865. @item linear
  8866. Interpolate values using the linear interpolation.
  8867. @item cosine
  8868. Interpolate values using the cosine interpolation.
  8869. @item cubic
  8870. Interpolate values using the cubic interpolation.
  8871. @item spline
  8872. Interpolate values using the spline interpolation.
  8873. @end table
  8874. @end table
  8875. @anchor{lut3d}
  8876. @section lut3d
  8877. Apply a 3D LUT to an input video.
  8878. The filter accepts the following options:
  8879. @table @option
  8880. @item file
  8881. Set the 3D LUT file name.
  8882. Currently supported formats:
  8883. @table @samp
  8884. @item 3dl
  8885. AfterEffects
  8886. @item cube
  8887. Iridas
  8888. @item dat
  8889. DaVinci
  8890. @item m3d
  8891. Pandora
  8892. @end table
  8893. @item interp
  8894. Select interpolation mode.
  8895. Available values are:
  8896. @table @samp
  8897. @item nearest
  8898. Use values from the nearest defined point.
  8899. @item trilinear
  8900. Interpolate values using the 8 points defining a cube.
  8901. @item tetrahedral
  8902. Interpolate values using a tetrahedron.
  8903. @end table
  8904. @end table
  8905. This filter also supports the @ref{framesync} options.
  8906. @section lumakey
  8907. Turn certain luma values into transparency.
  8908. The filter accepts the following options:
  8909. @table @option
  8910. @item threshold
  8911. Set the luma which will be used as base for transparency.
  8912. Default value is @code{0}.
  8913. @item tolerance
  8914. Set the range of luma values to be keyed out.
  8915. Default value is @code{0}.
  8916. @item softness
  8917. Set the range of softness. Default value is @code{0}.
  8918. Use this to control gradual transition from zero to full transparency.
  8919. @end table
  8920. @section lut, lutrgb, lutyuv
  8921. Compute a look-up table for binding each pixel component input value
  8922. to an output value, and apply it to the input video.
  8923. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  8924. to an RGB input video.
  8925. These filters accept the following parameters:
  8926. @table @option
  8927. @item c0
  8928. set first pixel component expression
  8929. @item c1
  8930. set second pixel component expression
  8931. @item c2
  8932. set third pixel component expression
  8933. @item c3
  8934. set fourth pixel component expression, corresponds to the alpha component
  8935. @item r
  8936. set red component expression
  8937. @item g
  8938. set green component expression
  8939. @item b
  8940. set blue component expression
  8941. @item a
  8942. alpha component expression
  8943. @item y
  8944. set Y/luminance component expression
  8945. @item u
  8946. set U/Cb component expression
  8947. @item v
  8948. set V/Cr component expression
  8949. @end table
  8950. Each of them specifies the expression to use for computing the lookup table for
  8951. the corresponding pixel component values.
  8952. The exact component associated to each of the @var{c*} options depends on the
  8953. format in input.
  8954. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  8955. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  8956. The expressions can contain the following constants and functions:
  8957. @table @option
  8958. @item w
  8959. @item h
  8960. The input width and height.
  8961. @item val
  8962. The input value for the pixel component.
  8963. @item clipval
  8964. The input value, clipped to the @var{minval}-@var{maxval} range.
  8965. @item maxval
  8966. The maximum value for the pixel component.
  8967. @item minval
  8968. The minimum value for the pixel component.
  8969. @item negval
  8970. The negated value for the pixel component value, clipped to the
  8971. @var{minval}-@var{maxval} range; it corresponds to the expression
  8972. "maxval-clipval+minval".
  8973. @item clip(val)
  8974. The computed value in @var{val}, clipped to the
  8975. @var{minval}-@var{maxval} range.
  8976. @item gammaval(gamma)
  8977. The computed gamma correction value of the pixel component value,
  8978. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  8979. expression
  8980. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  8981. @end table
  8982. All expressions default to "val".
  8983. @subsection Examples
  8984. @itemize
  8985. @item
  8986. Negate input video:
  8987. @example
  8988. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  8989. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  8990. @end example
  8991. The above is the same as:
  8992. @example
  8993. lutrgb="r=negval:g=negval:b=negval"
  8994. lutyuv="y=negval:u=negval:v=negval"
  8995. @end example
  8996. @item
  8997. Negate luminance:
  8998. @example
  8999. lutyuv=y=negval
  9000. @end example
  9001. @item
  9002. Remove chroma components, turning the video into a graytone image:
  9003. @example
  9004. lutyuv="u=128:v=128"
  9005. @end example
  9006. @item
  9007. Apply a luma burning effect:
  9008. @example
  9009. lutyuv="y=2*val"
  9010. @end example
  9011. @item
  9012. Remove green and blue components:
  9013. @example
  9014. lutrgb="g=0:b=0"
  9015. @end example
  9016. @item
  9017. Set a constant alpha channel value on input:
  9018. @example
  9019. format=rgba,lutrgb=a="maxval-minval/2"
  9020. @end example
  9021. @item
  9022. Correct luminance gamma by a factor of 0.5:
  9023. @example
  9024. lutyuv=y=gammaval(0.5)
  9025. @end example
  9026. @item
  9027. Discard least significant bits of luma:
  9028. @example
  9029. lutyuv=y='bitand(val, 128+64+32)'
  9030. @end example
  9031. @item
  9032. Technicolor like effect:
  9033. @example
  9034. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9035. @end example
  9036. @end itemize
  9037. @section lut2, tlut2
  9038. The @code{lut2} filter takes two input streams and outputs one
  9039. stream.
  9040. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9041. from one single stream.
  9042. This filter accepts the following parameters:
  9043. @table @option
  9044. @item c0
  9045. set first pixel component expression
  9046. @item c1
  9047. set second pixel component expression
  9048. @item c2
  9049. set third pixel component expression
  9050. @item c3
  9051. set fourth pixel component expression, corresponds to the alpha component
  9052. @item d
  9053. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9054. which means bit depth is automatically picked from first input format.
  9055. @end table
  9056. Each of them specifies the expression to use for computing the lookup table for
  9057. the corresponding pixel component values.
  9058. The exact component associated to each of the @var{c*} options depends on the
  9059. format in inputs.
  9060. The expressions can contain the following constants:
  9061. @table @option
  9062. @item w
  9063. @item h
  9064. The input width and height.
  9065. @item x
  9066. The first input value for the pixel component.
  9067. @item y
  9068. The second input value for the pixel component.
  9069. @item bdx
  9070. The first input video bit depth.
  9071. @item bdy
  9072. The second input video bit depth.
  9073. @end table
  9074. All expressions default to "x".
  9075. @subsection Examples
  9076. @itemize
  9077. @item
  9078. Highlight differences between two RGB video streams:
  9079. @example
  9080. 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)'
  9081. @end example
  9082. @item
  9083. Highlight differences between two YUV video streams:
  9084. @example
  9085. 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)'
  9086. @end example
  9087. @item
  9088. Show max difference between two video streams:
  9089. @example
  9090. 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)))'
  9091. @end example
  9092. @end itemize
  9093. @section maskedclamp
  9094. Clamp the first input stream with the second input and third input stream.
  9095. Returns the value of first stream to be between second input
  9096. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9097. This filter accepts the following options:
  9098. @table @option
  9099. @item undershoot
  9100. Default value is @code{0}.
  9101. @item overshoot
  9102. Default value is @code{0}.
  9103. @item planes
  9104. Set which planes will be processed as bitmap, unprocessed planes will be
  9105. copied from first stream.
  9106. By default value 0xf, all planes will be processed.
  9107. @end table
  9108. @section maskedmerge
  9109. Merge the first input stream with the second input stream using per pixel
  9110. weights in the third input stream.
  9111. A value of 0 in the third stream pixel component means that pixel component
  9112. from first stream is returned unchanged, while maximum value (eg. 255 for
  9113. 8-bit videos) means that pixel component from second stream is returned
  9114. unchanged. Intermediate values define the amount of merging between both
  9115. input stream's pixel components.
  9116. This filter accepts the following options:
  9117. @table @option
  9118. @item planes
  9119. Set which planes will be processed as bitmap, unprocessed planes will be
  9120. copied from first stream.
  9121. By default value 0xf, all planes will be processed.
  9122. @end table
  9123. @section maskfun
  9124. Create mask from input video.
  9125. For example it is useful to create motion masks after @code{tblend} filter.
  9126. This filter accepts the following options:
  9127. @table @option
  9128. @item low
  9129. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  9130. @item high
  9131. Set high threshold. Any pixel component higher than this value will be set to max value
  9132. allowed for current pixel format.
  9133. @item planes
  9134. Set planes to filter, by default all available planes are filtered.
  9135. @item fill
  9136. Fill all frame pixels with this value.
  9137. @item sum
  9138. Set max average pixel value for frame. If sum of all pixel components is higher that this
  9139. average, output frame will be completely filled with value set by @var{fill} option.
  9140. Typically useful for scene changes when used in combination with @code{tblend} filter.
  9141. @end table
  9142. @section mcdeint
  9143. Apply motion-compensation deinterlacing.
  9144. It needs one field per frame as input and must thus be used together
  9145. with yadif=1/3 or equivalent.
  9146. This filter accepts the following options:
  9147. @table @option
  9148. @item mode
  9149. Set the deinterlacing mode.
  9150. It accepts one of the following values:
  9151. @table @samp
  9152. @item fast
  9153. @item medium
  9154. @item slow
  9155. use iterative motion estimation
  9156. @item extra_slow
  9157. like @samp{slow}, but use multiple reference frames.
  9158. @end table
  9159. Default value is @samp{fast}.
  9160. @item parity
  9161. Set the picture field parity assumed for the input video. It must be
  9162. one of the following values:
  9163. @table @samp
  9164. @item 0, tff
  9165. assume top field first
  9166. @item 1, bff
  9167. assume bottom field first
  9168. @end table
  9169. Default value is @samp{bff}.
  9170. @item qp
  9171. Set per-block quantization parameter (QP) used by the internal
  9172. encoder.
  9173. Higher values should result in a smoother motion vector field but less
  9174. optimal individual vectors. Default value is 1.
  9175. @end table
  9176. @section mergeplanes
  9177. Merge color channel components from several video streams.
  9178. The filter accepts up to 4 input streams, and merge selected input
  9179. planes to the output video.
  9180. This filter accepts the following options:
  9181. @table @option
  9182. @item mapping
  9183. Set input to output plane mapping. Default is @code{0}.
  9184. The mappings is specified as a bitmap. It should be specified as a
  9185. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  9186. mapping for the first plane of the output stream. 'A' sets the number of
  9187. the input stream to use (from 0 to 3), and 'a' the plane number of the
  9188. corresponding input to use (from 0 to 3). The rest of the mappings is
  9189. similar, 'Bb' describes the mapping for the output stream second
  9190. plane, 'Cc' describes the mapping for the output stream third plane and
  9191. 'Dd' describes the mapping for the output stream fourth plane.
  9192. @item format
  9193. Set output pixel format. Default is @code{yuva444p}.
  9194. @end table
  9195. @subsection Examples
  9196. @itemize
  9197. @item
  9198. Merge three gray video streams of same width and height into single video stream:
  9199. @example
  9200. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  9201. @end example
  9202. @item
  9203. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  9204. @example
  9205. [a0][a1]mergeplanes=0x00010210:yuva444p
  9206. @end example
  9207. @item
  9208. Swap Y and A plane in yuva444p stream:
  9209. @example
  9210. format=yuva444p,mergeplanes=0x03010200:yuva444p
  9211. @end example
  9212. @item
  9213. Swap U and V plane in yuv420p stream:
  9214. @example
  9215. format=yuv420p,mergeplanes=0x000201:yuv420p
  9216. @end example
  9217. @item
  9218. Cast a rgb24 clip to yuv444p:
  9219. @example
  9220. format=rgb24,mergeplanes=0x000102:yuv444p
  9221. @end example
  9222. @end itemize
  9223. @section mestimate
  9224. Estimate and export motion vectors using block matching algorithms.
  9225. Motion vectors are stored in frame side data to be used by other filters.
  9226. This filter accepts the following options:
  9227. @table @option
  9228. @item method
  9229. Specify the motion estimation method. Accepts one of the following values:
  9230. @table @samp
  9231. @item esa
  9232. Exhaustive search algorithm.
  9233. @item tss
  9234. Three step search algorithm.
  9235. @item tdls
  9236. Two dimensional logarithmic search algorithm.
  9237. @item ntss
  9238. New three step search algorithm.
  9239. @item fss
  9240. Four step search algorithm.
  9241. @item ds
  9242. Diamond search algorithm.
  9243. @item hexbs
  9244. Hexagon-based search algorithm.
  9245. @item epzs
  9246. Enhanced predictive zonal search algorithm.
  9247. @item umh
  9248. Uneven multi-hexagon search algorithm.
  9249. @end table
  9250. Default value is @samp{esa}.
  9251. @item mb_size
  9252. Macroblock size. Default @code{16}.
  9253. @item search_param
  9254. Search parameter. Default @code{7}.
  9255. @end table
  9256. @section midequalizer
  9257. Apply Midway Image Equalization effect using two video streams.
  9258. Midway Image Equalization adjusts a pair of images to have the same
  9259. histogram, while maintaining their dynamics as much as possible. It's
  9260. useful for e.g. matching exposures from a pair of stereo cameras.
  9261. This filter has two inputs and one output, which must be of same pixel format, but
  9262. may be of different sizes. The output of filter is first input adjusted with
  9263. midway histogram of both inputs.
  9264. This filter accepts the following option:
  9265. @table @option
  9266. @item planes
  9267. Set which planes to process. Default is @code{15}, which is all available planes.
  9268. @end table
  9269. @section minterpolate
  9270. Convert the video to specified frame rate using motion interpolation.
  9271. This filter accepts the following options:
  9272. @table @option
  9273. @item fps
  9274. 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}.
  9275. @item mi_mode
  9276. Motion interpolation mode. Following values are accepted:
  9277. @table @samp
  9278. @item dup
  9279. Duplicate previous or next frame for interpolating new ones.
  9280. @item blend
  9281. Blend source frames. Interpolated frame is mean of previous and next frames.
  9282. @item mci
  9283. Motion compensated interpolation. Following options are effective when this mode is selected:
  9284. @table @samp
  9285. @item mc_mode
  9286. Motion compensation mode. Following values are accepted:
  9287. @table @samp
  9288. @item obmc
  9289. Overlapped block motion compensation.
  9290. @item aobmc
  9291. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  9292. @end table
  9293. Default mode is @samp{obmc}.
  9294. @item me_mode
  9295. Motion estimation mode. Following values are accepted:
  9296. @table @samp
  9297. @item bidir
  9298. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  9299. @item bilat
  9300. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  9301. @end table
  9302. Default mode is @samp{bilat}.
  9303. @item me
  9304. The algorithm to be used for motion estimation. Following values are accepted:
  9305. @table @samp
  9306. @item esa
  9307. Exhaustive search algorithm.
  9308. @item tss
  9309. Three step search algorithm.
  9310. @item tdls
  9311. Two dimensional logarithmic search algorithm.
  9312. @item ntss
  9313. New three step search algorithm.
  9314. @item fss
  9315. Four step search algorithm.
  9316. @item ds
  9317. Diamond search algorithm.
  9318. @item hexbs
  9319. Hexagon-based search algorithm.
  9320. @item epzs
  9321. Enhanced predictive zonal search algorithm.
  9322. @item umh
  9323. Uneven multi-hexagon search algorithm.
  9324. @end table
  9325. Default algorithm is @samp{epzs}.
  9326. @item mb_size
  9327. Macroblock size. Default @code{16}.
  9328. @item search_param
  9329. Motion estimation search parameter. Default @code{32}.
  9330. @item vsbmc
  9331. 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).
  9332. @end table
  9333. @end table
  9334. @item scd
  9335. 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:
  9336. @table @samp
  9337. @item none
  9338. Disable scene change detection.
  9339. @item fdiff
  9340. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  9341. @end table
  9342. Default method is @samp{fdiff}.
  9343. @item scd_threshold
  9344. Scene change detection threshold. Default is @code{5.0}.
  9345. @end table
  9346. @section mix
  9347. Mix several video input streams into one video stream.
  9348. A description of the accepted options follows.
  9349. @table @option
  9350. @item nb_inputs
  9351. The number of inputs. If unspecified, it defaults to 2.
  9352. @item weights
  9353. Specify weight of each input video stream as sequence.
  9354. Each weight is separated by space. If number of weights
  9355. is smaller than number of @var{frames} last specified
  9356. weight will be used for all remaining unset weights.
  9357. @item scale
  9358. Specify scale, if it is set it will be multiplied with sum
  9359. of each weight multiplied with pixel values to give final destination
  9360. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9361. @item duration
  9362. Specify how end of stream is determined.
  9363. @table @samp
  9364. @item longest
  9365. The duration of the longest input. (default)
  9366. @item shortest
  9367. The duration of the shortest input.
  9368. @item first
  9369. The duration of the first input.
  9370. @end table
  9371. @end table
  9372. @section mpdecimate
  9373. Drop frames that do not differ greatly from the previous frame in
  9374. order to reduce frame rate.
  9375. The main use of this filter is for very-low-bitrate encoding
  9376. (e.g. streaming over dialup modem), but it could in theory be used for
  9377. fixing movies that were inverse-telecined incorrectly.
  9378. A description of the accepted options follows.
  9379. @table @option
  9380. @item max
  9381. Set the maximum number of consecutive frames which can be dropped (if
  9382. positive), or the minimum interval between dropped frames (if
  9383. negative). If the value is 0, the frame is dropped disregarding the
  9384. number of previous sequentially dropped frames.
  9385. Default value is 0.
  9386. @item hi
  9387. @item lo
  9388. @item frac
  9389. Set the dropping threshold values.
  9390. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9391. represent actual pixel value differences, so a threshold of 64
  9392. corresponds to 1 unit of difference for each pixel, or the same spread
  9393. out differently over the block.
  9394. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9395. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9396. meaning the whole image) differ by more than a threshold of @option{lo}.
  9397. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9398. 64*5, and default value for @option{frac} is 0.33.
  9399. @end table
  9400. @section negate
  9401. Negate (invert) the input video.
  9402. It accepts the following option:
  9403. @table @option
  9404. @item negate_alpha
  9405. With value 1, it negates the alpha component, if present. Default value is 0.
  9406. @end table
  9407. @anchor{nlmeans}
  9408. @section nlmeans
  9409. Denoise frames using Non-Local Means algorithm.
  9410. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9411. context similarity is defined by comparing their surrounding patches of size
  9412. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9413. around the pixel.
  9414. Note that the research area defines centers for patches, which means some
  9415. patches will be made of pixels outside that research area.
  9416. The filter accepts the following options.
  9417. @table @option
  9418. @item s
  9419. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  9420. @item p
  9421. Set patch size. Default is 7. Must be odd number in range [0, 99].
  9422. @item pc
  9423. Same as @option{p} but for chroma planes.
  9424. The default value is @var{0} and means automatic.
  9425. @item r
  9426. Set research size. Default is 15. Must be odd number in range [0, 99].
  9427. @item rc
  9428. Same as @option{r} but for chroma planes.
  9429. The default value is @var{0} and means automatic.
  9430. @end table
  9431. @section nnedi
  9432. Deinterlace video using neural network edge directed interpolation.
  9433. This filter accepts the following options:
  9434. @table @option
  9435. @item weights
  9436. Mandatory option, without binary file filter can not work.
  9437. Currently file can be found here:
  9438. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9439. @item deint
  9440. Set which frames to deinterlace, by default it is @code{all}.
  9441. Can be @code{all} or @code{interlaced}.
  9442. @item field
  9443. Set mode of operation.
  9444. Can be one of the following:
  9445. @table @samp
  9446. @item af
  9447. Use frame flags, both fields.
  9448. @item a
  9449. Use frame flags, single field.
  9450. @item t
  9451. Use top field only.
  9452. @item b
  9453. Use bottom field only.
  9454. @item tf
  9455. Use both fields, top first.
  9456. @item bf
  9457. Use both fields, bottom first.
  9458. @end table
  9459. @item planes
  9460. Set which planes to process, by default filter process all frames.
  9461. @item nsize
  9462. Set size of local neighborhood around each pixel, used by the predictor neural
  9463. network.
  9464. Can be one of the following:
  9465. @table @samp
  9466. @item s8x6
  9467. @item s16x6
  9468. @item s32x6
  9469. @item s48x6
  9470. @item s8x4
  9471. @item s16x4
  9472. @item s32x4
  9473. @end table
  9474. @item nns
  9475. Set the number of neurons in predictor neural network.
  9476. Can be one of the following:
  9477. @table @samp
  9478. @item n16
  9479. @item n32
  9480. @item n64
  9481. @item n128
  9482. @item n256
  9483. @end table
  9484. @item qual
  9485. Controls the number of different neural network predictions that are blended
  9486. together to compute the final output value. Can be @code{fast}, default or
  9487. @code{slow}.
  9488. @item etype
  9489. Set which set of weights to use in the predictor.
  9490. Can be one of the following:
  9491. @table @samp
  9492. @item a
  9493. weights trained to minimize absolute error
  9494. @item s
  9495. weights trained to minimize squared error
  9496. @end table
  9497. @item pscrn
  9498. Controls whether or not the prescreener neural network is used to decide
  9499. which pixels should be processed by the predictor neural network and which
  9500. can be handled by simple cubic interpolation.
  9501. The prescreener is trained to know whether cubic interpolation will be
  9502. sufficient for a pixel or whether it should be predicted by the predictor nn.
  9503. The computational complexity of the prescreener nn is much less than that of
  9504. the predictor nn. Since most pixels can be handled by cubic interpolation,
  9505. using the prescreener generally results in much faster processing.
  9506. The prescreener is pretty accurate, so the difference between using it and not
  9507. using it is almost always unnoticeable.
  9508. Can be one of the following:
  9509. @table @samp
  9510. @item none
  9511. @item original
  9512. @item new
  9513. @end table
  9514. Default is @code{new}.
  9515. @item fapprox
  9516. Set various debugging flags.
  9517. @end table
  9518. @section noformat
  9519. Force libavfilter not to use any of the specified pixel formats for the
  9520. input to the next filter.
  9521. It accepts the following parameters:
  9522. @table @option
  9523. @item pix_fmts
  9524. A '|'-separated list of pixel format names, such as
  9525. pix_fmts=yuv420p|monow|rgb24".
  9526. @end table
  9527. @subsection Examples
  9528. @itemize
  9529. @item
  9530. Force libavfilter to use a format different from @var{yuv420p} for the
  9531. input to the vflip filter:
  9532. @example
  9533. noformat=pix_fmts=yuv420p,vflip
  9534. @end example
  9535. @item
  9536. Convert the input video to any of the formats not contained in the list:
  9537. @example
  9538. noformat=yuv420p|yuv444p|yuv410p
  9539. @end example
  9540. @end itemize
  9541. @section noise
  9542. Add noise on video input frame.
  9543. The filter accepts the following options:
  9544. @table @option
  9545. @item all_seed
  9546. @item c0_seed
  9547. @item c1_seed
  9548. @item c2_seed
  9549. @item c3_seed
  9550. Set noise seed for specific pixel component or all pixel components in case
  9551. of @var{all_seed}. Default value is @code{123457}.
  9552. @item all_strength, alls
  9553. @item c0_strength, c0s
  9554. @item c1_strength, c1s
  9555. @item c2_strength, c2s
  9556. @item c3_strength, c3s
  9557. Set noise strength for specific pixel component or all pixel components in case
  9558. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  9559. @item all_flags, allf
  9560. @item c0_flags, c0f
  9561. @item c1_flags, c1f
  9562. @item c2_flags, c2f
  9563. @item c3_flags, c3f
  9564. Set pixel component flags or set flags for all components if @var{all_flags}.
  9565. Available values for component flags are:
  9566. @table @samp
  9567. @item a
  9568. averaged temporal noise (smoother)
  9569. @item p
  9570. mix random noise with a (semi)regular pattern
  9571. @item t
  9572. temporal noise (noise pattern changes between frames)
  9573. @item u
  9574. uniform noise (gaussian otherwise)
  9575. @end table
  9576. @end table
  9577. @subsection Examples
  9578. Add temporal and uniform noise to input video:
  9579. @example
  9580. noise=alls=20:allf=t+u
  9581. @end example
  9582. @section normalize
  9583. Normalize RGB video (aka histogram stretching, contrast stretching).
  9584. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  9585. For each channel of each frame, the filter computes the input range and maps
  9586. it linearly to the user-specified output range. The output range defaults
  9587. to the full dynamic range from pure black to pure white.
  9588. Temporal smoothing can be used on the input range to reduce flickering (rapid
  9589. changes in brightness) caused when small dark or bright objects enter or leave
  9590. the scene. This is similar to the auto-exposure (automatic gain control) on a
  9591. video camera, and, like a video camera, it may cause a period of over- or
  9592. under-exposure of the video.
  9593. The R,G,B channels can be normalized independently, which may cause some
  9594. color shifting, or linked together as a single channel, which prevents
  9595. color shifting. Linked normalization preserves hue. Independent normalization
  9596. does not, so it can be used to remove some color casts. Independent and linked
  9597. normalization can be combined in any ratio.
  9598. The normalize filter accepts the following options:
  9599. @table @option
  9600. @item blackpt
  9601. @item whitept
  9602. Colors which define the output range. The minimum input value is mapped to
  9603. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  9604. The defaults are black and white respectively. Specifying white for
  9605. @var{blackpt} and black for @var{whitept} will give color-inverted,
  9606. normalized video. Shades of grey can be used to reduce the dynamic range
  9607. (contrast). Specifying saturated colors here can create some interesting
  9608. effects.
  9609. @item smoothing
  9610. The number of previous frames to use for temporal smoothing. The input range
  9611. of each channel is smoothed using a rolling average over the current frame
  9612. and the @var{smoothing} previous frames. The default is 0 (no temporal
  9613. smoothing).
  9614. @item independence
  9615. Controls the ratio of independent (color shifting) channel normalization to
  9616. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  9617. independent. Defaults to 1.0 (fully independent).
  9618. @item strength
  9619. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  9620. expensive no-op. Defaults to 1.0 (full strength).
  9621. @end table
  9622. @subsection Examples
  9623. Stretch video contrast to use the full dynamic range, with no temporal
  9624. smoothing; may flicker depending on the source content:
  9625. @example
  9626. normalize=blackpt=black:whitept=white:smoothing=0
  9627. @end example
  9628. As above, but with 50 frames of temporal smoothing; flicker should be
  9629. reduced, depending on the source content:
  9630. @example
  9631. normalize=blackpt=black:whitept=white:smoothing=50
  9632. @end example
  9633. As above, but with hue-preserving linked channel normalization:
  9634. @example
  9635. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  9636. @end example
  9637. As above, but with half strength:
  9638. @example
  9639. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  9640. @end example
  9641. Map the darkest input color to red, the brightest input color to cyan:
  9642. @example
  9643. normalize=blackpt=red:whitept=cyan
  9644. @end example
  9645. @section null
  9646. Pass the video source unchanged to the output.
  9647. @section ocr
  9648. Optical Character Recognition
  9649. This filter uses Tesseract for optical character recognition. To enable
  9650. compilation of this filter, you need to configure FFmpeg with
  9651. @code{--enable-libtesseract}.
  9652. It accepts the following options:
  9653. @table @option
  9654. @item datapath
  9655. Set datapath to tesseract data. Default is to use whatever was
  9656. set at installation.
  9657. @item language
  9658. Set language, default is "eng".
  9659. @item whitelist
  9660. Set character whitelist.
  9661. @item blacklist
  9662. Set character blacklist.
  9663. @end table
  9664. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  9665. @section ocv
  9666. Apply a video transform using libopencv.
  9667. To enable this filter, install the libopencv library and headers and
  9668. configure FFmpeg with @code{--enable-libopencv}.
  9669. It accepts the following parameters:
  9670. @table @option
  9671. @item filter_name
  9672. The name of the libopencv filter to apply.
  9673. @item filter_params
  9674. The parameters to pass to the libopencv filter. If not specified, the default
  9675. values are assumed.
  9676. @end table
  9677. Refer to the official libopencv documentation for more precise
  9678. information:
  9679. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  9680. Several libopencv filters are supported; see the following subsections.
  9681. @anchor{dilate}
  9682. @subsection dilate
  9683. Dilate an image by using a specific structuring element.
  9684. It corresponds to the libopencv function @code{cvDilate}.
  9685. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  9686. @var{struct_el} represents a structuring element, and has the syntax:
  9687. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  9688. @var{cols} and @var{rows} represent the number of columns and rows of
  9689. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  9690. point, and @var{shape} the shape for the structuring element. @var{shape}
  9691. must be "rect", "cross", "ellipse", or "custom".
  9692. If the value for @var{shape} is "custom", it must be followed by a
  9693. string of the form "=@var{filename}". The file with name
  9694. @var{filename} is assumed to represent a binary image, with each
  9695. printable character corresponding to a bright pixel. When a custom
  9696. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  9697. or columns and rows of the read file are assumed instead.
  9698. The default value for @var{struct_el} is "3x3+0x0/rect".
  9699. @var{nb_iterations} specifies the number of times the transform is
  9700. applied to the image, and defaults to 1.
  9701. Some examples:
  9702. @example
  9703. # Use the default values
  9704. ocv=dilate
  9705. # Dilate using a structuring element with a 5x5 cross, iterating two times
  9706. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  9707. # Read the shape from the file diamond.shape, iterating two times.
  9708. # The file diamond.shape may contain a pattern of characters like this
  9709. # *
  9710. # ***
  9711. # *****
  9712. # ***
  9713. # *
  9714. # The specified columns and rows are ignored
  9715. # but the anchor point coordinates are not
  9716. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  9717. @end example
  9718. @subsection erode
  9719. Erode an image by using a specific structuring element.
  9720. It corresponds to the libopencv function @code{cvErode}.
  9721. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  9722. with the same syntax and semantics as the @ref{dilate} filter.
  9723. @subsection smooth
  9724. Smooth the input video.
  9725. The filter takes the following parameters:
  9726. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  9727. @var{type} is the type of smooth filter to apply, and must be one of
  9728. the following values: "blur", "blur_no_scale", "median", "gaussian",
  9729. or "bilateral". The default value is "gaussian".
  9730. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  9731. depend on the smooth type. @var{param1} and
  9732. @var{param2} accept integer positive values or 0. @var{param3} and
  9733. @var{param4} accept floating point values.
  9734. The default value for @var{param1} is 3. The default value for the
  9735. other parameters is 0.
  9736. These parameters correspond to the parameters assigned to the
  9737. libopencv function @code{cvSmooth}.
  9738. @section oscilloscope
  9739. 2D Video Oscilloscope.
  9740. Useful to measure spatial impulse, step responses, chroma delays, etc.
  9741. It accepts the following parameters:
  9742. @table @option
  9743. @item x
  9744. Set scope center x position.
  9745. @item y
  9746. Set scope center y position.
  9747. @item s
  9748. Set scope size, relative to frame diagonal.
  9749. @item t
  9750. Set scope tilt/rotation.
  9751. @item o
  9752. Set trace opacity.
  9753. @item tx
  9754. Set trace center x position.
  9755. @item ty
  9756. Set trace center y position.
  9757. @item tw
  9758. Set trace width, relative to width of frame.
  9759. @item th
  9760. Set trace height, relative to height of frame.
  9761. @item c
  9762. Set which components to trace. By default it traces first three components.
  9763. @item g
  9764. Draw trace grid. By default is enabled.
  9765. @item st
  9766. Draw some statistics. By default is enabled.
  9767. @item sc
  9768. Draw scope. By default is enabled.
  9769. @end table
  9770. @subsection Examples
  9771. @itemize
  9772. @item
  9773. Inspect full first row of video frame.
  9774. @example
  9775. oscilloscope=x=0.5:y=0:s=1
  9776. @end example
  9777. @item
  9778. Inspect full last row of video frame.
  9779. @example
  9780. oscilloscope=x=0.5:y=1:s=1
  9781. @end example
  9782. @item
  9783. Inspect full 5th line of video frame of height 1080.
  9784. @example
  9785. oscilloscope=x=0.5:y=5/1080:s=1
  9786. @end example
  9787. @item
  9788. Inspect full last column of video frame.
  9789. @example
  9790. oscilloscope=x=1:y=0.5:s=1:t=1
  9791. @end example
  9792. @end itemize
  9793. @anchor{overlay}
  9794. @section overlay
  9795. Overlay one video on top of another.
  9796. It takes two inputs and has one output. The first input is the "main"
  9797. video on which the second input is overlaid.
  9798. It accepts the following parameters:
  9799. A description of the accepted options follows.
  9800. @table @option
  9801. @item x
  9802. @item y
  9803. Set the expression for the x and y coordinates of the overlaid video
  9804. on the main video. Default value is "0" for both expressions. In case
  9805. the expression is invalid, it is set to a huge value (meaning that the
  9806. overlay will not be displayed within the output visible area).
  9807. @item eof_action
  9808. See @ref{framesync}.
  9809. @item eval
  9810. Set when the expressions for @option{x}, and @option{y} are evaluated.
  9811. It accepts the following values:
  9812. @table @samp
  9813. @item init
  9814. only evaluate expressions once during the filter initialization or
  9815. when a command is processed
  9816. @item frame
  9817. evaluate expressions for each incoming frame
  9818. @end table
  9819. Default value is @samp{frame}.
  9820. @item shortest
  9821. See @ref{framesync}.
  9822. @item format
  9823. Set the format for the output video.
  9824. It accepts the following values:
  9825. @table @samp
  9826. @item yuv420
  9827. force YUV420 output
  9828. @item yuv422
  9829. force YUV422 output
  9830. @item yuv444
  9831. force YUV444 output
  9832. @item rgb
  9833. force packed RGB output
  9834. @item gbrp
  9835. force planar RGB output
  9836. @item auto
  9837. automatically pick format
  9838. @end table
  9839. Default value is @samp{yuv420}.
  9840. @item repeatlast
  9841. See @ref{framesync}.
  9842. @item alpha
  9843. Set format of alpha of the overlaid video, it can be @var{straight} or
  9844. @var{premultiplied}. Default is @var{straight}.
  9845. @end table
  9846. The @option{x}, and @option{y} expressions can contain the following
  9847. parameters.
  9848. @table @option
  9849. @item main_w, W
  9850. @item main_h, H
  9851. The main input width and height.
  9852. @item overlay_w, w
  9853. @item overlay_h, h
  9854. The overlay input width and height.
  9855. @item x
  9856. @item y
  9857. The computed values for @var{x} and @var{y}. They are evaluated for
  9858. each new frame.
  9859. @item hsub
  9860. @item vsub
  9861. horizontal and vertical chroma subsample values of the output
  9862. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  9863. @var{vsub} is 1.
  9864. @item n
  9865. the number of input frame, starting from 0
  9866. @item pos
  9867. the position in the file of the input frame, NAN if unknown
  9868. @item t
  9869. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  9870. @end table
  9871. This filter also supports the @ref{framesync} options.
  9872. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  9873. when evaluation is done @emph{per frame}, and will evaluate to NAN
  9874. when @option{eval} is set to @samp{init}.
  9875. Be aware that frames are taken from each input video in timestamp
  9876. order, hence, if their initial timestamps differ, it is a good idea
  9877. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  9878. have them begin in the same zero timestamp, as the example for
  9879. the @var{movie} filter does.
  9880. You can chain together more overlays but you should test the
  9881. efficiency of such approach.
  9882. @subsection Commands
  9883. This filter supports the following commands:
  9884. @table @option
  9885. @item x
  9886. @item y
  9887. Modify the x and y of the overlay input.
  9888. The command accepts the same syntax of the corresponding option.
  9889. If the specified expression is not valid, it is kept at its current
  9890. value.
  9891. @end table
  9892. @subsection Examples
  9893. @itemize
  9894. @item
  9895. Draw the overlay at 10 pixels from the bottom right corner of the main
  9896. video:
  9897. @example
  9898. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  9899. @end example
  9900. Using named options the example above becomes:
  9901. @example
  9902. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  9903. @end example
  9904. @item
  9905. Insert a transparent PNG logo in the bottom left corner of the input,
  9906. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  9907. @example
  9908. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  9909. @end example
  9910. @item
  9911. Insert 2 different transparent PNG logos (second logo on bottom
  9912. right corner) using the @command{ffmpeg} tool:
  9913. @example
  9914. 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
  9915. @end example
  9916. @item
  9917. Add a transparent color layer on top of the main video; @code{WxH}
  9918. must specify the size of the main input to the overlay filter:
  9919. @example
  9920. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  9921. @end example
  9922. @item
  9923. Play an original video and a filtered version (here with the deshake
  9924. filter) side by side using the @command{ffplay} tool:
  9925. @example
  9926. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  9927. @end example
  9928. The above command is the same as:
  9929. @example
  9930. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  9931. @end example
  9932. @item
  9933. Make a sliding overlay appearing from the left to the right top part of the
  9934. screen starting since time 2:
  9935. @example
  9936. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  9937. @end example
  9938. @item
  9939. Compose output by putting two input videos side to side:
  9940. @example
  9941. ffmpeg -i left.avi -i right.avi -filter_complex "
  9942. nullsrc=size=200x100 [background];
  9943. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  9944. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  9945. [background][left] overlay=shortest=1 [background+left];
  9946. [background+left][right] overlay=shortest=1:x=100 [left+right]
  9947. "
  9948. @end example
  9949. @item
  9950. Mask 10-20 seconds of a video by applying the delogo filter to a section
  9951. @example
  9952. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  9953. -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]'
  9954. masked.avi
  9955. @end example
  9956. @item
  9957. Chain several overlays in cascade:
  9958. @example
  9959. nullsrc=s=200x200 [bg];
  9960. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  9961. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  9962. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  9963. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  9964. [in3] null, [mid2] overlay=100:100 [out0]
  9965. @end example
  9966. @end itemize
  9967. @section owdenoise
  9968. Apply Overcomplete Wavelet denoiser.
  9969. The filter accepts the following options:
  9970. @table @option
  9971. @item depth
  9972. Set depth.
  9973. Larger depth values will denoise lower frequency components more, but
  9974. slow down filtering.
  9975. Must be an int in the range 8-16, default is @code{8}.
  9976. @item luma_strength, ls
  9977. Set luma strength.
  9978. Must be a double value in the range 0-1000, default is @code{1.0}.
  9979. @item chroma_strength, cs
  9980. Set chroma strength.
  9981. Must be a double value in the range 0-1000, default is @code{1.0}.
  9982. @end table
  9983. @anchor{pad}
  9984. @section pad
  9985. Add paddings to the input image, and place the original input at the
  9986. provided @var{x}, @var{y} coordinates.
  9987. It accepts the following parameters:
  9988. @table @option
  9989. @item width, w
  9990. @item height, h
  9991. Specify an expression for the size of the output image with the
  9992. paddings added. If the value for @var{width} or @var{height} is 0, the
  9993. corresponding input size is used for the output.
  9994. The @var{width} expression can reference the value set by the
  9995. @var{height} expression, and vice versa.
  9996. The default value of @var{width} and @var{height} is 0.
  9997. @item x
  9998. @item y
  9999. Specify the offsets to place the input image at within the padded area,
  10000. with respect to the top/left border of the output image.
  10001. The @var{x} expression can reference the value set by the @var{y}
  10002. expression, and vice versa.
  10003. The default value of @var{x} and @var{y} is 0.
  10004. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  10005. so the input image is centered on the padded area.
  10006. @item color
  10007. Specify the color of the padded area. For the syntax of this option,
  10008. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10009. manual,ffmpeg-utils}.
  10010. The default value of @var{color} is "black".
  10011. @item eval
  10012. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  10013. It accepts the following values:
  10014. @table @samp
  10015. @item init
  10016. Only evaluate expressions once during the filter initialization or when
  10017. a command is processed.
  10018. @item frame
  10019. Evaluate expressions for each incoming frame.
  10020. @end table
  10021. Default value is @samp{init}.
  10022. @item aspect
  10023. Pad to aspect instead to a resolution.
  10024. @end table
  10025. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  10026. options are expressions containing the following constants:
  10027. @table @option
  10028. @item in_w
  10029. @item in_h
  10030. The input video width and height.
  10031. @item iw
  10032. @item ih
  10033. These are the same as @var{in_w} and @var{in_h}.
  10034. @item out_w
  10035. @item out_h
  10036. The output width and height (the size of the padded area), as
  10037. specified by the @var{width} and @var{height} expressions.
  10038. @item ow
  10039. @item oh
  10040. These are the same as @var{out_w} and @var{out_h}.
  10041. @item x
  10042. @item y
  10043. The x and y offsets as specified by the @var{x} and @var{y}
  10044. expressions, or NAN if not yet specified.
  10045. @item a
  10046. same as @var{iw} / @var{ih}
  10047. @item sar
  10048. input sample aspect ratio
  10049. @item dar
  10050. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  10051. @item hsub
  10052. @item vsub
  10053. The horizontal and vertical chroma subsample values. For example for the
  10054. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10055. @end table
  10056. @subsection Examples
  10057. @itemize
  10058. @item
  10059. Add paddings with the color "violet" to the input video. The output video
  10060. size is 640x480, and the top-left corner of the input video is placed at
  10061. column 0, row 40
  10062. @example
  10063. pad=640:480:0:40:violet
  10064. @end example
  10065. The example above is equivalent to the following command:
  10066. @example
  10067. pad=width=640:height=480:x=0:y=40:color=violet
  10068. @end example
  10069. @item
  10070. Pad the input to get an output with dimensions increased by 3/2,
  10071. and put the input video at the center of the padded area:
  10072. @example
  10073. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10074. @end example
  10075. @item
  10076. Pad the input to get a squared output with size equal to the maximum
  10077. value between the input width and height, and put the input video at
  10078. the center of the padded area:
  10079. @example
  10080. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10081. @end example
  10082. @item
  10083. Pad the input to get a final w/h ratio of 16:9:
  10084. @example
  10085. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10086. @end example
  10087. @item
  10088. In case of anamorphic video, in order to set the output display aspect
  10089. correctly, it is necessary to use @var{sar} in the expression,
  10090. according to the relation:
  10091. @example
  10092. (ih * X / ih) * sar = output_dar
  10093. X = output_dar / sar
  10094. @end example
  10095. Thus the previous example needs to be modified to:
  10096. @example
  10097. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  10098. @end example
  10099. @item
  10100. Double the output size and put the input video in the bottom-right
  10101. corner of the output padded area:
  10102. @example
  10103. pad="2*iw:2*ih:ow-iw:oh-ih"
  10104. @end example
  10105. @end itemize
  10106. @anchor{palettegen}
  10107. @section palettegen
  10108. Generate one palette for a whole video stream.
  10109. It accepts the following options:
  10110. @table @option
  10111. @item max_colors
  10112. Set the maximum number of colors to quantize in the palette.
  10113. Note: the palette will still contain 256 colors; the unused palette entries
  10114. will be black.
  10115. @item reserve_transparent
  10116. Create a palette of 255 colors maximum and reserve the last one for
  10117. transparency. Reserving the transparency color is useful for GIF optimization.
  10118. If not set, the maximum of colors in the palette will be 256. You probably want
  10119. to disable this option for a standalone image.
  10120. Set by default.
  10121. @item transparency_color
  10122. Set the color that will be used as background for transparency.
  10123. @item stats_mode
  10124. Set statistics mode.
  10125. It accepts the following values:
  10126. @table @samp
  10127. @item full
  10128. Compute full frame histograms.
  10129. @item diff
  10130. Compute histograms only for the part that differs from previous frame. This
  10131. might be relevant to give more importance to the moving part of your input if
  10132. the background is static.
  10133. @item single
  10134. Compute new histogram for each frame.
  10135. @end table
  10136. Default value is @var{full}.
  10137. @end table
  10138. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  10139. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  10140. color quantization of the palette. This information is also visible at
  10141. @var{info} logging level.
  10142. @subsection Examples
  10143. @itemize
  10144. @item
  10145. Generate a representative palette of a given video using @command{ffmpeg}:
  10146. @example
  10147. ffmpeg -i input.mkv -vf palettegen palette.png
  10148. @end example
  10149. @end itemize
  10150. @section paletteuse
  10151. Use a palette to downsample an input video stream.
  10152. The filter takes two inputs: one video stream and a palette. The palette must
  10153. be a 256 pixels image.
  10154. It accepts the following options:
  10155. @table @option
  10156. @item dither
  10157. Select dithering mode. Available algorithms are:
  10158. @table @samp
  10159. @item bayer
  10160. Ordered 8x8 bayer dithering (deterministic)
  10161. @item heckbert
  10162. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  10163. Note: this dithering is sometimes considered "wrong" and is included as a
  10164. reference.
  10165. @item floyd_steinberg
  10166. Floyd and Steingberg dithering (error diffusion)
  10167. @item sierra2
  10168. Frankie Sierra dithering v2 (error diffusion)
  10169. @item sierra2_4a
  10170. Frankie Sierra dithering v2 "Lite" (error diffusion)
  10171. @end table
  10172. Default is @var{sierra2_4a}.
  10173. @item bayer_scale
  10174. When @var{bayer} dithering is selected, this option defines the scale of the
  10175. pattern (how much the crosshatch pattern is visible). A low value means more
  10176. visible pattern for less banding, and higher value means less visible pattern
  10177. at the cost of more banding.
  10178. The option must be an integer value in the range [0,5]. Default is @var{2}.
  10179. @item diff_mode
  10180. If set, define the zone to process
  10181. @table @samp
  10182. @item rectangle
  10183. Only the changing rectangle will be reprocessed. This is similar to GIF
  10184. cropping/offsetting compression mechanism. This option can be useful for speed
  10185. if only a part of the image is changing, and has use cases such as limiting the
  10186. scope of the error diffusal @option{dither} to the rectangle that bounds the
  10187. moving scene (it leads to more deterministic output if the scene doesn't change
  10188. much, and as a result less moving noise and better GIF compression).
  10189. @end table
  10190. Default is @var{none}.
  10191. @item new
  10192. Take new palette for each output frame.
  10193. @item alpha_threshold
  10194. Sets the alpha threshold for transparency. Alpha values above this threshold
  10195. will be treated as completely opaque, and values below this threshold will be
  10196. treated as completely transparent.
  10197. The option must be an integer value in the range [0,255]. Default is @var{128}.
  10198. @end table
  10199. @subsection Examples
  10200. @itemize
  10201. @item
  10202. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  10203. using @command{ffmpeg}:
  10204. @example
  10205. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  10206. @end example
  10207. @end itemize
  10208. @section perspective
  10209. Correct perspective of video not recorded perpendicular to the screen.
  10210. A description of the accepted parameters follows.
  10211. @table @option
  10212. @item x0
  10213. @item y0
  10214. @item x1
  10215. @item y1
  10216. @item x2
  10217. @item y2
  10218. @item x3
  10219. @item y3
  10220. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  10221. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  10222. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  10223. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  10224. then the corners of the source will be sent to the specified coordinates.
  10225. The expressions can use the following variables:
  10226. @table @option
  10227. @item W
  10228. @item H
  10229. the width and height of video frame.
  10230. @item in
  10231. Input frame count.
  10232. @item on
  10233. Output frame count.
  10234. @end table
  10235. @item interpolation
  10236. Set interpolation for perspective correction.
  10237. It accepts the following values:
  10238. @table @samp
  10239. @item linear
  10240. @item cubic
  10241. @end table
  10242. Default value is @samp{linear}.
  10243. @item sense
  10244. Set interpretation of coordinate options.
  10245. It accepts the following values:
  10246. @table @samp
  10247. @item 0, source
  10248. Send point in the source specified by the given coordinates to
  10249. the corners of the destination.
  10250. @item 1, destination
  10251. Send the corners of the source to the point in the destination specified
  10252. by the given coordinates.
  10253. Default value is @samp{source}.
  10254. @end table
  10255. @item eval
  10256. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  10257. It accepts the following values:
  10258. @table @samp
  10259. @item init
  10260. only evaluate expressions once during the filter initialization or
  10261. when a command is processed
  10262. @item frame
  10263. evaluate expressions for each incoming frame
  10264. @end table
  10265. Default value is @samp{init}.
  10266. @end table
  10267. @section phase
  10268. Delay interlaced video by one field time so that the field order changes.
  10269. The intended use is to fix PAL movies that have been captured with the
  10270. opposite field order to the film-to-video transfer.
  10271. A description of the accepted parameters follows.
  10272. @table @option
  10273. @item mode
  10274. Set phase mode.
  10275. It accepts the following values:
  10276. @table @samp
  10277. @item t
  10278. Capture field order top-first, transfer bottom-first.
  10279. Filter will delay the bottom field.
  10280. @item b
  10281. Capture field order bottom-first, transfer top-first.
  10282. Filter will delay the top field.
  10283. @item p
  10284. Capture and transfer with the same field order. This mode only exists
  10285. for the documentation of the other options to refer to, but if you
  10286. actually select it, the filter will faithfully do nothing.
  10287. @item a
  10288. Capture field order determined automatically by field flags, transfer
  10289. opposite.
  10290. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  10291. basis using field flags. If no field information is available,
  10292. then this works just like @samp{u}.
  10293. @item u
  10294. Capture unknown or varying, transfer opposite.
  10295. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  10296. analyzing the images and selecting the alternative that produces best
  10297. match between the fields.
  10298. @item T
  10299. Capture top-first, transfer unknown or varying.
  10300. Filter selects among @samp{t} and @samp{p} using image analysis.
  10301. @item B
  10302. Capture bottom-first, transfer unknown or varying.
  10303. Filter selects among @samp{b} and @samp{p} using image analysis.
  10304. @item A
  10305. Capture determined by field flags, transfer unknown or varying.
  10306. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  10307. image analysis. If no field information is available, then this works just
  10308. like @samp{U}. This is the default mode.
  10309. @item U
  10310. Both capture and transfer unknown or varying.
  10311. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  10312. @end table
  10313. @end table
  10314. @section pixdesctest
  10315. Pixel format descriptor test filter, mainly useful for internal
  10316. testing. The output video should be equal to the input video.
  10317. For example:
  10318. @example
  10319. format=monow, pixdesctest
  10320. @end example
  10321. can be used to test the monowhite pixel format descriptor definition.
  10322. @section pixscope
  10323. Display sample values of color channels. Mainly useful for checking color
  10324. and levels. Minimum supported resolution is 640x480.
  10325. The filters accept the following options:
  10326. @table @option
  10327. @item x
  10328. Set scope X position, relative offset on X axis.
  10329. @item y
  10330. Set scope Y position, relative offset on Y axis.
  10331. @item w
  10332. Set scope width.
  10333. @item h
  10334. Set scope height.
  10335. @item o
  10336. Set window opacity. This window also holds statistics about pixel area.
  10337. @item wx
  10338. Set window X position, relative offset on X axis.
  10339. @item wy
  10340. Set window Y position, relative offset on Y axis.
  10341. @end table
  10342. @section pp
  10343. Enable the specified chain of postprocessing subfilters using libpostproc. This
  10344. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  10345. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  10346. Each subfilter and some options have a short and a long name that can be used
  10347. interchangeably, i.e. dr/dering are the same.
  10348. The filters accept the following options:
  10349. @table @option
  10350. @item subfilters
  10351. Set postprocessing subfilters string.
  10352. @end table
  10353. All subfilters share common options to determine their scope:
  10354. @table @option
  10355. @item a/autoq
  10356. Honor the quality commands for this subfilter.
  10357. @item c/chrom
  10358. Do chrominance filtering, too (default).
  10359. @item y/nochrom
  10360. Do luminance filtering only (no chrominance).
  10361. @item n/noluma
  10362. Do chrominance filtering only (no luminance).
  10363. @end table
  10364. These options can be appended after the subfilter name, separated by a '|'.
  10365. Available subfilters are:
  10366. @table @option
  10367. @item hb/hdeblock[|difference[|flatness]]
  10368. Horizontal deblocking filter
  10369. @table @option
  10370. @item difference
  10371. Difference factor where higher values mean more deblocking (default: @code{32}).
  10372. @item flatness
  10373. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10374. @end table
  10375. @item vb/vdeblock[|difference[|flatness]]
  10376. Vertical deblocking filter
  10377. @table @option
  10378. @item difference
  10379. Difference factor where higher values mean more deblocking (default: @code{32}).
  10380. @item flatness
  10381. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10382. @end table
  10383. @item ha/hadeblock[|difference[|flatness]]
  10384. Accurate horizontal deblocking filter
  10385. @table @option
  10386. @item difference
  10387. Difference factor where higher values mean more deblocking (default: @code{32}).
  10388. @item flatness
  10389. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10390. @end table
  10391. @item va/vadeblock[|difference[|flatness]]
  10392. Accurate vertical deblocking filter
  10393. @table @option
  10394. @item difference
  10395. Difference factor where higher values mean more deblocking (default: @code{32}).
  10396. @item flatness
  10397. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10398. @end table
  10399. @end table
  10400. The horizontal and vertical deblocking filters share the difference and
  10401. flatness values so you cannot set different horizontal and vertical
  10402. thresholds.
  10403. @table @option
  10404. @item h1/x1hdeblock
  10405. Experimental horizontal deblocking filter
  10406. @item v1/x1vdeblock
  10407. Experimental vertical deblocking filter
  10408. @item dr/dering
  10409. Deringing filter
  10410. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10411. @table @option
  10412. @item threshold1
  10413. larger -> stronger filtering
  10414. @item threshold2
  10415. larger -> stronger filtering
  10416. @item threshold3
  10417. larger -> stronger filtering
  10418. @end table
  10419. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10420. @table @option
  10421. @item f/fullyrange
  10422. Stretch luminance to @code{0-255}.
  10423. @end table
  10424. @item lb/linblenddeint
  10425. Linear blend deinterlacing filter that deinterlaces the given block by
  10426. filtering all lines with a @code{(1 2 1)} filter.
  10427. @item li/linipoldeint
  10428. Linear interpolating deinterlacing filter that deinterlaces the given block by
  10429. linearly interpolating every second line.
  10430. @item ci/cubicipoldeint
  10431. Cubic interpolating deinterlacing filter deinterlaces the given block by
  10432. cubically interpolating every second line.
  10433. @item md/mediandeint
  10434. Median deinterlacing filter that deinterlaces the given block by applying a
  10435. median filter to every second line.
  10436. @item fd/ffmpegdeint
  10437. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  10438. second line with a @code{(-1 4 2 4 -1)} filter.
  10439. @item l5/lowpass5
  10440. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  10441. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  10442. @item fq/forceQuant[|quantizer]
  10443. Overrides the quantizer table from the input with the constant quantizer you
  10444. specify.
  10445. @table @option
  10446. @item quantizer
  10447. Quantizer to use
  10448. @end table
  10449. @item de/default
  10450. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  10451. @item fa/fast
  10452. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  10453. @item ac
  10454. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  10455. @end table
  10456. @subsection Examples
  10457. @itemize
  10458. @item
  10459. Apply horizontal and vertical deblocking, deringing and automatic
  10460. brightness/contrast:
  10461. @example
  10462. pp=hb/vb/dr/al
  10463. @end example
  10464. @item
  10465. Apply default filters without brightness/contrast correction:
  10466. @example
  10467. pp=de/-al
  10468. @end example
  10469. @item
  10470. Apply default filters and temporal denoiser:
  10471. @example
  10472. pp=default/tmpnoise|1|2|3
  10473. @end example
  10474. @item
  10475. Apply deblocking on luminance only, and switch vertical deblocking on or off
  10476. automatically depending on available CPU time:
  10477. @example
  10478. pp=hb|y/vb|a
  10479. @end example
  10480. @end itemize
  10481. @section pp7
  10482. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  10483. similar to spp = 6 with 7 point DCT, where only the center sample is
  10484. used after IDCT.
  10485. The filter accepts the following options:
  10486. @table @option
  10487. @item qp
  10488. Force a constant quantization parameter. It accepts an integer in range
  10489. 0 to 63. If not set, the filter will use the QP from the video stream
  10490. (if available).
  10491. @item mode
  10492. Set thresholding mode. Available modes are:
  10493. @table @samp
  10494. @item hard
  10495. Set hard thresholding.
  10496. @item soft
  10497. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10498. @item medium
  10499. Set medium thresholding (good results, default).
  10500. @end table
  10501. @end table
  10502. @section premultiply
  10503. Apply alpha premultiply effect to input video stream using first plane
  10504. of second stream as alpha.
  10505. Both streams must have same dimensions and same pixel format.
  10506. The filter accepts the following option:
  10507. @table @option
  10508. @item planes
  10509. Set which planes will be processed, unprocessed planes will be copied.
  10510. By default value 0xf, all planes will be processed.
  10511. @item inplace
  10512. Do not require 2nd input for processing, instead use alpha plane from input stream.
  10513. @end table
  10514. @section prewitt
  10515. Apply prewitt operator to input video stream.
  10516. The filter accepts the following option:
  10517. @table @option
  10518. @item planes
  10519. Set which planes will be processed, unprocessed planes will be copied.
  10520. By default value 0xf, all planes will be processed.
  10521. @item scale
  10522. Set value which will be multiplied with filtered result.
  10523. @item delta
  10524. Set value which will be added to filtered result.
  10525. @end table
  10526. @anchor{program_opencl}
  10527. @section program_opencl
  10528. Filter video using an OpenCL program.
  10529. @table @option
  10530. @item source
  10531. OpenCL program source file.
  10532. @item kernel
  10533. Kernel name in program.
  10534. @item inputs
  10535. Number of inputs to the filter. Defaults to 1.
  10536. @item size, s
  10537. Size of output frames. Defaults to the same as the first input.
  10538. @end table
  10539. The program source file must contain a kernel function with the given name,
  10540. which will be run once for each plane of the output. Each run on a plane
  10541. gets enqueued as a separate 2D global NDRange with one work-item for each
  10542. pixel to be generated. The global ID offset for each work-item is therefore
  10543. the coordinates of a pixel in the destination image.
  10544. The kernel function needs to take the following arguments:
  10545. @itemize
  10546. @item
  10547. Destination image, @var{__write_only image2d_t}.
  10548. This image will become the output; the kernel should write all of it.
  10549. @item
  10550. Frame index, @var{unsigned int}.
  10551. This is a counter starting from zero and increasing by one for each frame.
  10552. @item
  10553. Source images, @var{__read_only image2d_t}.
  10554. These are the most recent images on each input. The kernel may read from
  10555. them to generate the output, but they can't be written to.
  10556. @end itemize
  10557. Example programs:
  10558. @itemize
  10559. @item
  10560. Copy the input to the output (output must be the same size as the input).
  10561. @verbatim
  10562. __kernel void copy(__write_only image2d_t destination,
  10563. unsigned int index,
  10564. __read_only image2d_t source)
  10565. {
  10566. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  10567. int2 location = (int2)(get_global_id(0), get_global_id(1));
  10568. float4 value = read_imagef(source, sampler, location);
  10569. write_imagef(destination, location, value);
  10570. }
  10571. @end verbatim
  10572. @item
  10573. Apply a simple transformation, rotating the input by an amount increasing
  10574. with the index counter. Pixel values are linearly interpolated by the
  10575. sampler, and the output need not have the same dimensions as the input.
  10576. @verbatim
  10577. __kernel void rotate_image(__write_only image2d_t dst,
  10578. unsigned int index,
  10579. __read_only image2d_t src)
  10580. {
  10581. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10582. CLK_FILTER_LINEAR);
  10583. float angle = (float)index / 100.0f;
  10584. float2 dst_dim = convert_float2(get_image_dim(dst));
  10585. float2 src_dim = convert_float2(get_image_dim(src));
  10586. float2 dst_cen = dst_dim / 2.0f;
  10587. float2 src_cen = src_dim / 2.0f;
  10588. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10589. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  10590. float2 src_pos = {
  10591. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  10592. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  10593. };
  10594. src_pos = src_pos * src_dim / dst_dim;
  10595. float2 src_loc = src_pos + src_cen;
  10596. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  10597. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  10598. write_imagef(dst, dst_loc, 0.5f);
  10599. else
  10600. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  10601. }
  10602. @end verbatim
  10603. @item
  10604. Blend two inputs together, with the amount of each input used varying
  10605. with the index counter.
  10606. @verbatim
  10607. __kernel void blend_images(__write_only image2d_t dst,
  10608. unsigned int index,
  10609. __read_only image2d_t src1,
  10610. __read_only image2d_t src2)
  10611. {
  10612. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10613. CLK_FILTER_LINEAR);
  10614. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  10615. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10616. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  10617. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  10618. float4 val1 = read_imagef(src1, sampler, src1_loc);
  10619. float4 val2 = read_imagef(src2, sampler, src2_loc);
  10620. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  10621. }
  10622. @end verbatim
  10623. @end itemize
  10624. @section pseudocolor
  10625. Alter frame colors in video with pseudocolors.
  10626. This filter accept the following options:
  10627. @table @option
  10628. @item c0
  10629. set pixel first component expression
  10630. @item c1
  10631. set pixel second component expression
  10632. @item c2
  10633. set pixel third component expression
  10634. @item c3
  10635. set pixel fourth component expression, corresponds to the alpha component
  10636. @item i
  10637. set component to use as base for altering colors
  10638. @end table
  10639. Each of them specifies the expression to use for computing the lookup table for
  10640. the corresponding pixel component values.
  10641. The expressions can contain the following constants and functions:
  10642. @table @option
  10643. @item w
  10644. @item h
  10645. The input width and height.
  10646. @item val
  10647. The input value for the pixel component.
  10648. @item ymin, umin, vmin, amin
  10649. The minimum allowed component value.
  10650. @item ymax, umax, vmax, amax
  10651. The maximum allowed component value.
  10652. @end table
  10653. All expressions default to "val".
  10654. @subsection Examples
  10655. @itemize
  10656. @item
  10657. Change too high luma values to gradient:
  10658. @example
  10659. 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'"
  10660. @end example
  10661. @end itemize
  10662. @section psnr
  10663. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  10664. Ratio) between two input videos.
  10665. This filter takes in input two input videos, the first input is
  10666. considered the "main" source and is passed unchanged to the
  10667. output. The second input is used as a "reference" video for computing
  10668. the PSNR.
  10669. Both video inputs must have the same resolution and pixel format for
  10670. this filter to work correctly. Also it assumes that both inputs
  10671. have the same number of frames, which are compared one by one.
  10672. The obtained average PSNR is printed through the logging system.
  10673. The filter stores the accumulated MSE (mean squared error) of each
  10674. frame, and at the end of the processing it is averaged across all frames
  10675. equally, and the following formula is applied to obtain the PSNR:
  10676. @example
  10677. PSNR = 10*log10(MAX^2/MSE)
  10678. @end example
  10679. Where MAX is the average of the maximum values of each component of the
  10680. image.
  10681. The description of the accepted parameters follows.
  10682. @table @option
  10683. @item stats_file, f
  10684. If specified the filter will use the named file to save the PSNR of
  10685. each individual frame. When filename equals "-" the data is sent to
  10686. standard output.
  10687. @item stats_version
  10688. Specifies which version of the stats file format to use. Details of
  10689. each format are written below.
  10690. Default value is 1.
  10691. @item stats_add_max
  10692. Determines whether the max value is output to the stats log.
  10693. Default value is 0.
  10694. Requires stats_version >= 2. If this is set and stats_version < 2,
  10695. the filter will return an error.
  10696. @end table
  10697. This filter also supports the @ref{framesync} options.
  10698. The file printed if @var{stats_file} is selected, contains a sequence of
  10699. key/value pairs of the form @var{key}:@var{value} for each compared
  10700. couple of frames.
  10701. If a @var{stats_version} greater than 1 is specified, a header line precedes
  10702. the list of per-frame-pair stats, with key value pairs following the frame
  10703. format with the following parameters:
  10704. @table @option
  10705. @item psnr_log_version
  10706. The version of the log file format. Will match @var{stats_version}.
  10707. @item fields
  10708. A comma separated list of the per-frame-pair parameters included in
  10709. the log.
  10710. @end table
  10711. A description of each shown per-frame-pair parameter follows:
  10712. @table @option
  10713. @item n
  10714. sequential number of the input frame, starting from 1
  10715. @item mse_avg
  10716. Mean Square Error pixel-by-pixel average difference of the compared
  10717. frames, averaged over all the image components.
  10718. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  10719. Mean Square Error pixel-by-pixel average difference of the compared
  10720. frames for the component specified by the suffix.
  10721. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  10722. Peak Signal to Noise ratio of the compared frames for the component
  10723. specified by the suffix.
  10724. @item max_avg, max_y, max_u, max_v
  10725. Maximum allowed value for each channel, and average over all
  10726. channels.
  10727. @end table
  10728. For example:
  10729. @example
  10730. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10731. [main][ref] psnr="stats_file=stats.log" [out]
  10732. @end example
  10733. On this example the input file being processed is compared with the
  10734. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  10735. is stored in @file{stats.log}.
  10736. @anchor{pullup}
  10737. @section pullup
  10738. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  10739. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  10740. content.
  10741. The pullup filter is designed to take advantage of future context in making
  10742. its decisions. This filter is stateless in the sense that it does not lock
  10743. onto a pattern to follow, but it instead looks forward to the following
  10744. fields in order to identify matches and rebuild progressive frames.
  10745. To produce content with an even framerate, insert the fps filter after
  10746. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  10747. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  10748. The filter accepts the following options:
  10749. @table @option
  10750. @item jl
  10751. @item jr
  10752. @item jt
  10753. @item jb
  10754. These options set the amount of "junk" to ignore at the left, right, top, and
  10755. bottom of the image, respectively. Left and right are in units of 8 pixels,
  10756. while top and bottom are in units of 2 lines.
  10757. The default is 8 pixels on each side.
  10758. @item sb
  10759. Set the strict breaks. Setting this option to 1 will reduce the chances of
  10760. filter generating an occasional mismatched frame, but it may also cause an
  10761. excessive number of frames to be dropped during high motion sequences.
  10762. Conversely, setting it to -1 will make filter match fields more easily.
  10763. This may help processing of video where there is slight blurring between
  10764. the fields, but may also cause there to be interlaced frames in the output.
  10765. Default value is @code{0}.
  10766. @item mp
  10767. Set the metric plane to use. It accepts the following values:
  10768. @table @samp
  10769. @item l
  10770. Use luma plane.
  10771. @item u
  10772. Use chroma blue plane.
  10773. @item v
  10774. Use chroma red plane.
  10775. @end table
  10776. This option may be set to use chroma plane instead of the default luma plane
  10777. for doing filter's computations. This may improve accuracy on very clean
  10778. source material, but more likely will decrease accuracy, especially if there
  10779. is chroma noise (rainbow effect) or any grayscale video.
  10780. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  10781. load and make pullup usable in realtime on slow machines.
  10782. @end table
  10783. For best results (without duplicated frames in the output file) it is
  10784. necessary to change the output frame rate. For example, to inverse
  10785. telecine NTSC input:
  10786. @example
  10787. ffmpeg -i input -vf pullup -r 24000/1001 ...
  10788. @end example
  10789. @section qp
  10790. Change video quantization parameters (QP).
  10791. The filter accepts the following option:
  10792. @table @option
  10793. @item qp
  10794. Set expression for quantization parameter.
  10795. @end table
  10796. The expression is evaluated through the eval API and can contain, among others,
  10797. the following constants:
  10798. @table @var
  10799. @item known
  10800. 1 if index is not 129, 0 otherwise.
  10801. @item qp
  10802. Sequential index starting from -129 to 128.
  10803. @end table
  10804. @subsection Examples
  10805. @itemize
  10806. @item
  10807. Some equation like:
  10808. @example
  10809. qp=2+2*sin(PI*qp)
  10810. @end example
  10811. @end itemize
  10812. @section random
  10813. Flush video frames from internal cache of frames into a random order.
  10814. No frame is discarded.
  10815. Inspired by @ref{frei0r} nervous filter.
  10816. @table @option
  10817. @item frames
  10818. Set size in number of frames of internal cache, in range from @code{2} to
  10819. @code{512}. Default is @code{30}.
  10820. @item seed
  10821. Set seed for random number generator, must be an integer included between
  10822. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10823. less than @code{0}, the filter will try to use a good random seed on a
  10824. best effort basis.
  10825. @end table
  10826. @section readeia608
  10827. Read closed captioning (EIA-608) information from the top lines of a video frame.
  10828. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  10829. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  10830. with EIA-608 data (starting from 0). A description of each metadata value follows:
  10831. @table @option
  10832. @item lavfi.readeia608.X.cc
  10833. The two bytes stored as EIA-608 data (printed in hexadecimal).
  10834. @item lavfi.readeia608.X.line
  10835. The number of the line on which the EIA-608 data was identified and read.
  10836. @end table
  10837. This filter accepts the following options:
  10838. @table @option
  10839. @item scan_min
  10840. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  10841. @item scan_max
  10842. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  10843. @item mac
  10844. Set minimal acceptable amplitude change for sync codes detection.
  10845. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  10846. @item spw
  10847. Set the ratio of width reserved for sync code detection.
  10848. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  10849. @item mhd
  10850. Set the max peaks height difference for sync code detection.
  10851. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10852. @item mpd
  10853. Set max peaks period difference for sync code detection.
  10854. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10855. @item msd
  10856. Set the first two max start code bits differences.
  10857. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  10858. @item bhd
  10859. Set the minimum ratio of bits height compared to 3rd start code bit.
  10860. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  10861. @item th_w
  10862. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  10863. @item th_b
  10864. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  10865. @item chp
  10866. Enable checking the parity bit. In the event of a parity error, the filter will output
  10867. @code{0x00} for that character. Default is false.
  10868. @end table
  10869. @subsection Examples
  10870. @itemize
  10871. @item
  10872. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  10873. @example
  10874. 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
  10875. @end example
  10876. @end itemize
  10877. @section readvitc
  10878. Read vertical interval timecode (VITC) information from the top lines of a
  10879. video frame.
  10880. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  10881. timecode value, if a valid timecode has been detected. Further metadata key
  10882. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  10883. timecode data has been found or not.
  10884. This filter accepts the following options:
  10885. @table @option
  10886. @item scan_max
  10887. Set the maximum number of lines to scan for VITC data. If the value is set to
  10888. @code{-1} the full video frame is scanned. Default is @code{45}.
  10889. @item thr_b
  10890. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  10891. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  10892. @item thr_w
  10893. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  10894. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  10895. @end table
  10896. @subsection Examples
  10897. @itemize
  10898. @item
  10899. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  10900. draw @code{--:--:--:--} as a placeholder:
  10901. @example
  10902. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  10903. @end example
  10904. @end itemize
  10905. @section remap
  10906. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  10907. Destination pixel at position (X, Y) will be picked from source (x, y) position
  10908. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  10909. value for pixel will be used for destination pixel.
  10910. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  10911. will have Xmap/Ymap video stream dimensions.
  10912. Xmap and Ymap input video streams are 16bit depth, single channel.
  10913. @section removegrain
  10914. The removegrain filter is a spatial denoiser for progressive video.
  10915. @table @option
  10916. @item m0
  10917. Set mode for the first plane.
  10918. @item m1
  10919. Set mode for the second plane.
  10920. @item m2
  10921. Set mode for the third plane.
  10922. @item m3
  10923. Set mode for the fourth plane.
  10924. @end table
  10925. Range of mode is from 0 to 24. Description of each mode follows:
  10926. @table @var
  10927. @item 0
  10928. Leave input plane unchanged. Default.
  10929. @item 1
  10930. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  10931. @item 2
  10932. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  10933. @item 3
  10934. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  10935. @item 4
  10936. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  10937. This is equivalent to a median filter.
  10938. @item 5
  10939. Line-sensitive clipping giving the minimal change.
  10940. @item 6
  10941. Line-sensitive clipping, intermediate.
  10942. @item 7
  10943. Line-sensitive clipping, intermediate.
  10944. @item 8
  10945. Line-sensitive clipping, intermediate.
  10946. @item 9
  10947. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  10948. @item 10
  10949. Replaces the target pixel with the closest neighbour.
  10950. @item 11
  10951. [1 2 1] horizontal and vertical kernel blur.
  10952. @item 12
  10953. Same as mode 11.
  10954. @item 13
  10955. Bob mode, interpolates top field from the line where the neighbours
  10956. pixels are the closest.
  10957. @item 14
  10958. Bob mode, interpolates bottom field from the line where the neighbours
  10959. pixels are the closest.
  10960. @item 15
  10961. Bob mode, interpolates top field. Same as 13 but with a more complicated
  10962. interpolation formula.
  10963. @item 16
  10964. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  10965. interpolation formula.
  10966. @item 17
  10967. Clips the pixel with the minimum and maximum of respectively the maximum and
  10968. minimum of each pair of opposite neighbour pixels.
  10969. @item 18
  10970. Line-sensitive clipping using opposite neighbours whose greatest distance from
  10971. the current pixel is minimal.
  10972. @item 19
  10973. Replaces the pixel with the average of its 8 neighbours.
  10974. @item 20
  10975. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  10976. @item 21
  10977. Clips pixels using the averages of opposite neighbour.
  10978. @item 22
  10979. Same as mode 21 but simpler and faster.
  10980. @item 23
  10981. Small edge and halo removal, but reputed useless.
  10982. @item 24
  10983. Similar as 23.
  10984. @end table
  10985. @section removelogo
  10986. Suppress a TV station logo, using an image file to determine which
  10987. pixels comprise the logo. It works by filling in the pixels that
  10988. comprise the logo with neighboring pixels.
  10989. The filter accepts the following options:
  10990. @table @option
  10991. @item filename, f
  10992. Set the filter bitmap file, which can be any image format supported by
  10993. libavformat. The width and height of the image file must match those of the
  10994. video stream being processed.
  10995. @end table
  10996. Pixels in the provided bitmap image with a value of zero are not
  10997. considered part of the logo, non-zero pixels are considered part of
  10998. the logo. If you use white (255) for the logo and black (0) for the
  10999. rest, you will be safe. For making the filter bitmap, it is
  11000. recommended to take a screen capture of a black frame with the logo
  11001. visible, and then using a threshold filter followed by the erode
  11002. filter once or twice.
  11003. If needed, little splotches can be fixed manually. Remember that if
  11004. logo pixels are not covered, the filter quality will be much
  11005. reduced. Marking too many pixels as part of the logo does not hurt as
  11006. much, but it will increase the amount of blurring needed to cover over
  11007. the image and will destroy more information than necessary, and extra
  11008. pixels will slow things down on a large logo.
  11009. @section repeatfields
  11010. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  11011. fields based on its value.
  11012. @section reverse
  11013. Reverse a video clip.
  11014. Warning: This filter requires memory to buffer the entire clip, so trimming
  11015. is suggested.
  11016. @subsection Examples
  11017. @itemize
  11018. @item
  11019. Take the first 5 seconds of a clip, and reverse it.
  11020. @example
  11021. trim=end=5,reverse
  11022. @end example
  11023. @end itemize
  11024. @section rgbashift
  11025. Shift R/G/B/A pixels horizontally and/or vertically.
  11026. The filter accepts the following options:
  11027. @table @option
  11028. @item rh
  11029. Set amount to shift red horizontally.
  11030. @item rv
  11031. Set amount to shift red vertically.
  11032. @item gh
  11033. Set amount to shift green horizontally.
  11034. @item gv
  11035. Set amount to shift green vertically.
  11036. @item bh
  11037. Set amount to shift blue horizontally.
  11038. @item bv
  11039. Set amount to shift blue vertically.
  11040. @item ah
  11041. Set amount to shift alpha horizontally.
  11042. @item av
  11043. Set amount to shift alpha vertically.
  11044. @item edge
  11045. Set edge mode, can be @var{smear}, default, or @var{warp}.
  11046. @end table
  11047. @section roberts
  11048. Apply roberts cross operator to input video stream.
  11049. The filter accepts the following option:
  11050. @table @option
  11051. @item planes
  11052. Set which planes will be processed, unprocessed planes will be copied.
  11053. By default value 0xf, all planes will be processed.
  11054. @item scale
  11055. Set value which will be multiplied with filtered result.
  11056. @item delta
  11057. Set value which will be added to filtered result.
  11058. @end table
  11059. @section rotate
  11060. Rotate video by an arbitrary angle expressed in radians.
  11061. The filter accepts the following options:
  11062. A description of the optional parameters follows.
  11063. @table @option
  11064. @item angle, a
  11065. Set an expression for the angle by which to rotate the input video
  11066. clockwise, expressed as a number of radians. A negative value will
  11067. result in a counter-clockwise rotation. By default it is set to "0".
  11068. This expression is evaluated for each frame.
  11069. @item out_w, ow
  11070. Set the output width expression, default value is "iw".
  11071. This expression is evaluated just once during configuration.
  11072. @item out_h, oh
  11073. Set the output height expression, default value is "ih".
  11074. This expression is evaluated just once during configuration.
  11075. @item bilinear
  11076. Enable bilinear interpolation if set to 1, a value of 0 disables
  11077. it. Default value is 1.
  11078. @item fillcolor, c
  11079. Set the color used to fill the output area not covered by the rotated
  11080. image. For the general syntax of this option, check the
  11081. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11082. If the special value "none" is selected then no
  11083. background is printed (useful for example if the background is never shown).
  11084. Default value is "black".
  11085. @end table
  11086. The expressions for the angle and the output size can contain the
  11087. following constants and functions:
  11088. @table @option
  11089. @item n
  11090. sequential number of the input frame, starting from 0. It is always NAN
  11091. before the first frame is filtered.
  11092. @item t
  11093. time in seconds of the input frame, it is set to 0 when the filter is
  11094. configured. It is always NAN before the first frame is filtered.
  11095. @item hsub
  11096. @item vsub
  11097. horizontal and vertical chroma subsample values. For example for the
  11098. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11099. @item in_w, iw
  11100. @item in_h, ih
  11101. the input video width and height
  11102. @item out_w, ow
  11103. @item out_h, oh
  11104. the output width and height, that is the size of the padded area as
  11105. specified by the @var{width} and @var{height} expressions
  11106. @item rotw(a)
  11107. @item roth(a)
  11108. the minimal width/height required for completely containing the input
  11109. video rotated by @var{a} radians.
  11110. These are only available when computing the @option{out_w} and
  11111. @option{out_h} expressions.
  11112. @end table
  11113. @subsection Examples
  11114. @itemize
  11115. @item
  11116. Rotate the input by PI/6 radians clockwise:
  11117. @example
  11118. rotate=PI/6
  11119. @end example
  11120. @item
  11121. Rotate the input by PI/6 radians counter-clockwise:
  11122. @example
  11123. rotate=-PI/6
  11124. @end example
  11125. @item
  11126. Rotate the input by 45 degrees clockwise:
  11127. @example
  11128. rotate=45*PI/180
  11129. @end example
  11130. @item
  11131. Apply a constant rotation with period T, starting from an angle of PI/3:
  11132. @example
  11133. rotate=PI/3+2*PI*t/T
  11134. @end example
  11135. @item
  11136. Make the input video rotation oscillating with a period of T
  11137. seconds and an amplitude of A radians:
  11138. @example
  11139. rotate=A*sin(2*PI/T*t)
  11140. @end example
  11141. @item
  11142. Rotate the video, output size is chosen so that the whole rotating
  11143. input video is always completely contained in the output:
  11144. @example
  11145. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  11146. @end example
  11147. @item
  11148. Rotate the video, reduce the output size so that no background is ever
  11149. shown:
  11150. @example
  11151. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  11152. @end example
  11153. @end itemize
  11154. @subsection Commands
  11155. The filter supports the following commands:
  11156. @table @option
  11157. @item a, angle
  11158. Set the angle expression.
  11159. The command accepts the same syntax of the corresponding option.
  11160. If the specified expression is not valid, it is kept at its current
  11161. value.
  11162. @end table
  11163. @section sab
  11164. Apply Shape Adaptive Blur.
  11165. The filter accepts the following options:
  11166. @table @option
  11167. @item luma_radius, lr
  11168. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  11169. value is 1.0. A greater value will result in a more blurred image, and
  11170. in slower processing.
  11171. @item luma_pre_filter_radius, lpfr
  11172. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  11173. value is 1.0.
  11174. @item luma_strength, ls
  11175. Set luma maximum difference between pixels to still be considered, must
  11176. be a value in the 0.1-100.0 range, default value is 1.0.
  11177. @item chroma_radius, cr
  11178. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  11179. greater value will result in a more blurred image, and in slower
  11180. processing.
  11181. @item chroma_pre_filter_radius, cpfr
  11182. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  11183. @item chroma_strength, cs
  11184. Set chroma maximum difference between pixels to still be considered,
  11185. must be a value in the -0.9-100.0 range.
  11186. @end table
  11187. Each chroma option value, if not explicitly specified, is set to the
  11188. corresponding luma option value.
  11189. @anchor{scale}
  11190. @section scale
  11191. Scale (resize) the input video, using the libswscale library.
  11192. The scale filter forces the output display aspect ratio to be the same
  11193. of the input, by changing the output sample aspect ratio.
  11194. If the input image format is different from the format requested by
  11195. the next filter, the scale filter will convert the input to the
  11196. requested format.
  11197. @subsection Options
  11198. The filter accepts the following options, or any of the options
  11199. supported by the libswscale scaler.
  11200. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  11201. the complete list of scaler options.
  11202. @table @option
  11203. @item width, w
  11204. @item height, h
  11205. Set the output video dimension expression. Default value is the input
  11206. dimension.
  11207. If the @var{width} or @var{w} value is 0, the input width is used for
  11208. the output. If the @var{height} or @var{h} value is 0, the input height
  11209. is used for the output.
  11210. If one and only one of the values is -n with n >= 1, the scale filter
  11211. will use a value that maintains the aspect ratio of the input image,
  11212. calculated from the other specified dimension. After that it will,
  11213. however, make sure that the calculated dimension is divisible by n and
  11214. adjust the value if necessary.
  11215. If both values are -n with n >= 1, the behavior will be identical to
  11216. both values being set to 0 as previously detailed.
  11217. See below for the list of accepted constants for use in the dimension
  11218. expression.
  11219. @item eval
  11220. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  11221. @table @samp
  11222. @item init
  11223. Only evaluate expressions once during the filter initialization or when a command is processed.
  11224. @item frame
  11225. Evaluate expressions for each incoming frame.
  11226. @end table
  11227. Default value is @samp{init}.
  11228. @item interl
  11229. Set the interlacing mode. It accepts the following values:
  11230. @table @samp
  11231. @item 1
  11232. Force interlaced aware scaling.
  11233. @item 0
  11234. Do not apply interlaced scaling.
  11235. @item -1
  11236. Select interlaced aware scaling depending on whether the source frames
  11237. are flagged as interlaced or not.
  11238. @end table
  11239. Default value is @samp{0}.
  11240. @item flags
  11241. Set libswscale scaling flags. See
  11242. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11243. complete list of values. If not explicitly specified the filter applies
  11244. the default flags.
  11245. @item param0, param1
  11246. Set libswscale input parameters for scaling algorithms that need them. See
  11247. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11248. complete documentation. If not explicitly specified the filter applies
  11249. empty parameters.
  11250. @item size, s
  11251. Set the video size. For the syntax of this option, check the
  11252. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11253. @item in_color_matrix
  11254. @item out_color_matrix
  11255. Set in/output YCbCr color space type.
  11256. This allows the autodetected value to be overridden as well as allows forcing
  11257. a specific value used for the output and encoder.
  11258. If not specified, the color space type depends on the pixel format.
  11259. Possible values:
  11260. @table @samp
  11261. @item auto
  11262. Choose automatically.
  11263. @item bt709
  11264. Format conforming to International Telecommunication Union (ITU)
  11265. Recommendation BT.709.
  11266. @item fcc
  11267. Set color space conforming to the United States Federal Communications
  11268. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  11269. @item bt601
  11270. Set color space conforming to:
  11271. @itemize
  11272. @item
  11273. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  11274. @item
  11275. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  11276. @item
  11277. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  11278. @end itemize
  11279. @item smpte240m
  11280. Set color space conforming to SMPTE ST 240:1999.
  11281. @end table
  11282. @item in_range
  11283. @item out_range
  11284. Set in/output YCbCr sample range.
  11285. This allows the autodetected value to be overridden as well as allows forcing
  11286. a specific value used for the output and encoder. If not specified, the
  11287. range depends on the pixel format. Possible values:
  11288. @table @samp
  11289. @item auto/unknown
  11290. Choose automatically.
  11291. @item jpeg/full/pc
  11292. Set full range (0-255 in case of 8-bit luma).
  11293. @item mpeg/limited/tv
  11294. Set "MPEG" range (16-235 in case of 8-bit luma).
  11295. @end table
  11296. @item force_original_aspect_ratio
  11297. Enable decreasing or increasing output video width or height if necessary to
  11298. keep the original aspect ratio. Possible values:
  11299. @table @samp
  11300. @item disable
  11301. Scale the video as specified and disable this feature.
  11302. @item decrease
  11303. The output video dimensions will automatically be decreased if needed.
  11304. @item increase
  11305. The output video dimensions will automatically be increased if needed.
  11306. @end table
  11307. One useful instance of this option is that when you know a specific device's
  11308. maximum allowed resolution, you can use this to limit the output video to
  11309. that, while retaining the aspect ratio. For example, device A allows
  11310. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  11311. decrease) and specifying 1280x720 to the command line makes the output
  11312. 1280x533.
  11313. Please note that this is a different thing than specifying -1 for @option{w}
  11314. or @option{h}, you still need to specify the output resolution for this option
  11315. to work.
  11316. @end table
  11317. The values of the @option{w} and @option{h} options are expressions
  11318. containing the following constants:
  11319. @table @var
  11320. @item in_w
  11321. @item in_h
  11322. The input width and height
  11323. @item iw
  11324. @item ih
  11325. These are the same as @var{in_w} and @var{in_h}.
  11326. @item out_w
  11327. @item out_h
  11328. The output (scaled) width and height
  11329. @item ow
  11330. @item oh
  11331. These are the same as @var{out_w} and @var{out_h}
  11332. @item a
  11333. The same as @var{iw} / @var{ih}
  11334. @item sar
  11335. input sample aspect ratio
  11336. @item dar
  11337. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11338. @item hsub
  11339. @item vsub
  11340. horizontal and vertical input chroma subsample values. For example for the
  11341. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11342. @item ohsub
  11343. @item ovsub
  11344. horizontal and vertical output chroma subsample values. For example for the
  11345. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11346. @end table
  11347. @subsection Examples
  11348. @itemize
  11349. @item
  11350. Scale the input video to a size of 200x100
  11351. @example
  11352. scale=w=200:h=100
  11353. @end example
  11354. This is equivalent to:
  11355. @example
  11356. scale=200:100
  11357. @end example
  11358. or:
  11359. @example
  11360. scale=200x100
  11361. @end example
  11362. @item
  11363. Specify a size abbreviation for the output size:
  11364. @example
  11365. scale=qcif
  11366. @end example
  11367. which can also be written as:
  11368. @example
  11369. scale=size=qcif
  11370. @end example
  11371. @item
  11372. Scale the input to 2x:
  11373. @example
  11374. scale=w=2*iw:h=2*ih
  11375. @end example
  11376. @item
  11377. The above is the same as:
  11378. @example
  11379. scale=2*in_w:2*in_h
  11380. @end example
  11381. @item
  11382. Scale the input to 2x with forced interlaced scaling:
  11383. @example
  11384. scale=2*iw:2*ih:interl=1
  11385. @end example
  11386. @item
  11387. Scale the input to half size:
  11388. @example
  11389. scale=w=iw/2:h=ih/2
  11390. @end example
  11391. @item
  11392. Increase the width, and set the height to the same size:
  11393. @example
  11394. scale=3/2*iw:ow
  11395. @end example
  11396. @item
  11397. Seek Greek harmony:
  11398. @example
  11399. scale=iw:1/PHI*iw
  11400. scale=ih*PHI:ih
  11401. @end example
  11402. @item
  11403. Increase the height, and set the width to 3/2 of the height:
  11404. @example
  11405. scale=w=3/2*oh:h=3/5*ih
  11406. @end example
  11407. @item
  11408. Increase the size, making the size a multiple of the chroma
  11409. subsample values:
  11410. @example
  11411. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  11412. @end example
  11413. @item
  11414. Increase the width to a maximum of 500 pixels,
  11415. keeping the same aspect ratio as the input:
  11416. @example
  11417. scale=w='min(500\, iw*3/2):h=-1'
  11418. @end example
  11419. @item
  11420. Make pixels square by combining scale and setsar:
  11421. @example
  11422. scale='trunc(ih*dar):ih',setsar=1/1
  11423. @end example
  11424. @item
  11425. Make pixels square by combining scale and setsar,
  11426. making sure the resulting resolution is even (required by some codecs):
  11427. @example
  11428. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  11429. @end example
  11430. @end itemize
  11431. @subsection Commands
  11432. This filter supports the following commands:
  11433. @table @option
  11434. @item width, w
  11435. @item height, h
  11436. Set the output video dimension expression.
  11437. The command accepts the same syntax of the corresponding option.
  11438. If the specified expression is not valid, it is kept at its current
  11439. value.
  11440. @end table
  11441. @section scale_npp
  11442. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  11443. format conversion on CUDA video frames. Setting the output width and height
  11444. works in the same way as for the @var{scale} filter.
  11445. The following additional options are accepted:
  11446. @table @option
  11447. @item format
  11448. The pixel format of the output CUDA frames. If set to the string "same" (the
  11449. default), the input format will be kept. Note that automatic format negotiation
  11450. and conversion is not yet supported for hardware frames
  11451. @item interp_algo
  11452. The interpolation algorithm used for resizing. One of the following:
  11453. @table @option
  11454. @item nn
  11455. Nearest neighbour.
  11456. @item linear
  11457. @item cubic
  11458. @item cubic2p_bspline
  11459. 2-parameter cubic (B=1, C=0)
  11460. @item cubic2p_catmullrom
  11461. 2-parameter cubic (B=0, C=1/2)
  11462. @item cubic2p_b05c03
  11463. 2-parameter cubic (B=1/2, C=3/10)
  11464. @item super
  11465. Supersampling
  11466. @item lanczos
  11467. @end table
  11468. @end table
  11469. @section scale2ref
  11470. Scale (resize) the input video, based on a reference video.
  11471. See the scale filter for available options, scale2ref supports the same but
  11472. uses the reference video instead of the main input as basis. scale2ref also
  11473. supports the following additional constants for the @option{w} and
  11474. @option{h} options:
  11475. @table @var
  11476. @item main_w
  11477. @item main_h
  11478. The main input video's width and height
  11479. @item main_a
  11480. The same as @var{main_w} / @var{main_h}
  11481. @item main_sar
  11482. The main input video's sample aspect ratio
  11483. @item main_dar, mdar
  11484. The main input video's display aspect ratio. Calculated from
  11485. @code{(main_w / main_h) * main_sar}.
  11486. @item main_hsub
  11487. @item main_vsub
  11488. The main input video's horizontal and vertical chroma subsample values.
  11489. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  11490. is 1.
  11491. @end table
  11492. @subsection Examples
  11493. @itemize
  11494. @item
  11495. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  11496. @example
  11497. 'scale2ref[b][a];[a][b]overlay'
  11498. @end example
  11499. @end itemize
  11500. @anchor{selectivecolor}
  11501. @section selectivecolor
  11502. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  11503. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  11504. by the "purity" of the color (that is, how saturated it already is).
  11505. This filter is similar to the Adobe Photoshop Selective Color tool.
  11506. The filter accepts the following options:
  11507. @table @option
  11508. @item correction_method
  11509. Select color correction method.
  11510. Available values are:
  11511. @table @samp
  11512. @item absolute
  11513. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  11514. component value).
  11515. @item relative
  11516. Specified adjustments are relative to the original component value.
  11517. @end table
  11518. Default is @code{absolute}.
  11519. @item reds
  11520. Adjustments for red pixels (pixels where the red component is the maximum)
  11521. @item yellows
  11522. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  11523. @item greens
  11524. Adjustments for green pixels (pixels where the green component is the maximum)
  11525. @item cyans
  11526. Adjustments for cyan pixels (pixels where the red component is the minimum)
  11527. @item blues
  11528. Adjustments for blue pixels (pixels where the blue component is the maximum)
  11529. @item magentas
  11530. Adjustments for magenta pixels (pixels where the green component is the minimum)
  11531. @item whites
  11532. Adjustments for white pixels (pixels where all components are greater than 128)
  11533. @item neutrals
  11534. Adjustments for all pixels except pure black and pure white
  11535. @item blacks
  11536. Adjustments for black pixels (pixels where all components are lesser than 128)
  11537. @item psfile
  11538. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  11539. @end table
  11540. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  11541. 4 space separated floating point adjustment values in the [-1,1] range,
  11542. respectively to adjust the amount of cyan, magenta, yellow and black for the
  11543. pixels of its range.
  11544. @subsection Examples
  11545. @itemize
  11546. @item
  11547. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  11548. increase magenta by 27% in blue areas:
  11549. @example
  11550. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  11551. @end example
  11552. @item
  11553. Use a Photoshop selective color preset:
  11554. @example
  11555. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  11556. @end example
  11557. @end itemize
  11558. @anchor{separatefields}
  11559. @section separatefields
  11560. The @code{separatefields} takes a frame-based video input and splits
  11561. each frame into its components fields, producing a new half height clip
  11562. with twice the frame rate and twice the frame count.
  11563. This filter use field-dominance information in frame to decide which
  11564. of each pair of fields to place first in the output.
  11565. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  11566. @section setdar, setsar
  11567. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  11568. output video.
  11569. This is done by changing the specified Sample (aka Pixel) Aspect
  11570. Ratio, according to the following equation:
  11571. @example
  11572. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  11573. @end example
  11574. Keep in mind that the @code{setdar} filter does not modify the pixel
  11575. dimensions of the video frame. Also, the display aspect ratio set by
  11576. this filter may be changed by later filters in the filterchain,
  11577. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  11578. applied.
  11579. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  11580. the filter output video.
  11581. Note that as a consequence of the application of this filter, the
  11582. output display aspect ratio will change according to the equation
  11583. above.
  11584. Keep in mind that the sample aspect ratio set by the @code{setsar}
  11585. filter may be changed by later filters in the filterchain, e.g. if
  11586. another "setsar" or a "setdar" filter is applied.
  11587. It accepts the following parameters:
  11588. @table @option
  11589. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  11590. Set the aspect ratio used by the filter.
  11591. The parameter can be a floating point number string, an expression, or
  11592. a string of the form @var{num}:@var{den}, where @var{num} and
  11593. @var{den} are the numerator and denominator of the aspect ratio. If
  11594. the parameter is not specified, it is assumed the value "0".
  11595. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  11596. should be escaped.
  11597. @item max
  11598. Set the maximum integer value to use for expressing numerator and
  11599. denominator when reducing the expressed aspect ratio to a rational.
  11600. Default value is @code{100}.
  11601. @end table
  11602. The parameter @var{sar} is an expression containing
  11603. the following constants:
  11604. @table @option
  11605. @item E, PI, PHI
  11606. These are approximated values for the mathematical constants e
  11607. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  11608. @item w, h
  11609. The input width and height.
  11610. @item a
  11611. These are the same as @var{w} / @var{h}.
  11612. @item sar
  11613. The input sample aspect ratio.
  11614. @item dar
  11615. The input display aspect ratio. It is the same as
  11616. (@var{w} / @var{h}) * @var{sar}.
  11617. @item hsub, vsub
  11618. Horizontal and vertical chroma subsample values. For example, for the
  11619. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11620. @end table
  11621. @subsection Examples
  11622. @itemize
  11623. @item
  11624. To change the display aspect ratio to 16:9, specify one of the following:
  11625. @example
  11626. setdar=dar=1.77777
  11627. setdar=dar=16/9
  11628. @end example
  11629. @item
  11630. To change the sample aspect ratio to 10:11, specify:
  11631. @example
  11632. setsar=sar=10/11
  11633. @end example
  11634. @item
  11635. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  11636. 1000 in the aspect ratio reduction, use the command:
  11637. @example
  11638. setdar=ratio=16/9:max=1000
  11639. @end example
  11640. @end itemize
  11641. @anchor{setfield}
  11642. @section setfield
  11643. Force field for the output video frame.
  11644. The @code{setfield} filter marks the interlace type field for the
  11645. output frames. It does not change the input frame, but only sets the
  11646. corresponding property, which affects how the frame is treated by
  11647. following filters (e.g. @code{fieldorder} or @code{yadif}).
  11648. The filter accepts the following options:
  11649. @table @option
  11650. @item mode
  11651. Available values are:
  11652. @table @samp
  11653. @item auto
  11654. Keep the same field property.
  11655. @item bff
  11656. Mark the frame as bottom-field-first.
  11657. @item tff
  11658. Mark the frame as top-field-first.
  11659. @item prog
  11660. Mark the frame as progressive.
  11661. @end table
  11662. @end table
  11663. @anchor{setparams}
  11664. @section setparams
  11665. Force frame parameter for the output video frame.
  11666. The @code{setparams} filter marks interlace and color range for the
  11667. output frames. It does not change the input frame, but only sets the
  11668. corresponding property, which affects how the frame is treated by
  11669. filters/encoders.
  11670. @table @option
  11671. @item field_mode
  11672. Available values are:
  11673. @table @samp
  11674. @item auto
  11675. Keep the same field property (default).
  11676. @item bff
  11677. Mark the frame as bottom-field-first.
  11678. @item tff
  11679. Mark the frame as top-field-first.
  11680. @item prog
  11681. Mark the frame as progressive.
  11682. @end table
  11683. @item range
  11684. Available values are:
  11685. @table @samp
  11686. @item auto
  11687. Keep the same color range property (default).
  11688. @item unspecified, unknown
  11689. Mark the frame as unspecified color range.
  11690. @item limited, tv, mpeg
  11691. Mark the frame as limited range.
  11692. @item full, pc, jpeg
  11693. Mark the frame as full range.
  11694. @end table
  11695. @item color_primaries
  11696. Set the color primaries.
  11697. Available values are:
  11698. @table @samp
  11699. @item auto
  11700. Keep the same color primaries property (default).
  11701. @item bt709
  11702. @item unknown
  11703. @item bt470m
  11704. @item bt470bg
  11705. @item smpte170m
  11706. @item smpte240m
  11707. @item film
  11708. @item bt2020
  11709. @item smpte428
  11710. @item smpte431
  11711. @item smpte432
  11712. @item jedec-p22
  11713. @end table
  11714. @item color_trc
  11715. Set the color transfer.
  11716. Available values are:
  11717. @table @samp
  11718. @item auto
  11719. Keep the same color trc property (default).
  11720. @item bt709
  11721. @item unknown
  11722. @item bt470m
  11723. @item bt470bg
  11724. @item smpte170m
  11725. @item smpte240m
  11726. @item linear
  11727. @item log100
  11728. @item log316
  11729. @item iec61966-2-4
  11730. @item bt1361e
  11731. @item iec61966-2-1
  11732. @item bt2020-10
  11733. @item bt2020-12
  11734. @item smpte2084
  11735. @item smpte428
  11736. @item arib-std-b67
  11737. @end table
  11738. @item colorspace
  11739. Set the colorspace.
  11740. Available values are:
  11741. @table @samp
  11742. @item auto
  11743. Keep the same colorspace property (default).
  11744. @item gbr
  11745. @item bt709
  11746. @item unknown
  11747. @item fcc
  11748. @item bt470bg
  11749. @item smpte170m
  11750. @item smpte240m
  11751. @item ycgco
  11752. @item bt2020nc
  11753. @item bt2020c
  11754. @item smpte2085
  11755. @item chroma-derived-nc
  11756. @item chroma-derived-c
  11757. @item ictcp
  11758. @end table
  11759. @end table
  11760. @section showinfo
  11761. Show a line containing various information for each input video frame.
  11762. The input video is not modified.
  11763. This filter supports the following options:
  11764. @table @option
  11765. @item checksum
  11766. Calculate checksums of each plane. By default enabled.
  11767. @end table
  11768. The shown line contains a sequence of key/value pairs of the form
  11769. @var{key}:@var{value}.
  11770. The following values are shown in the output:
  11771. @table @option
  11772. @item n
  11773. The (sequential) number of the input frame, starting from 0.
  11774. @item pts
  11775. The Presentation TimeStamp of the input frame, expressed as a number of
  11776. time base units. The time base unit depends on the filter input pad.
  11777. @item pts_time
  11778. The Presentation TimeStamp of the input frame, expressed as a number of
  11779. seconds.
  11780. @item pos
  11781. The position of the frame in the input stream, or -1 if this information is
  11782. unavailable and/or meaningless (for example in case of synthetic video).
  11783. @item fmt
  11784. The pixel format name.
  11785. @item sar
  11786. The sample aspect ratio of the input frame, expressed in the form
  11787. @var{num}/@var{den}.
  11788. @item s
  11789. The size of the input frame. For the syntax of this option, check the
  11790. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11791. @item i
  11792. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  11793. for bottom field first).
  11794. @item iskey
  11795. This is 1 if the frame is a key frame, 0 otherwise.
  11796. @item type
  11797. The picture type of the input frame ("I" for an I-frame, "P" for a
  11798. P-frame, "B" for a B-frame, or "?" for an unknown type).
  11799. Also refer to the documentation of the @code{AVPictureType} enum and of
  11800. the @code{av_get_picture_type_char} function defined in
  11801. @file{libavutil/avutil.h}.
  11802. @item checksum
  11803. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  11804. @item plane_checksum
  11805. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  11806. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  11807. @end table
  11808. @section showpalette
  11809. Displays the 256 colors palette of each frame. This filter is only relevant for
  11810. @var{pal8} pixel format frames.
  11811. It accepts the following option:
  11812. @table @option
  11813. @item s
  11814. Set the size of the box used to represent one palette color entry. Default is
  11815. @code{30} (for a @code{30x30} pixel box).
  11816. @end table
  11817. @section shuffleframes
  11818. Reorder and/or duplicate and/or drop video frames.
  11819. It accepts the following parameters:
  11820. @table @option
  11821. @item mapping
  11822. Set the destination indexes of input frames.
  11823. This is space or '|' separated list of indexes that maps input frames to output
  11824. frames. Number of indexes also sets maximal value that each index may have.
  11825. '-1' index have special meaning and that is to drop frame.
  11826. @end table
  11827. The first frame has the index 0. The default is to keep the input unchanged.
  11828. @subsection Examples
  11829. @itemize
  11830. @item
  11831. Swap second and third frame of every three frames of the input:
  11832. @example
  11833. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  11834. @end example
  11835. @item
  11836. Swap 10th and 1st frame of every ten frames of the input:
  11837. @example
  11838. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  11839. @end example
  11840. @end itemize
  11841. @section shuffleplanes
  11842. Reorder and/or duplicate video planes.
  11843. It accepts the following parameters:
  11844. @table @option
  11845. @item map0
  11846. The index of the input plane to be used as the first output plane.
  11847. @item map1
  11848. The index of the input plane to be used as the second output plane.
  11849. @item map2
  11850. The index of the input plane to be used as the third output plane.
  11851. @item map3
  11852. The index of the input plane to be used as the fourth output plane.
  11853. @end table
  11854. The first plane has the index 0. The default is to keep the input unchanged.
  11855. @subsection Examples
  11856. @itemize
  11857. @item
  11858. Swap the second and third planes of the input:
  11859. @example
  11860. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  11861. @end example
  11862. @end itemize
  11863. @anchor{signalstats}
  11864. @section signalstats
  11865. Evaluate various visual metrics that assist in determining issues associated
  11866. with the digitization of analog video media.
  11867. By default the filter will log these metadata values:
  11868. @table @option
  11869. @item YMIN
  11870. Display the minimal Y value contained within the input frame. Expressed in
  11871. range of [0-255].
  11872. @item YLOW
  11873. Display the Y value at the 10% percentile within the input frame. Expressed in
  11874. range of [0-255].
  11875. @item YAVG
  11876. Display the average Y value within the input frame. Expressed in range of
  11877. [0-255].
  11878. @item YHIGH
  11879. Display the Y value at the 90% percentile within the input frame. Expressed in
  11880. range of [0-255].
  11881. @item YMAX
  11882. Display the maximum Y value contained within the input frame. Expressed in
  11883. range of [0-255].
  11884. @item UMIN
  11885. Display the minimal U value contained within the input frame. Expressed in
  11886. range of [0-255].
  11887. @item ULOW
  11888. Display the U value at the 10% percentile within the input frame. Expressed in
  11889. range of [0-255].
  11890. @item UAVG
  11891. Display the average U value within the input frame. Expressed in range of
  11892. [0-255].
  11893. @item UHIGH
  11894. Display the U value at the 90% percentile within the input frame. Expressed in
  11895. range of [0-255].
  11896. @item UMAX
  11897. Display the maximum U value contained within the input frame. Expressed in
  11898. range of [0-255].
  11899. @item VMIN
  11900. Display the minimal V value contained within the input frame. Expressed in
  11901. range of [0-255].
  11902. @item VLOW
  11903. Display the V value at the 10% percentile within the input frame. Expressed in
  11904. range of [0-255].
  11905. @item VAVG
  11906. Display the average V value within the input frame. Expressed in range of
  11907. [0-255].
  11908. @item VHIGH
  11909. Display the V value at the 90% percentile within the input frame. Expressed in
  11910. range of [0-255].
  11911. @item VMAX
  11912. Display the maximum V value contained within the input frame. Expressed in
  11913. range of [0-255].
  11914. @item SATMIN
  11915. Display the minimal saturation value contained within the input frame.
  11916. Expressed in range of [0-~181.02].
  11917. @item SATLOW
  11918. Display the saturation value at the 10% percentile within the input frame.
  11919. Expressed in range of [0-~181.02].
  11920. @item SATAVG
  11921. Display the average saturation value within the input frame. Expressed in range
  11922. of [0-~181.02].
  11923. @item SATHIGH
  11924. Display the saturation value at the 90% percentile within the input frame.
  11925. Expressed in range of [0-~181.02].
  11926. @item SATMAX
  11927. Display the maximum saturation value contained within the input frame.
  11928. Expressed in range of [0-~181.02].
  11929. @item HUEMED
  11930. Display the median value for hue within the input frame. Expressed in range of
  11931. [0-360].
  11932. @item HUEAVG
  11933. Display the average value for hue within the input frame. Expressed in range of
  11934. [0-360].
  11935. @item YDIF
  11936. Display the average of sample value difference between all values of the Y
  11937. plane in the current frame and corresponding values of the previous input frame.
  11938. Expressed in range of [0-255].
  11939. @item UDIF
  11940. Display the average of sample value difference between all values of the U
  11941. plane in the current frame and corresponding values of the previous input frame.
  11942. Expressed in range of [0-255].
  11943. @item VDIF
  11944. Display the average of sample value difference between all values of the V
  11945. plane in the current frame and corresponding values of the previous input frame.
  11946. Expressed in range of [0-255].
  11947. @item YBITDEPTH
  11948. Display bit depth of Y plane in current frame.
  11949. Expressed in range of [0-16].
  11950. @item UBITDEPTH
  11951. Display bit depth of U plane in current frame.
  11952. Expressed in range of [0-16].
  11953. @item VBITDEPTH
  11954. Display bit depth of V plane in current frame.
  11955. Expressed in range of [0-16].
  11956. @end table
  11957. The filter accepts the following options:
  11958. @table @option
  11959. @item stat
  11960. @item out
  11961. @option{stat} specify an additional form of image analysis.
  11962. @option{out} output video with the specified type of pixel highlighted.
  11963. Both options accept the following values:
  11964. @table @samp
  11965. @item tout
  11966. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  11967. unlike the neighboring pixels of the same field. Examples of temporal outliers
  11968. include the results of video dropouts, head clogs, or tape tracking issues.
  11969. @item vrep
  11970. Identify @var{vertical line repetition}. Vertical line repetition includes
  11971. similar rows of pixels within a frame. In born-digital video vertical line
  11972. repetition is common, but this pattern is uncommon in video digitized from an
  11973. analog source. When it occurs in video that results from the digitization of an
  11974. analog source it can indicate concealment from a dropout compensator.
  11975. @item brng
  11976. Identify pixels that fall outside of legal broadcast range.
  11977. @end table
  11978. @item color, c
  11979. Set the highlight color for the @option{out} option. The default color is
  11980. yellow.
  11981. @end table
  11982. @subsection Examples
  11983. @itemize
  11984. @item
  11985. Output data of various video metrics:
  11986. @example
  11987. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  11988. @end example
  11989. @item
  11990. Output specific data about the minimum and maximum values of the Y plane per frame:
  11991. @example
  11992. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  11993. @end example
  11994. @item
  11995. Playback video while highlighting pixels that are outside of broadcast range in red.
  11996. @example
  11997. ffplay example.mov -vf signalstats="out=brng:color=red"
  11998. @end example
  11999. @item
  12000. Playback video with signalstats metadata drawn over the frame.
  12001. @example
  12002. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  12003. @end example
  12004. The contents of signalstat_drawtext.txt used in the command are:
  12005. @example
  12006. time %@{pts:hms@}
  12007. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  12008. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  12009. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  12010. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  12011. @end example
  12012. @end itemize
  12013. @anchor{signature}
  12014. @section signature
  12015. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  12016. input. In this case the matching between the inputs can be calculated additionally.
  12017. The filter always passes through the first input. The signature of each stream can
  12018. be written into a file.
  12019. It accepts the following options:
  12020. @table @option
  12021. @item detectmode
  12022. Enable or disable the matching process.
  12023. Available values are:
  12024. @table @samp
  12025. @item off
  12026. Disable the calculation of a matching (default).
  12027. @item full
  12028. Calculate the matching for the whole video and output whether the whole video
  12029. matches or only parts.
  12030. @item fast
  12031. Calculate only until a matching is found or the video ends. Should be faster in
  12032. some cases.
  12033. @end table
  12034. @item nb_inputs
  12035. Set the number of inputs. The option value must be a non negative integer.
  12036. Default value is 1.
  12037. @item filename
  12038. Set the path to which the output is written. If there is more than one input,
  12039. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  12040. integer), that will be replaced with the input number. If no filename is
  12041. specified, no output will be written. This is the default.
  12042. @item format
  12043. Choose the output format.
  12044. Available values are:
  12045. @table @samp
  12046. @item binary
  12047. Use the specified binary representation (default).
  12048. @item xml
  12049. Use the specified xml representation.
  12050. @end table
  12051. @item th_d
  12052. Set threshold to detect one word as similar. The option value must be an integer
  12053. greater than zero. The default value is 9000.
  12054. @item th_dc
  12055. Set threshold to detect all words as similar. The option value must be an integer
  12056. greater than zero. The default value is 60000.
  12057. @item th_xh
  12058. Set threshold to detect frames as similar. The option value must be an integer
  12059. greater than zero. The default value is 116.
  12060. @item th_di
  12061. Set the minimum length of a sequence in frames to recognize it as matching
  12062. sequence. The option value must be a non negative integer value.
  12063. The default value is 0.
  12064. @item th_it
  12065. Set the minimum relation, that matching frames to all frames must have.
  12066. The option value must be a double value between 0 and 1. The default value is 0.5.
  12067. @end table
  12068. @subsection Examples
  12069. @itemize
  12070. @item
  12071. To calculate the signature of an input video and store it in signature.bin:
  12072. @example
  12073. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  12074. @end example
  12075. @item
  12076. To detect whether two videos match and store the signatures in XML format in
  12077. signature0.xml and signature1.xml:
  12078. @example
  12079. 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 -
  12080. @end example
  12081. @end itemize
  12082. @anchor{smartblur}
  12083. @section smartblur
  12084. Blur the input video without impacting the outlines.
  12085. It accepts the following options:
  12086. @table @option
  12087. @item luma_radius, lr
  12088. Set the luma radius. The option value must be a float number in
  12089. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12090. used to blur the image (slower if larger). Default value is 1.0.
  12091. @item luma_strength, ls
  12092. Set the luma strength. The option value must be a float number
  12093. in the range [-1.0,1.0] that configures the blurring. A value included
  12094. in [0.0,1.0] will blur the image whereas a value included in
  12095. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  12096. @item luma_threshold, lt
  12097. Set the luma threshold used as a coefficient to determine
  12098. whether a pixel should be blurred or not. The option value must be an
  12099. integer in the range [-30,30]. A value of 0 will filter all the image,
  12100. a value included in [0,30] will filter flat areas and a value included
  12101. in [-30,0] will filter edges. Default value is 0.
  12102. @item chroma_radius, cr
  12103. Set the chroma radius. The option value must be a float number in
  12104. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12105. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  12106. @item chroma_strength, cs
  12107. Set the chroma strength. The option value must be a float number
  12108. in the range [-1.0,1.0] that configures the blurring. A value included
  12109. in [0.0,1.0] will blur the image whereas a value included in
  12110. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  12111. @item chroma_threshold, ct
  12112. Set the chroma threshold used as a coefficient to determine
  12113. whether a pixel should be blurred or not. The option value must be an
  12114. integer in the range [-30,30]. A value of 0 will filter all the image,
  12115. a value included in [0,30] will filter flat areas and a value included
  12116. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  12117. @end table
  12118. If a chroma option is not explicitly set, the corresponding luma value
  12119. is set.
  12120. @section ssim
  12121. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  12122. This filter takes in input two input videos, the first input is
  12123. considered the "main" source and is passed unchanged to the
  12124. output. The second input is used as a "reference" video for computing
  12125. the SSIM.
  12126. Both video inputs must have the same resolution and pixel format for
  12127. this filter to work correctly. Also it assumes that both inputs
  12128. have the same number of frames, which are compared one by one.
  12129. The filter stores the calculated SSIM of each frame.
  12130. The description of the accepted parameters follows.
  12131. @table @option
  12132. @item stats_file, f
  12133. If specified the filter will use the named file to save the SSIM of
  12134. each individual frame. When filename equals "-" the data is sent to
  12135. standard output.
  12136. @end table
  12137. The file printed if @var{stats_file} is selected, contains a sequence of
  12138. key/value pairs of the form @var{key}:@var{value} for each compared
  12139. couple of frames.
  12140. A description of each shown parameter follows:
  12141. @table @option
  12142. @item n
  12143. sequential number of the input frame, starting from 1
  12144. @item Y, U, V, R, G, B
  12145. SSIM of the compared frames for the component specified by the suffix.
  12146. @item All
  12147. SSIM of the compared frames for the whole frame.
  12148. @item dB
  12149. Same as above but in dB representation.
  12150. @end table
  12151. This filter also supports the @ref{framesync} options.
  12152. For example:
  12153. @example
  12154. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12155. [main][ref] ssim="stats_file=stats.log" [out]
  12156. @end example
  12157. On this example the input file being processed is compared with the
  12158. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  12159. is stored in @file{stats.log}.
  12160. Another example with both psnr and ssim at same time:
  12161. @example
  12162. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  12163. @end example
  12164. @section stereo3d
  12165. Convert between different stereoscopic image formats.
  12166. The filters accept the following options:
  12167. @table @option
  12168. @item in
  12169. Set stereoscopic image format of input.
  12170. Available values for input image formats are:
  12171. @table @samp
  12172. @item sbsl
  12173. side by side parallel (left eye left, right eye right)
  12174. @item sbsr
  12175. side by side crosseye (right eye left, left eye right)
  12176. @item sbs2l
  12177. side by side parallel with half width resolution
  12178. (left eye left, right eye right)
  12179. @item sbs2r
  12180. side by side crosseye with half width resolution
  12181. (right eye left, left eye right)
  12182. @item abl
  12183. above-below (left eye above, right eye below)
  12184. @item abr
  12185. above-below (right eye above, left eye below)
  12186. @item ab2l
  12187. above-below with half height resolution
  12188. (left eye above, right eye below)
  12189. @item ab2r
  12190. above-below with half height resolution
  12191. (right eye above, left eye below)
  12192. @item al
  12193. alternating frames (left eye first, right eye second)
  12194. @item ar
  12195. alternating frames (right eye first, left eye second)
  12196. @item irl
  12197. interleaved rows (left eye has top row, right eye starts on next row)
  12198. @item irr
  12199. interleaved rows (right eye has top row, left eye starts on next row)
  12200. @item icl
  12201. interleaved columns, left eye first
  12202. @item icr
  12203. interleaved columns, right eye first
  12204. Default value is @samp{sbsl}.
  12205. @end table
  12206. @item out
  12207. Set stereoscopic image format of output.
  12208. @table @samp
  12209. @item sbsl
  12210. side by side parallel (left eye left, right eye right)
  12211. @item sbsr
  12212. side by side crosseye (right eye left, left eye right)
  12213. @item sbs2l
  12214. side by side parallel with half width resolution
  12215. (left eye left, right eye right)
  12216. @item sbs2r
  12217. side by side crosseye with half width resolution
  12218. (right eye left, left eye right)
  12219. @item abl
  12220. above-below (left eye above, right eye below)
  12221. @item abr
  12222. above-below (right eye above, left eye below)
  12223. @item ab2l
  12224. above-below with half height resolution
  12225. (left eye above, right eye below)
  12226. @item ab2r
  12227. above-below with half height resolution
  12228. (right eye above, left eye below)
  12229. @item al
  12230. alternating frames (left eye first, right eye second)
  12231. @item ar
  12232. alternating frames (right eye first, left eye second)
  12233. @item irl
  12234. interleaved rows (left eye has top row, right eye starts on next row)
  12235. @item irr
  12236. interleaved rows (right eye has top row, left eye starts on next row)
  12237. @item arbg
  12238. anaglyph red/blue gray
  12239. (red filter on left eye, blue filter on right eye)
  12240. @item argg
  12241. anaglyph red/green gray
  12242. (red filter on left eye, green filter on right eye)
  12243. @item arcg
  12244. anaglyph red/cyan gray
  12245. (red filter on left eye, cyan filter on right eye)
  12246. @item arch
  12247. anaglyph red/cyan half colored
  12248. (red filter on left eye, cyan filter on right eye)
  12249. @item arcc
  12250. anaglyph red/cyan color
  12251. (red filter on left eye, cyan filter on right eye)
  12252. @item arcd
  12253. anaglyph red/cyan color optimized with the least squares projection of dubois
  12254. (red filter on left eye, cyan filter on right eye)
  12255. @item agmg
  12256. anaglyph green/magenta gray
  12257. (green filter on left eye, magenta filter on right eye)
  12258. @item agmh
  12259. anaglyph green/magenta half colored
  12260. (green filter on left eye, magenta filter on right eye)
  12261. @item agmc
  12262. anaglyph green/magenta colored
  12263. (green filter on left eye, magenta filter on right eye)
  12264. @item agmd
  12265. anaglyph green/magenta color optimized with the least squares projection of dubois
  12266. (green filter on left eye, magenta filter on right eye)
  12267. @item aybg
  12268. anaglyph yellow/blue gray
  12269. (yellow filter on left eye, blue filter on right eye)
  12270. @item aybh
  12271. anaglyph yellow/blue half colored
  12272. (yellow filter on left eye, blue filter on right eye)
  12273. @item aybc
  12274. anaglyph yellow/blue colored
  12275. (yellow filter on left eye, blue filter on right eye)
  12276. @item aybd
  12277. anaglyph yellow/blue color optimized with the least squares projection of dubois
  12278. (yellow filter on left eye, blue filter on right eye)
  12279. @item ml
  12280. mono output (left eye only)
  12281. @item mr
  12282. mono output (right eye only)
  12283. @item chl
  12284. checkerboard, left eye first
  12285. @item chr
  12286. checkerboard, right eye first
  12287. @item icl
  12288. interleaved columns, left eye first
  12289. @item icr
  12290. interleaved columns, right eye first
  12291. @item hdmi
  12292. HDMI frame pack
  12293. @end table
  12294. Default value is @samp{arcd}.
  12295. @end table
  12296. @subsection Examples
  12297. @itemize
  12298. @item
  12299. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  12300. @example
  12301. stereo3d=sbsl:aybd
  12302. @end example
  12303. @item
  12304. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  12305. @example
  12306. stereo3d=abl:sbsr
  12307. @end example
  12308. @end itemize
  12309. @section streamselect, astreamselect
  12310. Select video or audio streams.
  12311. The filter accepts the following options:
  12312. @table @option
  12313. @item inputs
  12314. Set number of inputs. Default is 2.
  12315. @item map
  12316. Set input indexes to remap to outputs.
  12317. @end table
  12318. @subsection Commands
  12319. The @code{streamselect} and @code{astreamselect} filter supports the following
  12320. commands:
  12321. @table @option
  12322. @item map
  12323. Set input indexes to remap to outputs.
  12324. @end table
  12325. @subsection Examples
  12326. @itemize
  12327. @item
  12328. Select first 5 seconds 1st stream and rest of time 2nd stream:
  12329. @example
  12330. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  12331. @end example
  12332. @item
  12333. Same as above, but for audio:
  12334. @example
  12335. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  12336. @end example
  12337. @end itemize
  12338. @section sobel
  12339. Apply sobel operator to input video stream.
  12340. The filter accepts the following option:
  12341. @table @option
  12342. @item planes
  12343. Set which planes will be processed, unprocessed planes will be copied.
  12344. By default value 0xf, all planes will be processed.
  12345. @item scale
  12346. Set value which will be multiplied with filtered result.
  12347. @item delta
  12348. Set value which will be added to filtered result.
  12349. @end table
  12350. @anchor{spp}
  12351. @section spp
  12352. Apply a simple postprocessing filter that compresses and decompresses the image
  12353. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  12354. and average the results.
  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-6. If set to @code{0}, the filter will have no
  12360. effect. A value of @code{6} 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. @item mode
  12367. Set thresholding mode. Available modes are:
  12368. @table @samp
  12369. @item hard
  12370. Set hard thresholding (default).
  12371. @item soft
  12372. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12373. @end table
  12374. @item use_bframe_qp
  12375. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  12376. option may cause flicker since the B-Frames have often larger QP. Default is
  12377. @code{0} (not enabled).
  12378. @end table
  12379. @section sr
  12380. Scale the input by applying one of the super-resolution methods based on
  12381. convolutional neural networks. Supported models:
  12382. @itemize
  12383. @item
  12384. Super-Resolution Convolutional Neural Network model (SRCNN).
  12385. See @url{https://arxiv.org/abs/1501.00092}.
  12386. @item
  12387. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  12388. See @url{https://arxiv.org/abs/1609.05158}.
  12389. @end itemize
  12390. Training scripts as well as scripts for model generation are provided in
  12391. the repository at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  12392. The filter accepts the following options:
  12393. @table @option
  12394. @item dnn_backend
  12395. Specify which DNN backend to use for model loading and execution. This option accepts
  12396. the following values:
  12397. @table @samp
  12398. @item native
  12399. Native implementation of DNN loading and execution.
  12400. @item tensorflow
  12401. TensorFlow backend. To enable this backend you
  12402. need to install the TensorFlow for C library (see
  12403. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  12404. @code{--enable-libtensorflow}
  12405. @end table
  12406. Default value is @samp{native}.
  12407. @item model
  12408. Set path to model file specifying network architecture and its parameters.
  12409. Note that different backends use different file formats. TensorFlow backend
  12410. can load files for both formats, while native backend can load files for only
  12411. its format.
  12412. @item scale_factor
  12413. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  12414. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  12415. input upscaled using bicubic upscaling with proper scale factor.
  12416. @end table
  12417. @anchor{subtitles}
  12418. @section subtitles
  12419. Draw subtitles on top of input video using the libass library.
  12420. To enable compilation of this filter you need to configure FFmpeg with
  12421. @code{--enable-libass}. This filter also requires a build with libavcodec and
  12422. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  12423. Alpha) subtitles format.
  12424. The filter accepts the following options:
  12425. @table @option
  12426. @item filename, f
  12427. Set the filename of the subtitle file to read. It must be specified.
  12428. @item original_size
  12429. Specify the size of the original video, the video for which the ASS file
  12430. was composed. For the syntax of this option, check the
  12431. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12432. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  12433. correctly scale the fonts if the aspect ratio has been changed.
  12434. @item fontsdir
  12435. Set a directory path containing fonts that can be used by the filter.
  12436. These fonts will be used in addition to whatever the font provider uses.
  12437. @item alpha
  12438. Process alpha channel, by default alpha channel is untouched.
  12439. @item charenc
  12440. Set subtitles input character encoding. @code{subtitles} filter only. Only
  12441. useful if not UTF-8.
  12442. @item stream_index, si
  12443. Set subtitles stream index. @code{subtitles} filter only.
  12444. @item force_style
  12445. Override default style or script info parameters of the subtitles. It accepts a
  12446. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  12447. @end table
  12448. If the first key is not specified, it is assumed that the first value
  12449. specifies the @option{filename}.
  12450. For example, to render the file @file{sub.srt} on top of the input
  12451. video, use the command:
  12452. @example
  12453. subtitles=sub.srt
  12454. @end example
  12455. which is equivalent to:
  12456. @example
  12457. subtitles=filename=sub.srt
  12458. @end example
  12459. To render the default subtitles stream from file @file{video.mkv}, use:
  12460. @example
  12461. subtitles=video.mkv
  12462. @end example
  12463. To render the second subtitles stream from that file, use:
  12464. @example
  12465. subtitles=video.mkv:si=1
  12466. @end example
  12467. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  12468. @code{DejaVu Serif}, use:
  12469. @example
  12470. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  12471. @end example
  12472. @section super2xsai
  12473. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  12474. Interpolate) pixel art scaling algorithm.
  12475. Useful for enlarging pixel art images without reducing sharpness.
  12476. @section swaprect
  12477. Swap two rectangular objects in video.
  12478. This filter accepts the following options:
  12479. @table @option
  12480. @item w
  12481. Set object width.
  12482. @item h
  12483. Set object height.
  12484. @item x1
  12485. Set 1st rect x coordinate.
  12486. @item y1
  12487. Set 1st rect y coordinate.
  12488. @item x2
  12489. Set 2nd rect x coordinate.
  12490. @item y2
  12491. Set 2nd rect y coordinate.
  12492. All expressions are evaluated once for each frame.
  12493. @end table
  12494. The all options are expressions containing the following constants:
  12495. @table @option
  12496. @item w
  12497. @item h
  12498. The input width and height.
  12499. @item a
  12500. same as @var{w} / @var{h}
  12501. @item sar
  12502. input sample aspect ratio
  12503. @item dar
  12504. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  12505. @item n
  12506. The number of the input frame, starting from 0.
  12507. @item t
  12508. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  12509. @item pos
  12510. the position in the file of the input frame, NAN if unknown
  12511. @end table
  12512. @section swapuv
  12513. Swap U & V plane.
  12514. @section telecine
  12515. Apply telecine process to the video.
  12516. This filter accepts the following options:
  12517. @table @option
  12518. @item first_field
  12519. @table @samp
  12520. @item top, t
  12521. top field first
  12522. @item bottom, b
  12523. bottom field first
  12524. The default value is @code{top}.
  12525. @end table
  12526. @item pattern
  12527. A string of numbers representing the pulldown pattern you wish to apply.
  12528. The default value is @code{23}.
  12529. @end table
  12530. @example
  12531. Some typical patterns:
  12532. NTSC output (30i):
  12533. 27.5p: 32222
  12534. 24p: 23 (classic)
  12535. 24p: 2332 (preferred)
  12536. 20p: 33
  12537. 18p: 334
  12538. 16p: 3444
  12539. PAL output (25i):
  12540. 27.5p: 12222
  12541. 24p: 222222222223 ("Euro pulldown")
  12542. 16.67p: 33
  12543. 16p: 33333334
  12544. @end example
  12545. @section threshold
  12546. Apply threshold effect to video stream.
  12547. This filter needs four video streams to perform thresholding.
  12548. First stream is stream we are filtering.
  12549. Second stream is holding threshold values, third stream is holding min values,
  12550. and last, fourth stream is holding max values.
  12551. The filter accepts the following option:
  12552. @table @option
  12553. @item planes
  12554. Set which planes will be processed, unprocessed planes will be copied.
  12555. By default value 0xf, all planes will be processed.
  12556. @end table
  12557. For example if first stream pixel's component value is less then threshold value
  12558. of pixel component from 2nd threshold stream, third stream value will picked,
  12559. otherwise fourth stream pixel component value will be picked.
  12560. Using color source filter one can perform various types of thresholding:
  12561. @subsection Examples
  12562. @itemize
  12563. @item
  12564. Binary threshold, using gray color as threshold:
  12565. @example
  12566. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  12567. @end example
  12568. @item
  12569. Inverted binary threshold, using gray color as threshold:
  12570. @example
  12571. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  12572. @end example
  12573. @item
  12574. Truncate binary threshold, using gray color as threshold:
  12575. @example
  12576. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  12577. @end example
  12578. @item
  12579. Threshold to zero, using gray color as threshold:
  12580. @example
  12581. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  12582. @end example
  12583. @item
  12584. Inverted threshold to zero, using gray color as threshold:
  12585. @example
  12586. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  12587. @end example
  12588. @end itemize
  12589. @section thumbnail
  12590. Select the most representative frame in a given sequence of consecutive frames.
  12591. The filter accepts the following options:
  12592. @table @option
  12593. @item n
  12594. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  12595. will pick one of them, and then handle the next batch of @var{n} frames until
  12596. the end. Default is @code{100}.
  12597. @end table
  12598. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  12599. value will result in a higher memory usage, so a high value is not recommended.
  12600. @subsection Examples
  12601. @itemize
  12602. @item
  12603. Extract one picture each 50 frames:
  12604. @example
  12605. thumbnail=50
  12606. @end example
  12607. @item
  12608. Complete example of a thumbnail creation with @command{ffmpeg}:
  12609. @example
  12610. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  12611. @end example
  12612. @end itemize
  12613. @section tile
  12614. Tile several successive frames together.
  12615. The filter accepts the following options:
  12616. @table @option
  12617. @item layout
  12618. Set the grid size (i.e. the number of lines and columns). For the syntax of
  12619. this option, check the
  12620. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12621. @item nb_frames
  12622. Set the maximum number of frames to render in the given area. It must be less
  12623. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  12624. the area will be used.
  12625. @item margin
  12626. Set the outer border margin in pixels.
  12627. @item padding
  12628. Set the inner border thickness (i.e. the number of pixels between frames). For
  12629. more advanced padding options (such as having different values for the edges),
  12630. refer to the pad video filter.
  12631. @item color
  12632. Specify the color of the unused area. For the syntax of this option, check the
  12633. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12634. The default value of @var{color} is "black".
  12635. @item overlap
  12636. Set the number of frames to overlap when tiling several successive frames together.
  12637. The value must be between @code{0} and @var{nb_frames - 1}.
  12638. @item init_padding
  12639. Set the number of frames to initially be empty before displaying first output frame.
  12640. This controls how soon will one get first output frame.
  12641. The value must be between @code{0} and @var{nb_frames - 1}.
  12642. @end table
  12643. @subsection Examples
  12644. @itemize
  12645. @item
  12646. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  12647. @example
  12648. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  12649. @end example
  12650. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  12651. duplicating each output frame to accommodate the originally detected frame
  12652. rate.
  12653. @item
  12654. Display @code{5} pictures in an area of @code{3x2} frames,
  12655. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  12656. mixed flat and named options:
  12657. @example
  12658. tile=3x2:nb_frames=5:padding=7:margin=2
  12659. @end example
  12660. @end itemize
  12661. @section tinterlace
  12662. Perform various types of temporal field interlacing.
  12663. Frames are counted starting from 1, so the first input frame is
  12664. considered odd.
  12665. The filter accepts the following options:
  12666. @table @option
  12667. @item mode
  12668. Specify the mode of the interlacing. This option can also be specified
  12669. as a value alone. See below for a list of values for this option.
  12670. Available values are:
  12671. @table @samp
  12672. @item merge, 0
  12673. Move odd frames into the upper field, even into the lower field,
  12674. generating a double height frame at half frame rate.
  12675. @example
  12676. ------> time
  12677. Input:
  12678. Frame 1 Frame 2 Frame 3 Frame 4
  12679. 11111 22222 33333 44444
  12680. 11111 22222 33333 44444
  12681. 11111 22222 33333 44444
  12682. 11111 22222 33333 44444
  12683. Output:
  12684. 11111 33333
  12685. 22222 44444
  12686. 11111 33333
  12687. 22222 44444
  12688. 11111 33333
  12689. 22222 44444
  12690. 11111 33333
  12691. 22222 44444
  12692. @end example
  12693. @item drop_even, 1
  12694. Only output odd frames, even frames are dropped, generating a frame with
  12695. unchanged height at half frame rate.
  12696. @example
  12697. ------> time
  12698. Input:
  12699. Frame 1 Frame 2 Frame 3 Frame 4
  12700. 11111 22222 33333 44444
  12701. 11111 22222 33333 44444
  12702. 11111 22222 33333 44444
  12703. 11111 22222 33333 44444
  12704. Output:
  12705. 11111 33333
  12706. 11111 33333
  12707. 11111 33333
  12708. 11111 33333
  12709. @end example
  12710. @item drop_odd, 2
  12711. Only output even frames, odd frames are dropped, generating a frame with
  12712. unchanged height at half frame rate.
  12713. @example
  12714. ------> time
  12715. Input:
  12716. Frame 1 Frame 2 Frame 3 Frame 4
  12717. 11111 22222 33333 44444
  12718. 11111 22222 33333 44444
  12719. 11111 22222 33333 44444
  12720. 11111 22222 33333 44444
  12721. Output:
  12722. 22222 44444
  12723. 22222 44444
  12724. 22222 44444
  12725. 22222 44444
  12726. @end example
  12727. @item pad, 3
  12728. Expand each frame to full height, but pad alternate lines with black,
  12729. generating a frame with double height at the same input frame rate.
  12730. @example
  12731. ------> time
  12732. Input:
  12733. Frame 1 Frame 2 Frame 3 Frame 4
  12734. 11111 22222 33333 44444
  12735. 11111 22222 33333 44444
  12736. 11111 22222 33333 44444
  12737. 11111 22222 33333 44444
  12738. Output:
  12739. 11111 ..... 33333 .....
  12740. ..... 22222 ..... 44444
  12741. 11111 ..... 33333 .....
  12742. ..... 22222 ..... 44444
  12743. 11111 ..... 33333 .....
  12744. ..... 22222 ..... 44444
  12745. 11111 ..... 33333 .....
  12746. ..... 22222 ..... 44444
  12747. @end example
  12748. @item interleave_top, 4
  12749. Interleave the upper field from odd frames with the lower field from
  12750. even frames, generating a frame with unchanged height at half frame rate.
  12751. @example
  12752. ------> time
  12753. Input:
  12754. Frame 1 Frame 2 Frame 3 Frame 4
  12755. 11111<- 22222 33333<- 44444
  12756. 11111 22222<- 33333 44444<-
  12757. 11111<- 22222 33333<- 44444
  12758. 11111 22222<- 33333 44444<-
  12759. Output:
  12760. 11111 33333
  12761. 22222 44444
  12762. 11111 33333
  12763. 22222 44444
  12764. @end example
  12765. @item interleave_bottom, 5
  12766. Interleave the lower field from odd frames with the upper field from
  12767. even frames, generating a frame with unchanged height at half frame rate.
  12768. @example
  12769. ------> time
  12770. Input:
  12771. Frame 1 Frame 2 Frame 3 Frame 4
  12772. 11111 22222<- 33333 44444<-
  12773. 11111<- 22222 33333<- 44444
  12774. 11111 22222<- 33333 44444<-
  12775. 11111<- 22222 33333<- 44444
  12776. Output:
  12777. 22222 44444
  12778. 11111 33333
  12779. 22222 44444
  12780. 11111 33333
  12781. @end example
  12782. @item interlacex2, 6
  12783. Double frame rate with unchanged height. Frames are inserted each
  12784. containing the second temporal field from the previous input frame and
  12785. the first temporal field from the next input frame. This mode relies on
  12786. the top_field_first flag. Useful for interlaced video displays with no
  12787. field synchronisation.
  12788. @example
  12789. ------> time
  12790. Input:
  12791. Frame 1 Frame 2 Frame 3 Frame 4
  12792. 11111 22222 33333 44444
  12793. 11111 22222 33333 44444
  12794. 11111 22222 33333 44444
  12795. 11111 22222 33333 44444
  12796. Output:
  12797. 11111 22222 22222 33333 33333 44444 44444
  12798. 11111 11111 22222 22222 33333 33333 44444
  12799. 11111 22222 22222 33333 33333 44444 44444
  12800. 11111 11111 22222 22222 33333 33333 44444
  12801. @end example
  12802. @item mergex2, 7
  12803. Move odd frames into the upper field, even into the lower field,
  12804. generating a double height frame at same frame rate.
  12805. @example
  12806. ------> time
  12807. Input:
  12808. Frame 1 Frame 2 Frame 3 Frame 4
  12809. 11111 22222 33333 44444
  12810. 11111 22222 33333 44444
  12811. 11111 22222 33333 44444
  12812. 11111 22222 33333 44444
  12813. Output:
  12814. 11111 33333 33333 55555
  12815. 22222 22222 44444 44444
  12816. 11111 33333 33333 55555
  12817. 22222 22222 44444 44444
  12818. 11111 33333 33333 55555
  12819. 22222 22222 44444 44444
  12820. 11111 33333 33333 55555
  12821. 22222 22222 44444 44444
  12822. @end example
  12823. @end table
  12824. Numeric values are deprecated but are accepted for backward
  12825. compatibility reasons.
  12826. Default mode is @code{merge}.
  12827. @item flags
  12828. Specify flags influencing the filter process.
  12829. Available value for @var{flags} is:
  12830. @table @option
  12831. @item low_pass_filter, vlfp
  12832. Enable linear vertical low-pass filtering in the filter.
  12833. Vertical low-pass filtering is required when creating an interlaced
  12834. destination from a progressive source which contains high-frequency
  12835. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  12836. patterning.
  12837. @item complex_filter, cvlfp
  12838. Enable complex vertical low-pass filtering.
  12839. This will slightly less reduce interlace 'twitter' and Moire
  12840. patterning but better retain detail and subjective sharpness impression.
  12841. @end table
  12842. Vertical low-pass filtering can only be enabled for @option{mode}
  12843. @var{interleave_top} and @var{interleave_bottom}.
  12844. @end table
  12845. @section tmix
  12846. Mix successive video frames.
  12847. A description of the accepted options follows.
  12848. @table @option
  12849. @item frames
  12850. The number of successive frames to mix. If unspecified, it defaults to 3.
  12851. @item weights
  12852. Specify weight of each input video frame.
  12853. Each weight is separated by space. If number of weights is smaller than
  12854. number of @var{frames} last specified weight will be used for all remaining
  12855. unset weights.
  12856. @item scale
  12857. Specify scale, if it is set it will be multiplied with sum
  12858. of each weight multiplied with pixel values to give final destination
  12859. pixel value. By default @var{scale} is auto scaled to sum of weights.
  12860. @end table
  12861. @subsection Examples
  12862. @itemize
  12863. @item
  12864. Average 7 successive frames:
  12865. @example
  12866. tmix=frames=7:weights="1 1 1 1 1 1 1"
  12867. @end example
  12868. @item
  12869. Apply simple temporal convolution:
  12870. @example
  12871. tmix=frames=3:weights="-1 3 -1"
  12872. @end example
  12873. @item
  12874. Similar as above but only showing temporal differences:
  12875. @example
  12876. tmix=frames=3:weights="-1 2 -1":scale=1
  12877. @end example
  12878. @end itemize
  12879. @anchor{tonemap}
  12880. @section tonemap
  12881. Tone map colors from different dynamic ranges.
  12882. This filter expects data in single precision floating point, as it needs to
  12883. operate on (and can output) out-of-range values. Another filter, such as
  12884. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  12885. The tonemapping algorithms implemented only work on linear light, so input
  12886. data should be linearized beforehand (and possibly correctly tagged).
  12887. @example
  12888. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  12889. @end example
  12890. @subsection Options
  12891. The filter accepts the following options.
  12892. @table @option
  12893. @item tonemap
  12894. Set the tone map algorithm to use.
  12895. Possible values are:
  12896. @table @var
  12897. @item none
  12898. Do not apply any tone map, only desaturate overbright pixels.
  12899. @item clip
  12900. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  12901. in-range values, while distorting out-of-range values.
  12902. @item linear
  12903. Stretch the entire reference gamut to a linear multiple of the display.
  12904. @item gamma
  12905. Fit a logarithmic transfer between the tone curves.
  12906. @item reinhard
  12907. Preserve overall image brightness with a simple curve, using nonlinear
  12908. contrast, which results in flattening details and degrading color accuracy.
  12909. @item hable
  12910. Preserve both dark and bright details better than @var{reinhard}, at the cost
  12911. of slightly darkening everything. Use it when detail preservation is more
  12912. important than color and brightness accuracy.
  12913. @item mobius
  12914. Smoothly map out-of-range values, while retaining contrast and colors for
  12915. in-range material as much as possible. Use it when color accuracy is more
  12916. important than detail preservation.
  12917. @end table
  12918. Default is none.
  12919. @item param
  12920. Tune the tone mapping algorithm.
  12921. This affects the following algorithms:
  12922. @table @var
  12923. @item none
  12924. Ignored.
  12925. @item linear
  12926. Specifies the scale factor to use while stretching.
  12927. Default to 1.0.
  12928. @item gamma
  12929. Specifies the exponent of the function.
  12930. Default to 1.8.
  12931. @item clip
  12932. Specify an extra linear coefficient to multiply into the signal before clipping.
  12933. Default to 1.0.
  12934. @item reinhard
  12935. Specify the local contrast coefficient at the display peak.
  12936. Default to 0.5, which means that in-gamut values will be about half as bright
  12937. as when clipping.
  12938. @item hable
  12939. Ignored.
  12940. @item mobius
  12941. Specify the transition point from linear to mobius transform. Every value
  12942. below this point is guaranteed to be mapped 1:1. The higher the value, the
  12943. more accurate the result will be, at the cost of losing bright details.
  12944. Default to 0.3, which due to the steep initial slope still preserves in-range
  12945. colors fairly accurately.
  12946. @end table
  12947. @item desat
  12948. Apply desaturation for highlights that exceed this level of brightness. The
  12949. higher the parameter, the more color information will be preserved. This
  12950. setting helps prevent unnaturally blown-out colors for super-highlights, by
  12951. (smoothly) turning into white instead. This makes images feel more natural,
  12952. at the cost of reducing information about out-of-range colors.
  12953. The default of 2.0 is somewhat conservative and will mostly just apply to
  12954. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  12955. This option works only if the input frame has a supported color tag.
  12956. @item peak
  12957. Override signal/nominal/reference peak with this value. Useful when the
  12958. embedded peak information in display metadata is not reliable or when tone
  12959. mapping from a lower range to a higher range.
  12960. @end table
  12961. @section tpad
  12962. Temporarily pad video frames.
  12963. The filter accepts the following options:
  12964. @table @option
  12965. @item start
  12966. Specify number of delay frames before input video stream.
  12967. @item stop
  12968. Specify number of padding frames after input video stream.
  12969. Set to -1 to pad indefinitely.
  12970. @item start_mode
  12971. Set kind of frames added to beginning of stream.
  12972. Can be either @var{add} or @var{clone}.
  12973. With @var{add} frames of solid-color are added.
  12974. With @var{clone} frames are clones of first frame.
  12975. @item stop_mode
  12976. Set kind of frames added to end of stream.
  12977. Can be either @var{add} or @var{clone}.
  12978. With @var{add} frames of solid-color are added.
  12979. With @var{clone} frames are clones of last frame.
  12980. @item start_duration, stop_duration
  12981. Specify the duration of the start/stop delay. See
  12982. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12983. for the accepted syntax.
  12984. These options override @var{start} and @var{stop}.
  12985. @item color
  12986. Specify the color of the padded area. For the syntax of this option,
  12987. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12988. manual,ffmpeg-utils}.
  12989. The default value of @var{color} is "black".
  12990. @end table
  12991. @anchor{transpose}
  12992. @section transpose
  12993. Transpose rows with columns in the input video and optionally flip it.
  12994. It accepts the following parameters:
  12995. @table @option
  12996. @item dir
  12997. Specify the transposition direction.
  12998. Can assume the following values:
  12999. @table @samp
  13000. @item 0, 4, cclock_flip
  13001. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  13002. @example
  13003. L.R L.l
  13004. . . -> . .
  13005. l.r R.r
  13006. @end example
  13007. @item 1, 5, clock
  13008. Rotate by 90 degrees clockwise, that is:
  13009. @example
  13010. L.R l.L
  13011. . . -> . .
  13012. l.r r.R
  13013. @end example
  13014. @item 2, 6, cclock
  13015. Rotate by 90 degrees counterclockwise, that is:
  13016. @example
  13017. L.R R.r
  13018. . . -> . .
  13019. l.r L.l
  13020. @end example
  13021. @item 3, 7, clock_flip
  13022. Rotate by 90 degrees clockwise and vertically flip, that is:
  13023. @example
  13024. L.R r.R
  13025. . . -> . .
  13026. l.r l.L
  13027. @end example
  13028. @end table
  13029. For values between 4-7, the transposition is only done if the input
  13030. video geometry is portrait and not landscape. These values are
  13031. deprecated, the @code{passthrough} option should be used instead.
  13032. Numerical values are deprecated, and should be dropped in favor of
  13033. symbolic constants.
  13034. @item passthrough
  13035. Do not apply the transposition if the input geometry matches the one
  13036. specified by the specified value. It accepts the following values:
  13037. @table @samp
  13038. @item none
  13039. Always apply transposition.
  13040. @item portrait
  13041. Preserve portrait geometry (when @var{height} >= @var{width}).
  13042. @item landscape
  13043. Preserve landscape geometry (when @var{width} >= @var{height}).
  13044. @end table
  13045. Default value is @code{none}.
  13046. @end table
  13047. For example to rotate by 90 degrees clockwise and preserve portrait
  13048. layout:
  13049. @example
  13050. transpose=dir=1:passthrough=portrait
  13051. @end example
  13052. The command above can also be specified as:
  13053. @example
  13054. transpose=1:portrait
  13055. @end example
  13056. @section transpose_npp
  13057. Transpose rows with columns in the input video and optionally flip it.
  13058. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  13059. It accepts the following parameters:
  13060. @table @option
  13061. @item dir
  13062. Specify the transposition direction.
  13063. Can assume the following values:
  13064. @table @samp
  13065. @item cclock_flip
  13066. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  13067. @item clock
  13068. Rotate by 90 degrees clockwise.
  13069. @item cclock
  13070. Rotate by 90 degrees counterclockwise.
  13071. @item clock_flip
  13072. Rotate by 90 degrees clockwise and vertically flip.
  13073. @end table
  13074. @item passthrough
  13075. Do not apply the transposition if the input geometry matches the one
  13076. specified by the specified value. It accepts the following values:
  13077. @table @samp
  13078. @item none
  13079. Always apply transposition. (default)
  13080. @item portrait
  13081. Preserve portrait geometry (when @var{height} >= @var{width}).
  13082. @item landscape
  13083. Preserve landscape geometry (when @var{width} >= @var{height}).
  13084. @end table
  13085. @end table
  13086. @section trim
  13087. Trim the input so that the output contains one continuous subpart of the input.
  13088. It accepts the following parameters:
  13089. @table @option
  13090. @item start
  13091. Specify the time of the start of the kept section, i.e. the frame with the
  13092. timestamp @var{start} will be the first frame in the output.
  13093. @item end
  13094. Specify the time of the first frame that will be dropped, i.e. the frame
  13095. immediately preceding the one with the timestamp @var{end} will be the last
  13096. frame in the output.
  13097. @item start_pts
  13098. This is the same as @var{start}, except this option sets the start timestamp
  13099. in timebase units instead of seconds.
  13100. @item end_pts
  13101. This is the same as @var{end}, except this option sets the end timestamp
  13102. in timebase units instead of seconds.
  13103. @item duration
  13104. The maximum duration of the output in seconds.
  13105. @item start_frame
  13106. The number of the first frame that should be passed to the output.
  13107. @item end_frame
  13108. The number of the first frame that should be dropped.
  13109. @end table
  13110. @option{start}, @option{end}, and @option{duration} are expressed as time
  13111. duration specifications; see
  13112. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13113. for the accepted syntax.
  13114. Note that the first two sets of the start/end options and the @option{duration}
  13115. option look at the frame timestamp, while the _frame variants simply count the
  13116. frames that pass through the filter. Also note that this filter does not modify
  13117. the timestamps. If you wish for the output timestamps to start at zero, insert a
  13118. setpts filter after the trim filter.
  13119. If multiple start or end options are set, this filter tries to be greedy and
  13120. keep all the frames that match at least one of the specified constraints. To keep
  13121. only the part that matches all the constraints at once, chain multiple trim
  13122. filters.
  13123. The defaults are such that all the input is kept. So it is possible to set e.g.
  13124. just the end values to keep everything before the specified time.
  13125. Examples:
  13126. @itemize
  13127. @item
  13128. Drop everything except the second minute of input:
  13129. @example
  13130. ffmpeg -i INPUT -vf trim=60:120
  13131. @end example
  13132. @item
  13133. Keep only the first second:
  13134. @example
  13135. ffmpeg -i INPUT -vf trim=duration=1
  13136. @end example
  13137. @end itemize
  13138. @section unpremultiply
  13139. Apply alpha unpremultiply effect to input video stream using first plane
  13140. of second stream as alpha.
  13141. Both streams must have same dimensions and same pixel format.
  13142. The filter accepts the following option:
  13143. @table @option
  13144. @item planes
  13145. Set which planes will be processed, unprocessed planes will be copied.
  13146. By default value 0xf, all planes will be processed.
  13147. If the format has 1 or 2 components, then luma is bit 0.
  13148. If the format has 3 or 4 components:
  13149. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  13150. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  13151. If present, the alpha channel is always the last bit.
  13152. @item inplace
  13153. Do not require 2nd input for processing, instead use alpha plane from input stream.
  13154. @end table
  13155. @anchor{unsharp}
  13156. @section unsharp
  13157. Sharpen or blur the input video.
  13158. It accepts the following parameters:
  13159. @table @option
  13160. @item luma_msize_x, lx
  13161. Set the luma matrix horizontal size. It must be an odd integer between
  13162. 3 and 23. The default value is 5.
  13163. @item luma_msize_y, ly
  13164. Set the luma matrix vertical size. It must be an odd integer between 3
  13165. and 23. The default value is 5.
  13166. @item luma_amount, la
  13167. Set the luma effect strength. It must be a floating point number, reasonable
  13168. values lay between -1.5 and 1.5.
  13169. Negative values will blur the input video, while positive values will
  13170. sharpen it, a value of zero will disable the effect.
  13171. Default value is 1.0.
  13172. @item chroma_msize_x, cx
  13173. Set the chroma matrix horizontal size. It must be an odd integer
  13174. between 3 and 23. The default value is 5.
  13175. @item chroma_msize_y, cy
  13176. Set the chroma matrix vertical size. It must be an odd integer
  13177. between 3 and 23. The default value is 5.
  13178. @item chroma_amount, ca
  13179. Set the chroma effect strength. It must be a floating point number, reasonable
  13180. values lay between -1.5 and 1.5.
  13181. Negative values will blur the input video, while positive values will
  13182. sharpen it, a value of zero will disable the effect.
  13183. Default value is 0.0.
  13184. @end table
  13185. All parameters are optional and default to the equivalent of the
  13186. string '5:5:1.0:5:5:0.0'.
  13187. @subsection Examples
  13188. @itemize
  13189. @item
  13190. Apply strong luma sharpen effect:
  13191. @example
  13192. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  13193. @end example
  13194. @item
  13195. Apply a strong blur of both luma and chroma parameters:
  13196. @example
  13197. unsharp=7:7:-2:7:7:-2
  13198. @end example
  13199. @end itemize
  13200. @section uspp
  13201. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  13202. the image at several (or - in the case of @option{quality} level @code{8} - all)
  13203. shifts and average the results.
  13204. The way this differs from the behavior of spp is that uspp actually encodes &
  13205. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  13206. DCT similar to MJPEG.
  13207. The filter accepts the following options:
  13208. @table @option
  13209. @item quality
  13210. Set quality. This option defines the number of levels for averaging. It accepts
  13211. an integer in the range 0-8. If set to @code{0}, the filter will have no
  13212. effect. A value of @code{8} means the higher quality. For each increment of
  13213. that value the speed drops by a factor of approximately 2. Default value is
  13214. @code{3}.
  13215. @item qp
  13216. Force a constant quantization parameter. If not set, the filter will use the QP
  13217. from the video stream (if available).
  13218. @end table
  13219. @section vaguedenoiser
  13220. Apply a wavelet based denoiser.
  13221. It transforms each frame from the video input into the wavelet domain,
  13222. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  13223. the obtained coefficients. It does an inverse wavelet transform after.
  13224. Due to wavelet properties, it should give a nice smoothed result, and
  13225. reduced noise, without blurring picture features.
  13226. This filter accepts the following options:
  13227. @table @option
  13228. @item threshold
  13229. The filtering strength. The higher, the more filtered the video will be.
  13230. Hard thresholding can use a higher threshold than soft thresholding
  13231. before the video looks overfiltered. Default value is 2.
  13232. @item method
  13233. The filtering method the filter will use.
  13234. It accepts the following values:
  13235. @table @samp
  13236. @item hard
  13237. All values under the threshold will be zeroed.
  13238. @item soft
  13239. All values under the threshold will be zeroed. All values above will be
  13240. reduced by the threshold.
  13241. @item garrote
  13242. Scales or nullifies coefficients - intermediary between (more) soft and
  13243. (less) hard thresholding.
  13244. @end table
  13245. Default is garrote.
  13246. @item nsteps
  13247. Number of times, the wavelet will decompose the picture. Picture can't
  13248. be decomposed beyond a particular point (typically, 8 for a 640x480
  13249. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  13250. @item percent
  13251. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  13252. @item planes
  13253. A list of the planes to process. By default all planes are processed.
  13254. @end table
  13255. @section vectorscope
  13256. Display 2 color component values in the two dimensional graph (which is called
  13257. a vectorscope).
  13258. This filter accepts the following options:
  13259. @table @option
  13260. @item mode, m
  13261. Set vectorscope mode.
  13262. It accepts the following values:
  13263. @table @samp
  13264. @item gray
  13265. Gray values are displayed on graph, higher brightness means more pixels have
  13266. same component color value on location in graph. This is the default mode.
  13267. @item color
  13268. Gray values are displayed on graph. Surrounding pixels values which are not
  13269. present in video frame are drawn in gradient of 2 color components which are
  13270. set by option @code{x} and @code{y}. The 3rd color component is static.
  13271. @item color2
  13272. Actual color components values present in video frame are displayed on graph.
  13273. @item color3
  13274. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  13275. on graph increases value of another color component, which is luminance by
  13276. default values of @code{x} and @code{y}.
  13277. @item color4
  13278. Actual colors present in video frame are displayed on graph. If two different
  13279. colors map to same position on graph then color with higher value of component
  13280. not present in graph is picked.
  13281. @item color5
  13282. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  13283. component picked from radial gradient.
  13284. @end table
  13285. @item x
  13286. Set which color component will be represented on X-axis. Default is @code{1}.
  13287. @item y
  13288. Set which color component will be represented on Y-axis. Default is @code{2}.
  13289. @item intensity, i
  13290. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  13291. of color component which represents frequency of (X, Y) location in graph.
  13292. @item envelope, e
  13293. @table @samp
  13294. @item none
  13295. No envelope, this is default.
  13296. @item instant
  13297. Instant envelope, even darkest single pixel will be clearly highlighted.
  13298. @item peak
  13299. Hold maximum and minimum values presented in graph over time. This way you
  13300. can still spot out of range values without constantly looking at vectorscope.
  13301. @item peak+instant
  13302. Peak and instant envelope combined together.
  13303. @end table
  13304. @item graticule, g
  13305. Set what kind of graticule to draw.
  13306. @table @samp
  13307. @item none
  13308. @item green
  13309. @item color
  13310. @end table
  13311. @item opacity, o
  13312. Set graticule opacity.
  13313. @item flags, f
  13314. Set graticule flags.
  13315. @table @samp
  13316. @item white
  13317. Draw graticule for white point.
  13318. @item black
  13319. Draw graticule for black point.
  13320. @item name
  13321. Draw color points short names.
  13322. @end table
  13323. @item bgopacity, b
  13324. Set background opacity.
  13325. @item lthreshold, l
  13326. Set low threshold for color component not represented on X or Y axis.
  13327. Values lower than this value will be ignored. Default is 0.
  13328. Note this value is multiplied with actual max possible value one pixel component
  13329. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  13330. is 0.1 * 255 = 25.
  13331. @item hthreshold, h
  13332. Set high threshold for color component not represented on X or Y axis.
  13333. Values higher than this value will be ignored. Default is 1.
  13334. Note this value is multiplied with actual max possible value one pixel component
  13335. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  13336. is 0.9 * 255 = 230.
  13337. @item colorspace, c
  13338. Set what kind of colorspace to use when drawing graticule.
  13339. @table @samp
  13340. @item auto
  13341. @item 601
  13342. @item 709
  13343. @end table
  13344. Default is auto.
  13345. @end table
  13346. @anchor{vidstabdetect}
  13347. @section vidstabdetect
  13348. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  13349. @ref{vidstabtransform} for pass 2.
  13350. This filter generates a file with relative translation and rotation
  13351. transform information about subsequent frames, which is then used by
  13352. the @ref{vidstabtransform} filter.
  13353. To enable compilation of this filter you need to configure FFmpeg with
  13354. @code{--enable-libvidstab}.
  13355. This filter accepts the following options:
  13356. @table @option
  13357. @item result
  13358. Set the path to the file used to write the transforms information.
  13359. Default value is @file{transforms.trf}.
  13360. @item shakiness
  13361. Set how shaky the video is and how quick the camera is. It accepts an
  13362. integer in the range 1-10, a value of 1 means little shakiness, a
  13363. value of 10 means strong shakiness. Default value is 5.
  13364. @item accuracy
  13365. Set the accuracy of the detection process. It must be a value in the
  13366. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  13367. accuracy. Default value is 15.
  13368. @item stepsize
  13369. Set stepsize of the search process. The region around minimum is
  13370. scanned with 1 pixel resolution. Default value is 6.
  13371. @item mincontrast
  13372. Set minimum contrast. Below this value a local measurement field is
  13373. discarded. Must be a floating point value in the range 0-1. Default
  13374. value is 0.3.
  13375. @item tripod
  13376. Set reference frame number for tripod mode.
  13377. If enabled, the motion of the frames is compared to a reference frame
  13378. in the filtered stream, identified by the specified number. The idea
  13379. is to compensate all movements in a more-or-less static scene and keep
  13380. the camera view absolutely still.
  13381. If set to 0, it is disabled. The frames are counted starting from 1.
  13382. @item show
  13383. Show fields and transforms in the resulting frames. It accepts an
  13384. integer in the range 0-2. Default value is 0, which disables any
  13385. visualization.
  13386. @end table
  13387. @subsection Examples
  13388. @itemize
  13389. @item
  13390. Use default values:
  13391. @example
  13392. vidstabdetect
  13393. @end example
  13394. @item
  13395. Analyze strongly shaky movie and put the results in file
  13396. @file{mytransforms.trf}:
  13397. @example
  13398. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  13399. @end example
  13400. @item
  13401. Visualize the result of internal transformations in the resulting
  13402. video:
  13403. @example
  13404. vidstabdetect=show=1
  13405. @end example
  13406. @item
  13407. Analyze a video with medium shakiness using @command{ffmpeg}:
  13408. @example
  13409. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  13410. @end example
  13411. @end itemize
  13412. @anchor{vidstabtransform}
  13413. @section vidstabtransform
  13414. Video stabilization/deshaking: pass 2 of 2,
  13415. see @ref{vidstabdetect} for pass 1.
  13416. Read a file with transform information for each frame and
  13417. apply/compensate them. Together with the @ref{vidstabdetect}
  13418. filter this can be used to deshake videos. See also
  13419. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  13420. the @ref{unsharp} filter, see below.
  13421. To enable compilation of this filter you need to configure FFmpeg with
  13422. @code{--enable-libvidstab}.
  13423. @subsection Options
  13424. @table @option
  13425. @item input
  13426. Set path to the file used to read the transforms. Default value is
  13427. @file{transforms.trf}.
  13428. @item smoothing
  13429. Set the number of frames (value*2 + 1) used for lowpass filtering the
  13430. camera movements. Default value is 10.
  13431. For example a number of 10 means that 21 frames are used (10 in the
  13432. past and 10 in the future) to smoothen the motion in the video. A
  13433. larger value leads to a smoother video, but limits the acceleration of
  13434. the camera (pan/tilt movements). 0 is a special case where a static
  13435. camera is simulated.
  13436. @item optalgo
  13437. Set the camera path optimization algorithm.
  13438. Accepted values are:
  13439. @table @samp
  13440. @item gauss
  13441. gaussian kernel low-pass filter on camera motion (default)
  13442. @item avg
  13443. averaging on transformations
  13444. @end table
  13445. @item maxshift
  13446. Set maximal number of pixels to translate frames. Default value is -1,
  13447. meaning no limit.
  13448. @item maxangle
  13449. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  13450. value is -1, meaning no limit.
  13451. @item crop
  13452. Specify how to deal with borders that may be visible due to movement
  13453. compensation.
  13454. Available values are:
  13455. @table @samp
  13456. @item keep
  13457. keep image information from previous frame (default)
  13458. @item black
  13459. fill the border black
  13460. @end table
  13461. @item invert
  13462. Invert transforms if set to 1. Default value is 0.
  13463. @item relative
  13464. Consider transforms as relative to previous frame if set to 1,
  13465. absolute if set to 0. Default value is 0.
  13466. @item zoom
  13467. Set percentage to zoom. A positive value will result in a zoom-in
  13468. effect, a negative value in a zoom-out effect. Default value is 0 (no
  13469. zoom).
  13470. @item optzoom
  13471. Set optimal zooming to avoid borders.
  13472. Accepted values are:
  13473. @table @samp
  13474. @item 0
  13475. disabled
  13476. @item 1
  13477. optimal static zoom value is determined (only very strong movements
  13478. will lead to visible borders) (default)
  13479. @item 2
  13480. optimal adaptive zoom value is determined (no borders will be
  13481. visible), see @option{zoomspeed}
  13482. @end table
  13483. Note that the value given at zoom is added to the one calculated here.
  13484. @item zoomspeed
  13485. Set percent to zoom maximally each frame (enabled when
  13486. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  13487. 0.25.
  13488. @item interpol
  13489. Specify type of interpolation.
  13490. Available values are:
  13491. @table @samp
  13492. @item no
  13493. no interpolation
  13494. @item linear
  13495. linear only horizontal
  13496. @item bilinear
  13497. linear in both directions (default)
  13498. @item bicubic
  13499. cubic in both directions (slow)
  13500. @end table
  13501. @item tripod
  13502. Enable virtual tripod mode if set to 1, which is equivalent to
  13503. @code{relative=0:smoothing=0}. Default value is 0.
  13504. Use also @code{tripod} option of @ref{vidstabdetect}.
  13505. @item debug
  13506. Increase log verbosity if set to 1. Also the detected global motions
  13507. are written to the temporary file @file{global_motions.trf}. Default
  13508. value is 0.
  13509. @end table
  13510. @subsection Examples
  13511. @itemize
  13512. @item
  13513. Use @command{ffmpeg} for a typical stabilization with default values:
  13514. @example
  13515. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  13516. @end example
  13517. Note the use of the @ref{unsharp} filter which is always recommended.
  13518. @item
  13519. Zoom in a bit more and load transform data from a given file:
  13520. @example
  13521. vidstabtransform=zoom=5:input="mytransforms.trf"
  13522. @end example
  13523. @item
  13524. Smoothen the video even more:
  13525. @example
  13526. vidstabtransform=smoothing=30
  13527. @end example
  13528. @end itemize
  13529. @section vflip
  13530. Flip the input video vertically.
  13531. For example, to vertically flip a video with @command{ffmpeg}:
  13532. @example
  13533. ffmpeg -i in.avi -vf "vflip" out.avi
  13534. @end example
  13535. @section vfrdet
  13536. Detect variable frame rate video.
  13537. This filter tries to detect if the input is variable or constant frame rate.
  13538. At end it will output number of frames detected as having variable delta pts,
  13539. and ones with constant delta pts.
  13540. If there was frames with variable delta, than it will also show min and max delta
  13541. encountered.
  13542. @section vibrance
  13543. Boost or alter saturation.
  13544. The filter accepts the following options:
  13545. @table @option
  13546. @item intensity
  13547. Set strength of boost if positive value or strength of alter if negative value.
  13548. Default is 0. Allowed range is from -2 to 2.
  13549. @item rbal
  13550. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  13551. @item gbal
  13552. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  13553. @item bbal
  13554. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  13555. @item rlum
  13556. Set the red luma coefficient.
  13557. @item glum
  13558. Set the green luma coefficient.
  13559. @item blum
  13560. Set the blue luma coefficient.
  13561. @end table
  13562. @anchor{vignette}
  13563. @section vignette
  13564. Make or reverse a natural vignetting effect.
  13565. The filter accepts the following options:
  13566. @table @option
  13567. @item angle, a
  13568. Set lens angle expression as a number of radians.
  13569. The value is clipped in the @code{[0,PI/2]} range.
  13570. Default value: @code{"PI/5"}
  13571. @item x0
  13572. @item y0
  13573. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  13574. by default.
  13575. @item mode
  13576. Set forward/backward mode.
  13577. Available modes are:
  13578. @table @samp
  13579. @item forward
  13580. The larger the distance from the central point, the darker the image becomes.
  13581. @item backward
  13582. The larger the distance from the central point, the brighter the image becomes.
  13583. This can be used to reverse a vignette effect, though there is no automatic
  13584. detection to extract the lens @option{angle} and other settings (yet). It can
  13585. also be used to create a burning effect.
  13586. @end table
  13587. Default value is @samp{forward}.
  13588. @item eval
  13589. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  13590. It accepts the following values:
  13591. @table @samp
  13592. @item init
  13593. Evaluate expressions only once during the filter initialization.
  13594. @item frame
  13595. Evaluate expressions for each incoming frame. This is way slower than the
  13596. @samp{init} mode since it requires all the scalers to be re-computed, but it
  13597. allows advanced dynamic expressions.
  13598. @end table
  13599. Default value is @samp{init}.
  13600. @item dither
  13601. Set dithering to reduce the circular banding effects. Default is @code{1}
  13602. (enabled).
  13603. @item aspect
  13604. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  13605. Setting this value to the SAR of the input will make a rectangular vignetting
  13606. following the dimensions of the video.
  13607. Default is @code{1/1}.
  13608. @end table
  13609. @subsection Expressions
  13610. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  13611. following parameters.
  13612. @table @option
  13613. @item w
  13614. @item h
  13615. input width and height
  13616. @item n
  13617. the number of input frame, starting from 0
  13618. @item pts
  13619. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  13620. @var{TB} units, NAN if undefined
  13621. @item r
  13622. frame rate of the input video, NAN if the input frame rate is unknown
  13623. @item t
  13624. the PTS (Presentation TimeStamp) of the filtered video frame,
  13625. expressed in seconds, NAN if undefined
  13626. @item tb
  13627. time base of the input video
  13628. @end table
  13629. @subsection Examples
  13630. @itemize
  13631. @item
  13632. Apply simple strong vignetting effect:
  13633. @example
  13634. vignette=PI/4
  13635. @end example
  13636. @item
  13637. Make a flickering vignetting:
  13638. @example
  13639. vignette='PI/4+random(1)*PI/50':eval=frame
  13640. @end example
  13641. @end itemize
  13642. @section vmafmotion
  13643. Obtain the average vmaf motion score of a video.
  13644. It is one of the component filters of VMAF.
  13645. The obtained average motion score is printed through the logging system.
  13646. In the below example the input file @file{ref.mpg} is being processed and score
  13647. is computed.
  13648. @example
  13649. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  13650. @end example
  13651. @section vstack
  13652. Stack input videos vertically.
  13653. All streams must be of same pixel format and of same width.
  13654. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  13655. to create same output.
  13656. The filter accept the following option:
  13657. @table @option
  13658. @item inputs
  13659. Set number of input streams. Default is 2.
  13660. @item shortest
  13661. If set to 1, force the output to terminate when the shortest input
  13662. terminates. Default value is 0.
  13663. @end table
  13664. @section w3fdif
  13665. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  13666. Deinterlacing Filter").
  13667. Based on the process described by Martin Weston for BBC R&D, and
  13668. implemented based on the de-interlace algorithm written by Jim
  13669. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  13670. uses filter coefficients calculated by BBC R&D.
  13671. There are two sets of filter coefficients, so called "simple":
  13672. and "complex". Which set of filter coefficients is used can
  13673. be set by passing an optional parameter:
  13674. @table @option
  13675. @item filter
  13676. Set the interlacing filter coefficients. Accepts one of the following values:
  13677. @table @samp
  13678. @item simple
  13679. Simple filter coefficient set.
  13680. @item complex
  13681. More-complex filter coefficient set.
  13682. @end table
  13683. Default value is @samp{complex}.
  13684. @item deint
  13685. Specify which frames to deinterlace. Accept one of the following values:
  13686. @table @samp
  13687. @item all
  13688. Deinterlace all frames,
  13689. @item interlaced
  13690. Only deinterlace frames marked as interlaced.
  13691. @end table
  13692. Default value is @samp{all}.
  13693. @end table
  13694. @section waveform
  13695. Video waveform monitor.
  13696. The waveform monitor plots color component intensity. By default luminance
  13697. only. Each column of the waveform corresponds to a column of pixels in the
  13698. source video.
  13699. It accepts the following options:
  13700. @table @option
  13701. @item mode, m
  13702. Can be either @code{row}, or @code{column}. Default is @code{column}.
  13703. In row mode, the graph on the left side represents color component value 0 and
  13704. the right side represents value = 255. In column mode, the top side represents
  13705. color component value = 0 and bottom side represents value = 255.
  13706. @item intensity, i
  13707. Set intensity. Smaller values are useful to find out how many values of the same
  13708. luminance are distributed across input rows/columns.
  13709. Default value is @code{0.04}. Allowed range is [0, 1].
  13710. @item mirror, r
  13711. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  13712. In mirrored mode, higher values will be represented on the left
  13713. side for @code{row} mode and at the top for @code{column} mode. Default is
  13714. @code{1} (mirrored).
  13715. @item display, d
  13716. Set display mode.
  13717. It accepts the following values:
  13718. @table @samp
  13719. @item overlay
  13720. Presents information identical to that in the @code{parade}, except
  13721. that the graphs representing color components are superimposed directly
  13722. over one another.
  13723. This display mode makes it easier to spot relative differences or similarities
  13724. in overlapping areas of the color components that are supposed to be identical,
  13725. such as neutral whites, grays, or blacks.
  13726. @item stack
  13727. Display separate graph for the color components side by side in
  13728. @code{row} mode or one below the other in @code{column} mode.
  13729. @item parade
  13730. Display separate graph for the color components side by side in
  13731. @code{column} mode or one below the other in @code{row} mode.
  13732. Using this display mode makes it easy to spot color casts in the highlights
  13733. and shadows of an image, by comparing the contours of the top and the bottom
  13734. graphs of each waveform. Since whites, grays, and blacks are characterized
  13735. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  13736. should display three waveforms of roughly equal width/height. If not, the
  13737. correction is easy to perform by making level adjustments the three waveforms.
  13738. @end table
  13739. Default is @code{stack}.
  13740. @item components, c
  13741. Set which color components to display. Default is 1, which means only luminance
  13742. or red color component if input is in RGB colorspace. If is set for example to
  13743. 7 it will display all 3 (if) available color components.
  13744. @item envelope, e
  13745. @table @samp
  13746. @item none
  13747. No envelope, this is default.
  13748. @item instant
  13749. Instant envelope, minimum and maximum values presented in graph will be easily
  13750. visible even with small @code{step} value.
  13751. @item peak
  13752. Hold minimum and maximum values presented in graph across time. This way you
  13753. can still spot out of range values without constantly looking at waveforms.
  13754. @item peak+instant
  13755. Peak and instant envelope combined together.
  13756. @end table
  13757. @item filter, f
  13758. @table @samp
  13759. @item lowpass
  13760. No filtering, this is default.
  13761. @item flat
  13762. Luma and chroma combined together.
  13763. @item aflat
  13764. Similar as above, but shows difference between blue and red chroma.
  13765. @item xflat
  13766. Similar as above, but use different colors.
  13767. @item chroma
  13768. Displays only chroma.
  13769. @item color
  13770. Displays actual color value on waveform.
  13771. @item acolor
  13772. Similar as above, but with luma showing frequency of chroma values.
  13773. @end table
  13774. @item graticule, g
  13775. Set which graticule to display.
  13776. @table @samp
  13777. @item none
  13778. Do not display graticule.
  13779. @item green
  13780. Display green graticule showing legal broadcast ranges.
  13781. @item orange
  13782. Display orange graticule showing legal broadcast ranges.
  13783. @end table
  13784. @item opacity, o
  13785. Set graticule opacity.
  13786. @item flags, fl
  13787. Set graticule flags.
  13788. @table @samp
  13789. @item numbers
  13790. Draw numbers above lines. By default enabled.
  13791. @item dots
  13792. Draw dots instead of lines.
  13793. @end table
  13794. @item scale, s
  13795. Set scale used for displaying graticule.
  13796. @table @samp
  13797. @item digital
  13798. @item millivolts
  13799. @item ire
  13800. @end table
  13801. Default is digital.
  13802. @item bgopacity, b
  13803. Set background opacity.
  13804. @end table
  13805. @section weave, doubleweave
  13806. The @code{weave} takes a field-based video input and join
  13807. each two sequential fields into single frame, producing a new double
  13808. height clip with half the frame rate and half the frame count.
  13809. The @code{doubleweave} works same as @code{weave} but without
  13810. halving frame rate and frame count.
  13811. It accepts the following option:
  13812. @table @option
  13813. @item first_field
  13814. Set first field. Available values are:
  13815. @table @samp
  13816. @item top, t
  13817. Set the frame as top-field-first.
  13818. @item bottom, b
  13819. Set the frame as bottom-field-first.
  13820. @end table
  13821. @end table
  13822. @subsection Examples
  13823. @itemize
  13824. @item
  13825. Interlace video using @ref{select} and @ref{separatefields} filter:
  13826. @example
  13827. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  13828. @end example
  13829. @end itemize
  13830. @section xbr
  13831. Apply the xBR high-quality magnification filter which is designed for pixel
  13832. art. It follows a set of edge-detection rules, see
  13833. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  13834. It accepts the following option:
  13835. @table @option
  13836. @item n
  13837. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  13838. @code{3xBR} and @code{4} for @code{4xBR}.
  13839. Default is @code{3}.
  13840. @end table
  13841. @section xstack
  13842. Stack video inputs into custom layout.
  13843. All streams must be of same pixel format.
  13844. The filter accept the following option:
  13845. @table @option
  13846. @item inputs
  13847. Set number of input streams. Default is 2.
  13848. @item layout
  13849. Specify layout of inputs.
  13850. This option requires the desired layout configuration to be explicitly set by the user.
  13851. This sets position of each video input in output. Each input
  13852. is separated by '|'.
  13853. The first number represents the column, and the second number represents the row.
  13854. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  13855. where X is video input from which to take width or height.
  13856. Multiple values can be used when separated by '+'. In such
  13857. case values are summed together.
  13858. @item shortest
  13859. If set to 1, force the output to terminate when the shortest input
  13860. terminates. Default value is 0.
  13861. @end table
  13862. @subsection Examples
  13863. @itemize
  13864. @item
  13865. Display 4 inputs into 2x2 grid,
  13866. note that if inputs are of different sizes unused gaps might appear,
  13867. as not all of output video is used.
  13868. @example
  13869. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  13870. @end example
  13871. @item
  13872. Display 4 inputs into 1x4 grid,
  13873. note that if inputs are of different sizes unused gaps might appear,
  13874. as not all of output video is used.
  13875. @example
  13876. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  13877. @end example
  13878. @item
  13879. Display 9 inputs into 3x3 grid,
  13880. note that if inputs are of different sizes unused gaps might appear,
  13881. as not all of output video is used.
  13882. @example
  13883. xstack=inputs=9:layout=w3_0|w3_h0+h2|w3_h0|0_h4|0_0|w3+w1_0|0_h1+h2|w3+w1_h0|w3+w1_h1+h2
  13884. @end example
  13885. @end itemize
  13886. @anchor{yadif}
  13887. @section yadif
  13888. Deinterlace the input video ("yadif" means "yet another deinterlacing
  13889. filter").
  13890. It accepts the following parameters:
  13891. @table @option
  13892. @item mode
  13893. The interlacing mode to adopt. It accepts one of the following values:
  13894. @table @option
  13895. @item 0, send_frame
  13896. Output one frame for each frame.
  13897. @item 1, send_field
  13898. Output one frame for each field.
  13899. @item 2, send_frame_nospatial
  13900. Like @code{send_frame}, but it skips the spatial interlacing check.
  13901. @item 3, send_field_nospatial
  13902. Like @code{send_field}, but it skips the spatial interlacing check.
  13903. @end table
  13904. The default value is @code{send_frame}.
  13905. @item parity
  13906. The picture field parity assumed for the input interlaced video. It accepts one
  13907. of the following values:
  13908. @table @option
  13909. @item 0, tff
  13910. Assume the top field is first.
  13911. @item 1, bff
  13912. Assume the bottom field is first.
  13913. @item -1, auto
  13914. Enable automatic detection of field parity.
  13915. @end table
  13916. The default value is @code{auto}.
  13917. If the interlacing is unknown or the decoder does not export this information,
  13918. top field first will be assumed.
  13919. @item deint
  13920. Specify which frames to deinterlace. Accept one of the following
  13921. values:
  13922. @table @option
  13923. @item 0, all
  13924. Deinterlace all frames.
  13925. @item 1, interlaced
  13926. Only deinterlace frames marked as interlaced.
  13927. @end table
  13928. The default value is @code{all}.
  13929. @end table
  13930. @section yadif_cuda
  13931. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  13932. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  13933. and/or nvenc.
  13934. It accepts the following parameters:
  13935. @table @option
  13936. @item mode
  13937. The interlacing mode to adopt. It accepts one of the following values:
  13938. @table @option
  13939. @item 0, send_frame
  13940. Output one frame for each frame.
  13941. @item 1, send_field
  13942. Output one frame for each field.
  13943. @item 2, send_frame_nospatial
  13944. Like @code{send_frame}, but it skips the spatial interlacing check.
  13945. @item 3, send_field_nospatial
  13946. Like @code{send_field}, but it skips the spatial interlacing check.
  13947. @end table
  13948. The default value is @code{send_frame}.
  13949. @item parity
  13950. The picture field parity assumed for the input interlaced video. It accepts one
  13951. of the following values:
  13952. @table @option
  13953. @item 0, tff
  13954. Assume the top field is first.
  13955. @item 1, bff
  13956. Assume the bottom field is first.
  13957. @item -1, auto
  13958. Enable automatic detection of field parity.
  13959. @end table
  13960. The default value is @code{auto}.
  13961. If the interlacing is unknown or the decoder does not export this information,
  13962. top field first will be assumed.
  13963. @item deint
  13964. Specify which frames to deinterlace. Accept one of the following
  13965. values:
  13966. @table @option
  13967. @item 0, all
  13968. Deinterlace all frames.
  13969. @item 1, interlaced
  13970. Only deinterlace frames marked as interlaced.
  13971. @end table
  13972. The default value is @code{all}.
  13973. @end table
  13974. @section zoompan
  13975. Apply Zoom & Pan effect.
  13976. This filter accepts the following options:
  13977. @table @option
  13978. @item zoom, z
  13979. Set the zoom expression. Default is 1.
  13980. @item x
  13981. @item y
  13982. Set the x and y expression. Default is 0.
  13983. @item d
  13984. Set the duration expression in number of frames.
  13985. This sets for how many number of frames effect will last for
  13986. single input image.
  13987. @item s
  13988. Set the output image size, default is 'hd720'.
  13989. @item fps
  13990. Set the output frame rate, default is '25'.
  13991. @end table
  13992. Each expression can contain the following constants:
  13993. @table @option
  13994. @item in_w, iw
  13995. Input width.
  13996. @item in_h, ih
  13997. Input height.
  13998. @item out_w, ow
  13999. Output width.
  14000. @item out_h, oh
  14001. Output height.
  14002. @item in
  14003. Input frame count.
  14004. @item on
  14005. Output frame count.
  14006. @item x
  14007. @item y
  14008. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  14009. for current input frame.
  14010. @item px
  14011. @item py
  14012. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  14013. not yet such frame (first input frame).
  14014. @item zoom
  14015. Last calculated zoom from 'z' expression for current input frame.
  14016. @item pzoom
  14017. Last calculated zoom of last output frame of previous input frame.
  14018. @item duration
  14019. Number of output frames for current input frame. Calculated from 'd' expression
  14020. for each input frame.
  14021. @item pduration
  14022. number of output frames created for previous input frame
  14023. @item a
  14024. Rational number: input width / input height
  14025. @item sar
  14026. sample aspect ratio
  14027. @item dar
  14028. display aspect ratio
  14029. @end table
  14030. @subsection Examples
  14031. @itemize
  14032. @item
  14033. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  14034. @example
  14035. 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
  14036. @end example
  14037. @item
  14038. Zoom-in up to 1.5 and pan always at center of picture:
  14039. @example
  14040. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14041. @end example
  14042. @item
  14043. Same as above but without pausing:
  14044. @example
  14045. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14046. @end example
  14047. @end itemize
  14048. @anchor{zscale}
  14049. @section zscale
  14050. Scale (resize) the input video, using the z.lib library:
  14051. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  14052. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  14053. The zscale filter forces the output display aspect ratio to be the same
  14054. as the input, by changing the output sample aspect ratio.
  14055. If the input image format is different from the format requested by
  14056. the next filter, the zscale filter will convert the input to the
  14057. requested format.
  14058. @subsection Options
  14059. The filter accepts the following options.
  14060. @table @option
  14061. @item width, w
  14062. @item height, h
  14063. Set the output video dimension expression. Default value is the input
  14064. dimension.
  14065. If the @var{width} or @var{w} value is 0, the input width is used for
  14066. the output. If the @var{height} or @var{h} value is 0, the input height
  14067. is used for the output.
  14068. If one and only one of the values is -n with n >= 1, the zscale filter
  14069. will use a value that maintains the aspect ratio of the input image,
  14070. calculated from the other specified dimension. After that it will,
  14071. however, make sure that the calculated dimension is divisible by n and
  14072. adjust the value if necessary.
  14073. If both values are -n with n >= 1, the behavior will be identical to
  14074. both values being set to 0 as previously detailed.
  14075. See below for the list of accepted constants for use in the dimension
  14076. expression.
  14077. @item size, s
  14078. Set the video size. For the syntax of this option, check the
  14079. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14080. @item dither, d
  14081. Set the dither type.
  14082. Possible values are:
  14083. @table @var
  14084. @item none
  14085. @item ordered
  14086. @item random
  14087. @item error_diffusion
  14088. @end table
  14089. Default is none.
  14090. @item filter, f
  14091. Set the resize filter type.
  14092. Possible values are:
  14093. @table @var
  14094. @item point
  14095. @item bilinear
  14096. @item bicubic
  14097. @item spline16
  14098. @item spline36
  14099. @item lanczos
  14100. @end table
  14101. Default is bilinear.
  14102. @item range, r
  14103. Set the color range.
  14104. Possible values are:
  14105. @table @var
  14106. @item input
  14107. @item limited
  14108. @item full
  14109. @end table
  14110. Default is same as input.
  14111. @item primaries, p
  14112. Set the color primaries.
  14113. Possible values are:
  14114. @table @var
  14115. @item input
  14116. @item 709
  14117. @item unspecified
  14118. @item 170m
  14119. @item 240m
  14120. @item 2020
  14121. @end table
  14122. Default is same as input.
  14123. @item transfer, t
  14124. Set the transfer characteristics.
  14125. Possible values are:
  14126. @table @var
  14127. @item input
  14128. @item 709
  14129. @item unspecified
  14130. @item 601
  14131. @item linear
  14132. @item 2020_10
  14133. @item 2020_12
  14134. @item smpte2084
  14135. @item iec61966-2-1
  14136. @item arib-std-b67
  14137. @end table
  14138. Default is same as input.
  14139. @item matrix, m
  14140. Set the colorspace matrix.
  14141. Possible value are:
  14142. @table @var
  14143. @item input
  14144. @item 709
  14145. @item unspecified
  14146. @item 470bg
  14147. @item 170m
  14148. @item 2020_ncl
  14149. @item 2020_cl
  14150. @end table
  14151. Default is same as input.
  14152. @item rangein, rin
  14153. Set the input color range.
  14154. Possible values are:
  14155. @table @var
  14156. @item input
  14157. @item limited
  14158. @item full
  14159. @end table
  14160. Default is same as input.
  14161. @item primariesin, pin
  14162. Set the input color primaries.
  14163. Possible values are:
  14164. @table @var
  14165. @item input
  14166. @item 709
  14167. @item unspecified
  14168. @item 170m
  14169. @item 240m
  14170. @item 2020
  14171. @end table
  14172. Default is same as input.
  14173. @item transferin, tin
  14174. Set the input transfer characteristics.
  14175. Possible values are:
  14176. @table @var
  14177. @item input
  14178. @item 709
  14179. @item unspecified
  14180. @item 601
  14181. @item linear
  14182. @item 2020_10
  14183. @item 2020_12
  14184. @end table
  14185. Default is same as input.
  14186. @item matrixin, min
  14187. Set the input colorspace matrix.
  14188. Possible value are:
  14189. @table @var
  14190. @item input
  14191. @item 709
  14192. @item unspecified
  14193. @item 470bg
  14194. @item 170m
  14195. @item 2020_ncl
  14196. @item 2020_cl
  14197. @end table
  14198. @item chromal, c
  14199. Set the output chroma location.
  14200. Possible values are:
  14201. @table @var
  14202. @item input
  14203. @item left
  14204. @item center
  14205. @item topleft
  14206. @item top
  14207. @item bottomleft
  14208. @item bottom
  14209. @end table
  14210. @item chromalin, cin
  14211. Set the input chroma location.
  14212. Possible values are:
  14213. @table @var
  14214. @item input
  14215. @item left
  14216. @item center
  14217. @item topleft
  14218. @item top
  14219. @item bottomleft
  14220. @item bottom
  14221. @end table
  14222. @item npl
  14223. Set the nominal peak luminance.
  14224. @end table
  14225. The values of the @option{w} and @option{h} options are expressions
  14226. containing the following constants:
  14227. @table @var
  14228. @item in_w
  14229. @item in_h
  14230. The input width and height
  14231. @item iw
  14232. @item ih
  14233. These are the same as @var{in_w} and @var{in_h}.
  14234. @item out_w
  14235. @item out_h
  14236. The output (scaled) width and height
  14237. @item ow
  14238. @item oh
  14239. These are the same as @var{out_w} and @var{out_h}
  14240. @item a
  14241. The same as @var{iw} / @var{ih}
  14242. @item sar
  14243. input sample aspect ratio
  14244. @item dar
  14245. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  14246. @item hsub
  14247. @item vsub
  14248. horizontal and vertical input chroma subsample values. For example for the
  14249. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14250. @item ohsub
  14251. @item ovsub
  14252. horizontal and vertical output chroma subsample values. For example for the
  14253. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14254. @end table
  14255. @table @option
  14256. @end table
  14257. @c man end VIDEO FILTERS
  14258. @chapter OpenCL Video Filters
  14259. @c man begin OPENCL VIDEO FILTERS
  14260. Below is a description of the currently available OpenCL video filters.
  14261. To enable compilation of these filters you need to configure FFmpeg with
  14262. @code{--enable-opencl}.
  14263. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  14264. @table @option
  14265. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  14266. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  14267. given device parameters.
  14268. @item -filter_hw_device @var{name}
  14269. Pass the hardware device called @var{name} to all filters in any filter graph.
  14270. @end table
  14271. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  14272. @itemize
  14273. @item
  14274. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  14275. @example
  14276. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  14277. @end example
  14278. @end itemize
  14279. Since OpenCL filters are not able to access frame data in normal memory, all frame data needs to be uploaded(@ref{hwupload}) to hardware surfaces connected to the appropriate device before being used and then downloaded(@ref{hwdownload}) back to normal memory. Note that @ref{hwupload} will upload to a surface with the same layout as the software frame, so it may be necessary to add a @ref{format} filter immediately before to get the input into the right format and @ref{hwdownload} does not support all formats on the output - it may be necessary to insert an additional @ref{format} filter immediately following in the graph to get the output in a supported format.
  14280. @section avgblur_opencl
  14281. Apply average blur filter.
  14282. The filter accepts the following options:
  14283. @table @option
  14284. @item sizeX
  14285. Set horizontal radius size.
  14286. Range is @code{[1, 1024]} and default value is @code{1}.
  14287. @item planes
  14288. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14289. @item sizeY
  14290. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  14291. @end table
  14292. @subsection Example
  14293. @itemize
  14294. @item
  14295. Apply average blur filter with horizontal and vertical size of 3, setting each pixel of the output to the average value of the 7x7 region centered on it in the input. For pixels on the edges of the image, the region does not extend beyond the image boundaries, and so out-of-range coordinates are not used in the calculations.
  14296. @example
  14297. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  14298. @end example
  14299. @end itemize
  14300. @section boxblur_opencl
  14301. Apply a boxblur algorithm to the input video.
  14302. It accepts the following parameters:
  14303. @table @option
  14304. @item luma_radius, lr
  14305. @item luma_power, lp
  14306. @item chroma_radius, cr
  14307. @item chroma_power, cp
  14308. @item alpha_radius, ar
  14309. @item alpha_power, ap
  14310. @end table
  14311. A description of the accepted options follows.
  14312. @table @option
  14313. @item luma_radius, lr
  14314. @item chroma_radius, cr
  14315. @item alpha_radius, ar
  14316. Set an expression for the box radius in pixels used for blurring the
  14317. corresponding input plane.
  14318. The radius value must be a non-negative number, and must not be
  14319. greater than the value of the expression @code{min(w,h)/2} for the
  14320. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  14321. planes.
  14322. Default value for @option{luma_radius} is "2". If not specified,
  14323. @option{chroma_radius} and @option{alpha_radius} default to the
  14324. corresponding value set for @option{luma_radius}.
  14325. The expressions can contain the following constants:
  14326. @table @option
  14327. @item w
  14328. @item h
  14329. The input width and height in pixels.
  14330. @item cw
  14331. @item ch
  14332. The input chroma image width and height in pixels.
  14333. @item hsub
  14334. @item vsub
  14335. The horizontal and vertical chroma subsample values. For example, for the
  14336. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  14337. @end table
  14338. @item luma_power, lp
  14339. @item chroma_power, cp
  14340. @item alpha_power, ap
  14341. Specify how many times the boxblur filter is applied to the
  14342. corresponding plane.
  14343. Default value for @option{luma_power} is 2. If not specified,
  14344. @option{chroma_power} and @option{alpha_power} default to the
  14345. corresponding value set for @option{luma_power}.
  14346. A value of 0 will disable the effect.
  14347. @end table
  14348. @subsection Examples
  14349. Apply boxblur filter, setting each pixel of the output to the average value of box-radiuses @var{luma_radius}, @var{chroma_radius}, @var{alpha_radius} for each plane respectively. The filter will apply @var{luma_power}, @var{chroma_power}, @var{alpha_power} times onto the corresponding plane. For pixels on the edges of the image, the radius does not extend beyond the image boundaries, and so out-of-range coordinates are not used in the calculations.
  14350. @itemize
  14351. @item
  14352. Apply a boxblur filter with the luma, chroma, and alpha radius
  14353. set to 2 and luma, chroma, and alpha power set to 3. The filter will run 3 times with box-radius set to 2 for every plane of the image.
  14354. @example
  14355. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  14356. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  14357. @end example
  14358. @item
  14359. Apply a boxblur filter with luma radius set to 2, luma_power to 1, chroma_radius to 4, chroma_power to 5, alpha_radius to 3 and alpha_power to 7.
  14360. For the luma plane, a 2x2 box radius will be run once.
  14361. For the chroma plane, a 4x4 box radius will be run 5 times.
  14362. For the alpha plane, a 3x3 box radius will be run 7 times.
  14363. @example
  14364. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  14365. @end example
  14366. @end itemize
  14367. @section convolution_opencl
  14368. Apply convolution of 3x3, 5x5, 7x7 matrix.
  14369. The filter accepts the following options:
  14370. @table @option
  14371. @item 0m
  14372. @item 1m
  14373. @item 2m
  14374. @item 3m
  14375. Set matrix for each plane.
  14376. Matrix is sequence of 9, 25 or 49 signed numbers.
  14377. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  14378. @item 0rdiv
  14379. @item 1rdiv
  14380. @item 2rdiv
  14381. @item 3rdiv
  14382. Set multiplier for calculated value for each plane.
  14383. If unset or 0, it will be sum of all matrix elements.
  14384. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  14385. @item 0bias
  14386. @item 1bias
  14387. @item 2bias
  14388. @item 3bias
  14389. Set bias for each plane. This value is added to the result of the multiplication.
  14390. Useful for making the overall image brighter or darker.
  14391. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  14392. @end table
  14393. @subsection Examples
  14394. @itemize
  14395. @item
  14396. Apply sharpen:
  14397. @example
  14398. -i INPUT -vf "hwupload, convolution_opencl=0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0, hwdownload" OUTPUT
  14399. @end example
  14400. @item
  14401. Apply blur:
  14402. @example
  14403. -i INPUT -vf "hwupload, convolution_opencl=1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1/9:1/9:1/9:1/9, hwdownload" OUTPUT
  14404. @end example
  14405. @item
  14406. Apply edge enhance:
  14407. @example
  14408. -i INPUT -vf "hwupload, convolution_opencl=0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:5:1:1:1:0:128:128:128, hwdownload" OUTPUT
  14409. @end example
  14410. @item
  14411. Apply edge detect:
  14412. @example
  14413. -i INPUT -vf "hwupload, convolution_opencl=0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:5:5:5:1:0:128:128:128, hwdownload" OUTPUT
  14414. @end example
  14415. @item
  14416. Apply laplacian edge detector which includes diagonals:
  14417. @example
  14418. -i INPUT -vf "hwupload, convolution_opencl=1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:5:5:5:1:0:128:128:0, hwdownload" OUTPUT
  14419. @end example
  14420. @item
  14421. Apply emboss:
  14422. @example
  14423. -i INPUT -vf "hwupload, convolution_opencl=-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2, hwdownload" OUTPUT
  14424. @end example
  14425. @end itemize
  14426. @section dilation_opencl
  14427. Apply dilation effect to the video.
  14428. This filter replaces the pixel by the local(3x3) maximum.
  14429. It accepts the following options:
  14430. @table @option
  14431. @item threshold0
  14432. @item threshold1
  14433. @item threshold2
  14434. @item threshold3
  14435. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14436. If @code{0}, plane will remain unchanged.
  14437. @item coordinates
  14438. Flag which specifies the pixel to refer to.
  14439. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14440. Flags to local 3x3 coordinates region centered on @code{x}:
  14441. 1 2 3
  14442. 4 x 5
  14443. 6 7 8
  14444. @end table
  14445. @subsection Example
  14446. @itemize
  14447. @item
  14448. Apply dilation filter with threshold0 set to 30, threshold1 set 40, threshold2 set to 50 and coordinates set to 231, setting each pixel of the output to the local maximum between pixels: 1, 2, 3, 6, 7, 8 of the 3x3 region centered on it in the input. If the difference between input pixel and local maximum is more then threshold of the corresponding plane, output pixel will be set to input pixel + threshold of corresponding plane.
  14449. @example
  14450. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14451. @end example
  14452. @end itemize
  14453. @section erosion_opencl
  14454. Apply erosion effect to the video.
  14455. This filter replaces the pixel by the local(3x3) minimum.
  14456. It accepts the following options:
  14457. @table @option
  14458. @item threshold0
  14459. @item threshold1
  14460. @item threshold2
  14461. @item threshold3
  14462. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14463. If @code{0}, plane will remain unchanged.
  14464. @item coordinates
  14465. Flag which specifies the pixel to refer to.
  14466. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14467. Flags to local 3x3 coordinates region centered on @code{x}:
  14468. 1 2 3
  14469. 4 x 5
  14470. 6 7 8
  14471. @end table
  14472. @subsection Example
  14473. @itemize
  14474. @item
  14475. Apply erosion filter with threshold0 set to 30, threshold1 set 40, threshold2 set to 50 and coordinates set to 231, setting each pixel of the output to the local minimum between pixels: 1, 2, 3, 6, 7, 8 of the 3x3 region centered on it in the input. If the difference between input pixel and local minimum is more then threshold of the corresponding plane, output pixel will be set to input pixel - threshold of corresponding plane.
  14476. @example
  14477. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14478. @end example
  14479. @end itemize
  14480. @section overlay_opencl
  14481. Overlay one video on top of another.
  14482. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  14483. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  14484. The filter accepts the following options:
  14485. @table @option
  14486. @item x
  14487. Set the x coordinate of the overlaid video on the main video.
  14488. Default value is @code{0}.
  14489. @item y
  14490. Set the x coordinate of the overlaid video on the main video.
  14491. Default value is @code{0}.
  14492. @end table
  14493. @subsection Examples
  14494. @itemize
  14495. @item
  14496. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  14497. @example
  14498. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14499. @end example
  14500. @item
  14501. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  14502. @example
  14503. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14504. @end example
  14505. @end itemize
  14506. @section prewitt_opencl
  14507. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  14508. The filter accepts the following option:
  14509. @table @option
  14510. @item planes
  14511. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14512. @item scale
  14513. Set value which will be multiplied with filtered result.
  14514. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14515. @item delta
  14516. Set value which will be added to filtered result.
  14517. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14518. @end table
  14519. @subsection Example
  14520. @itemize
  14521. @item
  14522. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  14523. @example
  14524. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14525. @end example
  14526. @end itemize
  14527. @section roberts_opencl
  14528. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  14529. The filter accepts the following option:
  14530. @table @option
  14531. @item planes
  14532. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14533. @item scale
  14534. Set value which will be multiplied with filtered result.
  14535. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14536. @item delta
  14537. Set value which will be added to filtered result.
  14538. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14539. @end table
  14540. @subsection Example
  14541. @itemize
  14542. @item
  14543. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  14544. @example
  14545. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14546. @end example
  14547. @end itemize
  14548. @section sobel_opencl
  14549. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  14550. The filter accepts the following option:
  14551. @table @option
  14552. @item planes
  14553. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14554. @item scale
  14555. Set value which will be multiplied with filtered result.
  14556. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14557. @item delta
  14558. Set value which will be added to filtered result.
  14559. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14560. @end table
  14561. @subsection Example
  14562. @itemize
  14563. @item
  14564. Apply sobel operator with scale set to 2 and delta set to 10
  14565. @example
  14566. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14567. @end example
  14568. @end itemize
  14569. @section tonemap_opencl
  14570. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  14571. It accepts the following parameters:
  14572. @table @option
  14573. @item tonemap
  14574. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  14575. @item param
  14576. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  14577. @item desat
  14578. Apply desaturation for highlights that exceed this level of brightness. The
  14579. higher the parameter, the more color information will be preserved. This
  14580. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14581. (smoothly) turning into white instead. This makes images feel more natural,
  14582. at the cost of reducing information about out-of-range colors.
  14583. The default value is 0.5, and the algorithm here is a little different from
  14584. the cpu version tonemap currently. A setting of 0.0 disables this option.
  14585. @item threshold
  14586. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  14587. is used to detect whether the scene has changed or not. If the distance between
  14588. the current frame average brightness and the current running average exceeds
  14589. a threshold value, we would re-calculate scene average and peak brightness.
  14590. The default value is 0.2.
  14591. @item format
  14592. Specify the output pixel format.
  14593. Currently supported formats are:
  14594. @table @var
  14595. @item p010
  14596. @item nv12
  14597. @end table
  14598. @item range, r
  14599. Set the output color range.
  14600. Possible values are:
  14601. @table @var
  14602. @item tv/mpeg
  14603. @item pc/jpeg
  14604. @end table
  14605. Default is same as input.
  14606. @item primaries, p
  14607. Set the output color primaries.
  14608. Possible values are:
  14609. @table @var
  14610. @item bt709
  14611. @item bt2020
  14612. @end table
  14613. Default is same as input.
  14614. @item transfer, t
  14615. Set the output transfer characteristics.
  14616. Possible values are:
  14617. @table @var
  14618. @item bt709
  14619. @item bt2020
  14620. @end table
  14621. Default is bt709.
  14622. @item matrix, m
  14623. Set the output colorspace matrix.
  14624. Possible value are:
  14625. @table @var
  14626. @item bt709
  14627. @item bt2020
  14628. @end table
  14629. Default is same as input.
  14630. @end table
  14631. @subsection Example
  14632. @itemize
  14633. @item
  14634. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  14635. @example
  14636. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  14637. @end example
  14638. @end itemize
  14639. @section unsharp_opencl
  14640. Sharpen or blur the input video.
  14641. It accepts the following parameters:
  14642. @table @option
  14643. @item luma_msize_x, lx
  14644. Set the luma matrix horizontal size.
  14645. Range is @code{[1, 23]} and default value is @code{5}.
  14646. @item luma_msize_y, ly
  14647. Set the luma matrix vertical size.
  14648. Range is @code{[1, 23]} and default value is @code{5}.
  14649. @item luma_amount, la
  14650. Set the luma effect strength.
  14651. Range is @code{[-10, 10]} and default value is @code{1.0}.
  14652. Negative values will blur the input video, while positive values will
  14653. sharpen it, a value of zero will disable the effect.
  14654. @item chroma_msize_x, cx
  14655. Set the chroma matrix horizontal size.
  14656. Range is @code{[1, 23]} and default value is @code{5}.
  14657. @item chroma_msize_y, cy
  14658. Set the chroma matrix vertical size.
  14659. Range is @code{[1, 23]} and default value is @code{5}.
  14660. @item chroma_amount, ca
  14661. Set the chroma effect strength.
  14662. Range is @code{[-10, 10]} and default value is @code{0.0}.
  14663. Negative values will blur the input video, while positive values will
  14664. sharpen it, a value of zero will disable the effect.
  14665. @end table
  14666. All parameters are optional and default to the equivalent of the
  14667. string '5:5:1.0:5:5:0.0'.
  14668. @subsection Examples
  14669. @itemize
  14670. @item
  14671. Apply strong luma sharpen effect:
  14672. @example
  14673. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  14674. @end example
  14675. @item
  14676. Apply a strong blur of both luma and chroma parameters:
  14677. @example
  14678. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  14679. @end example
  14680. @end itemize
  14681. @c man end OPENCL VIDEO FILTERS
  14682. @chapter Video Sources
  14683. @c man begin VIDEO SOURCES
  14684. Below is a description of the currently available video sources.
  14685. @section buffer
  14686. Buffer video frames, and make them available to the filter chain.
  14687. This source is mainly intended for a programmatic use, in particular
  14688. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  14689. It accepts the following parameters:
  14690. @table @option
  14691. @item video_size
  14692. Specify the size (width and height) of the buffered video frames. For the
  14693. syntax of this option, check the
  14694. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14695. @item width
  14696. The input video width.
  14697. @item height
  14698. The input video height.
  14699. @item pix_fmt
  14700. A string representing the pixel format of the buffered video frames.
  14701. It may be a number corresponding to a pixel format, or a pixel format
  14702. name.
  14703. @item time_base
  14704. Specify the timebase assumed by the timestamps of the buffered frames.
  14705. @item frame_rate
  14706. Specify the frame rate expected for the video stream.
  14707. @item pixel_aspect, sar
  14708. The sample (pixel) aspect ratio of the input video.
  14709. @item sws_param
  14710. Specify the optional parameters to be used for the scale filter which
  14711. is automatically inserted when an input change is detected in the
  14712. input size or format.
  14713. @item hw_frames_ctx
  14714. When using a hardware pixel format, this should be a reference to an
  14715. AVHWFramesContext describing input frames.
  14716. @end table
  14717. For example:
  14718. @example
  14719. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  14720. @end example
  14721. will instruct the source to accept video frames with size 320x240 and
  14722. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  14723. square pixels (1:1 sample aspect ratio).
  14724. Since the pixel format with name "yuv410p" corresponds to the number 6
  14725. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  14726. this example corresponds to:
  14727. @example
  14728. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  14729. @end example
  14730. Alternatively, the options can be specified as a flat string, but this
  14731. syntax is deprecated:
  14732. @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}]
  14733. @section cellauto
  14734. Create a pattern generated by an elementary cellular automaton.
  14735. The initial state of the cellular automaton can be defined through the
  14736. @option{filename} and @option{pattern} options. If such options are
  14737. not specified an initial state is created randomly.
  14738. At each new frame a new row in the video is filled with the result of
  14739. the cellular automaton next generation. The behavior when the whole
  14740. frame is filled is defined by the @option{scroll} option.
  14741. This source accepts the following options:
  14742. @table @option
  14743. @item filename, f
  14744. Read the initial cellular automaton state, i.e. the starting row, from
  14745. the specified file.
  14746. In the file, each non-whitespace character is considered an alive
  14747. cell, a newline will terminate the row, and further characters in the
  14748. file will be ignored.
  14749. @item pattern, p
  14750. Read the initial cellular automaton state, i.e. the starting row, from
  14751. the specified string.
  14752. Each non-whitespace character in the string is considered an alive
  14753. cell, a newline will terminate the row, and further characters in the
  14754. string will be ignored.
  14755. @item rate, r
  14756. Set the video rate, that is the number of frames generated per second.
  14757. Default is 25.
  14758. @item random_fill_ratio, ratio
  14759. Set the random fill ratio for the initial cellular automaton row. It
  14760. is a floating point number value ranging from 0 to 1, defaults to
  14761. 1/PHI.
  14762. This option is ignored when a file or a pattern is specified.
  14763. @item random_seed, seed
  14764. Set the seed for filling randomly the initial row, must be an integer
  14765. included between 0 and UINT32_MAX. If not specified, or if explicitly
  14766. set to -1, the filter will try to use a good random seed on a best
  14767. effort basis.
  14768. @item rule
  14769. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  14770. Default value is 110.
  14771. @item size, s
  14772. Set the size of the output video. For the syntax of this option, check the
  14773. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14774. If @option{filename} or @option{pattern} is specified, the size is set
  14775. by default to the width of the specified initial state row, and the
  14776. height is set to @var{width} * PHI.
  14777. If @option{size} is set, it must contain the width of the specified
  14778. pattern string, and the specified pattern will be centered in the
  14779. larger row.
  14780. If a filename or a pattern string is not specified, the size value
  14781. defaults to "320x518" (used for a randomly generated initial state).
  14782. @item scroll
  14783. If set to 1, scroll the output upward when all the rows in the output
  14784. have been already filled. If set to 0, the new generated row will be
  14785. written over the top row just after the bottom row is filled.
  14786. Defaults to 1.
  14787. @item start_full, full
  14788. If set to 1, completely fill the output with generated rows before
  14789. outputting the first frame.
  14790. This is the default behavior, for disabling set the value to 0.
  14791. @item stitch
  14792. If set to 1, stitch the left and right row edges together.
  14793. This is the default behavior, for disabling set the value to 0.
  14794. @end table
  14795. @subsection Examples
  14796. @itemize
  14797. @item
  14798. Read the initial state from @file{pattern}, and specify an output of
  14799. size 200x400.
  14800. @example
  14801. cellauto=f=pattern:s=200x400
  14802. @end example
  14803. @item
  14804. Generate a random initial row with a width of 200 cells, with a fill
  14805. ratio of 2/3:
  14806. @example
  14807. cellauto=ratio=2/3:s=200x200
  14808. @end example
  14809. @item
  14810. Create a pattern generated by rule 18 starting by a single alive cell
  14811. centered on an initial row with width 100:
  14812. @example
  14813. cellauto=p=@@:s=100x400:full=0:rule=18
  14814. @end example
  14815. @item
  14816. Specify a more elaborated initial pattern:
  14817. @example
  14818. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  14819. @end example
  14820. @end itemize
  14821. @anchor{coreimagesrc}
  14822. @section coreimagesrc
  14823. Video source generated on GPU using Apple's CoreImage API on OSX.
  14824. This video source is a specialized version of the @ref{coreimage} video filter.
  14825. Use a core image generator at the beginning of the applied filterchain to
  14826. generate the content.
  14827. The coreimagesrc video source accepts the following options:
  14828. @table @option
  14829. @item list_generators
  14830. List all available generators along with all their respective options as well as
  14831. possible minimum and maximum values along with the default values.
  14832. @example
  14833. list_generators=true
  14834. @end example
  14835. @item size, s
  14836. Specify the size of the sourced video. For the syntax of this option, check the
  14837. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14838. The default value is @code{320x240}.
  14839. @item rate, r
  14840. Specify the frame rate of the sourced video, as the number of frames
  14841. generated per second. It has to be a string in the format
  14842. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  14843. number or a valid video frame rate abbreviation. The default value is
  14844. "25".
  14845. @item sar
  14846. Set the sample aspect ratio of the sourced video.
  14847. @item duration, d
  14848. Set the duration of the sourced video. See
  14849. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14850. for the accepted syntax.
  14851. If not specified, or the expressed duration is negative, the video is
  14852. supposed to be generated forever.
  14853. @end table
  14854. Additionally, all options of the @ref{coreimage} video filter are accepted.
  14855. A complete filterchain can be used for further processing of the
  14856. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  14857. and examples for details.
  14858. @subsection Examples
  14859. @itemize
  14860. @item
  14861. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  14862. given as complete and escaped command-line for Apple's standard bash shell:
  14863. @example
  14864. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  14865. @end example
  14866. This example is equivalent to the QRCode example of @ref{coreimage} without the
  14867. need for a nullsrc video source.
  14868. @end itemize
  14869. @section mandelbrot
  14870. Generate a Mandelbrot set fractal, and progressively zoom towards the
  14871. point specified with @var{start_x} and @var{start_y}.
  14872. This source accepts the following options:
  14873. @table @option
  14874. @item end_pts
  14875. Set the terminal pts value. Default value is 400.
  14876. @item end_scale
  14877. Set the terminal scale value.
  14878. Must be a floating point value. Default value is 0.3.
  14879. @item inner
  14880. Set the inner coloring mode, that is the algorithm used to draw the
  14881. Mandelbrot fractal internal region.
  14882. It shall assume one of the following values:
  14883. @table @option
  14884. @item black
  14885. Set black mode.
  14886. @item convergence
  14887. Show time until convergence.
  14888. @item mincol
  14889. Set color based on point closest to the origin of the iterations.
  14890. @item period
  14891. Set period mode.
  14892. @end table
  14893. Default value is @var{mincol}.
  14894. @item bailout
  14895. Set the bailout value. Default value is 10.0.
  14896. @item maxiter
  14897. Set the maximum of iterations performed by the rendering
  14898. algorithm. Default value is 7189.
  14899. @item outer
  14900. Set outer coloring mode.
  14901. It shall assume one of following values:
  14902. @table @option
  14903. @item iteration_count
  14904. Set iteration count mode.
  14905. @item normalized_iteration_count
  14906. set normalized iteration count mode.
  14907. @end table
  14908. Default value is @var{normalized_iteration_count}.
  14909. @item rate, r
  14910. Set frame rate, expressed as number of frames per second. Default
  14911. value is "25".
  14912. @item size, s
  14913. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  14914. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  14915. @item start_scale
  14916. Set the initial scale value. Default value is 3.0.
  14917. @item start_x
  14918. Set the initial x position. Must be a floating point value between
  14919. -100 and 100. Default value is -0.743643887037158704752191506114774.
  14920. @item start_y
  14921. Set the initial y position. Must be a floating point value between
  14922. -100 and 100. Default value is -0.131825904205311970493132056385139.
  14923. @end table
  14924. @section mptestsrc
  14925. Generate various test patterns, as generated by the MPlayer test filter.
  14926. The size of the generated video is fixed, and is 256x256.
  14927. This source is useful in particular for testing encoding features.
  14928. This source accepts the following options:
  14929. @table @option
  14930. @item rate, r
  14931. Specify the frame rate of the sourced video, as the number of frames
  14932. generated per second. It has to be a string in the format
  14933. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  14934. number or a valid video frame rate abbreviation. The default value is
  14935. "25".
  14936. @item duration, d
  14937. Set the duration of the sourced video. See
  14938. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14939. for the accepted syntax.
  14940. If not specified, or the expressed duration is negative, the video is
  14941. supposed to be generated forever.
  14942. @item test, t
  14943. Set the number or the name of the test to perform. Supported tests are:
  14944. @table @option
  14945. @item dc_luma
  14946. @item dc_chroma
  14947. @item freq_luma
  14948. @item freq_chroma
  14949. @item amp_luma
  14950. @item amp_chroma
  14951. @item cbp
  14952. @item mv
  14953. @item ring1
  14954. @item ring2
  14955. @item all
  14956. @end table
  14957. Default value is "all", which will cycle through the list of all tests.
  14958. @end table
  14959. Some examples:
  14960. @example
  14961. mptestsrc=t=dc_luma
  14962. @end example
  14963. will generate a "dc_luma" test pattern.
  14964. @section frei0r_src
  14965. Provide a frei0r source.
  14966. To enable compilation of this filter you need to install the frei0r
  14967. header and configure FFmpeg with @code{--enable-frei0r}.
  14968. This source accepts the following parameters:
  14969. @table @option
  14970. @item size
  14971. The size of the video to generate. For the syntax of this option, check the
  14972. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14973. @item framerate
  14974. The framerate of the generated video. It may be a string of the form
  14975. @var{num}/@var{den} or a frame rate abbreviation.
  14976. @item filter_name
  14977. The name to the frei0r source to load. For more information regarding frei0r and
  14978. how to set the parameters, read the @ref{frei0r} section in the video filters
  14979. documentation.
  14980. @item filter_params
  14981. A '|'-separated list of parameters to pass to the frei0r source.
  14982. @end table
  14983. For example, to generate a frei0r partik0l source with size 200x200
  14984. and frame rate 10 which is overlaid on the overlay filter main input:
  14985. @example
  14986. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  14987. @end example
  14988. @section life
  14989. Generate a life pattern.
  14990. This source is based on a generalization of John Conway's life game.
  14991. The sourced input represents a life grid, each pixel represents a cell
  14992. which can be in one of two possible states, alive or dead. Every cell
  14993. interacts with its eight neighbours, which are the cells that are
  14994. horizontally, vertically, or diagonally adjacent.
  14995. At each interaction the grid evolves according to the adopted rule,
  14996. which specifies the number of neighbor alive cells which will make a
  14997. cell stay alive or born. The @option{rule} option allows one to specify
  14998. the rule to adopt.
  14999. This source accepts the following options:
  15000. @table @option
  15001. @item filename, f
  15002. Set the file from which to read the initial grid state. In the file,
  15003. each non-whitespace character is considered an alive cell, and newline
  15004. is used to delimit the end of each row.
  15005. If this option is not specified, the initial grid is generated
  15006. randomly.
  15007. @item rate, r
  15008. Set the video rate, that is the number of frames generated per second.
  15009. Default is 25.
  15010. @item random_fill_ratio, ratio
  15011. Set the random fill ratio for the initial random grid. It is a
  15012. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  15013. It is ignored when a file is specified.
  15014. @item random_seed, seed
  15015. Set the seed for filling the initial random grid, must be an integer
  15016. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15017. set to -1, the filter will try to use a good random seed on a best
  15018. effort basis.
  15019. @item rule
  15020. Set the life rule.
  15021. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  15022. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  15023. @var{NS} specifies the number of alive neighbor cells which make a
  15024. live cell stay alive, and @var{NB} the number of alive neighbor cells
  15025. which make a dead cell to become alive (i.e. to "born").
  15026. "s" and "b" can be used in place of "S" and "B", respectively.
  15027. Alternatively a rule can be specified by an 18-bits integer. The 9
  15028. high order bits are used to encode the next cell state if it is alive
  15029. for each number of neighbor alive cells, the low order bits specify
  15030. the rule for "borning" new cells. Higher order bits encode for an
  15031. higher number of neighbor cells.
  15032. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  15033. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  15034. Default value is "S23/B3", which is the original Conway's game of life
  15035. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  15036. cells, and will born a new cell if there are three alive cells around
  15037. a dead cell.
  15038. @item size, s
  15039. Set the size of the output video. For the syntax of this option, check the
  15040. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15041. If @option{filename} is specified, the size is set by default to the
  15042. same size of the input file. If @option{size} is set, it must contain
  15043. the size specified in the input file, and the initial grid defined in
  15044. that file is centered in the larger resulting area.
  15045. If a filename is not specified, the size value defaults to "320x240"
  15046. (used for a randomly generated initial grid).
  15047. @item stitch
  15048. If set to 1, stitch the left and right grid edges together, and the
  15049. top and bottom edges also. Defaults to 1.
  15050. @item mold
  15051. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  15052. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  15053. value from 0 to 255.
  15054. @item life_color
  15055. Set the color of living (or new born) cells.
  15056. @item death_color
  15057. Set the color of dead cells. If @option{mold} is set, this is the first color
  15058. used to represent a dead cell.
  15059. @item mold_color
  15060. Set mold color, for definitely dead and moldy cells.
  15061. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  15062. ffmpeg-utils manual,ffmpeg-utils}.
  15063. @end table
  15064. @subsection Examples
  15065. @itemize
  15066. @item
  15067. Read a grid from @file{pattern}, and center it on a grid of size
  15068. 300x300 pixels:
  15069. @example
  15070. life=f=pattern:s=300x300
  15071. @end example
  15072. @item
  15073. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  15074. @example
  15075. life=ratio=2/3:s=200x200
  15076. @end example
  15077. @item
  15078. Specify a custom rule for evolving a randomly generated grid:
  15079. @example
  15080. life=rule=S14/B34
  15081. @end example
  15082. @item
  15083. Full example with slow death effect (mold) using @command{ffplay}:
  15084. @example
  15085. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  15086. @end example
  15087. @end itemize
  15088. @anchor{allrgb}
  15089. @anchor{allyuv}
  15090. @anchor{color}
  15091. @anchor{haldclutsrc}
  15092. @anchor{nullsrc}
  15093. @anchor{pal75bars}
  15094. @anchor{pal100bars}
  15095. @anchor{rgbtestsrc}
  15096. @anchor{smptebars}
  15097. @anchor{smptehdbars}
  15098. @anchor{testsrc}
  15099. @anchor{testsrc2}
  15100. @anchor{yuvtestsrc}
  15101. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  15102. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  15103. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  15104. The @code{color} source provides an uniformly colored input.
  15105. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  15106. @ref{haldclut} filter.
  15107. The @code{nullsrc} source returns unprocessed video frames. It is
  15108. mainly useful to be employed in analysis / debugging tools, or as the
  15109. source for filters which ignore the input data.
  15110. The @code{pal75bars} source generates a color bars pattern, based on
  15111. EBU PAL recommendations with 75% color levels.
  15112. The @code{pal100bars} source generates a color bars pattern, based on
  15113. EBU PAL recommendations with 100% color levels.
  15114. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  15115. detecting RGB vs BGR issues. You should see a red, green and blue
  15116. stripe from top to bottom.
  15117. The @code{smptebars} source generates a color bars pattern, based on
  15118. the SMPTE Engineering Guideline EG 1-1990.
  15119. The @code{smptehdbars} source generates a color bars pattern, based on
  15120. the SMPTE RP 219-2002.
  15121. The @code{testsrc} source generates a test video pattern, showing a
  15122. color pattern, a scrolling gradient and a timestamp. This is mainly
  15123. intended for testing purposes.
  15124. The @code{testsrc2} source is similar to testsrc, but supports more
  15125. pixel formats instead of just @code{rgb24}. This allows using it as an
  15126. input for other tests without requiring a format conversion.
  15127. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  15128. see a y, cb and cr stripe from top to bottom.
  15129. The sources accept the following parameters:
  15130. @table @option
  15131. @item level
  15132. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  15133. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  15134. pixels to be used as identity matrix for 3D lookup tables. Each component is
  15135. coded on a @code{1/(N*N)} scale.
  15136. @item color, c
  15137. Specify the color of the source, only available in the @code{color}
  15138. source. For the syntax of this option, check the
  15139. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15140. @item size, s
  15141. Specify the size of the sourced video. For the syntax of this option, check the
  15142. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15143. The default value is @code{320x240}.
  15144. This option is not available with the @code{allrgb}, @code{allyuv}, and
  15145. @code{haldclutsrc} filters.
  15146. @item rate, r
  15147. Specify the frame rate of the sourced video, as the number of frames
  15148. generated per second. It has to be a string in the format
  15149. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15150. number or a valid video frame rate abbreviation. The default value is
  15151. "25".
  15152. @item duration, d
  15153. Set the duration of the sourced video. See
  15154. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15155. for the accepted syntax.
  15156. If not specified, or the expressed duration is negative, the video is
  15157. supposed to be generated forever.
  15158. @item sar
  15159. Set the sample aspect ratio of the sourced video.
  15160. @item alpha
  15161. Specify the alpha (opacity) of the background, only available in the
  15162. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  15163. 255 (fully opaque, the default).
  15164. @item decimals, n
  15165. Set the number of decimals to show in the timestamp, only available in the
  15166. @code{testsrc} source.
  15167. The displayed timestamp value will correspond to the original
  15168. timestamp value multiplied by the power of 10 of the specified
  15169. value. Default value is 0.
  15170. @end table
  15171. @subsection Examples
  15172. @itemize
  15173. @item
  15174. Generate a video with a duration of 5.3 seconds, with size
  15175. 176x144 and a frame rate of 10 frames per second:
  15176. @example
  15177. testsrc=duration=5.3:size=qcif:rate=10
  15178. @end example
  15179. @item
  15180. The following graph description will generate a red source
  15181. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  15182. frames per second:
  15183. @example
  15184. color=c=red@@0.2:s=qcif:r=10
  15185. @end example
  15186. @item
  15187. If the input content is to be ignored, @code{nullsrc} can be used. The
  15188. following command generates noise in the luminance plane by employing
  15189. the @code{geq} filter:
  15190. @example
  15191. nullsrc=s=256x256, geq=random(1)*255:128:128
  15192. @end example
  15193. @end itemize
  15194. @subsection Commands
  15195. The @code{color} source supports the following commands:
  15196. @table @option
  15197. @item c, color
  15198. Set the color of the created image. Accepts the same syntax of the
  15199. corresponding @option{color} option.
  15200. @end table
  15201. @section openclsrc
  15202. Generate video using an OpenCL program.
  15203. @table @option
  15204. @item source
  15205. OpenCL program source file.
  15206. @item kernel
  15207. Kernel name in program.
  15208. @item size, s
  15209. Size of frames to generate. This must be set.
  15210. @item format
  15211. Pixel format to use for the generated frames. This must be set.
  15212. @item rate, r
  15213. Number of frames generated every second. Default value is '25'.
  15214. @end table
  15215. For details of how the program loading works, see the @ref{program_opencl}
  15216. filter.
  15217. Example programs:
  15218. @itemize
  15219. @item
  15220. Generate a colour ramp by setting pixel values from the position of the pixel
  15221. in the output image. (Note that this will work with all pixel formats, but
  15222. the generated output will not be the same.)
  15223. @verbatim
  15224. __kernel void ramp(__write_only image2d_t dst,
  15225. unsigned int index)
  15226. {
  15227. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15228. float4 val;
  15229. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  15230. write_imagef(dst, loc, val);
  15231. }
  15232. @end verbatim
  15233. @item
  15234. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  15235. @verbatim
  15236. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  15237. unsigned int index)
  15238. {
  15239. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15240. float4 value = 0.0f;
  15241. int x = loc.x + index;
  15242. int y = loc.y + index;
  15243. while (x > 0 || y > 0) {
  15244. if (x % 3 == 1 && y % 3 == 1) {
  15245. value = 1.0f;
  15246. break;
  15247. }
  15248. x /= 3;
  15249. y /= 3;
  15250. }
  15251. write_imagef(dst, loc, value);
  15252. }
  15253. @end verbatim
  15254. @end itemize
  15255. @c man end VIDEO SOURCES
  15256. @chapter Video Sinks
  15257. @c man begin VIDEO SINKS
  15258. Below is a description of the currently available video sinks.
  15259. @section buffersink
  15260. Buffer video frames, and make them available to the end of the filter
  15261. graph.
  15262. This sink is mainly intended for programmatic use, in particular
  15263. through the interface defined in @file{libavfilter/buffersink.h}
  15264. or the options system.
  15265. It accepts a pointer to an AVBufferSinkContext structure, which
  15266. defines the incoming buffers' formats, to be passed as the opaque
  15267. parameter to @code{avfilter_init_filter} for initialization.
  15268. @section nullsink
  15269. Null video sink: do absolutely nothing with the input video. It is
  15270. mainly useful as a template and for use in analysis / debugging
  15271. tools.
  15272. @c man end VIDEO SINKS
  15273. @chapter Multimedia Filters
  15274. @c man begin MULTIMEDIA FILTERS
  15275. Below is a description of the currently available multimedia filters.
  15276. @section abitscope
  15277. Convert input audio to a video output, displaying the audio bit scope.
  15278. The filter accepts the following options:
  15279. @table @option
  15280. @item rate, r
  15281. Set frame rate, expressed as number of frames per second. Default
  15282. value is "25".
  15283. @item size, s
  15284. Specify the video size for the output. For the syntax of this option, check the
  15285. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15286. Default value is @code{1024x256}.
  15287. @item colors
  15288. Specify list of colors separated by space or by '|' which will be used to
  15289. draw channels. Unrecognized or missing colors will be replaced
  15290. by white color.
  15291. @end table
  15292. @section ahistogram
  15293. Convert input audio to a video output, displaying the volume histogram.
  15294. The filter accepts the following options:
  15295. @table @option
  15296. @item dmode
  15297. Specify how histogram is calculated.
  15298. It accepts the following values:
  15299. @table @samp
  15300. @item single
  15301. Use single histogram for all channels.
  15302. @item separate
  15303. Use separate histogram for each channel.
  15304. @end table
  15305. Default is @code{single}.
  15306. @item rate, r
  15307. Set frame rate, expressed as number of frames per second. Default
  15308. value is "25".
  15309. @item size, s
  15310. Specify the video size for the output. For the syntax of this option, check the
  15311. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15312. Default value is @code{hd720}.
  15313. @item scale
  15314. Set display scale.
  15315. It accepts the following values:
  15316. @table @samp
  15317. @item log
  15318. logarithmic
  15319. @item sqrt
  15320. square root
  15321. @item cbrt
  15322. cubic root
  15323. @item lin
  15324. linear
  15325. @item rlog
  15326. reverse logarithmic
  15327. @end table
  15328. Default is @code{log}.
  15329. @item ascale
  15330. Set amplitude scale.
  15331. It accepts the following values:
  15332. @table @samp
  15333. @item log
  15334. logarithmic
  15335. @item lin
  15336. linear
  15337. @end table
  15338. Default is @code{log}.
  15339. @item acount
  15340. Set how much frames to accumulate in histogram.
  15341. Default is 1. Setting this to -1 accumulates all frames.
  15342. @item rheight
  15343. Set histogram ratio of window height.
  15344. @item slide
  15345. Set sonogram sliding.
  15346. It accepts the following values:
  15347. @table @samp
  15348. @item replace
  15349. replace old rows with new ones.
  15350. @item scroll
  15351. scroll from top to bottom.
  15352. @end table
  15353. Default is @code{replace}.
  15354. @end table
  15355. @section aphasemeter
  15356. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  15357. representing mean phase of current audio frame. A video output can also be produced and is
  15358. enabled by default. The audio is passed through as first output.
  15359. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  15360. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  15361. and @code{1} means channels are in phase.
  15362. The filter accepts the following options, all related to its video output:
  15363. @table @option
  15364. @item rate, r
  15365. Set the output frame rate. Default value is @code{25}.
  15366. @item size, s
  15367. Set the video size for the output. For the syntax of this option, check the
  15368. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15369. Default value is @code{800x400}.
  15370. @item rc
  15371. @item gc
  15372. @item bc
  15373. Specify the red, green, blue contrast. Default values are @code{2},
  15374. @code{7} and @code{1}.
  15375. Allowed range is @code{[0, 255]}.
  15376. @item mpc
  15377. Set color which will be used for drawing median phase. If color is
  15378. @code{none} which is default, no median phase value will be drawn.
  15379. @item video
  15380. Enable video output. Default is enabled.
  15381. @end table
  15382. @section avectorscope
  15383. Convert input audio to a video output, representing the audio vector
  15384. scope.
  15385. The filter is used to measure the difference between channels of stereo
  15386. audio stream. A monoaural signal, consisting of identical left and right
  15387. signal, results in straight vertical line. Any stereo separation is visible
  15388. as a deviation from this line, creating a Lissajous figure.
  15389. If the straight (or deviation from it) but horizontal line appears this
  15390. indicates that the left and right channels are out of phase.
  15391. The filter accepts the following options:
  15392. @table @option
  15393. @item mode, m
  15394. Set the vectorscope mode.
  15395. Available values are:
  15396. @table @samp
  15397. @item lissajous
  15398. Lissajous rotated by 45 degrees.
  15399. @item lissajous_xy
  15400. Same as above but not rotated.
  15401. @item polar
  15402. Shape resembling half of circle.
  15403. @end table
  15404. Default value is @samp{lissajous}.
  15405. @item size, s
  15406. Set the video size for the output. For the syntax of this option, check the
  15407. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15408. Default value is @code{400x400}.
  15409. @item rate, r
  15410. Set the output frame rate. Default value is @code{25}.
  15411. @item rc
  15412. @item gc
  15413. @item bc
  15414. @item ac
  15415. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  15416. @code{160}, @code{80} and @code{255}.
  15417. Allowed range is @code{[0, 255]}.
  15418. @item rf
  15419. @item gf
  15420. @item bf
  15421. @item af
  15422. Specify the red, green, blue and alpha fade. Default values are @code{15},
  15423. @code{10}, @code{5} and @code{5}.
  15424. Allowed range is @code{[0, 255]}.
  15425. @item zoom
  15426. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  15427. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  15428. @item draw
  15429. Set the vectorscope drawing mode.
  15430. Available values are:
  15431. @table @samp
  15432. @item dot
  15433. Draw dot for each sample.
  15434. @item line
  15435. Draw line between previous and current sample.
  15436. @end table
  15437. Default value is @samp{dot}.
  15438. @item scale
  15439. Specify amplitude scale of audio samples.
  15440. Available values are:
  15441. @table @samp
  15442. @item lin
  15443. Linear.
  15444. @item sqrt
  15445. Square root.
  15446. @item cbrt
  15447. Cubic root.
  15448. @item log
  15449. Logarithmic.
  15450. @end table
  15451. @item swap
  15452. Swap left channel axis with right channel axis.
  15453. @item mirror
  15454. Mirror axis.
  15455. @table @samp
  15456. @item none
  15457. No mirror.
  15458. @item x
  15459. Mirror only x axis.
  15460. @item y
  15461. Mirror only y axis.
  15462. @item xy
  15463. Mirror both axis.
  15464. @end table
  15465. @end table
  15466. @subsection Examples
  15467. @itemize
  15468. @item
  15469. Complete example using @command{ffplay}:
  15470. @example
  15471. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15472. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  15473. @end example
  15474. @end itemize
  15475. @section bench, abench
  15476. Benchmark part of a filtergraph.
  15477. The filter accepts the following options:
  15478. @table @option
  15479. @item action
  15480. Start or stop a timer.
  15481. Available values are:
  15482. @table @samp
  15483. @item start
  15484. Get the current time, set it as frame metadata (using the key
  15485. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  15486. @item stop
  15487. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  15488. the input frame metadata to get the time difference. Time difference, average,
  15489. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  15490. @code{min}) are then printed. The timestamps are expressed in seconds.
  15491. @end table
  15492. @end table
  15493. @subsection Examples
  15494. @itemize
  15495. @item
  15496. Benchmark @ref{selectivecolor} filter:
  15497. @example
  15498. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  15499. @end example
  15500. @end itemize
  15501. @section concat
  15502. Concatenate audio and video streams, joining them together one after the
  15503. other.
  15504. The filter works on segments of synchronized video and audio streams. All
  15505. segments must have the same number of streams of each type, and that will
  15506. also be the number of streams at output.
  15507. The filter accepts the following options:
  15508. @table @option
  15509. @item n
  15510. Set the number of segments. Default is 2.
  15511. @item v
  15512. Set the number of output video streams, that is also the number of video
  15513. streams in each segment. Default is 1.
  15514. @item a
  15515. Set the number of output audio streams, that is also the number of audio
  15516. streams in each segment. Default is 0.
  15517. @item unsafe
  15518. Activate unsafe mode: do not fail if segments have a different format.
  15519. @end table
  15520. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  15521. @var{a} audio outputs.
  15522. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  15523. segment, in the same order as the outputs, then the inputs for the second
  15524. segment, etc.
  15525. Related streams do not always have exactly the same duration, for various
  15526. reasons including codec frame size or sloppy authoring. For that reason,
  15527. related synchronized streams (e.g. a video and its audio track) should be
  15528. concatenated at once. The concat filter will use the duration of the longest
  15529. stream in each segment (except the last one), and if necessary pad shorter
  15530. audio streams with silence.
  15531. For this filter to work correctly, all segments must start at timestamp 0.
  15532. All corresponding streams must have the same parameters in all segments; the
  15533. filtering system will automatically select a common pixel format for video
  15534. streams, and a common sample format, sample rate and channel layout for
  15535. audio streams, but other settings, such as resolution, must be converted
  15536. explicitly by the user.
  15537. Different frame rates are acceptable but will result in variable frame rate
  15538. at output; be sure to configure the output file to handle it.
  15539. @subsection Examples
  15540. @itemize
  15541. @item
  15542. Concatenate an opening, an episode and an ending, all in bilingual version
  15543. (video in stream 0, audio in streams 1 and 2):
  15544. @example
  15545. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  15546. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  15547. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  15548. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  15549. @end example
  15550. @item
  15551. Concatenate two parts, handling audio and video separately, using the
  15552. (a)movie sources, and adjusting the resolution:
  15553. @example
  15554. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  15555. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  15556. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  15557. @end example
  15558. Note that a desync will happen at the stitch if the audio and video streams
  15559. do not have exactly the same duration in the first file.
  15560. @end itemize
  15561. @subsection Commands
  15562. This filter supports the following commands:
  15563. @table @option
  15564. @item next
  15565. Close the current segment and step to the next one
  15566. @end table
  15567. @section drawgraph, adrawgraph
  15568. Draw a graph using input video or audio metadata.
  15569. It accepts the following parameters:
  15570. @table @option
  15571. @item m1
  15572. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  15573. @item fg1
  15574. Set 1st foreground color expression.
  15575. @item m2
  15576. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  15577. @item fg2
  15578. Set 2nd foreground color expression.
  15579. @item m3
  15580. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  15581. @item fg3
  15582. Set 3rd foreground color expression.
  15583. @item m4
  15584. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  15585. @item fg4
  15586. Set 4th foreground color expression.
  15587. @item min
  15588. Set minimal value of metadata value.
  15589. @item max
  15590. Set maximal value of metadata value.
  15591. @item bg
  15592. Set graph background color. Default is white.
  15593. @item mode
  15594. Set graph mode.
  15595. Available values for mode is:
  15596. @table @samp
  15597. @item bar
  15598. @item dot
  15599. @item line
  15600. @end table
  15601. Default is @code{line}.
  15602. @item slide
  15603. Set slide mode.
  15604. Available values for slide is:
  15605. @table @samp
  15606. @item frame
  15607. Draw new frame when right border is reached.
  15608. @item replace
  15609. Replace old columns with new ones.
  15610. @item scroll
  15611. Scroll from right to left.
  15612. @item rscroll
  15613. Scroll from left to right.
  15614. @item picture
  15615. Draw single picture.
  15616. @end table
  15617. Default is @code{frame}.
  15618. @item size
  15619. Set size of graph video. For the syntax of this option, check the
  15620. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15621. The default value is @code{900x256}.
  15622. The foreground color expressions can use the following variables:
  15623. @table @option
  15624. @item MIN
  15625. Minimal value of metadata value.
  15626. @item MAX
  15627. Maximal value of metadata value.
  15628. @item VAL
  15629. Current metadata key value.
  15630. @end table
  15631. The color is defined as 0xAABBGGRR.
  15632. @end table
  15633. Example using metadata from @ref{signalstats} filter:
  15634. @example
  15635. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  15636. @end example
  15637. Example using metadata from @ref{ebur128} filter:
  15638. @example
  15639. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  15640. @end example
  15641. @anchor{ebur128}
  15642. @section ebur128
  15643. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  15644. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  15645. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  15646. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  15647. The filter also has a video output (see the @var{video} option) with a real
  15648. time graph to observe the loudness evolution. The graphic contains the logged
  15649. message mentioned above, so it is not printed anymore when this option is set,
  15650. unless the verbose logging is set. The main graphing area contains the
  15651. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  15652. the momentary loudness (400 milliseconds), but can optionally be configured
  15653. to instead display short-term loudness (see @var{gauge}).
  15654. The green area marks a +/- 1LU target range around the target loudness
  15655. (-23LUFS by default, unless modified through @var{target}).
  15656. More information about the Loudness Recommendation EBU R128 on
  15657. @url{http://tech.ebu.ch/loudness}.
  15658. The filter accepts the following options:
  15659. @table @option
  15660. @item video
  15661. Activate the video output. The audio stream is passed unchanged whether this
  15662. option is set or no. The video stream will be the first output stream if
  15663. activated. Default is @code{0}.
  15664. @item size
  15665. Set the video size. This option is for video only. For the syntax of this
  15666. option, check the
  15667. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15668. Default and minimum resolution is @code{640x480}.
  15669. @item meter
  15670. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  15671. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  15672. other integer value between this range is allowed.
  15673. @item metadata
  15674. Set metadata injection. If set to @code{1}, the audio input will be segmented
  15675. into 100ms output frames, each of them containing various loudness information
  15676. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  15677. Default is @code{0}.
  15678. @item framelog
  15679. Force the frame logging level.
  15680. Available values are:
  15681. @table @samp
  15682. @item info
  15683. information logging level
  15684. @item verbose
  15685. verbose logging level
  15686. @end table
  15687. By default, the logging level is set to @var{info}. If the @option{video} or
  15688. the @option{metadata} options are set, it switches to @var{verbose}.
  15689. @item peak
  15690. Set peak mode(s).
  15691. Available modes can be cumulated (the option is a @code{flag} type). Possible
  15692. values are:
  15693. @table @samp
  15694. @item none
  15695. Disable any peak mode (default).
  15696. @item sample
  15697. Enable sample-peak mode.
  15698. Simple peak mode looking for the higher sample value. It logs a message
  15699. for sample-peak (identified by @code{SPK}).
  15700. @item true
  15701. Enable true-peak mode.
  15702. If enabled, the peak lookup is done on an over-sampled version of the input
  15703. stream for better peak accuracy. It logs a message for true-peak.
  15704. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  15705. This mode requires a build with @code{libswresample}.
  15706. @end table
  15707. @item dualmono
  15708. Treat mono input files as "dual mono". If a mono file is intended for playback
  15709. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  15710. If set to @code{true}, this option will compensate for this effect.
  15711. Multi-channel input files are not affected by this option.
  15712. @item panlaw
  15713. Set a specific pan law to be used for the measurement of dual mono files.
  15714. This parameter is optional, and has a default value of -3.01dB.
  15715. @item target
  15716. Set a specific target level (in LUFS) used as relative zero in the visualization.
  15717. This parameter is optional and has a default value of -23LUFS as specified
  15718. by EBU R128. However, material published online may prefer a level of -16LUFS
  15719. (e.g. for use with podcasts or video platforms).
  15720. @item gauge
  15721. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  15722. @code{shortterm}. By default the momentary value will be used, but in certain
  15723. scenarios it may be more useful to observe the short term value instead (e.g.
  15724. live mixing).
  15725. @item scale
  15726. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  15727. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  15728. video output, not the summary or continuous log output.
  15729. @end table
  15730. @subsection Examples
  15731. @itemize
  15732. @item
  15733. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  15734. @example
  15735. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  15736. @end example
  15737. @item
  15738. Run an analysis with @command{ffmpeg}:
  15739. @example
  15740. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  15741. @end example
  15742. @end itemize
  15743. @section interleave, ainterleave
  15744. Temporally interleave frames from several inputs.
  15745. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  15746. These filters read frames from several inputs and send the oldest
  15747. queued frame to the output.
  15748. Input streams must have well defined, monotonically increasing frame
  15749. timestamp values.
  15750. In order to submit one frame to output, these filters need to enqueue
  15751. at least one frame for each input, so they cannot work in case one
  15752. input is not yet terminated and will not receive incoming frames.
  15753. For example consider the case when one input is a @code{select} filter
  15754. which always drops input frames. The @code{interleave} filter will keep
  15755. reading from that input, but it will never be able to send new frames
  15756. to output until the input sends an end-of-stream signal.
  15757. Also, depending on inputs synchronization, the filters will drop
  15758. frames in case one input receives more frames than the other ones, and
  15759. the queue is already filled.
  15760. These filters accept the following options:
  15761. @table @option
  15762. @item nb_inputs, n
  15763. Set the number of different inputs, it is 2 by default.
  15764. @end table
  15765. @subsection Examples
  15766. @itemize
  15767. @item
  15768. Interleave frames belonging to different streams using @command{ffmpeg}:
  15769. @example
  15770. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  15771. @end example
  15772. @item
  15773. Add flickering blur effect:
  15774. @example
  15775. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  15776. @end example
  15777. @end itemize
  15778. @section metadata, ametadata
  15779. Manipulate frame metadata.
  15780. This filter accepts the following options:
  15781. @table @option
  15782. @item mode
  15783. Set mode of operation of the filter.
  15784. Can be one of the following:
  15785. @table @samp
  15786. @item select
  15787. If both @code{value} and @code{key} is set, select frames
  15788. which have such metadata. If only @code{key} is set, select
  15789. every frame that has such key in metadata.
  15790. @item add
  15791. Add new metadata @code{key} and @code{value}. If key is already available
  15792. do nothing.
  15793. @item modify
  15794. Modify value of already present key.
  15795. @item delete
  15796. If @code{value} is set, delete only keys that have such value.
  15797. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  15798. the frame.
  15799. @item print
  15800. Print key and its value if metadata was found. If @code{key} is not set print all
  15801. metadata values available in frame.
  15802. @end table
  15803. @item key
  15804. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  15805. @item value
  15806. Set metadata value which will be used. This option is mandatory for
  15807. @code{modify} and @code{add} mode.
  15808. @item function
  15809. Which function to use when comparing metadata value and @code{value}.
  15810. Can be one of following:
  15811. @table @samp
  15812. @item same_str
  15813. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  15814. @item starts_with
  15815. Values are interpreted as strings, returns true if metadata value starts with
  15816. the @code{value} option string.
  15817. @item less
  15818. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  15819. @item equal
  15820. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  15821. @item greater
  15822. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  15823. @item expr
  15824. Values are interpreted as floats, returns true if expression from option @code{expr}
  15825. evaluates to true.
  15826. @end table
  15827. @item expr
  15828. Set expression which is used when @code{function} is set to @code{expr}.
  15829. The expression is evaluated through the eval API and can contain the following
  15830. constants:
  15831. @table @option
  15832. @item VALUE1
  15833. Float representation of @code{value} from metadata key.
  15834. @item VALUE2
  15835. Float representation of @code{value} as supplied by user in @code{value} option.
  15836. @end table
  15837. @item file
  15838. If specified in @code{print} mode, output is written to the named file. Instead of
  15839. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  15840. for standard output. If @code{file} option is not set, output is written to the log
  15841. with AV_LOG_INFO loglevel.
  15842. @end table
  15843. @subsection Examples
  15844. @itemize
  15845. @item
  15846. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  15847. between 0 and 1.
  15848. @example
  15849. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  15850. @end example
  15851. @item
  15852. Print silencedetect output to file @file{metadata.txt}.
  15853. @example
  15854. silencedetect,ametadata=mode=print:file=metadata.txt
  15855. @end example
  15856. @item
  15857. Direct all metadata to a pipe with file descriptor 4.
  15858. @example
  15859. metadata=mode=print:file='pipe\:4'
  15860. @end example
  15861. @end itemize
  15862. @section perms, aperms
  15863. Set read/write permissions for the output frames.
  15864. These filters are mainly aimed at developers to test direct path in the
  15865. following filter in the filtergraph.
  15866. The filters accept the following options:
  15867. @table @option
  15868. @item mode
  15869. Select the permissions mode.
  15870. It accepts the following values:
  15871. @table @samp
  15872. @item none
  15873. Do nothing. This is the default.
  15874. @item ro
  15875. Set all the output frames read-only.
  15876. @item rw
  15877. Set all the output frames directly writable.
  15878. @item toggle
  15879. Make the frame read-only if writable, and writable if read-only.
  15880. @item random
  15881. Set each output frame read-only or writable randomly.
  15882. @end table
  15883. @item seed
  15884. Set the seed for the @var{random} mode, must be an integer included between
  15885. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  15886. @code{-1}, the filter will try to use a good random seed on a best effort
  15887. basis.
  15888. @end table
  15889. Note: in case of auto-inserted filter between the permission filter and the
  15890. following one, the permission might not be received as expected in that
  15891. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  15892. perms/aperms filter can avoid this problem.
  15893. @section realtime, arealtime
  15894. Slow down filtering to match real time approximately.
  15895. These filters will pause the filtering for a variable amount of time to
  15896. match the output rate with the input timestamps.
  15897. They are similar to the @option{re} option to @code{ffmpeg}.
  15898. They accept the following options:
  15899. @table @option
  15900. @item limit
  15901. Time limit for the pauses. Any pause longer than that will be considered
  15902. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  15903. @end table
  15904. @anchor{select}
  15905. @section select, aselect
  15906. Select frames to pass in output.
  15907. This filter accepts the following options:
  15908. @table @option
  15909. @item expr, e
  15910. Set expression, which is evaluated for each input frame.
  15911. If the expression is evaluated to zero, the frame is discarded.
  15912. If the evaluation result is negative or NaN, the frame is sent to the
  15913. first output; otherwise it is sent to the output with index
  15914. @code{ceil(val)-1}, assuming that the input index starts from 0.
  15915. For example a value of @code{1.2} corresponds to the output with index
  15916. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  15917. @item outputs, n
  15918. Set the number of outputs. The output to which to send the selected
  15919. frame is based on the result of the evaluation. Default value is 1.
  15920. @end table
  15921. The expression can contain the following constants:
  15922. @table @option
  15923. @item n
  15924. The (sequential) number of the filtered frame, starting from 0.
  15925. @item selected_n
  15926. The (sequential) number of the selected frame, starting from 0.
  15927. @item prev_selected_n
  15928. The sequential number of the last selected frame. It's NAN if undefined.
  15929. @item TB
  15930. The timebase of the input timestamps.
  15931. @item pts
  15932. The PTS (Presentation TimeStamp) of the filtered video frame,
  15933. expressed in @var{TB} units. It's NAN if undefined.
  15934. @item t
  15935. The PTS of the filtered video frame,
  15936. expressed in seconds. It's NAN if undefined.
  15937. @item prev_pts
  15938. The PTS of the previously filtered video frame. It's NAN if undefined.
  15939. @item prev_selected_pts
  15940. The PTS of the last previously filtered video frame. It's NAN if undefined.
  15941. @item prev_selected_t
  15942. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  15943. @item start_pts
  15944. The PTS of the first video frame in the video. It's NAN if undefined.
  15945. @item start_t
  15946. The time of the first video frame in the video. It's NAN if undefined.
  15947. @item pict_type @emph{(video only)}
  15948. The type of the filtered frame. It can assume one of the following
  15949. values:
  15950. @table @option
  15951. @item I
  15952. @item P
  15953. @item B
  15954. @item S
  15955. @item SI
  15956. @item SP
  15957. @item BI
  15958. @end table
  15959. @item interlace_type @emph{(video only)}
  15960. The frame interlace type. It can assume one of the following values:
  15961. @table @option
  15962. @item PROGRESSIVE
  15963. The frame is progressive (not interlaced).
  15964. @item TOPFIRST
  15965. The frame is top-field-first.
  15966. @item BOTTOMFIRST
  15967. The frame is bottom-field-first.
  15968. @end table
  15969. @item consumed_sample_n @emph{(audio only)}
  15970. the number of selected samples before the current frame
  15971. @item samples_n @emph{(audio only)}
  15972. the number of samples in the current frame
  15973. @item sample_rate @emph{(audio only)}
  15974. the input sample rate
  15975. @item key
  15976. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  15977. @item pos
  15978. the position in the file of the filtered frame, -1 if the information
  15979. is not available (e.g. for synthetic video)
  15980. @item scene @emph{(video only)}
  15981. value between 0 and 1 to indicate a new scene; a low value reflects a low
  15982. probability for the current frame to introduce a new scene, while a higher
  15983. value means the current frame is more likely to be one (see the example below)
  15984. @item concatdec_select
  15985. The concat demuxer can select only part of a concat input file by setting an
  15986. inpoint and an outpoint, but the output packets may not be entirely contained
  15987. in the selected interval. By using this variable, it is possible to skip frames
  15988. generated by the concat demuxer which are not exactly contained in the selected
  15989. interval.
  15990. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  15991. and the @var{lavf.concat.duration} packet metadata values which are also
  15992. present in the decoded frames.
  15993. The @var{concatdec_select} variable is -1 if the frame pts is at least
  15994. start_time and either the duration metadata is missing or the frame pts is less
  15995. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  15996. missing.
  15997. That basically means that an input frame is selected if its pts is within the
  15998. interval set by the concat demuxer.
  15999. @end table
  16000. The default value of the select expression is "1".
  16001. @subsection Examples
  16002. @itemize
  16003. @item
  16004. Select all frames in input:
  16005. @example
  16006. select
  16007. @end example
  16008. The example above is the same as:
  16009. @example
  16010. select=1
  16011. @end example
  16012. @item
  16013. Skip all frames:
  16014. @example
  16015. select=0
  16016. @end example
  16017. @item
  16018. Select only I-frames:
  16019. @example
  16020. select='eq(pict_type\,I)'
  16021. @end example
  16022. @item
  16023. Select one frame every 100:
  16024. @example
  16025. select='not(mod(n\,100))'
  16026. @end example
  16027. @item
  16028. Select only frames contained in the 10-20 time interval:
  16029. @example
  16030. select=between(t\,10\,20)
  16031. @end example
  16032. @item
  16033. Select only I-frames contained in the 10-20 time interval:
  16034. @example
  16035. select=between(t\,10\,20)*eq(pict_type\,I)
  16036. @end example
  16037. @item
  16038. Select frames with a minimum distance of 10 seconds:
  16039. @example
  16040. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  16041. @end example
  16042. @item
  16043. Use aselect to select only audio frames with samples number > 100:
  16044. @example
  16045. aselect='gt(samples_n\,100)'
  16046. @end example
  16047. @item
  16048. Create a mosaic of the first scenes:
  16049. @example
  16050. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  16051. @end example
  16052. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  16053. choice.
  16054. @item
  16055. Send even and odd frames to separate outputs, and compose them:
  16056. @example
  16057. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  16058. @end example
  16059. @item
  16060. Select useful frames from an ffconcat file which is using inpoints and
  16061. outpoints but where the source files are not intra frame only.
  16062. @example
  16063. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  16064. @end example
  16065. @end itemize
  16066. @section sendcmd, asendcmd
  16067. Send commands to filters in the filtergraph.
  16068. These filters read commands to be sent to other filters in the
  16069. filtergraph.
  16070. @code{sendcmd} must be inserted between two video filters,
  16071. @code{asendcmd} must be inserted between two audio filters, but apart
  16072. from that they act the same way.
  16073. The specification of commands can be provided in the filter arguments
  16074. with the @var{commands} option, or in a file specified by the
  16075. @var{filename} option.
  16076. These filters accept the following options:
  16077. @table @option
  16078. @item commands, c
  16079. Set the commands to be read and sent to the other filters.
  16080. @item filename, f
  16081. Set the filename of the commands to be read and sent to the other
  16082. filters.
  16083. @end table
  16084. @subsection Commands syntax
  16085. A commands description consists of a sequence of interval
  16086. specifications, comprising a list of commands to be executed when a
  16087. particular event related to that interval occurs. The occurring event
  16088. is typically the current frame time entering or leaving a given time
  16089. interval.
  16090. An interval is specified by the following syntax:
  16091. @example
  16092. @var{START}[-@var{END}] @var{COMMANDS};
  16093. @end example
  16094. The time interval is specified by the @var{START} and @var{END} times.
  16095. @var{END} is optional and defaults to the maximum time.
  16096. The current frame time is considered within the specified interval if
  16097. it is included in the interval [@var{START}, @var{END}), that is when
  16098. the time is greater or equal to @var{START} and is lesser than
  16099. @var{END}.
  16100. @var{COMMANDS} consists of a sequence of one or more command
  16101. specifications, separated by ",", relating to that interval. The
  16102. syntax of a command specification is given by:
  16103. @example
  16104. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  16105. @end example
  16106. @var{FLAGS} is optional and specifies the type of events relating to
  16107. the time interval which enable sending the specified command, and must
  16108. be a non-null sequence of identifier flags separated by "+" or "|" and
  16109. enclosed between "[" and "]".
  16110. The following flags are recognized:
  16111. @table @option
  16112. @item enter
  16113. The command is sent when the current frame timestamp enters the
  16114. specified interval. In other words, the command is sent when the
  16115. previous frame timestamp was not in the given interval, and the
  16116. current is.
  16117. @item leave
  16118. The command is sent when the current frame timestamp leaves the
  16119. specified interval. In other words, the command is sent when the
  16120. previous frame timestamp was in the given interval, and the
  16121. current is not.
  16122. @end table
  16123. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  16124. assumed.
  16125. @var{TARGET} specifies the target of the command, usually the name of
  16126. the filter class or a specific filter instance name.
  16127. @var{COMMAND} specifies the name of the command for the target filter.
  16128. @var{ARG} is optional and specifies the optional list of argument for
  16129. the given @var{COMMAND}.
  16130. Between one interval specification and another, whitespaces, or
  16131. sequences of characters starting with @code{#} until the end of line,
  16132. are ignored and can be used to annotate comments.
  16133. A simplified BNF description of the commands specification syntax
  16134. follows:
  16135. @example
  16136. @var{COMMAND_FLAG} ::= "enter" | "leave"
  16137. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  16138. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  16139. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  16140. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  16141. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  16142. @end example
  16143. @subsection Examples
  16144. @itemize
  16145. @item
  16146. Specify audio tempo change at second 4:
  16147. @example
  16148. asendcmd=c='4.0 atempo tempo 1.5',atempo
  16149. @end example
  16150. @item
  16151. Target a specific filter instance:
  16152. @example
  16153. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  16154. @end example
  16155. @item
  16156. Specify a list of drawtext and hue commands in a file.
  16157. @example
  16158. # show text in the interval 5-10
  16159. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  16160. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  16161. # desaturate the image in the interval 15-20
  16162. 15.0-20.0 [enter] hue s 0,
  16163. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  16164. [leave] hue s 1,
  16165. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  16166. # apply an exponential saturation fade-out effect, starting from time 25
  16167. 25 [enter] hue s exp(25-t)
  16168. @end example
  16169. A filtergraph allowing to read and process the above command list
  16170. stored in a file @file{test.cmd}, can be specified with:
  16171. @example
  16172. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  16173. @end example
  16174. @end itemize
  16175. @anchor{setpts}
  16176. @section setpts, asetpts
  16177. Change the PTS (presentation timestamp) of the input frames.
  16178. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  16179. This filter accepts the following options:
  16180. @table @option
  16181. @item expr
  16182. The expression which is evaluated for each frame to construct its timestamp.
  16183. @end table
  16184. The expression is evaluated through the eval API and can contain the following
  16185. constants:
  16186. @table @option
  16187. @item FRAME_RATE, FR
  16188. frame rate, only defined for constant frame-rate video
  16189. @item PTS
  16190. The presentation timestamp in input
  16191. @item N
  16192. The count of the input frame for video or the number of consumed samples,
  16193. not including the current frame for audio, starting from 0.
  16194. @item NB_CONSUMED_SAMPLES
  16195. The number of consumed samples, not including the current frame (only
  16196. audio)
  16197. @item NB_SAMPLES, S
  16198. The number of samples in the current frame (only audio)
  16199. @item SAMPLE_RATE, SR
  16200. The audio sample rate.
  16201. @item STARTPTS
  16202. The PTS of the first frame.
  16203. @item STARTT
  16204. the time in seconds of the first frame
  16205. @item INTERLACED
  16206. State whether the current frame is interlaced.
  16207. @item T
  16208. the time in seconds of the current frame
  16209. @item POS
  16210. original position in the file of the frame, or undefined if undefined
  16211. for the current frame
  16212. @item PREV_INPTS
  16213. The previous input PTS.
  16214. @item PREV_INT
  16215. previous input time in seconds
  16216. @item PREV_OUTPTS
  16217. The previous output PTS.
  16218. @item PREV_OUTT
  16219. previous output time in seconds
  16220. @item RTCTIME
  16221. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  16222. instead.
  16223. @item RTCSTART
  16224. The wallclock (RTC) time at the start of the movie in microseconds.
  16225. @item TB
  16226. The timebase of the input timestamps.
  16227. @end table
  16228. @subsection Examples
  16229. @itemize
  16230. @item
  16231. Start counting PTS from zero
  16232. @example
  16233. setpts=PTS-STARTPTS
  16234. @end example
  16235. @item
  16236. Apply fast motion effect:
  16237. @example
  16238. setpts=0.5*PTS
  16239. @end example
  16240. @item
  16241. Apply slow motion effect:
  16242. @example
  16243. setpts=2.0*PTS
  16244. @end example
  16245. @item
  16246. Set fixed rate of 25 frames per second:
  16247. @example
  16248. setpts=N/(25*TB)
  16249. @end example
  16250. @item
  16251. Set fixed rate 25 fps with some jitter:
  16252. @example
  16253. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  16254. @end example
  16255. @item
  16256. Apply an offset of 10 seconds to the input PTS:
  16257. @example
  16258. setpts=PTS+10/TB
  16259. @end example
  16260. @item
  16261. Generate timestamps from a "live source" and rebase onto the current timebase:
  16262. @example
  16263. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  16264. @end example
  16265. @item
  16266. Generate timestamps by counting samples:
  16267. @example
  16268. asetpts=N/SR/TB
  16269. @end example
  16270. @end itemize
  16271. @section setrange
  16272. Force color range for the output video frame.
  16273. The @code{setrange} filter marks the color range property for the
  16274. output frames. It does not change the input frame, but only sets the
  16275. corresponding property, which affects how the frame is treated by
  16276. following filters.
  16277. The filter accepts the following options:
  16278. @table @option
  16279. @item range
  16280. Available values are:
  16281. @table @samp
  16282. @item auto
  16283. Keep the same color range property.
  16284. @item unspecified, unknown
  16285. Set the color range as unspecified.
  16286. @item limited, tv, mpeg
  16287. Set the color range as limited.
  16288. @item full, pc, jpeg
  16289. Set the color range as full.
  16290. @end table
  16291. @end table
  16292. @section settb, asettb
  16293. Set the timebase to use for the output frames timestamps.
  16294. It is mainly useful for testing timebase configuration.
  16295. It accepts the following parameters:
  16296. @table @option
  16297. @item expr, tb
  16298. The expression which is evaluated into the output timebase.
  16299. @end table
  16300. The value for @option{tb} is an arithmetic expression representing a
  16301. rational. The expression can contain the constants "AVTB" (the default
  16302. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  16303. audio only). Default value is "intb".
  16304. @subsection Examples
  16305. @itemize
  16306. @item
  16307. Set the timebase to 1/25:
  16308. @example
  16309. settb=expr=1/25
  16310. @end example
  16311. @item
  16312. Set the timebase to 1/10:
  16313. @example
  16314. settb=expr=0.1
  16315. @end example
  16316. @item
  16317. Set the timebase to 1001/1000:
  16318. @example
  16319. settb=1+0.001
  16320. @end example
  16321. @item
  16322. Set the timebase to 2*intb:
  16323. @example
  16324. settb=2*intb
  16325. @end example
  16326. @item
  16327. Set the default timebase value:
  16328. @example
  16329. settb=AVTB
  16330. @end example
  16331. @end itemize
  16332. @section showcqt
  16333. Convert input audio to a video output representing frequency spectrum
  16334. logarithmically using Brown-Puckette constant Q transform algorithm with
  16335. direct frequency domain coefficient calculation (but the transform itself
  16336. is not really constant Q, instead the Q factor is actually variable/clamped),
  16337. with musical tone scale, from E0 to D#10.
  16338. The filter accepts the following options:
  16339. @table @option
  16340. @item size, s
  16341. Specify the video size for the output. It must be even. For the syntax of this option,
  16342. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16343. Default value is @code{1920x1080}.
  16344. @item fps, rate, r
  16345. Set the output frame rate. Default value is @code{25}.
  16346. @item bar_h
  16347. Set the bargraph height. It must be even. Default value is @code{-1} which
  16348. computes the bargraph height automatically.
  16349. @item axis_h
  16350. Set the axis height. It must be even. Default value is @code{-1} which computes
  16351. the axis height automatically.
  16352. @item sono_h
  16353. Set the sonogram height. It must be even. Default value is @code{-1} which
  16354. computes the sonogram height automatically.
  16355. @item fullhd
  16356. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  16357. instead. Default value is @code{1}.
  16358. @item sono_v, volume
  16359. Specify the sonogram volume expression. It can contain variables:
  16360. @table @option
  16361. @item bar_v
  16362. the @var{bar_v} evaluated expression
  16363. @item frequency, freq, f
  16364. the frequency where it is evaluated
  16365. @item timeclamp, tc
  16366. the value of @var{timeclamp} option
  16367. @end table
  16368. and functions:
  16369. @table @option
  16370. @item a_weighting(f)
  16371. A-weighting of equal loudness
  16372. @item b_weighting(f)
  16373. B-weighting of equal loudness
  16374. @item c_weighting(f)
  16375. C-weighting of equal loudness.
  16376. @end table
  16377. Default value is @code{16}.
  16378. @item bar_v, volume2
  16379. Specify the bargraph volume expression. It can contain variables:
  16380. @table @option
  16381. @item sono_v
  16382. the @var{sono_v} evaluated expression
  16383. @item frequency, freq, f
  16384. the frequency where it is evaluated
  16385. @item timeclamp, tc
  16386. the value of @var{timeclamp} option
  16387. @end table
  16388. and functions:
  16389. @table @option
  16390. @item a_weighting(f)
  16391. A-weighting of equal loudness
  16392. @item b_weighting(f)
  16393. B-weighting of equal loudness
  16394. @item c_weighting(f)
  16395. C-weighting of equal loudness.
  16396. @end table
  16397. Default value is @code{sono_v}.
  16398. @item sono_g, gamma
  16399. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  16400. higher gamma makes the spectrum having more range. Default value is @code{3}.
  16401. Acceptable range is @code{[1, 7]}.
  16402. @item bar_g, gamma2
  16403. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  16404. @code{[1, 7]}.
  16405. @item bar_t
  16406. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  16407. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  16408. @item timeclamp, tc
  16409. Specify the transform timeclamp. At low frequency, there is trade-off between
  16410. accuracy in time domain and frequency domain. If timeclamp is lower,
  16411. event in time domain is represented more accurately (such as fast bass drum),
  16412. otherwise event in frequency domain is represented more accurately
  16413. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  16414. @item attack
  16415. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  16416. limits future samples by applying asymmetric windowing in time domain, useful
  16417. when low latency is required. Accepted range is @code{[0, 1]}.
  16418. @item basefreq
  16419. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  16420. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  16421. @item endfreq
  16422. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  16423. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  16424. @item coeffclamp
  16425. This option is deprecated and ignored.
  16426. @item tlength
  16427. Specify the transform length in time domain. Use this option to control accuracy
  16428. trade-off between time domain and frequency domain at every frequency sample.
  16429. It can contain variables:
  16430. @table @option
  16431. @item frequency, freq, f
  16432. the frequency where it is evaluated
  16433. @item timeclamp, tc
  16434. the value of @var{timeclamp} option.
  16435. @end table
  16436. Default value is @code{384*tc/(384+tc*f)}.
  16437. @item count
  16438. Specify the transform count for every video frame. Default value is @code{6}.
  16439. Acceptable range is @code{[1, 30]}.
  16440. @item fcount
  16441. Specify the transform count for every single pixel. Default value is @code{0},
  16442. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  16443. @item fontfile
  16444. Specify font file for use with freetype to draw the axis. If not specified,
  16445. use embedded font. Note that drawing with font file or embedded font is not
  16446. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  16447. option instead.
  16448. @item font
  16449. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  16450. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  16451. @item fontcolor
  16452. Specify font color expression. This is arithmetic expression that should return
  16453. integer value 0xRRGGBB. It can contain variables:
  16454. @table @option
  16455. @item frequency, freq, f
  16456. the frequency where it is evaluated
  16457. @item timeclamp, tc
  16458. the value of @var{timeclamp} option
  16459. @end table
  16460. and functions:
  16461. @table @option
  16462. @item midi(f)
  16463. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  16464. @item r(x), g(x), b(x)
  16465. red, green, and blue value of intensity x.
  16466. @end table
  16467. Default value is @code{st(0, (midi(f)-59.5)/12);
  16468. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  16469. r(1-ld(1)) + b(ld(1))}.
  16470. @item axisfile
  16471. Specify image file to draw the axis. This option override @var{fontfile} and
  16472. @var{fontcolor} option.
  16473. @item axis, text
  16474. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  16475. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  16476. Default value is @code{1}.
  16477. @item csp
  16478. Set colorspace. The accepted values are:
  16479. @table @samp
  16480. @item unspecified
  16481. Unspecified (default)
  16482. @item bt709
  16483. BT.709
  16484. @item fcc
  16485. FCC
  16486. @item bt470bg
  16487. BT.470BG or BT.601-6 625
  16488. @item smpte170m
  16489. SMPTE-170M or BT.601-6 525
  16490. @item smpte240m
  16491. SMPTE-240M
  16492. @item bt2020ncl
  16493. BT.2020 with non-constant luminance
  16494. @end table
  16495. @item cscheme
  16496. Set spectrogram color scheme. This is list of floating point values with format
  16497. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  16498. The default is @code{1|0.5|0|0|0.5|1}.
  16499. @end table
  16500. @subsection Examples
  16501. @itemize
  16502. @item
  16503. Playing audio while showing the spectrum:
  16504. @example
  16505. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  16506. @end example
  16507. @item
  16508. Same as above, but with frame rate 30 fps:
  16509. @example
  16510. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  16511. @end example
  16512. @item
  16513. Playing at 1280x720:
  16514. @example
  16515. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  16516. @end example
  16517. @item
  16518. Disable sonogram display:
  16519. @example
  16520. sono_h=0
  16521. @end example
  16522. @item
  16523. A1 and its harmonics: A1, A2, (near)E3, A3:
  16524. @example
  16525. 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),
  16526. asplit[a][out1]; [a] showcqt [out0]'
  16527. @end example
  16528. @item
  16529. Same as above, but with more accuracy in frequency domain:
  16530. @example
  16531. 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),
  16532. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  16533. @end example
  16534. @item
  16535. Custom volume:
  16536. @example
  16537. bar_v=10:sono_v=bar_v*a_weighting(f)
  16538. @end example
  16539. @item
  16540. Custom gamma, now spectrum is linear to the amplitude.
  16541. @example
  16542. bar_g=2:sono_g=2
  16543. @end example
  16544. @item
  16545. Custom tlength equation:
  16546. @example
  16547. 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)))'
  16548. @end example
  16549. @item
  16550. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  16551. @example
  16552. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  16553. @end example
  16554. @item
  16555. Custom font using fontconfig:
  16556. @example
  16557. font='Courier New,Monospace,mono|bold'
  16558. @end example
  16559. @item
  16560. Custom frequency range with custom axis using image file:
  16561. @example
  16562. axisfile=myaxis.png:basefreq=40:endfreq=10000
  16563. @end example
  16564. @end itemize
  16565. @section showfreqs
  16566. Convert input audio to video output representing the audio power spectrum.
  16567. Audio amplitude is on Y-axis while frequency is on X-axis.
  16568. The filter accepts the following options:
  16569. @table @option
  16570. @item size, s
  16571. Specify size of video. For the syntax of this option, check the
  16572. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16573. Default is @code{1024x512}.
  16574. @item mode
  16575. Set display mode.
  16576. This set how each frequency bin will be represented.
  16577. It accepts the following values:
  16578. @table @samp
  16579. @item line
  16580. @item bar
  16581. @item dot
  16582. @end table
  16583. Default is @code{bar}.
  16584. @item ascale
  16585. Set amplitude scale.
  16586. It accepts the following values:
  16587. @table @samp
  16588. @item lin
  16589. Linear scale.
  16590. @item sqrt
  16591. Square root scale.
  16592. @item cbrt
  16593. Cubic root scale.
  16594. @item log
  16595. Logarithmic scale.
  16596. @end table
  16597. Default is @code{log}.
  16598. @item fscale
  16599. Set frequency scale.
  16600. It accepts the following values:
  16601. @table @samp
  16602. @item lin
  16603. Linear scale.
  16604. @item log
  16605. Logarithmic scale.
  16606. @item rlog
  16607. Reverse logarithmic scale.
  16608. @end table
  16609. Default is @code{lin}.
  16610. @item win_size
  16611. Set window size.
  16612. It accepts the following values:
  16613. @table @samp
  16614. @item w16
  16615. @item w32
  16616. @item w64
  16617. @item w128
  16618. @item w256
  16619. @item w512
  16620. @item w1024
  16621. @item w2048
  16622. @item w4096
  16623. @item w8192
  16624. @item w16384
  16625. @item w32768
  16626. @item w65536
  16627. @end table
  16628. Default is @code{w2048}
  16629. @item win_func
  16630. Set windowing function.
  16631. It accepts the following values:
  16632. @table @samp
  16633. @item rect
  16634. @item bartlett
  16635. @item hanning
  16636. @item hamming
  16637. @item blackman
  16638. @item welch
  16639. @item flattop
  16640. @item bharris
  16641. @item bnuttall
  16642. @item bhann
  16643. @item sine
  16644. @item nuttall
  16645. @item lanczos
  16646. @item gauss
  16647. @item tukey
  16648. @item dolph
  16649. @item cauchy
  16650. @item parzen
  16651. @item poisson
  16652. @item bohman
  16653. @end table
  16654. Default is @code{hanning}.
  16655. @item overlap
  16656. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  16657. which means optimal overlap for selected window function will be picked.
  16658. @item averaging
  16659. Set time averaging. Setting this to 0 will display current maximal peaks.
  16660. Default is @code{1}, which means time averaging is disabled.
  16661. @item colors
  16662. Specify list of colors separated by space or by '|' which will be used to
  16663. draw channel frequencies. Unrecognized or missing colors will be replaced
  16664. by white color.
  16665. @item cmode
  16666. Set channel display mode.
  16667. It accepts the following values:
  16668. @table @samp
  16669. @item combined
  16670. @item separate
  16671. @end table
  16672. Default is @code{combined}.
  16673. @item minamp
  16674. Set minimum amplitude used in @code{log} amplitude scaler.
  16675. @end table
  16676. @anchor{showspectrum}
  16677. @section showspectrum
  16678. Convert input audio to a video output, representing the audio frequency
  16679. spectrum.
  16680. The filter accepts the following options:
  16681. @table @option
  16682. @item size, s
  16683. Specify the video size for the output. For the syntax of this option, check the
  16684. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16685. Default value is @code{640x512}.
  16686. @item slide
  16687. Specify how the spectrum should slide along the window.
  16688. It accepts the following values:
  16689. @table @samp
  16690. @item replace
  16691. the samples start again on the left when they reach the right
  16692. @item scroll
  16693. the samples scroll from right to left
  16694. @item fullframe
  16695. frames are only produced when the samples reach the right
  16696. @item rscroll
  16697. the samples scroll from left to right
  16698. @end table
  16699. Default value is @code{replace}.
  16700. @item mode
  16701. Specify display mode.
  16702. It accepts the following values:
  16703. @table @samp
  16704. @item combined
  16705. all channels are displayed in the same row
  16706. @item separate
  16707. all channels are displayed in separate rows
  16708. @end table
  16709. Default value is @samp{combined}.
  16710. @item color
  16711. Specify display color mode.
  16712. It accepts the following values:
  16713. @table @samp
  16714. @item channel
  16715. each channel is displayed in a separate color
  16716. @item intensity
  16717. each channel is displayed using the same color scheme
  16718. @item rainbow
  16719. each channel is displayed using the rainbow color scheme
  16720. @item moreland
  16721. each channel is displayed using the moreland color scheme
  16722. @item nebulae
  16723. each channel is displayed using the nebulae color scheme
  16724. @item fire
  16725. each channel is displayed using the fire color scheme
  16726. @item fiery
  16727. each channel is displayed using the fiery color scheme
  16728. @item fruit
  16729. each channel is displayed using the fruit color scheme
  16730. @item cool
  16731. each channel is displayed using the cool color scheme
  16732. @item magma
  16733. each channel is displayed using the magma color scheme
  16734. @item green
  16735. each channel is displayed using the green color scheme
  16736. @item viridis
  16737. each channel is displayed using the viridis color scheme
  16738. @item plasma
  16739. each channel is displayed using the plasma color scheme
  16740. @item cividis
  16741. each channel is displayed using the cividis color scheme
  16742. @item terrain
  16743. each channel is displayed using the terrain color scheme
  16744. @end table
  16745. Default value is @samp{channel}.
  16746. @item scale
  16747. Specify scale used for calculating intensity color values.
  16748. It accepts the following values:
  16749. @table @samp
  16750. @item lin
  16751. linear
  16752. @item sqrt
  16753. square root, default
  16754. @item cbrt
  16755. cubic root
  16756. @item log
  16757. logarithmic
  16758. @item 4thrt
  16759. 4th root
  16760. @item 5thrt
  16761. 5th root
  16762. @end table
  16763. Default value is @samp{sqrt}.
  16764. @item saturation
  16765. Set saturation modifier for displayed colors. Negative values provide
  16766. alternative color scheme. @code{0} is no saturation at all.
  16767. Saturation must be in [-10.0, 10.0] range.
  16768. Default value is @code{1}.
  16769. @item win_func
  16770. Set window function.
  16771. It accepts the following values:
  16772. @table @samp
  16773. @item rect
  16774. @item bartlett
  16775. @item hann
  16776. @item hanning
  16777. @item hamming
  16778. @item blackman
  16779. @item welch
  16780. @item flattop
  16781. @item bharris
  16782. @item bnuttall
  16783. @item bhann
  16784. @item sine
  16785. @item nuttall
  16786. @item lanczos
  16787. @item gauss
  16788. @item tukey
  16789. @item dolph
  16790. @item cauchy
  16791. @item parzen
  16792. @item poisson
  16793. @item bohman
  16794. @end table
  16795. Default value is @code{hann}.
  16796. @item orientation
  16797. Set orientation of time vs frequency axis. Can be @code{vertical} or
  16798. @code{horizontal}. Default is @code{vertical}.
  16799. @item overlap
  16800. Set ratio of overlap window. Default value is @code{0}.
  16801. When value is @code{1} overlap is set to recommended size for specific
  16802. window function currently used.
  16803. @item gain
  16804. Set scale gain for calculating intensity color values.
  16805. Default value is @code{1}.
  16806. @item data
  16807. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  16808. @item rotation
  16809. Set color rotation, must be in [-1.0, 1.0] range.
  16810. Default value is @code{0}.
  16811. @item start
  16812. Set start frequency from which to display spectrogram. Default is @code{0}.
  16813. @item stop
  16814. Set stop frequency to which to display spectrogram. Default is @code{0}.
  16815. @item fps
  16816. Set upper frame rate limit. Default is @code{auto}, unlimited.
  16817. @item legend
  16818. Draw time and frequency axes and legends. Default is disabled.
  16819. @end table
  16820. The usage is very similar to the showwaves filter; see the examples in that
  16821. section.
  16822. @subsection Examples
  16823. @itemize
  16824. @item
  16825. Large window with logarithmic color scaling:
  16826. @example
  16827. showspectrum=s=1280x480:scale=log
  16828. @end example
  16829. @item
  16830. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  16831. @example
  16832. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  16833. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  16834. @end example
  16835. @end itemize
  16836. @section showspectrumpic
  16837. Convert input audio to a single video frame, representing the audio frequency
  16838. spectrum.
  16839. The filter accepts the following options:
  16840. @table @option
  16841. @item size, s
  16842. Specify the video size for the output. For the syntax of this option, check the
  16843. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16844. Default value is @code{4096x2048}.
  16845. @item mode
  16846. Specify display mode.
  16847. It accepts the following values:
  16848. @table @samp
  16849. @item combined
  16850. all channels are displayed in the same row
  16851. @item separate
  16852. all channels are displayed in separate rows
  16853. @end table
  16854. Default value is @samp{combined}.
  16855. @item color
  16856. Specify display color mode.
  16857. It accepts the following values:
  16858. @table @samp
  16859. @item channel
  16860. each channel is displayed in a separate color
  16861. @item intensity
  16862. each channel is displayed using the same color scheme
  16863. @item rainbow
  16864. each channel is displayed using the rainbow color scheme
  16865. @item moreland
  16866. each channel is displayed using the moreland color scheme
  16867. @item nebulae
  16868. each channel is displayed using the nebulae color scheme
  16869. @item fire
  16870. each channel is displayed using the fire color scheme
  16871. @item fiery
  16872. each channel is displayed using the fiery color scheme
  16873. @item fruit
  16874. each channel is displayed using the fruit color scheme
  16875. @item cool
  16876. each channel is displayed using the cool color scheme
  16877. @item magma
  16878. each channel is displayed using the magma color scheme
  16879. @item green
  16880. each channel is displayed using the green color scheme
  16881. @item viridis
  16882. each channel is displayed using the viridis color scheme
  16883. @item plasma
  16884. each channel is displayed using the plasma color scheme
  16885. @item cividis
  16886. each channel is displayed using the cividis color scheme
  16887. @item terrain
  16888. each channel is displayed using the terrain color scheme
  16889. @end table
  16890. Default value is @samp{intensity}.
  16891. @item scale
  16892. Specify scale used for calculating intensity color values.
  16893. It accepts the following values:
  16894. @table @samp
  16895. @item lin
  16896. linear
  16897. @item sqrt
  16898. square root, default
  16899. @item cbrt
  16900. cubic root
  16901. @item log
  16902. logarithmic
  16903. @item 4thrt
  16904. 4th root
  16905. @item 5thrt
  16906. 5th root
  16907. @end table
  16908. Default value is @samp{log}.
  16909. @item saturation
  16910. Set saturation modifier for displayed colors. Negative values provide
  16911. alternative color scheme. @code{0} is no saturation at all.
  16912. Saturation must be in [-10.0, 10.0] range.
  16913. Default value is @code{1}.
  16914. @item win_func
  16915. Set window function.
  16916. It accepts the following values:
  16917. @table @samp
  16918. @item rect
  16919. @item bartlett
  16920. @item hann
  16921. @item hanning
  16922. @item hamming
  16923. @item blackman
  16924. @item welch
  16925. @item flattop
  16926. @item bharris
  16927. @item bnuttall
  16928. @item bhann
  16929. @item sine
  16930. @item nuttall
  16931. @item lanczos
  16932. @item gauss
  16933. @item tukey
  16934. @item dolph
  16935. @item cauchy
  16936. @item parzen
  16937. @item poisson
  16938. @item bohman
  16939. @end table
  16940. Default value is @code{hann}.
  16941. @item orientation
  16942. Set orientation of time vs frequency axis. Can be @code{vertical} or
  16943. @code{horizontal}. Default is @code{vertical}.
  16944. @item gain
  16945. Set scale gain for calculating intensity color values.
  16946. Default value is @code{1}.
  16947. @item legend
  16948. Draw time and frequency axes and legends. Default is enabled.
  16949. @item rotation
  16950. Set color rotation, must be in [-1.0, 1.0] range.
  16951. Default value is @code{0}.
  16952. @item start
  16953. Set start frequency from which to display spectrogram. Default is @code{0}.
  16954. @item stop
  16955. Set stop frequency to which to display spectrogram. Default is @code{0}.
  16956. @end table
  16957. @subsection Examples
  16958. @itemize
  16959. @item
  16960. Extract an audio spectrogram of a whole audio track
  16961. in a 1024x1024 picture using @command{ffmpeg}:
  16962. @example
  16963. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  16964. @end example
  16965. @end itemize
  16966. @section showvolume
  16967. Convert input audio volume to a video output.
  16968. The filter accepts the following options:
  16969. @table @option
  16970. @item rate, r
  16971. Set video rate.
  16972. @item b
  16973. Set border width, allowed range is [0, 5]. Default is 1.
  16974. @item w
  16975. Set channel width, allowed range is [80, 8192]. Default is 400.
  16976. @item h
  16977. Set channel height, allowed range is [1, 900]. Default is 20.
  16978. @item f
  16979. Set fade, allowed range is [0, 1]. Default is 0.95.
  16980. @item c
  16981. Set volume color expression.
  16982. The expression can use the following variables:
  16983. @table @option
  16984. @item VOLUME
  16985. Current max volume of channel in dB.
  16986. @item PEAK
  16987. Current peak.
  16988. @item CHANNEL
  16989. Current channel number, starting from 0.
  16990. @end table
  16991. @item t
  16992. If set, displays channel names. Default is enabled.
  16993. @item v
  16994. If set, displays volume values. Default is enabled.
  16995. @item o
  16996. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  16997. default is @code{h}.
  16998. @item s
  16999. Set step size, allowed range is [0, 5]. Default is 0, which means
  17000. step is disabled.
  17001. @item p
  17002. Set background opacity, allowed range is [0, 1]. Default is 0.
  17003. @item m
  17004. Set metering mode, can be peak: @code{p} or rms: @code{r},
  17005. default is @code{p}.
  17006. @item ds
  17007. Set display scale, can be linear: @code{lin} or log: @code{log},
  17008. default is @code{lin}.
  17009. @item dm
  17010. In second.
  17011. If set to > 0., display a line for the max level
  17012. in the previous seconds.
  17013. default is disabled: @code{0.}
  17014. @item dmc
  17015. The color of the max line. Use when @code{dm} option is set to > 0.
  17016. default is: @code{orange}
  17017. @end table
  17018. @section showwaves
  17019. Convert input audio to a video output, representing the samples waves.
  17020. The filter accepts the following options:
  17021. @table @option
  17022. @item size, s
  17023. Specify the video size for the output. For the syntax of this option, check the
  17024. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17025. Default value is @code{600x240}.
  17026. @item mode
  17027. Set display mode.
  17028. Available values are:
  17029. @table @samp
  17030. @item point
  17031. Draw a point for each sample.
  17032. @item line
  17033. Draw a vertical line for each sample.
  17034. @item p2p
  17035. Draw a point for each sample and a line between them.
  17036. @item cline
  17037. Draw a centered vertical line for each sample.
  17038. @end table
  17039. Default value is @code{point}.
  17040. @item n
  17041. Set the number of samples which are printed on the same column. A
  17042. larger value will decrease the frame rate. Must be a positive
  17043. integer. This option can be set only if the value for @var{rate}
  17044. is not explicitly specified.
  17045. @item rate, r
  17046. Set the (approximate) output frame rate. This is done by setting the
  17047. option @var{n}. Default value is "25".
  17048. @item split_channels
  17049. Set if channels should be drawn separately or overlap. Default value is 0.
  17050. @item colors
  17051. Set colors separated by '|' which are going to be used for drawing of each channel.
  17052. @item scale
  17053. Set amplitude scale.
  17054. Available values are:
  17055. @table @samp
  17056. @item lin
  17057. Linear.
  17058. @item log
  17059. Logarithmic.
  17060. @item sqrt
  17061. Square root.
  17062. @item cbrt
  17063. Cubic root.
  17064. @end table
  17065. Default is linear.
  17066. @item draw
  17067. Set the draw mode. This is mostly useful to set for high @var{n}.
  17068. Available values are:
  17069. @table @samp
  17070. @item scale
  17071. Scale pixel values for each drawn sample.
  17072. @item full
  17073. Draw every sample directly.
  17074. @end table
  17075. Default value is @code{scale}.
  17076. @end table
  17077. @subsection Examples
  17078. @itemize
  17079. @item
  17080. Output the input file audio and the corresponding video representation
  17081. at the same time:
  17082. @example
  17083. amovie=a.mp3,asplit[out0],showwaves[out1]
  17084. @end example
  17085. @item
  17086. Create a synthetic signal and show it with showwaves, forcing a
  17087. frame rate of 30 frames per second:
  17088. @example
  17089. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  17090. @end example
  17091. @end itemize
  17092. @section showwavespic
  17093. Convert input audio to a single video frame, representing the samples waves.
  17094. The filter accepts the following options:
  17095. @table @option
  17096. @item size, s
  17097. Specify the video size for the output. For the syntax of this option, check the
  17098. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17099. Default value is @code{600x240}.
  17100. @item split_channels
  17101. Set if channels should be drawn separately or overlap. Default value is 0.
  17102. @item colors
  17103. Set colors separated by '|' which are going to be used for drawing of each channel.
  17104. @item scale
  17105. Set amplitude scale.
  17106. Available values are:
  17107. @table @samp
  17108. @item lin
  17109. Linear.
  17110. @item log
  17111. Logarithmic.
  17112. @item sqrt
  17113. Square root.
  17114. @item cbrt
  17115. Cubic root.
  17116. @end table
  17117. Default is linear.
  17118. @end table
  17119. @subsection Examples
  17120. @itemize
  17121. @item
  17122. Extract a channel split representation of the wave form of a whole audio track
  17123. in a 1024x800 picture using @command{ffmpeg}:
  17124. @example
  17125. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  17126. @end example
  17127. @end itemize
  17128. @section sidedata, asidedata
  17129. Delete frame side data, or select frames based on it.
  17130. This filter accepts the following options:
  17131. @table @option
  17132. @item mode
  17133. Set mode of operation of the filter.
  17134. Can be one of the following:
  17135. @table @samp
  17136. @item select
  17137. Select every frame with side data of @code{type}.
  17138. @item delete
  17139. Delete side data of @code{type}. If @code{type} is not set, delete all side
  17140. data in the frame.
  17141. @end table
  17142. @item type
  17143. Set side data type used with all modes. Must be set for @code{select} mode. For
  17144. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  17145. in @file{libavutil/frame.h}. For example, to choose
  17146. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  17147. @end table
  17148. @section spectrumsynth
  17149. Sythesize audio from 2 input video spectrums, first input stream represents
  17150. magnitude across time and second represents phase across time.
  17151. The filter will transform from frequency domain as displayed in videos back
  17152. to time domain as presented in audio output.
  17153. This filter is primarily created for reversing processed @ref{showspectrum}
  17154. filter outputs, but can synthesize sound from other spectrograms too.
  17155. But in such case results are going to be poor if the phase data is not
  17156. available, because in such cases phase data need to be recreated, usually
  17157. it's just recreated from random noise.
  17158. For best results use gray only output (@code{channel} color mode in
  17159. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  17160. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  17161. @code{data} option. Inputs videos should generally use @code{fullframe}
  17162. slide mode as that saves resources needed for decoding video.
  17163. The filter accepts the following options:
  17164. @table @option
  17165. @item sample_rate
  17166. Specify sample rate of output audio, the sample rate of audio from which
  17167. spectrum was generated may differ.
  17168. @item channels
  17169. Set number of channels represented in input video spectrums.
  17170. @item scale
  17171. Set scale which was used when generating magnitude input spectrum.
  17172. Can be @code{lin} or @code{log}. Default is @code{log}.
  17173. @item slide
  17174. Set slide which was used when generating inputs spectrums.
  17175. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  17176. Default is @code{fullframe}.
  17177. @item win_func
  17178. Set window function used for resynthesis.
  17179. @item overlap
  17180. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17181. which means optimal overlap for selected window function will be picked.
  17182. @item orientation
  17183. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  17184. Default is @code{vertical}.
  17185. @end table
  17186. @subsection Examples
  17187. @itemize
  17188. @item
  17189. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  17190. then resynthesize videos back to audio with spectrumsynth:
  17191. @example
  17192. 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
  17193. 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
  17194. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  17195. @end example
  17196. @end itemize
  17197. @section split, asplit
  17198. Split input into several identical outputs.
  17199. @code{asplit} works with audio input, @code{split} with video.
  17200. The filter accepts a single parameter which specifies the number of outputs. If
  17201. unspecified, it defaults to 2.
  17202. @subsection Examples
  17203. @itemize
  17204. @item
  17205. Create two separate outputs from the same input:
  17206. @example
  17207. [in] split [out0][out1]
  17208. @end example
  17209. @item
  17210. To create 3 or more outputs, you need to specify the number of
  17211. outputs, like in:
  17212. @example
  17213. [in] asplit=3 [out0][out1][out2]
  17214. @end example
  17215. @item
  17216. Create two separate outputs from the same input, one cropped and
  17217. one padded:
  17218. @example
  17219. [in] split [splitout1][splitout2];
  17220. [splitout1] crop=100:100:0:0 [cropout];
  17221. [splitout2] pad=200:200:100:100 [padout];
  17222. @end example
  17223. @item
  17224. Create 5 copies of the input audio with @command{ffmpeg}:
  17225. @example
  17226. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  17227. @end example
  17228. @end itemize
  17229. @section zmq, azmq
  17230. Receive commands sent through a libzmq client, and forward them to
  17231. filters in the filtergraph.
  17232. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  17233. must be inserted between two video filters, @code{azmq} between two
  17234. audio filters. Both are capable to send messages to any filter type.
  17235. To enable these filters you need to install the libzmq library and
  17236. headers and configure FFmpeg with @code{--enable-libzmq}.
  17237. For more information about libzmq see:
  17238. @url{http://www.zeromq.org/}
  17239. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  17240. receives messages sent through a network interface defined by the
  17241. @option{bind_address} (or the abbreviation "@option{b}") option.
  17242. Default value of this option is @file{tcp://localhost:5555}. You may
  17243. want to alter this value to your needs, but do not forget to escape any
  17244. ':' signs (see @ref{filtergraph escaping}).
  17245. The received message must be in the form:
  17246. @example
  17247. @var{TARGET} @var{COMMAND} [@var{ARG}]
  17248. @end example
  17249. @var{TARGET} specifies the target of the command, usually the name of
  17250. the filter class or a specific filter instance name. The default
  17251. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  17252. but you can override this by using the @samp{filter_name@@id} syntax
  17253. (see @ref{Filtergraph syntax}).
  17254. @var{COMMAND} specifies the name of the command for the target filter.
  17255. @var{ARG} is optional and specifies the optional argument list for the
  17256. given @var{COMMAND}.
  17257. Upon reception, the message is processed and the corresponding command
  17258. is injected into the filtergraph. Depending on the result, the filter
  17259. will send a reply to the client, adopting the format:
  17260. @example
  17261. @var{ERROR_CODE} @var{ERROR_REASON}
  17262. @var{MESSAGE}
  17263. @end example
  17264. @var{MESSAGE} is optional.
  17265. @subsection Examples
  17266. Look at @file{tools/zmqsend} for an example of a zmq client which can
  17267. be used to send commands processed by these filters.
  17268. Consider the following filtergraph generated by @command{ffplay}.
  17269. In this example the last overlay filter has an instance name. All other
  17270. filters will have default instance names.
  17271. @example
  17272. ffplay -dumpgraph 1 -f lavfi "
  17273. color=s=100x100:c=red [l];
  17274. color=s=100x100:c=blue [r];
  17275. nullsrc=s=200x100, zmq [bg];
  17276. [bg][l] overlay [bg+l];
  17277. [bg+l][r] overlay@@my=x=100 "
  17278. @end example
  17279. To change the color of the left side of the video, the following
  17280. command can be used:
  17281. @example
  17282. echo Parsed_color_0 c yellow | tools/zmqsend
  17283. @end example
  17284. To change the right side:
  17285. @example
  17286. echo Parsed_color_1 c pink | tools/zmqsend
  17287. @end example
  17288. To change the position of the right side:
  17289. @example
  17290. echo overlay@@my x 150 | tools/zmqsend
  17291. @end example
  17292. @c man end MULTIMEDIA FILTERS
  17293. @chapter Multimedia Sources
  17294. @c man begin MULTIMEDIA SOURCES
  17295. Below is a description of the currently available multimedia sources.
  17296. @section amovie
  17297. This is the same as @ref{movie} source, except it selects an audio
  17298. stream by default.
  17299. @anchor{movie}
  17300. @section movie
  17301. Read audio and/or video stream(s) from a movie container.
  17302. It accepts the following parameters:
  17303. @table @option
  17304. @item filename
  17305. The name of the resource to read (not necessarily a file; it can also be a
  17306. device or a stream accessed through some protocol).
  17307. @item format_name, f
  17308. Specifies the format assumed for the movie to read, and can be either
  17309. the name of a container or an input device. If not specified, the
  17310. format is guessed from @var{movie_name} or by probing.
  17311. @item seek_point, sp
  17312. Specifies the seek point in seconds. The frames will be output
  17313. starting from this seek point. The parameter is evaluated with
  17314. @code{av_strtod}, so the numerical value may be suffixed by an IS
  17315. postfix. The default value is "0".
  17316. @item streams, s
  17317. Specifies the streams to read. Several streams can be specified,
  17318. separated by "+". The source will then have as many outputs, in the
  17319. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  17320. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  17321. respectively the default (best suited) video and audio stream. Default
  17322. is "dv", or "da" if the filter is called as "amovie".
  17323. @item stream_index, si
  17324. Specifies the index of the video stream to read. If the value is -1,
  17325. the most suitable video stream will be automatically selected. The default
  17326. value is "-1". Deprecated. If the filter is called "amovie", it will select
  17327. audio instead of video.
  17328. @item loop
  17329. Specifies how many times to read the stream in sequence.
  17330. If the value is 0, the stream will be looped infinitely.
  17331. Default value is "1".
  17332. Note that when the movie is looped the source timestamps are not
  17333. changed, so it will generate non monotonically increasing timestamps.
  17334. @item discontinuity
  17335. Specifies the time difference between frames above which the point is
  17336. considered a timestamp discontinuity which is removed by adjusting the later
  17337. timestamps.
  17338. @end table
  17339. It allows overlaying a second video on top of the main input of
  17340. a filtergraph, as shown in this graph:
  17341. @example
  17342. input -----------> deltapts0 --> overlay --> output
  17343. ^
  17344. |
  17345. movie --> scale--> deltapts1 -------+
  17346. @end example
  17347. @subsection Examples
  17348. @itemize
  17349. @item
  17350. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  17351. on top of the input labelled "in":
  17352. @example
  17353. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17354. [in] setpts=PTS-STARTPTS [main];
  17355. [main][over] overlay=16:16 [out]
  17356. @end example
  17357. @item
  17358. Read from a video4linux2 device, and overlay it on top of the input
  17359. labelled "in":
  17360. @example
  17361. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17362. [in] setpts=PTS-STARTPTS [main];
  17363. [main][over] overlay=16:16 [out]
  17364. @end example
  17365. @item
  17366. Read the first video stream and the audio stream with id 0x81 from
  17367. dvd.vob; the video is connected to the pad named "video" and the audio is
  17368. connected to the pad named "audio":
  17369. @example
  17370. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  17371. @end example
  17372. @end itemize
  17373. @subsection Commands
  17374. Both movie and amovie support the following commands:
  17375. @table @option
  17376. @item seek
  17377. Perform seek using "av_seek_frame".
  17378. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  17379. @itemize
  17380. @item
  17381. @var{stream_index}: If stream_index is -1, a default
  17382. stream is selected, and @var{timestamp} is automatically converted
  17383. from AV_TIME_BASE units to the stream specific time_base.
  17384. @item
  17385. @var{timestamp}: Timestamp in AVStream.time_base units
  17386. or, if no stream is specified, in AV_TIME_BASE units.
  17387. @item
  17388. @var{flags}: Flags which select direction and seeking mode.
  17389. @end itemize
  17390. @item get_duration
  17391. Get movie duration in AV_TIME_BASE units.
  17392. @end table
  17393. @c man end MULTIMEDIA SOURCES