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.

25471 lines
678KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{commands}
  252. @chapter Changing options at runtime with a command
  253. Some options can be changed during the operation of the filter using
  254. a command. These options are marked 'T' on the output of
  255. @command{ffmpeg} @option{-h filter=<name of filter>}.
  256. The name of the command is the name of the option and the argument is
  257. the new value.
  258. @anchor{framesync}
  259. @chapter Options for filters with several inputs (framesync)
  260. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  261. Some filters with several inputs support a common set of options.
  262. These options can only be set by name, not with the short notation.
  263. @table @option
  264. @item eof_action
  265. The action to take when EOF is encountered on the secondary input; it accepts
  266. one of the following values:
  267. @table @option
  268. @item repeat
  269. Repeat the last frame (the default).
  270. @item endall
  271. End both streams.
  272. @item pass
  273. Pass the main input through.
  274. @end table
  275. @item shortest
  276. If set to 1, force the output to terminate when the shortest input
  277. terminates. Default value is 0.
  278. @item repeatlast
  279. If set to 1, force the filter to extend the last frame of secondary streams
  280. until the end of the primary stream. A value of 0 disables this behavior.
  281. Default value is 1.
  282. @end table
  283. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  284. @chapter Audio Filters
  285. @c man begin AUDIO FILTERS
  286. When you configure your FFmpeg build, you can disable any of the
  287. existing filters using @code{--disable-filters}.
  288. The configure output will show the audio filters included in your
  289. build.
  290. Below is a description of the currently available audio filters.
  291. @section acompressor
  292. A compressor is mainly used to reduce the dynamic range of a signal.
  293. Especially modern music is mostly compressed at a high ratio to
  294. improve the overall loudness. It's done to get the highest attention
  295. of a listener, "fatten" the sound and bring more "power" to the track.
  296. If a signal is compressed too much it may sound dull or "dead"
  297. afterwards or it may start to "pump" (which could be a powerful effect
  298. but can also destroy a track completely).
  299. The right compression is the key to reach a professional sound and is
  300. the high art of mixing and mastering. Because of its complex settings
  301. it may take a long time to get the right feeling for this kind of effect.
  302. Compression is done by detecting the volume above a chosen level
  303. @code{threshold} and dividing it by the factor set with @code{ratio}.
  304. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  305. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  306. the signal would cause distortion of the waveform the reduction can be
  307. levelled over the time. This is done by setting "Attack" and "Release".
  308. @code{attack} determines how long the signal has to rise above the threshold
  309. before any reduction will occur and @code{release} sets the time the signal
  310. has to fall below the threshold to reduce the reduction again. Shorter signals
  311. than the chosen attack time will be left untouched.
  312. The overall reduction of the signal can be made up afterwards with the
  313. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  314. raising the makeup to this level results in a signal twice as loud than the
  315. source. To gain a softer entry in the compression the @code{knee} flattens the
  316. hard edge at the threshold in the range of the chosen decibels.
  317. The filter accepts the following options:
  318. @table @option
  319. @item level_in
  320. Set input gain. Default is 1. Range is between 0.015625 and 64.
  321. @item mode
  322. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  323. Default is @code{downward}.
  324. @item threshold
  325. If a signal of stream rises above this level it will affect the gain
  326. reduction.
  327. By default it is 0.125. Range is between 0.00097563 and 1.
  328. @item ratio
  329. Set a ratio by which the signal is reduced. 1:2 means that if the level
  330. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  331. Default is 2. Range is between 1 and 20.
  332. @item attack
  333. Amount of milliseconds the signal has to rise above the threshold before gain
  334. reduction starts. Default is 20. Range is between 0.01 and 2000.
  335. @item release
  336. Amount of milliseconds the signal has to fall below the threshold before
  337. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  338. @item makeup
  339. Set the amount by how much signal will be amplified after processing.
  340. Default is 1. Range is from 1 to 64.
  341. @item knee
  342. Curve the sharp knee around the threshold to enter gain reduction more softly.
  343. Default is 2.82843. Range is between 1 and 8.
  344. @item link
  345. Choose if the @code{average} level between all channels of input stream
  346. or the louder(@code{maximum}) channel of input stream affects the
  347. reduction. Default is @code{average}.
  348. @item detection
  349. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  350. of @code{rms}. Default is @code{rms} which is mostly smoother.
  351. @item mix
  352. How much to use compressed signal in output. Default is 1.
  353. Range is between 0 and 1.
  354. @end table
  355. @subsection Commands
  356. This filter supports the all above options as @ref{commands}.
  357. @section acontrast
  358. Simple audio dynamic range compression/expansion filter.
  359. The filter accepts the following options:
  360. @table @option
  361. @item contrast
  362. Set contrast. Default is 33. Allowed range is between 0 and 100.
  363. @end table
  364. @section acopy
  365. Copy the input audio source unchanged to the output. This is mainly useful for
  366. testing purposes.
  367. @section acrossfade
  368. Apply cross fade from one input audio stream to another input audio stream.
  369. The cross fade is applied for specified duration near the end of first stream.
  370. The filter accepts the following options:
  371. @table @option
  372. @item nb_samples, ns
  373. Specify the number of samples for which the cross fade effect has to last.
  374. At the end of the cross fade effect the first input audio will be completely
  375. silent. Default is 44100.
  376. @item duration, d
  377. Specify the duration of the cross fade effect. See
  378. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  379. for the accepted syntax.
  380. By default the duration is determined by @var{nb_samples}.
  381. If set this option is used instead of @var{nb_samples}.
  382. @item overlap, o
  383. Should first stream end overlap with second stream start. Default is enabled.
  384. @item curve1
  385. Set curve for cross fade transition for first stream.
  386. @item curve2
  387. Set curve for cross fade transition for second stream.
  388. For description of available curve types see @ref{afade} filter description.
  389. @end table
  390. @subsection Examples
  391. @itemize
  392. @item
  393. Cross fade from one input to another:
  394. @example
  395. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  396. @end example
  397. @item
  398. Cross fade from one input to another but without overlapping:
  399. @example
  400. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  401. @end example
  402. @end itemize
  403. @section acrossover
  404. Split audio stream into several bands.
  405. This filter splits audio stream into two or more frequency ranges.
  406. Summing all streams back will give flat output.
  407. The filter accepts the following options:
  408. @table @option
  409. @item split
  410. Set split frequencies. Those must be positive and increasing.
  411. @item order
  412. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  413. Default is @var{4th}.
  414. @end table
  415. @section acrusher
  416. Reduce audio bit resolution.
  417. This filter is bit crusher with enhanced functionality. A bit crusher
  418. is used to audibly reduce number of bits an audio signal is sampled
  419. with. This doesn't change the bit depth at all, it just produces the
  420. effect. Material reduced in bit depth sounds more harsh and "digital".
  421. This filter is able to even round to continuous values instead of discrete
  422. bit depths.
  423. Additionally it has a D/C offset which results in different crushing of
  424. the lower and the upper half of the signal.
  425. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  426. Another feature of this filter is the logarithmic mode.
  427. This setting switches from linear distances between bits to logarithmic ones.
  428. The result is a much more "natural" sounding crusher which doesn't gate low
  429. signals for example. The human ear has a logarithmic perception,
  430. so this kind of crushing is much more pleasant.
  431. Logarithmic crushing is also able to get anti-aliased.
  432. The filter accepts the following options:
  433. @table @option
  434. @item level_in
  435. Set level in.
  436. @item level_out
  437. Set level out.
  438. @item bits
  439. Set bit reduction.
  440. @item mix
  441. Set mixing amount.
  442. @item mode
  443. Can be linear: @code{lin} or logarithmic: @code{log}.
  444. @item dc
  445. Set DC.
  446. @item aa
  447. Set anti-aliasing.
  448. @item samples
  449. Set sample reduction.
  450. @item lfo
  451. Enable LFO. By default disabled.
  452. @item lforange
  453. Set LFO range.
  454. @item lforate
  455. Set LFO rate.
  456. @end table
  457. @section acue
  458. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  459. filter.
  460. @section adeclick
  461. Remove impulsive noise from input audio.
  462. Samples detected as impulsive noise are replaced by interpolated samples using
  463. autoregressive modelling.
  464. @table @option
  465. @item w
  466. Set window size, in milliseconds. Allowed range is from @code{10} to
  467. @code{100}. Default value is @code{55} milliseconds.
  468. This sets size of window which will be processed at once.
  469. @item o
  470. Set window overlap, in percentage of window size. Allowed range is from
  471. @code{50} to @code{95}. Default value is @code{75} percent.
  472. Setting this to a very high value increases impulsive noise removal but makes
  473. whole process much slower.
  474. @item a
  475. Set autoregression order, in percentage of window size. Allowed range is from
  476. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  477. controls quality of interpolated samples using neighbour good samples.
  478. @item t
  479. Set threshold value. Allowed range is from @code{1} to @code{100}.
  480. Default value is @code{2}.
  481. This controls the strength of impulsive noise which is going to be removed.
  482. The lower value, the more samples will be detected as impulsive noise.
  483. @item b
  484. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  485. @code{10}. Default value is @code{2}.
  486. If any two samples detected as noise are spaced less than this value then any
  487. sample between those two samples will be also detected as noise.
  488. @item m
  489. Set overlap method.
  490. It accepts the following values:
  491. @table @option
  492. @item a
  493. Select overlap-add method. Even not interpolated samples are slightly
  494. changed with this method.
  495. @item s
  496. Select overlap-save method. Not interpolated samples remain unchanged.
  497. @end table
  498. Default value is @code{a}.
  499. @end table
  500. @section adeclip
  501. Remove clipped samples from input audio.
  502. Samples detected as clipped are replaced by interpolated samples using
  503. autoregressive modelling.
  504. @table @option
  505. @item w
  506. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  507. Default value is @code{55} milliseconds.
  508. This sets size of window which will be processed at once.
  509. @item o
  510. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  511. to @code{95}. Default value is @code{75} percent.
  512. @item a
  513. Set autoregression order, in percentage of window size. Allowed range is from
  514. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  515. quality of interpolated samples using neighbour good samples.
  516. @item t
  517. Set threshold value. Allowed range is from @code{1} to @code{100}.
  518. Default value is @code{10}. Higher values make clip detection less aggressive.
  519. @item n
  520. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  521. Default value is @code{1000}. Higher values make clip detection less aggressive.
  522. @item m
  523. Set overlap method.
  524. It accepts the following values:
  525. @table @option
  526. @item a
  527. Select overlap-add method. Even not interpolated samples are slightly changed
  528. with this method.
  529. @item s
  530. Select overlap-save method. Not interpolated samples remain unchanged.
  531. @end table
  532. Default value is @code{a}.
  533. @end table
  534. @section adelay
  535. Delay one or more audio channels.
  536. Samples in delayed channel are filled with silence.
  537. The filter accepts the following option:
  538. @table @option
  539. @item delays
  540. Set list of delays in milliseconds for each channel separated by '|'.
  541. Unused delays will be silently ignored. If number of given delays is
  542. smaller than number of channels all remaining channels will not be delayed.
  543. If you want to delay exact number of samples, append 'S' to number.
  544. If you want instead to delay in seconds, append 's' to number.
  545. @item all
  546. Use last set delay for all remaining channels. By default is disabled.
  547. This option if enabled changes how option @code{delays} is interpreted.
  548. @end table
  549. @subsection Examples
  550. @itemize
  551. @item
  552. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  553. the second channel (and any other channels that may be present) unchanged.
  554. @example
  555. adelay=1500|0|500
  556. @end example
  557. @item
  558. Delay second channel by 500 samples, the third channel by 700 samples and leave
  559. the first channel (and any other channels that may be present) unchanged.
  560. @example
  561. adelay=0|500S|700S
  562. @end example
  563. @item
  564. Delay all channels by same number of samples:
  565. @example
  566. adelay=delays=64S:all=1
  567. @end example
  568. @end itemize
  569. @section aderivative, aintegral
  570. Compute derivative/integral of audio stream.
  571. Applying both filters one after another produces original audio.
  572. @section aecho
  573. Apply echoing to the input audio.
  574. Echoes are reflected sound and can occur naturally amongst mountains
  575. (and sometimes large buildings) when talking or shouting; digital echo
  576. effects emulate this behaviour and are often used to help fill out the
  577. sound of a single instrument or vocal. The time difference between the
  578. original signal and the reflection is the @code{delay}, and the
  579. loudness of the reflected signal is the @code{decay}.
  580. Multiple echoes can have different delays and decays.
  581. A description of the accepted parameters follows.
  582. @table @option
  583. @item in_gain
  584. Set input gain of reflected signal. Default is @code{0.6}.
  585. @item out_gain
  586. Set output gain of reflected signal. Default is @code{0.3}.
  587. @item delays
  588. Set list of time intervals in milliseconds between original signal and reflections
  589. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  590. Default is @code{1000}.
  591. @item decays
  592. Set list of loudness of reflected signals separated by '|'.
  593. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  594. Default is @code{0.5}.
  595. @end table
  596. @subsection Examples
  597. @itemize
  598. @item
  599. Make it sound as if there are twice as many instruments as are actually playing:
  600. @example
  601. aecho=0.8:0.88:60:0.4
  602. @end example
  603. @item
  604. If delay is very short, then it sounds like a (metallic) robot playing music:
  605. @example
  606. aecho=0.8:0.88:6:0.4
  607. @end example
  608. @item
  609. A longer delay will sound like an open air concert in the mountains:
  610. @example
  611. aecho=0.8:0.9:1000:0.3
  612. @end example
  613. @item
  614. Same as above but with one more mountain:
  615. @example
  616. aecho=0.8:0.9:1000|1800:0.3|0.25
  617. @end example
  618. @end itemize
  619. @section aemphasis
  620. Audio emphasis filter creates or restores material directly taken from LPs or
  621. emphased CDs with different filter curves. E.g. to store music on vinyl the
  622. signal has to be altered by a filter first to even out the disadvantages of
  623. this recording medium.
  624. Once the material is played back the inverse filter has to be applied to
  625. restore the distortion of the frequency response.
  626. The filter accepts the following options:
  627. @table @option
  628. @item level_in
  629. Set input gain.
  630. @item level_out
  631. Set output gain.
  632. @item mode
  633. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  634. use @code{production} mode. Default is @code{reproduction} mode.
  635. @item type
  636. Set filter type. Selects medium. Can be one of the following:
  637. @table @option
  638. @item col
  639. select Columbia.
  640. @item emi
  641. select EMI.
  642. @item bsi
  643. select BSI (78RPM).
  644. @item riaa
  645. select RIAA.
  646. @item cd
  647. select Compact Disc (CD).
  648. @item 50fm
  649. select 50µs (FM).
  650. @item 75fm
  651. select 75µs (FM).
  652. @item 50kf
  653. select 50µs (FM-KF).
  654. @item 75kf
  655. select 75µs (FM-KF).
  656. @end table
  657. @end table
  658. @section aeval
  659. Modify an audio signal according to the specified expressions.
  660. This filter accepts one or more expressions (one for each channel),
  661. which are evaluated and used to modify a corresponding audio signal.
  662. It accepts the following parameters:
  663. @table @option
  664. @item exprs
  665. Set the '|'-separated expressions list for each separate channel. If
  666. the number of input channels is greater than the number of
  667. expressions, the last specified expression is used for the remaining
  668. output channels.
  669. @item channel_layout, c
  670. Set output channel layout. If not specified, the channel layout is
  671. specified by the number of expressions. If set to @samp{same}, it will
  672. use by default the same input channel layout.
  673. @end table
  674. Each expression in @var{exprs} can contain the following constants and functions:
  675. @table @option
  676. @item ch
  677. channel number of the current expression
  678. @item n
  679. number of the evaluated sample, starting from 0
  680. @item s
  681. sample rate
  682. @item t
  683. time of the evaluated sample expressed in seconds
  684. @item nb_in_channels
  685. @item nb_out_channels
  686. input and output number of channels
  687. @item val(CH)
  688. the value of input channel with number @var{CH}
  689. @end table
  690. Note: this filter is slow. For faster processing you should use a
  691. dedicated filter.
  692. @subsection Examples
  693. @itemize
  694. @item
  695. Half volume:
  696. @example
  697. aeval=val(ch)/2:c=same
  698. @end example
  699. @item
  700. Invert phase of the second channel:
  701. @example
  702. aeval=val(0)|-val(1)
  703. @end example
  704. @end itemize
  705. @anchor{afade}
  706. @section afade
  707. Apply fade-in/out effect to input audio.
  708. A description of the accepted parameters follows.
  709. @table @option
  710. @item type, t
  711. Specify the effect type, can be either @code{in} for fade-in, or
  712. @code{out} for a fade-out effect. Default is @code{in}.
  713. @item start_sample, ss
  714. Specify the number of the start sample for starting to apply the fade
  715. effect. Default is 0.
  716. @item nb_samples, ns
  717. Specify the number of samples for which the fade effect has to last. At
  718. the end of the fade-in effect the output audio will have the same
  719. volume as the input audio, at the end of the fade-out transition
  720. the output audio will be silence. Default is 44100.
  721. @item start_time, st
  722. Specify the start time of the fade effect. Default is 0.
  723. The value must be specified as a time duration; see
  724. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  725. for the accepted syntax.
  726. If set this option is used instead of @var{start_sample}.
  727. @item duration, d
  728. Specify the duration of the fade effect. See
  729. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  730. for the accepted syntax.
  731. At the end of the fade-in effect the output audio will have the same
  732. volume as the input audio, at the end of the fade-out transition
  733. the output audio will be silence.
  734. By default the duration is determined by @var{nb_samples}.
  735. If set this option is used instead of @var{nb_samples}.
  736. @item curve
  737. Set curve for fade transition.
  738. It accepts the following values:
  739. @table @option
  740. @item tri
  741. select triangular, linear slope (default)
  742. @item qsin
  743. select quarter of sine wave
  744. @item hsin
  745. select half of sine wave
  746. @item esin
  747. select exponential sine wave
  748. @item log
  749. select logarithmic
  750. @item ipar
  751. select inverted parabola
  752. @item qua
  753. select quadratic
  754. @item cub
  755. select cubic
  756. @item squ
  757. select square root
  758. @item cbr
  759. select cubic root
  760. @item par
  761. select parabola
  762. @item exp
  763. select exponential
  764. @item iqsin
  765. select inverted quarter of sine wave
  766. @item ihsin
  767. select inverted half of sine wave
  768. @item dese
  769. select double-exponential seat
  770. @item desi
  771. select double-exponential sigmoid
  772. @item losi
  773. select logistic sigmoid
  774. @item nofade
  775. no fade applied
  776. @end table
  777. @end table
  778. @subsection Examples
  779. @itemize
  780. @item
  781. Fade in first 15 seconds of audio:
  782. @example
  783. afade=t=in:ss=0:d=15
  784. @end example
  785. @item
  786. Fade out last 25 seconds of a 900 seconds audio:
  787. @example
  788. afade=t=out:st=875:d=25
  789. @end example
  790. @end itemize
  791. @section afftdn
  792. Denoise audio samples with FFT.
  793. A description of the accepted parameters follows.
  794. @table @option
  795. @item nr
  796. Set the noise reduction in dB, allowed range is 0.01 to 97.
  797. Default value is 12 dB.
  798. @item nf
  799. Set the noise floor in dB, allowed range is -80 to -20.
  800. Default value is -50 dB.
  801. @item nt
  802. Set the noise type.
  803. It accepts the following values:
  804. @table @option
  805. @item w
  806. Select white noise.
  807. @item v
  808. Select vinyl noise.
  809. @item s
  810. Select shellac noise.
  811. @item c
  812. Select custom noise, defined in @code{bn} option.
  813. Default value is white noise.
  814. @end table
  815. @item bn
  816. Set custom band noise for every one of 15 bands.
  817. Bands are separated by ' ' or '|'.
  818. @item rf
  819. Set the residual floor in dB, allowed range is -80 to -20.
  820. Default value is -38 dB.
  821. @item tn
  822. Enable noise tracking. By default is disabled.
  823. With this enabled, noise floor is automatically adjusted.
  824. @item tr
  825. Enable residual tracking. By default is disabled.
  826. @item om
  827. Set the output mode.
  828. It accepts the following values:
  829. @table @option
  830. @item i
  831. Pass input unchanged.
  832. @item o
  833. Pass noise filtered out.
  834. @item n
  835. Pass only noise.
  836. Default value is @var{o}.
  837. @end table
  838. @end table
  839. @subsection Commands
  840. This filter supports the following commands:
  841. @table @option
  842. @item sample_noise, sn
  843. Start or stop measuring noise profile.
  844. Syntax for the command is : "start" or "stop" string.
  845. After measuring noise profile is stopped it will be
  846. automatically applied in filtering.
  847. @item noise_reduction, nr
  848. Change noise reduction. Argument is single float number.
  849. Syntax for the command is : "@var{noise_reduction}"
  850. @item noise_floor, nf
  851. Change noise floor. Argument is single float number.
  852. Syntax for the command is : "@var{noise_floor}"
  853. @item output_mode, om
  854. Change output mode operation.
  855. Syntax for the command is : "i", "o" or "n" string.
  856. @end table
  857. @section afftfilt
  858. Apply arbitrary expressions to samples in frequency domain.
  859. @table @option
  860. @item real
  861. Set frequency domain real expression for each separate channel separated
  862. by '|'. Default is "re".
  863. If the number of input channels is greater than the number of
  864. expressions, the last specified expression is used for the remaining
  865. output channels.
  866. @item imag
  867. Set frequency domain imaginary expression for each separate channel
  868. separated by '|'. Default is "im".
  869. Each expression in @var{real} and @var{imag} can contain the following
  870. constants and functions:
  871. @table @option
  872. @item sr
  873. sample rate
  874. @item b
  875. current frequency bin number
  876. @item nb
  877. number of available bins
  878. @item ch
  879. channel number of the current expression
  880. @item chs
  881. number of channels
  882. @item pts
  883. current frame pts
  884. @item re
  885. current real part of frequency bin of current channel
  886. @item im
  887. current imaginary part of frequency bin of current channel
  888. @item real(b, ch)
  889. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  890. @item imag(b, ch)
  891. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  892. @end table
  893. @item win_size
  894. Set window size. Allowed range is from 16 to 131072.
  895. Default is @code{4096}
  896. @item win_func
  897. Set window function. Default is @code{hann}.
  898. @item overlap
  899. Set window overlap. If set to 1, the recommended overlap for selected
  900. window function will be picked. Default is @code{0.75}.
  901. @end table
  902. @subsection Examples
  903. @itemize
  904. @item
  905. Leave almost only low frequencies in audio:
  906. @example
  907. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  908. @end example
  909. @item
  910. Apply robotize effect:
  911. @example
  912. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  913. @end example
  914. @item
  915. Apply whisper effect:
  916. @example
  917. afftfilt="real='hypot(re,im)*cos((random(0)*2-1)*2*3.14)':imag='hypot(re,im)*sin((random(1)*2-1)*2*3.14)':win_size=128:overlap=0.8"
  918. @end example
  919. @end itemize
  920. @anchor{afir}
  921. @section afir
  922. Apply an arbitrary Finite Impulse Response filter.
  923. This filter is designed for applying long FIR filters,
  924. up to 60 seconds long.
  925. It can be used as component for digital crossover filters,
  926. room equalization, cross talk cancellation, wavefield synthesis,
  927. auralization, ambiophonics, ambisonics and spatialization.
  928. This filter uses the streams higher than first one as FIR coefficients.
  929. If the non-first stream holds a single channel, it will be used
  930. for all input channels in the first stream, otherwise
  931. the number of channels in the non-first stream must be same as
  932. the number of channels in the first stream.
  933. It accepts the following parameters:
  934. @table @option
  935. @item dry
  936. Set dry gain. This sets input gain.
  937. @item wet
  938. Set wet gain. This sets final output gain.
  939. @item length
  940. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  941. @item gtype
  942. Enable applying gain measured from power of IR.
  943. Set which approach to use for auto gain measurement.
  944. @table @option
  945. @item none
  946. Do not apply any gain.
  947. @item peak
  948. select peak gain, very conservative approach. This is default value.
  949. @item dc
  950. select DC gain, limited application.
  951. @item gn
  952. select gain to noise approach, this is most popular one.
  953. @end table
  954. @item irgain
  955. Set gain to be applied to IR coefficients before filtering.
  956. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  957. @item irfmt
  958. Set format of IR stream. Can be @code{mono} or @code{input}.
  959. Default is @code{input}.
  960. @item maxir
  961. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  962. Allowed range is 0.1 to 60 seconds.
  963. @item response
  964. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  965. By default it is disabled.
  966. @item channel
  967. Set for which IR channel to display frequency response. By default is first channel
  968. displayed. This option is used only when @var{response} is enabled.
  969. @item size
  970. Set video stream size. This option is used only when @var{response} is enabled.
  971. @item rate
  972. Set video stream frame rate. This option is used only when @var{response} is enabled.
  973. @item minp
  974. Set minimal partition size used for convolution. Default is @var{8192}.
  975. Allowed range is from @var{1} to @var{32768}.
  976. Lower values decreases latency at cost of higher CPU usage.
  977. @item maxp
  978. Set maximal partition size used for convolution. Default is @var{8192}.
  979. Allowed range is from @var{8} to @var{32768}.
  980. Lower values may increase CPU usage.
  981. @item nbirs
  982. Set number of input impulse responses streams which will be switchable at runtime.
  983. Allowed range is from @var{1} to @var{32}. Default is @var{1}.
  984. @item ir
  985. Set IR stream which will be used for convolution, starting from @var{0}, should always be
  986. lower than supplied value by @code{nbirs} option. Default is @var{0}.
  987. This option can be changed at runtime via @ref{commands}.
  988. @end table
  989. @subsection Examples
  990. @itemize
  991. @item
  992. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  993. @example
  994. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  995. @end example
  996. @end itemize
  997. @anchor{aformat}
  998. @section aformat
  999. Set output format constraints for the input audio. The framework will
  1000. negotiate the most appropriate format to minimize conversions.
  1001. It accepts the following parameters:
  1002. @table @option
  1003. @item sample_fmts, f
  1004. A '|'-separated list of requested sample formats.
  1005. @item sample_rates, r
  1006. A '|'-separated list of requested sample rates.
  1007. @item channel_layouts, cl
  1008. A '|'-separated list of requested channel layouts.
  1009. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1010. for the required syntax.
  1011. @end table
  1012. If a parameter is omitted, all values are allowed.
  1013. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1014. @example
  1015. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1016. @end example
  1017. @section agate
  1018. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1019. processing reduces disturbing noise between useful signals.
  1020. Gating is done by detecting the volume below a chosen level @var{threshold}
  1021. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1022. floor is set via @var{range}. Because an exact manipulation of the signal
  1023. would cause distortion of the waveform the reduction can be levelled over
  1024. time. This is done by setting @var{attack} and @var{release}.
  1025. @var{attack} determines how long the signal has to fall below the threshold
  1026. before any reduction will occur and @var{release} sets the time the signal
  1027. has to rise above the threshold to reduce the reduction again.
  1028. Shorter signals than the chosen attack time will be left untouched.
  1029. @table @option
  1030. @item level_in
  1031. Set input level before filtering.
  1032. Default is 1. Allowed range is from 0.015625 to 64.
  1033. @item mode
  1034. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1035. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1036. will be amplified, expanding dynamic range in upward direction.
  1037. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1038. @item range
  1039. Set the level of gain reduction when the signal is below the threshold.
  1040. Default is 0.06125. Allowed range is from 0 to 1.
  1041. Setting this to 0 disables reduction and then filter behaves like expander.
  1042. @item threshold
  1043. If a signal rises above this level the gain reduction is released.
  1044. Default is 0.125. Allowed range is from 0 to 1.
  1045. @item ratio
  1046. Set a ratio by which the signal is reduced.
  1047. Default is 2. Allowed range is from 1 to 9000.
  1048. @item attack
  1049. Amount of milliseconds the signal has to rise above the threshold before gain
  1050. reduction stops.
  1051. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1052. @item release
  1053. Amount of milliseconds the signal has to fall below the threshold before the
  1054. reduction is increased again. Default is 250 milliseconds.
  1055. Allowed range is from 0.01 to 9000.
  1056. @item makeup
  1057. Set amount of amplification of signal after processing.
  1058. Default is 1. Allowed range is from 1 to 64.
  1059. @item knee
  1060. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1061. Default is 2.828427125. Allowed range is from 1 to 8.
  1062. @item detection
  1063. Choose if exact signal should be taken for detection or an RMS like one.
  1064. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1065. @item link
  1066. Choose if the average level between all channels or the louder channel affects
  1067. the reduction.
  1068. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1069. @end table
  1070. @section aiir
  1071. Apply an arbitrary Infinite Impulse Response filter.
  1072. It accepts the following parameters:
  1073. @table @option
  1074. @item z
  1075. Set numerator/zeros coefficients.
  1076. @item p
  1077. Set denominator/poles coefficients.
  1078. @item k
  1079. Set channels gains.
  1080. @item dry_gain
  1081. Set input gain.
  1082. @item wet_gain
  1083. Set output gain.
  1084. @item f
  1085. Set coefficients format.
  1086. @table @samp
  1087. @item tf
  1088. transfer function
  1089. @item zp
  1090. Z-plane zeros/poles, cartesian (default)
  1091. @item pr
  1092. Z-plane zeros/poles, polar radians
  1093. @item pd
  1094. Z-plane zeros/poles, polar degrees
  1095. @end table
  1096. @item r
  1097. Set kind of processing.
  1098. Can be @code{d} - direct or @code{s} - serial cascading. Default is @code{s}.
  1099. @item e
  1100. Set filtering precision.
  1101. @table @samp
  1102. @item dbl
  1103. double-precision floating-point (default)
  1104. @item flt
  1105. single-precision floating-point
  1106. @item i32
  1107. 32-bit integers
  1108. @item i16
  1109. 16-bit integers
  1110. @end table
  1111. @item mix
  1112. How much to use filtered signal in output. Default is 1.
  1113. Range is between 0 and 1.
  1114. @item response
  1115. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1116. By default it is disabled.
  1117. @item channel
  1118. Set for which IR channel to display frequency response. By default is first channel
  1119. displayed. This option is used only when @var{response} is enabled.
  1120. @item size
  1121. Set video stream size. This option is used only when @var{response} is enabled.
  1122. @end table
  1123. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1124. order.
  1125. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1126. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1127. imaginary unit.
  1128. Different coefficients and gains can be provided for every channel, in such case
  1129. use '|' to separate coefficients or gains. Last provided coefficients will be
  1130. used for all remaining channels.
  1131. @subsection Examples
  1132. @itemize
  1133. @item
  1134. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1135. @example
  1136. 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
  1137. @end example
  1138. @item
  1139. Same as above but in @code{zp} format:
  1140. @example
  1141. 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
  1142. @end example
  1143. @end itemize
  1144. @section alimiter
  1145. The limiter prevents an input signal from rising over a desired threshold.
  1146. This limiter uses lookahead technology to prevent your signal from distorting.
  1147. It means that there is a small delay after the signal is processed. Keep in mind
  1148. that the delay it produces is the attack time you set.
  1149. The filter accepts the following options:
  1150. @table @option
  1151. @item level_in
  1152. Set input gain. Default is 1.
  1153. @item level_out
  1154. Set output gain. Default is 1.
  1155. @item limit
  1156. Don't let signals above this level pass the limiter. Default is 1.
  1157. @item attack
  1158. The limiter will reach its attenuation level in this amount of time in
  1159. milliseconds. Default is 5 milliseconds.
  1160. @item release
  1161. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1162. Default is 50 milliseconds.
  1163. @item asc
  1164. When gain reduction is always needed ASC takes care of releasing to an
  1165. average reduction level rather than reaching a reduction of 0 in the release
  1166. time.
  1167. @item asc_level
  1168. Select how much the release time is affected by ASC, 0 means nearly no changes
  1169. in release time while 1 produces higher release times.
  1170. @item level
  1171. Auto level output signal. Default is enabled.
  1172. This normalizes audio back to 0dB if enabled.
  1173. @end table
  1174. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1175. with @ref{aresample} before applying this filter.
  1176. @section allpass
  1177. Apply a two-pole all-pass filter with central frequency (in Hz)
  1178. @var{frequency}, and filter-width @var{width}.
  1179. An all-pass filter changes the audio's frequency to phase relationship
  1180. without changing its frequency to amplitude relationship.
  1181. The filter accepts the following options:
  1182. @table @option
  1183. @item frequency, f
  1184. Set frequency in Hz.
  1185. @item width_type, t
  1186. Set method to specify band-width of filter.
  1187. @table @option
  1188. @item h
  1189. Hz
  1190. @item q
  1191. Q-Factor
  1192. @item o
  1193. octave
  1194. @item s
  1195. slope
  1196. @item k
  1197. kHz
  1198. @end table
  1199. @item width, w
  1200. Specify the band-width of a filter in width_type units.
  1201. @item mix, m
  1202. How much to use filtered signal in output. Default is 1.
  1203. Range is between 0 and 1.
  1204. @item channels, c
  1205. Specify which channels to filter, by default all available are filtered.
  1206. @item normalize, n
  1207. Normalize biquad coefficients, by default is disabled.
  1208. Enabling it will normalize magnitude response at DC to 0dB.
  1209. @end table
  1210. @subsection Commands
  1211. This filter supports the following commands:
  1212. @table @option
  1213. @item frequency, f
  1214. Change allpass frequency.
  1215. Syntax for the command is : "@var{frequency}"
  1216. @item width_type, t
  1217. Change allpass width_type.
  1218. Syntax for the command is : "@var{width_type}"
  1219. @item width, w
  1220. Change allpass width.
  1221. Syntax for the command is : "@var{width}"
  1222. @item mix, m
  1223. Change allpass mix.
  1224. Syntax for the command is : "@var{mix}"
  1225. @end table
  1226. @section aloop
  1227. Loop audio samples.
  1228. The filter accepts the following options:
  1229. @table @option
  1230. @item loop
  1231. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1232. Default is 0.
  1233. @item size
  1234. Set maximal number of samples. Default is 0.
  1235. @item start
  1236. Set first sample of loop. Default is 0.
  1237. @end table
  1238. @anchor{amerge}
  1239. @section amerge
  1240. Merge two or more audio streams into a single multi-channel stream.
  1241. The filter accepts the following options:
  1242. @table @option
  1243. @item inputs
  1244. Set the number of inputs. Default is 2.
  1245. @end table
  1246. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1247. the channel layout of the output will be set accordingly and the channels
  1248. will be reordered as necessary. If the channel layouts of the inputs are not
  1249. disjoint, the output will have all the channels of the first input then all
  1250. the channels of the second input, in that order, and the channel layout of
  1251. the output will be the default value corresponding to the total number of
  1252. channels.
  1253. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1254. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1255. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1256. first input, b1 is the first channel of the second input).
  1257. On the other hand, if both input are in stereo, the output channels will be
  1258. in the default order: a1, a2, b1, b2, and the channel layout will be
  1259. arbitrarily set to 4.0, which may or may not be the expected value.
  1260. All inputs must have the same sample rate, and format.
  1261. If inputs do not have the same duration, the output will stop with the
  1262. shortest.
  1263. @subsection Examples
  1264. @itemize
  1265. @item
  1266. Merge two mono files into a stereo stream:
  1267. @example
  1268. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1269. @end example
  1270. @item
  1271. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1272. @example
  1273. 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
  1274. @end example
  1275. @end itemize
  1276. @section amix
  1277. Mixes multiple audio inputs into a single output.
  1278. Note that this filter only supports float samples (the @var{amerge}
  1279. and @var{pan} audio filters support many formats). If the @var{amix}
  1280. input has integer samples then @ref{aresample} will be automatically
  1281. inserted to perform the conversion to float samples.
  1282. For example
  1283. @example
  1284. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1285. @end example
  1286. will mix 3 input audio streams to a single output with the same duration as the
  1287. first input and a dropout transition time of 3 seconds.
  1288. It accepts the following parameters:
  1289. @table @option
  1290. @item inputs
  1291. The number of inputs. If unspecified, it defaults to 2.
  1292. @item duration
  1293. How to determine the end-of-stream.
  1294. @table @option
  1295. @item longest
  1296. The duration of the longest input. (default)
  1297. @item shortest
  1298. The duration of the shortest input.
  1299. @item first
  1300. The duration of the first input.
  1301. @end table
  1302. @item dropout_transition
  1303. The transition time, in seconds, for volume renormalization when an input
  1304. stream ends. The default value is 2 seconds.
  1305. @item weights
  1306. Specify weight of each input audio stream as sequence.
  1307. Each weight is separated by space. By default all inputs have same weight.
  1308. @end table
  1309. @section amultiply
  1310. Multiply first audio stream with second audio stream and store result
  1311. in output audio stream. Multiplication is done by multiplying each
  1312. sample from first stream with sample at same position from second stream.
  1313. With this element-wise multiplication one can create amplitude fades and
  1314. amplitude modulations.
  1315. @section anequalizer
  1316. High-order parametric multiband equalizer for each channel.
  1317. It accepts the following parameters:
  1318. @table @option
  1319. @item params
  1320. This option string is in format:
  1321. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1322. Each equalizer band is separated by '|'.
  1323. @table @option
  1324. @item chn
  1325. Set channel number to which equalization will be applied.
  1326. If input doesn't have that channel the entry is ignored.
  1327. @item f
  1328. Set central frequency for band.
  1329. If input doesn't have that frequency the entry is ignored.
  1330. @item w
  1331. Set band width in hertz.
  1332. @item g
  1333. Set band gain in dB.
  1334. @item t
  1335. Set filter type for band, optional, can be:
  1336. @table @samp
  1337. @item 0
  1338. Butterworth, this is default.
  1339. @item 1
  1340. Chebyshev type 1.
  1341. @item 2
  1342. Chebyshev type 2.
  1343. @end table
  1344. @end table
  1345. @item curves
  1346. With this option activated frequency response of anequalizer is displayed
  1347. in video stream.
  1348. @item size
  1349. Set video stream size. Only useful if curves option is activated.
  1350. @item mgain
  1351. Set max gain that will be displayed. Only useful if curves option is activated.
  1352. Setting this to a reasonable value makes it possible to display gain which is derived from
  1353. neighbour bands which are too close to each other and thus produce higher gain
  1354. when both are activated.
  1355. @item fscale
  1356. Set frequency scale used to draw frequency response in video output.
  1357. Can be linear or logarithmic. Default is logarithmic.
  1358. @item colors
  1359. Set color for each channel curve which is going to be displayed in video stream.
  1360. This is list of color names separated by space or by '|'.
  1361. Unrecognised or missing colors will be replaced by white color.
  1362. @end table
  1363. @subsection Examples
  1364. @itemize
  1365. @item
  1366. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1367. for first 2 channels using Chebyshev type 1 filter:
  1368. @example
  1369. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1370. @end example
  1371. @end itemize
  1372. @subsection Commands
  1373. This filter supports the following commands:
  1374. @table @option
  1375. @item change
  1376. Alter existing filter parameters.
  1377. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1378. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1379. error is returned.
  1380. @var{freq} set new frequency parameter.
  1381. @var{width} set new width parameter in herz.
  1382. @var{gain} set new gain parameter in dB.
  1383. Full filter invocation with asendcmd may look like this:
  1384. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1385. @end table
  1386. @section anlmdn
  1387. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1388. Each sample is adjusted by looking for other samples with similar contexts. This
  1389. context similarity is defined by comparing their surrounding patches of size
  1390. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1391. The filter accepts the following options:
  1392. @table @option
  1393. @item s
  1394. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1395. @item p
  1396. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1397. Default value is 2 milliseconds.
  1398. @item r
  1399. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1400. Default value is 6 milliseconds.
  1401. @item o
  1402. Set the output mode.
  1403. It accepts the following values:
  1404. @table @option
  1405. @item i
  1406. Pass input unchanged.
  1407. @item o
  1408. Pass noise filtered out.
  1409. @item n
  1410. Pass only noise.
  1411. Default value is @var{o}.
  1412. @end table
  1413. @item m
  1414. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1415. @end table
  1416. @subsection Commands
  1417. This filter supports the following commands:
  1418. @table @option
  1419. @item s
  1420. Change denoise strength. Argument is single float number.
  1421. Syntax for the command is : "@var{s}"
  1422. @item o
  1423. Change output mode.
  1424. Syntax for the command is : "i", "o" or "n" string.
  1425. @end table
  1426. @section anlms
  1427. Apply Normalized Least-Mean-Squares algorithm to the first audio stream using the second audio stream.
  1428. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1429. relate to producing the least mean square of the error signal (difference between the desired,
  1430. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1431. A description of the accepted options follows.
  1432. @table @option
  1433. @item order
  1434. Set filter order.
  1435. @item mu
  1436. Set filter mu.
  1437. @item eps
  1438. Set the filter eps.
  1439. @item leakage
  1440. Set the filter leakage.
  1441. @item out_mode
  1442. It accepts the following values:
  1443. @table @option
  1444. @item i
  1445. Pass the 1st input.
  1446. @item d
  1447. Pass the 2nd input.
  1448. @item o
  1449. Pass filtered samples.
  1450. @item n
  1451. Pass difference between desired and filtered samples.
  1452. Default value is @var{o}.
  1453. @end table
  1454. @end table
  1455. @subsection Examples
  1456. @itemize
  1457. @item
  1458. One of many usages of this filter is noise reduction, input audio is filtered
  1459. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1460. @example
  1461. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1462. @end example
  1463. @end itemize
  1464. @subsection Commands
  1465. This filter supports the same commands as options, excluding option @code{order}.
  1466. @section anull
  1467. Pass the audio source unchanged to the output.
  1468. @section apad
  1469. Pad the end of an audio stream with silence.
  1470. This can be used together with @command{ffmpeg} @option{-shortest} to
  1471. extend audio streams to the same length as the video stream.
  1472. A description of the accepted options follows.
  1473. @table @option
  1474. @item packet_size
  1475. Set silence packet size. Default value is 4096.
  1476. @item pad_len
  1477. Set the number of samples of silence to add to the end. After the
  1478. value is reached, the stream is terminated. This option is mutually
  1479. exclusive with @option{whole_len}.
  1480. @item whole_len
  1481. Set the minimum total number of samples in the output audio stream. If
  1482. the value is longer than the input audio length, silence is added to
  1483. the end, until the value is reached. This option is mutually exclusive
  1484. with @option{pad_len}.
  1485. @item pad_dur
  1486. Specify the duration of samples of silence to add. See
  1487. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1488. for the accepted syntax. Used only if set to non-zero value.
  1489. @item whole_dur
  1490. Specify the minimum total duration in the output audio stream. See
  1491. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1492. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1493. the input audio length, silence is added to the end, until the value is reached.
  1494. This option is mutually exclusive with @option{pad_dur}
  1495. @end table
  1496. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1497. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1498. the input stream indefinitely.
  1499. @subsection Examples
  1500. @itemize
  1501. @item
  1502. Add 1024 samples of silence to the end of the input:
  1503. @example
  1504. apad=pad_len=1024
  1505. @end example
  1506. @item
  1507. Make sure the audio output will contain at least 10000 samples, pad
  1508. the input with silence if required:
  1509. @example
  1510. apad=whole_len=10000
  1511. @end example
  1512. @item
  1513. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1514. video stream will always result the shortest and will be converted
  1515. until the end in the output file when using the @option{shortest}
  1516. option:
  1517. @example
  1518. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1519. @end example
  1520. @end itemize
  1521. @section aphaser
  1522. Add a phasing effect to the input audio.
  1523. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1524. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1525. A description of the accepted parameters follows.
  1526. @table @option
  1527. @item in_gain
  1528. Set input gain. Default is 0.4.
  1529. @item out_gain
  1530. Set output gain. Default is 0.74
  1531. @item delay
  1532. Set delay in milliseconds. Default is 3.0.
  1533. @item decay
  1534. Set decay. Default is 0.4.
  1535. @item speed
  1536. Set modulation speed in Hz. Default is 0.5.
  1537. @item type
  1538. Set modulation type. Default is triangular.
  1539. It accepts the following values:
  1540. @table @samp
  1541. @item triangular, t
  1542. @item sinusoidal, s
  1543. @end table
  1544. @end table
  1545. @section apulsator
  1546. Audio pulsator is something between an autopanner and a tremolo.
  1547. But it can produce funny stereo effects as well. Pulsator changes the volume
  1548. of the left and right channel based on a LFO (low frequency oscillator) with
  1549. different waveforms and shifted phases.
  1550. This filter have the ability to define an offset between left and right
  1551. channel. An offset of 0 means that both LFO shapes match each other.
  1552. The left and right channel are altered equally - a conventional tremolo.
  1553. An offset of 50% means that the shape of the right channel is exactly shifted
  1554. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1555. an autopanner. At 1 both curves match again. Every setting in between moves the
  1556. phase shift gapless between all stages and produces some "bypassing" sounds with
  1557. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1558. the 0.5) the faster the signal passes from the left to the right speaker.
  1559. The filter accepts the following options:
  1560. @table @option
  1561. @item level_in
  1562. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1563. @item level_out
  1564. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1565. @item mode
  1566. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1567. sawup or sawdown. Default is sine.
  1568. @item amount
  1569. Set modulation. Define how much of original signal is affected by the LFO.
  1570. @item offset_l
  1571. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1572. @item offset_r
  1573. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1574. @item width
  1575. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1576. @item timing
  1577. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1578. @item bpm
  1579. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1580. is set to bpm.
  1581. @item ms
  1582. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1583. is set to ms.
  1584. @item hz
  1585. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1586. if timing is set to hz.
  1587. @end table
  1588. @anchor{aresample}
  1589. @section aresample
  1590. Resample the input audio to the specified parameters, using the
  1591. libswresample library. If none are specified then the filter will
  1592. automatically convert between its input and output.
  1593. This filter is also able to stretch/squeeze the audio data to make it match
  1594. the timestamps or to inject silence / cut out audio to make it match the
  1595. timestamps, do a combination of both or do neither.
  1596. The filter accepts the syntax
  1597. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1598. expresses a sample rate and @var{resampler_options} is a list of
  1599. @var{key}=@var{value} pairs, separated by ":". See the
  1600. @ref{Resampler Options,,"Resampler Options" section in the
  1601. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1602. for the complete list of supported options.
  1603. @subsection Examples
  1604. @itemize
  1605. @item
  1606. Resample the input audio to 44100Hz:
  1607. @example
  1608. aresample=44100
  1609. @end example
  1610. @item
  1611. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1612. samples per second compensation:
  1613. @example
  1614. aresample=async=1000
  1615. @end example
  1616. @end itemize
  1617. @section areverse
  1618. Reverse an audio clip.
  1619. Warning: This filter requires memory to buffer the entire clip, so trimming
  1620. is suggested.
  1621. @subsection Examples
  1622. @itemize
  1623. @item
  1624. Take the first 5 seconds of a clip, and reverse it.
  1625. @example
  1626. atrim=end=5,areverse
  1627. @end example
  1628. @end itemize
  1629. @section arnndn
  1630. Reduce noise from speech using Recurrent Neural Networks.
  1631. This filter accepts the following options:
  1632. @table @option
  1633. @item model, m
  1634. Set train model file to load. This option is always required.
  1635. @end table
  1636. @section asetnsamples
  1637. Set the number of samples per each output audio frame.
  1638. The last output packet may contain a different number of samples, as
  1639. the filter will flush all the remaining samples when the input audio
  1640. signals its end.
  1641. The filter accepts the following options:
  1642. @table @option
  1643. @item nb_out_samples, n
  1644. Set the number of frames per each output audio frame. The number is
  1645. intended as the number of samples @emph{per each channel}.
  1646. Default value is 1024.
  1647. @item pad, p
  1648. If set to 1, the filter will pad the last audio frame with zeroes, so
  1649. that the last frame will contain the same number of samples as the
  1650. previous ones. Default value is 1.
  1651. @end table
  1652. For example, to set the number of per-frame samples to 1234 and
  1653. disable padding for the last frame, use:
  1654. @example
  1655. asetnsamples=n=1234:p=0
  1656. @end example
  1657. @section asetrate
  1658. Set the sample rate without altering the PCM data.
  1659. This will result in a change of speed and pitch.
  1660. The filter accepts the following options:
  1661. @table @option
  1662. @item sample_rate, r
  1663. Set the output sample rate. Default is 44100 Hz.
  1664. @end table
  1665. @section ashowinfo
  1666. Show a line containing various information for each input audio frame.
  1667. The input audio is not modified.
  1668. The shown line contains a sequence of key/value pairs of the form
  1669. @var{key}:@var{value}.
  1670. The following values are shown in the output:
  1671. @table @option
  1672. @item n
  1673. The (sequential) number of the input frame, starting from 0.
  1674. @item pts
  1675. The presentation timestamp of the input frame, in time base units; the time base
  1676. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1677. @item pts_time
  1678. The presentation timestamp of the input frame in seconds.
  1679. @item pos
  1680. position of the frame in the input stream, -1 if this information in
  1681. unavailable and/or meaningless (for example in case of synthetic audio)
  1682. @item fmt
  1683. The sample format.
  1684. @item chlayout
  1685. The channel layout.
  1686. @item rate
  1687. The sample rate for the audio frame.
  1688. @item nb_samples
  1689. The number of samples (per channel) in the frame.
  1690. @item checksum
  1691. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1692. audio, the data is treated as if all the planes were concatenated.
  1693. @item plane_checksums
  1694. A list of Adler-32 checksums for each data plane.
  1695. @end table
  1696. @section asoftclip
  1697. Apply audio soft clipping.
  1698. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1699. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1700. This filter accepts the following options:
  1701. @table @option
  1702. @item type
  1703. Set type of soft-clipping.
  1704. It accepts the following values:
  1705. @table @option
  1706. @item tanh
  1707. @item atan
  1708. @item cubic
  1709. @item exp
  1710. @item alg
  1711. @item quintic
  1712. @item sin
  1713. @end table
  1714. @item param
  1715. Set additional parameter which controls sigmoid function.
  1716. @end table
  1717. @subsection Commands
  1718. This filter supports the all above options as @ref{commands}.
  1719. @section asr
  1720. Automatic Speech Recognition
  1721. This filter uses PocketSphinx for speech recognition. To enable
  1722. compilation of this filter, you need to configure FFmpeg with
  1723. @code{--enable-pocketsphinx}.
  1724. It accepts the following options:
  1725. @table @option
  1726. @item rate
  1727. Set sampling rate of input audio. Defaults is @code{16000}.
  1728. This need to match speech models, otherwise one will get poor results.
  1729. @item hmm
  1730. Set dictionary containing acoustic model files.
  1731. @item dict
  1732. Set pronunciation dictionary.
  1733. @item lm
  1734. Set language model file.
  1735. @item lmctl
  1736. Set language model set.
  1737. @item lmname
  1738. Set which language model to use.
  1739. @item logfn
  1740. Set output for log messages.
  1741. @end table
  1742. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1743. @anchor{astats}
  1744. @section astats
  1745. Display time domain statistical information about the audio channels.
  1746. Statistics are calculated and displayed for each audio channel and,
  1747. where applicable, an overall figure is also given.
  1748. It accepts the following option:
  1749. @table @option
  1750. @item length
  1751. Short window length in seconds, used for peak and trough RMS measurement.
  1752. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1753. @item metadata
  1754. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1755. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1756. disabled.
  1757. Available keys for each channel are:
  1758. DC_offset
  1759. Min_level
  1760. Max_level
  1761. Min_difference
  1762. Max_difference
  1763. Mean_difference
  1764. RMS_difference
  1765. Peak_level
  1766. RMS_peak
  1767. RMS_trough
  1768. Crest_factor
  1769. Flat_factor
  1770. Peak_count
  1771. Bit_depth
  1772. Dynamic_range
  1773. Zero_crossings
  1774. Zero_crossings_rate
  1775. Number_of_NaNs
  1776. Number_of_Infs
  1777. Number_of_denormals
  1778. and for Overall:
  1779. DC_offset
  1780. Min_level
  1781. Max_level
  1782. Min_difference
  1783. Max_difference
  1784. Mean_difference
  1785. RMS_difference
  1786. Peak_level
  1787. RMS_level
  1788. RMS_peak
  1789. RMS_trough
  1790. Flat_factor
  1791. Peak_count
  1792. Bit_depth
  1793. Number_of_samples
  1794. Number_of_NaNs
  1795. Number_of_Infs
  1796. Number_of_denormals
  1797. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1798. this @code{lavfi.astats.Overall.Peak_count}.
  1799. For description what each key means read below.
  1800. @item reset
  1801. Set number of frame after which stats are going to be recalculated.
  1802. Default is disabled.
  1803. @item measure_perchannel
  1804. Select the entries which need to be measured per channel. The metadata keys can
  1805. be used as flags, default is @option{all} which measures everything.
  1806. @option{none} disables all per channel measurement.
  1807. @item measure_overall
  1808. Select the entries which need to be measured overall. The metadata keys can
  1809. be used as flags, default is @option{all} which measures everything.
  1810. @option{none} disables all overall measurement.
  1811. @end table
  1812. A description of each shown parameter follows:
  1813. @table @option
  1814. @item DC offset
  1815. Mean amplitude displacement from zero.
  1816. @item Min level
  1817. Minimal sample level.
  1818. @item Max level
  1819. Maximal sample level.
  1820. @item Min difference
  1821. Minimal difference between two consecutive samples.
  1822. @item Max difference
  1823. Maximal difference between two consecutive samples.
  1824. @item Mean difference
  1825. Mean difference between two consecutive samples.
  1826. The average of each difference between two consecutive samples.
  1827. @item RMS difference
  1828. Root Mean Square difference between two consecutive samples.
  1829. @item Peak level dB
  1830. @item RMS level dB
  1831. Standard peak and RMS level measured in dBFS.
  1832. @item RMS peak dB
  1833. @item RMS trough dB
  1834. Peak and trough values for RMS level measured over a short window.
  1835. @item Crest factor
  1836. Standard ratio of peak to RMS level (note: not in dB).
  1837. @item Flat factor
  1838. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1839. (i.e. either @var{Min level} or @var{Max level}).
  1840. @item Peak count
  1841. Number of occasions (not the number of samples) that the signal attained either
  1842. @var{Min level} or @var{Max level}.
  1843. @item Bit depth
  1844. Overall bit depth of audio. Number of bits used for each sample.
  1845. @item Dynamic range
  1846. Measured dynamic range of audio in dB.
  1847. @item Zero crossings
  1848. Number of points where the waveform crosses the zero level axis.
  1849. @item Zero crossings rate
  1850. Rate of Zero crossings and number of audio samples.
  1851. @end table
  1852. @section atempo
  1853. Adjust audio tempo.
  1854. The filter accepts exactly one parameter, the audio tempo. If not
  1855. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1856. be in the [0.5, 100.0] range.
  1857. Note that tempo greater than 2 will skip some samples rather than
  1858. blend them in. If for any reason this is a concern it is always
  1859. possible to daisy-chain several instances of atempo to achieve the
  1860. desired product tempo.
  1861. @subsection Examples
  1862. @itemize
  1863. @item
  1864. Slow down audio to 80% tempo:
  1865. @example
  1866. atempo=0.8
  1867. @end example
  1868. @item
  1869. To speed up audio to 300% tempo:
  1870. @example
  1871. atempo=3
  1872. @end example
  1873. @item
  1874. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1875. @example
  1876. atempo=sqrt(3),atempo=sqrt(3)
  1877. @end example
  1878. @end itemize
  1879. @subsection Commands
  1880. This filter supports the following commands:
  1881. @table @option
  1882. @item tempo
  1883. Change filter tempo scale factor.
  1884. Syntax for the command is : "@var{tempo}"
  1885. @end table
  1886. @section atrim
  1887. Trim the input so that the output contains one continuous subpart of the input.
  1888. It accepts the following parameters:
  1889. @table @option
  1890. @item start
  1891. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1892. sample with the timestamp @var{start} will be the first sample in the output.
  1893. @item end
  1894. Specify time of the first audio sample that will be dropped, i.e. the
  1895. audio sample immediately preceding the one with the timestamp @var{end} will be
  1896. the last sample in the output.
  1897. @item start_pts
  1898. Same as @var{start}, except this option sets the start timestamp in samples
  1899. instead of seconds.
  1900. @item end_pts
  1901. Same as @var{end}, except this option sets the end timestamp in samples instead
  1902. of seconds.
  1903. @item duration
  1904. The maximum duration of the output in seconds.
  1905. @item start_sample
  1906. The number of the first sample that should be output.
  1907. @item end_sample
  1908. The number of the first sample that should be dropped.
  1909. @end table
  1910. @option{start}, @option{end}, and @option{duration} are expressed as time
  1911. duration specifications; see
  1912. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1913. Note that the first two sets of the start/end options and the @option{duration}
  1914. option look at the frame timestamp, while the _sample options simply count the
  1915. samples that pass through the filter. So start/end_pts and start/end_sample will
  1916. give different results when the timestamps are wrong, inexact or do not start at
  1917. zero. Also note that this filter does not modify the timestamps. If you wish
  1918. to have the output timestamps start at zero, insert the asetpts filter after the
  1919. atrim filter.
  1920. If multiple start or end options are set, this filter tries to be greedy and
  1921. keep all samples that match at least one of the specified constraints. To keep
  1922. only the part that matches all the constraints at once, chain multiple atrim
  1923. filters.
  1924. The defaults are such that all the input is kept. So it is possible to set e.g.
  1925. just the end values to keep everything before the specified time.
  1926. Examples:
  1927. @itemize
  1928. @item
  1929. Drop everything except the second minute of input:
  1930. @example
  1931. ffmpeg -i INPUT -af atrim=60:120
  1932. @end example
  1933. @item
  1934. Keep only the first 1000 samples:
  1935. @example
  1936. ffmpeg -i INPUT -af atrim=end_sample=1000
  1937. @end example
  1938. @end itemize
  1939. @section axcorrelate
  1940. Calculate normalized cross-correlation between two input audio streams.
  1941. Resulted samples are always between -1 and 1 inclusive.
  1942. If result is 1 it means two input samples are highly correlated in that selected segment.
  1943. Result 0 means they are not correlated at all.
  1944. If result is -1 it means two input samples are out of phase, which means they cancel each
  1945. other.
  1946. The filter accepts the following options:
  1947. @table @option
  1948. @item size
  1949. Set size of segment over which cross-correlation is calculated.
  1950. Default is 256. Allowed range is from 2 to 131072.
  1951. @item algo
  1952. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  1953. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  1954. are always zero and thus need much less calculations to make.
  1955. This is generally not true, but is valid for typical audio streams.
  1956. @end table
  1957. @subsection Examples
  1958. @itemize
  1959. @item
  1960. Calculate correlation between channels in stereo audio stream:
  1961. @example
  1962. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  1963. @end example
  1964. @end itemize
  1965. @section bandpass
  1966. Apply a two-pole Butterworth band-pass filter with central
  1967. frequency @var{frequency}, and (3dB-point) band-width width.
  1968. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1969. instead of the default: constant 0dB peak gain.
  1970. The filter roll off at 6dB per octave (20dB per decade).
  1971. The filter accepts the following options:
  1972. @table @option
  1973. @item frequency, f
  1974. Set the filter's central frequency. Default is @code{3000}.
  1975. @item csg
  1976. Constant skirt gain if set to 1. Defaults to 0.
  1977. @item width_type, t
  1978. Set method to specify band-width of filter.
  1979. @table @option
  1980. @item h
  1981. Hz
  1982. @item q
  1983. Q-Factor
  1984. @item o
  1985. octave
  1986. @item s
  1987. slope
  1988. @item k
  1989. kHz
  1990. @end table
  1991. @item width, w
  1992. Specify the band-width of a filter in width_type units.
  1993. @item mix, m
  1994. How much to use filtered signal in output. Default is 1.
  1995. Range is between 0 and 1.
  1996. @item channels, c
  1997. Specify which channels to filter, by default all available are filtered.
  1998. @item normalize, n
  1999. Normalize biquad coefficients, by default is disabled.
  2000. Enabling it will normalize magnitude response at DC to 0dB.
  2001. @end table
  2002. @subsection Commands
  2003. This filter supports the following commands:
  2004. @table @option
  2005. @item frequency, f
  2006. Change bandpass frequency.
  2007. Syntax for the command is : "@var{frequency}"
  2008. @item width_type, t
  2009. Change bandpass width_type.
  2010. Syntax for the command is : "@var{width_type}"
  2011. @item width, w
  2012. Change bandpass width.
  2013. Syntax for the command is : "@var{width}"
  2014. @item mix, m
  2015. Change bandpass mix.
  2016. Syntax for the command is : "@var{mix}"
  2017. @end table
  2018. @section bandreject
  2019. Apply a two-pole Butterworth band-reject filter with central
  2020. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2021. The filter roll off at 6dB per octave (20dB per decade).
  2022. The filter accepts the following options:
  2023. @table @option
  2024. @item frequency, f
  2025. Set the filter's central frequency. Default is @code{3000}.
  2026. @item width_type, t
  2027. Set method to specify band-width of filter.
  2028. @table @option
  2029. @item h
  2030. Hz
  2031. @item q
  2032. Q-Factor
  2033. @item o
  2034. octave
  2035. @item s
  2036. slope
  2037. @item k
  2038. kHz
  2039. @end table
  2040. @item width, w
  2041. Specify the band-width of a filter in width_type units.
  2042. @item mix, m
  2043. How much to use filtered signal in output. Default is 1.
  2044. Range is between 0 and 1.
  2045. @item channels, c
  2046. Specify which channels to filter, by default all available are filtered.
  2047. @item normalize, n
  2048. Normalize biquad coefficients, by default is disabled.
  2049. Enabling it will normalize magnitude response at DC to 0dB.
  2050. @end table
  2051. @subsection Commands
  2052. This filter supports the following commands:
  2053. @table @option
  2054. @item frequency, f
  2055. Change bandreject frequency.
  2056. Syntax for the command is : "@var{frequency}"
  2057. @item width_type, t
  2058. Change bandreject width_type.
  2059. Syntax for the command is : "@var{width_type}"
  2060. @item width, w
  2061. Change bandreject width.
  2062. Syntax for the command is : "@var{width}"
  2063. @item mix, m
  2064. Change bandreject mix.
  2065. Syntax for the command is : "@var{mix}"
  2066. @end table
  2067. @section bass, lowshelf
  2068. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2069. shelving filter with a response similar to that of a standard
  2070. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2071. The filter accepts the following options:
  2072. @table @option
  2073. @item gain, g
  2074. Give the gain at 0 Hz. Its useful range is about -20
  2075. (for a large cut) to +20 (for a large boost).
  2076. Beware of clipping when using a positive gain.
  2077. @item frequency, f
  2078. Set the filter's central frequency and so can be used
  2079. to extend or reduce the frequency range to be boosted or cut.
  2080. The default value is @code{100} Hz.
  2081. @item width_type, t
  2082. Set method to specify band-width of filter.
  2083. @table @option
  2084. @item h
  2085. Hz
  2086. @item q
  2087. Q-Factor
  2088. @item o
  2089. octave
  2090. @item s
  2091. slope
  2092. @item k
  2093. kHz
  2094. @end table
  2095. @item width, w
  2096. Determine how steep is the filter's shelf transition.
  2097. @item mix, m
  2098. How much to use filtered signal in output. Default is 1.
  2099. Range is between 0 and 1.
  2100. @item channels, c
  2101. Specify which channels to filter, by default all available are filtered.
  2102. @item normalize, n
  2103. Normalize biquad coefficients, by default is disabled.
  2104. Enabling it will normalize magnitude response at DC to 0dB.
  2105. @end table
  2106. @subsection Commands
  2107. This filter supports the following commands:
  2108. @table @option
  2109. @item frequency, f
  2110. Change bass frequency.
  2111. Syntax for the command is : "@var{frequency}"
  2112. @item width_type, t
  2113. Change bass width_type.
  2114. Syntax for the command is : "@var{width_type}"
  2115. @item width, w
  2116. Change bass width.
  2117. Syntax for the command is : "@var{width}"
  2118. @item gain, g
  2119. Change bass gain.
  2120. Syntax for the command is : "@var{gain}"
  2121. @item mix, m
  2122. Change bass mix.
  2123. Syntax for the command is : "@var{mix}"
  2124. @end table
  2125. @section biquad
  2126. Apply a biquad IIR filter with the given coefficients.
  2127. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2128. are the numerator and denominator coefficients respectively.
  2129. and @var{channels}, @var{c} specify which channels to filter, by default all
  2130. available are filtered.
  2131. @subsection Commands
  2132. This filter supports the following commands:
  2133. @table @option
  2134. @item a0
  2135. @item a1
  2136. @item a2
  2137. @item b0
  2138. @item b1
  2139. @item b2
  2140. Change biquad parameter.
  2141. Syntax for the command is : "@var{value}"
  2142. @item mix, m
  2143. How much to use filtered signal in output. Default is 1.
  2144. Range is between 0 and 1.
  2145. @item channels, c
  2146. Specify which channels to filter, by default all available are filtered.
  2147. @item normalize, n
  2148. Normalize biquad coefficients, by default is disabled.
  2149. Enabling it will normalize magnitude response at DC to 0dB.
  2150. @end table
  2151. @section bs2b
  2152. Bauer stereo to binaural transformation, which improves headphone listening of
  2153. stereo audio records.
  2154. To enable compilation of this filter you need to configure FFmpeg with
  2155. @code{--enable-libbs2b}.
  2156. It accepts the following parameters:
  2157. @table @option
  2158. @item profile
  2159. Pre-defined crossfeed level.
  2160. @table @option
  2161. @item default
  2162. Default level (fcut=700, feed=50).
  2163. @item cmoy
  2164. Chu Moy circuit (fcut=700, feed=60).
  2165. @item jmeier
  2166. Jan Meier circuit (fcut=650, feed=95).
  2167. @end table
  2168. @item fcut
  2169. Cut frequency (in Hz).
  2170. @item feed
  2171. Feed level (in Hz).
  2172. @end table
  2173. @section channelmap
  2174. Remap input channels to new locations.
  2175. It accepts the following parameters:
  2176. @table @option
  2177. @item map
  2178. Map channels from input to output. The argument is a '|'-separated list of
  2179. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2180. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2181. channel (e.g. FL for front left) or its index in the input channel layout.
  2182. @var{out_channel} is the name of the output channel or its index in the output
  2183. channel layout. If @var{out_channel} is not given then it is implicitly an
  2184. index, starting with zero and increasing by one for each mapping.
  2185. @item channel_layout
  2186. The channel layout of the output stream.
  2187. @end table
  2188. If no mapping is present, the filter will implicitly map input channels to
  2189. output channels, preserving indices.
  2190. @subsection Examples
  2191. @itemize
  2192. @item
  2193. For example, assuming a 5.1+downmix input MOV file,
  2194. @example
  2195. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2196. @end example
  2197. will create an output WAV file tagged as stereo from the downmix channels of
  2198. the input.
  2199. @item
  2200. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2201. @example
  2202. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2203. @end example
  2204. @end itemize
  2205. @section channelsplit
  2206. Split each channel from an input audio stream into a separate output stream.
  2207. It accepts the following parameters:
  2208. @table @option
  2209. @item channel_layout
  2210. The channel layout of the input stream. The default is "stereo".
  2211. @item channels
  2212. A channel layout describing the channels to be extracted as separate output streams
  2213. or "all" to extract each input channel as a separate stream. The default is "all".
  2214. Choosing channels not present in channel layout in the input will result in an error.
  2215. @end table
  2216. @subsection Examples
  2217. @itemize
  2218. @item
  2219. For example, assuming a stereo input MP3 file,
  2220. @example
  2221. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2222. @end example
  2223. will create an output Matroska file with two audio streams, one containing only
  2224. the left channel and the other the right channel.
  2225. @item
  2226. Split a 5.1 WAV file into per-channel files:
  2227. @example
  2228. ffmpeg -i in.wav -filter_complex
  2229. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2230. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2231. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2232. side_right.wav
  2233. @end example
  2234. @item
  2235. Extract only LFE from a 5.1 WAV file:
  2236. @example
  2237. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2238. -map '[LFE]' lfe.wav
  2239. @end example
  2240. @end itemize
  2241. @section chorus
  2242. Add a chorus effect to the audio.
  2243. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2244. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2245. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2246. The modulation depth defines the range the modulated delay is played before or after
  2247. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2248. sound tuned around the original one, like in a chorus where some vocals are slightly
  2249. off key.
  2250. It accepts the following parameters:
  2251. @table @option
  2252. @item in_gain
  2253. Set input gain. Default is 0.4.
  2254. @item out_gain
  2255. Set output gain. Default is 0.4.
  2256. @item delays
  2257. Set delays. A typical delay is around 40ms to 60ms.
  2258. @item decays
  2259. Set decays.
  2260. @item speeds
  2261. Set speeds.
  2262. @item depths
  2263. Set depths.
  2264. @end table
  2265. @subsection Examples
  2266. @itemize
  2267. @item
  2268. A single delay:
  2269. @example
  2270. chorus=0.7:0.9:55:0.4:0.25:2
  2271. @end example
  2272. @item
  2273. Two delays:
  2274. @example
  2275. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2276. @end example
  2277. @item
  2278. Fuller sounding chorus with three delays:
  2279. @example
  2280. 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
  2281. @end example
  2282. @end itemize
  2283. @section compand
  2284. Compress or expand the audio's dynamic range.
  2285. It accepts the following parameters:
  2286. @table @option
  2287. @item attacks
  2288. @item decays
  2289. A list of times in seconds for each channel over which the instantaneous level
  2290. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2291. increase of volume and @var{decays} refers to decrease of volume. For most
  2292. situations, the attack time (response to the audio getting louder) should be
  2293. shorter than the decay time, because the human ear is more sensitive to sudden
  2294. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2295. a typical value for decay is 0.8 seconds.
  2296. If specified number of attacks & decays is lower than number of channels, the last
  2297. set attack/decay will be used for all remaining channels.
  2298. @item points
  2299. A list of points for the transfer function, specified in dB relative to the
  2300. maximum possible signal amplitude. Each key points list must be defined using
  2301. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2302. @code{x0/y0 x1/y1 x2/y2 ....}
  2303. The input values must be in strictly increasing order but the transfer function
  2304. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2305. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2306. function are @code{-70/-70|-60/-20|1/0}.
  2307. @item soft-knee
  2308. Set the curve radius in dB for all joints. It defaults to 0.01.
  2309. @item gain
  2310. Set the additional gain in dB to be applied at all points on the transfer
  2311. function. This allows for easy adjustment of the overall gain.
  2312. It defaults to 0.
  2313. @item volume
  2314. Set an initial volume, in dB, to be assumed for each channel when filtering
  2315. starts. This permits the user to supply a nominal level initially, so that, for
  2316. example, a very large gain is not applied to initial signal levels before the
  2317. companding has begun to operate. A typical value for audio which is initially
  2318. quiet is -90 dB. It defaults to 0.
  2319. @item delay
  2320. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2321. delayed before being fed to the volume adjuster. Specifying a delay
  2322. approximately equal to the attack/decay times allows the filter to effectively
  2323. operate in predictive rather than reactive mode. It defaults to 0.
  2324. @end table
  2325. @subsection Examples
  2326. @itemize
  2327. @item
  2328. Make music with both quiet and loud passages suitable for listening to in a
  2329. noisy environment:
  2330. @example
  2331. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2332. @end example
  2333. Another example for audio with whisper and explosion parts:
  2334. @example
  2335. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2336. @end example
  2337. @item
  2338. A noise gate for when the noise is at a lower level than the signal:
  2339. @example
  2340. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2341. @end example
  2342. @item
  2343. Here is another noise gate, this time for when the noise is at a higher level
  2344. than the signal (making it, in some ways, similar to squelch):
  2345. @example
  2346. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2347. @end example
  2348. @item
  2349. 2:1 compression starting at -6dB:
  2350. @example
  2351. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2352. @end example
  2353. @item
  2354. 2:1 compression starting at -9dB:
  2355. @example
  2356. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2357. @end example
  2358. @item
  2359. 2:1 compression starting at -12dB:
  2360. @example
  2361. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2362. @end example
  2363. @item
  2364. 2:1 compression starting at -18dB:
  2365. @example
  2366. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2367. @end example
  2368. @item
  2369. 3:1 compression starting at -15dB:
  2370. @example
  2371. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2372. @end example
  2373. @item
  2374. Compressor/Gate:
  2375. @example
  2376. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2377. @end example
  2378. @item
  2379. Expander:
  2380. @example
  2381. 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
  2382. @end example
  2383. @item
  2384. Hard limiter at -6dB:
  2385. @example
  2386. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2387. @end example
  2388. @item
  2389. Hard limiter at -12dB:
  2390. @example
  2391. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2392. @end example
  2393. @item
  2394. Hard noise gate at -35 dB:
  2395. @example
  2396. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2397. @end example
  2398. @item
  2399. Soft limiter:
  2400. @example
  2401. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2402. @end example
  2403. @end itemize
  2404. @section compensationdelay
  2405. Compensation Delay Line is a metric based delay to compensate differing
  2406. positions of microphones or speakers.
  2407. For example, you have recorded guitar with two microphones placed in
  2408. different locations. Because the front of sound wave has fixed speed in
  2409. normal conditions, the phasing of microphones can vary and depends on
  2410. their location and interposition. The best sound mix can be achieved when
  2411. these microphones are in phase (synchronized). Note that a distance of
  2412. ~30 cm between microphones makes one microphone capture the signal in
  2413. antiphase to the other microphone. That makes the final mix sound moody.
  2414. This filter helps to solve phasing problems by adding different delays
  2415. to each microphone track and make them synchronized.
  2416. The best result can be reached when you take one track as base and
  2417. synchronize other tracks one by one with it.
  2418. Remember that synchronization/delay tolerance depends on sample rate, too.
  2419. Higher sample rates will give more tolerance.
  2420. The filter accepts the following parameters:
  2421. @table @option
  2422. @item mm
  2423. Set millimeters distance. This is compensation distance for fine tuning.
  2424. Default is 0.
  2425. @item cm
  2426. Set cm distance. This is compensation distance for tightening distance setup.
  2427. Default is 0.
  2428. @item m
  2429. Set meters distance. This is compensation distance for hard distance setup.
  2430. Default is 0.
  2431. @item dry
  2432. Set dry amount. Amount of unprocessed (dry) signal.
  2433. Default is 0.
  2434. @item wet
  2435. Set wet amount. Amount of processed (wet) signal.
  2436. Default is 1.
  2437. @item temp
  2438. Set temperature in degrees Celsius. This is the temperature of the environment.
  2439. Default is 20.
  2440. @end table
  2441. @section crossfeed
  2442. Apply headphone crossfeed filter.
  2443. Crossfeed is the process of blending the left and right channels of stereo
  2444. audio recording.
  2445. It is mainly used to reduce extreme stereo separation of low frequencies.
  2446. The intent is to produce more speaker like sound to the listener.
  2447. The filter accepts the following options:
  2448. @table @option
  2449. @item strength
  2450. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2451. This sets gain of low shelf filter for side part of stereo image.
  2452. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2453. @item range
  2454. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2455. This sets cut off frequency of low shelf filter. Default is cut off near
  2456. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2457. @item level_in
  2458. Set input gain. Default is 0.9.
  2459. @item level_out
  2460. Set output gain. Default is 1.
  2461. @end table
  2462. @section crystalizer
  2463. Simple algorithm to expand audio dynamic range.
  2464. The filter accepts the following options:
  2465. @table @option
  2466. @item i
  2467. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2468. (unchanged sound) to 10.0 (maximum effect).
  2469. @item c
  2470. Enable clipping. By default is enabled.
  2471. @end table
  2472. @subsection Commands
  2473. This filter supports the all above options as @ref{commands}.
  2474. @section dcshift
  2475. Apply a DC shift to the audio.
  2476. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2477. in the recording chain) from the audio. The effect of a DC offset is reduced
  2478. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2479. a signal has a DC offset.
  2480. @table @option
  2481. @item shift
  2482. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2483. the audio.
  2484. @item limitergain
  2485. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2486. used to prevent clipping.
  2487. @end table
  2488. @section deesser
  2489. Apply de-essing to the audio samples.
  2490. @table @option
  2491. @item i
  2492. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2493. Default is 0.
  2494. @item m
  2495. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2496. Default is 0.5.
  2497. @item f
  2498. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2499. Default is 0.5.
  2500. @item s
  2501. Set the output mode.
  2502. It accepts the following values:
  2503. @table @option
  2504. @item i
  2505. Pass input unchanged.
  2506. @item o
  2507. Pass ess filtered out.
  2508. @item e
  2509. Pass only ess.
  2510. Default value is @var{o}.
  2511. @end table
  2512. @end table
  2513. @section drmeter
  2514. Measure audio dynamic range.
  2515. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2516. is found in transition material. And anything less that 8 have very poor dynamics
  2517. and is very compressed.
  2518. The filter accepts the following options:
  2519. @table @option
  2520. @item length
  2521. Set window length in seconds used to split audio into segments of equal length.
  2522. Default is 3 seconds.
  2523. @end table
  2524. @section dynaudnorm
  2525. Dynamic Audio Normalizer.
  2526. This filter applies a certain amount of gain to the input audio in order
  2527. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2528. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2529. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2530. This allows for applying extra gain to the "quiet" sections of the audio
  2531. while avoiding distortions or clipping the "loud" sections. In other words:
  2532. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2533. sections, in the sense that the volume of each section is brought to the
  2534. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2535. this goal *without* applying "dynamic range compressing". It will retain 100%
  2536. of the dynamic range *within* each section of the audio file.
  2537. @table @option
  2538. @item framelen, f
  2539. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2540. Default is 500 milliseconds.
  2541. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2542. referred to as frames. This is required, because a peak magnitude has no
  2543. meaning for just a single sample value. Instead, we need to determine the
  2544. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2545. normalizer would simply use the peak magnitude of the complete file, the
  2546. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2547. frame. The length of a frame is specified in milliseconds. By default, the
  2548. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2549. been found to give good results with most files.
  2550. Note that the exact frame length, in number of samples, will be determined
  2551. automatically, based on the sampling rate of the individual input audio file.
  2552. @item gausssize, g
  2553. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2554. number. Default is 31.
  2555. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2556. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2557. is specified in frames, centered around the current frame. For the sake of
  2558. simplicity, this must be an odd number. Consequently, the default value of 31
  2559. takes into account the current frame, as well as the 15 preceding frames and
  2560. the 15 subsequent frames. Using a larger window results in a stronger
  2561. smoothing effect and thus in less gain variation, i.e. slower gain
  2562. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2563. effect and thus in more gain variation, i.e. faster gain adaptation.
  2564. In other words, the more you increase this value, the more the Dynamic Audio
  2565. Normalizer will behave like a "traditional" normalization filter. On the
  2566. contrary, the more you decrease this value, the more the Dynamic Audio
  2567. Normalizer will behave like a dynamic range compressor.
  2568. @item peak, p
  2569. Set the target peak value. This specifies the highest permissible magnitude
  2570. level for the normalized audio input. This filter will try to approach the
  2571. target peak magnitude as closely as possible, but at the same time it also
  2572. makes sure that the normalized signal will never exceed the peak magnitude.
  2573. A frame's maximum local gain factor is imposed directly by the target peak
  2574. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2575. It is not recommended to go above this value.
  2576. @item maxgain, m
  2577. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2578. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2579. factor for each input frame, i.e. the maximum gain factor that does not
  2580. result in clipping or distortion. The maximum gain factor is determined by
  2581. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2582. additionally bounds the frame's maximum gain factor by a predetermined
  2583. (global) maximum gain factor. This is done in order to avoid excessive gain
  2584. factors in "silent" or almost silent frames. By default, the maximum gain
  2585. factor is 10.0, For most inputs the default value should be sufficient and
  2586. it usually is not recommended to increase this value. Though, for input
  2587. with an extremely low overall volume level, it may be necessary to allow even
  2588. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2589. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2590. Instead, a "sigmoid" threshold function will be applied. This way, the
  2591. gain factors will smoothly approach the threshold value, but never exceed that
  2592. value.
  2593. @item targetrms, r
  2594. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2595. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2596. This means that the maximum local gain factor for each frame is defined
  2597. (only) by the frame's highest magnitude sample. This way, the samples can
  2598. be amplified as much as possible without exceeding the maximum signal
  2599. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2600. Normalizer can also take into account the frame's root mean square,
  2601. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2602. determine the power of a time-varying signal. It is therefore considered
  2603. that the RMS is a better approximation of the "perceived loudness" than
  2604. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2605. frames to a constant RMS value, a uniform "perceived loudness" can be
  2606. established. If a target RMS value has been specified, a frame's local gain
  2607. factor is defined as the factor that would result in exactly that RMS value.
  2608. Note, however, that the maximum local gain factor is still restricted by the
  2609. frame's highest magnitude sample, in order to prevent clipping.
  2610. @item coupling, n
  2611. Enable channels coupling. By default is enabled.
  2612. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2613. amount. This means the same gain factor will be applied to all channels, i.e.
  2614. the maximum possible gain factor is determined by the "loudest" channel.
  2615. However, in some recordings, it may happen that the volume of the different
  2616. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2617. In this case, this option can be used to disable the channel coupling. This way,
  2618. the gain factor will be determined independently for each channel, depending
  2619. only on the individual channel's highest magnitude sample. This allows for
  2620. harmonizing the volume of the different channels.
  2621. @item correctdc, c
  2622. Enable DC bias correction. By default is disabled.
  2623. An audio signal (in the time domain) is a sequence of sample values.
  2624. In the Dynamic Audio Normalizer these sample values are represented in the
  2625. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2626. audio signal, or "waveform", should be centered around the zero point.
  2627. That means if we calculate the mean value of all samples in a file, or in a
  2628. single frame, then the result should be 0.0 or at least very close to that
  2629. value. If, however, there is a significant deviation of the mean value from
  2630. 0.0, in either positive or negative direction, this is referred to as a
  2631. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2632. Audio Normalizer provides optional DC bias correction.
  2633. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2634. the mean value, or "DC correction" offset, of each input frame and subtract
  2635. that value from all of the frame's sample values which ensures those samples
  2636. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2637. boundaries, the DC correction offset values will be interpolated smoothly
  2638. between neighbouring frames.
  2639. @item altboundary, b
  2640. Enable alternative boundary mode. By default is disabled.
  2641. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2642. around each frame. This includes the preceding frames as well as the
  2643. subsequent frames. However, for the "boundary" frames, located at the very
  2644. beginning and at the very end of the audio file, not all neighbouring
  2645. frames are available. In particular, for the first few frames in the audio
  2646. file, the preceding frames are not known. And, similarly, for the last few
  2647. frames in the audio file, the subsequent frames are not known. Thus, the
  2648. question arises which gain factors should be assumed for the missing frames
  2649. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2650. to deal with this situation. The default boundary mode assumes a gain factor
  2651. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2652. "fade out" at the beginning and at the end of the input, respectively.
  2653. @item compress, s
  2654. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2655. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2656. compression. This means that signal peaks will not be pruned and thus the
  2657. full dynamic range will be retained within each local neighbourhood. However,
  2658. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2659. normalization algorithm with a more "traditional" compression.
  2660. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2661. (thresholding) function. If (and only if) the compression feature is enabled,
  2662. all input frames will be processed by a soft knee thresholding function prior
  2663. to the actual normalization process. Put simply, the thresholding function is
  2664. going to prune all samples whose magnitude exceeds a certain threshold value.
  2665. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2666. value. Instead, the threshold value will be adjusted for each individual
  2667. frame.
  2668. In general, smaller parameters result in stronger compression, and vice versa.
  2669. Values below 3.0 are not recommended, because audible distortion may appear.
  2670. @item threshold, t
  2671. Set the target threshold value. This specifies the lowest permissible
  2672. magnitude level for the audio input which will be normalized.
  2673. If input frame volume is above this value frame will be normalized.
  2674. Otherwise frame may not be normalized at all. The default value is set
  2675. to 0, which means all input frames will be normalized.
  2676. This option is mostly useful if digital noise is not wanted to be amplified.
  2677. @end table
  2678. @subsection Commands
  2679. This filter supports the all above options as @ref{commands}.
  2680. @section earwax
  2681. Make audio easier to listen to on headphones.
  2682. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2683. so that when listened to on headphones the stereo image is moved from
  2684. inside your head (standard for headphones) to outside and in front of
  2685. the listener (standard for speakers).
  2686. Ported from SoX.
  2687. @section equalizer
  2688. Apply a two-pole peaking equalisation (EQ) filter. With this
  2689. filter, the signal-level at and around a selected frequency can
  2690. be increased or decreased, whilst (unlike bandpass and bandreject
  2691. filters) that at all other frequencies is unchanged.
  2692. In order to produce complex equalisation curves, this filter can
  2693. be given several times, each with a different central frequency.
  2694. The filter accepts the following options:
  2695. @table @option
  2696. @item frequency, f
  2697. Set the filter's central frequency in Hz.
  2698. @item width_type, t
  2699. Set method to specify band-width of filter.
  2700. @table @option
  2701. @item h
  2702. Hz
  2703. @item q
  2704. Q-Factor
  2705. @item o
  2706. octave
  2707. @item s
  2708. slope
  2709. @item k
  2710. kHz
  2711. @end table
  2712. @item width, w
  2713. Specify the band-width of a filter in width_type units.
  2714. @item gain, g
  2715. Set the required gain or attenuation in dB.
  2716. Beware of clipping when using a positive gain.
  2717. @item mix, m
  2718. How much to use filtered signal in output. Default is 1.
  2719. Range is between 0 and 1.
  2720. @item channels, c
  2721. Specify which channels to filter, by default all available are filtered.
  2722. @item normalize, n
  2723. Normalize biquad coefficients, by default is disabled.
  2724. Enabling it will normalize magnitude response at DC to 0dB.
  2725. @end table
  2726. @subsection Examples
  2727. @itemize
  2728. @item
  2729. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2730. @example
  2731. equalizer=f=1000:t=h:width=200:g=-10
  2732. @end example
  2733. @item
  2734. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2735. @example
  2736. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2737. @end example
  2738. @end itemize
  2739. @subsection Commands
  2740. This filter supports the following commands:
  2741. @table @option
  2742. @item frequency, f
  2743. Change equalizer frequency.
  2744. Syntax for the command is : "@var{frequency}"
  2745. @item width_type, t
  2746. Change equalizer width_type.
  2747. Syntax for the command is : "@var{width_type}"
  2748. @item width, w
  2749. Change equalizer width.
  2750. Syntax for the command is : "@var{width}"
  2751. @item gain, g
  2752. Change equalizer gain.
  2753. Syntax for the command is : "@var{gain}"
  2754. @item mix, m
  2755. Change equalizer mix.
  2756. Syntax for the command is : "@var{mix}"
  2757. @end table
  2758. @section extrastereo
  2759. Linearly increases the difference between left and right channels which
  2760. adds some sort of "live" effect to playback.
  2761. The filter accepts the following options:
  2762. @table @option
  2763. @item m
  2764. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2765. (average of both channels), with 1.0 sound will be unchanged, with
  2766. -1.0 left and right channels will be swapped.
  2767. @item c
  2768. Enable clipping. By default is enabled.
  2769. @end table
  2770. @subsection Commands
  2771. This filter supports the all above options as @ref{commands}.
  2772. @section firequalizer
  2773. Apply FIR Equalization using arbitrary frequency response.
  2774. The filter accepts the following option:
  2775. @table @option
  2776. @item gain
  2777. Set gain curve equation (in dB). The expression can contain variables:
  2778. @table @option
  2779. @item f
  2780. the evaluated frequency
  2781. @item sr
  2782. sample rate
  2783. @item ch
  2784. channel number, set to 0 when multichannels evaluation is disabled
  2785. @item chid
  2786. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2787. multichannels evaluation is disabled
  2788. @item chs
  2789. number of channels
  2790. @item chlayout
  2791. channel_layout, see libavutil/channel_layout.h
  2792. @end table
  2793. and functions:
  2794. @table @option
  2795. @item gain_interpolate(f)
  2796. interpolate gain on frequency f based on gain_entry
  2797. @item cubic_interpolate(f)
  2798. same as gain_interpolate, but smoother
  2799. @end table
  2800. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2801. @item gain_entry
  2802. Set gain entry for gain_interpolate function. The expression can
  2803. contain functions:
  2804. @table @option
  2805. @item entry(f, g)
  2806. store gain entry at frequency f with value g
  2807. @end table
  2808. This option is also available as command.
  2809. @item delay
  2810. Set filter delay in seconds. Higher value means more accurate.
  2811. Default is @code{0.01}.
  2812. @item accuracy
  2813. Set filter accuracy in Hz. Lower value means more accurate.
  2814. Default is @code{5}.
  2815. @item wfunc
  2816. Set window function. Acceptable values are:
  2817. @table @option
  2818. @item rectangular
  2819. rectangular window, useful when gain curve is already smooth
  2820. @item hann
  2821. hann window (default)
  2822. @item hamming
  2823. hamming window
  2824. @item blackman
  2825. blackman window
  2826. @item nuttall3
  2827. 3-terms continuous 1st derivative nuttall window
  2828. @item mnuttall3
  2829. minimum 3-terms discontinuous nuttall window
  2830. @item nuttall
  2831. 4-terms continuous 1st derivative nuttall window
  2832. @item bnuttall
  2833. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2834. @item bharris
  2835. blackman-harris window
  2836. @item tukey
  2837. tukey window
  2838. @end table
  2839. @item fixed
  2840. If enabled, use fixed number of audio samples. This improves speed when
  2841. filtering with large delay. Default is disabled.
  2842. @item multi
  2843. Enable multichannels evaluation on gain. Default is disabled.
  2844. @item zero_phase
  2845. Enable zero phase mode by subtracting timestamp to compensate delay.
  2846. Default is disabled.
  2847. @item scale
  2848. Set scale used by gain. Acceptable values are:
  2849. @table @option
  2850. @item linlin
  2851. linear frequency, linear gain
  2852. @item linlog
  2853. linear frequency, logarithmic (in dB) gain (default)
  2854. @item loglin
  2855. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2856. @item loglog
  2857. logarithmic frequency, logarithmic gain
  2858. @end table
  2859. @item dumpfile
  2860. Set file for dumping, suitable for gnuplot.
  2861. @item dumpscale
  2862. Set scale for dumpfile. Acceptable values are same with scale option.
  2863. Default is linlog.
  2864. @item fft2
  2865. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2866. Default is disabled.
  2867. @item min_phase
  2868. Enable minimum phase impulse response. Default is disabled.
  2869. @end table
  2870. @subsection Examples
  2871. @itemize
  2872. @item
  2873. lowpass at 1000 Hz:
  2874. @example
  2875. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2876. @end example
  2877. @item
  2878. lowpass at 1000 Hz with gain_entry:
  2879. @example
  2880. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2881. @end example
  2882. @item
  2883. custom equalization:
  2884. @example
  2885. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2886. @end example
  2887. @item
  2888. higher delay with zero phase to compensate delay:
  2889. @example
  2890. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2891. @end example
  2892. @item
  2893. lowpass on left channel, highpass on right channel:
  2894. @example
  2895. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2896. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2897. @end example
  2898. @end itemize
  2899. @section flanger
  2900. Apply a flanging effect to the audio.
  2901. The filter accepts the following options:
  2902. @table @option
  2903. @item delay
  2904. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2905. @item depth
  2906. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2907. @item regen
  2908. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2909. Default value is 0.
  2910. @item width
  2911. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2912. Default value is 71.
  2913. @item speed
  2914. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2915. @item shape
  2916. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2917. Default value is @var{sinusoidal}.
  2918. @item phase
  2919. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2920. Default value is 25.
  2921. @item interp
  2922. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2923. Default is @var{linear}.
  2924. @end table
  2925. @section haas
  2926. Apply Haas effect to audio.
  2927. Note that this makes most sense to apply on mono signals.
  2928. With this filter applied to mono signals it give some directionality and
  2929. stretches its stereo image.
  2930. The filter accepts the following options:
  2931. @table @option
  2932. @item level_in
  2933. Set input level. By default is @var{1}, or 0dB
  2934. @item level_out
  2935. Set output level. By default is @var{1}, or 0dB.
  2936. @item side_gain
  2937. Set gain applied to side part of signal. By default is @var{1}.
  2938. @item middle_source
  2939. Set kind of middle source. Can be one of the following:
  2940. @table @samp
  2941. @item left
  2942. Pick left channel.
  2943. @item right
  2944. Pick right channel.
  2945. @item mid
  2946. Pick middle part signal of stereo image.
  2947. @item side
  2948. Pick side part signal of stereo image.
  2949. @end table
  2950. @item middle_phase
  2951. Change middle phase. By default is disabled.
  2952. @item left_delay
  2953. Set left channel delay. By default is @var{2.05} milliseconds.
  2954. @item left_balance
  2955. Set left channel balance. By default is @var{-1}.
  2956. @item left_gain
  2957. Set left channel gain. By default is @var{1}.
  2958. @item left_phase
  2959. Change left phase. By default is disabled.
  2960. @item right_delay
  2961. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2962. @item right_balance
  2963. Set right channel balance. By default is @var{1}.
  2964. @item right_gain
  2965. Set right channel gain. By default is @var{1}.
  2966. @item right_phase
  2967. Change right phase. By default is enabled.
  2968. @end table
  2969. @section hdcd
  2970. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2971. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2972. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2973. of HDCD, and detects the Transient Filter flag.
  2974. @example
  2975. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2976. @end example
  2977. When using the filter with wav, note the default encoding for wav is 16-bit,
  2978. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2979. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2980. @example
  2981. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2982. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2983. @end example
  2984. The filter accepts the following options:
  2985. @table @option
  2986. @item disable_autoconvert
  2987. Disable any automatic format conversion or resampling in the filter graph.
  2988. @item process_stereo
  2989. Process the stereo channels together. If target_gain does not match between
  2990. channels, consider it invalid and use the last valid target_gain.
  2991. @item cdt_ms
  2992. Set the code detect timer period in ms.
  2993. @item force_pe
  2994. Always extend peaks above -3dBFS even if PE isn't signaled.
  2995. @item analyze_mode
  2996. Replace audio with a solid tone and adjust the amplitude to signal some
  2997. specific aspect of the decoding process. The output file can be loaded in
  2998. an audio editor alongside the original to aid analysis.
  2999. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  3000. Modes are:
  3001. @table @samp
  3002. @item 0, off
  3003. Disabled
  3004. @item 1, lle
  3005. Gain adjustment level at each sample
  3006. @item 2, pe
  3007. Samples where peak extend occurs
  3008. @item 3, cdt
  3009. Samples where the code detect timer is active
  3010. @item 4, tgm
  3011. Samples where the target gain does not match between channels
  3012. @end table
  3013. @end table
  3014. @section headphone
  3015. Apply head-related transfer functions (HRTFs) to create virtual
  3016. loudspeakers around the user for binaural listening via headphones.
  3017. The HRIRs are provided via additional streams, for each channel
  3018. one stereo input stream is needed.
  3019. The filter accepts the following options:
  3020. @table @option
  3021. @item map
  3022. Set mapping of input streams for convolution.
  3023. The argument is a '|'-separated list of channel names in order as they
  3024. are given as additional stream inputs for filter.
  3025. This also specify number of input streams. Number of input streams
  3026. must be not less than number of channels in first stream plus one.
  3027. @item gain
  3028. Set gain applied to audio. Value is in dB. Default is 0.
  3029. @item type
  3030. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3031. processing audio in time domain which is slow.
  3032. @var{freq} is processing audio in frequency domain which is fast.
  3033. Default is @var{freq}.
  3034. @item lfe
  3035. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3036. @item size
  3037. Set size of frame in number of samples which will be processed at once.
  3038. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  3039. @item hrir
  3040. Set format of hrir stream.
  3041. Default value is @var{stereo}. Alternative value is @var{multich}.
  3042. If value is set to @var{stereo}, number of additional streams should
  3043. be greater or equal to number of input channels in first input stream.
  3044. Also each additional stream should have stereo number of channels.
  3045. If value is set to @var{multich}, number of additional streams should
  3046. be exactly one. Also number of input channels of additional stream
  3047. should be equal or greater than twice number of channels of first input
  3048. stream.
  3049. @end table
  3050. @subsection Examples
  3051. @itemize
  3052. @item
  3053. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3054. each amovie filter use stereo file with IR coefficients as input.
  3055. The files give coefficients for each position of virtual loudspeaker:
  3056. @example
  3057. ffmpeg -i input.wav
  3058. -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"
  3059. output.wav
  3060. @end example
  3061. @item
  3062. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3063. but now in @var{multich} @var{hrir} format.
  3064. @example
  3065. 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"
  3066. output.wav
  3067. @end example
  3068. @end itemize
  3069. @section highpass
  3070. Apply a high-pass filter with 3dB point frequency.
  3071. The filter can be either single-pole, or double-pole (the default).
  3072. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3073. The filter accepts the following options:
  3074. @table @option
  3075. @item frequency, f
  3076. Set frequency in Hz. Default is 3000.
  3077. @item poles, p
  3078. Set number of poles. Default is 2.
  3079. @item width_type, t
  3080. Set method to specify band-width of filter.
  3081. @table @option
  3082. @item h
  3083. Hz
  3084. @item q
  3085. Q-Factor
  3086. @item o
  3087. octave
  3088. @item s
  3089. slope
  3090. @item k
  3091. kHz
  3092. @end table
  3093. @item width, w
  3094. Specify the band-width of a filter in width_type units.
  3095. Applies only to double-pole filter.
  3096. The default is 0.707q and gives a Butterworth response.
  3097. @item mix, m
  3098. How much to use filtered signal in output. Default is 1.
  3099. Range is between 0 and 1.
  3100. @item channels, c
  3101. Specify which channels to filter, by default all available are filtered.
  3102. @item normalize, n
  3103. Normalize biquad coefficients, by default is disabled.
  3104. Enabling it will normalize magnitude response at DC to 0dB.
  3105. @end table
  3106. @subsection Commands
  3107. This filter supports the following commands:
  3108. @table @option
  3109. @item frequency, f
  3110. Change highpass frequency.
  3111. Syntax for the command is : "@var{frequency}"
  3112. @item width_type, t
  3113. Change highpass width_type.
  3114. Syntax for the command is : "@var{width_type}"
  3115. @item width, w
  3116. Change highpass width.
  3117. Syntax for the command is : "@var{width}"
  3118. @item mix, m
  3119. Change highpass mix.
  3120. Syntax for the command is : "@var{mix}"
  3121. @end table
  3122. @section join
  3123. Join multiple input streams into one multi-channel stream.
  3124. It accepts the following parameters:
  3125. @table @option
  3126. @item inputs
  3127. The number of input streams. It defaults to 2.
  3128. @item channel_layout
  3129. The desired output channel layout. It defaults to stereo.
  3130. @item map
  3131. Map channels from inputs to output. The argument is a '|'-separated list of
  3132. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3133. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3134. can be either the name of the input channel (e.g. FL for front left) or its
  3135. index in the specified input stream. @var{out_channel} is the name of the output
  3136. channel.
  3137. @end table
  3138. The filter will attempt to guess the mappings when they are not specified
  3139. explicitly. It does so by first trying to find an unused matching input channel
  3140. and if that fails it picks the first unused input channel.
  3141. Join 3 inputs (with properly set channel layouts):
  3142. @example
  3143. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3144. @end example
  3145. Build a 5.1 output from 6 single-channel streams:
  3146. @example
  3147. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3148. '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'
  3149. out
  3150. @end example
  3151. @section ladspa
  3152. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3153. To enable compilation of this filter you need to configure FFmpeg with
  3154. @code{--enable-ladspa}.
  3155. @table @option
  3156. @item file, f
  3157. Specifies the name of LADSPA plugin library to load. If the environment
  3158. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3159. each one of the directories specified by the colon separated list in
  3160. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3161. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3162. @file{/usr/lib/ladspa/}.
  3163. @item plugin, p
  3164. Specifies the plugin within the library. Some libraries contain only
  3165. one plugin, but others contain many of them. If this is not set filter
  3166. will list all available plugins within the specified library.
  3167. @item controls, c
  3168. Set the '|' separated list of controls which are zero or more floating point
  3169. values that determine the behavior of the loaded plugin (for example delay,
  3170. threshold or gain).
  3171. Controls need to be defined using the following syntax:
  3172. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3173. @var{valuei} is the value set on the @var{i}-th control.
  3174. Alternatively they can be also defined using the following syntax:
  3175. @var{value0}|@var{value1}|@var{value2}|..., where
  3176. @var{valuei} is the value set on the @var{i}-th control.
  3177. If @option{controls} is set to @code{help}, all available controls and
  3178. their valid ranges are printed.
  3179. @item sample_rate, s
  3180. Specify the sample rate, default to 44100. Only used if plugin have
  3181. zero inputs.
  3182. @item nb_samples, n
  3183. Set the number of samples per channel per each output frame, default
  3184. is 1024. Only used if plugin have zero inputs.
  3185. @item duration, d
  3186. Set the minimum duration of the sourced audio. See
  3187. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3188. for the accepted syntax.
  3189. Note that the resulting duration may be greater than the specified duration,
  3190. as the generated audio is always cut at the end of a complete frame.
  3191. If not specified, or the expressed duration is negative, the audio is
  3192. supposed to be generated forever.
  3193. Only used if plugin have zero inputs.
  3194. @end table
  3195. @subsection Examples
  3196. @itemize
  3197. @item
  3198. List all available plugins within amp (LADSPA example plugin) library:
  3199. @example
  3200. ladspa=file=amp
  3201. @end example
  3202. @item
  3203. List all available controls and their valid ranges for @code{vcf_notch}
  3204. plugin from @code{VCF} library:
  3205. @example
  3206. ladspa=f=vcf:p=vcf_notch:c=help
  3207. @end example
  3208. @item
  3209. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3210. plugin library:
  3211. @example
  3212. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3213. @end example
  3214. @item
  3215. Add reverberation to the audio using TAP-plugins
  3216. (Tom's Audio Processing plugins):
  3217. @example
  3218. ladspa=file=tap_reverb:tap_reverb
  3219. @end example
  3220. @item
  3221. Generate white noise, with 0.2 amplitude:
  3222. @example
  3223. ladspa=file=cmt:noise_source_white:c=c0=.2
  3224. @end example
  3225. @item
  3226. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3227. @code{C* Audio Plugin Suite} (CAPS) library:
  3228. @example
  3229. ladspa=file=caps:Click:c=c1=20'
  3230. @end example
  3231. @item
  3232. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3233. @example
  3234. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3235. @end example
  3236. @item
  3237. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3238. @code{SWH Plugins} collection:
  3239. @example
  3240. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3241. @end example
  3242. @item
  3243. Attenuate low frequencies using Multiband EQ from Steve Harris
  3244. @code{SWH Plugins} collection:
  3245. @example
  3246. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3247. @end example
  3248. @item
  3249. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3250. (CAPS) library:
  3251. @example
  3252. ladspa=caps:Narrower
  3253. @end example
  3254. @item
  3255. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3256. @example
  3257. ladspa=caps:White:.2
  3258. @end example
  3259. @item
  3260. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3261. @example
  3262. ladspa=caps:Fractal:c=c1=1
  3263. @end example
  3264. @item
  3265. Dynamic volume normalization using @code{VLevel} plugin:
  3266. @example
  3267. ladspa=vlevel-ladspa:vlevel_mono
  3268. @end example
  3269. @end itemize
  3270. @subsection Commands
  3271. This filter supports the following commands:
  3272. @table @option
  3273. @item cN
  3274. Modify the @var{N}-th control value.
  3275. If the specified value is not valid, it is ignored and prior one is kept.
  3276. @end table
  3277. @section loudnorm
  3278. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3279. Support for both single pass (livestreams, files) and double pass (files) modes.
  3280. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  3281. detect true peaks, the audio stream will be upsampled to 192 kHz.
  3282. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3283. The filter accepts the following options:
  3284. @table @option
  3285. @item I, i
  3286. Set integrated loudness target.
  3287. Range is -70.0 - -5.0. Default value is -24.0.
  3288. @item LRA, lra
  3289. Set loudness range target.
  3290. Range is 1.0 - 20.0. Default value is 7.0.
  3291. @item TP, tp
  3292. Set maximum true peak.
  3293. Range is -9.0 - +0.0. Default value is -2.0.
  3294. @item measured_I, measured_i
  3295. Measured IL of input file.
  3296. Range is -99.0 - +0.0.
  3297. @item measured_LRA, measured_lra
  3298. Measured LRA of input file.
  3299. Range is 0.0 - 99.0.
  3300. @item measured_TP, measured_tp
  3301. Measured true peak of input file.
  3302. Range is -99.0 - +99.0.
  3303. @item measured_thresh
  3304. Measured threshold of input file.
  3305. Range is -99.0 - +0.0.
  3306. @item offset
  3307. Set offset gain. Gain is applied before the true-peak limiter.
  3308. Range is -99.0 - +99.0. Default is +0.0.
  3309. @item linear
  3310. Normalize by linearly scaling the source audio.
  3311. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  3312. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  3313. be lower than source LRA and the change in integrated loudness shouldn't
  3314. result in a true peak which exceeds the target TP. If any of these
  3315. conditions aren't met, normalization mode will revert to @var{dynamic}.
  3316. Options are @code{true} or @code{false}. Default is @code{true}.
  3317. @item dual_mono
  3318. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3319. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3320. If set to @code{true}, this option will compensate for this effect.
  3321. Multi-channel input files are not affected by this option.
  3322. Options are true or false. Default is false.
  3323. @item print_format
  3324. Set print format for stats. Options are summary, json, or none.
  3325. Default value is none.
  3326. @end table
  3327. @section lowpass
  3328. Apply a low-pass filter with 3dB point frequency.
  3329. The filter can be either single-pole or double-pole (the default).
  3330. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3331. The filter accepts the following options:
  3332. @table @option
  3333. @item frequency, f
  3334. Set frequency in Hz. Default is 500.
  3335. @item poles, p
  3336. Set number of poles. Default is 2.
  3337. @item width_type, t
  3338. Set method to specify band-width of filter.
  3339. @table @option
  3340. @item h
  3341. Hz
  3342. @item q
  3343. Q-Factor
  3344. @item o
  3345. octave
  3346. @item s
  3347. slope
  3348. @item k
  3349. kHz
  3350. @end table
  3351. @item width, w
  3352. Specify the band-width of a filter in width_type units.
  3353. Applies only to double-pole filter.
  3354. The default is 0.707q and gives a Butterworth response.
  3355. @item mix, m
  3356. How much to use filtered signal in output. Default is 1.
  3357. Range is between 0 and 1.
  3358. @item channels, c
  3359. Specify which channels to filter, by default all available are filtered.
  3360. @item normalize, n
  3361. Normalize biquad coefficients, by default is disabled.
  3362. Enabling it will normalize magnitude response at DC to 0dB.
  3363. @end table
  3364. @subsection Examples
  3365. @itemize
  3366. @item
  3367. Lowpass only LFE channel, it LFE is not present it does nothing:
  3368. @example
  3369. lowpass=c=LFE
  3370. @end example
  3371. @end itemize
  3372. @subsection Commands
  3373. This filter supports the following commands:
  3374. @table @option
  3375. @item frequency, f
  3376. Change lowpass frequency.
  3377. Syntax for the command is : "@var{frequency}"
  3378. @item width_type, t
  3379. Change lowpass width_type.
  3380. Syntax for the command is : "@var{width_type}"
  3381. @item width, w
  3382. Change lowpass width.
  3383. Syntax for the command is : "@var{width}"
  3384. @item mix, m
  3385. Change lowpass mix.
  3386. Syntax for the command is : "@var{mix}"
  3387. @end table
  3388. @section lv2
  3389. Load a LV2 (LADSPA Version 2) plugin.
  3390. To enable compilation of this filter you need to configure FFmpeg with
  3391. @code{--enable-lv2}.
  3392. @table @option
  3393. @item plugin, p
  3394. Specifies the plugin URI. You may need to escape ':'.
  3395. @item controls, c
  3396. Set the '|' separated list of controls which are zero or more floating point
  3397. values that determine the behavior of the loaded plugin (for example delay,
  3398. threshold or gain).
  3399. If @option{controls} is set to @code{help}, all available controls and
  3400. their valid ranges are printed.
  3401. @item sample_rate, s
  3402. Specify the sample rate, default to 44100. Only used if plugin have
  3403. zero inputs.
  3404. @item nb_samples, n
  3405. Set the number of samples per channel per each output frame, default
  3406. is 1024. Only used if plugin have zero inputs.
  3407. @item duration, d
  3408. Set the minimum duration of the sourced audio. See
  3409. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3410. for the accepted syntax.
  3411. Note that the resulting duration may be greater than the specified duration,
  3412. as the generated audio is always cut at the end of a complete frame.
  3413. If not specified, or the expressed duration is negative, the audio is
  3414. supposed to be generated forever.
  3415. Only used if plugin have zero inputs.
  3416. @end table
  3417. @subsection Examples
  3418. @itemize
  3419. @item
  3420. Apply bass enhancer plugin from Calf:
  3421. @example
  3422. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3423. @end example
  3424. @item
  3425. Apply vinyl plugin from Calf:
  3426. @example
  3427. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3428. @end example
  3429. @item
  3430. Apply bit crusher plugin from ArtyFX:
  3431. @example
  3432. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3433. @end example
  3434. @end itemize
  3435. @section mcompand
  3436. Multiband Compress or expand the audio's dynamic range.
  3437. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3438. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3439. response when absent compander action.
  3440. It accepts the following parameters:
  3441. @table @option
  3442. @item args
  3443. This option syntax is:
  3444. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3445. For explanation of each item refer to compand filter documentation.
  3446. @end table
  3447. @anchor{pan}
  3448. @section pan
  3449. Mix channels with specific gain levels. The filter accepts the output
  3450. channel layout followed by a set of channels definitions.
  3451. This filter is also designed to efficiently remap the channels of an audio
  3452. stream.
  3453. The filter accepts parameters of the form:
  3454. "@var{l}|@var{outdef}|@var{outdef}|..."
  3455. @table @option
  3456. @item l
  3457. output channel layout or number of channels
  3458. @item outdef
  3459. output channel specification, of the form:
  3460. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3461. @item out_name
  3462. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3463. number (c0, c1, etc.)
  3464. @item gain
  3465. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3466. @item in_name
  3467. input channel to use, see out_name for details; it is not possible to mix
  3468. named and numbered input channels
  3469. @end table
  3470. If the `=' in a channel specification is replaced by `<', then the gains for
  3471. that specification will be renormalized so that the total is 1, thus
  3472. avoiding clipping noise.
  3473. @subsection Mixing examples
  3474. For example, if you want to down-mix from stereo to mono, but with a bigger
  3475. factor for the left channel:
  3476. @example
  3477. pan=1c|c0=0.9*c0+0.1*c1
  3478. @end example
  3479. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3480. 7-channels surround:
  3481. @example
  3482. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3483. @end example
  3484. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3485. that should be preferred (see "-ac" option) unless you have very specific
  3486. needs.
  3487. @subsection Remapping examples
  3488. The channel remapping will be effective if, and only if:
  3489. @itemize
  3490. @item gain coefficients are zeroes or ones,
  3491. @item only one input per channel output,
  3492. @end itemize
  3493. If all these conditions are satisfied, the filter will notify the user ("Pure
  3494. channel mapping detected"), and use an optimized and lossless method to do the
  3495. remapping.
  3496. For example, if you have a 5.1 source and want a stereo audio stream by
  3497. dropping the extra channels:
  3498. @example
  3499. pan="stereo| c0=FL | c1=FR"
  3500. @end example
  3501. Given the same source, you can also switch front left and front right channels
  3502. and keep the input channel layout:
  3503. @example
  3504. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3505. @end example
  3506. If the input is a stereo audio stream, you can mute the front left channel (and
  3507. still keep the stereo channel layout) with:
  3508. @example
  3509. pan="stereo|c1=c1"
  3510. @end example
  3511. Still with a stereo audio stream input, you can copy the right channel in both
  3512. front left and right:
  3513. @example
  3514. pan="stereo| c0=FR | c1=FR"
  3515. @end example
  3516. @section replaygain
  3517. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3518. outputs it unchanged.
  3519. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3520. @section resample
  3521. Convert the audio sample format, sample rate and channel layout. It is
  3522. not meant to be used directly.
  3523. @section rubberband
  3524. Apply time-stretching and pitch-shifting with librubberband.
  3525. To enable compilation of this filter, you need to configure FFmpeg with
  3526. @code{--enable-librubberband}.
  3527. The filter accepts the following options:
  3528. @table @option
  3529. @item tempo
  3530. Set tempo scale factor.
  3531. @item pitch
  3532. Set pitch scale factor.
  3533. @item transients
  3534. Set transients detector.
  3535. Possible values are:
  3536. @table @var
  3537. @item crisp
  3538. @item mixed
  3539. @item smooth
  3540. @end table
  3541. @item detector
  3542. Set detector.
  3543. Possible values are:
  3544. @table @var
  3545. @item compound
  3546. @item percussive
  3547. @item soft
  3548. @end table
  3549. @item phase
  3550. Set phase.
  3551. Possible values are:
  3552. @table @var
  3553. @item laminar
  3554. @item independent
  3555. @end table
  3556. @item window
  3557. Set processing window size.
  3558. Possible values are:
  3559. @table @var
  3560. @item standard
  3561. @item short
  3562. @item long
  3563. @end table
  3564. @item smoothing
  3565. Set smoothing.
  3566. Possible values are:
  3567. @table @var
  3568. @item off
  3569. @item on
  3570. @end table
  3571. @item formant
  3572. Enable formant preservation when shift pitching.
  3573. Possible values are:
  3574. @table @var
  3575. @item shifted
  3576. @item preserved
  3577. @end table
  3578. @item pitchq
  3579. Set pitch quality.
  3580. Possible values are:
  3581. @table @var
  3582. @item quality
  3583. @item speed
  3584. @item consistency
  3585. @end table
  3586. @item channels
  3587. Set channels.
  3588. Possible values are:
  3589. @table @var
  3590. @item apart
  3591. @item together
  3592. @end table
  3593. @end table
  3594. @subsection Commands
  3595. This filter supports the following commands:
  3596. @table @option
  3597. @item tempo
  3598. Change filter tempo scale factor.
  3599. Syntax for the command is : "@var{tempo}"
  3600. @item pitch
  3601. Change filter pitch scale factor.
  3602. Syntax for the command is : "@var{pitch}"
  3603. @end table
  3604. @section sidechaincompress
  3605. This filter acts like normal compressor but has the ability to compress
  3606. detected signal using second input signal.
  3607. It needs two input streams and returns one output stream.
  3608. First input stream will be processed depending on second stream signal.
  3609. The filtered signal then can be filtered with other filters in later stages of
  3610. processing. See @ref{pan} and @ref{amerge} filter.
  3611. The filter accepts the following options:
  3612. @table @option
  3613. @item level_in
  3614. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3615. @item mode
  3616. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3617. Default is @code{downward}.
  3618. @item threshold
  3619. If a signal of second stream raises above this level it will affect the gain
  3620. reduction of first stream.
  3621. By default is 0.125. Range is between 0.00097563 and 1.
  3622. @item ratio
  3623. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3624. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3625. Default is 2. Range is between 1 and 20.
  3626. @item attack
  3627. Amount of milliseconds the signal has to rise above the threshold before gain
  3628. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3629. @item release
  3630. Amount of milliseconds the signal has to fall below the threshold before
  3631. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3632. @item makeup
  3633. Set the amount by how much signal will be amplified after processing.
  3634. Default is 1. Range is from 1 to 64.
  3635. @item knee
  3636. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3637. Default is 2.82843. Range is between 1 and 8.
  3638. @item link
  3639. Choose if the @code{average} level between all channels of side-chain stream
  3640. or the louder(@code{maximum}) channel of side-chain stream affects the
  3641. reduction. Default is @code{average}.
  3642. @item detection
  3643. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3644. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3645. @item level_sc
  3646. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3647. @item mix
  3648. How much to use compressed signal in output. Default is 1.
  3649. Range is between 0 and 1.
  3650. @end table
  3651. @subsection Commands
  3652. This filter supports the all above options as @ref{commands}.
  3653. @subsection Examples
  3654. @itemize
  3655. @item
  3656. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3657. depending on the signal of 2nd input and later compressed signal to be
  3658. merged with 2nd input:
  3659. @example
  3660. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3661. @end example
  3662. @end itemize
  3663. @section sidechaingate
  3664. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3665. filter the detected signal before sending it to the gain reduction stage.
  3666. Normally a gate uses the full range signal to detect a level above the
  3667. threshold.
  3668. For example: If you cut all lower frequencies from your sidechain signal
  3669. the gate will decrease the volume of your track only if not enough highs
  3670. appear. With this technique you are able to reduce the resonation of a
  3671. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3672. guitar.
  3673. It needs two input streams and returns one output stream.
  3674. First input stream will be processed depending on second stream signal.
  3675. The filter accepts the following options:
  3676. @table @option
  3677. @item level_in
  3678. Set input level before filtering.
  3679. Default is 1. Allowed range is from 0.015625 to 64.
  3680. @item mode
  3681. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3682. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3683. will be amplified, expanding dynamic range in upward direction.
  3684. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3685. @item range
  3686. Set the level of gain reduction when the signal is below the threshold.
  3687. Default is 0.06125. Allowed range is from 0 to 1.
  3688. Setting this to 0 disables reduction and then filter behaves like expander.
  3689. @item threshold
  3690. If a signal rises above this level the gain reduction is released.
  3691. Default is 0.125. Allowed range is from 0 to 1.
  3692. @item ratio
  3693. Set a ratio about which the signal is reduced.
  3694. Default is 2. Allowed range is from 1 to 9000.
  3695. @item attack
  3696. Amount of milliseconds the signal has to rise above the threshold before gain
  3697. reduction stops.
  3698. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3699. @item release
  3700. Amount of milliseconds the signal has to fall below the threshold before the
  3701. reduction is increased again. Default is 250 milliseconds.
  3702. Allowed range is from 0.01 to 9000.
  3703. @item makeup
  3704. Set amount of amplification of signal after processing.
  3705. Default is 1. Allowed range is from 1 to 64.
  3706. @item knee
  3707. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3708. Default is 2.828427125. Allowed range is from 1 to 8.
  3709. @item detection
  3710. Choose if exact signal should be taken for detection or an RMS like one.
  3711. Default is rms. Can be peak or rms.
  3712. @item link
  3713. Choose if the average level between all channels or the louder channel affects
  3714. the reduction.
  3715. Default is average. Can be average or maximum.
  3716. @item level_sc
  3717. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3718. @end table
  3719. @section silencedetect
  3720. Detect silence in an audio stream.
  3721. This filter logs a message when it detects that the input audio volume is less
  3722. or equal to a noise tolerance value for a duration greater or equal to the
  3723. minimum detected noise duration.
  3724. The printed times and duration are expressed in seconds. The
  3725. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  3726. is set on the first frame whose timestamp equals or exceeds the detection
  3727. duration and it contains the timestamp of the first frame of the silence.
  3728. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  3729. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  3730. keys are set on the first frame after the silence. If @option{mono} is
  3731. enabled, and each channel is evaluated separately, the @code{.X}
  3732. suffixed keys are used, and @code{X} corresponds to the channel number.
  3733. The filter accepts the following options:
  3734. @table @option
  3735. @item noise, n
  3736. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3737. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3738. @item duration, d
  3739. Set silence duration until notification (default is 2 seconds). See
  3740. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3741. for the accepted syntax.
  3742. @item mono, m
  3743. Process each channel separately, instead of combined. By default is disabled.
  3744. @end table
  3745. @subsection Examples
  3746. @itemize
  3747. @item
  3748. Detect 5 seconds of silence with -50dB noise tolerance:
  3749. @example
  3750. silencedetect=n=-50dB:d=5
  3751. @end example
  3752. @item
  3753. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3754. tolerance in @file{silence.mp3}:
  3755. @example
  3756. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3757. @end example
  3758. @end itemize
  3759. @section silenceremove
  3760. Remove silence from the beginning, middle or end of the audio.
  3761. The filter accepts the following options:
  3762. @table @option
  3763. @item start_periods
  3764. This value is used to indicate if audio should be trimmed at beginning of
  3765. the audio. A value of zero indicates no silence should be trimmed from the
  3766. beginning. When specifying a non-zero value, it trims audio up until it
  3767. finds non-silence. Normally, when trimming silence from beginning of audio
  3768. the @var{start_periods} will be @code{1} but it can be increased to higher
  3769. values to trim all audio up to specific count of non-silence periods.
  3770. Default value is @code{0}.
  3771. @item start_duration
  3772. Specify the amount of time that non-silence must be detected before it stops
  3773. trimming audio. By increasing the duration, bursts of noises can be treated
  3774. as silence and trimmed off. Default value is @code{0}.
  3775. @item start_threshold
  3776. This indicates what sample value should be treated as silence. For digital
  3777. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3778. you may wish to increase the value to account for background noise.
  3779. Can be specified in dB (in case "dB" is appended to the specified value)
  3780. or amplitude ratio. Default value is @code{0}.
  3781. @item start_silence
  3782. Specify max duration of silence at beginning that will be kept after
  3783. trimming. Default is 0, which is equal to trimming all samples detected
  3784. as silence.
  3785. @item start_mode
  3786. Specify mode of detection of silence end in start of multi-channel audio.
  3787. Can be @var{any} or @var{all}. Default is @var{any}.
  3788. With @var{any}, any sample that is detected as non-silence will cause
  3789. stopped trimming of silence.
  3790. With @var{all}, only if all channels are detected as non-silence will cause
  3791. stopped trimming of silence.
  3792. @item stop_periods
  3793. Set the count for trimming silence from the end of audio.
  3794. To remove silence from the middle of a file, specify a @var{stop_periods}
  3795. that is negative. This value is then treated as a positive value and is
  3796. used to indicate the effect should restart processing as specified by
  3797. @var{start_periods}, making it suitable for removing periods of silence
  3798. in the middle of the audio.
  3799. Default value is @code{0}.
  3800. @item stop_duration
  3801. Specify a duration of silence that must exist before audio is not copied any
  3802. more. By specifying a higher duration, silence that is wanted can be left in
  3803. the audio.
  3804. Default value is @code{0}.
  3805. @item stop_threshold
  3806. This is the same as @option{start_threshold} but for trimming silence from
  3807. the end of audio.
  3808. Can be specified in dB (in case "dB" is appended to the specified value)
  3809. or amplitude ratio. Default value is @code{0}.
  3810. @item stop_silence
  3811. Specify max duration of silence at end that will be kept after
  3812. trimming. Default is 0, which is equal to trimming all samples detected
  3813. as silence.
  3814. @item stop_mode
  3815. Specify mode of detection of silence start in end of multi-channel audio.
  3816. Can be @var{any} or @var{all}. Default is @var{any}.
  3817. With @var{any}, any sample that is detected as non-silence will cause
  3818. stopped trimming of silence.
  3819. With @var{all}, only if all channels are detected as non-silence will cause
  3820. stopped trimming of silence.
  3821. @item detection
  3822. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3823. and works better with digital silence which is exactly 0.
  3824. Default value is @code{rms}.
  3825. @item window
  3826. Set duration in number of seconds used to calculate size of window in number
  3827. of samples for detecting silence.
  3828. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3829. @end table
  3830. @subsection Examples
  3831. @itemize
  3832. @item
  3833. The following example shows how this filter can be used to start a recording
  3834. that does not contain the delay at the start which usually occurs between
  3835. pressing the record button and the start of the performance:
  3836. @example
  3837. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3838. @end example
  3839. @item
  3840. Trim all silence encountered from beginning to end where there is more than 1
  3841. second of silence in audio:
  3842. @example
  3843. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3844. @end example
  3845. @item
  3846. Trim all digital silence samples, using peak detection, from beginning to end
  3847. where there is more than 0 samples of digital silence in audio and digital
  3848. silence is detected in all channels at same positions in stream:
  3849. @example
  3850. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  3851. @end example
  3852. @end itemize
  3853. @section sofalizer
  3854. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3855. loudspeakers around the user for binaural listening via headphones (audio
  3856. formats up to 9 channels supported).
  3857. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3858. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3859. Austrian Academy of Sciences.
  3860. To enable compilation of this filter you need to configure FFmpeg with
  3861. @code{--enable-libmysofa}.
  3862. The filter accepts the following options:
  3863. @table @option
  3864. @item sofa
  3865. Set the SOFA file used for rendering.
  3866. @item gain
  3867. Set gain applied to audio. Value is in dB. Default is 0.
  3868. @item rotation
  3869. Set rotation of virtual loudspeakers in deg. Default is 0.
  3870. @item elevation
  3871. Set elevation of virtual speakers in deg. Default is 0.
  3872. @item radius
  3873. Set distance in meters between loudspeakers and the listener with near-field
  3874. HRTFs. Default is 1.
  3875. @item type
  3876. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3877. processing audio in time domain which is slow.
  3878. @var{freq} is processing audio in frequency domain which is fast.
  3879. Default is @var{freq}.
  3880. @item speakers
  3881. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3882. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3883. Each virtual loudspeaker is described with short channel name following with
  3884. azimuth and elevation in degrees.
  3885. Each virtual loudspeaker description is separated by '|'.
  3886. For example to override front left and front right channel positions use:
  3887. 'speakers=FL 45 15|FR 345 15'.
  3888. Descriptions with unrecognised channel names are ignored.
  3889. @item lfegain
  3890. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3891. @item framesize
  3892. Set custom frame size in number of samples. Default is 1024.
  3893. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3894. is set to @var{freq}.
  3895. @item normalize
  3896. Should all IRs be normalized upon importing SOFA file.
  3897. By default is enabled.
  3898. @item interpolate
  3899. Should nearest IRs be interpolated with neighbor IRs if exact position
  3900. does not match. By default is disabled.
  3901. @item minphase
  3902. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3903. @item anglestep
  3904. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3905. @item radstep
  3906. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3907. @end table
  3908. @subsection Examples
  3909. @itemize
  3910. @item
  3911. Using ClubFritz6 sofa file:
  3912. @example
  3913. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3914. @end example
  3915. @item
  3916. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3917. @example
  3918. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3919. @end example
  3920. @item
  3921. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3922. and also with custom gain:
  3923. @example
  3924. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3925. @end example
  3926. @end itemize
  3927. @section stereotools
  3928. This filter has some handy utilities to manage stereo signals, for converting
  3929. M/S stereo recordings to L/R signal while having control over the parameters
  3930. or spreading the stereo image of master track.
  3931. The filter accepts the following options:
  3932. @table @option
  3933. @item level_in
  3934. Set input level before filtering for both channels. Defaults is 1.
  3935. Allowed range is from 0.015625 to 64.
  3936. @item level_out
  3937. Set output level after filtering for both channels. Defaults is 1.
  3938. Allowed range is from 0.015625 to 64.
  3939. @item balance_in
  3940. Set input balance between both channels. Default is 0.
  3941. Allowed range is from -1 to 1.
  3942. @item balance_out
  3943. Set output balance between both channels. Default is 0.
  3944. Allowed range is from -1 to 1.
  3945. @item softclip
  3946. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3947. clipping. Disabled by default.
  3948. @item mutel
  3949. Mute the left channel. Disabled by default.
  3950. @item muter
  3951. Mute the right channel. Disabled by default.
  3952. @item phasel
  3953. Change the phase of the left channel. Disabled by default.
  3954. @item phaser
  3955. Change the phase of the right channel. Disabled by default.
  3956. @item mode
  3957. Set stereo mode. Available values are:
  3958. @table @samp
  3959. @item lr>lr
  3960. Left/Right to Left/Right, this is default.
  3961. @item lr>ms
  3962. Left/Right to Mid/Side.
  3963. @item ms>lr
  3964. Mid/Side to Left/Right.
  3965. @item lr>ll
  3966. Left/Right to Left/Left.
  3967. @item lr>rr
  3968. Left/Right to Right/Right.
  3969. @item lr>l+r
  3970. Left/Right to Left + Right.
  3971. @item lr>rl
  3972. Left/Right to Right/Left.
  3973. @item ms>ll
  3974. Mid/Side to Left/Left.
  3975. @item ms>rr
  3976. Mid/Side to Right/Right.
  3977. @end table
  3978. @item slev
  3979. Set level of side signal. Default is 1.
  3980. Allowed range is from 0.015625 to 64.
  3981. @item sbal
  3982. Set balance of side signal. Default is 0.
  3983. Allowed range is from -1 to 1.
  3984. @item mlev
  3985. Set level of the middle signal. Default is 1.
  3986. Allowed range is from 0.015625 to 64.
  3987. @item mpan
  3988. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3989. @item base
  3990. Set stereo base between mono and inversed channels. Default is 0.
  3991. Allowed range is from -1 to 1.
  3992. @item delay
  3993. Set delay in milliseconds how much to delay left from right channel and
  3994. vice versa. Default is 0. Allowed range is from -20 to 20.
  3995. @item sclevel
  3996. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3997. @item phase
  3998. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3999. @item bmode_in, bmode_out
  4000. Set balance mode for balance_in/balance_out option.
  4001. Can be one of the following:
  4002. @table @samp
  4003. @item balance
  4004. Classic balance mode. Attenuate one channel at time.
  4005. Gain is raised up to 1.
  4006. @item amplitude
  4007. Similar as classic mode above but gain is raised up to 2.
  4008. @item power
  4009. Equal power distribution, from -6dB to +6dB range.
  4010. @end table
  4011. @end table
  4012. @subsection Examples
  4013. @itemize
  4014. @item
  4015. Apply karaoke like effect:
  4016. @example
  4017. stereotools=mlev=0.015625
  4018. @end example
  4019. @item
  4020. Convert M/S signal to L/R:
  4021. @example
  4022. "stereotools=mode=ms>lr"
  4023. @end example
  4024. @end itemize
  4025. @section stereowiden
  4026. This filter enhance the stereo effect by suppressing signal common to both
  4027. channels and by delaying the signal of left into right and vice versa,
  4028. thereby widening the stereo effect.
  4029. The filter accepts the following options:
  4030. @table @option
  4031. @item delay
  4032. Time in milliseconds of the delay of left signal into right and vice versa.
  4033. Default is 20 milliseconds.
  4034. @item feedback
  4035. Amount of gain in delayed signal into right and vice versa. Gives a delay
  4036. effect of left signal in right output and vice versa which gives widening
  4037. effect. Default is 0.3.
  4038. @item crossfeed
  4039. Cross feed of left into right with inverted phase. This helps in suppressing
  4040. the mono. If the value is 1 it will cancel all the signal common to both
  4041. channels. Default is 0.3.
  4042. @item drymix
  4043. Set level of input signal of original channel. Default is 0.8.
  4044. @end table
  4045. @subsection Commands
  4046. This filter supports the all above options except @code{delay} as @ref{commands}.
  4047. @section superequalizer
  4048. Apply 18 band equalizer.
  4049. The filter accepts the following options:
  4050. @table @option
  4051. @item 1b
  4052. Set 65Hz band gain.
  4053. @item 2b
  4054. Set 92Hz band gain.
  4055. @item 3b
  4056. Set 131Hz band gain.
  4057. @item 4b
  4058. Set 185Hz band gain.
  4059. @item 5b
  4060. Set 262Hz band gain.
  4061. @item 6b
  4062. Set 370Hz band gain.
  4063. @item 7b
  4064. Set 523Hz band gain.
  4065. @item 8b
  4066. Set 740Hz band gain.
  4067. @item 9b
  4068. Set 1047Hz band gain.
  4069. @item 10b
  4070. Set 1480Hz band gain.
  4071. @item 11b
  4072. Set 2093Hz band gain.
  4073. @item 12b
  4074. Set 2960Hz band gain.
  4075. @item 13b
  4076. Set 4186Hz band gain.
  4077. @item 14b
  4078. Set 5920Hz band gain.
  4079. @item 15b
  4080. Set 8372Hz band gain.
  4081. @item 16b
  4082. Set 11840Hz band gain.
  4083. @item 17b
  4084. Set 16744Hz band gain.
  4085. @item 18b
  4086. Set 20000Hz band gain.
  4087. @end table
  4088. @section surround
  4089. Apply audio surround upmix filter.
  4090. This filter allows to produce multichannel output from audio stream.
  4091. The filter accepts the following options:
  4092. @table @option
  4093. @item chl_out
  4094. Set output channel layout. By default, this is @var{5.1}.
  4095. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4096. for the required syntax.
  4097. @item chl_in
  4098. Set input channel layout. By default, this is @var{stereo}.
  4099. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4100. for the required syntax.
  4101. @item level_in
  4102. Set input volume level. By default, this is @var{1}.
  4103. @item level_out
  4104. Set output volume level. By default, this is @var{1}.
  4105. @item lfe
  4106. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  4107. @item lfe_low
  4108. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  4109. @item lfe_high
  4110. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  4111. @item lfe_mode
  4112. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  4113. In @var{add} mode, LFE channel is created from input audio and added to output.
  4114. In @var{sub} mode, LFE channel is created from input audio and added to output but
  4115. also all non-LFE output channels are subtracted with output LFE channel.
  4116. @item angle
  4117. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  4118. Default is @var{90}.
  4119. @item fc_in
  4120. Set front center input volume. By default, this is @var{1}.
  4121. @item fc_out
  4122. Set front center output volume. By default, this is @var{1}.
  4123. @item fl_in
  4124. Set front left input volume. By default, this is @var{1}.
  4125. @item fl_out
  4126. Set front left output volume. By default, this is @var{1}.
  4127. @item fr_in
  4128. Set front right input volume. By default, this is @var{1}.
  4129. @item fr_out
  4130. Set front right output volume. By default, this is @var{1}.
  4131. @item sl_in
  4132. Set side left input volume. By default, this is @var{1}.
  4133. @item sl_out
  4134. Set side left output volume. By default, this is @var{1}.
  4135. @item sr_in
  4136. Set side right input volume. By default, this is @var{1}.
  4137. @item sr_out
  4138. Set side right output volume. By default, this is @var{1}.
  4139. @item bl_in
  4140. Set back left input volume. By default, this is @var{1}.
  4141. @item bl_out
  4142. Set back left output volume. By default, this is @var{1}.
  4143. @item br_in
  4144. Set back right input volume. By default, this is @var{1}.
  4145. @item br_out
  4146. Set back right output volume. By default, this is @var{1}.
  4147. @item bc_in
  4148. Set back center input volume. By default, this is @var{1}.
  4149. @item bc_out
  4150. Set back center output volume. By default, this is @var{1}.
  4151. @item lfe_in
  4152. Set LFE input volume. By default, this is @var{1}.
  4153. @item lfe_out
  4154. Set LFE output volume. By default, this is @var{1}.
  4155. @item allx
  4156. Set spread usage of stereo image across X axis for all channels.
  4157. @item ally
  4158. Set spread usage of stereo image across Y axis for all channels.
  4159. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4160. Set spread usage of stereo image across X axis for each channel.
  4161. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4162. Set spread usage of stereo image across Y axis for each channel.
  4163. @item win_size
  4164. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4165. @item win_func
  4166. Set window function.
  4167. It accepts the following values:
  4168. @table @samp
  4169. @item rect
  4170. @item bartlett
  4171. @item hann, hanning
  4172. @item hamming
  4173. @item blackman
  4174. @item welch
  4175. @item flattop
  4176. @item bharris
  4177. @item bnuttall
  4178. @item bhann
  4179. @item sine
  4180. @item nuttall
  4181. @item lanczos
  4182. @item gauss
  4183. @item tukey
  4184. @item dolph
  4185. @item cauchy
  4186. @item parzen
  4187. @item poisson
  4188. @item bohman
  4189. @end table
  4190. Default is @code{hann}.
  4191. @item overlap
  4192. Set window overlap. If set to 1, the recommended overlap for selected
  4193. window function will be picked. Default is @code{0.5}.
  4194. @end table
  4195. @section treble, highshelf
  4196. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4197. shelving filter with a response similar to that of a standard
  4198. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4199. The filter accepts the following options:
  4200. @table @option
  4201. @item gain, g
  4202. Give the gain at whichever is the lower of ~22 kHz and the
  4203. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4204. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4205. @item frequency, f
  4206. Set the filter's central frequency and so can be used
  4207. to extend or reduce the frequency range to be boosted or cut.
  4208. The default value is @code{3000} Hz.
  4209. @item width_type, t
  4210. Set method to specify band-width of filter.
  4211. @table @option
  4212. @item h
  4213. Hz
  4214. @item q
  4215. Q-Factor
  4216. @item o
  4217. octave
  4218. @item s
  4219. slope
  4220. @item k
  4221. kHz
  4222. @end table
  4223. @item width, w
  4224. Determine how steep is the filter's shelf transition.
  4225. @item mix, m
  4226. How much to use filtered signal in output. Default is 1.
  4227. Range is between 0 and 1.
  4228. @item channels, c
  4229. Specify which channels to filter, by default all available are filtered.
  4230. @item normalize, n
  4231. Normalize biquad coefficients, by default is disabled.
  4232. Enabling it will normalize magnitude response at DC to 0dB.
  4233. @end table
  4234. @subsection Commands
  4235. This filter supports the following commands:
  4236. @table @option
  4237. @item frequency, f
  4238. Change treble frequency.
  4239. Syntax for the command is : "@var{frequency}"
  4240. @item width_type, t
  4241. Change treble width_type.
  4242. Syntax for the command is : "@var{width_type}"
  4243. @item width, w
  4244. Change treble width.
  4245. Syntax for the command is : "@var{width}"
  4246. @item gain, g
  4247. Change treble gain.
  4248. Syntax for the command is : "@var{gain}"
  4249. @item mix, m
  4250. Change treble mix.
  4251. Syntax for the command is : "@var{mix}"
  4252. @end table
  4253. @section tremolo
  4254. Sinusoidal amplitude modulation.
  4255. The filter accepts the following options:
  4256. @table @option
  4257. @item f
  4258. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4259. (20 Hz or lower) will result in a tremolo effect.
  4260. This filter may also be used as a ring modulator by specifying
  4261. a modulation frequency higher than 20 Hz.
  4262. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4263. @item d
  4264. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4265. Default value is 0.5.
  4266. @end table
  4267. @section vibrato
  4268. Sinusoidal phase modulation.
  4269. The filter accepts the following options:
  4270. @table @option
  4271. @item f
  4272. Modulation frequency in Hertz.
  4273. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4274. @item d
  4275. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4276. Default value is 0.5.
  4277. @end table
  4278. @section volume
  4279. Adjust the input audio volume.
  4280. It accepts the following parameters:
  4281. @table @option
  4282. @item volume
  4283. Set audio volume expression.
  4284. Output values are clipped to the maximum value.
  4285. The output audio volume is given by the relation:
  4286. @example
  4287. @var{output_volume} = @var{volume} * @var{input_volume}
  4288. @end example
  4289. The default value for @var{volume} is "1.0".
  4290. @item precision
  4291. This parameter represents the mathematical precision.
  4292. It determines which input sample formats will be allowed, which affects the
  4293. precision of the volume scaling.
  4294. @table @option
  4295. @item fixed
  4296. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4297. @item float
  4298. 32-bit floating-point; this limits input sample format to FLT. (default)
  4299. @item double
  4300. 64-bit floating-point; this limits input sample format to DBL.
  4301. @end table
  4302. @item replaygain
  4303. Choose the behaviour on encountering ReplayGain side data in input frames.
  4304. @table @option
  4305. @item drop
  4306. Remove ReplayGain side data, ignoring its contents (the default).
  4307. @item ignore
  4308. Ignore ReplayGain side data, but leave it in the frame.
  4309. @item track
  4310. Prefer the track gain, if present.
  4311. @item album
  4312. Prefer the album gain, if present.
  4313. @end table
  4314. @item replaygain_preamp
  4315. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4316. Default value for @var{replaygain_preamp} is 0.0.
  4317. @item replaygain_noclip
  4318. Prevent clipping by limiting the gain applied.
  4319. Default value for @var{replaygain_noclip} is 1.
  4320. @item eval
  4321. Set when the volume expression is evaluated.
  4322. It accepts the following values:
  4323. @table @samp
  4324. @item once
  4325. only evaluate expression once during the filter initialization, or
  4326. when the @samp{volume} command is sent
  4327. @item frame
  4328. evaluate expression for each incoming frame
  4329. @end table
  4330. Default value is @samp{once}.
  4331. @end table
  4332. The volume expression can contain the following parameters.
  4333. @table @option
  4334. @item n
  4335. frame number (starting at zero)
  4336. @item nb_channels
  4337. number of channels
  4338. @item nb_consumed_samples
  4339. number of samples consumed by the filter
  4340. @item nb_samples
  4341. number of samples in the current frame
  4342. @item pos
  4343. original frame position in the file
  4344. @item pts
  4345. frame PTS
  4346. @item sample_rate
  4347. sample rate
  4348. @item startpts
  4349. PTS at start of stream
  4350. @item startt
  4351. time at start of stream
  4352. @item t
  4353. frame time
  4354. @item tb
  4355. timestamp timebase
  4356. @item volume
  4357. last set volume value
  4358. @end table
  4359. Note that when @option{eval} is set to @samp{once} only the
  4360. @var{sample_rate} and @var{tb} variables are available, all other
  4361. variables will evaluate to NAN.
  4362. @subsection Commands
  4363. This filter supports the following commands:
  4364. @table @option
  4365. @item volume
  4366. Modify the volume expression.
  4367. The command accepts the same syntax of the corresponding option.
  4368. If the specified expression is not valid, it is kept at its current
  4369. value.
  4370. @end table
  4371. @subsection Examples
  4372. @itemize
  4373. @item
  4374. Halve the input audio volume:
  4375. @example
  4376. volume=volume=0.5
  4377. volume=volume=1/2
  4378. volume=volume=-6.0206dB
  4379. @end example
  4380. In all the above example the named key for @option{volume} can be
  4381. omitted, for example like in:
  4382. @example
  4383. volume=0.5
  4384. @end example
  4385. @item
  4386. Increase input audio power by 6 decibels using fixed-point precision:
  4387. @example
  4388. volume=volume=6dB:precision=fixed
  4389. @end example
  4390. @item
  4391. Fade volume after time 10 with an annihilation period of 5 seconds:
  4392. @example
  4393. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4394. @end example
  4395. @end itemize
  4396. @section volumedetect
  4397. Detect the volume of the input video.
  4398. The filter has no parameters. The input is not modified. Statistics about
  4399. the volume will be printed in the log when the input stream end is reached.
  4400. In particular it will show the mean volume (root mean square), maximum
  4401. volume (on a per-sample basis), and the beginning of a histogram of the
  4402. registered volume values (from the maximum value to a cumulated 1/1000 of
  4403. the samples).
  4404. All volumes are in decibels relative to the maximum PCM value.
  4405. @subsection Examples
  4406. Here is an excerpt of the output:
  4407. @example
  4408. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4409. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4410. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4411. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4412. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4413. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4414. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4415. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4416. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4417. @end example
  4418. It means that:
  4419. @itemize
  4420. @item
  4421. The mean square energy is approximately -27 dB, or 10^-2.7.
  4422. @item
  4423. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4424. @item
  4425. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4426. @end itemize
  4427. In other words, raising the volume by +4 dB does not cause any clipping,
  4428. raising it by +5 dB causes clipping for 6 samples, etc.
  4429. @c man end AUDIO FILTERS
  4430. @chapter Audio Sources
  4431. @c man begin AUDIO SOURCES
  4432. Below is a description of the currently available audio sources.
  4433. @section abuffer
  4434. Buffer audio frames, and make them available to the filter chain.
  4435. This source is mainly intended for a programmatic use, in particular
  4436. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4437. It accepts the following parameters:
  4438. @table @option
  4439. @item time_base
  4440. The timebase which will be used for timestamps of submitted frames. It must be
  4441. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4442. @item sample_rate
  4443. The sample rate of the incoming audio buffers.
  4444. @item sample_fmt
  4445. The sample format of the incoming audio buffers.
  4446. Either a sample format name or its corresponding integer representation from
  4447. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4448. @item channel_layout
  4449. The channel layout of the incoming audio buffers.
  4450. Either a channel layout name from channel_layout_map in
  4451. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4452. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4453. @item channels
  4454. The number of channels of the incoming audio buffers.
  4455. If both @var{channels} and @var{channel_layout} are specified, then they
  4456. must be consistent.
  4457. @end table
  4458. @subsection Examples
  4459. @example
  4460. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4461. @end example
  4462. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4463. Since the sample format with name "s16p" corresponds to the number
  4464. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4465. equivalent to:
  4466. @example
  4467. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4468. @end example
  4469. @section aevalsrc
  4470. Generate an audio signal specified by an expression.
  4471. This source accepts in input one or more expressions (one for each
  4472. channel), which are evaluated and used to generate a corresponding
  4473. audio signal.
  4474. This source accepts the following options:
  4475. @table @option
  4476. @item exprs
  4477. Set the '|'-separated expressions list for each separate channel. In case the
  4478. @option{channel_layout} option is not specified, the selected channel layout
  4479. depends on the number of provided expressions. Otherwise the last
  4480. specified expression is applied to the remaining output channels.
  4481. @item channel_layout, c
  4482. Set the channel layout. The number of channels in the specified layout
  4483. must be equal to the number of specified expressions.
  4484. @item duration, d
  4485. Set the minimum duration of the sourced audio. See
  4486. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4487. for the accepted syntax.
  4488. Note that the resulting duration may be greater than the specified
  4489. duration, as the generated audio is always cut at the end of a
  4490. complete frame.
  4491. If not specified, or the expressed duration is negative, the audio is
  4492. supposed to be generated forever.
  4493. @item nb_samples, n
  4494. Set the number of samples per channel per each output frame,
  4495. default to 1024.
  4496. @item sample_rate, s
  4497. Specify the sample rate, default to 44100.
  4498. @end table
  4499. Each expression in @var{exprs} can contain the following constants:
  4500. @table @option
  4501. @item n
  4502. number of the evaluated sample, starting from 0
  4503. @item t
  4504. time of the evaluated sample expressed in seconds, starting from 0
  4505. @item s
  4506. sample rate
  4507. @end table
  4508. @subsection Examples
  4509. @itemize
  4510. @item
  4511. Generate silence:
  4512. @example
  4513. aevalsrc=0
  4514. @end example
  4515. @item
  4516. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4517. 8000 Hz:
  4518. @example
  4519. aevalsrc="sin(440*2*PI*t):s=8000"
  4520. @end example
  4521. @item
  4522. Generate a two channels signal, specify the channel layout (Front
  4523. Center + Back Center) explicitly:
  4524. @example
  4525. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4526. @end example
  4527. @item
  4528. Generate white noise:
  4529. @example
  4530. aevalsrc="-2+random(0)"
  4531. @end example
  4532. @item
  4533. Generate an amplitude modulated signal:
  4534. @example
  4535. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4536. @end example
  4537. @item
  4538. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4539. @example
  4540. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4541. @end example
  4542. @end itemize
  4543. @section afirsrc
  4544. Generate a FIR coefficients using frequency sampling method.
  4545. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4546. The filter accepts the following options:
  4547. @table @option
  4548. @item taps, t
  4549. Set number of filter coefficents in output audio stream.
  4550. Default value is 1025.
  4551. @item frequency, f
  4552. Set frequency points from where magnitude and phase are set.
  4553. This must be in non decreasing order, and first element must be 0, while last element
  4554. must be 1. Elements are separated by white spaces.
  4555. @item magnitude, m
  4556. Set magnitude value for every frequency point set by @option{frequency}.
  4557. Number of values must be same as number of frequency points.
  4558. Values are separated by white spaces.
  4559. @item phase, p
  4560. Set phase value for every frequency point set by @option{frequency}.
  4561. Number of values must be same as number of frequency points.
  4562. Values are separated by white spaces.
  4563. @item sample_rate, r
  4564. Set sample rate, default is 44100.
  4565. @item nb_samples, n
  4566. Set number of samples per each frame. Default is 1024.
  4567. @item win_func, w
  4568. Set window function. Default is blackman.
  4569. @end table
  4570. @section anullsrc
  4571. The null audio source, return unprocessed audio frames. It is mainly useful
  4572. as a template and to be employed in analysis / debugging tools, or as
  4573. the source for filters which ignore the input data (for example the sox
  4574. synth filter).
  4575. This source accepts the following options:
  4576. @table @option
  4577. @item channel_layout, cl
  4578. Specifies the channel layout, and can be either an integer or a string
  4579. representing a channel layout. The default value of @var{channel_layout}
  4580. is "stereo".
  4581. Check the channel_layout_map definition in
  4582. @file{libavutil/channel_layout.c} for the mapping between strings and
  4583. channel layout values.
  4584. @item sample_rate, r
  4585. Specifies the sample rate, and defaults to 44100.
  4586. @item nb_samples, n
  4587. Set the number of samples per requested frames.
  4588. @end table
  4589. @subsection Examples
  4590. @itemize
  4591. @item
  4592. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4593. @example
  4594. anullsrc=r=48000:cl=4
  4595. @end example
  4596. @item
  4597. Do the same operation with a more obvious syntax:
  4598. @example
  4599. anullsrc=r=48000:cl=mono
  4600. @end example
  4601. @end itemize
  4602. All the parameters need to be explicitly defined.
  4603. @section flite
  4604. Synthesize a voice utterance using the libflite library.
  4605. To enable compilation of this filter you need to configure FFmpeg with
  4606. @code{--enable-libflite}.
  4607. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4608. The filter accepts the following options:
  4609. @table @option
  4610. @item list_voices
  4611. If set to 1, list the names of the available voices and exit
  4612. immediately. Default value is 0.
  4613. @item nb_samples, n
  4614. Set the maximum number of samples per frame. Default value is 512.
  4615. @item textfile
  4616. Set the filename containing the text to speak.
  4617. @item text
  4618. Set the text to speak.
  4619. @item voice, v
  4620. Set the voice to use for the speech synthesis. Default value is
  4621. @code{kal}. See also the @var{list_voices} option.
  4622. @end table
  4623. @subsection Examples
  4624. @itemize
  4625. @item
  4626. Read from file @file{speech.txt}, and synthesize the text using the
  4627. standard flite voice:
  4628. @example
  4629. flite=textfile=speech.txt
  4630. @end example
  4631. @item
  4632. Read the specified text selecting the @code{slt} voice:
  4633. @example
  4634. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4635. @end example
  4636. @item
  4637. Input text to ffmpeg:
  4638. @example
  4639. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4640. @end example
  4641. @item
  4642. Make @file{ffplay} speak the specified text, using @code{flite} and
  4643. the @code{lavfi} device:
  4644. @example
  4645. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4646. @end example
  4647. @end itemize
  4648. For more information about libflite, check:
  4649. @url{http://www.festvox.org/flite/}
  4650. @section anoisesrc
  4651. Generate a noise audio signal.
  4652. The filter accepts the following options:
  4653. @table @option
  4654. @item sample_rate, r
  4655. Specify the sample rate. Default value is 48000 Hz.
  4656. @item amplitude, a
  4657. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4658. is 1.0.
  4659. @item duration, d
  4660. Specify the duration of the generated audio stream. Not specifying this option
  4661. results in noise with an infinite length.
  4662. @item color, colour, c
  4663. Specify the color of noise. Available noise colors are white, pink, brown,
  4664. blue, violet and velvet. Default color is white.
  4665. @item seed, s
  4666. Specify a value used to seed the PRNG.
  4667. @item nb_samples, n
  4668. Set the number of samples per each output frame, default is 1024.
  4669. @end table
  4670. @subsection Examples
  4671. @itemize
  4672. @item
  4673. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4674. @example
  4675. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4676. @end example
  4677. @end itemize
  4678. @section hilbert
  4679. Generate odd-tap Hilbert transform FIR coefficients.
  4680. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4681. the signal by 90 degrees.
  4682. This is used in many matrix coding schemes and for analytic signal generation.
  4683. The process is often written as a multiplication by i (or j), the imaginary unit.
  4684. The filter accepts the following options:
  4685. @table @option
  4686. @item sample_rate, s
  4687. Set sample rate, default is 44100.
  4688. @item taps, t
  4689. Set length of FIR filter, default is 22051.
  4690. @item nb_samples, n
  4691. Set number of samples per each frame.
  4692. @item win_func, w
  4693. Set window function to be used when generating FIR coefficients.
  4694. @end table
  4695. @section sinc
  4696. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4697. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4698. The filter accepts the following options:
  4699. @table @option
  4700. @item sample_rate, r
  4701. Set sample rate, default is 44100.
  4702. @item nb_samples, n
  4703. Set number of samples per each frame. Default is 1024.
  4704. @item hp
  4705. Set high-pass frequency. Default is 0.
  4706. @item lp
  4707. Set low-pass frequency. Default is 0.
  4708. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4709. is higher than 0 then filter will create band-pass filter coefficients,
  4710. otherwise band-reject filter coefficients.
  4711. @item phase
  4712. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4713. @item beta
  4714. Set Kaiser window beta.
  4715. @item att
  4716. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4717. @item round
  4718. Enable rounding, by default is disabled.
  4719. @item hptaps
  4720. Set number of taps for high-pass filter.
  4721. @item lptaps
  4722. Set number of taps for low-pass filter.
  4723. @end table
  4724. @section sine
  4725. Generate an audio signal made of a sine wave with amplitude 1/8.
  4726. The audio signal is bit-exact.
  4727. The filter accepts the following options:
  4728. @table @option
  4729. @item frequency, f
  4730. Set the carrier frequency. Default is 440 Hz.
  4731. @item beep_factor, b
  4732. Enable a periodic beep every second with frequency @var{beep_factor} times
  4733. the carrier frequency. Default is 0, meaning the beep is disabled.
  4734. @item sample_rate, r
  4735. Specify the sample rate, default is 44100.
  4736. @item duration, d
  4737. Specify the duration of the generated audio stream.
  4738. @item samples_per_frame
  4739. Set the number of samples per output frame.
  4740. The expression can contain the following constants:
  4741. @table @option
  4742. @item n
  4743. The (sequential) number of the output audio frame, starting from 0.
  4744. @item pts
  4745. The PTS (Presentation TimeStamp) of the output audio frame,
  4746. expressed in @var{TB} units.
  4747. @item t
  4748. The PTS of the output audio frame, expressed in seconds.
  4749. @item TB
  4750. The timebase of the output audio frames.
  4751. @end table
  4752. Default is @code{1024}.
  4753. @end table
  4754. @subsection Examples
  4755. @itemize
  4756. @item
  4757. Generate a simple 440 Hz sine wave:
  4758. @example
  4759. sine
  4760. @end example
  4761. @item
  4762. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4763. @example
  4764. sine=220:4:d=5
  4765. sine=f=220:b=4:d=5
  4766. sine=frequency=220:beep_factor=4:duration=5
  4767. @end example
  4768. @item
  4769. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4770. pattern:
  4771. @example
  4772. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4773. @end example
  4774. @end itemize
  4775. @c man end AUDIO SOURCES
  4776. @chapter Audio Sinks
  4777. @c man begin AUDIO SINKS
  4778. Below is a description of the currently available audio sinks.
  4779. @section abuffersink
  4780. Buffer audio frames, and make them available to the end of filter chain.
  4781. This sink is mainly intended for programmatic use, in particular
  4782. through the interface defined in @file{libavfilter/buffersink.h}
  4783. or the options system.
  4784. It accepts a pointer to an AVABufferSinkContext structure, which
  4785. defines the incoming buffers' formats, to be passed as the opaque
  4786. parameter to @code{avfilter_init_filter} for initialization.
  4787. @section anullsink
  4788. Null audio sink; do absolutely nothing with the input audio. It is
  4789. mainly useful as a template and for use in analysis / debugging
  4790. tools.
  4791. @c man end AUDIO SINKS
  4792. @chapter Video Filters
  4793. @c man begin VIDEO FILTERS
  4794. When you configure your FFmpeg build, you can disable any of the
  4795. existing filters using @code{--disable-filters}.
  4796. The configure output will show the video filters included in your
  4797. build.
  4798. Below is a description of the currently available video filters.
  4799. @section addroi
  4800. Mark a region of interest in a video frame.
  4801. The frame data is passed through unchanged, but metadata is attached
  4802. to the frame indicating regions of interest which can affect the
  4803. behaviour of later encoding. Multiple regions can be marked by
  4804. applying the filter multiple times.
  4805. @table @option
  4806. @item x
  4807. Region distance in pixels from the left edge of the frame.
  4808. @item y
  4809. Region distance in pixels from the top edge of the frame.
  4810. @item w
  4811. Region width in pixels.
  4812. @item h
  4813. Region height in pixels.
  4814. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  4815. and may contain the following variables:
  4816. @table @option
  4817. @item iw
  4818. Width of the input frame.
  4819. @item ih
  4820. Height of the input frame.
  4821. @end table
  4822. @item qoffset
  4823. Quantisation offset to apply within the region.
  4824. This must be a real value in the range -1 to +1. A value of zero
  4825. indicates no quality change. A negative value asks for better quality
  4826. (less quantisation), while a positive value asks for worse quality
  4827. (greater quantisation).
  4828. The range is calibrated so that the extreme values indicate the
  4829. largest possible offset - if the rest of the frame is encoded with the
  4830. worst possible quality, an offset of -1 indicates that this region
  4831. should be encoded with the best possible quality anyway. Intermediate
  4832. values are then interpolated in some codec-dependent way.
  4833. For example, in 10-bit H.264 the quantisation parameter varies between
  4834. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  4835. this region should be encoded with a QP around one-tenth of the full
  4836. range better than the rest of the frame. So, if most of the frame
  4837. were to be encoded with a QP of around 30, this region would get a QP
  4838. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  4839. An extreme value of -1 would indicate that this region should be
  4840. encoded with the best possible quality regardless of the treatment of
  4841. the rest of the frame - that is, should be encoded at a QP of -12.
  4842. @item clear
  4843. If set to true, remove any existing regions of interest marked on the
  4844. frame before adding the new one.
  4845. @end table
  4846. @subsection Examples
  4847. @itemize
  4848. @item
  4849. Mark the centre quarter of the frame as interesting.
  4850. @example
  4851. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  4852. @end example
  4853. @item
  4854. Mark the 100-pixel-wide region on the left edge of the frame as very
  4855. uninteresting (to be encoded at much lower quality than the rest of
  4856. the frame).
  4857. @example
  4858. addroi=0:0:100:ih:+1/5
  4859. @end example
  4860. @end itemize
  4861. @section alphaextract
  4862. Extract the alpha component from the input as a grayscale video. This
  4863. is especially useful with the @var{alphamerge} filter.
  4864. @section alphamerge
  4865. Add or replace the alpha component of the primary input with the
  4866. grayscale value of a second input. This is intended for use with
  4867. @var{alphaextract} to allow the transmission or storage of frame
  4868. sequences that have alpha in a format that doesn't support an alpha
  4869. channel.
  4870. For example, to reconstruct full frames from a normal YUV-encoded video
  4871. and a separate video created with @var{alphaextract}, you might use:
  4872. @example
  4873. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4874. @end example
  4875. Since this filter is designed for reconstruction, it operates on frame
  4876. sequences without considering timestamps, and terminates when either
  4877. input reaches end of stream. This will cause problems if your encoding
  4878. pipeline drops frames. If you're trying to apply an image as an
  4879. overlay to a video stream, consider the @var{overlay} filter instead.
  4880. @section amplify
  4881. Amplify differences between current pixel and pixels of adjacent frames in
  4882. same pixel location.
  4883. This filter accepts the following options:
  4884. @table @option
  4885. @item radius
  4886. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4887. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4888. @item factor
  4889. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4890. @item threshold
  4891. Set threshold for difference amplification. Any difference greater or equal to
  4892. this value will not alter source pixel. Default is 10.
  4893. Allowed range is from 0 to 65535.
  4894. @item tolerance
  4895. Set tolerance for difference amplification. Any difference lower to
  4896. this value will not alter source pixel. Default is 0.
  4897. Allowed range is from 0 to 65535.
  4898. @item low
  4899. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4900. This option controls maximum possible value that will decrease source pixel value.
  4901. @item high
  4902. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4903. This option controls maximum possible value that will increase source pixel value.
  4904. @item planes
  4905. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4906. @end table
  4907. @subsection Commands
  4908. This filter supports the following @ref{commands} that corresponds to option of same name:
  4909. @table @option
  4910. @item factor
  4911. @item threshold
  4912. @item tolerance
  4913. @item low
  4914. @item high
  4915. @item planes
  4916. @end table
  4917. @section ass
  4918. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4919. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4920. Substation Alpha) subtitles files.
  4921. This filter accepts the following option in addition to the common options from
  4922. the @ref{subtitles} filter:
  4923. @table @option
  4924. @item shaping
  4925. Set the shaping engine
  4926. Available values are:
  4927. @table @samp
  4928. @item auto
  4929. The default libass shaping engine, which is the best available.
  4930. @item simple
  4931. Fast, font-agnostic shaper that can do only substitutions
  4932. @item complex
  4933. Slower shaper using OpenType for substitutions and positioning
  4934. @end table
  4935. The default is @code{auto}.
  4936. @end table
  4937. @section atadenoise
  4938. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4939. The filter accepts the following options:
  4940. @table @option
  4941. @item 0a
  4942. Set threshold A for 1st plane. Default is 0.02.
  4943. Valid range is 0 to 0.3.
  4944. @item 0b
  4945. Set threshold B for 1st plane. Default is 0.04.
  4946. Valid range is 0 to 5.
  4947. @item 1a
  4948. Set threshold A for 2nd plane. Default is 0.02.
  4949. Valid range is 0 to 0.3.
  4950. @item 1b
  4951. Set threshold B for 2nd plane. Default is 0.04.
  4952. Valid range is 0 to 5.
  4953. @item 2a
  4954. Set threshold A for 3rd plane. Default is 0.02.
  4955. Valid range is 0 to 0.3.
  4956. @item 2b
  4957. Set threshold B for 3rd plane. Default is 0.04.
  4958. Valid range is 0 to 5.
  4959. Threshold A is designed to react on abrupt changes in the input signal and
  4960. threshold B is designed to react on continuous changes in the input signal.
  4961. @item s
  4962. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4963. number in range [5, 129].
  4964. @item p
  4965. Set what planes of frame filter will use for averaging. Default is all.
  4966. @item a
  4967. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  4968. Alternatively can be set to @code{s} serial.
  4969. Parallel can be faster then serial, while other way around is never true.
  4970. Parallel will abort early on first change being greater then thresholds, while serial
  4971. will continue processing other side of frames if they are equal or bellow thresholds.
  4972. @end table
  4973. @subsection Commands
  4974. This filter supports same @ref{commands} as options except option @code{s}.
  4975. The command accepts the same syntax of the corresponding option.
  4976. @section avgblur
  4977. Apply average blur filter.
  4978. The filter accepts the following options:
  4979. @table @option
  4980. @item sizeX
  4981. Set horizontal radius size.
  4982. @item planes
  4983. Set which planes to filter. By default all planes are filtered.
  4984. @item sizeY
  4985. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4986. Default is @code{0}.
  4987. @end table
  4988. @subsection Commands
  4989. This filter supports same commands as options.
  4990. The command accepts the same syntax of the corresponding option.
  4991. If the specified expression is not valid, it is kept at its current
  4992. value.
  4993. @section bbox
  4994. Compute the bounding box for the non-black pixels in the input frame
  4995. luminance plane.
  4996. This filter computes the bounding box containing all the pixels with a
  4997. luminance value greater than the minimum allowed value.
  4998. The parameters describing the bounding box are printed on the filter
  4999. log.
  5000. The filter accepts the following option:
  5001. @table @option
  5002. @item min_val
  5003. Set the minimal luminance value. Default is @code{16}.
  5004. @end table
  5005. @section bilateral
  5006. Apply bilateral filter, spatial smoothing while preserving edges.
  5007. The filter accepts the following options:
  5008. @table @option
  5009. @item sigmaS
  5010. Set sigma of gaussian function to calculate spatial weight.
  5011. Allowed range is 0 to 10. Default is 0.1.
  5012. @item sigmaR
  5013. Set sigma of gaussian function to calculate range weight.
  5014. Allowed range is 0 to 1. Default is 0.1.
  5015. @item planes
  5016. Set planes to filter. Default is first only.
  5017. @end table
  5018. @section bitplanenoise
  5019. Show and measure bit plane noise.
  5020. The filter accepts the following options:
  5021. @table @option
  5022. @item bitplane
  5023. Set which plane to analyze. Default is @code{1}.
  5024. @item filter
  5025. Filter out noisy pixels from @code{bitplane} set above.
  5026. Default is disabled.
  5027. @end table
  5028. @section blackdetect
  5029. Detect video intervals that are (almost) completely black. Can be
  5030. useful to detect chapter transitions, commercials, or invalid
  5031. recordings.
  5032. The filter outputs its detection analysis to both the log as well as
  5033. frame metadata. If a black segment of at least the specified minimum
  5034. duration is found, a line with the start and end timestamps as well
  5035. as duration is printed to the log with level @code{info}. In addition,
  5036. a log line with level @code{debug} is printed per frame showing the
  5037. black amount detected for that frame.
  5038. The filter also attaches metadata to the first frame of a black
  5039. segment with key @code{lavfi.black_start} and to the first frame
  5040. after the black segment ends with key @code{lavfi.black_end}. The
  5041. value is the frame's timestamp. This metadata is added regardless
  5042. of the minimum duration specified.
  5043. The filter accepts the following options:
  5044. @table @option
  5045. @item black_min_duration, d
  5046. Set the minimum detected black duration expressed in seconds. It must
  5047. be a non-negative floating point number.
  5048. Default value is 2.0.
  5049. @item picture_black_ratio_th, pic_th
  5050. Set the threshold for considering a picture "black".
  5051. Express the minimum value for the ratio:
  5052. @example
  5053. @var{nb_black_pixels} / @var{nb_pixels}
  5054. @end example
  5055. for which a picture is considered black.
  5056. Default value is 0.98.
  5057. @item pixel_black_th, pix_th
  5058. Set the threshold for considering a pixel "black".
  5059. The threshold expresses the maximum pixel luminance value for which a
  5060. pixel is considered "black". The provided value is scaled according to
  5061. the following equation:
  5062. @example
  5063. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  5064. @end example
  5065. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  5066. the input video format, the range is [0-255] for YUV full-range
  5067. formats and [16-235] for YUV non full-range formats.
  5068. Default value is 0.10.
  5069. @end table
  5070. The following example sets the maximum pixel threshold to the minimum
  5071. value, and detects only black intervals of 2 or more seconds:
  5072. @example
  5073. blackdetect=d=2:pix_th=0.00
  5074. @end example
  5075. @section blackframe
  5076. Detect frames that are (almost) completely black. Can be useful to
  5077. detect chapter transitions or commercials. Output lines consist of
  5078. the frame number of the detected frame, the percentage of blackness,
  5079. the position in the file if known or -1 and the timestamp in seconds.
  5080. In order to display the output lines, you need to set the loglevel at
  5081. least to the AV_LOG_INFO value.
  5082. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  5083. The value represents the percentage of pixels in the picture that
  5084. are below the threshold value.
  5085. It accepts the following parameters:
  5086. @table @option
  5087. @item amount
  5088. The percentage of the pixels that have to be below the threshold; it defaults to
  5089. @code{98}.
  5090. @item threshold, thresh
  5091. The threshold below which a pixel value is considered black; it defaults to
  5092. @code{32}.
  5093. @end table
  5094. @anchor{blend}
  5095. @section blend
  5096. Blend two video frames into each other.
  5097. The @code{blend} filter takes two input streams and outputs one
  5098. stream, the first input is the "top" layer and second input is
  5099. "bottom" layer. By default, the output terminates when the longest input terminates.
  5100. The @code{tblend} (time blend) filter takes two consecutive frames
  5101. from one single stream, and outputs the result obtained by blending
  5102. the new frame on top of the old frame.
  5103. A description of the accepted options follows.
  5104. @table @option
  5105. @item c0_mode
  5106. @item c1_mode
  5107. @item c2_mode
  5108. @item c3_mode
  5109. @item all_mode
  5110. Set blend mode for specific pixel component or all pixel components in case
  5111. of @var{all_mode}. Default value is @code{normal}.
  5112. Available values for component modes are:
  5113. @table @samp
  5114. @item addition
  5115. @item grainmerge
  5116. @item and
  5117. @item average
  5118. @item burn
  5119. @item darken
  5120. @item difference
  5121. @item grainextract
  5122. @item divide
  5123. @item dodge
  5124. @item freeze
  5125. @item exclusion
  5126. @item extremity
  5127. @item glow
  5128. @item hardlight
  5129. @item hardmix
  5130. @item heat
  5131. @item lighten
  5132. @item linearlight
  5133. @item multiply
  5134. @item multiply128
  5135. @item negation
  5136. @item normal
  5137. @item or
  5138. @item overlay
  5139. @item phoenix
  5140. @item pinlight
  5141. @item reflect
  5142. @item screen
  5143. @item softlight
  5144. @item subtract
  5145. @item vividlight
  5146. @item xor
  5147. @end table
  5148. @item c0_opacity
  5149. @item c1_opacity
  5150. @item c2_opacity
  5151. @item c3_opacity
  5152. @item all_opacity
  5153. Set blend opacity for specific pixel component or all pixel components in case
  5154. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  5155. @item c0_expr
  5156. @item c1_expr
  5157. @item c2_expr
  5158. @item c3_expr
  5159. @item all_expr
  5160. Set blend expression for specific pixel component or all pixel components in case
  5161. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  5162. The expressions can use the following variables:
  5163. @table @option
  5164. @item N
  5165. The sequential number of the filtered frame, starting from @code{0}.
  5166. @item X
  5167. @item Y
  5168. the coordinates of the current sample
  5169. @item W
  5170. @item H
  5171. the width and height of currently filtered plane
  5172. @item SW
  5173. @item SH
  5174. Width and height scale for the plane being filtered. It is the
  5175. ratio between the dimensions of the current plane to the luma plane,
  5176. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  5177. the luma plane and @code{0.5,0.5} for the chroma planes.
  5178. @item T
  5179. Time of the current frame, expressed in seconds.
  5180. @item TOP, A
  5181. Value of pixel component at current location for first video frame (top layer).
  5182. @item BOTTOM, B
  5183. Value of pixel component at current location for second video frame (bottom layer).
  5184. @end table
  5185. @end table
  5186. The @code{blend} filter also supports the @ref{framesync} options.
  5187. @subsection Examples
  5188. @itemize
  5189. @item
  5190. Apply transition from bottom layer to top layer in first 10 seconds:
  5191. @example
  5192. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  5193. @end example
  5194. @item
  5195. Apply linear horizontal transition from top layer to bottom layer:
  5196. @example
  5197. blend=all_expr='A*(X/W)+B*(1-X/W)'
  5198. @end example
  5199. @item
  5200. Apply 1x1 checkerboard effect:
  5201. @example
  5202. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  5203. @end example
  5204. @item
  5205. Apply uncover left effect:
  5206. @example
  5207. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  5208. @end example
  5209. @item
  5210. Apply uncover down effect:
  5211. @example
  5212. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  5213. @end example
  5214. @item
  5215. Apply uncover up-left effect:
  5216. @example
  5217. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5218. @end example
  5219. @item
  5220. Split diagonally video and shows top and bottom layer on each side:
  5221. @example
  5222. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5223. @end example
  5224. @item
  5225. Display differences between the current and the previous frame:
  5226. @example
  5227. tblend=all_mode=grainextract
  5228. @end example
  5229. @end itemize
  5230. @section bm3d
  5231. Denoise frames using Block-Matching 3D algorithm.
  5232. The filter accepts the following options.
  5233. @table @option
  5234. @item sigma
  5235. Set denoising strength. Default value is 1.
  5236. Allowed range is from 0 to 999.9.
  5237. The denoising algorithm is very sensitive to sigma, so adjust it
  5238. according to the source.
  5239. @item block
  5240. Set local patch size. This sets dimensions in 2D.
  5241. @item bstep
  5242. Set sliding step for processing blocks. Default value is 4.
  5243. Allowed range is from 1 to 64.
  5244. Smaller values allows processing more reference blocks and is slower.
  5245. @item group
  5246. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5247. When set to 1, no block matching is done. Larger values allows more blocks
  5248. in single group.
  5249. Allowed range is from 1 to 256.
  5250. @item range
  5251. Set radius for search block matching. Default is 9.
  5252. Allowed range is from 1 to INT32_MAX.
  5253. @item mstep
  5254. Set step between two search locations for block matching. Default is 1.
  5255. Allowed range is from 1 to 64. Smaller is slower.
  5256. @item thmse
  5257. Set threshold of mean square error for block matching. Valid range is 0 to
  5258. INT32_MAX.
  5259. @item hdthr
  5260. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5261. Larger values results in stronger hard-thresholding filtering in frequency
  5262. domain.
  5263. @item estim
  5264. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5265. Default is @code{basic}.
  5266. @item ref
  5267. If enabled, filter will use 2nd stream for block matching.
  5268. Default is disabled for @code{basic} value of @var{estim} option,
  5269. and always enabled if value of @var{estim} is @code{final}.
  5270. @item planes
  5271. Set planes to filter. Default is all available except alpha.
  5272. @end table
  5273. @subsection Examples
  5274. @itemize
  5275. @item
  5276. Basic filtering with bm3d:
  5277. @example
  5278. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5279. @end example
  5280. @item
  5281. Same as above, but filtering only luma:
  5282. @example
  5283. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5284. @end example
  5285. @item
  5286. Same as above, but with both estimation modes:
  5287. @example
  5288. 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
  5289. @end example
  5290. @item
  5291. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5292. @example
  5293. 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
  5294. @end example
  5295. @end itemize
  5296. @section boxblur
  5297. Apply a boxblur algorithm to the input video.
  5298. It accepts the following parameters:
  5299. @table @option
  5300. @item luma_radius, lr
  5301. @item luma_power, lp
  5302. @item chroma_radius, cr
  5303. @item chroma_power, cp
  5304. @item alpha_radius, ar
  5305. @item alpha_power, ap
  5306. @end table
  5307. A description of the accepted options follows.
  5308. @table @option
  5309. @item luma_radius, lr
  5310. @item chroma_radius, cr
  5311. @item alpha_radius, ar
  5312. Set an expression for the box radius in pixels used for blurring the
  5313. corresponding input plane.
  5314. The radius value must be a non-negative number, and must not be
  5315. greater than the value of the expression @code{min(w,h)/2} for the
  5316. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5317. planes.
  5318. Default value for @option{luma_radius} is "2". If not specified,
  5319. @option{chroma_radius} and @option{alpha_radius} default to the
  5320. corresponding value set for @option{luma_radius}.
  5321. The expressions can contain the following constants:
  5322. @table @option
  5323. @item w
  5324. @item h
  5325. The input width and height in pixels.
  5326. @item cw
  5327. @item ch
  5328. The input chroma image width and height in pixels.
  5329. @item hsub
  5330. @item vsub
  5331. The horizontal and vertical chroma subsample values. For example, for the
  5332. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5333. @end table
  5334. @item luma_power, lp
  5335. @item chroma_power, cp
  5336. @item alpha_power, ap
  5337. Specify how many times the boxblur filter is applied to the
  5338. corresponding plane.
  5339. Default value for @option{luma_power} is 2. If not specified,
  5340. @option{chroma_power} and @option{alpha_power} default to the
  5341. corresponding value set for @option{luma_power}.
  5342. A value of 0 will disable the effect.
  5343. @end table
  5344. @subsection Examples
  5345. @itemize
  5346. @item
  5347. Apply a boxblur filter with the luma, chroma, and alpha radii
  5348. set to 2:
  5349. @example
  5350. boxblur=luma_radius=2:luma_power=1
  5351. boxblur=2:1
  5352. @end example
  5353. @item
  5354. Set the luma radius to 2, and alpha and chroma radius to 0:
  5355. @example
  5356. boxblur=2:1:cr=0:ar=0
  5357. @end example
  5358. @item
  5359. Set the luma and chroma radii to a fraction of the video dimension:
  5360. @example
  5361. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5362. @end example
  5363. @end itemize
  5364. @section bwdif
  5365. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5366. Deinterlacing Filter").
  5367. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5368. interpolation algorithms.
  5369. It accepts the following parameters:
  5370. @table @option
  5371. @item mode
  5372. The interlacing mode to adopt. It accepts one of the following values:
  5373. @table @option
  5374. @item 0, send_frame
  5375. Output one frame for each frame.
  5376. @item 1, send_field
  5377. Output one frame for each field.
  5378. @end table
  5379. The default value is @code{send_field}.
  5380. @item parity
  5381. The picture field parity assumed for the input interlaced video. It accepts one
  5382. of the following values:
  5383. @table @option
  5384. @item 0, tff
  5385. Assume the top field is first.
  5386. @item 1, bff
  5387. Assume the bottom field is first.
  5388. @item -1, auto
  5389. Enable automatic detection of field parity.
  5390. @end table
  5391. The default value is @code{auto}.
  5392. If the interlacing is unknown or the decoder does not export this information,
  5393. top field first will be assumed.
  5394. @item deint
  5395. Specify which frames to deinterlace. Accepts one of the following
  5396. values:
  5397. @table @option
  5398. @item 0, all
  5399. Deinterlace all frames.
  5400. @item 1, interlaced
  5401. Only deinterlace frames marked as interlaced.
  5402. @end table
  5403. The default value is @code{all}.
  5404. @end table
  5405. @section cas
  5406. Apply Contrast Adaptive Sharpen filter to video stream.
  5407. The filter accepts the following options:
  5408. @table @option
  5409. @item strength
  5410. Set the sharpening strength. Default value is 0.
  5411. @item planes
  5412. Set planes to filter. Default value is to filter all
  5413. planes except alpha plane.
  5414. @end table
  5415. @section chromahold
  5416. Remove all color information for all colors except for certain one.
  5417. The filter accepts the following options:
  5418. @table @option
  5419. @item color
  5420. The color which will not be replaced with neutral chroma.
  5421. @item similarity
  5422. Similarity percentage with the above color.
  5423. 0.01 matches only the exact key color, while 1.0 matches everything.
  5424. @item blend
  5425. Blend percentage.
  5426. 0.0 makes pixels either fully gray, or not gray at all.
  5427. Higher values result in more preserved color.
  5428. @item yuv
  5429. Signals that the color passed is already in YUV instead of RGB.
  5430. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5431. This can be used to pass exact YUV values as hexadecimal numbers.
  5432. @end table
  5433. @subsection Commands
  5434. This filter supports same @ref{commands} as options.
  5435. The command accepts the same syntax of the corresponding option.
  5436. If the specified expression is not valid, it is kept at its current
  5437. value.
  5438. @section chromakey
  5439. YUV colorspace color/chroma keying.
  5440. The filter accepts the following options:
  5441. @table @option
  5442. @item color
  5443. The color which will be replaced with transparency.
  5444. @item similarity
  5445. Similarity percentage with the key color.
  5446. 0.01 matches only the exact key color, while 1.0 matches everything.
  5447. @item blend
  5448. Blend percentage.
  5449. 0.0 makes pixels either fully transparent, or not transparent at all.
  5450. Higher values result in semi-transparent pixels, with a higher transparency
  5451. the more similar the pixels color is to the key color.
  5452. @item yuv
  5453. Signals that the color passed is already in YUV instead of RGB.
  5454. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5455. This can be used to pass exact YUV values as hexadecimal numbers.
  5456. @end table
  5457. @subsection Commands
  5458. This filter supports same @ref{commands} as options.
  5459. The command accepts the same syntax of the corresponding option.
  5460. If the specified expression is not valid, it is kept at its current
  5461. value.
  5462. @subsection Examples
  5463. @itemize
  5464. @item
  5465. Make every green pixel in the input image transparent:
  5466. @example
  5467. ffmpeg -i input.png -vf chromakey=green out.png
  5468. @end example
  5469. @item
  5470. Overlay a greenscreen-video on top of a static black background.
  5471. @example
  5472. 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
  5473. @end example
  5474. @end itemize
  5475. @section chromashift
  5476. Shift chroma pixels horizontally and/or vertically.
  5477. The filter accepts the following options:
  5478. @table @option
  5479. @item cbh
  5480. Set amount to shift chroma-blue horizontally.
  5481. @item cbv
  5482. Set amount to shift chroma-blue vertically.
  5483. @item crh
  5484. Set amount to shift chroma-red horizontally.
  5485. @item crv
  5486. Set amount to shift chroma-red vertically.
  5487. @item edge
  5488. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5489. @end table
  5490. @subsection Commands
  5491. This filter supports the all above options as @ref{commands}.
  5492. @section ciescope
  5493. Display CIE color diagram with pixels overlaid onto it.
  5494. The filter accepts the following options:
  5495. @table @option
  5496. @item system
  5497. Set color system.
  5498. @table @samp
  5499. @item ntsc, 470m
  5500. @item ebu, 470bg
  5501. @item smpte
  5502. @item 240m
  5503. @item apple
  5504. @item widergb
  5505. @item cie1931
  5506. @item rec709, hdtv
  5507. @item uhdtv, rec2020
  5508. @item dcip3
  5509. @end table
  5510. @item cie
  5511. Set CIE system.
  5512. @table @samp
  5513. @item xyy
  5514. @item ucs
  5515. @item luv
  5516. @end table
  5517. @item gamuts
  5518. Set what gamuts to draw.
  5519. See @code{system} option for available values.
  5520. @item size, s
  5521. Set ciescope size, by default set to 512.
  5522. @item intensity, i
  5523. Set intensity used to map input pixel values to CIE diagram.
  5524. @item contrast
  5525. Set contrast used to draw tongue colors that are out of active color system gamut.
  5526. @item corrgamma
  5527. Correct gamma displayed on scope, by default enabled.
  5528. @item showwhite
  5529. Show white point on CIE diagram, by default disabled.
  5530. @item gamma
  5531. Set input gamma. Used only with XYZ input color space.
  5532. @end table
  5533. @section codecview
  5534. Visualize information exported by some codecs.
  5535. Some codecs can export information through frames using side-data or other
  5536. means. For example, some MPEG based codecs export motion vectors through the
  5537. @var{export_mvs} flag in the codec @option{flags2} option.
  5538. The filter accepts the following option:
  5539. @table @option
  5540. @item mv
  5541. Set motion vectors to visualize.
  5542. Available flags for @var{mv} are:
  5543. @table @samp
  5544. @item pf
  5545. forward predicted MVs of P-frames
  5546. @item bf
  5547. forward predicted MVs of B-frames
  5548. @item bb
  5549. backward predicted MVs of B-frames
  5550. @end table
  5551. @item qp
  5552. Display quantization parameters using the chroma planes.
  5553. @item mv_type, mvt
  5554. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5555. Available flags for @var{mv_type} are:
  5556. @table @samp
  5557. @item fp
  5558. forward predicted MVs
  5559. @item bp
  5560. backward predicted MVs
  5561. @end table
  5562. @item frame_type, ft
  5563. Set frame type to visualize motion vectors of.
  5564. Available flags for @var{frame_type} are:
  5565. @table @samp
  5566. @item if
  5567. intra-coded frames (I-frames)
  5568. @item pf
  5569. predicted frames (P-frames)
  5570. @item bf
  5571. bi-directionally predicted frames (B-frames)
  5572. @end table
  5573. @end table
  5574. @subsection Examples
  5575. @itemize
  5576. @item
  5577. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5578. @example
  5579. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5580. @end example
  5581. @item
  5582. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5583. @example
  5584. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5585. @end example
  5586. @end itemize
  5587. @section colorbalance
  5588. Modify intensity of primary colors (red, green and blue) of input frames.
  5589. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5590. regions for the red-cyan, green-magenta or blue-yellow balance.
  5591. A positive adjustment value shifts the balance towards the primary color, a negative
  5592. value towards the complementary color.
  5593. The filter accepts the following options:
  5594. @table @option
  5595. @item rs
  5596. @item gs
  5597. @item bs
  5598. Adjust red, green and blue shadows (darkest pixels).
  5599. @item rm
  5600. @item gm
  5601. @item bm
  5602. Adjust red, green and blue midtones (medium pixels).
  5603. @item rh
  5604. @item gh
  5605. @item bh
  5606. Adjust red, green and blue highlights (brightest pixels).
  5607. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5608. @item pl
  5609. Preserve lightness when changing color balance. Default is disabled.
  5610. @end table
  5611. @subsection Examples
  5612. @itemize
  5613. @item
  5614. Add red color cast to shadows:
  5615. @example
  5616. colorbalance=rs=.3
  5617. @end example
  5618. @end itemize
  5619. @subsection Commands
  5620. This filter supports the all above options as @ref{commands}.
  5621. @section colorchannelmixer
  5622. Adjust video input frames by re-mixing color channels.
  5623. This filter modifies a color channel by adding the values associated to
  5624. the other channels of the same pixels. For example if the value to
  5625. modify is red, the output value will be:
  5626. @example
  5627. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5628. @end example
  5629. The filter accepts the following options:
  5630. @table @option
  5631. @item rr
  5632. @item rg
  5633. @item rb
  5634. @item ra
  5635. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5636. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5637. @item gr
  5638. @item gg
  5639. @item gb
  5640. @item ga
  5641. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5642. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5643. @item br
  5644. @item bg
  5645. @item bb
  5646. @item ba
  5647. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5648. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5649. @item ar
  5650. @item ag
  5651. @item ab
  5652. @item aa
  5653. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5654. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5655. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5656. @end table
  5657. @subsection Examples
  5658. @itemize
  5659. @item
  5660. Convert source to grayscale:
  5661. @example
  5662. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5663. @end example
  5664. @item
  5665. Simulate sepia tones:
  5666. @example
  5667. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5668. @end example
  5669. @end itemize
  5670. @subsection Commands
  5671. This filter supports the all above options as @ref{commands}.
  5672. @section colorkey
  5673. RGB colorspace color keying.
  5674. The filter accepts the following options:
  5675. @table @option
  5676. @item color
  5677. The color which will be replaced with transparency.
  5678. @item similarity
  5679. Similarity percentage with the key color.
  5680. 0.01 matches only the exact key color, while 1.0 matches everything.
  5681. @item blend
  5682. Blend percentage.
  5683. 0.0 makes pixels either fully transparent, or not transparent at all.
  5684. Higher values result in semi-transparent pixels, with a higher transparency
  5685. the more similar the pixels color is to the key color.
  5686. @end table
  5687. @subsection Examples
  5688. @itemize
  5689. @item
  5690. Make every green pixel in the input image transparent:
  5691. @example
  5692. ffmpeg -i input.png -vf colorkey=green out.png
  5693. @end example
  5694. @item
  5695. Overlay a greenscreen-video on top of a static background image.
  5696. @example
  5697. 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
  5698. @end example
  5699. @end itemize
  5700. @subsection Commands
  5701. This filter supports same @ref{commands} as options.
  5702. The command accepts the same syntax of the corresponding option.
  5703. If the specified expression is not valid, it is kept at its current
  5704. value.
  5705. @section colorhold
  5706. Remove all color information for all RGB colors except for certain one.
  5707. The filter accepts the following options:
  5708. @table @option
  5709. @item color
  5710. The color which will not be replaced with neutral gray.
  5711. @item similarity
  5712. Similarity percentage with the above color.
  5713. 0.01 matches only the exact key color, while 1.0 matches everything.
  5714. @item blend
  5715. Blend percentage. 0.0 makes pixels fully gray.
  5716. Higher values result in more preserved color.
  5717. @end table
  5718. @subsection Commands
  5719. This filter supports same @ref{commands} as options.
  5720. The command accepts the same syntax of the corresponding option.
  5721. If the specified expression is not valid, it is kept at its current
  5722. value.
  5723. @section colorlevels
  5724. Adjust video input frames using levels.
  5725. The filter accepts the following options:
  5726. @table @option
  5727. @item rimin
  5728. @item gimin
  5729. @item bimin
  5730. @item aimin
  5731. Adjust red, green, blue and alpha input black point.
  5732. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5733. @item rimax
  5734. @item gimax
  5735. @item bimax
  5736. @item aimax
  5737. Adjust red, green, blue and alpha input white point.
  5738. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5739. Input levels are used to lighten highlights (bright tones), darken shadows
  5740. (dark tones), change the balance of bright and dark tones.
  5741. @item romin
  5742. @item gomin
  5743. @item bomin
  5744. @item aomin
  5745. Adjust red, green, blue and alpha output black point.
  5746. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5747. @item romax
  5748. @item gomax
  5749. @item bomax
  5750. @item aomax
  5751. Adjust red, green, blue and alpha output white point.
  5752. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5753. Output levels allows manual selection of a constrained output level range.
  5754. @end table
  5755. @subsection Examples
  5756. @itemize
  5757. @item
  5758. Make video output darker:
  5759. @example
  5760. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5761. @end example
  5762. @item
  5763. Increase contrast:
  5764. @example
  5765. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5766. @end example
  5767. @item
  5768. Make video output lighter:
  5769. @example
  5770. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5771. @end example
  5772. @item
  5773. Increase brightness:
  5774. @example
  5775. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5776. @end example
  5777. @end itemize
  5778. @subsection Commands
  5779. This filter supports the all above options as @ref{commands}.
  5780. @section colormatrix
  5781. Convert color matrix.
  5782. The filter accepts the following options:
  5783. @table @option
  5784. @item src
  5785. @item dst
  5786. Specify the source and destination color matrix. Both values must be
  5787. specified.
  5788. The accepted values are:
  5789. @table @samp
  5790. @item bt709
  5791. BT.709
  5792. @item fcc
  5793. FCC
  5794. @item bt601
  5795. BT.601
  5796. @item bt470
  5797. BT.470
  5798. @item bt470bg
  5799. BT.470BG
  5800. @item smpte170m
  5801. SMPTE-170M
  5802. @item smpte240m
  5803. SMPTE-240M
  5804. @item bt2020
  5805. BT.2020
  5806. @end table
  5807. @end table
  5808. For example to convert from BT.601 to SMPTE-240M, use the command:
  5809. @example
  5810. colormatrix=bt601:smpte240m
  5811. @end example
  5812. @section colorspace
  5813. Convert colorspace, transfer characteristics or color primaries.
  5814. Input video needs to have an even size.
  5815. The filter accepts the following options:
  5816. @table @option
  5817. @anchor{all}
  5818. @item all
  5819. Specify all color properties at once.
  5820. The accepted values are:
  5821. @table @samp
  5822. @item bt470m
  5823. BT.470M
  5824. @item bt470bg
  5825. BT.470BG
  5826. @item bt601-6-525
  5827. BT.601-6 525
  5828. @item bt601-6-625
  5829. BT.601-6 625
  5830. @item bt709
  5831. BT.709
  5832. @item smpte170m
  5833. SMPTE-170M
  5834. @item smpte240m
  5835. SMPTE-240M
  5836. @item bt2020
  5837. BT.2020
  5838. @end table
  5839. @anchor{space}
  5840. @item space
  5841. Specify output colorspace.
  5842. The accepted values are:
  5843. @table @samp
  5844. @item bt709
  5845. BT.709
  5846. @item fcc
  5847. FCC
  5848. @item bt470bg
  5849. BT.470BG or BT.601-6 625
  5850. @item smpte170m
  5851. SMPTE-170M or BT.601-6 525
  5852. @item smpte240m
  5853. SMPTE-240M
  5854. @item ycgco
  5855. YCgCo
  5856. @item bt2020ncl
  5857. BT.2020 with non-constant luminance
  5858. @end table
  5859. @anchor{trc}
  5860. @item trc
  5861. Specify output transfer characteristics.
  5862. The accepted values are:
  5863. @table @samp
  5864. @item bt709
  5865. BT.709
  5866. @item bt470m
  5867. BT.470M
  5868. @item bt470bg
  5869. BT.470BG
  5870. @item gamma22
  5871. Constant gamma of 2.2
  5872. @item gamma28
  5873. Constant gamma of 2.8
  5874. @item smpte170m
  5875. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5876. @item smpte240m
  5877. SMPTE-240M
  5878. @item srgb
  5879. SRGB
  5880. @item iec61966-2-1
  5881. iec61966-2-1
  5882. @item iec61966-2-4
  5883. iec61966-2-4
  5884. @item xvycc
  5885. xvycc
  5886. @item bt2020-10
  5887. BT.2020 for 10-bits content
  5888. @item bt2020-12
  5889. BT.2020 for 12-bits content
  5890. @end table
  5891. @anchor{primaries}
  5892. @item primaries
  5893. Specify output color primaries.
  5894. The accepted values are:
  5895. @table @samp
  5896. @item bt709
  5897. BT.709
  5898. @item bt470m
  5899. BT.470M
  5900. @item bt470bg
  5901. BT.470BG or BT.601-6 625
  5902. @item smpte170m
  5903. SMPTE-170M or BT.601-6 525
  5904. @item smpte240m
  5905. SMPTE-240M
  5906. @item film
  5907. film
  5908. @item smpte431
  5909. SMPTE-431
  5910. @item smpte432
  5911. SMPTE-432
  5912. @item bt2020
  5913. BT.2020
  5914. @item jedec-p22
  5915. JEDEC P22 phosphors
  5916. @end table
  5917. @anchor{range}
  5918. @item range
  5919. Specify output color range.
  5920. The accepted values are:
  5921. @table @samp
  5922. @item tv
  5923. TV (restricted) range
  5924. @item mpeg
  5925. MPEG (restricted) range
  5926. @item pc
  5927. PC (full) range
  5928. @item jpeg
  5929. JPEG (full) range
  5930. @end table
  5931. @item format
  5932. Specify output color format.
  5933. The accepted values are:
  5934. @table @samp
  5935. @item yuv420p
  5936. YUV 4:2:0 planar 8-bits
  5937. @item yuv420p10
  5938. YUV 4:2:0 planar 10-bits
  5939. @item yuv420p12
  5940. YUV 4:2:0 planar 12-bits
  5941. @item yuv422p
  5942. YUV 4:2:2 planar 8-bits
  5943. @item yuv422p10
  5944. YUV 4:2:2 planar 10-bits
  5945. @item yuv422p12
  5946. YUV 4:2:2 planar 12-bits
  5947. @item yuv444p
  5948. YUV 4:4:4 planar 8-bits
  5949. @item yuv444p10
  5950. YUV 4:4:4 planar 10-bits
  5951. @item yuv444p12
  5952. YUV 4:4:4 planar 12-bits
  5953. @end table
  5954. @item fast
  5955. Do a fast conversion, which skips gamma/primary correction. This will take
  5956. significantly less CPU, but will be mathematically incorrect. To get output
  5957. compatible with that produced by the colormatrix filter, use fast=1.
  5958. @item dither
  5959. Specify dithering mode.
  5960. The accepted values are:
  5961. @table @samp
  5962. @item none
  5963. No dithering
  5964. @item fsb
  5965. Floyd-Steinberg dithering
  5966. @end table
  5967. @item wpadapt
  5968. Whitepoint adaptation mode.
  5969. The accepted values are:
  5970. @table @samp
  5971. @item bradford
  5972. Bradford whitepoint adaptation
  5973. @item vonkries
  5974. von Kries whitepoint adaptation
  5975. @item identity
  5976. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5977. @end table
  5978. @item iall
  5979. Override all input properties at once. Same accepted values as @ref{all}.
  5980. @item ispace
  5981. Override input colorspace. Same accepted values as @ref{space}.
  5982. @item iprimaries
  5983. Override input color primaries. Same accepted values as @ref{primaries}.
  5984. @item itrc
  5985. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5986. @item irange
  5987. Override input color range. Same accepted values as @ref{range}.
  5988. @end table
  5989. The filter converts the transfer characteristics, color space and color
  5990. primaries to the specified user values. The output value, if not specified,
  5991. is set to a default value based on the "all" property. If that property is
  5992. also not specified, the filter will log an error. The output color range and
  5993. format default to the same value as the input color range and format. The
  5994. input transfer characteristics, color space, color primaries and color range
  5995. should be set on the input data. If any of these are missing, the filter will
  5996. log an error and no conversion will take place.
  5997. For example to convert the input to SMPTE-240M, use the command:
  5998. @example
  5999. colorspace=smpte240m
  6000. @end example
  6001. @section convolution
  6002. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  6003. The filter accepts the following options:
  6004. @table @option
  6005. @item 0m
  6006. @item 1m
  6007. @item 2m
  6008. @item 3m
  6009. Set matrix for each plane.
  6010. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  6011. and from 1 to 49 odd number of signed integers in @var{row} mode.
  6012. @item 0rdiv
  6013. @item 1rdiv
  6014. @item 2rdiv
  6015. @item 3rdiv
  6016. Set multiplier for calculated value for each plane.
  6017. If unset or 0, it will be sum of all matrix elements.
  6018. @item 0bias
  6019. @item 1bias
  6020. @item 2bias
  6021. @item 3bias
  6022. Set bias for each plane. This value is added to the result of the multiplication.
  6023. Useful for making the overall image brighter or darker. Default is 0.0.
  6024. @item 0mode
  6025. @item 1mode
  6026. @item 2mode
  6027. @item 3mode
  6028. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  6029. Default is @var{square}.
  6030. @end table
  6031. @subsection Examples
  6032. @itemize
  6033. @item
  6034. Apply sharpen:
  6035. @example
  6036. 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"
  6037. @end example
  6038. @item
  6039. Apply blur:
  6040. @example
  6041. 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"
  6042. @end example
  6043. @item
  6044. Apply edge enhance:
  6045. @example
  6046. 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"
  6047. @end example
  6048. @item
  6049. Apply edge detect:
  6050. @example
  6051. 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"
  6052. @end example
  6053. @item
  6054. Apply laplacian edge detector which includes diagonals:
  6055. @example
  6056. 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"
  6057. @end example
  6058. @item
  6059. Apply emboss:
  6060. @example
  6061. 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"
  6062. @end example
  6063. @end itemize
  6064. @section convolve
  6065. Apply 2D convolution of video stream in frequency domain using second stream
  6066. as impulse.
  6067. The filter accepts the following options:
  6068. @table @option
  6069. @item planes
  6070. Set which planes to process.
  6071. @item impulse
  6072. Set which impulse video frames will be processed, can be @var{first}
  6073. or @var{all}. Default is @var{all}.
  6074. @end table
  6075. The @code{convolve} filter also supports the @ref{framesync} options.
  6076. @section copy
  6077. Copy the input video source unchanged to the output. This is mainly useful for
  6078. testing purposes.
  6079. @anchor{coreimage}
  6080. @section coreimage
  6081. Video filtering on GPU using Apple's CoreImage API on OSX.
  6082. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  6083. processed by video hardware. However, software-based OpenGL implementations
  6084. exist which means there is no guarantee for hardware processing. It depends on
  6085. the respective OSX.
  6086. There are many filters and image generators provided by Apple that come with a
  6087. large variety of options. The filter has to be referenced by its name along
  6088. with its options.
  6089. The coreimage filter accepts the following options:
  6090. @table @option
  6091. @item list_filters
  6092. List all available filters and generators along with all their respective
  6093. options as well as possible minimum and maximum values along with the default
  6094. values.
  6095. @example
  6096. list_filters=true
  6097. @end example
  6098. @item filter
  6099. Specify all filters by their respective name and options.
  6100. Use @var{list_filters} to determine all valid filter names and options.
  6101. Numerical options are specified by a float value and are automatically clamped
  6102. to their respective value range. Vector and color options have to be specified
  6103. by a list of space separated float values. Character escaping has to be done.
  6104. A special option name @code{default} is available to use default options for a
  6105. filter.
  6106. It is required to specify either @code{default} or at least one of the filter options.
  6107. All omitted options are used with their default values.
  6108. The syntax of the filter string is as follows:
  6109. @example
  6110. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  6111. @end example
  6112. @item output_rect
  6113. Specify a rectangle where the output of the filter chain is copied into the
  6114. input image. It is given by a list of space separated float values:
  6115. @example
  6116. output_rect=x\ y\ width\ height
  6117. @end example
  6118. If not given, the output rectangle equals the dimensions of the input image.
  6119. The output rectangle is automatically cropped at the borders of the input
  6120. image. Negative values are valid for each component.
  6121. @example
  6122. output_rect=25\ 25\ 100\ 100
  6123. @end example
  6124. @end table
  6125. Several filters can be chained for successive processing without GPU-HOST
  6126. transfers allowing for fast processing of complex filter chains.
  6127. Currently, only filters with zero (generators) or exactly one (filters) input
  6128. image and one output image are supported. Also, transition filters are not yet
  6129. usable as intended.
  6130. Some filters generate output images with additional padding depending on the
  6131. respective filter kernel. The padding is automatically removed to ensure the
  6132. filter output has the same size as the input image.
  6133. For image generators, the size of the output image is determined by the
  6134. previous output image of the filter chain or the input image of the whole
  6135. filterchain, respectively. The generators do not use the pixel information of
  6136. this image to generate their output. However, the generated output is
  6137. blended onto this image, resulting in partial or complete coverage of the
  6138. output image.
  6139. The @ref{coreimagesrc} video source can be used for generating input images
  6140. which are directly fed into the filter chain. By using it, providing input
  6141. images by another video source or an input video is not required.
  6142. @subsection Examples
  6143. @itemize
  6144. @item
  6145. List all filters available:
  6146. @example
  6147. coreimage=list_filters=true
  6148. @end example
  6149. @item
  6150. Use the CIBoxBlur filter with default options to blur an image:
  6151. @example
  6152. coreimage=filter=CIBoxBlur@@default
  6153. @end example
  6154. @item
  6155. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  6156. its center at 100x100 and a radius of 50 pixels:
  6157. @example
  6158. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  6159. @end example
  6160. @item
  6161. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  6162. given as complete and escaped command-line for Apple's standard bash shell:
  6163. @example
  6164. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  6165. @end example
  6166. @end itemize
  6167. @section cover_rect
  6168. Cover a rectangular object
  6169. It accepts the following options:
  6170. @table @option
  6171. @item cover
  6172. Filepath of the optional cover image, needs to be in yuv420.
  6173. @item mode
  6174. Set covering mode.
  6175. It accepts the following values:
  6176. @table @samp
  6177. @item cover
  6178. cover it by the supplied image
  6179. @item blur
  6180. cover it by interpolating the surrounding pixels
  6181. @end table
  6182. Default value is @var{blur}.
  6183. @end table
  6184. @subsection Examples
  6185. @itemize
  6186. @item
  6187. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  6188. @example
  6189. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6190. @end example
  6191. @end itemize
  6192. @section crop
  6193. Crop the input video to given dimensions.
  6194. It accepts the following parameters:
  6195. @table @option
  6196. @item w, out_w
  6197. The width of the output video. It defaults to @code{iw}.
  6198. This expression is evaluated only once during the filter
  6199. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  6200. @item h, out_h
  6201. The height of the output video. It defaults to @code{ih}.
  6202. This expression is evaluated only once during the filter
  6203. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  6204. @item x
  6205. The horizontal position, in the input video, of the left edge of the output
  6206. video. It defaults to @code{(in_w-out_w)/2}.
  6207. This expression is evaluated per-frame.
  6208. @item y
  6209. The vertical position, in the input video, of the top edge of the output video.
  6210. It defaults to @code{(in_h-out_h)/2}.
  6211. This expression is evaluated per-frame.
  6212. @item keep_aspect
  6213. If set to 1 will force the output display aspect ratio
  6214. to be the same of the input, by changing the output sample aspect
  6215. ratio. It defaults to 0.
  6216. @item exact
  6217. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  6218. width/height/x/y as specified and will not be rounded to nearest smaller value.
  6219. It defaults to 0.
  6220. @end table
  6221. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  6222. expressions containing the following constants:
  6223. @table @option
  6224. @item x
  6225. @item y
  6226. The computed values for @var{x} and @var{y}. They are evaluated for
  6227. each new frame.
  6228. @item in_w
  6229. @item in_h
  6230. The input width and height.
  6231. @item iw
  6232. @item ih
  6233. These are the same as @var{in_w} and @var{in_h}.
  6234. @item out_w
  6235. @item out_h
  6236. The output (cropped) width and height.
  6237. @item ow
  6238. @item oh
  6239. These are the same as @var{out_w} and @var{out_h}.
  6240. @item a
  6241. same as @var{iw} / @var{ih}
  6242. @item sar
  6243. input sample aspect ratio
  6244. @item dar
  6245. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6246. @item hsub
  6247. @item vsub
  6248. horizontal and vertical chroma subsample values. For example for the
  6249. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6250. @item n
  6251. The number of the input frame, starting from 0.
  6252. @item pos
  6253. the position in the file of the input frame, NAN if unknown
  6254. @item t
  6255. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6256. @end table
  6257. The expression for @var{out_w} may depend on the value of @var{out_h},
  6258. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6259. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6260. evaluated after @var{out_w} and @var{out_h}.
  6261. The @var{x} and @var{y} parameters specify the expressions for the
  6262. position of the top-left corner of the output (non-cropped) area. They
  6263. are evaluated for each frame. If the evaluated value is not valid, it
  6264. is approximated to the nearest valid value.
  6265. The expression for @var{x} may depend on @var{y}, and the expression
  6266. for @var{y} may depend on @var{x}.
  6267. @subsection Examples
  6268. @itemize
  6269. @item
  6270. Crop area with size 100x100 at position (12,34).
  6271. @example
  6272. crop=100:100:12:34
  6273. @end example
  6274. Using named options, the example above becomes:
  6275. @example
  6276. crop=w=100:h=100:x=12:y=34
  6277. @end example
  6278. @item
  6279. Crop the central input area with size 100x100:
  6280. @example
  6281. crop=100:100
  6282. @end example
  6283. @item
  6284. Crop the central input area with size 2/3 of the input video:
  6285. @example
  6286. crop=2/3*in_w:2/3*in_h
  6287. @end example
  6288. @item
  6289. Crop the input video central square:
  6290. @example
  6291. crop=out_w=in_h
  6292. crop=in_h
  6293. @end example
  6294. @item
  6295. Delimit the rectangle with the top-left corner placed at position
  6296. 100:100 and the right-bottom corner corresponding to the right-bottom
  6297. corner of the input image.
  6298. @example
  6299. crop=in_w-100:in_h-100:100:100
  6300. @end example
  6301. @item
  6302. Crop 10 pixels from the left and right borders, and 20 pixels from
  6303. the top and bottom borders
  6304. @example
  6305. crop=in_w-2*10:in_h-2*20
  6306. @end example
  6307. @item
  6308. Keep only the bottom right quarter of the input image:
  6309. @example
  6310. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6311. @end example
  6312. @item
  6313. Crop height for getting Greek harmony:
  6314. @example
  6315. crop=in_w:1/PHI*in_w
  6316. @end example
  6317. @item
  6318. Apply trembling effect:
  6319. @example
  6320. 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)
  6321. @end example
  6322. @item
  6323. Apply erratic camera effect depending on timestamp:
  6324. @example
  6325. 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)"
  6326. @end example
  6327. @item
  6328. Set x depending on the value of y:
  6329. @example
  6330. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6331. @end example
  6332. @end itemize
  6333. @subsection Commands
  6334. This filter supports the following commands:
  6335. @table @option
  6336. @item w, out_w
  6337. @item h, out_h
  6338. @item x
  6339. @item y
  6340. Set width/height of the output video and the horizontal/vertical position
  6341. in the input video.
  6342. The command accepts the same syntax of the corresponding option.
  6343. If the specified expression is not valid, it is kept at its current
  6344. value.
  6345. @end table
  6346. @section cropdetect
  6347. Auto-detect the crop size.
  6348. It calculates the necessary cropping parameters and prints the
  6349. recommended parameters via the logging system. The detected dimensions
  6350. correspond to the non-black area of the input video.
  6351. It accepts the following parameters:
  6352. @table @option
  6353. @item limit
  6354. Set higher black value threshold, which can be optionally specified
  6355. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6356. value greater to the set value is considered non-black. It defaults to 24.
  6357. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6358. on the bitdepth of the pixel format.
  6359. @item round
  6360. The value which the width/height should be divisible by. It defaults to
  6361. 16. The offset is automatically adjusted to center the video. Use 2 to
  6362. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6363. encoding to most video codecs.
  6364. @item reset_count, reset
  6365. Set the counter that determines after how many frames cropdetect will
  6366. reset the previously detected largest video area and start over to
  6367. detect the current optimal crop area. Default value is 0.
  6368. This can be useful when channel logos distort the video area. 0
  6369. indicates 'never reset', and returns the largest area encountered during
  6370. playback.
  6371. @end table
  6372. @anchor{cue}
  6373. @section cue
  6374. Delay video filtering until a given wallclock timestamp. The filter first
  6375. passes on @option{preroll} amount of frames, then it buffers at most
  6376. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6377. it forwards the buffered frames and also any subsequent frames coming in its
  6378. input.
  6379. The filter can be used synchronize the output of multiple ffmpeg processes for
  6380. realtime output devices like decklink. By putting the delay in the filtering
  6381. chain and pre-buffering frames the process can pass on data to output almost
  6382. immediately after the target wallclock timestamp is reached.
  6383. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6384. some use cases.
  6385. @table @option
  6386. @item cue
  6387. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6388. @item preroll
  6389. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6390. @item buffer
  6391. The maximum duration of content to buffer before waiting for the cue expressed
  6392. in seconds. Default is 0.
  6393. @end table
  6394. @anchor{curves}
  6395. @section curves
  6396. Apply color adjustments using curves.
  6397. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6398. component (red, green and blue) has its values defined by @var{N} key points
  6399. tied from each other using a smooth curve. The x-axis represents the pixel
  6400. values from the input frame, and the y-axis the new pixel values to be set for
  6401. the output frame.
  6402. By default, a component curve is defined by the two points @var{(0;0)} and
  6403. @var{(1;1)}. This creates a straight line where each original pixel value is
  6404. "adjusted" to its own value, which means no change to the image.
  6405. The filter allows you to redefine these two points and add some more. A new
  6406. curve (using a natural cubic spline interpolation) will be define to pass
  6407. smoothly through all these new coordinates. The new defined points needs to be
  6408. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6409. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6410. the vector spaces, the values will be clipped accordingly.
  6411. The filter accepts the following options:
  6412. @table @option
  6413. @item preset
  6414. Select one of the available color presets. This option can be used in addition
  6415. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6416. options takes priority on the preset values.
  6417. Available presets are:
  6418. @table @samp
  6419. @item none
  6420. @item color_negative
  6421. @item cross_process
  6422. @item darker
  6423. @item increase_contrast
  6424. @item lighter
  6425. @item linear_contrast
  6426. @item medium_contrast
  6427. @item negative
  6428. @item strong_contrast
  6429. @item vintage
  6430. @end table
  6431. Default is @code{none}.
  6432. @item master, m
  6433. Set the master key points. These points will define a second pass mapping. It
  6434. is sometimes called a "luminance" or "value" mapping. It can be used with
  6435. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6436. post-processing LUT.
  6437. @item red, r
  6438. Set the key points for the red component.
  6439. @item green, g
  6440. Set the key points for the green component.
  6441. @item blue, b
  6442. Set the key points for the blue component.
  6443. @item all
  6444. Set the key points for all components (not including master).
  6445. Can be used in addition to the other key points component
  6446. options. In this case, the unset component(s) will fallback on this
  6447. @option{all} setting.
  6448. @item psfile
  6449. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6450. @item plot
  6451. Save Gnuplot script of the curves in specified file.
  6452. @end table
  6453. To avoid some filtergraph syntax conflicts, each key points list need to be
  6454. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6455. @subsection Examples
  6456. @itemize
  6457. @item
  6458. Increase slightly the middle level of blue:
  6459. @example
  6460. curves=blue='0/0 0.5/0.58 1/1'
  6461. @end example
  6462. @item
  6463. Vintage effect:
  6464. @example
  6465. 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'
  6466. @end example
  6467. Here we obtain the following coordinates for each components:
  6468. @table @var
  6469. @item red
  6470. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6471. @item green
  6472. @code{(0;0) (0.50;0.48) (1;1)}
  6473. @item blue
  6474. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6475. @end table
  6476. @item
  6477. The previous example can also be achieved with the associated built-in preset:
  6478. @example
  6479. curves=preset=vintage
  6480. @end example
  6481. @item
  6482. Or simply:
  6483. @example
  6484. curves=vintage
  6485. @end example
  6486. @item
  6487. Use a Photoshop preset and redefine the points of the green component:
  6488. @example
  6489. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6490. @end example
  6491. @item
  6492. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6493. and @command{gnuplot}:
  6494. @example
  6495. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6496. gnuplot -p /tmp/curves.plt
  6497. @end example
  6498. @end itemize
  6499. @section datascope
  6500. Video data analysis filter.
  6501. This filter shows hexadecimal pixel values of part of video.
  6502. The filter accepts the following options:
  6503. @table @option
  6504. @item size, s
  6505. Set output video size.
  6506. @item x
  6507. Set x offset from where to pick pixels.
  6508. @item y
  6509. Set y offset from where to pick pixels.
  6510. @item mode
  6511. Set scope mode, can be one of the following:
  6512. @table @samp
  6513. @item mono
  6514. Draw hexadecimal pixel values with white color on black background.
  6515. @item color
  6516. Draw hexadecimal pixel values with input video pixel color on black
  6517. background.
  6518. @item color2
  6519. Draw hexadecimal pixel values on color background picked from input video,
  6520. the text color is picked in such way so its always visible.
  6521. @end table
  6522. @item axis
  6523. Draw rows and columns numbers on left and top of video.
  6524. @item opacity
  6525. Set background opacity.
  6526. @item format
  6527. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  6528. @end table
  6529. @section dctdnoiz
  6530. Denoise frames using 2D DCT (frequency domain filtering).
  6531. This filter is not designed for real time.
  6532. The filter accepts the following options:
  6533. @table @option
  6534. @item sigma, s
  6535. Set the noise sigma constant.
  6536. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6537. coefficient (absolute value) below this threshold with be dropped.
  6538. If you need a more advanced filtering, see @option{expr}.
  6539. Default is @code{0}.
  6540. @item overlap
  6541. Set number overlapping pixels for each block. Since the filter can be slow, you
  6542. may want to reduce this value, at the cost of a less effective filter and the
  6543. risk of various artefacts.
  6544. If the overlapping value doesn't permit processing the whole input width or
  6545. height, a warning will be displayed and according borders won't be denoised.
  6546. Default value is @var{blocksize}-1, which is the best possible setting.
  6547. @item expr, e
  6548. Set the coefficient factor expression.
  6549. For each coefficient of a DCT block, this expression will be evaluated as a
  6550. multiplier value for the coefficient.
  6551. If this is option is set, the @option{sigma} option will be ignored.
  6552. The absolute value of the coefficient can be accessed through the @var{c}
  6553. variable.
  6554. @item n
  6555. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6556. @var{blocksize}, which is the width and height of the processed blocks.
  6557. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6558. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6559. on the speed processing. Also, a larger block size does not necessarily means a
  6560. better de-noising.
  6561. @end table
  6562. @subsection Examples
  6563. Apply a denoise with a @option{sigma} of @code{4.5}:
  6564. @example
  6565. dctdnoiz=4.5
  6566. @end example
  6567. The same operation can be achieved using the expression system:
  6568. @example
  6569. dctdnoiz=e='gte(c, 4.5*3)'
  6570. @end example
  6571. Violent denoise using a block size of @code{16x16}:
  6572. @example
  6573. dctdnoiz=15:n=4
  6574. @end example
  6575. @section deband
  6576. Remove banding artifacts from input video.
  6577. It works by replacing banded pixels with average value of referenced pixels.
  6578. The filter accepts the following options:
  6579. @table @option
  6580. @item 1thr
  6581. @item 2thr
  6582. @item 3thr
  6583. @item 4thr
  6584. Set banding detection threshold for each plane. Default is 0.02.
  6585. Valid range is 0.00003 to 0.5.
  6586. If difference between current pixel and reference pixel is less than threshold,
  6587. it will be considered as banded.
  6588. @item range, r
  6589. Banding detection range in pixels. Default is 16. If positive, random number
  6590. in range 0 to set value will be used. If negative, exact absolute value
  6591. will be used.
  6592. The range defines square of four pixels around current pixel.
  6593. @item direction, d
  6594. Set direction in radians from which four pixel will be compared. If positive,
  6595. random direction from 0 to set direction will be picked. If negative, exact of
  6596. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6597. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6598. column.
  6599. @item blur, b
  6600. If enabled, current pixel is compared with average value of all four
  6601. surrounding pixels. The default is enabled. If disabled current pixel is
  6602. compared with all four surrounding pixels. The pixel is considered banded
  6603. if only all four differences with surrounding pixels are less than threshold.
  6604. @item coupling, c
  6605. If enabled, current pixel is changed if and only if all pixel components are banded,
  6606. e.g. banding detection threshold is triggered for all color components.
  6607. The default is disabled.
  6608. @end table
  6609. @section deblock
  6610. Remove blocking artifacts from input video.
  6611. The filter accepts the following options:
  6612. @table @option
  6613. @item filter
  6614. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6615. This controls what kind of deblocking is applied.
  6616. @item block
  6617. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6618. @item alpha
  6619. @item beta
  6620. @item gamma
  6621. @item delta
  6622. Set blocking detection thresholds. Allowed range is 0 to 1.
  6623. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6624. Using higher threshold gives more deblocking strength.
  6625. Setting @var{alpha} controls threshold detection at exact edge of block.
  6626. Remaining options controls threshold detection near the edge. Each one for
  6627. below/above or left/right. Setting any of those to @var{0} disables
  6628. deblocking.
  6629. @item planes
  6630. Set planes to filter. Default is to filter all available planes.
  6631. @end table
  6632. @subsection Examples
  6633. @itemize
  6634. @item
  6635. Deblock using weak filter and block size of 4 pixels.
  6636. @example
  6637. deblock=filter=weak:block=4
  6638. @end example
  6639. @item
  6640. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6641. deblocking more edges.
  6642. @example
  6643. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6644. @end example
  6645. @item
  6646. Similar as above, but filter only first plane.
  6647. @example
  6648. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6649. @end example
  6650. @item
  6651. Similar as above, but filter only second and third plane.
  6652. @example
  6653. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6654. @end example
  6655. @end itemize
  6656. @anchor{decimate}
  6657. @section decimate
  6658. Drop duplicated frames at regular intervals.
  6659. The filter accepts the following options:
  6660. @table @option
  6661. @item cycle
  6662. Set the number of frames from which one will be dropped. Setting this to
  6663. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6664. Default is @code{5}.
  6665. @item dupthresh
  6666. Set the threshold for duplicate detection. If the difference metric for a frame
  6667. is less than or equal to this value, then it is declared as duplicate. Default
  6668. is @code{1.1}
  6669. @item scthresh
  6670. Set scene change threshold. Default is @code{15}.
  6671. @item blockx
  6672. @item blocky
  6673. Set the size of the x and y-axis blocks used during metric calculations.
  6674. Larger blocks give better noise suppression, but also give worse detection of
  6675. small movements. Must be a power of two. Default is @code{32}.
  6676. @item ppsrc
  6677. Mark main input as a pre-processed input and activate clean source input
  6678. stream. This allows the input to be pre-processed with various filters to help
  6679. the metrics calculation while keeping the frame selection lossless. When set to
  6680. @code{1}, the first stream is for the pre-processed input, and the second
  6681. stream is the clean source from where the kept frames are chosen. Default is
  6682. @code{0}.
  6683. @item chroma
  6684. Set whether or not chroma is considered in the metric calculations. Default is
  6685. @code{1}.
  6686. @end table
  6687. @section deconvolve
  6688. Apply 2D deconvolution of video stream in frequency domain using second stream
  6689. as impulse.
  6690. The filter accepts the following options:
  6691. @table @option
  6692. @item planes
  6693. Set which planes to process.
  6694. @item impulse
  6695. Set which impulse video frames will be processed, can be @var{first}
  6696. or @var{all}. Default is @var{all}.
  6697. @item noise
  6698. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6699. and height are not same and not power of 2 or if stream prior to convolving
  6700. had noise.
  6701. @end table
  6702. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6703. @section dedot
  6704. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6705. It accepts the following options:
  6706. @table @option
  6707. @item m
  6708. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6709. @var{rainbows} for cross-color reduction.
  6710. @item lt
  6711. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6712. @item tl
  6713. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6714. @item tc
  6715. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6716. @item ct
  6717. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6718. @end table
  6719. @section deflate
  6720. Apply deflate effect to the video.
  6721. This filter replaces the pixel by the local(3x3) average by taking into account
  6722. only values lower than the pixel.
  6723. It accepts the following options:
  6724. @table @option
  6725. @item threshold0
  6726. @item threshold1
  6727. @item threshold2
  6728. @item threshold3
  6729. Limit the maximum change for each plane, default is 65535.
  6730. If 0, plane will remain unchanged.
  6731. @end table
  6732. @subsection Commands
  6733. This filter supports the all above options as @ref{commands}.
  6734. @section deflicker
  6735. Remove temporal frame luminance variations.
  6736. It accepts the following options:
  6737. @table @option
  6738. @item size, s
  6739. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6740. @item mode, m
  6741. Set averaging mode to smooth temporal luminance variations.
  6742. Available values are:
  6743. @table @samp
  6744. @item am
  6745. Arithmetic mean
  6746. @item gm
  6747. Geometric mean
  6748. @item hm
  6749. Harmonic mean
  6750. @item qm
  6751. Quadratic mean
  6752. @item cm
  6753. Cubic mean
  6754. @item pm
  6755. Power mean
  6756. @item median
  6757. Median
  6758. @end table
  6759. @item bypass
  6760. Do not actually modify frame. Useful when one only wants metadata.
  6761. @end table
  6762. @section dejudder
  6763. Remove judder produced by partially interlaced telecined content.
  6764. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6765. source was partially telecined content then the output of @code{pullup,dejudder}
  6766. will have a variable frame rate. May change the recorded frame rate of the
  6767. container. Aside from that change, this filter will not affect constant frame
  6768. rate video.
  6769. The option available in this filter is:
  6770. @table @option
  6771. @item cycle
  6772. Specify the length of the window over which the judder repeats.
  6773. Accepts any integer greater than 1. Useful values are:
  6774. @table @samp
  6775. @item 4
  6776. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6777. @item 5
  6778. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6779. @item 20
  6780. If a mixture of the two.
  6781. @end table
  6782. The default is @samp{4}.
  6783. @end table
  6784. @section delogo
  6785. Suppress a TV station logo by a simple interpolation of the surrounding
  6786. pixels. Just set a rectangle covering the logo and watch it disappear
  6787. (and sometimes something even uglier appear - your mileage may vary).
  6788. It accepts the following parameters:
  6789. @table @option
  6790. @item x
  6791. @item y
  6792. Specify the top left corner coordinates of the logo. They must be
  6793. specified.
  6794. @item w
  6795. @item h
  6796. Specify the width and height of the logo to clear. They must be
  6797. specified.
  6798. @item band, t
  6799. Specify the thickness of the fuzzy edge of the rectangle (added to
  6800. @var{w} and @var{h}). The default value is 1. This option is
  6801. deprecated, setting higher values should no longer be necessary and
  6802. is not recommended.
  6803. @item show
  6804. When set to 1, a green rectangle is drawn on the screen to simplify
  6805. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6806. The default value is 0.
  6807. The rectangle is drawn on the outermost pixels which will be (partly)
  6808. replaced with interpolated values. The values of the next pixels
  6809. immediately outside this rectangle in each direction will be used to
  6810. compute the interpolated pixel values inside the rectangle.
  6811. @end table
  6812. @subsection Examples
  6813. @itemize
  6814. @item
  6815. Set a rectangle covering the area with top left corner coordinates 0,0
  6816. and size 100x77, and a band of size 10:
  6817. @example
  6818. delogo=x=0:y=0:w=100:h=77:band=10
  6819. @end example
  6820. @end itemize
  6821. @anchor{derain}
  6822. @section derain
  6823. Remove the rain in the input image/video by applying the derain methods based on
  6824. convolutional neural networks. Supported models:
  6825. @itemize
  6826. @item
  6827. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  6828. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  6829. @end itemize
  6830. Training as well as model generation scripts are provided in
  6831. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  6832. Native model files (.model) can be generated from TensorFlow model
  6833. files (.pb) by using tools/python/convert.py
  6834. The filter accepts the following options:
  6835. @table @option
  6836. @item filter_type
  6837. Specify which filter to use. This option accepts the following values:
  6838. @table @samp
  6839. @item derain
  6840. Derain filter. To conduct derain filter, you need to use a derain model.
  6841. @item dehaze
  6842. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  6843. @end table
  6844. Default value is @samp{derain}.
  6845. @item dnn_backend
  6846. Specify which DNN backend to use for model loading and execution. This option accepts
  6847. the following values:
  6848. @table @samp
  6849. @item native
  6850. Native implementation of DNN loading and execution.
  6851. @item tensorflow
  6852. TensorFlow backend. To enable this backend you
  6853. need to install the TensorFlow for C library (see
  6854. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  6855. @code{--enable-libtensorflow}
  6856. @end table
  6857. Default value is @samp{native}.
  6858. @item model
  6859. Set path to model file specifying network architecture and its parameters.
  6860. Note that different backends use different file formats. TensorFlow and native
  6861. backend can load files for only its format.
  6862. @end table
  6863. It can also be finished with @ref{dnn_processing} filter.
  6864. @section deshake
  6865. Attempt to fix small changes in horizontal and/or vertical shift. This
  6866. filter helps remove camera shake from hand-holding a camera, bumping a
  6867. tripod, moving on a vehicle, etc.
  6868. The filter accepts the following options:
  6869. @table @option
  6870. @item x
  6871. @item y
  6872. @item w
  6873. @item h
  6874. Specify a rectangular area where to limit the search for motion
  6875. vectors.
  6876. If desired the search for motion vectors can be limited to a
  6877. rectangular area of the frame defined by its top left corner, width
  6878. and height. These parameters have the same meaning as the drawbox
  6879. filter which can be used to visualise the position of the bounding
  6880. box.
  6881. This is useful when simultaneous movement of subjects within the frame
  6882. might be confused for camera motion by the motion vector search.
  6883. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6884. then the full frame is used. This allows later options to be set
  6885. without specifying the bounding box for the motion vector search.
  6886. Default - search the whole frame.
  6887. @item rx
  6888. @item ry
  6889. Specify the maximum extent of movement in x and y directions in the
  6890. range 0-64 pixels. Default 16.
  6891. @item edge
  6892. Specify how to generate pixels to fill blanks at the edge of the
  6893. frame. Available values are:
  6894. @table @samp
  6895. @item blank, 0
  6896. Fill zeroes at blank locations
  6897. @item original, 1
  6898. Original image at blank locations
  6899. @item clamp, 2
  6900. Extruded edge value at blank locations
  6901. @item mirror, 3
  6902. Mirrored edge at blank locations
  6903. @end table
  6904. Default value is @samp{mirror}.
  6905. @item blocksize
  6906. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6907. default 8.
  6908. @item contrast
  6909. Specify the contrast threshold for blocks. Only blocks with more than
  6910. the specified contrast (difference between darkest and lightest
  6911. pixels) will be considered. Range 1-255, default 125.
  6912. @item search
  6913. Specify the search strategy. Available values are:
  6914. @table @samp
  6915. @item exhaustive, 0
  6916. Set exhaustive search
  6917. @item less, 1
  6918. Set less exhaustive search.
  6919. @end table
  6920. Default value is @samp{exhaustive}.
  6921. @item filename
  6922. If set then a detailed log of the motion search is written to the
  6923. specified file.
  6924. @end table
  6925. @section despill
  6926. Remove unwanted contamination of foreground colors, caused by reflected color of
  6927. greenscreen or bluescreen.
  6928. This filter accepts the following options:
  6929. @table @option
  6930. @item type
  6931. Set what type of despill to use.
  6932. @item mix
  6933. Set how spillmap will be generated.
  6934. @item expand
  6935. Set how much to get rid of still remaining spill.
  6936. @item red
  6937. Controls amount of red in spill area.
  6938. @item green
  6939. Controls amount of green in spill area.
  6940. Should be -1 for greenscreen.
  6941. @item blue
  6942. Controls amount of blue in spill area.
  6943. Should be -1 for bluescreen.
  6944. @item brightness
  6945. Controls brightness of spill area, preserving colors.
  6946. @item alpha
  6947. Modify alpha from generated spillmap.
  6948. @end table
  6949. @section detelecine
  6950. Apply an exact inverse of the telecine operation. It requires a predefined
  6951. pattern specified using the pattern option which must be the same as that passed
  6952. to the telecine filter.
  6953. This filter accepts the following options:
  6954. @table @option
  6955. @item first_field
  6956. @table @samp
  6957. @item top, t
  6958. top field first
  6959. @item bottom, b
  6960. bottom field first
  6961. The default value is @code{top}.
  6962. @end table
  6963. @item pattern
  6964. A string of numbers representing the pulldown pattern you wish to apply.
  6965. The default value is @code{23}.
  6966. @item start_frame
  6967. A number representing position of the first frame with respect to the telecine
  6968. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6969. @end table
  6970. @section dilation
  6971. Apply dilation effect to the video.
  6972. This filter replaces the pixel by the local(3x3) maximum.
  6973. It accepts the following options:
  6974. @table @option
  6975. @item threshold0
  6976. @item threshold1
  6977. @item threshold2
  6978. @item threshold3
  6979. Limit the maximum change for each plane, default is 65535.
  6980. If 0, plane will remain unchanged.
  6981. @item coordinates
  6982. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6983. pixels are used.
  6984. Flags to local 3x3 coordinates maps like this:
  6985. 1 2 3
  6986. 4 5
  6987. 6 7 8
  6988. @end table
  6989. @subsection Commands
  6990. This filter supports the all above options as @ref{commands}.
  6991. @section displace
  6992. Displace pixels as indicated by second and third input stream.
  6993. It takes three input streams and outputs one stream, the first input is the
  6994. source, and second and third input are displacement maps.
  6995. The second input specifies how much to displace pixels along the
  6996. x-axis, while the third input specifies how much to displace pixels
  6997. along the y-axis.
  6998. If one of displacement map streams terminates, last frame from that
  6999. displacement map will be used.
  7000. Note that once generated, displacements maps can be reused over and over again.
  7001. A description of the accepted options follows.
  7002. @table @option
  7003. @item edge
  7004. Set displace behavior for pixels that are out of range.
  7005. Available values are:
  7006. @table @samp
  7007. @item blank
  7008. Missing pixels are replaced by black pixels.
  7009. @item smear
  7010. Adjacent pixels will spread out to replace missing pixels.
  7011. @item wrap
  7012. Out of range pixels are wrapped so they point to pixels of other side.
  7013. @item mirror
  7014. Out of range pixels will be replaced with mirrored pixels.
  7015. @end table
  7016. Default is @samp{smear}.
  7017. @end table
  7018. @subsection Examples
  7019. @itemize
  7020. @item
  7021. Add ripple effect to rgb input of video size hd720:
  7022. @example
  7023. 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
  7024. @end example
  7025. @item
  7026. Add wave effect to rgb input of video size hd720:
  7027. @example
  7028. 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
  7029. @end example
  7030. @end itemize
  7031. @anchor{dnn_processing}
  7032. @section dnn_processing
  7033. Do image processing with deep neural networks. It works together with another filter
  7034. which converts the pixel format of the Frame to what the dnn network requires.
  7035. The filter accepts the following options:
  7036. @table @option
  7037. @item dnn_backend
  7038. Specify which DNN backend to use for model loading and execution. This option accepts
  7039. the following values:
  7040. @table @samp
  7041. @item native
  7042. Native implementation of DNN loading and execution.
  7043. @item tensorflow
  7044. TensorFlow backend. To enable this backend you
  7045. need to install the TensorFlow for C library (see
  7046. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7047. @code{--enable-libtensorflow}
  7048. @end table
  7049. Default value is @samp{native}.
  7050. @item model
  7051. Set path to model file specifying network architecture and its parameters.
  7052. Note that different backends use different file formats. TensorFlow and native
  7053. backend can load files for only its format.
  7054. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  7055. @item input
  7056. Set the input name of the dnn network.
  7057. @item output
  7058. Set the output name of the dnn network.
  7059. @end table
  7060. @subsection Examples
  7061. @itemize
  7062. @item
  7063. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  7064. @example
  7065. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  7066. @end example
  7067. @item
  7068. Halve the pixel value of the frame with format gray32f:
  7069. @example
  7070. ffmpeg -i input.jpg -vf format=grayf32,dnn_processing=model=halve_gray_float.model:input=dnn_in:output=dnn_out:dnn_backend=native -y out.native.png
  7071. @end example
  7072. @item
  7073. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  7074. @example
  7075. ./ffmpeg -i 480p.jpg -vf format=yuv420p,scale=w=iw*2:h=ih*2,dnn_processing=dnn_backend=tensorflow:model=srcnn.pb:input=x:output=y -y srcnn.jpg
  7076. @end example
  7077. @item
  7078. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported):
  7079. @example
  7080. ./ffmpeg -i 480p.jpg -vf format=yuv420p,dnn_processing=dnn_backend=tensorflow:model=espcn.pb:input=x:output=y -y tmp.espcn.jpg
  7081. @end example
  7082. @end itemize
  7083. @section drawbox
  7084. Draw a colored box on the input image.
  7085. It accepts the following parameters:
  7086. @table @option
  7087. @item x
  7088. @item y
  7089. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  7090. @item width, w
  7091. @item height, h
  7092. The expressions which specify the width and height of the box; if 0 they are interpreted as
  7093. the input width and height. It defaults to 0.
  7094. @item color, c
  7095. Specify the color of the box to write. For the general syntax of this option,
  7096. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7097. value @code{invert} is used, the box edge color is the same as the
  7098. video with inverted luma.
  7099. @item thickness, t
  7100. The expression which sets the thickness of the box edge.
  7101. A value of @code{fill} will create a filled box. Default value is @code{3}.
  7102. See below for the list of accepted constants.
  7103. @item replace
  7104. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  7105. will overwrite the video's color and alpha pixels.
  7106. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  7107. @end table
  7108. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7109. following constants:
  7110. @table @option
  7111. @item dar
  7112. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7113. @item hsub
  7114. @item vsub
  7115. horizontal and vertical chroma subsample values. For example for the
  7116. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7117. @item in_h, ih
  7118. @item in_w, iw
  7119. The input width and height.
  7120. @item sar
  7121. The input sample aspect ratio.
  7122. @item x
  7123. @item y
  7124. The x and y offset coordinates where the box is drawn.
  7125. @item w
  7126. @item h
  7127. The width and height of the drawn box.
  7128. @item t
  7129. The thickness of the drawn box.
  7130. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7131. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7132. @end table
  7133. @subsection Examples
  7134. @itemize
  7135. @item
  7136. Draw a black box around the edge of the input image:
  7137. @example
  7138. drawbox
  7139. @end example
  7140. @item
  7141. Draw a box with color red and an opacity of 50%:
  7142. @example
  7143. drawbox=10:20:200:60:red@@0.5
  7144. @end example
  7145. The previous example can be specified as:
  7146. @example
  7147. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  7148. @end example
  7149. @item
  7150. Fill the box with pink color:
  7151. @example
  7152. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  7153. @end example
  7154. @item
  7155. Draw a 2-pixel red 2.40:1 mask:
  7156. @example
  7157. 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
  7158. @end example
  7159. @end itemize
  7160. @subsection Commands
  7161. This filter supports same commands as options.
  7162. The command accepts the same syntax of the corresponding option.
  7163. If the specified expression is not valid, it is kept at its current
  7164. value.
  7165. @anchor{drawgraph}
  7166. @section drawgraph
  7167. Draw a graph using input video metadata.
  7168. It accepts the following parameters:
  7169. @table @option
  7170. @item m1
  7171. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  7172. @item fg1
  7173. Set 1st foreground color expression.
  7174. @item m2
  7175. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  7176. @item fg2
  7177. Set 2nd foreground color expression.
  7178. @item m3
  7179. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  7180. @item fg3
  7181. Set 3rd foreground color expression.
  7182. @item m4
  7183. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  7184. @item fg4
  7185. Set 4th foreground color expression.
  7186. @item min
  7187. Set minimal value of metadata value.
  7188. @item max
  7189. Set maximal value of metadata value.
  7190. @item bg
  7191. Set graph background color. Default is white.
  7192. @item mode
  7193. Set graph mode.
  7194. Available values for mode is:
  7195. @table @samp
  7196. @item bar
  7197. @item dot
  7198. @item line
  7199. @end table
  7200. Default is @code{line}.
  7201. @item slide
  7202. Set slide mode.
  7203. Available values for slide is:
  7204. @table @samp
  7205. @item frame
  7206. Draw new frame when right border is reached.
  7207. @item replace
  7208. Replace old columns with new ones.
  7209. @item scroll
  7210. Scroll from right to left.
  7211. @item rscroll
  7212. Scroll from left to right.
  7213. @item picture
  7214. Draw single picture.
  7215. @end table
  7216. Default is @code{frame}.
  7217. @item size
  7218. Set size of graph video. For the syntax of this option, check the
  7219. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7220. The default value is @code{900x256}.
  7221. @item rate, r
  7222. Set the output frame rate. Default value is @code{25}.
  7223. The foreground color expressions can use the following variables:
  7224. @table @option
  7225. @item MIN
  7226. Minimal value of metadata value.
  7227. @item MAX
  7228. Maximal value of metadata value.
  7229. @item VAL
  7230. Current metadata key value.
  7231. @end table
  7232. The color is defined as 0xAABBGGRR.
  7233. @end table
  7234. Example using metadata from @ref{signalstats} filter:
  7235. @example
  7236. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  7237. @end example
  7238. Example using metadata from @ref{ebur128} filter:
  7239. @example
  7240. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  7241. @end example
  7242. @section drawgrid
  7243. Draw a grid on the input image.
  7244. It accepts the following parameters:
  7245. @table @option
  7246. @item x
  7247. @item y
  7248. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  7249. @item width, w
  7250. @item height, h
  7251. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  7252. input width and height, respectively, minus @code{thickness}, so image gets
  7253. framed. Default to 0.
  7254. @item color, c
  7255. Specify the color of the grid. For the general syntax of this option,
  7256. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7257. value @code{invert} is used, the grid color is the same as the
  7258. video with inverted luma.
  7259. @item thickness, t
  7260. The expression which sets the thickness of the grid line. Default value is @code{1}.
  7261. See below for the list of accepted constants.
  7262. @item replace
  7263. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  7264. will overwrite the video's color and alpha pixels.
  7265. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  7266. @end table
  7267. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7268. following constants:
  7269. @table @option
  7270. @item dar
  7271. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7272. @item hsub
  7273. @item vsub
  7274. horizontal and vertical chroma subsample values. For example for the
  7275. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7276. @item in_h, ih
  7277. @item in_w, iw
  7278. The input grid cell width and height.
  7279. @item sar
  7280. The input sample aspect ratio.
  7281. @item x
  7282. @item y
  7283. The x and y coordinates of some point of grid intersection (meant to configure offset).
  7284. @item w
  7285. @item h
  7286. The width and height of the drawn cell.
  7287. @item t
  7288. The thickness of the drawn cell.
  7289. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7290. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7291. @end table
  7292. @subsection Examples
  7293. @itemize
  7294. @item
  7295. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  7296. @example
  7297. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  7298. @end example
  7299. @item
  7300. Draw a white 3x3 grid with an opacity of 50%:
  7301. @example
  7302. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  7303. @end example
  7304. @end itemize
  7305. @subsection Commands
  7306. This filter supports same commands as options.
  7307. The command accepts the same syntax of the corresponding option.
  7308. If the specified expression is not valid, it is kept at its current
  7309. value.
  7310. @anchor{drawtext}
  7311. @section drawtext
  7312. Draw a text string or text from a specified file on top of a video, using the
  7313. libfreetype library.
  7314. To enable compilation of this filter, you need to configure FFmpeg with
  7315. @code{--enable-libfreetype}.
  7316. To enable default font fallback and the @var{font} option you need to
  7317. configure FFmpeg with @code{--enable-libfontconfig}.
  7318. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  7319. @code{--enable-libfribidi}.
  7320. @subsection Syntax
  7321. It accepts the following parameters:
  7322. @table @option
  7323. @item box
  7324. Used to draw a box around text using the background color.
  7325. The value must be either 1 (enable) or 0 (disable).
  7326. The default value of @var{box} is 0.
  7327. @item boxborderw
  7328. Set the width of the border to be drawn around the box using @var{boxcolor}.
  7329. The default value of @var{boxborderw} is 0.
  7330. @item boxcolor
  7331. The color to be used for drawing box around text. For the syntax of this
  7332. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7333. The default value of @var{boxcolor} is "white".
  7334. @item line_spacing
  7335. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  7336. The default value of @var{line_spacing} is 0.
  7337. @item borderw
  7338. Set the width of the border to be drawn around the text using @var{bordercolor}.
  7339. The default value of @var{borderw} is 0.
  7340. @item bordercolor
  7341. Set the color to be used for drawing border around text. For the syntax of this
  7342. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7343. The default value of @var{bordercolor} is "black".
  7344. @item expansion
  7345. Select how the @var{text} is expanded. Can be either @code{none},
  7346. @code{strftime} (deprecated) or
  7347. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  7348. below for details.
  7349. @item basetime
  7350. Set a start time for the count. Value is in microseconds. Only applied
  7351. in the deprecated strftime expansion mode. To emulate in normal expansion
  7352. mode use the @code{pts} function, supplying the start time (in seconds)
  7353. as the second argument.
  7354. @item fix_bounds
  7355. If true, check and fix text coords to avoid clipping.
  7356. @item fontcolor
  7357. The color to be used for drawing fonts. For the syntax of this option, check
  7358. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7359. The default value of @var{fontcolor} is "black".
  7360. @item fontcolor_expr
  7361. String which is expanded the same way as @var{text} to obtain dynamic
  7362. @var{fontcolor} value. By default this option has empty value and is not
  7363. processed. When this option is set, it overrides @var{fontcolor} option.
  7364. @item font
  7365. The font family to be used for drawing text. By default Sans.
  7366. @item fontfile
  7367. The font file to be used for drawing text. The path must be included.
  7368. This parameter is mandatory if the fontconfig support is disabled.
  7369. @item alpha
  7370. Draw the text applying alpha blending. The value can
  7371. be a number between 0.0 and 1.0.
  7372. The expression accepts the same variables @var{x, y} as well.
  7373. The default value is 1.
  7374. Please see @var{fontcolor_expr}.
  7375. @item fontsize
  7376. The font size to be used for drawing text.
  7377. The default value of @var{fontsize} is 16.
  7378. @item text_shaping
  7379. If set to 1, attempt to shape the text (for example, reverse the order of
  7380. right-to-left text and join Arabic characters) before drawing it.
  7381. Otherwise, just draw the text exactly as given.
  7382. By default 1 (if supported).
  7383. @item ft_load_flags
  7384. The flags to be used for loading the fonts.
  7385. The flags map the corresponding flags supported by libfreetype, and are
  7386. a combination of the following values:
  7387. @table @var
  7388. @item default
  7389. @item no_scale
  7390. @item no_hinting
  7391. @item render
  7392. @item no_bitmap
  7393. @item vertical_layout
  7394. @item force_autohint
  7395. @item crop_bitmap
  7396. @item pedantic
  7397. @item ignore_global_advance_width
  7398. @item no_recurse
  7399. @item ignore_transform
  7400. @item monochrome
  7401. @item linear_design
  7402. @item no_autohint
  7403. @end table
  7404. Default value is "default".
  7405. For more information consult the documentation for the FT_LOAD_*
  7406. libfreetype flags.
  7407. @item shadowcolor
  7408. The color to be used for drawing a shadow behind the drawn text. For the
  7409. syntax of this option, check the @ref{color syntax,,"Color" section in the
  7410. ffmpeg-utils manual,ffmpeg-utils}.
  7411. The default value of @var{shadowcolor} is "black".
  7412. @item shadowx
  7413. @item shadowy
  7414. The x and y offsets for the text shadow position with respect to the
  7415. position of the text. They can be either positive or negative
  7416. values. The default value for both is "0".
  7417. @item start_number
  7418. The starting frame number for the n/frame_num variable. The default value
  7419. is "0".
  7420. @item tabsize
  7421. The size in number of spaces to use for rendering the tab.
  7422. Default value is 4.
  7423. @item timecode
  7424. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  7425. format. It can be used with or without text parameter. @var{timecode_rate}
  7426. option must be specified.
  7427. @item timecode_rate, rate, r
  7428. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  7429. integer. Minimum value is "1".
  7430. Drop-frame timecode is supported for frame rates 30 & 60.
  7431. @item tc24hmax
  7432. If set to 1, the output of the timecode option will wrap around at 24 hours.
  7433. Default is 0 (disabled).
  7434. @item text
  7435. The text string to be drawn. The text must be a sequence of UTF-8
  7436. encoded characters.
  7437. This parameter is mandatory if no file is specified with the parameter
  7438. @var{textfile}.
  7439. @item textfile
  7440. A text file containing text to be drawn. The text must be a sequence
  7441. of UTF-8 encoded characters.
  7442. This parameter is mandatory if no text string is specified with the
  7443. parameter @var{text}.
  7444. If both @var{text} and @var{textfile} are specified, an error is thrown.
  7445. @item reload
  7446. If set to 1, the @var{textfile} will be reloaded before each frame.
  7447. Be sure to update it atomically, or it may be read partially, or even fail.
  7448. @item x
  7449. @item y
  7450. The expressions which specify the offsets where text will be drawn
  7451. within the video frame. They are relative to the top/left border of the
  7452. output image.
  7453. The default value of @var{x} and @var{y} is "0".
  7454. See below for the list of accepted constants and functions.
  7455. @end table
  7456. The parameters for @var{x} and @var{y} are expressions containing the
  7457. following constants and functions:
  7458. @table @option
  7459. @item dar
  7460. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  7461. @item hsub
  7462. @item vsub
  7463. horizontal and vertical chroma subsample values. For example for the
  7464. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7465. @item line_h, lh
  7466. the height of each text line
  7467. @item main_h, h, H
  7468. the input height
  7469. @item main_w, w, W
  7470. the input width
  7471. @item max_glyph_a, ascent
  7472. the maximum distance from the baseline to the highest/upper grid
  7473. coordinate used to place a glyph outline point, for all the rendered
  7474. glyphs.
  7475. It is a positive value, due to the grid's orientation with the Y axis
  7476. upwards.
  7477. @item max_glyph_d, descent
  7478. the maximum distance from the baseline to the lowest grid coordinate
  7479. used to place a glyph outline point, for all the rendered glyphs.
  7480. This is a negative value, due to the grid's orientation, with the Y axis
  7481. upwards.
  7482. @item max_glyph_h
  7483. maximum glyph height, that is the maximum height for all the glyphs
  7484. contained in the rendered text, it is equivalent to @var{ascent} -
  7485. @var{descent}.
  7486. @item max_glyph_w
  7487. maximum glyph width, that is the maximum width for all the glyphs
  7488. contained in the rendered text
  7489. @item n
  7490. the number of input frame, starting from 0
  7491. @item rand(min, max)
  7492. return a random number included between @var{min} and @var{max}
  7493. @item sar
  7494. The input sample aspect ratio.
  7495. @item t
  7496. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7497. @item text_h, th
  7498. the height of the rendered text
  7499. @item text_w, tw
  7500. the width of the rendered text
  7501. @item x
  7502. @item y
  7503. the x and y offset coordinates where the text is drawn.
  7504. These parameters allow the @var{x} and @var{y} expressions to refer
  7505. to each other, so you can for example specify @code{y=x/dar}.
  7506. @item pict_type
  7507. A one character description of the current frame's picture type.
  7508. @item pkt_pos
  7509. The current packet's position in the input file or stream
  7510. (in bytes, from the start of the input). A value of -1 indicates
  7511. this info is not available.
  7512. @item pkt_duration
  7513. The current packet's duration, in seconds.
  7514. @item pkt_size
  7515. The current packet's size (in bytes).
  7516. @end table
  7517. @anchor{drawtext_expansion}
  7518. @subsection Text expansion
  7519. If @option{expansion} is set to @code{strftime},
  7520. the filter recognizes strftime() sequences in the provided text and
  7521. expands them accordingly. Check the documentation of strftime(). This
  7522. feature is deprecated.
  7523. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  7524. If @option{expansion} is set to @code{normal} (which is the default),
  7525. the following expansion mechanism is used.
  7526. The backslash character @samp{\}, followed by any character, always expands to
  7527. the second character.
  7528. Sequences of the form @code{%@{...@}} are expanded. The text between the
  7529. braces is a function name, possibly followed by arguments separated by ':'.
  7530. If the arguments contain special characters or delimiters (':' or '@}'),
  7531. they should be escaped.
  7532. Note that they probably must also be escaped as the value for the
  7533. @option{text} option in the filter argument string and as the filter
  7534. argument in the filtergraph description, and possibly also for the shell,
  7535. that makes up to four levels of escaping; using a text file avoids these
  7536. problems.
  7537. The following functions are available:
  7538. @table @command
  7539. @item expr, e
  7540. The expression evaluation result.
  7541. It must take one argument specifying the expression to be evaluated,
  7542. which accepts the same constants and functions as the @var{x} and
  7543. @var{y} values. Note that not all constants should be used, for
  7544. example the text size is not known when evaluating the expression, so
  7545. the constants @var{text_w} and @var{text_h} will have an undefined
  7546. value.
  7547. @item expr_int_format, eif
  7548. Evaluate the expression's value and output as formatted integer.
  7549. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  7550. The second argument specifies the output format. Allowed values are @samp{x},
  7551. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  7552. @code{printf} function.
  7553. The third parameter is optional and sets the number of positions taken by the output.
  7554. It can be used to add padding with zeros from the left.
  7555. @item gmtime
  7556. The time at which the filter is running, expressed in UTC.
  7557. It can accept an argument: a strftime() format string.
  7558. @item localtime
  7559. The time at which the filter is running, expressed in the local time zone.
  7560. It can accept an argument: a strftime() format string.
  7561. @item metadata
  7562. Frame metadata. Takes one or two arguments.
  7563. The first argument is mandatory and specifies the metadata key.
  7564. The second argument is optional and specifies a default value, used when the
  7565. metadata key is not found or empty.
  7566. Available metadata can be identified by inspecting entries
  7567. starting with TAG included within each frame section
  7568. printed by running @code{ffprobe -show_frames}.
  7569. String metadata generated in filters leading to
  7570. the drawtext filter are also available.
  7571. @item n, frame_num
  7572. The frame number, starting from 0.
  7573. @item pict_type
  7574. A one character description of the current picture type.
  7575. @item pts
  7576. The timestamp of the current frame.
  7577. It can take up to three arguments.
  7578. The first argument is the format of the timestamp; it defaults to @code{flt}
  7579. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  7580. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  7581. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  7582. @code{localtime} stands for the timestamp of the frame formatted as
  7583. local time zone time.
  7584. The second argument is an offset added to the timestamp.
  7585. If the format is set to @code{hms}, a third argument @code{24HH} may be
  7586. supplied to present the hour part of the formatted timestamp in 24h format
  7587. (00-23).
  7588. If the format is set to @code{localtime} or @code{gmtime},
  7589. a third argument may be supplied: a strftime() format string.
  7590. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  7591. @end table
  7592. @subsection Commands
  7593. This filter supports altering parameters via commands:
  7594. @table @option
  7595. @item reinit
  7596. Alter existing filter parameters.
  7597. Syntax for the argument is the same as for filter invocation, e.g.
  7598. @example
  7599. fontsize=56:fontcolor=green:text='Hello World'
  7600. @end example
  7601. Full filter invocation with sendcmd would look like this:
  7602. @example
  7603. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7604. @end example
  7605. @end table
  7606. If the entire argument can't be parsed or applied as valid values then the filter will
  7607. continue with its existing parameters.
  7608. @subsection Examples
  7609. @itemize
  7610. @item
  7611. Draw "Test Text" with font FreeSerif, using the default values for the
  7612. optional parameters.
  7613. @example
  7614. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7615. @end example
  7616. @item
  7617. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7618. and y=50 (counting from the top-left corner of the screen), text is
  7619. yellow with a red box around it. Both the text and the box have an
  7620. opacity of 20%.
  7621. @example
  7622. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7623. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7624. @end example
  7625. Note that the double quotes are not necessary if spaces are not used
  7626. within the parameter list.
  7627. @item
  7628. Show the text at the center of the video frame:
  7629. @example
  7630. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7631. @end example
  7632. @item
  7633. Show the text at a random position, switching to a new position every 30 seconds:
  7634. @example
  7635. 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)"
  7636. @end example
  7637. @item
  7638. Show a text line sliding from right to left in the last row of the video
  7639. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7640. with no newlines.
  7641. @example
  7642. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7643. @end example
  7644. @item
  7645. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7646. @example
  7647. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7648. @end example
  7649. @item
  7650. Draw a single green letter "g", at the center of the input video.
  7651. The glyph baseline is placed at half screen height.
  7652. @example
  7653. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7654. @end example
  7655. @item
  7656. Show text for 1 second every 3 seconds:
  7657. @example
  7658. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7659. @end example
  7660. @item
  7661. Use fontconfig to set the font. Note that the colons need to be escaped.
  7662. @example
  7663. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7664. @end example
  7665. @item
  7666. Print the date of a real-time encoding (see strftime(3)):
  7667. @example
  7668. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7669. @end example
  7670. @item
  7671. Show text fading in and out (appearing/disappearing):
  7672. @example
  7673. #!/bin/sh
  7674. DS=1.0 # display start
  7675. DE=10.0 # display end
  7676. FID=1.5 # fade in duration
  7677. FOD=5 # fade out duration
  7678. 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 @}"
  7679. @end example
  7680. @item
  7681. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7682. and the @option{fontsize} value are included in the @option{y} offset.
  7683. @example
  7684. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7685. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7686. @end example
  7687. @item
  7688. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  7689. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  7690. must have option @option{-export_path_metadata 1} for the special metadata fields
  7691. to be available for filters.
  7692. @example
  7693. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  7694. @end example
  7695. @end itemize
  7696. For more information about libfreetype, check:
  7697. @url{http://www.freetype.org/}.
  7698. For more information about fontconfig, check:
  7699. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7700. For more information about libfribidi, check:
  7701. @url{http://fribidi.org/}.
  7702. @section edgedetect
  7703. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7704. The filter accepts the following options:
  7705. @table @option
  7706. @item low
  7707. @item high
  7708. Set low and high threshold values used by the Canny thresholding
  7709. algorithm.
  7710. The high threshold selects the "strong" edge pixels, which are then
  7711. connected through 8-connectivity with the "weak" edge pixels selected
  7712. by the low threshold.
  7713. @var{low} and @var{high} threshold values must be chosen in the range
  7714. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7715. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  7716. is @code{50/255}.
  7717. @item mode
  7718. Define the drawing mode.
  7719. @table @samp
  7720. @item wires
  7721. Draw white/gray wires on black background.
  7722. @item colormix
  7723. Mix the colors to create a paint/cartoon effect.
  7724. @item canny
  7725. Apply Canny edge detector on all selected planes.
  7726. @end table
  7727. Default value is @var{wires}.
  7728. @item planes
  7729. Select planes for filtering. By default all available planes are filtered.
  7730. @end table
  7731. @subsection Examples
  7732. @itemize
  7733. @item
  7734. Standard edge detection with custom values for the hysteresis thresholding:
  7735. @example
  7736. edgedetect=low=0.1:high=0.4
  7737. @end example
  7738. @item
  7739. Painting effect without thresholding:
  7740. @example
  7741. edgedetect=mode=colormix:high=0
  7742. @end example
  7743. @end itemize
  7744. @section elbg
  7745. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7746. For each input image, the filter will compute the optimal mapping from
  7747. the input to the output given the codebook length, that is the number
  7748. of distinct output colors.
  7749. This filter accepts the following options.
  7750. @table @option
  7751. @item codebook_length, l
  7752. Set codebook length. The value must be a positive integer, and
  7753. represents the number of distinct output colors. Default value is 256.
  7754. @item nb_steps, n
  7755. Set the maximum number of iterations to apply for computing the optimal
  7756. mapping. The higher the value the better the result and the higher the
  7757. computation time. Default value is 1.
  7758. @item seed, s
  7759. Set a random seed, must be an integer included between 0 and
  7760. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7761. will try to use a good random seed on a best effort basis.
  7762. @item pal8
  7763. Set pal8 output pixel format. This option does not work with codebook
  7764. length greater than 256.
  7765. @end table
  7766. @section entropy
  7767. Measure graylevel entropy in histogram of color channels of video frames.
  7768. It accepts the following parameters:
  7769. @table @option
  7770. @item mode
  7771. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7772. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7773. between neighbour histogram values.
  7774. @end table
  7775. @section eq
  7776. Set brightness, contrast, saturation and approximate gamma adjustment.
  7777. The filter accepts the following options:
  7778. @table @option
  7779. @item contrast
  7780. Set the contrast expression. The value must be a float value in range
  7781. @code{-1000.0} to @code{1000.0}. The default value is "1".
  7782. @item brightness
  7783. Set the brightness expression. The value must be a float value in
  7784. range @code{-1.0} to @code{1.0}. The default value is "0".
  7785. @item saturation
  7786. Set the saturation expression. The value must be a float in
  7787. range @code{0.0} to @code{3.0}. The default value is "1".
  7788. @item gamma
  7789. Set the gamma expression. The value must be a float in range
  7790. @code{0.1} to @code{10.0}. The default value is "1".
  7791. @item gamma_r
  7792. Set the gamma expression for red. The value must be a float in
  7793. range @code{0.1} to @code{10.0}. The default value is "1".
  7794. @item gamma_g
  7795. Set the gamma expression for green. The value must be a float in range
  7796. @code{0.1} to @code{10.0}. The default value is "1".
  7797. @item gamma_b
  7798. Set the gamma expression for blue. The value must be a float in range
  7799. @code{0.1} to @code{10.0}. The default value is "1".
  7800. @item gamma_weight
  7801. Set the gamma weight expression. It can be used to reduce the effect
  7802. of a high gamma value on bright image areas, e.g. keep them from
  7803. getting overamplified and just plain white. The value must be a float
  7804. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7805. gamma correction all the way down while @code{1.0} leaves it at its
  7806. full strength. Default is "1".
  7807. @item eval
  7808. Set when the expressions for brightness, contrast, saturation and
  7809. gamma expressions are evaluated.
  7810. It accepts the following values:
  7811. @table @samp
  7812. @item init
  7813. only evaluate expressions once during the filter initialization or
  7814. when a command is processed
  7815. @item frame
  7816. evaluate expressions for each incoming frame
  7817. @end table
  7818. Default value is @samp{init}.
  7819. @end table
  7820. The expressions accept the following parameters:
  7821. @table @option
  7822. @item n
  7823. frame count of the input frame starting from 0
  7824. @item pos
  7825. byte position of the corresponding packet in the input file, NAN if
  7826. unspecified
  7827. @item r
  7828. frame rate of the input video, NAN if the input frame rate is unknown
  7829. @item t
  7830. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7831. @end table
  7832. @subsection Commands
  7833. The filter supports the following commands:
  7834. @table @option
  7835. @item contrast
  7836. Set the contrast expression.
  7837. @item brightness
  7838. Set the brightness expression.
  7839. @item saturation
  7840. Set the saturation expression.
  7841. @item gamma
  7842. Set the gamma expression.
  7843. @item gamma_r
  7844. Set the gamma_r expression.
  7845. @item gamma_g
  7846. Set gamma_g expression.
  7847. @item gamma_b
  7848. Set gamma_b expression.
  7849. @item gamma_weight
  7850. Set gamma_weight expression.
  7851. The command accepts the same syntax of the corresponding option.
  7852. If the specified expression is not valid, it is kept at its current
  7853. value.
  7854. @end table
  7855. @section erosion
  7856. Apply erosion effect to the video.
  7857. This filter replaces the pixel by the local(3x3) minimum.
  7858. It accepts the following options:
  7859. @table @option
  7860. @item threshold0
  7861. @item threshold1
  7862. @item threshold2
  7863. @item threshold3
  7864. Limit the maximum change for each plane, default is 65535.
  7865. If 0, plane will remain unchanged.
  7866. @item coordinates
  7867. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7868. pixels are used.
  7869. Flags to local 3x3 coordinates maps like this:
  7870. 1 2 3
  7871. 4 5
  7872. 6 7 8
  7873. @end table
  7874. @subsection Commands
  7875. This filter supports the all above options as @ref{commands}.
  7876. @section extractplanes
  7877. Extract color channel components from input video stream into
  7878. separate grayscale video streams.
  7879. The filter accepts the following option:
  7880. @table @option
  7881. @item planes
  7882. Set plane(s) to extract.
  7883. Available values for planes are:
  7884. @table @samp
  7885. @item y
  7886. @item u
  7887. @item v
  7888. @item a
  7889. @item r
  7890. @item g
  7891. @item b
  7892. @end table
  7893. Choosing planes not available in the input will result in an error.
  7894. That means you cannot select @code{r}, @code{g}, @code{b} planes
  7895. with @code{y}, @code{u}, @code{v} planes at same time.
  7896. @end table
  7897. @subsection Examples
  7898. @itemize
  7899. @item
  7900. Extract luma, u and v color channel component from input video frame
  7901. into 3 grayscale outputs:
  7902. @example
  7903. 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
  7904. @end example
  7905. @end itemize
  7906. @section fade
  7907. Apply a fade-in/out effect to the input video.
  7908. It accepts the following parameters:
  7909. @table @option
  7910. @item type, t
  7911. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7912. effect.
  7913. Default is @code{in}.
  7914. @item start_frame, s
  7915. Specify the number of the frame to start applying the fade
  7916. effect at. Default is 0.
  7917. @item nb_frames, n
  7918. The number of frames that the fade effect lasts. At the end of the
  7919. fade-in effect, the output video will have the same intensity as the input video.
  7920. At the end of the fade-out transition, the output video will be filled with the
  7921. selected @option{color}.
  7922. Default is 25.
  7923. @item alpha
  7924. If set to 1, fade only alpha channel, if one exists on the input.
  7925. Default value is 0.
  7926. @item start_time, st
  7927. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7928. effect. If both start_frame and start_time are specified, the fade will start at
  7929. whichever comes last. Default is 0.
  7930. @item duration, d
  7931. The number of seconds for which the fade effect has to last. At the end of the
  7932. fade-in effect the output video will have the same intensity as the input video,
  7933. at the end of the fade-out transition the output video will be filled with the
  7934. selected @option{color}.
  7935. If both duration and nb_frames are specified, duration is used. Default is 0
  7936. (nb_frames is used by default).
  7937. @item color, c
  7938. Specify the color of the fade. Default is "black".
  7939. @end table
  7940. @subsection Examples
  7941. @itemize
  7942. @item
  7943. Fade in the first 30 frames of video:
  7944. @example
  7945. fade=in:0:30
  7946. @end example
  7947. The command above is equivalent to:
  7948. @example
  7949. fade=t=in:s=0:n=30
  7950. @end example
  7951. @item
  7952. Fade out the last 45 frames of a 200-frame video:
  7953. @example
  7954. fade=out:155:45
  7955. fade=type=out:start_frame=155:nb_frames=45
  7956. @end example
  7957. @item
  7958. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7959. @example
  7960. fade=in:0:25, fade=out:975:25
  7961. @end example
  7962. @item
  7963. Make the first 5 frames yellow, then fade in from frame 5-24:
  7964. @example
  7965. fade=in:5:20:color=yellow
  7966. @end example
  7967. @item
  7968. Fade in alpha over first 25 frames of video:
  7969. @example
  7970. fade=in:0:25:alpha=1
  7971. @end example
  7972. @item
  7973. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7974. @example
  7975. fade=t=in:st=5.5:d=0.5
  7976. @end example
  7977. @end itemize
  7978. @section fftdnoiz
  7979. Denoise frames using 3D FFT (frequency domain filtering).
  7980. The filter accepts the following options:
  7981. @table @option
  7982. @item sigma
  7983. Set the noise sigma constant. This sets denoising strength.
  7984. Default value is 1. Allowed range is from 0 to 30.
  7985. Using very high sigma with low overlap may give blocking artifacts.
  7986. @item amount
  7987. Set amount of denoising. By default all detected noise is reduced.
  7988. Default value is 1. Allowed range is from 0 to 1.
  7989. @item block
  7990. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7991. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7992. block size in pixels is 2^4 which is 16.
  7993. @item overlap
  7994. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7995. @item prev
  7996. Set number of previous frames to use for denoising. By default is set to 0.
  7997. @item next
  7998. Set number of next frames to to use for denoising. By default is set to 0.
  7999. @item planes
  8000. Set planes which will be filtered, by default are all available filtered
  8001. except alpha.
  8002. @end table
  8003. @section fftfilt
  8004. Apply arbitrary expressions to samples in frequency domain
  8005. @table @option
  8006. @item dc_Y
  8007. Adjust the dc value (gain) of the luma plane of the image. The filter
  8008. accepts an integer value in range @code{0} to @code{1000}. The default
  8009. value is set to @code{0}.
  8010. @item dc_U
  8011. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  8012. filter accepts an integer value in range @code{0} to @code{1000}. The
  8013. default value is set to @code{0}.
  8014. @item dc_V
  8015. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  8016. filter accepts an integer value in range @code{0} to @code{1000}. The
  8017. default value is set to @code{0}.
  8018. @item weight_Y
  8019. Set the frequency domain weight expression for the luma plane.
  8020. @item weight_U
  8021. Set the frequency domain weight expression for the 1st chroma plane.
  8022. @item weight_V
  8023. Set the frequency domain weight expression for the 2nd chroma plane.
  8024. @item eval
  8025. Set when the expressions are evaluated.
  8026. It accepts the following values:
  8027. @table @samp
  8028. @item init
  8029. Only evaluate expressions once during the filter initialization.
  8030. @item frame
  8031. Evaluate expressions for each incoming frame.
  8032. @end table
  8033. Default value is @samp{init}.
  8034. The filter accepts the following variables:
  8035. @item X
  8036. @item Y
  8037. The coordinates of the current sample.
  8038. @item W
  8039. @item H
  8040. The width and height of the image.
  8041. @item N
  8042. The number of input frame, starting from 0.
  8043. @end table
  8044. @subsection Examples
  8045. @itemize
  8046. @item
  8047. High-pass:
  8048. @example
  8049. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  8050. @end example
  8051. @item
  8052. Low-pass:
  8053. @example
  8054. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  8055. @end example
  8056. @item
  8057. Sharpen:
  8058. @example
  8059. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  8060. @end example
  8061. @item
  8062. Blur:
  8063. @example
  8064. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  8065. @end example
  8066. @end itemize
  8067. @section field
  8068. Extract a single field from an interlaced image using stride
  8069. arithmetic to avoid wasting CPU time. The output frames are marked as
  8070. non-interlaced.
  8071. The filter accepts the following options:
  8072. @table @option
  8073. @item type
  8074. Specify whether to extract the top (if the value is @code{0} or
  8075. @code{top}) or the bottom field (if the value is @code{1} or
  8076. @code{bottom}).
  8077. @end table
  8078. @section fieldhint
  8079. Create new frames by copying the top and bottom fields from surrounding frames
  8080. supplied as numbers by the hint file.
  8081. @table @option
  8082. @item hint
  8083. Set file containing hints: absolute/relative frame numbers.
  8084. There must be one line for each frame in a clip. Each line must contain two
  8085. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  8086. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  8087. is current frame number for @code{absolute} mode or out of [-1, 1] range
  8088. for @code{relative} mode. First number tells from which frame to pick up top
  8089. field and second number tells from which frame to pick up bottom field.
  8090. If optionally followed by @code{+} output frame will be marked as interlaced,
  8091. else if followed by @code{-} output frame will be marked as progressive, else
  8092. it will be marked same as input frame.
  8093. If optionally followed by @code{t} output frame will use only top field, or in
  8094. case of @code{b} it will use only bottom field.
  8095. If line starts with @code{#} or @code{;} that line is skipped.
  8096. @item mode
  8097. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  8098. @end table
  8099. Example of first several lines of @code{hint} file for @code{relative} mode:
  8100. @example
  8101. 0,0 - # first frame
  8102. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  8103. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  8104. 1,0 -
  8105. 0,0 -
  8106. 0,0 -
  8107. 1,0 -
  8108. 1,0 -
  8109. 1,0 -
  8110. 0,0 -
  8111. 0,0 -
  8112. 1,0 -
  8113. 1,0 -
  8114. 1,0 -
  8115. 0,0 -
  8116. @end example
  8117. @section fieldmatch
  8118. Field matching filter for inverse telecine. It is meant to reconstruct the
  8119. progressive frames from a telecined stream. The filter does not drop duplicated
  8120. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  8121. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  8122. The separation of the field matching and the decimation is notably motivated by
  8123. the possibility of inserting a de-interlacing filter fallback between the two.
  8124. If the source has mixed telecined and real interlaced content,
  8125. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  8126. But these remaining combed frames will be marked as interlaced, and thus can be
  8127. de-interlaced by a later filter such as @ref{yadif} before decimation.
  8128. In addition to the various configuration options, @code{fieldmatch} can take an
  8129. optional second stream, activated through the @option{ppsrc} option. If
  8130. enabled, the frames reconstruction will be based on the fields and frames from
  8131. this second stream. This allows the first input to be pre-processed in order to
  8132. help the various algorithms of the filter, while keeping the output lossless
  8133. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  8134. or brightness/contrast adjustments can help.
  8135. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  8136. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  8137. which @code{fieldmatch} is based on. While the semantic and usage are very
  8138. close, some behaviour and options names can differ.
  8139. The @ref{decimate} filter currently only works for constant frame rate input.
  8140. If your input has mixed telecined (30fps) and progressive content with a lower
  8141. framerate like 24fps use the following filterchain to produce the necessary cfr
  8142. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  8143. The filter accepts the following options:
  8144. @table @option
  8145. @item order
  8146. Specify the assumed field order of the input stream. Available values are:
  8147. @table @samp
  8148. @item auto
  8149. Auto detect parity (use FFmpeg's internal parity value).
  8150. @item bff
  8151. Assume bottom field first.
  8152. @item tff
  8153. Assume top field first.
  8154. @end table
  8155. Note that it is sometimes recommended not to trust the parity announced by the
  8156. stream.
  8157. Default value is @var{auto}.
  8158. @item mode
  8159. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  8160. sense that it won't risk creating jerkiness due to duplicate frames when
  8161. possible, but if there are bad edits or blended fields it will end up
  8162. outputting combed frames when a good match might actually exist. On the other
  8163. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  8164. but will almost always find a good frame if there is one. The other values are
  8165. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  8166. jerkiness and creating duplicate frames versus finding good matches in sections
  8167. with bad edits, orphaned fields, blended fields, etc.
  8168. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  8169. Available values are:
  8170. @table @samp
  8171. @item pc
  8172. 2-way matching (p/c)
  8173. @item pc_n
  8174. 2-way matching, and trying 3rd match if still combed (p/c + n)
  8175. @item pc_u
  8176. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  8177. @item pc_n_ub
  8178. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  8179. still combed (p/c + n + u/b)
  8180. @item pcn
  8181. 3-way matching (p/c/n)
  8182. @item pcn_ub
  8183. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  8184. detected as combed (p/c/n + u/b)
  8185. @end table
  8186. The parenthesis at the end indicate the matches that would be used for that
  8187. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  8188. @var{top}).
  8189. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  8190. the slowest.
  8191. Default value is @var{pc_n}.
  8192. @item ppsrc
  8193. Mark the main input stream as a pre-processed input, and enable the secondary
  8194. input stream as the clean source to pick the fields from. See the filter
  8195. introduction for more details. It is similar to the @option{clip2} feature from
  8196. VFM/TFM.
  8197. Default value is @code{0} (disabled).
  8198. @item field
  8199. Set the field to match from. It is recommended to set this to the same value as
  8200. @option{order} unless you experience matching failures with that setting. In
  8201. certain circumstances changing the field that is used to match from can have a
  8202. large impact on matching performance. Available values are:
  8203. @table @samp
  8204. @item auto
  8205. Automatic (same value as @option{order}).
  8206. @item bottom
  8207. Match from the bottom field.
  8208. @item top
  8209. Match from the top field.
  8210. @end table
  8211. Default value is @var{auto}.
  8212. @item mchroma
  8213. Set whether or not chroma is included during the match comparisons. In most
  8214. cases it is recommended to leave this enabled. You should set this to @code{0}
  8215. only if your clip has bad chroma problems such as heavy rainbowing or other
  8216. artifacts. Setting this to @code{0} could also be used to speed things up at
  8217. the cost of some accuracy.
  8218. Default value is @code{1}.
  8219. @item y0
  8220. @item y1
  8221. These define an exclusion band which excludes the lines between @option{y0} and
  8222. @option{y1} from being included in the field matching decision. An exclusion
  8223. band can be used to ignore subtitles, a logo, or other things that may
  8224. interfere with the matching. @option{y0} sets the starting scan line and
  8225. @option{y1} sets the ending line; all lines in between @option{y0} and
  8226. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  8227. @option{y0} and @option{y1} to the same value will disable the feature.
  8228. @option{y0} and @option{y1} defaults to @code{0}.
  8229. @item scthresh
  8230. Set the scene change detection threshold as a percentage of maximum change on
  8231. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  8232. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  8233. @option{scthresh} is @code{[0.0, 100.0]}.
  8234. Default value is @code{12.0}.
  8235. @item combmatch
  8236. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  8237. account the combed scores of matches when deciding what match to use as the
  8238. final match. Available values are:
  8239. @table @samp
  8240. @item none
  8241. No final matching based on combed scores.
  8242. @item sc
  8243. Combed scores are only used when a scene change is detected.
  8244. @item full
  8245. Use combed scores all the time.
  8246. @end table
  8247. Default is @var{sc}.
  8248. @item combdbg
  8249. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  8250. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  8251. Available values are:
  8252. @table @samp
  8253. @item none
  8254. No forced calculation.
  8255. @item pcn
  8256. Force p/c/n calculations.
  8257. @item pcnub
  8258. Force p/c/n/u/b calculations.
  8259. @end table
  8260. Default value is @var{none}.
  8261. @item cthresh
  8262. This is the area combing threshold used for combed frame detection. This
  8263. essentially controls how "strong" or "visible" combing must be to be detected.
  8264. Larger values mean combing must be more visible and smaller values mean combing
  8265. can be less visible or strong and still be detected. Valid settings are from
  8266. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  8267. be detected as combed). This is basically a pixel difference value. A good
  8268. range is @code{[8, 12]}.
  8269. Default value is @code{9}.
  8270. @item chroma
  8271. Sets whether or not chroma is considered in the combed frame decision. Only
  8272. disable this if your source has chroma problems (rainbowing, etc.) that are
  8273. causing problems for the combed frame detection with chroma enabled. Actually,
  8274. using @option{chroma}=@var{0} is usually more reliable, except for the case
  8275. where there is chroma only combing in the source.
  8276. Default value is @code{0}.
  8277. @item blockx
  8278. @item blocky
  8279. Respectively set the x-axis and y-axis size of the window used during combed
  8280. frame detection. This has to do with the size of the area in which
  8281. @option{combpel} pixels are required to be detected as combed for a frame to be
  8282. declared combed. See the @option{combpel} parameter description for more info.
  8283. Possible values are any number that is a power of 2 starting at 4 and going up
  8284. to 512.
  8285. Default value is @code{16}.
  8286. @item combpel
  8287. The number of combed pixels inside any of the @option{blocky} by
  8288. @option{blockx} size blocks on the frame for the frame to be detected as
  8289. combed. While @option{cthresh} controls how "visible" the combing must be, this
  8290. setting controls "how much" combing there must be in any localized area (a
  8291. window defined by the @option{blockx} and @option{blocky} settings) on the
  8292. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  8293. which point no frames will ever be detected as combed). This setting is known
  8294. as @option{MI} in TFM/VFM vocabulary.
  8295. Default value is @code{80}.
  8296. @end table
  8297. @anchor{p/c/n/u/b meaning}
  8298. @subsection p/c/n/u/b meaning
  8299. @subsubsection p/c/n
  8300. We assume the following telecined stream:
  8301. @example
  8302. Top fields: 1 2 2 3 4
  8303. Bottom fields: 1 2 3 4 4
  8304. @end example
  8305. The numbers correspond to the progressive frame the fields relate to. Here, the
  8306. first two frames are progressive, the 3rd and 4th are combed, and so on.
  8307. When @code{fieldmatch} is configured to run a matching from bottom
  8308. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  8309. @example
  8310. Input stream:
  8311. T 1 2 2 3 4
  8312. B 1 2 3 4 4 <-- matching reference
  8313. Matches: c c n n c
  8314. Output stream:
  8315. T 1 2 3 4 4
  8316. B 1 2 3 4 4
  8317. @end example
  8318. As a result of the field matching, we can see that some frames get duplicated.
  8319. To perform a complete inverse telecine, you need to rely on a decimation filter
  8320. after this operation. See for instance the @ref{decimate} filter.
  8321. The same operation now matching from top fields (@option{field}=@var{top})
  8322. looks like this:
  8323. @example
  8324. Input stream:
  8325. T 1 2 2 3 4 <-- matching reference
  8326. B 1 2 3 4 4
  8327. Matches: c c p p c
  8328. Output stream:
  8329. T 1 2 2 3 4
  8330. B 1 2 2 3 4
  8331. @end example
  8332. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  8333. basically, they refer to the frame and field of the opposite parity:
  8334. @itemize
  8335. @item @var{p} matches the field of the opposite parity in the previous frame
  8336. @item @var{c} matches the field of the opposite parity in the current frame
  8337. @item @var{n} matches the field of the opposite parity in the next frame
  8338. @end itemize
  8339. @subsubsection u/b
  8340. The @var{u} and @var{b} matching are a bit special in the sense that they match
  8341. from the opposite parity flag. In the following examples, we assume that we are
  8342. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  8343. 'x' is placed above and below each matched fields.
  8344. With bottom matching (@option{field}=@var{bottom}):
  8345. @example
  8346. Match: c p n b u
  8347. x x x x x
  8348. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8349. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8350. x x x x x
  8351. Output frames:
  8352. 2 1 2 2 2
  8353. 2 2 2 1 3
  8354. @end example
  8355. With top matching (@option{field}=@var{top}):
  8356. @example
  8357. Match: c p n b u
  8358. x x x x x
  8359. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8360. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8361. x x x x x
  8362. Output frames:
  8363. 2 2 2 1 2
  8364. 2 1 3 2 2
  8365. @end example
  8366. @subsection Examples
  8367. Simple IVTC of a top field first telecined stream:
  8368. @example
  8369. fieldmatch=order=tff:combmatch=none, decimate
  8370. @end example
  8371. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  8372. @example
  8373. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  8374. @end example
  8375. @section fieldorder
  8376. Transform the field order of the input video.
  8377. It accepts the following parameters:
  8378. @table @option
  8379. @item order
  8380. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  8381. for bottom field first.
  8382. @end table
  8383. The default value is @samp{tff}.
  8384. The transformation is done by shifting the picture content up or down
  8385. by one line, and filling the remaining line with appropriate picture content.
  8386. This method is consistent with most broadcast field order converters.
  8387. If the input video is not flagged as being interlaced, or it is already
  8388. flagged as being of the required output field order, then this filter does
  8389. not alter the incoming video.
  8390. It is very useful when converting to or from PAL DV material,
  8391. which is bottom field first.
  8392. For example:
  8393. @example
  8394. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  8395. @end example
  8396. @section fifo, afifo
  8397. Buffer input images and send them when they are requested.
  8398. It is mainly useful when auto-inserted by the libavfilter
  8399. framework.
  8400. It does not take parameters.
  8401. @section fillborders
  8402. Fill borders of the input video, without changing video stream dimensions.
  8403. Sometimes video can have garbage at the four edges and you may not want to
  8404. crop video input to keep size multiple of some number.
  8405. This filter accepts the following options:
  8406. @table @option
  8407. @item left
  8408. Number of pixels to fill from left border.
  8409. @item right
  8410. Number of pixels to fill from right border.
  8411. @item top
  8412. Number of pixels to fill from top border.
  8413. @item bottom
  8414. Number of pixels to fill from bottom border.
  8415. @item mode
  8416. Set fill mode.
  8417. It accepts the following values:
  8418. @table @samp
  8419. @item smear
  8420. fill pixels using outermost pixels
  8421. @item mirror
  8422. fill pixels using mirroring
  8423. @item fixed
  8424. fill pixels with constant value
  8425. @end table
  8426. Default is @var{smear}.
  8427. @item color
  8428. Set color for pixels in fixed mode. Default is @var{black}.
  8429. @end table
  8430. @subsection Commands
  8431. This filter supports same @ref{commands} as options.
  8432. The command accepts the same syntax of the corresponding option.
  8433. If the specified expression is not valid, it is kept at its current
  8434. value.
  8435. @section find_rect
  8436. Find a rectangular object
  8437. It accepts the following options:
  8438. @table @option
  8439. @item object
  8440. Filepath of the object image, needs to be in gray8.
  8441. @item threshold
  8442. Detection threshold, default is 0.5.
  8443. @item mipmaps
  8444. Number of mipmaps, default is 3.
  8445. @item xmin, ymin, xmax, ymax
  8446. Specifies the rectangle in which to search.
  8447. @end table
  8448. @subsection Examples
  8449. @itemize
  8450. @item
  8451. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8452. @example
  8453. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8454. @end example
  8455. @end itemize
  8456. @section floodfill
  8457. Flood area with values of same pixel components with another values.
  8458. It accepts the following options:
  8459. @table @option
  8460. @item x
  8461. Set pixel x coordinate.
  8462. @item y
  8463. Set pixel y coordinate.
  8464. @item s0
  8465. Set source #0 component value.
  8466. @item s1
  8467. Set source #1 component value.
  8468. @item s2
  8469. Set source #2 component value.
  8470. @item s3
  8471. Set source #3 component value.
  8472. @item d0
  8473. Set destination #0 component value.
  8474. @item d1
  8475. Set destination #1 component value.
  8476. @item d2
  8477. Set destination #2 component value.
  8478. @item d3
  8479. Set destination #3 component value.
  8480. @end table
  8481. @anchor{format}
  8482. @section format
  8483. Convert the input video to one of the specified pixel formats.
  8484. Libavfilter will try to pick one that is suitable as input to
  8485. the next filter.
  8486. It accepts the following parameters:
  8487. @table @option
  8488. @item pix_fmts
  8489. A '|'-separated list of pixel format names, such as
  8490. "pix_fmts=yuv420p|monow|rgb24".
  8491. @end table
  8492. @subsection Examples
  8493. @itemize
  8494. @item
  8495. Convert the input video to the @var{yuv420p} format
  8496. @example
  8497. format=pix_fmts=yuv420p
  8498. @end example
  8499. Convert the input video to any of the formats in the list
  8500. @example
  8501. format=pix_fmts=yuv420p|yuv444p|yuv410p
  8502. @end example
  8503. @end itemize
  8504. @anchor{fps}
  8505. @section fps
  8506. Convert the video to specified constant frame rate by duplicating or dropping
  8507. frames as necessary.
  8508. It accepts the following parameters:
  8509. @table @option
  8510. @item fps
  8511. The desired output frame rate. The default is @code{25}.
  8512. @item start_time
  8513. Assume the first PTS should be the given value, in seconds. This allows for
  8514. padding/trimming at the start of stream. By default, no assumption is made
  8515. about the first frame's expected PTS, so no padding or trimming is done.
  8516. For example, this could be set to 0 to pad the beginning with duplicates of
  8517. the first frame if a video stream starts after the audio stream or to trim any
  8518. frames with a negative PTS.
  8519. @item round
  8520. Timestamp (PTS) rounding method.
  8521. Possible values are:
  8522. @table @option
  8523. @item zero
  8524. round towards 0
  8525. @item inf
  8526. round away from 0
  8527. @item down
  8528. round towards -infinity
  8529. @item up
  8530. round towards +infinity
  8531. @item near
  8532. round to nearest
  8533. @end table
  8534. The default is @code{near}.
  8535. @item eof_action
  8536. Action performed when reading the last frame.
  8537. Possible values are:
  8538. @table @option
  8539. @item round
  8540. Use same timestamp rounding method as used for other frames.
  8541. @item pass
  8542. Pass through last frame if input duration has not been reached yet.
  8543. @end table
  8544. The default is @code{round}.
  8545. @end table
  8546. Alternatively, the options can be specified as a flat string:
  8547. @var{fps}[:@var{start_time}[:@var{round}]].
  8548. See also the @ref{setpts} filter.
  8549. @subsection Examples
  8550. @itemize
  8551. @item
  8552. A typical usage in order to set the fps to 25:
  8553. @example
  8554. fps=fps=25
  8555. @end example
  8556. @item
  8557. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  8558. @example
  8559. fps=fps=film:round=near
  8560. @end example
  8561. @end itemize
  8562. @section framepack
  8563. Pack two different video streams into a stereoscopic video, setting proper
  8564. metadata on supported codecs. The two views should have the same size and
  8565. framerate and processing will stop when the shorter video ends. Please note
  8566. that you may conveniently adjust view properties with the @ref{scale} and
  8567. @ref{fps} filters.
  8568. It accepts the following parameters:
  8569. @table @option
  8570. @item format
  8571. The desired packing format. Supported values are:
  8572. @table @option
  8573. @item sbs
  8574. The views are next to each other (default).
  8575. @item tab
  8576. The views are on top of each other.
  8577. @item lines
  8578. The views are packed by line.
  8579. @item columns
  8580. The views are packed by column.
  8581. @item frameseq
  8582. The views are temporally interleaved.
  8583. @end table
  8584. @end table
  8585. Some examples:
  8586. @example
  8587. # Convert left and right views into a frame-sequential video
  8588. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8589. # Convert views into a side-by-side video with the same output resolution as the input
  8590. 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
  8591. @end example
  8592. @section framerate
  8593. Change the frame rate by interpolating new video output frames from the source
  8594. frames.
  8595. This filter is not designed to function correctly with interlaced media. If
  8596. you wish to change the frame rate of interlaced media then you are required
  8597. to deinterlace before this filter and re-interlace after this filter.
  8598. A description of the accepted options follows.
  8599. @table @option
  8600. @item fps
  8601. Specify the output frames per second. This option can also be specified
  8602. as a value alone. The default is @code{50}.
  8603. @item interp_start
  8604. Specify the start of a range where the output frame will be created as a
  8605. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8606. the default is @code{15}.
  8607. @item interp_end
  8608. Specify the end of a range where the output frame will be created as a
  8609. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8610. the default is @code{240}.
  8611. @item scene
  8612. Specify the level at which a scene change is detected as a value between
  8613. 0 and 100 to indicate a new scene; a low value reflects a low
  8614. probability for the current frame to introduce a new scene, while a higher
  8615. value means the current frame is more likely to be one.
  8616. The default is @code{8.2}.
  8617. @item flags
  8618. Specify flags influencing the filter process.
  8619. Available value for @var{flags} is:
  8620. @table @option
  8621. @item scene_change_detect, scd
  8622. Enable scene change detection using the value of the option @var{scene}.
  8623. This flag is enabled by default.
  8624. @end table
  8625. @end table
  8626. @section framestep
  8627. Select one frame every N-th frame.
  8628. This filter accepts the following option:
  8629. @table @option
  8630. @item step
  8631. Select frame after every @code{step} frames.
  8632. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8633. @end table
  8634. @section freezedetect
  8635. Detect frozen video.
  8636. This filter logs a message and sets frame metadata when it detects that the
  8637. input video has no significant change in content during a specified duration.
  8638. Video freeze detection calculates the mean average absolute difference of all
  8639. the components of video frames and compares it to a noise floor.
  8640. The printed times and duration are expressed in seconds. The
  8641. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8642. whose timestamp equals or exceeds the detection duration and it contains the
  8643. timestamp of the first frame of the freeze. The
  8644. @code{lavfi.freezedetect.freeze_duration} and
  8645. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8646. after the freeze.
  8647. The filter accepts the following options:
  8648. @table @option
  8649. @item noise, n
  8650. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8651. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8652. 0.001.
  8653. @item duration, d
  8654. Set freeze duration until notification (default is 2 seconds).
  8655. @end table
  8656. @section freezeframes
  8657. Freeze video frames.
  8658. This filter freezes video frames using frame from 2nd input.
  8659. The filter accepts the following options:
  8660. @table @option
  8661. @item first
  8662. Set number of first frame from which to start freeze.
  8663. @item last
  8664. Set number of last frame from which to end freeze.
  8665. @item replace
  8666. Set number of frame from 2nd input which will be used instead of replaced frames.
  8667. @end table
  8668. @anchor{frei0r}
  8669. @section frei0r
  8670. Apply a frei0r effect to the input video.
  8671. To enable the compilation of this filter, you need to install the frei0r
  8672. header and configure FFmpeg with @code{--enable-frei0r}.
  8673. It accepts the following parameters:
  8674. @table @option
  8675. @item filter_name
  8676. The name of the frei0r effect to load. If the environment variable
  8677. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8678. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8679. Otherwise, the standard frei0r paths are searched, in this order:
  8680. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8681. @file{/usr/lib/frei0r-1/}.
  8682. @item filter_params
  8683. A '|'-separated list of parameters to pass to the frei0r effect.
  8684. @end table
  8685. A frei0r effect parameter can be a boolean (its value is either
  8686. "y" or "n"), a double, a color (specified as
  8687. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8688. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8689. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8690. a position (specified as @var{X}/@var{Y}, where
  8691. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8692. The number and types of parameters depend on the loaded effect. If an
  8693. effect parameter is not specified, the default value is set.
  8694. @subsection Examples
  8695. @itemize
  8696. @item
  8697. Apply the distort0r effect, setting the first two double parameters:
  8698. @example
  8699. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8700. @end example
  8701. @item
  8702. Apply the colordistance effect, taking a color as the first parameter:
  8703. @example
  8704. frei0r=colordistance:0.2/0.3/0.4
  8705. frei0r=colordistance:violet
  8706. frei0r=colordistance:0x112233
  8707. @end example
  8708. @item
  8709. Apply the perspective effect, specifying the top left and top right image
  8710. positions:
  8711. @example
  8712. frei0r=perspective:0.2/0.2|0.8/0.2
  8713. @end example
  8714. @end itemize
  8715. For more information, see
  8716. @url{http://frei0r.dyne.org}
  8717. @section fspp
  8718. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8719. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8720. processing filter, one of them is performed once per block, not per pixel.
  8721. This allows for much higher speed.
  8722. The filter accepts the following options:
  8723. @table @option
  8724. @item quality
  8725. Set quality. This option defines the number of levels for averaging. It accepts
  8726. an integer in the range 4-5. Default value is @code{4}.
  8727. @item qp
  8728. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8729. If not set, the filter will use the QP from the video stream (if available).
  8730. @item strength
  8731. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8732. more details but also more artifacts, while higher values make the image smoother
  8733. but also blurrier. Default value is @code{0} − PSNR optimal.
  8734. @item use_bframe_qp
  8735. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8736. option may cause flicker since the B-Frames have often larger QP. Default is
  8737. @code{0} (not enabled).
  8738. @end table
  8739. @section gblur
  8740. Apply Gaussian blur filter.
  8741. The filter accepts the following options:
  8742. @table @option
  8743. @item sigma
  8744. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8745. @item steps
  8746. Set number of steps for Gaussian approximation. Default is @code{1}.
  8747. @item planes
  8748. Set which planes to filter. By default all planes are filtered.
  8749. @item sigmaV
  8750. Set vertical sigma, if negative it will be same as @code{sigma}.
  8751. Default is @code{-1}.
  8752. @end table
  8753. @subsection Commands
  8754. This filter supports same commands as options.
  8755. The command accepts the same syntax of the corresponding option.
  8756. If the specified expression is not valid, it is kept at its current
  8757. value.
  8758. @section geq
  8759. Apply generic equation to each pixel.
  8760. The filter accepts the following options:
  8761. @table @option
  8762. @item lum_expr, lum
  8763. Set the luminance expression.
  8764. @item cb_expr, cb
  8765. Set the chrominance blue expression.
  8766. @item cr_expr, cr
  8767. Set the chrominance red expression.
  8768. @item alpha_expr, a
  8769. Set the alpha expression.
  8770. @item red_expr, r
  8771. Set the red expression.
  8772. @item green_expr, g
  8773. Set the green expression.
  8774. @item blue_expr, b
  8775. Set the blue expression.
  8776. @end table
  8777. The colorspace is selected according to the specified options. If one
  8778. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8779. options is specified, the filter will automatically select a YCbCr
  8780. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8781. @option{blue_expr} options is specified, it will select an RGB
  8782. colorspace.
  8783. If one of the chrominance expression is not defined, it falls back on the other
  8784. one. If no alpha expression is specified it will evaluate to opaque value.
  8785. If none of chrominance expressions are specified, they will evaluate
  8786. to the luminance expression.
  8787. The expressions can use the following variables and functions:
  8788. @table @option
  8789. @item N
  8790. The sequential number of the filtered frame, starting from @code{0}.
  8791. @item X
  8792. @item Y
  8793. The coordinates of the current sample.
  8794. @item W
  8795. @item H
  8796. The width and height of the image.
  8797. @item SW
  8798. @item SH
  8799. Width and height scale depending on the currently filtered plane. It is the
  8800. ratio between the corresponding luma plane number of pixels and the current
  8801. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8802. @code{0.5,0.5} for chroma planes.
  8803. @item T
  8804. Time of the current frame, expressed in seconds.
  8805. @item p(x, y)
  8806. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8807. plane.
  8808. @item lum(x, y)
  8809. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8810. plane.
  8811. @item cb(x, y)
  8812. Return the value of the pixel at location (@var{x},@var{y}) of the
  8813. blue-difference chroma plane. Return 0 if there is no such plane.
  8814. @item cr(x, y)
  8815. Return the value of the pixel at location (@var{x},@var{y}) of the
  8816. red-difference chroma plane. Return 0 if there is no such plane.
  8817. @item r(x, y)
  8818. @item g(x, y)
  8819. @item b(x, y)
  8820. Return the value of the pixel at location (@var{x},@var{y}) of the
  8821. red/green/blue component. Return 0 if there is no such component.
  8822. @item alpha(x, y)
  8823. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8824. plane. Return 0 if there is no such plane.
  8825. @item psum(x,y), lumsum(x, y), cbsum(x,y), crsum(x,y), rsum(x,y), gsum(x,y), bsum(x,y), alphasum(x,y)
  8826. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  8827. sums of samples within a rectangle. See the functions without the sum postfix.
  8828. @item interpolation
  8829. Set one of interpolation methods:
  8830. @table @option
  8831. @item nearest, n
  8832. @item bilinear, b
  8833. @end table
  8834. Default is bilinear.
  8835. @end table
  8836. For functions, if @var{x} and @var{y} are outside the area, the value will be
  8837. automatically clipped to the closer edge.
  8838. Please note that this filter can use multiple threads in which case each slice
  8839. will have its own expression state. If you want to use only a single expression
  8840. state because your expressions depend on previous state then you should limit
  8841. the number of filter threads to 1.
  8842. @subsection Examples
  8843. @itemize
  8844. @item
  8845. Flip the image horizontally:
  8846. @example
  8847. geq=p(W-X\,Y)
  8848. @end example
  8849. @item
  8850. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  8851. wavelength of 100 pixels:
  8852. @example
  8853. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  8854. @end example
  8855. @item
  8856. Generate a fancy enigmatic moving light:
  8857. @example
  8858. 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
  8859. @end example
  8860. @item
  8861. Generate a quick emboss effect:
  8862. @example
  8863. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  8864. @end example
  8865. @item
  8866. Modify RGB components depending on pixel position:
  8867. @example
  8868. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  8869. @end example
  8870. @item
  8871. Create a radial gradient that is the same size as the input (also see
  8872. the @ref{vignette} filter):
  8873. @example
  8874. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8875. @end example
  8876. @end itemize
  8877. @section gradfun
  8878. Fix the banding artifacts that are sometimes introduced into nearly flat
  8879. regions by truncation to 8-bit color depth.
  8880. Interpolate the gradients that should go where the bands are, and
  8881. dither them.
  8882. It is designed for playback only. Do not use it prior to
  8883. lossy compression, because compression tends to lose the dither and
  8884. bring back the bands.
  8885. It accepts the following parameters:
  8886. @table @option
  8887. @item strength
  8888. The maximum amount by which the filter will change any one pixel. This is also
  8889. the threshold for detecting nearly flat regions. Acceptable values range from
  8890. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8891. valid range.
  8892. @item radius
  8893. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8894. gradients, but also prevents the filter from modifying the pixels near detailed
  8895. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8896. values will be clipped to the valid range.
  8897. @end table
  8898. Alternatively, the options can be specified as a flat string:
  8899. @var{strength}[:@var{radius}]
  8900. @subsection Examples
  8901. @itemize
  8902. @item
  8903. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8904. @example
  8905. gradfun=3.5:8
  8906. @end example
  8907. @item
  8908. Specify radius, omitting the strength (which will fall-back to the default
  8909. value):
  8910. @example
  8911. gradfun=radius=8
  8912. @end example
  8913. @end itemize
  8914. @anchor{graphmonitor}
  8915. @section graphmonitor
  8916. Show various filtergraph stats.
  8917. With this filter one can debug complete filtergraph.
  8918. Especially issues with links filling with queued frames.
  8919. The filter accepts the following options:
  8920. @table @option
  8921. @item size, s
  8922. Set video output size. Default is @var{hd720}.
  8923. @item opacity, o
  8924. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8925. @item mode, m
  8926. Set output mode, can be @var{fulll} or @var{compact}.
  8927. In @var{compact} mode only filters with some queued frames have displayed stats.
  8928. @item flags, f
  8929. Set flags which enable which stats are shown in video.
  8930. Available values for flags are:
  8931. @table @samp
  8932. @item queue
  8933. Display number of queued frames in each link.
  8934. @item frame_count_in
  8935. Display number of frames taken from filter.
  8936. @item frame_count_out
  8937. Display number of frames given out from filter.
  8938. @item pts
  8939. Display current filtered frame pts.
  8940. @item time
  8941. Display current filtered frame time.
  8942. @item timebase
  8943. Display time base for filter link.
  8944. @item format
  8945. Display used format for filter link.
  8946. @item size
  8947. Display video size or number of audio channels in case of audio used by filter link.
  8948. @item rate
  8949. Display video frame rate or sample rate in case of audio used by filter link.
  8950. @end table
  8951. @item rate, r
  8952. Set upper limit for video rate of output stream, Default value is @var{25}.
  8953. This guarantee that output video frame rate will not be higher than this value.
  8954. @end table
  8955. @section greyedge
  8956. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8957. and corrects the scene colors accordingly.
  8958. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8959. The filter accepts the following options:
  8960. @table @option
  8961. @item difford
  8962. The order of differentiation to be applied on the scene. Must be chosen in the range
  8963. [0,2] and default value is 1.
  8964. @item minknorm
  8965. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8966. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8967. max value instead of calculating Minkowski distance.
  8968. @item sigma
  8969. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8970. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8971. can't be equal to 0 if @var{difford} is greater than 0.
  8972. @end table
  8973. @subsection Examples
  8974. @itemize
  8975. @item
  8976. Grey Edge:
  8977. @example
  8978. greyedge=difford=1:minknorm=5:sigma=2
  8979. @end example
  8980. @item
  8981. Max Edge:
  8982. @example
  8983. greyedge=difford=1:minknorm=0:sigma=2
  8984. @end example
  8985. @end itemize
  8986. @anchor{haldclut}
  8987. @section haldclut
  8988. Apply a Hald CLUT to a video stream.
  8989. First input is the video stream to process, and second one is the Hald CLUT.
  8990. The Hald CLUT input can be a simple picture or a complete video stream.
  8991. The filter accepts the following options:
  8992. @table @option
  8993. @item shortest
  8994. Force termination when the shortest input terminates. Default is @code{0}.
  8995. @item repeatlast
  8996. Continue applying the last CLUT after the end of the stream. A value of
  8997. @code{0} disable the filter after the last frame of the CLUT is reached.
  8998. Default is @code{1}.
  8999. @end table
  9000. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  9001. filters share the same internals).
  9002. This filter also supports the @ref{framesync} options.
  9003. More information about the Hald CLUT can be found on Eskil Steenberg's website
  9004. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  9005. @subsection Workflow examples
  9006. @subsubsection Hald CLUT video stream
  9007. Generate an identity Hald CLUT stream altered with various effects:
  9008. @example
  9009. 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
  9010. @end example
  9011. Note: make sure you use a lossless codec.
  9012. Then use it with @code{haldclut} to apply it on some random stream:
  9013. @example
  9014. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  9015. @end example
  9016. The Hald CLUT will be applied to the 10 first seconds (duration of
  9017. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  9018. to the remaining frames of the @code{mandelbrot} stream.
  9019. @subsubsection Hald CLUT with preview
  9020. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  9021. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  9022. biggest possible square starting at the top left of the picture. The remaining
  9023. padding pixels (bottom or right) will be ignored. This area can be used to add
  9024. a preview of the Hald CLUT.
  9025. Typically, the following generated Hald CLUT will be supported by the
  9026. @code{haldclut} filter:
  9027. @example
  9028. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  9029. pad=iw+320 [padded_clut];
  9030. smptebars=s=320x256, split [a][b];
  9031. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  9032. [main][b] overlay=W-320" -frames:v 1 clut.png
  9033. @end example
  9034. It contains the original and a preview of the effect of the CLUT: SMPTE color
  9035. bars are displayed on the right-top, and below the same color bars processed by
  9036. the color changes.
  9037. Then, the effect of this Hald CLUT can be visualized with:
  9038. @example
  9039. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  9040. @end example
  9041. @section hflip
  9042. Flip the input video horizontally.
  9043. For example, to horizontally flip the input video with @command{ffmpeg}:
  9044. @example
  9045. ffmpeg -i in.avi -vf "hflip" out.avi
  9046. @end example
  9047. @section histeq
  9048. This filter applies a global color histogram equalization on a
  9049. per-frame basis.
  9050. It can be used to correct video that has a compressed range of pixel
  9051. intensities. The filter redistributes the pixel intensities to
  9052. equalize their distribution across the intensity range. It may be
  9053. viewed as an "automatically adjusting contrast filter". This filter is
  9054. useful only for correcting degraded or poorly captured source
  9055. video.
  9056. The filter accepts the following options:
  9057. @table @option
  9058. @item strength
  9059. Determine the amount of equalization to be applied. As the strength
  9060. is reduced, the distribution of pixel intensities more-and-more
  9061. approaches that of the input frame. The value must be a float number
  9062. in the range [0,1] and defaults to 0.200.
  9063. @item intensity
  9064. Set the maximum intensity that can generated and scale the output
  9065. values appropriately. The strength should be set as desired and then
  9066. the intensity can be limited if needed to avoid washing-out. The value
  9067. must be a float number in the range [0,1] and defaults to 0.210.
  9068. @item antibanding
  9069. Set the antibanding level. If enabled the filter will randomly vary
  9070. the luminance of output pixels by a small amount to avoid banding of
  9071. the histogram. Possible values are @code{none}, @code{weak} or
  9072. @code{strong}. It defaults to @code{none}.
  9073. @end table
  9074. @anchor{histogram}
  9075. @section histogram
  9076. Compute and draw a color distribution histogram for the input video.
  9077. The computed histogram is a representation of the color component
  9078. distribution in an image.
  9079. Standard histogram displays the color components distribution in an image.
  9080. Displays color graph for each color component. Shows distribution of
  9081. the Y, U, V, A or R, G, B components, depending on input format, in the
  9082. current frame. Below each graph a color component scale meter is shown.
  9083. The filter accepts the following options:
  9084. @table @option
  9085. @item level_height
  9086. Set height of level. Default value is @code{200}.
  9087. Allowed range is [50, 2048].
  9088. @item scale_height
  9089. Set height of color scale. Default value is @code{12}.
  9090. Allowed range is [0, 40].
  9091. @item display_mode
  9092. Set display mode.
  9093. It accepts the following values:
  9094. @table @samp
  9095. @item stack
  9096. Per color component graphs are placed below each other.
  9097. @item parade
  9098. Per color component graphs are placed side by side.
  9099. @item overlay
  9100. Presents information identical to that in the @code{parade}, except
  9101. that the graphs representing color components are superimposed directly
  9102. over one another.
  9103. @end table
  9104. Default is @code{stack}.
  9105. @item levels_mode
  9106. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  9107. Default is @code{linear}.
  9108. @item components
  9109. Set what color components to display.
  9110. Default is @code{7}.
  9111. @item fgopacity
  9112. Set foreground opacity. Default is @code{0.7}.
  9113. @item bgopacity
  9114. Set background opacity. Default is @code{0.5}.
  9115. @end table
  9116. @subsection Examples
  9117. @itemize
  9118. @item
  9119. Calculate and draw histogram:
  9120. @example
  9121. ffplay -i input -vf histogram
  9122. @end example
  9123. @end itemize
  9124. @anchor{hqdn3d}
  9125. @section hqdn3d
  9126. This is a high precision/quality 3d denoise filter. It aims to reduce
  9127. image noise, producing smooth images and making still images really
  9128. still. It should enhance compressibility.
  9129. It accepts the following optional parameters:
  9130. @table @option
  9131. @item luma_spatial
  9132. A non-negative floating point number which specifies spatial luma strength.
  9133. It defaults to 4.0.
  9134. @item chroma_spatial
  9135. A non-negative floating point number which specifies spatial chroma strength.
  9136. It defaults to 3.0*@var{luma_spatial}/4.0.
  9137. @item luma_tmp
  9138. A floating point number which specifies luma temporal strength. It defaults to
  9139. 6.0*@var{luma_spatial}/4.0.
  9140. @item chroma_tmp
  9141. A floating point number which specifies chroma temporal strength. It defaults to
  9142. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  9143. @end table
  9144. @subsection Commands
  9145. This filter supports same @ref{commands} as options.
  9146. The command accepts the same syntax of the corresponding option.
  9147. If the specified expression is not valid, it is kept at its current
  9148. value.
  9149. @anchor{hwdownload}
  9150. @section hwdownload
  9151. Download hardware frames to system memory.
  9152. The input must be in hardware frames, and the output a non-hardware format.
  9153. Not all formats will be supported on the output - it may be necessary to insert
  9154. an additional @option{format} filter immediately following in the graph to get
  9155. the output in a supported format.
  9156. @section hwmap
  9157. Map hardware frames to system memory or to another device.
  9158. This filter has several different modes of operation; which one is used depends
  9159. on the input and output formats:
  9160. @itemize
  9161. @item
  9162. Hardware frame input, normal frame output
  9163. Map the input frames to system memory and pass them to the output. If the
  9164. original hardware frame is later required (for example, after overlaying
  9165. something else on part of it), the @option{hwmap} filter can be used again
  9166. in the next mode to retrieve it.
  9167. @item
  9168. Normal frame input, hardware frame output
  9169. If the input is actually a software-mapped hardware frame, then unmap it -
  9170. that is, return the original hardware frame.
  9171. Otherwise, a device must be provided. Create new hardware surfaces on that
  9172. device for the output, then map them back to the software format at the input
  9173. and give those frames to the preceding filter. This will then act like the
  9174. @option{hwupload} filter, but may be able to avoid an additional copy when
  9175. the input is already in a compatible format.
  9176. @item
  9177. Hardware frame input and output
  9178. A device must be supplied for the output, either directly or with the
  9179. @option{derive_device} option. The input and output devices must be of
  9180. different types and compatible - the exact meaning of this is
  9181. system-dependent, but typically it means that they must refer to the same
  9182. underlying hardware context (for example, refer to the same graphics card).
  9183. If the input frames were originally created on the output device, then unmap
  9184. to retrieve the original frames.
  9185. Otherwise, map the frames to the output device - create new hardware frames
  9186. on the output corresponding to the frames on the input.
  9187. @end itemize
  9188. The following additional parameters are accepted:
  9189. @table @option
  9190. @item mode
  9191. Set the frame mapping mode. Some combination of:
  9192. @table @var
  9193. @item read
  9194. The mapped frame should be readable.
  9195. @item write
  9196. The mapped frame should be writeable.
  9197. @item overwrite
  9198. The mapping will always overwrite the entire frame.
  9199. This may improve performance in some cases, as the original contents of the
  9200. frame need not be loaded.
  9201. @item direct
  9202. The mapping must not involve any copying.
  9203. Indirect mappings to copies of frames are created in some cases where either
  9204. direct mapping is not possible or it would have unexpected properties.
  9205. Setting this flag ensures that the mapping is direct and will fail if that is
  9206. not possible.
  9207. @end table
  9208. Defaults to @var{read+write} if not specified.
  9209. @item derive_device @var{type}
  9210. Rather than using the device supplied at initialisation, instead derive a new
  9211. device of type @var{type} from the device the input frames exist on.
  9212. @item reverse
  9213. In a hardware to hardware mapping, map in reverse - create frames in the sink
  9214. and map them back to the source. This may be necessary in some cases where
  9215. a mapping in one direction is required but only the opposite direction is
  9216. supported by the devices being used.
  9217. This option is dangerous - it may break the preceding filter in undefined
  9218. ways if there are any additional constraints on that filter's output.
  9219. Do not use it without fully understanding the implications of its use.
  9220. @end table
  9221. @anchor{hwupload}
  9222. @section hwupload
  9223. Upload system memory frames to hardware surfaces.
  9224. The device to upload to must be supplied when the filter is initialised. If
  9225. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  9226. option or with the @option{derive_device} option. The input and output devices
  9227. must be of different types and compatible - the exact meaning of this is
  9228. system-dependent, but typically it means that they must refer to the same
  9229. underlying hardware context (for example, refer to the same graphics card).
  9230. The following additional parameters are accepted:
  9231. @table @option
  9232. @item derive_device @var{type}
  9233. Rather than using the device supplied at initialisation, instead derive a new
  9234. device of type @var{type} from the device the input frames exist on.
  9235. @end table
  9236. @anchor{hwupload_cuda}
  9237. @section hwupload_cuda
  9238. Upload system memory frames to a CUDA device.
  9239. It accepts the following optional parameters:
  9240. @table @option
  9241. @item device
  9242. The number of the CUDA device to use
  9243. @end table
  9244. @section hqx
  9245. Apply a high-quality magnification filter designed for pixel art. This filter
  9246. was originally created by Maxim Stepin.
  9247. It accepts the following option:
  9248. @table @option
  9249. @item n
  9250. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  9251. @code{hq3x} and @code{4} for @code{hq4x}.
  9252. Default is @code{3}.
  9253. @end table
  9254. @section hstack
  9255. Stack input videos horizontally.
  9256. All streams must be of same pixel format and of same height.
  9257. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  9258. to create same output.
  9259. The filter accepts the following option:
  9260. @table @option
  9261. @item inputs
  9262. Set number of input streams. Default is 2.
  9263. @item shortest
  9264. If set to 1, force the output to terminate when the shortest input
  9265. terminates. Default value is 0.
  9266. @end table
  9267. @section hue
  9268. Modify the hue and/or the saturation of the input.
  9269. It accepts the following parameters:
  9270. @table @option
  9271. @item h
  9272. Specify the hue angle as a number of degrees. It accepts an expression,
  9273. and defaults to "0".
  9274. @item s
  9275. Specify the saturation in the [-10,10] range. It accepts an expression and
  9276. defaults to "1".
  9277. @item H
  9278. Specify the hue angle as a number of radians. It accepts an
  9279. expression, and defaults to "0".
  9280. @item b
  9281. Specify the brightness in the [-10,10] range. It accepts an expression and
  9282. defaults to "0".
  9283. @end table
  9284. @option{h} and @option{H} are mutually exclusive, and can't be
  9285. specified at the same time.
  9286. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  9287. expressions containing the following constants:
  9288. @table @option
  9289. @item n
  9290. frame count of the input frame starting from 0
  9291. @item pts
  9292. presentation timestamp of the input frame expressed in time base units
  9293. @item r
  9294. frame rate of the input video, NAN if the input frame rate is unknown
  9295. @item t
  9296. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9297. @item tb
  9298. time base of the input video
  9299. @end table
  9300. @subsection Examples
  9301. @itemize
  9302. @item
  9303. Set the hue to 90 degrees and the saturation to 1.0:
  9304. @example
  9305. hue=h=90:s=1
  9306. @end example
  9307. @item
  9308. Same command but expressing the hue in radians:
  9309. @example
  9310. hue=H=PI/2:s=1
  9311. @end example
  9312. @item
  9313. Rotate hue and make the saturation swing between 0
  9314. and 2 over a period of 1 second:
  9315. @example
  9316. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  9317. @end example
  9318. @item
  9319. Apply a 3 seconds saturation fade-in effect starting at 0:
  9320. @example
  9321. hue="s=min(t/3\,1)"
  9322. @end example
  9323. The general fade-in expression can be written as:
  9324. @example
  9325. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  9326. @end example
  9327. @item
  9328. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  9329. @example
  9330. hue="s=max(0\, min(1\, (8-t)/3))"
  9331. @end example
  9332. The general fade-out expression can be written as:
  9333. @example
  9334. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  9335. @end example
  9336. @end itemize
  9337. @subsection Commands
  9338. This filter supports the following commands:
  9339. @table @option
  9340. @item b
  9341. @item s
  9342. @item h
  9343. @item H
  9344. Modify the hue and/or the saturation and/or brightness of the input video.
  9345. The command accepts the same syntax of the corresponding option.
  9346. If the specified expression is not valid, it is kept at its current
  9347. value.
  9348. @end table
  9349. @section hysteresis
  9350. Grow first stream into second stream by connecting components.
  9351. This makes it possible to build more robust edge masks.
  9352. This filter accepts the following options:
  9353. @table @option
  9354. @item planes
  9355. Set which planes will be processed as bitmap, unprocessed planes will be
  9356. copied from first stream.
  9357. By default value 0xf, all planes will be processed.
  9358. @item threshold
  9359. Set threshold which is used in filtering. If pixel component value is higher than
  9360. this value filter algorithm for connecting components is activated.
  9361. By default value is 0.
  9362. @end table
  9363. The @code{hysteresis} filter also supports the @ref{framesync} options.
  9364. @section idet
  9365. Detect video interlacing type.
  9366. This filter tries to detect if the input frames are interlaced, progressive,
  9367. top or bottom field first. It will also try to detect fields that are
  9368. repeated between adjacent frames (a sign of telecine).
  9369. Single frame detection considers only immediately adjacent frames when classifying each frame.
  9370. Multiple frame detection incorporates the classification history of previous frames.
  9371. The filter will log these metadata values:
  9372. @table @option
  9373. @item single.current_frame
  9374. Detected type of current frame using single-frame detection. One of:
  9375. ``tff'' (top field first), ``bff'' (bottom field first),
  9376. ``progressive'', or ``undetermined''
  9377. @item single.tff
  9378. Cumulative number of frames detected as top field first using single-frame detection.
  9379. @item multiple.tff
  9380. Cumulative number of frames detected as top field first using multiple-frame detection.
  9381. @item single.bff
  9382. Cumulative number of frames detected as bottom field first using single-frame detection.
  9383. @item multiple.current_frame
  9384. Detected type of current frame using multiple-frame detection. One of:
  9385. ``tff'' (top field first), ``bff'' (bottom field first),
  9386. ``progressive'', or ``undetermined''
  9387. @item multiple.bff
  9388. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  9389. @item single.progressive
  9390. Cumulative number of frames detected as progressive using single-frame detection.
  9391. @item multiple.progressive
  9392. Cumulative number of frames detected as progressive using multiple-frame detection.
  9393. @item single.undetermined
  9394. Cumulative number of frames that could not be classified using single-frame detection.
  9395. @item multiple.undetermined
  9396. Cumulative number of frames that could not be classified using multiple-frame detection.
  9397. @item repeated.current_frame
  9398. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  9399. @item repeated.neither
  9400. Cumulative number of frames with no repeated field.
  9401. @item repeated.top
  9402. Cumulative number of frames with the top field repeated from the previous frame's top field.
  9403. @item repeated.bottom
  9404. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  9405. @end table
  9406. The filter accepts the following options:
  9407. @table @option
  9408. @item intl_thres
  9409. Set interlacing threshold.
  9410. @item prog_thres
  9411. Set progressive threshold.
  9412. @item rep_thres
  9413. Threshold for repeated field detection.
  9414. @item half_life
  9415. Number of frames after which a given frame's contribution to the
  9416. statistics is halved (i.e., it contributes only 0.5 to its
  9417. classification). The default of 0 means that all frames seen are given
  9418. full weight of 1.0 forever.
  9419. @item analyze_interlaced_flag
  9420. When this is not 0 then idet will use the specified number of frames to determine
  9421. if the interlaced flag is accurate, it will not count undetermined frames.
  9422. If the flag is found to be accurate it will be used without any further
  9423. computations, if it is found to be inaccurate it will be cleared without any
  9424. further computations. This allows inserting the idet filter as a low computational
  9425. method to clean up the interlaced flag
  9426. @end table
  9427. @section il
  9428. Deinterleave or interleave fields.
  9429. This filter allows one to process interlaced images fields without
  9430. deinterlacing them. Deinterleaving splits the input frame into 2
  9431. fields (so called half pictures). Odd lines are moved to the top
  9432. half of the output image, even lines to the bottom half.
  9433. You can process (filter) them independently and then re-interleave them.
  9434. The filter accepts the following options:
  9435. @table @option
  9436. @item luma_mode, l
  9437. @item chroma_mode, c
  9438. @item alpha_mode, a
  9439. Available values for @var{luma_mode}, @var{chroma_mode} and
  9440. @var{alpha_mode} are:
  9441. @table @samp
  9442. @item none
  9443. Do nothing.
  9444. @item deinterleave, d
  9445. Deinterleave fields, placing one above the other.
  9446. @item interleave, i
  9447. Interleave fields. Reverse the effect of deinterleaving.
  9448. @end table
  9449. Default value is @code{none}.
  9450. @item luma_swap, ls
  9451. @item chroma_swap, cs
  9452. @item alpha_swap, as
  9453. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  9454. @end table
  9455. @subsection Commands
  9456. This filter supports the all above options as @ref{commands}.
  9457. @section inflate
  9458. Apply inflate effect to the video.
  9459. This filter replaces the pixel by the local(3x3) average by taking into account
  9460. only values higher than the pixel.
  9461. It accepts the following options:
  9462. @table @option
  9463. @item threshold0
  9464. @item threshold1
  9465. @item threshold2
  9466. @item threshold3
  9467. Limit the maximum change for each plane, default is 65535.
  9468. If 0, plane will remain unchanged.
  9469. @end table
  9470. @subsection Commands
  9471. This filter supports the all above options as @ref{commands}.
  9472. @section interlace
  9473. Simple interlacing filter from progressive contents. This interleaves upper (or
  9474. lower) lines from odd frames with lower (or upper) lines from even frames,
  9475. halving the frame rate and preserving image height.
  9476. @example
  9477. Original Original New Frame
  9478. Frame 'j' Frame 'j+1' (tff)
  9479. ========== =========== ==================
  9480. Line 0 --------------------> Frame 'j' Line 0
  9481. Line 1 Line 1 ----> Frame 'j+1' Line 1
  9482. Line 2 ---------------------> Frame 'j' Line 2
  9483. Line 3 Line 3 ----> Frame 'j+1' Line 3
  9484. ... ... ...
  9485. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  9486. @end example
  9487. It accepts the following optional parameters:
  9488. @table @option
  9489. @item scan
  9490. This determines whether the interlaced frame is taken from the even
  9491. (tff - default) or odd (bff) lines of the progressive frame.
  9492. @item lowpass
  9493. Vertical lowpass filter to avoid twitter interlacing and
  9494. reduce moire patterns.
  9495. @table @samp
  9496. @item 0, off
  9497. Disable vertical lowpass filter
  9498. @item 1, linear
  9499. Enable linear filter (default)
  9500. @item 2, complex
  9501. Enable complex filter. This will slightly less reduce twitter and moire
  9502. but better retain detail and subjective sharpness impression.
  9503. @end table
  9504. @end table
  9505. @section kerndeint
  9506. Deinterlace input video by applying Donald Graft's adaptive kernel
  9507. deinterling. Work on interlaced parts of a video to produce
  9508. progressive frames.
  9509. The description of the accepted parameters follows.
  9510. @table @option
  9511. @item thresh
  9512. Set the threshold which affects the filter's tolerance when
  9513. determining if a pixel line must be processed. It must be an integer
  9514. in the range [0,255] and defaults to 10. A value of 0 will result in
  9515. applying the process on every pixels.
  9516. @item map
  9517. Paint pixels exceeding the threshold value to white if set to 1.
  9518. Default is 0.
  9519. @item order
  9520. Set the fields order. Swap fields if set to 1, leave fields alone if
  9521. 0. Default is 0.
  9522. @item sharp
  9523. Enable additional sharpening if set to 1. Default is 0.
  9524. @item twoway
  9525. Enable twoway sharpening if set to 1. Default is 0.
  9526. @end table
  9527. @subsection Examples
  9528. @itemize
  9529. @item
  9530. Apply default values:
  9531. @example
  9532. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  9533. @end example
  9534. @item
  9535. Enable additional sharpening:
  9536. @example
  9537. kerndeint=sharp=1
  9538. @end example
  9539. @item
  9540. Paint processed pixels in white:
  9541. @example
  9542. kerndeint=map=1
  9543. @end example
  9544. @end itemize
  9545. @section lagfun
  9546. Slowly update darker pixels.
  9547. This filter makes short flashes of light appear longer.
  9548. This filter accepts the following options:
  9549. @table @option
  9550. @item decay
  9551. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  9552. @item planes
  9553. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  9554. @end table
  9555. @section lenscorrection
  9556. Correct radial lens distortion
  9557. This filter can be used to correct for radial distortion as can result from the use
  9558. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  9559. one can use tools available for example as part of opencv or simply trial-and-error.
  9560. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  9561. and extract the k1 and k2 coefficients from the resulting matrix.
  9562. Note that effectively the same filter is available in the open-source tools Krita and
  9563. Digikam from the KDE project.
  9564. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  9565. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  9566. brightness distribution, so you may want to use both filters together in certain
  9567. cases, though you will have to take care of ordering, i.e. whether vignetting should
  9568. be applied before or after lens correction.
  9569. @subsection Options
  9570. The filter accepts the following options:
  9571. @table @option
  9572. @item cx
  9573. Relative x-coordinate of the focal point of the image, and thereby the center of the
  9574. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9575. width. Default is 0.5.
  9576. @item cy
  9577. Relative y-coordinate of the focal point of the image, and thereby the center of the
  9578. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9579. height. Default is 0.5.
  9580. @item k1
  9581. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  9582. no correction. Default is 0.
  9583. @item k2
  9584. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  9585. 0 means no correction. Default is 0.
  9586. @end table
  9587. The formula that generates the correction is:
  9588. @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)
  9589. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  9590. distances from the focal point in the source and target images, respectively.
  9591. @section lensfun
  9592. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  9593. The @code{lensfun} filter requires the camera make, camera model, and lens model
  9594. to apply the lens correction. The filter will load the lensfun database and
  9595. query it to find the corresponding camera and lens entries in the database. As
  9596. long as these entries can be found with the given options, the filter can
  9597. perform corrections on frames. Note that incomplete strings will result in the
  9598. filter choosing the best match with the given options, and the filter will
  9599. output the chosen camera and lens models (logged with level "info"). You must
  9600. provide the make, camera model, and lens model as they are required.
  9601. The filter accepts the following options:
  9602. @table @option
  9603. @item make
  9604. The make of the camera (for example, "Canon"). This option is required.
  9605. @item model
  9606. The model of the camera (for example, "Canon EOS 100D"). This option is
  9607. required.
  9608. @item lens_model
  9609. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  9610. option is required.
  9611. @item mode
  9612. The type of correction to apply. The following values are valid options:
  9613. @table @samp
  9614. @item vignetting
  9615. Enables fixing lens vignetting.
  9616. @item geometry
  9617. Enables fixing lens geometry. This is the default.
  9618. @item subpixel
  9619. Enables fixing chromatic aberrations.
  9620. @item vig_geo
  9621. Enables fixing lens vignetting and lens geometry.
  9622. @item vig_subpixel
  9623. Enables fixing lens vignetting and chromatic aberrations.
  9624. @item distortion
  9625. Enables fixing both lens geometry and chromatic aberrations.
  9626. @item all
  9627. Enables all possible corrections.
  9628. @end table
  9629. @item focal_length
  9630. The focal length of the image/video (zoom; expected constant for video). For
  9631. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  9632. range should be chosen when using that lens. Default 18.
  9633. @item aperture
  9634. The aperture of the image/video (expected constant for video). Note that
  9635. aperture is only used for vignetting correction. Default 3.5.
  9636. @item focus_distance
  9637. The focus distance of the image/video (expected constant for video). Note that
  9638. focus distance is only used for vignetting and only slightly affects the
  9639. vignetting correction process. If unknown, leave it at the default value (which
  9640. is 1000).
  9641. @item scale
  9642. The scale factor which is applied after transformation. After correction the
  9643. video is no longer necessarily rectangular. This parameter controls how much of
  9644. the resulting image is visible. The value 0 means that a value will be chosen
  9645. automatically such that there is little or no unmapped area in the output
  9646. image. 1.0 means that no additional scaling is done. Lower values may result
  9647. in more of the corrected image being visible, while higher values may avoid
  9648. unmapped areas in the output.
  9649. @item target_geometry
  9650. The target geometry of the output image/video. The following values are valid
  9651. options:
  9652. @table @samp
  9653. @item rectilinear (default)
  9654. @item fisheye
  9655. @item panoramic
  9656. @item equirectangular
  9657. @item fisheye_orthographic
  9658. @item fisheye_stereographic
  9659. @item fisheye_equisolid
  9660. @item fisheye_thoby
  9661. @end table
  9662. @item reverse
  9663. Apply the reverse of image correction (instead of correcting distortion, apply
  9664. it).
  9665. @item interpolation
  9666. The type of interpolation used when correcting distortion. The following values
  9667. are valid options:
  9668. @table @samp
  9669. @item nearest
  9670. @item linear (default)
  9671. @item lanczos
  9672. @end table
  9673. @end table
  9674. @subsection Examples
  9675. @itemize
  9676. @item
  9677. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9678. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9679. aperture of "8.0".
  9680. @example
  9681. 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
  9682. @end example
  9683. @item
  9684. Apply the same as before, but only for the first 5 seconds of video.
  9685. @example
  9686. 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
  9687. @end example
  9688. @end itemize
  9689. @section libvmaf
  9690. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9691. score between two input videos.
  9692. The obtained VMAF score is printed through the logging system.
  9693. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9694. After installing the library it can be enabled using:
  9695. @code{./configure --enable-libvmaf --enable-version3}.
  9696. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9697. The filter has following options:
  9698. @table @option
  9699. @item model_path
  9700. Set the model path which is to be used for SVM.
  9701. Default value: @code{"/usr/local/share/model/vmaf_v0.6.1.pkl"}
  9702. @item log_path
  9703. Set the file path to be used to store logs.
  9704. @item log_fmt
  9705. Set the format of the log file (xml or json).
  9706. @item enable_transform
  9707. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  9708. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  9709. Default value: @code{false}
  9710. @item phone_model
  9711. Invokes the phone model which will generate VMAF scores higher than in the
  9712. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  9713. Default value: @code{false}
  9714. @item psnr
  9715. Enables computing psnr along with vmaf.
  9716. Default value: @code{false}
  9717. @item ssim
  9718. Enables computing ssim along with vmaf.
  9719. Default value: @code{false}
  9720. @item ms_ssim
  9721. Enables computing ms_ssim along with vmaf.
  9722. Default value: @code{false}
  9723. @item pool
  9724. Set the pool method to be used for computing vmaf.
  9725. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  9726. @item n_threads
  9727. Set number of threads to be used when computing vmaf.
  9728. Default value: @code{0}, which makes use of all available logical processors.
  9729. @item n_subsample
  9730. Set interval for frame subsampling used when computing vmaf.
  9731. Default value: @code{1}
  9732. @item enable_conf_interval
  9733. Enables confidence interval.
  9734. Default value: @code{false}
  9735. @end table
  9736. This filter also supports the @ref{framesync} options.
  9737. @subsection Examples
  9738. @itemize
  9739. @item
  9740. On the below examples the input file @file{main.mpg} being processed is
  9741. compared with the reference file @file{ref.mpg}.
  9742. @example
  9743. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  9744. @end example
  9745. @item
  9746. Example with options:
  9747. @example
  9748. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  9749. @end example
  9750. @item
  9751. Example with options and different containers:
  9752. @example
  9753. ffmpeg -i main.mpg -i ref.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[main][ref]libvmaf=psnr=1:log_fmt=json" -f null -
  9754. @end example
  9755. @end itemize
  9756. @section limiter
  9757. Limits the pixel components values to the specified range [min, max].
  9758. The filter accepts the following options:
  9759. @table @option
  9760. @item min
  9761. Lower bound. Defaults to the lowest allowed value for the input.
  9762. @item max
  9763. Upper bound. Defaults to the highest allowed value for the input.
  9764. @item planes
  9765. Specify which planes will be processed. Defaults to all available.
  9766. @end table
  9767. @section loop
  9768. Loop video frames.
  9769. The filter accepts the following options:
  9770. @table @option
  9771. @item loop
  9772. Set the number of loops. Setting this value to -1 will result in infinite loops.
  9773. Default is 0.
  9774. @item size
  9775. Set maximal size in number of frames. Default is 0.
  9776. @item start
  9777. Set first frame of loop. Default is 0.
  9778. @end table
  9779. @subsection Examples
  9780. @itemize
  9781. @item
  9782. Loop single first frame infinitely:
  9783. @example
  9784. loop=loop=-1:size=1:start=0
  9785. @end example
  9786. @item
  9787. Loop single first frame 10 times:
  9788. @example
  9789. loop=loop=10:size=1:start=0
  9790. @end example
  9791. @item
  9792. Loop 10 first frames 5 times:
  9793. @example
  9794. loop=loop=5:size=10:start=0
  9795. @end example
  9796. @end itemize
  9797. @section lut1d
  9798. Apply a 1D LUT to an input video.
  9799. The filter accepts the following options:
  9800. @table @option
  9801. @item file
  9802. Set the 1D LUT file name.
  9803. Currently supported formats:
  9804. @table @samp
  9805. @item cube
  9806. Iridas
  9807. @item csp
  9808. cineSpace
  9809. @end table
  9810. @item interp
  9811. Select interpolation mode.
  9812. Available values are:
  9813. @table @samp
  9814. @item nearest
  9815. Use values from the nearest defined point.
  9816. @item linear
  9817. Interpolate values using the linear interpolation.
  9818. @item cosine
  9819. Interpolate values using the cosine interpolation.
  9820. @item cubic
  9821. Interpolate values using the cubic interpolation.
  9822. @item spline
  9823. Interpolate values using the spline interpolation.
  9824. @end table
  9825. @end table
  9826. @anchor{lut3d}
  9827. @section lut3d
  9828. Apply a 3D LUT to an input video.
  9829. The filter accepts the following options:
  9830. @table @option
  9831. @item file
  9832. Set the 3D LUT file name.
  9833. Currently supported formats:
  9834. @table @samp
  9835. @item 3dl
  9836. AfterEffects
  9837. @item cube
  9838. Iridas
  9839. @item dat
  9840. DaVinci
  9841. @item m3d
  9842. Pandora
  9843. @item csp
  9844. cineSpace
  9845. @end table
  9846. @item interp
  9847. Select interpolation mode.
  9848. Available values are:
  9849. @table @samp
  9850. @item nearest
  9851. Use values from the nearest defined point.
  9852. @item trilinear
  9853. Interpolate values using the 8 points defining a cube.
  9854. @item tetrahedral
  9855. Interpolate values using a tetrahedron.
  9856. @end table
  9857. @end table
  9858. @section lumakey
  9859. Turn certain luma values into transparency.
  9860. The filter accepts the following options:
  9861. @table @option
  9862. @item threshold
  9863. Set the luma which will be used as base for transparency.
  9864. Default value is @code{0}.
  9865. @item tolerance
  9866. Set the range of luma values to be keyed out.
  9867. Default value is @code{0.01}.
  9868. @item softness
  9869. Set the range of softness. Default value is @code{0}.
  9870. Use this to control gradual transition from zero to full transparency.
  9871. @end table
  9872. @subsection Commands
  9873. This filter supports same @ref{commands} as options.
  9874. The command accepts the same syntax of the corresponding option.
  9875. If the specified expression is not valid, it is kept at its current
  9876. value.
  9877. @section lut, lutrgb, lutyuv
  9878. Compute a look-up table for binding each pixel component input value
  9879. to an output value, and apply it to the input video.
  9880. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  9881. to an RGB input video.
  9882. These filters accept the following parameters:
  9883. @table @option
  9884. @item c0
  9885. set first pixel component expression
  9886. @item c1
  9887. set second pixel component expression
  9888. @item c2
  9889. set third pixel component expression
  9890. @item c3
  9891. set fourth pixel component expression, corresponds to the alpha component
  9892. @item r
  9893. set red component expression
  9894. @item g
  9895. set green component expression
  9896. @item b
  9897. set blue component expression
  9898. @item a
  9899. alpha component expression
  9900. @item y
  9901. set Y/luminance component expression
  9902. @item u
  9903. set U/Cb component expression
  9904. @item v
  9905. set V/Cr component expression
  9906. @end table
  9907. Each of them specifies the expression to use for computing the lookup table for
  9908. the corresponding pixel component values.
  9909. The exact component associated to each of the @var{c*} options depends on the
  9910. format in input.
  9911. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  9912. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  9913. The expressions can contain the following constants and functions:
  9914. @table @option
  9915. @item w
  9916. @item h
  9917. The input width and height.
  9918. @item val
  9919. The input value for the pixel component.
  9920. @item clipval
  9921. The input value, clipped to the @var{minval}-@var{maxval} range.
  9922. @item maxval
  9923. The maximum value for the pixel component.
  9924. @item minval
  9925. The minimum value for the pixel component.
  9926. @item negval
  9927. The negated value for the pixel component value, clipped to the
  9928. @var{minval}-@var{maxval} range; it corresponds to the expression
  9929. "maxval-clipval+minval".
  9930. @item clip(val)
  9931. The computed value in @var{val}, clipped to the
  9932. @var{minval}-@var{maxval} range.
  9933. @item gammaval(gamma)
  9934. The computed gamma correction value of the pixel component value,
  9935. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  9936. expression
  9937. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  9938. @end table
  9939. All expressions default to "val".
  9940. @subsection Examples
  9941. @itemize
  9942. @item
  9943. Negate input video:
  9944. @example
  9945. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  9946. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  9947. @end example
  9948. The above is the same as:
  9949. @example
  9950. lutrgb="r=negval:g=negval:b=negval"
  9951. lutyuv="y=negval:u=negval:v=negval"
  9952. @end example
  9953. @item
  9954. Negate luminance:
  9955. @example
  9956. lutyuv=y=negval
  9957. @end example
  9958. @item
  9959. Remove chroma components, turning the video into a graytone image:
  9960. @example
  9961. lutyuv="u=128:v=128"
  9962. @end example
  9963. @item
  9964. Apply a luma burning effect:
  9965. @example
  9966. lutyuv="y=2*val"
  9967. @end example
  9968. @item
  9969. Remove green and blue components:
  9970. @example
  9971. lutrgb="g=0:b=0"
  9972. @end example
  9973. @item
  9974. Set a constant alpha channel value on input:
  9975. @example
  9976. format=rgba,lutrgb=a="maxval-minval/2"
  9977. @end example
  9978. @item
  9979. Correct luminance gamma by a factor of 0.5:
  9980. @example
  9981. lutyuv=y=gammaval(0.5)
  9982. @end example
  9983. @item
  9984. Discard least significant bits of luma:
  9985. @example
  9986. lutyuv=y='bitand(val, 128+64+32)'
  9987. @end example
  9988. @item
  9989. Technicolor like effect:
  9990. @example
  9991. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9992. @end example
  9993. @end itemize
  9994. @section lut2, tlut2
  9995. The @code{lut2} filter takes two input streams and outputs one
  9996. stream.
  9997. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9998. from one single stream.
  9999. This filter accepts the following parameters:
  10000. @table @option
  10001. @item c0
  10002. set first pixel component expression
  10003. @item c1
  10004. set second pixel component expression
  10005. @item c2
  10006. set third pixel component expression
  10007. @item c3
  10008. set fourth pixel component expression, corresponds to the alpha component
  10009. @item d
  10010. set output bit depth, only available for @code{lut2} filter. By default is 0,
  10011. which means bit depth is automatically picked from first input format.
  10012. @end table
  10013. The @code{lut2} filter also supports the @ref{framesync} options.
  10014. Each of them specifies the expression to use for computing the lookup table for
  10015. the corresponding pixel component values.
  10016. The exact component associated to each of the @var{c*} options depends on the
  10017. format in inputs.
  10018. The expressions can contain the following constants:
  10019. @table @option
  10020. @item w
  10021. @item h
  10022. The input width and height.
  10023. @item x
  10024. The first input value for the pixel component.
  10025. @item y
  10026. The second input value for the pixel component.
  10027. @item bdx
  10028. The first input video bit depth.
  10029. @item bdy
  10030. The second input video bit depth.
  10031. @end table
  10032. All expressions default to "x".
  10033. @subsection Examples
  10034. @itemize
  10035. @item
  10036. Highlight differences between two RGB video streams:
  10037. @example
  10038. 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)'
  10039. @end example
  10040. @item
  10041. Highlight differences between two YUV video streams:
  10042. @example
  10043. 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)'
  10044. @end example
  10045. @item
  10046. Show max difference between two video streams:
  10047. @example
  10048. 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)))'
  10049. @end example
  10050. @end itemize
  10051. @section maskedclamp
  10052. Clamp the first input stream with the second input and third input stream.
  10053. Returns the value of first stream to be between second input
  10054. stream - @code{undershoot} and third input stream + @code{overshoot}.
  10055. This filter accepts the following options:
  10056. @table @option
  10057. @item undershoot
  10058. Default value is @code{0}.
  10059. @item overshoot
  10060. Default value is @code{0}.
  10061. @item planes
  10062. Set which planes will be processed as bitmap, unprocessed planes will be
  10063. copied from first stream.
  10064. By default value 0xf, all planes will be processed.
  10065. @end table
  10066. @section maskedmax
  10067. Merge the second and third input stream into output stream using absolute differences
  10068. between second input stream and first input stream and absolute difference between
  10069. third input stream and first input stream. The picked value will be from second input
  10070. stream if second absolute difference is greater than first one or from third input stream
  10071. otherwise.
  10072. This filter accepts the following options:
  10073. @table @option
  10074. @item planes
  10075. Set which planes will be processed as bitmap, unprocessed planes will be
  10076. copied from first stream.
  10077. By default value 0xf, all planes will be processed.
  10078. @end table
  10079. @section maskedmerge
  10080. Merge the first input stream with the second input stream using per pixel
  10081. weights in the third input stream.
  10082. A value of 0 in the third stream pixel component means that pixel component
  10083. from first stream is returned unchanged, while maximum value (eg. 255 for
  10084. 8-bit videos) means that pixel component from second stream is returned
  10085. unchanged. Intermediate values define the amount of merging between both
  10086. input stream's pixel components.
  10087. This filter accepts the following options:
  10088. @table @option
  10089. @item planes
  10090. Set which planes will be processed as bitmap, unprocessed planes will be
  10091. copied from first stream.
  10092. By default value 0xf, all planes will be processed.
  10093. @end table
  10094. @section maskedmin
  10095. Merge the second and third input stream into output stream using absolute differences
  10096. between second input stream and first input stream and absolute difference between
  10097. third input stream and first input stream. The picked value will be from second input
  10098. stream if second absolute difference is less than first one or from third input stream
  10099. otherwise.
  10100. This filter accepts the following options:
  10101. @table @option
  10102. @item planes
  10103. Set which planes will be processed as bitmap, unprocessed planes will be
  10104. copied from first stream.
  10105. By default value 0xf, all planes will be processed.
  10106. @end table
  10107. @section maskfun
  10108. Create mask from input video.
  10109. For example it is useful to create motion masks after @code{tblend} filter.
  10110. This filter accepts the following options:
  10111. @table @option
  10112. @item low
  10113. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  10114. @item high
  10115. Set high threshold. Any pixel component higher than this value will be set to max value
  10116. allowed for current pixel format.
  10117. @item planes
  10118. Set planes to filter, by default all available planes are filtered.
  10119. @item fill
  10120. Fill all frame pixels with this value.
  10121. @item sum
  10122. Set max average pixel value for frame. If sum of all pixel components is higher that this
  10123. average, output frame will be completely filled with value set by @var{fill} option.
  10124. Typically useful for scene changes when used in combination with @code{tblend} filter.
  10125. @end table
  10126. @section mcdeint
  10127. Apply motion-compensation deinterlacing.
  10128. It needs one field per frame as input and must thus be used together
  10129. with yadif=1/3 or equivalent.
  10130. This filter accepts the following options:
  10131. @table @option
  10132. @item mode
  10133. Set the deinterlacing mode.
  10134. It accepts one of the following values:
  10135. @table @samp
  10136. @item fast
  10137. @item medium
  10138. @item slow
  10139. use iterative motion estimation
  10140. @item extra_slow
  10141. like @samp{slow}, but use multiple reference frames.
  10142. @end table
  10143. Default value is @samp{fast}.
  10144. @item parity
  10145. Set the picture field parity assumed for the input video. It must be
  10146. one of the following values:
  10147. @table @samp
  10148. @item 0, tff
  10149. assume top field first
  10150. @item 1, bff
  10151. assume bottom field first
  10152. @end table
  10153. Default value is @samp{bff}.
  10154. @item qp
  10155. Set per-block quantization parameter (QP) used by the internal
  10156. encoder.
  10157. Higher values should result in a smoother motion vector field but less
  10158. optimal individual vectors. Default value is 1.
  10159. @end table
  10160. @section median
  10161. Pick median pixel from certain rectangle defined by radius.
  10162. This filter accepts the following options:
  10163. @table @option
  10164. @item radius
  10165. Set horizontal radius size. Default value is @code{1}.
  10166. Allowed range is integer from 1 to 127.
  10167. @item planes
  10168. Set which planes to process. Default is @code{15}, which is all available planes.
  10169. @item radiusV
  10170. Set vertical radius size. Default value is @code{0}.
  10171. Allowed range is integer from 0 to 127.
  10172. If it is 0, value will be picked from horizontal @code{radius} option.
  10173. @item percentile
  10174. Set median percentile. Default value is @code{0.5}.
  10175. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  10176. minimum values, and @code{1} maximum values.
  10177. @end table
  10178. @subsection Commands
  10179. This filter supports same @ref{commands} as options.
  10180. The command accepts the same syntax of the corresponding option.
  10181. If the specified expression is not valid, it is kept at its current
  10182. value.
  10183. @section mergeplanes
  10184. Merge color channel components from several video streams.
  10185. The filter accepts up to 4 input streams, and merge selected input
  10186. planes to the output video.
  10187. This filter accepts the following options:
  10188. @table @option
  10189. @item mapping
  10190. Set input to output plane mapping. Default is @code{0}.
  10191. The mappings is specified as a bitmap. It should be specified as a
  10192. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  10193. mapping for the first plane of the output stream. 'A' sets the number of
  10194. the input stream to use (from 0 to 3), and 'a' the plane number of the
  10195. corresponding input to use (from 0 to 3). The rest of the mappings is
  10196. similar, 'Bb' describes the mapping for the output stream second
  10197. plane, 'Cc' describes the mapping for the output stream third plane and
  10198. 'Dd' describes the mapping for the output stream fourth plane.
  10199. @item format
  10200. Set output pixel format. Default is @code{yuva444p}.
  10201. @end table
  10202. @subsection Examples
  10203. @itemize
  10204. @item
  10205. Merge three gray video streams of same width and height into single video stream:
  10206. @example
  10207. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  10208. @end example
  10209. @item
  10210. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  10211. @example
  10212. [a0][a1]mergeplanes=0x00010210:yuva444p
  10213. @end example
  10214. @item
  10215. Swap Y and A plane in yuva444p stream:
  10216. @example
  10217. format=yuva444p,mergeplanes=0x03010200:yuva444p
  10218. @end example
  10219. @item
  10220. Swap U and V plane in yuv420p stream:
  10221. @example
  10222. format=yuv420p,mergeplanes=0x000201:yuv420p
  10223. @end example
  10224. @item
  10225. Cast a rgb24 clip to yuv444p:
  10226. @example
  10227. format=rgb24,mergeplanes=0x000102:yuv444p
  10228. @end example
  10229. @end itemize
  10230. @section mestimate
  10231. Estimate and export motion vectors using block matching algorithms.
  10232. Motion vectors are stored in frame side data to be used by other filters.
  10233. This filter accepts the following options:
  10234. @table @option
  10235. @item method
  10236. Specify the motion estimation method. Accepts one of the following values:
  10237. @table @samp
  10238. @item esa
  10239. Exhaustive search algorithm.
  10240. @item tss
  10241. Three step search algorithm.
  10242. @item tdls
  10243. Two dimensional logarithmic search algorithm.
  10244. @item ntss
  10245. New three step search algorithm.
  10246. @item fss
  10247. Four step search algorithm.
  10248. @item ds
  10249. Diamond search algorithm.
  10250. @item hexbs
  10251. Hexagon-based search algorithm.
  10252. @item epzs
  10253. Enhanced predictive zonal search algorithm.
  10254. @item umh
  10255. Uneven multi-hexagon search algorithm.
  10256. @end table
  10257. Default value is @samp{esa}.
  10258. @item mb_size
  10259. Macroblock size. Default @code{16}.
  10260. @item search_param
  10261. Search parameter. Default @code{7}.
  10262. @end table
  10263. @section midequalizer
  10264. Apply Midway Image Equalization effect using two video streams.
  10265. Midway Image Equalization adjusts a pair of images to have the same
  10266. histogram, while maintaining their dynamics as much as possible. It's
  10267. useful for e.g. matching exposures from a pair of stereo cameras.
  10268. This filter has two inputs and one output, which must be of same pixel format, but
  10269. may be of different sizes. The output of filter is first input adjusted with
  10270. midway histogram of both inputs.
  10271. This filter accepts the following option:
  10272. @table @option
  10273. @item planes
  10274. Set which planes to process. Default is @code{15}, which is all available planes.
  10275. @end table
  10276. @section minterpolate
  10277. Convert the video to specified frame rate using motion interpolation.
  10278. This filter accepts the following options:
  10279. @table @option
  10280. @item fps
  10281. 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}.
  10282. @item mi_mode
  10283. Motion interpolation mode. Following values are accepted:
  10284. @table @samp
  10285. @item dup
  10286. Duplicate previous or next frame for interpolating new ones.
  10287. @item blend
  10288. Blend source frames. Interpolated frame is mean of previous and next frames.
  10289. @item mci
  10290. Motion compensated interpolation. Following options are effective when this mode is selected:
  10291. @table @samp
  10292. @item mc_mode
  10293. Motion compensation mode. Following values are accepted:
  10294. @table @samp
  10295. @item obmc
  10296. Overlapped block motion compensation.
  10297. @item aobmc
  10298. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  10299. @end table
  10300. Default mode is @samp{obmc}.
  10301. @item me_mode
  10302. Motion estimation mode. Following values are accepted:
  10303. @table @samp
  10304. @item bidir
  10305. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  10306. @item bilat
  10307. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  10308. @end table
  10309. Default mode is @samp{bilat}.
  10310. @item me
  10311. The algorithm to be used for motion estimation. Following values are accepted:
  10312. @table @samp
  10313. @item esa
  10314. Exhaustive search algorithm.
  10315. @item tss
  10316. Three step search algorithm.
  10317. @item tdls
  10318. Two dimensional logarithmic search algorithm.
  10319. @item ntss
  10320. New three step search algorithm.
  10321. @item fss
  10322. Four step search algorithm.
  10323. @item ds
  10324. Diamond search algorithm.
  10325. @item hexbs
  10326. Hexagon-based search algorithm.
  10327. @item epzs
  10328. Enhanced predictive zonal search algorithm.
  10329. @item umh
  10330. Uneven multi-hexagon search algorithm.
  10331. @end table
  10332. Default algorithm is @samp{epzs}.
  10333. @item mb_size
  10334. Macroblock size. Default @code{16}.
  10335. @item search_param
  10336. Motion estimation search parameter. Default @code{32}.
  10337. @item vsbmc
  10338. 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).
  10339. @end table
  10340. @end table
  10341. @item scd
  10342. 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:
  10343. @table @samp
  10344. @item none
  10345. Disable scene change detection.
  10346. @item fdiff
  10347. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  10348. @end table
  10349. Default method is @samp{fdiff}.
  10350. @item scd_threshold
  10351. Scene change detection threshold. Default is @code{5.0}.
  10352. @end table
  10353. @section mix
  10354. Mix several video input streams into one video stream.
  10355. A description of the accepted options follows.
  10356. @table @option
  10357. @item nb_inputs
  10358. The number of inputs. If unspecified, it defaults to 2.
  10359. @item weights
  10360. Specify weight of each input video stream as sequence.
  10361. Each weight is separated by space. If number of weights
  10362. is smaller than number of @var{frames} last specified
  10363. weight will be used for all remaining unset weights.
  10364. @item scale
  10365. Specify scale, if it is set it will be multiplied with sum
  10366. of each weight multiplied with pixel values to give final destination
  10367. pixel value. By default @var{scale} is auto scaled to sum of weights.
  10368. @item duration
  10369. Specify how end of stream is determined.
  10370. @table @samp
  10371. @item longest
  10372. The duration of the longest input. (default)
  10373. @item shortest
  10374. The duration of the shortest input.
  10375. @item first
  10376. The duration of the first input.
  10377. @end table
  10378. @end table
  10379. @section mpdecimate
  10380. Drop frames that do not differ greatly from the previous frame in
  10381. order to reduce frame rate.
  10382. The main use of this filter is for very-low-bitrate encoding
  10383. (e.g. streaming over dialup modem), but it could in theory be used for
  10384. fixing movies that were inverse-telecined incorrectly.
  10385. A description of the accepted options follows.
  10386. @table @option
  10387. @item max
  10388. Set the maximum number of consecutive frames which can be dropped (if
  10389. positive), or the minimum interval between dropped frames (if
  10390. negative). If the value is 0, the frame is dropped disregarding the
  10391. number of previous sequentially dropped frames.
  10392. Default value is 0.
  10393. @item hi
  10394. @item lo
  10395. @item frac
  10396. Set the dropping threshold values.
  10397. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  10398. represent actual pixel value differences, so a threshold of 64
  10399. corresponds to 1 unit of difference for each pixel, or the same spread
  10400. out differently over the block.
  10401. A frame is a candidate for dropping if no 8x8 blocks differ by more
  10402. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  10403. meaning the whole image) differ by more than a threshold of @option{lo}.
  10404. Default value for @option{hi} is 64*12, default value for @option{lo} is
  10405. 64*5, and default value for @option{frac} is 0.33.
  10406. @end table
  10407. @section negate
  10408. Negate (invert) the input video.
  10409. It accepts the following option:
  10410. @table @option
  10411. @item negate_alpha
  10412. With value 1, it negates the alpha component, if present. Default value is 0.
  10413. @end table
  10414. @anchor{nlmeans}
  10415. @section nlmeans
  10416. Denoise frames using Non-Local Means algorithm.
  10417. Each pixel is adjusted by looking for other pixels with similar contexts. This
  10418. context similarity is defined by comparing their surrounding patches of size
  10419. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  10420. around the pixel.
  10421. Note that the research area defines centers for patches, which means some
  10422. patches will be made of pixels outside that research area.
  10423. The filter accepts the following options.
  10424. @table @option
  10425. @item s
  10426. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  10427. @item p
  10428. Set patch size. Default is 7. Must be odd number in range [0, 99].
  10429. @item pc
  10430. Same as @option{p} but for chroma planes.
  10431. The default value is @var{0} and means automatic.
  10432. @item r
  10433. Set research size. Default is 15. Must be odd number in range [0, 99].
  10434. @item rc
  10435. Same as @option{r} but for chroma planes.
  10436. The default value is @var{0} and means automatic.
  10437. @end table
  10438. @section nnedi
  10439. Deinterlace video using neural network edge directed interpolation.
  10440. This filter accepts the following options:
  10441. @table @option
  10442. @item weights
  10443. Mandatory option, without binary file filter can not work.
  10444. Currently file can be found here:
  10445. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  10446. @item deint
  10447. Set which frames to deinterlace, by default it is @code{all}.
  10448. Can be @code{all} or @code{interlaced}.
  10449. @item field
  10450. Set mode of operation.
  10451. Can be one of the following:
  10452. @table @samp
  10453. @item af
  10454. Use frame flags, both fields.
  10455. @item a
  10456. Use frame flags, single field.
  10457. @item t
  10458. Use top field only.
  10459. @item b
  10460. Use bottom field only.
  10461. @item tf
  10462. Use both fields, top first.
  10463. @item bf
  10464. Use both fields, bottom first.
  10465. @end table
  10466. @item planes
  10467. Set which planes to process, by default filter process all frames.
  10468. @item nsize
  10469. Set size of local neighborhood around each pixel, used by the predictor neural
  10470. network.
  10471. Can be one of the following:
  10472. @table @samp
  10473. @item s8x6
  10474. @item s16x6
  10475. @item s32x6
  10476. @item s48x6
  10477. @item s8x4
  10478. @item s16x4
  10479. @item s32x4
  10480. @end table
  10481. @item nns
  10482. Set the number of neurons in predictor neural network.
  10483. Can be one of the following:
  10484. @table @samp
  10485. @item n16
  10486. @item n32
  10487. @item n64
  10488. @item n128
  10489. @item n256
  10490. @end table
  10491. @item qual
  10492. Controls the number of different neural network predictions that are blended
  10493. together to compute the final output value. Can be @code{fast}, default or
  10494. @code{slow}.
  10495. @item etype
  10496. Set which set of weights to use in the predictor.
  10497. Can be one of the following:
  10498. @table @samp
  10499. @item a
  10500. weights trained to minimize absolute error
  10501. @item s
  10502. weights trained to minimize squared error
  10503. @end table
  10504. @item pscrn
  10505. Controls whether or not the prescreener neural network is used to decide
  10506. which pixels should be processed by the predictor neural network and which
  10507. can be handled by simple cubic interpolation.
  10508. The prescreener is trained to know whether cubic interpolation will be
  10509. sufficient for a pixel or whether it should be predicted by the predictor nn.
  10510. The computational complexity of the prescreener nn is much less than that of
  10511. the predictor nn. Since most pixels can be handled by cubic interpolation,
  10512. using the prescreener generally results in much faster processing.
  10513. The prescreener is pretty accurate, so the difference between using it and not
  10514. using it is almost always unnoticeable.
  10515. Can be one of the following:
  10516. @table @samp
  10517. @item none
  10518. @item original
  10519. @item new
  10520. @end table
  10521. Default is @code{new}.
  10522. @item fapprox
  10523. Set various debugging flags.
  10524. @end table
  10525. @section noformat
  10526. Force libavfilter not to use any of the specified pixel formats for the
  10527. input to the next filter.
  10528. It accepts the following parameters:
  10529. @table @option
  10530. @item pix_fmts
  10531. A '|'-separated list of pixel format names, such as
  10532. pix_fmts=yuv420p|monow|rgb24".
  10533. @end table
  10534. @subsection Examples
  10535. @itemize
  10536. @item
  10537. Force libavfilter to use a format different from @var{yuv420p} for the
  10538. input to the vflip filter:
  10539. @example
  10540. noformat=pix_fmts=yuv420p,vflip
  10541. @end example
  10542. @item
  10543. Convert the input video to any of the formats not contained in the list:
  10544. @example
  10545. noformat=yuv420p|yuv444p|yuv410p
  10546. @end example
  10547. @end itemize
  10548. @section noise
  10549. Add noise on video input frame.
  10550. The filter accepts the following options:
  10551. @table @option
  10552. @item all_seed
  10553. @item c0_seed
  10554. @item c1_seed
  10555. @item c2_seed
  10556. @item c3_seed
  10557. Set noise seed for specific pixel component or all pixel components in case
  10558. of @var{all_seed}. Default value is @code{123457}.
  10559. @item all_strength, alls
  10560. @item c0_strength, c0s
  10561. @item c1_strength, c1s
  10562. @item c2_strength, c2s
  10563. @item c3_strength, c3s
  10564. Set noise strength for specific pixel component or all pixel components in case
  10565. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  10566. @item all_flags, allf
  10567. @item c0_flags, c0f
  10568. @item c1_flags, c1f
  10569. @item c2_flags, c2f
  10570. @item c3_flags, c3f
  10571. Set pixel component flags or set flags for all components if @var{all_flags}.
  10572. Available values for component flags are:
  10573. @table @samp
  10574. @item a
  10575. averaged temporal noise (smoother)
  10576. @item p
  10577. mix random noise with a (semi)regular pattern
  10578. @item t
  10579. temporal noise (noise pattern changes between frames)
  10580. @item u
  10581. uniform noise (gaussian otherwise)
  10582. @end table
  10583. @end table
  10584. @subsection Examples
  10585. Add temporal and uniform noise to input video:
  10586. @example
  10587. noise=alls=20:allf=t+u
  10588. @end example
  10589. @section normalize
  10590. Normalize RGB video (aka histogram stretching, contrast stretching).
  10591. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  10592. For each channel of each frame, the filter computes the input range and maps
  10593. it linearly to the user-specified output range. The output range defaults
  10594. to the full dynamic range from pure black to pure white.
  10595. Temporal smoothing can be used on the input range to reduce flickering (rapid
  10596. changes in brightness) caused when small dark or bright objects enter or leave
  10597. the scene. This is similar to the auto-exposure (automatic gain control) on a
  10598. video camera, and, like a video camera, it may cause a period of over- or
  10599. under-exposure of the video.
  10600. The R,G,B channels can be normalized independently, which may cause some
  10601. color shifting, or linked together as a single channel, which prevents
  10602. color shifting. Linked normalization preserves hue. Independent normalization
  10603. does not, so it can be used to remove some color casts. Independent and linked
  10604. normalization can be combined in any ratio.
  10605. The normalize filter accepts the following options:
  10606. @table @option
  10607. @item blackpt
  10608. @item whitept
  10609. Colors which define the output range. The minimum input value is mapped to
  10610. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  10611. The defaults are black and white respectively. Specifying white for
  10612. @var{blackpt} and black for @var{whitept} will give color-inverted,
  10613. normalized video. Shades of grey can be used to reduce the dynamic range
  10614. (contrast). Specifying saturated colors here can create some interesting
  10615. effects.
  10616. @item smoothing
  10617. The number of previous frames to use for temporal smoothing. The input range
  10618. of each channel is smoothed using a rolling average over the current frame
  10619. and the @var{smoothing} previous frames. The default is 0 (no temporal
  10620. smoothing).
  10621. @item independence
  10622. Controls the ratio of independent (color shifting) channel normalization to
  10623. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  10624. independent. Defaults to 1.0 (fully independent).
  10625. @item strength
  10626. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  10627. expensive no-op. Defaults to 1.0 (full strength).
  10628. @end table
  10629. @subsection Commands
  10630. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  10631. The command accepts the same syntax of the corresponding option.
  10632. If the specified expression is not valid, it is kept at its current
  10633. value.
  10634. @subsection Examples
  10635. Stretch video contrast to use the full dynamic range, with no temporal
  10636. smoothing; may flicker depending on the source content:
  10637. @example
  10638. normalize=blackpt=black:whitept=white:smoothing=0
  10639. @end example
  10640. As above, but with 50 frames of temporal smoothing; flicker should be
  10641. reduced, depending on the source content:
  10642. @example
  10643. normalize=blackpt=black:whitept=white:smoothing=50
  10644. @end example
  10645. As above, but with hue-preserving linked channel normalization:
  10646. @example
  10647. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  10648. @end example
  10649. As above, but with half strength:
  10650. @example
  10651. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  10652. @end example
  10653. Map the darkest input color to red, the brightest input color to cyan:
  10654. @example
  10655. normalize=blackpt=red:whitept=cyan
  10656. @end example
  10657. @section null
  10658. Pass the video source unchanged to the output.
  10659. @section ocr
  10660. Optical Character Recognition
  10661. This filter uses Tesseract for optical character recognition. To enable
  10662. compilation of this filter, you need to configure FFmpeg with
  10663. @code{--enable-libtesseract}.
  10664. It accepts the following options:
  10665. @table @option
  10666. @item datapath
  10667. Set datapath to tesseract data. Default is to use whatever was
  10668. set at installation.
  10669. @item language
  10670. Set language, default is "eng".
  10671. @item whitelist
  10672. Set character whitelist.
  10673. @item blacklist
  10674. Set character blacklist.
  10675. @end table
  10676. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  10677. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  10678. @section ocv
  10679. Apply a video transform using libopencv.
  10680. To enable this filter, install the libopencv library and headers and
  10681. configure FFmpeg with @code{--enable-libopencv}.
  10682. It accepts the following parameters:
  10683. @table @option
  10684. @item filter_name
  10685. The name of the libopencv filter to apply.
  10686. @item filter_params
  10687. The parameters to pass to the libopencv filter. If not specified, the default
  10688. values are assumed.
  10689. @end table
  10690. Refer to the official libopencv documentation for more precise
  10691. information:
  10692. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  10693. Several libopencv filters are supported; see the following subsections.
  10694. @anchor{dilate}
  10695. @subsection dilate
  10696. Dilate an image by using a specific structuring element.
  10697. It corresponds to the libopencv function @code{cvDilate}.
  10698. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  10699. @var{struct_el} represents a structuring element, and has the syntax:
  10700. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  10701. @var{cols} and @var{rows} represent the number of columns and rows of
  10702. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  10703. point, and @var{shape} the shape for the structuring element. @var{shape}
  10704. must be "rect", "cross", "ellipse", or "custom".
  10705. If the value for @var{shape} is "custom", it must be followed by a
  10706. string of the form "=@var{filename}". The file with name
  10707. @var{filename} is assumed to represent a binary image, with each
  10708. printable character corresponding to a bright pixel. When a custom
  10709. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  10710. or columns and rows of the read file are assumed instead.
  10711. The default value for @var{struct_el} is "3x3+0x0/rect".
  10712. @var{nb_iterations} specifies the number of times the transform is
  10713. applied to the image, and defaults to 1.
  10714. Some examples:
  10715. @example
  10716. # Use the default values
  10717. ocv=dilate
  10718. # Dilate using a structuring element with a 5x5 cross, iterating two times
  10719. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  10720. # Read the shape from the file diamond.shape, iterating two times.
  10721. # The file diamond.shape may contain a pattern of characters like this
  10722. # *
  10723. # ***
  10724. # *****
  10725. # ***
  10726. # *
  10727. # The specified columns and rows are ignored
  10728. # but the anchor point coordinates are not
  10729. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  10730. @end example
  10731. @subsection erode
  10732. Erode an image by using a specific structuring element.
  10733. It corresponds to the libopencv function @code{cvErode}.
  10734. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  10735. with the same syntax and semantics as the @ref{dilate} filter.
  10736. @subsection smooth
  10737. Smooth the input video.
  10738. The filter takes the following parameters:
  10739. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  10740. @var{type} is the type of smooth filter to apply, and must be one of
  10741. the following values: "blur", "blur_no_scale", "median", "gaussian",
  10742. or "bilateral". The default value is "gaussian".
  10743. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  10744. depends on the smooth type. @var{param1} and
  10745. @var{param2} accept integer positive values or 0. @var{param3} and
  10746. @var{param4} accept floating point values.
  10747. The default value for @var{param1} is 3. The default value for the
  10748. other parameters is 0.
  10749. These parameters correspond to the parameters assigned to the
  10750. libopencv function @code{cvSmooth}.
  10751. @section oscilloscope
  10752. 2D Video Oscilloscope.
  10753. Useful to measure spatial impulse, step responses, chroma delays, etc.
  10754. It accepts the following parameters:
  10755. @table @option
  10756. @item x
  10757. Set scope center x position.
  10758. @item y
  10759. Set scope center y position.
  10760. @item s
  10761. Set scope size, relative to frame diagonal.
  10762. @item t
  10763. Set scope tilt/rotation.
  10764. @item o
  10765. Set trace opacity.
  10766. @item tx
  10767. Set trace center x position.
  10768. @item ty
  10769. Set trace center y position.
  10770. @item tw
  10771. Set trace width, relative to width of frame.
  10772. @item th
  10773. Set trace height, relative to height of frame.
  10774. @item c
  10775. Set which components to trace. By default it traces first three components.
  10776. @item g
  10777. Draw trace grid. By default is enabled.
  10778. @item st
  10779. Draw some statistics. By default is enabled.
  10780. @item sc
  10781. Draw scope. By default is enabled.
  10782. @end table
  10783. @subsection Commands
  10784. This filter supports same @ref{commands} as options.
  10785. The command accepts the same syntax of the corresponding option.
  10786. If the specified expression is not valid, it is kept at its current
  10787. value.
  10788. @subsection Examples
  10789. @itemize
  10790. @item
  10791. Inspect full first row of video frame.
  10792. @example
  10793. oscilloscope=x=0.5:y=0:s=1
  10794. @end example
  10795. @item
  10796. Inspect full last row of video frame.
  10797. @example
  10798. oscilloscope=x=0.5:y=1:s=1
  10799. @end example
  10800. @item
  10801. Inspect full 5th line of video frame of height 1080.
  10802. @example
  10803. oscilloscope=x=0.5:y=5/1080:s=1
  10804. @end example
  10805. @item
  10806. Inspect full last column of video frame.
  10807. @example
  10808. oscilloscope=x=1:y=0.5:s=1:t=1
  10809. @end example
  10810. @end itemize
  10811. @anchor{overlay}
  10812. @section overlay
  10813. Overlay one video on top of another.
  10814. It takes two inputs and has one output. The first input is the "main"
  10815. video on which the second input is overlaid.
  10816. It accepts the following parameters:
  10817. A description of the accepted options follows.
  10818. @table @option
  10819. @item x
  10820. @item y
  10821. Set the expression for the x and y coordinates of the overlaid video
  10822. on the main video. Default value is "0" for both expressions. In case
  10823. the expression is invalid, it is set to a huge value (meaning that the
  10824. overlay will not be displayed within the output visible area).
  10825. @item eof_action
  10826. See @ref{framesync}.
  10827. @item eval
  10828. Set when the expressions for @option{x}, and @option{y} are evaluated.
  10829. It accepts the following values:
  10830. @table @samp
  10831. @item init
  10832. only evaluate expressions once during the filter initialization or
  10833. when a command is processed
  10834. @item frame
  10835. evaluate expressions for each incoming frame
  10836. @end table
  10837. Default value is @samp{frame}.
  10838. @item shortest
  10839. See @ref{framesync}.
  10840. @item format
  10841. Set the format for the output video.
  10842. It accepts the following values:
  10843. @table @samp
  10844. @item yuv420
  10845. force YUV420 output
  10846. @item yuv422
  10847. force YUV422 output
  10848. @item yuv444
  10849. force YUV444 output
  10850. @item rgb
  10851. force packed RGB output
  10852. @item gbrp
  10853. force planar RGB output
  10854. @item auto
  10855. automatically pick format
  10856. @end table
  10857. Default value is @samp{yuv420}.
  10858. @item repeatlast
  10859. See @ref{framesync}.
  10860. @item alpha
  10861. Set format of alpha of the overlaid video, it can be @var{straight} or
  10862. @var{premultiplied}. Default is @var{straight}.
  10863. @end table
  10864. The @option{x}, and @option{y} expressions can contain the following
  10865. parameters.
  10866. @table @option
  10867. @item main_w, W
  10868. @item main_h, H
  10869. The main input width and height.
  10870. @item overlay_w, w
  10871. @item overlay_h, h
  10872. The overlay input width and height.
  10873. @item x
  10874. @item y
  10875. The computed values for @var{x} and @var{y}. They are evaluated for
  10876. each new frame.
  10877. @item hsub
  10878. @item vsub
  10879. horizontal and vertical chroma subsample values of the output
  10880. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  10881. @var{vsub} is 1.
  10882. @item n
  10883. the number of input frame, starting from 0
  10884. @item pos
  10885. the position in the file of the input frame, NAN if unknown
  10886. @item t
  10887. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  10888. @end table
  10889. This filter also supports the @ref{framesync} options.
  10890. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  10891. when evaluation is done @emph{per frame}, and will evaluate to NAN
  10892. when @option{eval} is set to @samp{init}.
  10893. Be aware that frames are taken from each input video in timestamp
  10894. order, hence, if their initial timestamps differ, it is a good idea
  10895. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  10896. have them begin in the same zero timestamp, as the example for
  10897. the @var{movie} filter does.
  10898. You can chain together more overlays but you should test the
  10899. efficiency of such approach.
  10900. @subsection Commands
  10901. This filter supports the following commands:
  10902. @table @option
  10903. @item x
  10904. @item y
  10905. Modify the x and y of the overlay input.
  10906. The command accepts the same syntax of the corresponding option.
  10907. If the specified expression is not valid, it is kept at its current
  10908. value.
  10909. @end table
  10910. @subsection Examples
  10911. @itemize
  10912. @item
  10913. Draw the overlay at 10 pixels from the bottom right corner of the main
  10914. video:
  10915. @example
  10916. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  10917. @end example
  10918. Using named options the example above becomes:
  10919. @example
  10920. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  10921. @end example
  10922. @item
  10923. Insert a transparent PNG logo in the bottom left corner of the input,
  10924. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  10925. @example
  10926. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  10927. @end example
  10928. @item
  10929. Insert 2 different transparent PNG logos (second logo on bottom
  10930. right corner) using the @command{ffmpeg} tool:
  10931. @example
  10932. 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
  10933. @end example
  10934. @item
  10935. Add a transparent color layer on top of the main video; @code{WxH}
  10936. must specify the size of the main input to the overlay filter:
  10937. @example
  10938. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  10939. @end example
  10940. @item
  10941. Play an original video and a filtered version (here with the deshake
  10942. filter) side by side using the @command{ffplay} tool:
  10943. @example
  10944. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  10945. @end example
  10946. The above command is the same as:
  10947. @example
  10948. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  10949. @end example
  10950. @item
  10951. Make a sliding overlay appearing from the left to the right top part of the
  10952. screen starting since time 2:
  10953. @example
  10954. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  10955. @end example
  10956. @item
  10957. Compose output by putting two input videos side to side:
  10958. @example
  10959. ffmpeg -i left.avi -i right.avi -filter_complex "
  10960. nullsrc=size=200x100 [background];
  10961. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  10962. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  10963. [background][left] overlay=shortest=1 [background+left];
  10964. [background+left][right] overlay=shortest=1:x=100 [left+right]
  10965. "
  10966. @end example
  10967. @item
  10968. Mask 10-20 seconds of a video by applying the delogo filter to a section
  10969. @example
  10970. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  10971. -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]'
  10972. masked.avi
  10973. @end example
  10974. @item
  10975. Chain several overlays in cascade:
  10976. @example
  10977. nullsrc=s=200x200 [bg];
  10978. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  10979. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  10980. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  10981. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  10982. [in3] null, [mid2] overlay=100:100 [out0]
  10983. @end example
  10984. @end itemize
  10985. @anchor{overlay_cuda}
  10986. @section overlay_cuda
  10987. Overlay one video on top of another.
  10988. This is the CUDA cariant of the @ref{overlay} filter.
  10989. It only accepts CUDA frames. The underlying input pixel formats have to match.
  10990. It takes two inputs and has one output. The first input is the "main"
  10991. video on which the second input is overlaid.
  10992. It accepts the following parameters:
  10993. @table @option
  10994. @item x
  10995. @item y
  10996. Set the x and y coordinates of the overlaid video on the main video.
  10997. Default value is "0" for both expressions.
  10998. @item eof_action
  10999. See @ref{framesync}.
  11000. @item shortest
  11001. See @ref{framesync}.
  11002. @item repeatlast
  11003. See @ref{framesync}.
  11004. @end table
  11005. This filter also supports the @ref{framesync} options.
  11006. @section owdenoise
  11007. Apply Overcomplete Wavelet denoiser.
  11008. The filter accepts the following options:
  11009. @table @option
  11010. @item depth
  11011. Set depth.
  11012. Larger depth values will denoise lower frequency components more, but
  11013. slow down filtering.
  11014. Must be an int in the range 8-16, default is @code{8}.
  11015. @item luma_strength, ls
  11016. Set luma strength.
  11017. Must be a double value in the range 0-1000, default is @code{1.0}.
  11018. @item chroma_strength, cs
  11019. Set chroma strength.
  11020. Must be a double value in the range 0-1000, default is @code{1.0}.
  11021. @end table
  11022. @anchor{pad}
  11023. @section pad
  11024. Add paddings to the input image, and place the original input at the
  11025. provided @var{x}, @var{y} coordinates.
  11026. It accepts the following parameters:
  11027. @table @option
  11028. @item width, w
  11029. @item height, h
  11030. Specify an expression for the size of the output image with the
  11031. paddings added. If the value for @var{width} or @var{height} is 0, the
  11032. corresponding input size is used for the output.
  11033. The @var{width} expression can reference the value set by the
  11034. @var{height} expression, and vice versa.
  11035. The default value of @var{width} and @var{height} is 0.
  11036. @item x
  11037. @item y
  11038. Specify the offsets to place the input image at within the padded area,
  11039. with respect to the top/left border of the output image.
  11040. The @var{x} expression can reference the value set by the @var{y}
  11041. expression, and vice versa.
  11042. The default value of @var{x} and @var{y} is 0.
  11043. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  11044. so the input image is centered on the padded area.
  11045. @item color
  11046. Specify the color of the padded area. For the syntax of this option,
  11047. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11048. manual,ffmpeg-utils}.
  11049. The default value of @var{color} is "black".
  11050. @item eval
  11051. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  11052. It accepts the following values:
  11053. @table @samp
  11054. @item init
  11055. Only evaluate expressions once during the filter initialization or when
  11056. a command is processed.
  11057. @item frame
  11058. Evaluate expressions for each incoming frame.
  11059. @end table
  11060. Default value is @samp{init}.
  11061. @item aspect
  11062. Pad to aspect instead to a resolution.
  11063. @end table
  11064. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  11065. options are expressions containing the following constants:
  11066. @table @option
  11067. @item in_w
  11068. @item in_h
  11069. The input video width and height.
  11070. @item iw
  11071. @item ih
  11072. These are the same as @var{in_w} and @var{in_h}.
  11073. @item out_w
  11074. @item out_h
  11075. The output width and height (the size of the padded area), as
  11076. specified by the @var{width} and @var{height} expressions.
  11077. @item ow
  11078. @item oh
  11079. These are the same as @var{out_w} and @var{out_h}.
  11080. @item x
  11081. @item y
  11082. The x and y offsets as specified by the @var{x} and @var{y}
  11083. expressions, or NAN if not yet specified.
  11084. @item a
  11085. same as @var{iw} / @var{ih}
  11086. @item sar
  11087. input sample aspect ratio
  11088. @item dar
  11089. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  11090. @item hsub
  11091. @item vsub
  11092. The horizontal and vertical chroma subsample values. For example for the
  11093. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11094. @end table
  11095. @subsection Examples
  11096. @itemize
  11097. @item
  11098. Add paddings with the color "violet" to the input video. The output video
  11099. size is 640x480, and the top-left corner of the input video is placed at
  11100. column 0, row 40
  11101. @example
  11102. pad=640:480:0:40:violet
  11103. @end example
  11104. The example above is equivalent to the following command:
  11105. @example
  11106. pad=width=640:height=480:x=0:y=40:color=violet
  11107. @end example
  11108. @item
  11109. Pad the input to get an output with dimensions increased by 3/2,
  11110. and put the input video at the center of the padded area:
  11111. @example
  11112. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  11113. @end example
  11114. @item
  11115. Pad the input to get a squared output with size equal to the maximum
  11116. value between the input width and height, and put the input video at
  11117. the center of the padded area:
  11118. @example
  11119. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  11120. @end example
  11121. @item
  11122. Pad the input to get a final w/h ratio of 16:9:
  11123. @example
  11124. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  11125. @end example
  11126. @item
  11127. In case of anamorphic video, in order to set the output display aspect
  11128. correctly, it is necessary to use @var{sar} in the expression,
  11129. according to the relation:
  11130. @example
  11131. (ih * X / ih) * sar = output_dar
  11132. X = output_dar / sar
  11133. @end example
  11134. Thus the previous example needs to be modified to:
  11135. @example
  11136. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  11137. @end example
  11138. @item
  11139. Double the output size and put the input video in the bottom-right
  11140. corner of the output padded area:
  11141. @example
  11142. pad="2*iw:2*ih:ow-iw:oh-ih"
  11143. @end example
  11144. @end itemize
  11145. @anchor{palettegen}
  11146. @section palettegen
  11147. Generate one palette for a whole video stream.
  11148. It accepts the following options:
  11149. @table @option
  11150. @item max_colors
  11151. Set the maximum number of colors to quantize in the palette.
  11152. Note: the palette will still contain 256 colors; the unused palette entries
  11153. will be black.
  11154. @item reserve_transparent
  11155. Create a palette of 255 colors maximum and reserve the last one for
  11156. transparency. Reserving the transparency color is useful for GIF optimization.
  11157. If not set, the maximum of colors in the palette will be 256. You probably want
  11158. to disable this option for a standalone image.
  11159. Set by default.
  11160. @item transparency_color
  11161. Set the color that will be used as background for transparency.
  11162. @item stats_mode
  11163. Set statistics mode.
  11164. It accepts the following values:
  11165. @table @samp
  11166. @item full
  11167. Compute full frame histograms.
  11168. @item diff
  11169. Compute histograms only for the part that differs from previous frame. This
  11170. might be relevant to give more importance to the moving part of your input if
  11171. the background is static.
  11172. @item single
  11173. Compute new histogram for each frame.
  11174. @end table
  11175. Default value is @var{full}.
  11176. @end table
  11177. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  11178. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  11179. color quantization of the palette. This information is also visible at
  11180. @var{info} logging level.
  11181. @subsection Examples
  11182. @itemize
  11183. @item
  11184. Generate a representative palette of a given video using @command{ffmpeg}:
  11185. @example
  11186. ffmpeg -i input.mkv -vf palettegen palette.png
  11187. @end example
  11188. @end itemize
  11189. @section paletteuse
  11190. Use a palette to downsample an input video stream.
  11191. The filter takes two inputs: one video stream and a palette. The palette must
  11192. be a 256 pixels image.
  11193. It accepts the following options:
  11194. @table @option
  11195. @item dither
  11196. Select dithering mode. Available algorithms are:
  11197. @table @samp
  11198. @item bayer
  11199. Ordered 8x8 bayer dithering (deterministic)
  11200. @item heckbert
  11201. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  11202. Note: this dithering is sometimes considered "wrong" and is included as a
  11203. reference.
  11204. @item floyd_steinberg
  11205. Floyd and Steingberg dithering (error diffusion)
  11206. @item sierra2
  11207. Frankie Sierra dithering v2 (error diffusion)
  11208. @item sierra2_4a
  11209. Frankie Sierra dithering v2 "Lite" (error diffusion)
  11210. @end table
  11211. Default is @var{sierra2_4a}.
  11212. @item bayer_scale
  11213. When @var{bayer} dithering is selected, this option defines the scale of the
  11214. pattern (how much the crosshatch pattern is visible). A low value means more
  11215. visible pattern for less banding, and higher value means less visible pattern
  11216. at the cost of more banding.
  11217. The option must be an integer value in the range [0,5]. Default is @var{2}.
  11218. @item diff_mode
  11219. If set, define the zone to process
  11220. @table @samp
  11221. @item rectangle
  11222. Only the changing rectangle will be reprocessed. This is similar to GIF
  11223. cropping/offsetting compression mechanism. This option can be useful for speed
  11224. if only a part of the image is changing, and has use cases such as limiting the
  11225. scope of the error diffusal @option{dither} to the rectangle that bounds the
  11226. moving scene (it leads to more deterministic output if the scene doesn't change
  11227. much, and as a result less moving noise and better GIF compression).
  11228. @end table
  11229. Default is @var{none}.
  11230. @item new
  11231. Take new palette for each output frame.
  11232. @item alpha_threshold
  11233. Sets the alpha threshold for transparency. Alpha values above this threshold
  11234. will be treated as completely opaque, and values below this threshold will be
  11235. treated as completely transparent.
  11236. The option must be an integer value in the range [0,255]. Default is @var{128}.
  11237. @end table
  11238. @subsection Examples
  11239. @itemize
  11240. @item
  11241. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  11242. using @command{ffmpeg}:
  11243. @example
  11244. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  11245. @end example
  11246. @end itemize
  11247. @section perspective
  11248. Correct perspective of video not recorded perpendicular to the screen.
  11249. A description of the accepted parameters follows.
  11250. @table @option
  11251. @item x0
  11252. @item y0
  11253. @item x1
  11254. @item y1
  11255. @item x2
  11256. @item y2
  11257. @item x3
  11258. @item y3
  11259. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  11260. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  11261. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  11262. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  11263. then the corners of the source will be sent to the specified coordinates.
  11264. The expressions can use the following variables:
  11265. @table @option
  11266. @item W
  11267. @item H
  11268. the width and height of video frame.
  11269. @item in
  11270. Input frame count.
  11271. @item on
  11272. Output frame count.
  11273. @end table
  11274. @item interpolation
  11275. Set interpolation for perspective correction.
  11276. It accepts the following values:
  11277. @table @samp
  11278. @item linear
  11279. @item cubic
  11280. @end table
  11281. Default value is @samp{linear}.
  11282. @item sense
  11283. Set interpretation of coordinate options.
  11284. It accepts the following values:
  11285. @table @samp
  11286. @item 0, source
  11287. Send point in the source specified by the given coordinates to
  11288. the corners of the destination.
  11289. @item 1, destination
  11290. Send the corners of the source to the point in the destination specified
  11291. by the given coordinates.
  11292. Default value is @samp{source}.
  11293. @end table
  11294. @item eval
  11295. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  11296. It accepts the following values:
  11297. @table @samp
  11298. @item init
  11299. only evaluate expressions once during the filter initialization or
  11300. when a command is processed
  11301. @item frame
  11302. evaluate expressions for each incoming frame
  11303. @end table
  11304. Default value is @samp{init}.
  11305. @end table
  11306. @section phase
  11307. Delay interlaced video by one field time so that the field order changes.
  11308. The intended use is to fix PAL movies that have been captured with the
  11309. opposite field order to the film-to-video transfer.
  11310. A description of the accepted parameters follows.
  11311. @table @option
  11312. @item mode
  11313. Set phase mode.
  11314. It accepts the following values:
  11315. @table @samp
  11316. @item t
  11317. Capture field order top-first, transfer bottom-first.
  11318. Filter will delay the bottom field.
  11319. @item b
  11320. Capture field order bottom-first, transfer top-first.
  11321. Filter will delay the top field.
  11322. @item p
  11323. Capture and transfer with the same field order. This mode only exists
  11324. for the documentation of the other options to refer to, but if you
  11325. actually select it, the filter will faithfully do nothing.
  11326. @item a
  11327. Capture field order determined automatically by field flags, transfer
  11328. opposite.
  11329. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  11330. basis using field flags. If no field information is available,
  11331. then this works just like @samp{u}.
  11332. @item u
  11333. Capture unknown or varying, transfer opposite.
  11334. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  11335. analyzing the images and selecting the alternative that produces best
  11336. match between the fields.
  11337. @item T
  11338. Capture top-first, transfer unknown or varying.
  11339. Filter selects among @samp{t} and @samp{p} using image analysis.
  11340. @item B
  11341. Capture bottom-first, transfer unknown or varying.
  11342. Filter selects among @samp{b} and @samp{p} using image analysis.
  11343. @item A
  11344. Capture determined by field flags, transfer unknown or varying.
  11345. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  11346. image analysis. If no field information is available, then this works just
  11347. like @samp{U}. This is the default mode.
  11348. @item U
  11349. Both capture and transfer unknown or varying.
  11350. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  11351. @end table
  11352. @end table
  11353. @section photosensitivity
  11354. Reduce various flashes in video, so to help users with epilepsy.
  11355. It accepts the following options:
  11356. @table @option
  11357. @item frames, f
  11358. Set how many frames to use when filtering. Default is 30.
  11359. @item threshold, t
  11360. Set detection threshold factor. Default is 1.
  11361. Lower is stricter.
  11362. @item skip
  11363. Set how many pixels to skip when sampling frames. Default is 1.
  11364. Allowed range is from 1 to 1024.
  11365. @item bypass
  11366. Leave frames unchanged. Default is disabled.
  11367. @end table
  11368. @section pixdesctest
  11369. Pixel format descriptor test filter, mainly useful for internal
  11370. testing. The output video should be equal to the input video.
  11371. For example:
  11372. @example
  11373. format=monow, pixdesctest
  11374. @end example
  11375. can be used to test the monowhite pixel format descriptor definition.
  11376. @section pixscope
  11377. Display sample values of color channels. Mainly useful for checking color
  11378. and levels. Minimum supported resolution is 640x480.
  11379. The filters accept the following options:
  11380. @table @option
  11381. @item x
  11382. Set scope X position, relative offset on X axis.
  11383. @item y
  11384. Set scope Y position, relative offset on Y axis.
  11385. @item w
  11386. Set scope width.
  11387. @item h
  11388. Set scope height.
  11389. @item o
  11390. Set window opacity. This window also holds statistics about pixel area.
  11391. @item wx
  11392. Set window X position, relative offset on X axis.
  11393. @item wy
  11394. Set window Y position, relative offset on Y axis.
  11395. @end table
  11396. @section pp
  11397. Enable the specified chain of postprocessing subfilters using libpostproc. This
  11398. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  11399. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  11400. Each subfilter and some options have a short and a long name that can be used
  11401. interchangeably, i.e. dr/dering are the same.
  11402. The filters accept the following options:
  11403. @table @option
  11404. @item subfilters
  11405. Set postprocessing subfilters string.
  11406. @end table
  11407. All subfilters share common options to determine their scope:
  11408. @table @option
  11409. @item a/autoq
  11410. Honor the quality commands for this subfilter.
  11411. @item c/chrom
  11412. Do chrominance filtering, too (default).
  11413. @item y/nochrom
  11414. Do luminance filtering only (no chrominance).
  11415. @item n/noluma
  11416. Do chrominance filtering only (no luminance).
  11417. @end table
  11418. These options can be appended after the subfilter name, separated by a '|'.
  11419. Available subfilters are:
  11420. @table @option
  11421. @item hb/hdeblock[|difference[|flatness]]
  11422. Horizontal deblocking filter
  11423. @table @option
  11424. @item difference
  11425. Difference factor where higher values mean more deblocking (default: @code{32}).
  11426. @item flatness
  11427. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11428. @end table
  11429. @item vb/vdeblock[|difference[|flatness]]
  11430. Vertical deblocking filter
  11431. @table @option
  11432. @item difference
  11433. Difference factor where higher values mean more deblocking (default: @code{32}).
  11434. @item flatness
  11435. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11436. @end table
  11437. @item ha/hadeblock[|difference[|flatness]]
  11438. Accurate horizontal deblocking filter
  11439. @table @option
  11440. @item difference
  11441. Difference factor where higher values mean more deblocking (default: @code{32}).
  11442. @item flatness
  11443. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11444. @end table
  11445. @item va/vadeblock[|difference[|flatness]]
  11446. Accurate vertical deblocking filter
  11447. @table @option
  11448. @item difference
  11449. Difference factor where higher values mean more deblocking (default: @code{32}).
  11450. @item flatness
  11451. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11452. @end table
  11453. @end table
  11454. The horizontal and vertical deblocking filters share the difference and
  11455. flatness values so you cannot set different horizontal and vertical
  11456. thresholds.
  11457. @table @option
  11458. @item h1/x1hdeblock
  11459. Experimental horizontal deblocking filter
  11460. @item v1/x1vdeblock
  11461. Experimental vertical deblocking filter
  11462. @item dr/dering
  11463. Deringing filter
  11464. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  11465. @table @option
  11466. @item threshold1
  11467. larger -> stronger filtering
  11468. @item threshold2
  11469. larger -> stronger filtering
  11470. @item threshold3
  11471. larger -> stronger filtering
  11472. @end table
  11473. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  11474. @table @option
  11475. @item f/fullyrange
  11476. Stretch luminance to @code{0-255}.
  11477. @end table
  11478. @item lb/linblenddeint
  11479. Linear blend deinterlacing filter that deinterlaces the given block by
  11480. filtering all lines with a @code{(1 2 1)} filter.
  11481. @item li/linipoldeint
  11482. Linear interpolating deinterlacing filter that deinterlaces the given block by
  11483. linearly interpolating every second line.
  11484. @item ci/cubicipoldeint
  11485. Cubic interpolating deinterlacing filter deinterlaces the given block by
  11486. cubically interpolating every second line.
  11487. @item md/mediandeint
  11488. Median deinterlacing filter that deinterlaces the given block by applying a
  11489. median filter to every second line.
  11490. @item fd/ffmpegdeint
  11491. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  11492. second line with a @code{(-1 4 2 4 -1)} filter.
  11493. @item l5/lowpass5
  11494. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  11495. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  11496. @item fq/forceQuant[|quantizer]
  11497. Overrides the quantizer table from the input with the constant quantizer you
  11498. specify.
  11499. @table @option
  11500. @item quantizer
  11501. Quantizer to use
  11502. @end table
  11503. @item de/default
  11504. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  11505. @item fa/fast
  11506. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  11507. @item ac
  11508. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  11509. @end table
  11510. @subsection Examples
  11511. @itemize
  11512. @item
  11513. Apply horizontal and vertical deblocking, deringing and automatic
  11514. brightness/contrast:
  11515. @example
  11516. pp=hb/vb/dr/al
  11517. @end example
  11518. @item
  11519. Apply default filters without brightness/contrast correction:
  11520. @example
  11521. pp=de/-al
  11522. @end example
  11523. @item
  11524. Apply default filters and temporal denoiser:
  11525. @example
  11526. pp=default/tmpnoise|1|2|3
  11527. @end example
  11528. @item
  11529. Apply deblocking on luminance only, and switch vertical deblocking on or off
  11530. automatically depending on available CPU time:
  11531. @example
  11532. pp=hb|y/vb|a
  11533. @end example
  11534. @end itemize
  11535. @section pp7
  11536. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  11537. similar to spp = 6 with 7 point DCT, where only the center sample is
  11538. used after IDCT.
  11539. The filter accepts the following options:
  11540. @table @option
  11541. @item qp
  11542. Force a constant quantization parameter. It accepts an integer in range
  11543. 0 to 63. If not set, the filter will use the QP from the video stream
  11544. (if available).
  11545. @item mode
  11546. Set thresholding mode. Available modes are:
  11547. @table @samp
  11548. @item hard
  11549. Set hard thresholding.
  11550. @item soft
  11551. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11552. @item medium
  11553. Set medium thresholding (good results, default).
  11554. @end table
  11555. @end table
  11556. @section premultiply
  11557. Apply alpha premultiply effect to input video stream using first plane
  11558. of second stream as alpha.
  11559. Both streams must have same dimensions and same pixel format.
  11560. The filter accepts the following option:
  11561. @table @option
  11562. @item planes
  11563. Set which planes will be processed, unprocessed planes will be copied.
  11564. By default value 0xf, all planes will be processed.
  11565. @item inplace
  11566. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11567. @end table
  11568. @section prewitt
  11569. Apply prewitt operator to input video stream.
  11570. The filter accepts the following option:
  11571. @table @option
  11572. @item planes
  11573. Set which planes will be processed, unprocessed planes will be copied.
  11574. By default value 0xf, all planes will be processed.
  11575. @item scale
  11576. Set value which will be multiplied with filtered result.
  11577. @item delta
  11578. Set value which will be added to filtered result.
  11579. @end table
  11580. @section pseudocolor
  11581. Alter frame colors in video with pseudocolors.
  11582. This filter accepts the following options:
  11583. @table @option
  11584. @item c0
  11585. set pixel first component expression
  11586. @item c1
  11587. set pixel second component expression
  11588. @item c2
  11589. set pixel third component expression
  11590. @item c3
  11591. set pixel fourth component expression, corresponds to the alpha component
  11592. @item i
  11593. set component to use as base for altering colors
  11594. @end table
  11595. Each of them specifies the expression to use for computing the lookup table for
  11596. the corresponding pixel component values.
  11597. The expressions can contain the following constants and functions:
  11598. @table @option
  11599. @item w
  11600. @item h
  11601. The input width and height.
  11602. @item val
  11603. The input value for the pixel component.
  11604. @item ymin, umin, vmin, amin
  11605. The minimum allowed component value.
  11606. @item ymax, umax, vmax, amax
  11607. The maximum allowed component value.
  11608. @end table
  11609. All expressions default to "val".
  11610. @subsection Examples
  11611. @itemize
  11612. @item
  11613. Change too high luma values to gradient:
  11614. @example
  11615. 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'"
  11616. @end example
  11617. @end itemize
  11618. @section psnr
  11619. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  11620. Ratio) between two input videos.
  11621. This filter takes in input two input videos, the first input is
  11622. considered the "main" source and is passed unchanged to the
  11623. output. The second input is used as a "reference" video for computing
  11624. the PSNR.
  11625. Both video inputs must have the same resolution and pixel format for
  11626. this filter to work correctly. Also it assumes that both inputs
  11627. have the same number of frames, which are compared one by one.
  11628. The obtained average PSNR is printed through the logging system.
  11629. The filter stores the accumulated MSE (mean squared error) of each
  11630. frame, and at the end of the processing it is averaged across all frames
  11631. equally, and the following formula is applied to obtain the PSNR:
  11632. @example
  11633. PSNR = 10*log10(MAX^2/MSE)
  11634. @end example
  11635. Where MAX is the average of the maximum values of each component of the
  11636. image.
  11637. The description of the accepted parameters follows.
  11638. @table @option
  11639. @item stats_file, f
  11640. If specified the filter will use the named file to save the PSNR of
  11641. each individual frame. When filename equals "-" the data is sent to
  11642. standard output.
  11643. @item stats_version
  11644. Specifies which version of the stats file format to use. Details of
  11645. each format are written below.
  11646. Default value is 1.
  11647. @item stats_add_max
  11648. Determines whether the max value is output to the stats log.
  11649. Default value is 0.
  11650. Requires stats_version >= 2. If this is set and stats_version < 2,
  11651. the filter will return an error.
  11652. @end table
  11653. This filter also supports the @ref{framesync} options.
  11654. The file printed if @var{stats_file} is selected, contains a sequence of
  11655. key/value pairs of the form @var{key}:@var{value} for each compared
  11656. couple of frames.
  11657. If a @var{stats_version} greater than 1 is specified, a header line precedes
  11658. the list of per-frame-pair stats, with key value pairs following the frame
  11659. format with the following parameters:
  11660. @table @option
  11661. @item psnr_log_version
  11662. The version of the log file format. Will match @var{stats_version}.
  11663. @item fields
  11664. A comma separated list of the per-frame-pair parameters included in
  11665. the log.
  11666. @end table
  11667. A description of each shown per-frame-pair parameter follows:
  11668. @table @option
  11669. @item n
  11670. sequential number of the input frame, starting from 1
  11671. @item mse_avg
  11672. Mean Square Error pixel-by-pixel average difference of the compared
  11673. frames, averaged over all the image components.
  11674. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  11675. Mean Square Error pixel-by-pixel average difference of the compared
  11676. frames for the component specified by the suffix.
  11677. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  11678. Peak Signal to Noise ratio of the compared frames for the component
  11679. specified by the suffix.
  11680. @item max_avg, max_y, max_u, max_v
  11681. Maximum allowed value for each channel, and average over all
  11682. channels.
  11683. @end table
  11684. @subsection Examples
  11685. @itemize
  11686. @item
  11687. For example:
  11688. @example
  11689. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11690. [main][ref] psnr="stats_file=stats.log" [out]
  11691. @end example
  11692. On this example the input file being processed is compared with the
  11693. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  11694. is stored in @file{stats.log}.
  11695. @item
  11696. Another example with different containers:
  11697. @example
  11698. ffmpeg -i main.mpg -i ref.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[main][ref]psnr" -f null -
  11699. @end example
  11700. @end itemize
  11701. @anchor{pullup}
  11702. @section pullup
  11703. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  11704. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  11705. content.
  11706. The pullup filter is designed to take advantage of future context in making
  11707. its decisions. This filter is stateless in the sense that it does not lock
  11708. onto a pattern to follow, but it instead looks forward to the following
  11709. fields in order to identify matches and rebuild progressive frames.
  11710. To produce content with an even framerate, insert the fps filter after
  11711. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  11712. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  11713. The filter accepts the following options:
  11714. @table @option
  11715. @item jl
  11716. @item jr
  11717. @item jt
  11718. @item jb
  11719. These options set the amount of "junk" to ignore at the left, right, top, and
  11720. bottom of the image, respectively. Left and right are in units of 8 pixels,
  11721. while top and bottom are in units of 2 lines.
  11722. The default is 8 pixels on each side.
  11723. @item sb
  11724. Set the strict breaks. Setting this option to 1 will reduce the chances of
  11725. filter generating an occasional mismatched frame, but it may also cause an
  11726. excessive number of frames to be dropped during high motion sequences.
  11727. Conversely, setting it to -1 will make filter match fields more easily.
  11728. This may help processing of video where there is slight blurring between
  11729. the fields, but may also cause there to be interlaced frames in the output.
  11730. Default value is @code{0}.
  11731. @item mp
  11732. Set the metric plane to use. It accepts the following values:
  11733. @table @samp
  11734. @item l
  11735. Use luma plane.
  11736. @item u
  11737. Use chroma blue plane.
  11738. @item v
  11739. Use chroma red plane.
  11740. @end table
  11741. This option may be set to use chroma plane instead of the default luma plane
  11742. for doing filter's computations. This may improve accuracy on very clean
  11743. source material, but more likely will decrease accuracy, especially if there
  11744. is chroma noise (rainbow effect) or any grayscale video.
  11745. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  11746. load and make pullup usable in realtime on slow machines.
  11747. @end table
  11748. For best results (without duplicated frames in the output file) it is
  11749. necessary to change the output frame rate. For example, to inverse
  11750. telecine NTSC input:
  11751. @example
  11752. ffmpeg -i input -vf pullup -r 24000/1001 ...
  11753. @end example
  11754. @section qp
  11755. Change video quantization parameters (QP).
  11756. The filter accepts the following option:
  11757. @table @option
  11758. @item qp
  11759. Set expression for quantization parameter.
  11760. @end table
  11761. The expression is evaluated through the eval API and can contain, among others,
  11762. the following constants:
  11763. @table @var
  11764. @item known
  11765. 1 if index is not 129, 0 otherwise.
  11766. @item qp
  11767. Sequential index starting from -129 to 128.
  11768. @end table
  11769. @subsection Examples
  11770. @itemize
  11771. @item
  11772. Some equation like:
  11773. @example
  11774. qp=2+2*sin(PI*qp)
  11775. @end example
  11776. @end itemize
  11777. @section random
  11778. Flush video frames from internal cache of frames into a random order.
  11779. No frame is discarded.
  11780. Inspired by @ref{frei0r} nervous filter.
  11781. @table @option
  11782. @item frames
  11783. Set size in number of frames of internal cache, in range from @code{2} to
  11784. @code{512}. Default is @code{30}.
  11785. @item seed
  11786. Set seed for random number generator, must be an integer included between
  11787. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11788. less than @code{0}, the filter will try to use a good random seed on a
  11789. best effort basis.
  11790. @end table
  11791. @section readeia608
  11792. Read closed captioning (EIA-608) information from the top lines of a video frame.
  11793. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  11794. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  11795. with EIA-608 data (starting from 0). A description of each metadata value follows:
  11796. @table @option
  11797. @item lavfi.readeia608.X.cc
  11798. The two bytes stored as EIA-608 data (printed in hexadecimal).
  11799. @item lavfi.readeia608.X.line
  11800. The number of the line on which the EIA-608 data was identified and read.
  11801. @end table
  11802. This filter accepts the following options:
  11803. @table @option
  11804. @item scan_min
  11805. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  11806. @item scan_max
  11807. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  11808. @item spw
  11809. Set the ratio of width reserved for sync code detection.
  11810. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  11811. @item chp
  11812. Enable checking the parity bit. In the event of a parity error, the filter will output
  11813. @code{0x00} for that character. Default is false.
  11814. @item lp
  11815. Lowpass lines prior to further processing. Default is enabled.
  11816. @end table
  11817. @subsection Examples
  11818. @itemize
  11819. @item
  11820. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  11821. @example
  11822. 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
  11823. @end example
  11824. @end itemize
  11825. @section readvitc
  11826. Read vertical interval timecode (VITC) information from the top lines of a
  11827. video frame.
  11828. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  11829. timecode value, if a valid timecode has been detected. Further metadata key
  11830. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  11831. timecode data has been found or not.
  11832. This filter accepts the following options:
  11833. @table @option
  11834. @item scan_max
  11835. Set the maximum number of lines to scan for VITC data. If the value is set to
  11836. @code{-1} the full video frame is scanned. Default is @code{45}.
  11837. @item thr_b
  11838. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  11839. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  11840. @item thr_w
  11841. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  11842. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  11843. @end table
  11844. @subsection Examples
  11845. @itemize
  11846. @item
  11847. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  11848. draw @code{--:--:--:--} as a placeholder:
  11849. @example
  11850. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  11851. @end example
  11852. @end itemize
  11853. @section remap
  11854. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  11855. Destination pixel at position (X, Y) will be picked from source (x, y) position
  11856. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  11857. value for pixel will be used for destination pixel.
  11858. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  11859. will have Xmap/Ymap video stream dimensions.
  11860. Xmap and Ymap input video streams are 16bit depth, single channel.
  11861. @table @option
  11862. @item format
  11863. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  11864. Default is @code{color}.
  11865. @item fill
  11866. Specify the color of the unmapped pixels. For the syntax of this option,
  11867. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11868. manual,ffmpeg-utils}. Default color is @code{black}.
  11869. @end table
  11870. @section removegrain
  11871. The removegrain filter is a spatial denoiser for progressive video.
  11872. @table @option
  11873. @item m0
  11874. Set mode for the first plane.
  11875. @item m1
  11876. Set mode for the second plane.
  11877. @item m2
  11878. Set mode for the third plane.
  11879. @item m3
  11880. Set mode for the fourth plane.
  11881. @end table
  11882. Range of mode is from 0 to 24. Description of each mode follows:
  11883. @table @var
  11884. @item 0
  11885. Leave input plane unchanged. Default.
  11886. @item 1
  11887. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  11888. @item 2
  11889. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  11890. @item 3
  11891. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  11892. @item 4
  11893. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  11894. This is equivalent to a median filter.
  11895. @item 5
  11896. Line-sensitive clipping giving the minimal change.
  11897. @item 6
  11898. Line-sensitive clipping, intermediate.
  11899. @item 7
  11900. Line-sensitive clipping, intermediate.
  11901. @item 8
  11902. Line-sensitive clipping, intermediate.
  11903. @item 9
  11904. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  11905. @item 10
  11906. Replaces the target pixel with the closest neighbour.
  11907. @item 11
  11908. [1 2 1] horizontal and vertical kernel blur.
  11909. @item 12
  11910. Same as mode 11.
  11911. @item 13
  11912. Bob mode, interpolates top field from the line where the neighbours
  11913. pixels are the closest.
  11914. @item 14
  11915. Bob mode, interpolates bottom field from the line where the neighbours
  11916. pixels are the closest.
  11917. @item 15
  11918. Bob mode, interpolates top field. Same as 13 but with a more complicated
  11919. interpolation formula.
  11920. @item 16
  11921. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  11922. interpolation formula.
  11923. @item 17
  11924. Clips the pixel with the minimum and maximum of respectively the maximum and
  11925. minimum of each pair of opposite neighbour pixels.
  11926. @item 18
  11927. Line-sensitive clipping using opposite neighbours whose greatest distance from
  11928. the current pixel is minimal.
  11929. @item 19
  11930. Replaces the pixel with the average of its 8 neighbours.
  11931. @item 20
  11932. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  11933. @item 21
  11934. Clips pixels using the averages of opposite neighbour.
  11935. @item 22
  11936. Same as mode 21 but simpler and faster.
  11937. @item 23
  11938. Small edge and halo removal, but reputed useless.
  11939. @item 24
  11940. Similar as 23.
  11941. @end table
  11942. @section removelogo
  11943. Suppress a TV station logo, using an image file to determine which
  11944. pixels comprise the logo. It works by filling in the pixels that
  11945. comprise the logo with neighboring pixels.
  11946. The filter accepts the following options:
  11947. @table @option
  11948. @item filename, f
  11949. Set the filter bitmap file, which can be any image format supported by
  11950. libavformat. The width and height of the image file must match those of the
  11951. video stream being processed.
  11952. @end table
  11953. Pixels in the provided bitmap image with a value of zero are not
  11954. considered part of the logo, non-zero pixels are considered part of
  11955. the logo. If you use white (255) for the logo and black (0) for the
  11956. rest, you will be safe. For making the filter bitmap, it is
  11957. recommended to take a screen capture of a black frame with the logo
  11958. visible, and then using a threshold filter followed by the erode
  11959. filter once or twice.
  11960. If needed, little splotches can be fixed manually. Remember that if
  11961. logo pixels are not covered, the filter quality will be much
  11962. reduced. Marking too many pixels as part of the logo does not hurt as
  11963. much, but it will increase the amount of blurring needed to cover over
  11964. the image and will destroy more information than necessary, and extra
  11965. pixels will slow things down on a large logo.
  11966. @section repeatfields
  11967. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  11968. fields based on its value.
  11969. @section reverse
  11970. Reverse a video clip.
  11971. Warning: This filter requires memory to buffer the entire clip, so trimming
  11972. is suggested.
  11973. @subsection Examples
  11974. @itemize
  11975. @item
  11976. Take the first 5 seconds of a clip, and reverse it.
  11977. @example
  11978. trim=end=5,reverse
  11979. @end example
  11980. @end itemize
  11981. @section rgbashift
  11982. Shift R/G/B/A pixels horizontally and/or vertically.
  11983. The filter accepts the following options:
  11984. @table @option
  11985. @item rh
  11986. Set amount to shift red horizontally.
  11987. @item rv
  11988. Set amount to shift red vertically.
  11989. @item gh
  11990. Set amount to shift green horizontally.
  11991. @item gv
  11992. Set amount to shift green vertically.
  11993. @item bh
  11994. Set amount to shift blue horizontally.
  11995. @item bv
  11996. Set amount to shift blue vertically.
  11997. @item ah
  11998. Set amount to shift alpha horizontally.
  11999. @item av
  12000. Set amount to shift alpha vertically.
  12001. @item edge
  12002. Set edge mode, can be @var{smear}, default, or @var{warp}.
  12003. @end table
  12004. @subsection Commands
  12005. This filter supports the all above options as @ref{commands}.
  12006. @section roberts
  12007. Apply roberts cross operator to input video stream.
  12008. The filter accepts the following option:
  12009. @table @option
  12010. @item planes
  12011. Set which planes will be processed, unprocessed planes will be copied.
  12012. By default value 0xf, all planes will be processed.
  12013. @item scale
  12014. Set value which will be multiplied with filtered result.
  12015. @item delta
  12016. Set value which will be added to filtered result.
  12017. @end table
  12018. @section rotate
  12019. Rotate video by an arbitrary angle expressed in radians.
  12020. The filter accepts the following options:
  12021. A description of the optional parameters follows.
  12022. @table @option
  12023. @item angle, a
  12024. Set an expression for the angle by which to rotate the input video
  12025. clockwise, expressed as a number of radians. A negative value will
  12026. result in a counter-clockwise rotation. By default it is set to "0".
  12027. This expression is evaluated for each frame.
  12028. @item out_w, ow
  12029. Set the output width expression, default value is "iw".
  12030. This expression is evaluated just once during configuration.
  12031. @item out_h, oh
  12032. Set the output height expression, default value is "ih".
  12033. This expression is evaluated just once during configuration.
  12034. @item bilinear
  12035. Enable bilinear interpolation if set to 1, a value of 0 disables
  12036. it. Default value is 1.
  12037. @item fillcolor, c
  12038. Set the color used to fill the output area not covered by the rotated
  12039. image. For the general syntax of this option, check the
  12040. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12041. If the special value "none" is selected then no
  12042. background is printed (useful for example if the background is never shown).
  12043. Default value is "black".
  12044. @end table
  12045. The expressions for the angle and the output size can contain the
  12046. following constants and functions:
  12047. @table @option
  12048. @item n
  12049. sequential number of the input frame, starting from 0. It is always NAN
  12050. before the first frame is filtered.
  12051. @item t
  12052. time in seconds of the input frame, it is set to 0 when the filter is
  12053. configured. It is always NAN before the first frame is filtered.
  12054. @item hsub
  12055. @item vsub
  12056. horizontal and vertical chroma subsample values. For example for the
  12057. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12058. @item in_w, iw
  12059. @item in_h, ih
  12060. the input video width and height
  12061. @item out_w, ow
  12062. @item out_h, oh
  12063. the output width and height, that is the size of the padded area as
  12064. specified by the @var{width} and @var{height} expressions
  12065. @item rotw(a)
  12066. @item roth(a)
  12067. the minimal width/height required for completely containing the input
  12068. video rotated by @var{a} radians.
  12069. These are only available when computing the @option{out_w} and
  12070. @option{out_h} expressions.
  12071. @end table
  12072. @subsection Examples
  12073. @itemize
  12074. @item
  12075. Rotate the input by PI/6 radians clockwise:
  12076. @example
  12077. rotate=PI/6
  12078. @end example
  12079. @item
  12080. Rotate the input by PI/6 radians counter-clockwise:
  12081. @example
  12082. rotate=-PI/6
  12083. @end example
  12084. @item
  12085. Rotate the input by 45 degrees clockwise:
  12086. @example
  12087. rotate=45*PI/180
  12088. @end example
  12089. @item
  12090. Apply a constant rotation with period T, starting from an angle of PI/3:
  12091. @example
  12092. rotate=PI/3+2*PI*t/T
  12093. @end example
  12094. @item
  12095. Make the input video rotation oscillating with a period of T
  12096. seconds and an amplitude of A radians:
  12097. @example
  12098. rotate=A*sin(2*PI/T*t)
  12099. @end example
  12100. @item
  12101. Rotate the video, output size is chosen so that the whole rotating
  12102. input video is always completely contained in the output:
  12103. @example
  12104. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  12105. @end example
  12106. @item
  12107. Rotate the video, reduce the output size so that no background is ever
  12108. shown:
  12109. @example
  12110. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  12111. @end example
  12112. @end itemize
  12113. @subsection Commands
  12114. The filter supports the following commands:
  12115. @table @option
  12116. @item a, angle
  12117. Set the angle expression.
  12118. The command accepts the same syntax of the corresponding option.
  12119. If the specified expression is not valid, it is kept at its current
  12120. value.
  12121. @end table
  12122. @section sab
  12123. Apply Shape Adaptive Blur.
  12124. The filter accepts the following options:
  12125. @table @option
  12126. @item luma_radius, lr
  12127. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  12128. value is 1.0. A greater value will result in a more blurred image, and
  12129. in slower processing.
  12130. @item luma_pre_filter_radius, lpfr
  12131. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  12132. value is 1.0.
  12133. @item luma_strength, ls
  12134. Set luma maximum difference between pixels to still be considered, must
  12135. be a value in the 0.1-100.0 range, default value is 1.0.
  12136. @item chroma_radius, cr
  12137. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  12138. greater value will result in a more blurred image, and in slower
  12139. processing.
  12140. @item chroma_pre_filter_radius, cpfr
  12141. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  12142. @item chroma_strength, cs
  12143. Set chroma maximum difference between pixels to still be considered,
  12144. must be a value in the -0.9-100.0 range.
  12145. @end table
  12146. Each chroma option value, if not explicitly specified, is set to the
  12147. corresponding luma option value.
  12148. @anchor{scale}
  12149. @section scale
  12150. Scale (resize) the input video, using the libswscale library.
  12151. The scale filter forces the output display aspect ratio to be the same
  12152. of the input, by changing the output sample aspect ratio.
  12153. If the input image format is different from the format requested by
  12154. the next filter, the scale filter will convert the input to the
  12155. requested format.
  12156. @subsection Options
  12157. The filter accepts the following options, or any of the options
  12158. supported by the libswscale scaler.
  12159. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  12160. the complete list of scaler options.
  12161. @table @option
  12162. @item width, w
  12163. @item height, h
  12164. Set the output video dimension expression. Default value is the input
  12165. dimension.
  12166. If the @var{width} or @var{w} value is 0, the input width is used for
  12167. the output. If the @var{height} or @var{h} value is 0, the input height
  12168. is used for the output.
  12169. If one and only one of the values is -n with n >= 1, the scale filter
  12170. will use a value that maintains the aspect ratio of the input image,
  12171. calculated from the other specified dimension. After that it will,
  12172. however, make sure that the calculated dimension is divisible by n and
  12173. adjust the value if necessary.
  12174. If both values are -n with n >= 1, the behavior will be identical to
  12175. both values being set to 0 as previously detailed.
  12176. See below for the list of accepted constants for use in the dimension
  12177. expression.
  12178. @item eval
  12179. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  12180. @table @samp
  12181. @item init
  12182. Only evaluate expressions once during the filter initialization or when a command is processed.
  12183. @item frame
  12184. Evaluate expressions for each incoming frame.
  12185. @end table
  12186. Default value is @samp{init}.
  12187. @item interl
  12188. Set the interlacing mode. It accepts the following values:
  12189. @table @samp
  12190. @item 1
  12191. Force interlaced aware scaling.
  12192. @item 0
  12193. Do not apply interlaced scaling.
  12194. @item -1
  12195. Select interlaced aware scaling depending on whether the source frames
  12196. are flagged as interlaced or not.
  12197. @end table
  12198. Default value is @samp{0}.
  12199. @item flags
  12200. Set libswscale scaling flags. See
  12201. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12202. complete list of values. If not explicitly specified the filter applies
  12203. the default flags.
  12204. @item param0, param1
  12205. Set libswscale input parameters for scaling algorithms that need them. See
  12206. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12207. complete documentation. If not explicitly specified the filter applies
  12208. empty parameters.
  12209. @item size, s
  12210. Set the video size. For the syntax of this option, check the
  12211. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12212. @item in_color_matrix
  12213. @item out_color_matrix
  12214. Set in/output YCbCr color space type.
  12215. This allows the autodetected value to be overridden as well as allows forcing
  12216. a specific value used for the output and encoder.
  12217. If not specified, the color space type depends on the pixel format.
  12218. Possible values:
  12219. @table @samp
  12220. @item auto
  12221. Choose automatically.
  12222. @item bt709
  12223. Format conforming to International Telecommunication Union (ITU)
  12224. Recommendation BT.709.
  12225. @item fcc
  12226. Set color space conforming to the United States Federal Communications
  12227. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  12228. @item bt601
  12229. @item bt470
  12230. @item smpte170m
  12231. Set color space conforming to:
  12232. @itemize
  12233. @item
  12234. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  12235. @item
  12236. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  12237. @item
  12238. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  12239. @end itemize
  12240. @item smpte240m
  12241. Set color space conforming to SMPTE ST 240:1999.
  12242. @item bt2020
  12243. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  12244. @end table
  12245. @item in_range
  12246. @item out_range
  12247. Set in/output YCbCr sample range.
  12248. This allows the autodetected value to be overridden as well as allows forcing
  12249. a specific value used for the output and encoder. If not specified, the
  12250. range depends on the pixel format. Possible values:
  12251. @table @samp
  12252. @item auto/unknown
  12253. Choose automatically.
  12254. @item jpeg/full/pc
  12255. Set full range (0-255 in case of 8-bit luma).
  12256. @item mpeg/limited/tv
  12257. Set "MPEG" range (16-235 in case of 8-bit luma).
  12258. @end table
  12259. @item force_original_aspect_ratio
  12260. Enable decreasing or increasing output video width or height if necessary to
  12261. keep the original aspect ratio. Possible values:
  12262. @table @samp
  12263. @item disable
  12264. Scale the video as specified and disable this feature.
  12265. @item decrease
  12266. The output video dimensions will automatically be decreased if needed.
  12267. @item increase
  12268. The output video dimensions will automatically be increased if needed.
  12269. @end table
  12270. One useful instance of this option is that when you know a specific device's
  12271. maximum allowed resolution, you can use this to limit the output video to
  12272. that, while retaining the aspect ratio. For example, device A allows
  12273. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12274. decrease) and specifying 1280x720 to the command line makes the output
  12275. 1280x533.
  12276. Please note that this is a different thing than specifying -1 for @option{w}
  12277. or @option{h}, you still need to specify the output resolution for this option
  12278. to work.
  12279. @item force_divisible_by
  12280. Ensures that both the output dimensions, width and height, are divisible by the
  12281. given integer when used together with @option{force_original_aspect_ratio}. This
  12282. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12283. This option respects the value set for @option{force_original_aspect_ratio},
  12284. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12285. may be slightly modified.
  12286. This option can be handy if you need to have a video fit within or exceed
  12287. a defined resolution using @option{force_original_aspect_ratio} but also have
  12288. encoder restrictions on width or height divisibility.
  12289. @end table
  12290. The values of the @option{w} and @option{h} options are expressions
  12291. containing the following constants:
  12292. @table @var
  12293. @item in_w
  12294. @item in_h
  12295. The input width and height
  12296. @item iw
  12297. @item ih
  12298. These are the same as @var{in_w} and @var{in_h}.
  12299. @item out_w
  12300. @item out_h
  12301. The output (scaled) width and height
  12302. @item ow
  12303. @item oh
  12304. These are the same as @var{out_w} and @var{out_h}
  12305. @item a
  12306. The same as @var{iw} / @var{ih}
  12307. @item sar
  12308. input sample aspect ratio
  12309. @item dar
  12310. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12311. @item hsub
  12312. @item vsub
  12313. horizontal and vertical input chroma subsample values. For example for the
  12314. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12315. @item ohsub
  12316. @item ovsub
  12317. horizontal and vertical output chroma subsample values. For example for the
  12318. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12319. @item n
  12320. The (sequential) number of the input frame, starting from 0.
  12321. Only available with @code{eval=frame}.
  12322. @item t
  12323. The presentation timestamp of the input frame, expressed as a number of
  12324. seconds. Only available with @code{eval=frame}.
  12325. @item pos
  12326. The position (byte offset) of the frame in the input stream, or NaN if
  12327. this information is unavailable and/or meaningless (for example in case of synthetic video).
  12328. Only available with @code{eval=frame}.
  12329. @end table
  12330. @subsection Examples
  12331. @itemize
  12332. @item
  12333. Scale the input video to a size of 200x100
  12334. @example
  12335. scale=w=200:h=100
  12336. @end example
  12337. This is equivalent to:
  12338. @example
  12339. scale=200:100
  12340. @end example
  12341. or:
  12342. @example
  12343. scale=200x100
  12344. @end example
  12345. @item
  12346. Specify a size abbreviation for the output size:
  12347. @example
  12348. scale=qcif
  12349. @end example
  12350. which can also be written as:
  12351. @example
  12352. scale=size=qcif
  12353. @end example
  12354. @item
  12355. Scale the input to 2x:
  12356. @example
  12357. scale=w=2*iw:h=2*ih
  12358. @end example
  12359. @item
  12360. The above is the same as:
  12361. @example
  12362. scale=2*in_w:2*in_h
  12363. @end example
  12364. @item
  12365. Scale the input to 2x with forced interlaced scaling:
  12366. @example
  12367. scale=2*iw:2*ih:interl=1
  12368. @end example
  12369. @item
  12370. Scale the input to half size:
  12371. @example
  12372. scale=w=iw/2:h=ih/2
  12373. @end example
  12374. @item
  12375. Increase the width, and set the height to the same size:
  12376. @example
  12377. scale=3/2*iw:ow
  12378. @end example
  12379. @item
  12380. Seek Greek harmony:
  12381. @example
  12382. scale=iw:1/PHI*iw
  12383. scale=ih*PHI:ih
  12384. @end example
  12385. @item
  12386. Increase the height, and set the width to 3/2 of the height:
  12387. @example
  12388. scale=w=3/2*oh:h=3/5*ih
  12389. @end example
  12390. @item
  12391. Increase the size, making the size a multiple of the chroma
  12392. subsample values:
  12393. @example
  12394. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  12395. @end example
  12396. @item
  12397. Increase the width to a maximum of 500 pixels,
  12398. keeping the same aspect ratio as the input:
  12399. @example
  12400. scale=w='min(500\, iw*3/2):h=-1'
  12401. @end example
  12402. @item
  12403. Make pixels square by combining scale and setsar:
  12404. @example
  12405. scale='trunc(ih*dar):ih',setsar=1/1
  12406. @end example
  12407. @item
  12408. Make pixels square by combining scale and setsar,
  12409. making sure the resulting resolution is even (required by some codecs):
  12410. @example
  12411. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  12412. @end example
  12413. @end itemize
  12414. @subsection Commands
  12415. This filter supports the following commands:
  12416. @table @option
  12417. @item width, w
  12418. @item height, h
  12419. Set the output video dimension expression.
  12420. The command accepts the same syntax of the corresponding option.
  12421. If the specified expression is not valid, it is kept at its current
  12422. value.
  12423. @end table
  12424. @section scale_npp
  12425. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  12426. format conversion on CUDA video frames. Setting the output width and height
  12427. works in the same way as for the @var{scale} filter.
  12428. The following additional options are accepted:
  12429. @table @option
  12430. @item format
  12431. The pixel format of the output CUDA frames. If set to the string "same" (the
  12432. default), the input format will be kept. Note that automatic format negotiation
  12433. and conversion is not yet supported for hardware frames
  12434. @item interp_algo
  12435. The interpolation algorithm used for resizing. One of the following:
  12436. @table @option
  12437. @item nn
  12438. Nearest neighbour.
  12439. @item linear
  12440. @item cubic
  12441. @item cubic2p_bspline
  12442. 2-parameter cubic (B=1, C=0)
  12443. @item cubic2p_catmullrom
  12444. 2-parameter cubic (B=0, C=1/2)
  12445. @item cubic2p_b05c03
  12446. 2-parameter cubic (B=1/2, C=3/10)
  12447. @item super
  12448. Supersampling
  12449. @item lanczos
  12450. @end table
  12451. @item force_original_aspect_ratio
  12452. Enable decreasing or increasing output video width or height if necessary to
  12453. keep the original aspect ratio. Possible values:
  12454. @table @samp
  12455. @item disable
  12456. Scale the video as specified and disable this feature.
  12457. @item decrease
  12458. The output video dimensions will automatically be decreased if needed.
  12459. @item increase
  12460. The output video dimensions will automatically be increased if needed.
  12461. @end table
  12462. One useful instance of this option is that when you know a specific device's
  12463. maximum allowed resolution, you can use this to limit the output video to
  12464. that, while retaining the aspect ratio. For example, device A allows
  12465. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12466. decrease) and specifying 1280x720 to the command line makes the output
  12467. 1280x533.
  12468. Please note that this is a different thing than specifying -1 for @option{w}
  12469. or @option{h}, you still need to specify the output resolution for this option
  12470. to work.
  12471. @item force_divisible_by
  12472. Ensures that both the output dimensions, width and height, are divisible by the
  12473. given integer when used together with @option{force_original_aspect_ratio}. This
  12474. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12475. This option respects the value set for @option{force_original_aspect_ratio},
  12476. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12477. may be slightly modified.
  12478. This option can be handy if you need to have a video fit within or exceed
  12479. a defined resolution using @option{force_original_aspect_ratio} but also have
  12480. encoder restrictions on width or height divisibility.
  12481. @end table
  12482. @section scale2ref
  12483. Scale (resize) the input video, based on a reference video.
  12484. See the scale filter for available options, scale2ref supports the same but
  12485. uses the reference video instead of the main input as basis. scale2ref also
  12486. supports the following additional constants for the @option{w} and
  12487. @option{h} options:
  12488. @table @var
  12489. @item main_w
  12490. @item main_h
  12491. The main input video's width and height
  12492. @item main_a
  12493. The same as @var{main_w} / @var{main_h}
  12494. @item main_sar
  12495. The main input video's sample aspect ratio
  12496. @item main_dar, mdar
  12497. The main input video's display aspect ratio. Calculated from
  12498. @code{(main_w / main_h) * main_sar}.
  12499. @item main_hsub
  12500. @item main_vsub
  12501. The main input video's horizontal and vertical chroma subsample values.
  12502. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  12503. is 1.
  12504. @item main_n
  12505. The (sequential) number of the main input frame, starting from 0.
  12506. Only available with @code{eval=frame}.
  12507. @item main_t
  12508. The presentation timestamp of the main input frame, expressed as a number of
  12509. seconds. Only available with @code{eval=frame}.
  12510. @item main_pos
  12511. The position (byte offset) of the frame in the main input stream, or NaN if
  12512. this information is unavailable and/or meaningless (for example in case of synthetic video).
  12513. Only available with @code{eval=frame}.
  12514. @end table
  12515. @subsection Examples
  12516. @itemize
  12517. @item
  12518. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  12519. @example
  12520. 'scale2ref[b][a];[a][b]overlay'
  12521. @end example
  12522. @item
  12523. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  12524. @example
  12525. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  12526. @end example
  12527. @end itemize
  12528. @subsection Commands
  12529. This filter supports the following commands:
  12530. @table @option
  12531. @item width, w
  12532. @item height, h
  12533. Set the output video dimension expression.
  12534. The command accepts the same syntax of the corresponding option.
  12535. If the specified expression is not valid, it is kept at its current
  12536. value.
  12537. @end table
  12538. @section scroll
  12539. Scroll input video horizontally and/or vertically by constant speed.
  12540. The filter accepts the following options:
  12541. @table @option
  12542. @item horizontal, h
  12543. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12544. Negative values changes scrolling direction.
  12545. @item vertical, v
  12546. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12547. Negative values changes scrolling direction.
  12548. @item hpos
  12549. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  12550. @item vpos
  12551. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  12552. @end table
  12553. @subsection Commands
  12554. This filter supports the following @ref{commands}:
  12555. @table @option
  12556. @item horizontal, h
  12557. Set the horizontal scrolling speed.
  12558. @item vertical, v
  12559. Set the vertical scrolling speed.
  12560. @end table
  12561. @anchor{selectivecolor}
  12562. @section selectivecolor
  12563. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  12564. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  12565. by the "purity" of the color (that is, how saturated it already is).
  12566. This filter is similar to the Adobe Photoshop Selective Color tool.
  12567. The filter accepts the following options:
  12568. @table @option
  12569. @item correction_method
  12570. Select color correction method.
  12571. Available values are:
  12572. @table @samp
  12573. @item absolute
  12574. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  12575. component value).
  12576. @item relative
  12577. Specified adjustments are relative to the original component value.
  12578. @end table
  12579. Default is @code{absolute}.
  12580. @item reds
  12581. Adjustments for red pixels (pixels where the red component is the maximum)
  12582. @item yellows
  12583. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  12584. @item greens
  12585. Adjustments for green pixels (pixels where the green component is the maximum)
  12586. @item cyans
  12587. Adjustments for cyan pixels (pixels where the red component is the minimum)
  12588. @item blues
  12589. Adjustments for blue pixels (pixels where the blue component is the maximum)
  12590. @item magentas
  12591. Adjustments for magenta pixels (pixels where the green component is the minimum)
  12592. @item whites
  12593. Adjustments for white pixels (pixels where all components are greater than 128)
  12594. @item neutrals
  12595. Adjustments for all pixels except pure black and pure white
  12596. @item blacks
  12597. Adjustments for black pixels (pixels where all components are lesser than 128)
  12598. @item psfile
  12599. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  12600. @end table
  12601. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  12602. 4 space separated floating point adjustment values in the [-1,1] range,
  12603. respectively to adjust the amount of cyan, magenta, yellow and black for the
  12604. pixels of its range.
  12605. @subsection Examples
  12606. @itemize
  12607. @item
  12608. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  12609. increase magenta by 27% in blue areas:
  12610. @example
  12611. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  12612. @end example
  12613. @item
  12614. Use a Photoshop selective color preset:
  12615. @example
  12616. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  12617. @end example
  12618. @end itemize
  12619. @anchor{separatefields}
  12620. @section separatefields
  12621. The @code{separatefields} takes a frame-based video input and splits
  12622. each frame into its components fields, producing a new half height clip
  12623. with twice the frame rate and twice the frame count.
  12624. This filter use field-dominance information in frame to decide which
  12625. of each pair of fields to place first in the output.
  12626. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  12627. @section setdar, setsar
  12628. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  12629. output video.
  12630. This is done by changing the specified Sample (aka Pixel) Aspect
  12631. Ratio, according to the following equation:
  12632. @example
  12633. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  12634. @end example
  12635. Keep in mind that the @code{setdar} filter does not modify the pixel
  12636. dimensions of the video frame. Also, the display aspect ratio set by
  12637. this filter may be changed by later filters in the filterchain,
  12638. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  12639. applied.
  12640. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  12641. the filter output video.
  12642. Note that as a consequence of the application of this filter, the
  12643. output display aspect ratio will change according to the equation
  12644. above.
  12645. Keep in mind that the sample aspect ratio set by the @code{setsar}
  12646. filter may be changed by later filters in the filterchain, e.g. if
  12647. another "setsar" or a "setdar" filter is applied.
  12648. It accepts the following parameters:
  12649. @table @option
  12650. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  12651. Set the aspect ratio used by the filter.
  12652. The parameter can be a floating point number string, an expression, or
  12653. a string of the form @var{num}:@var{den}, where @var{num} and
  12654. @var{den} are the numerator and denominator of the aspect ratio. If
  12655. the parameter is not specified, it is assumed the value "0".
  12656. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  12657. should be escaped.
  12658. @item max
  12659. Set the maximum integer value to use for expressing numerator and
  12660. denominator when reducing the expressed aspect ratio to a rational.
  12661. Default value is @code{100}.
  12662. @end table
  12663. The parameter @var{sar} is an expression containing
  12664. the following constants:
  12665. @table @option
  12666. @item E, PI, PHI
  12667. These are approximated values for the mathematical constants e
  12668. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  12669. @item w, h
  12670. The input width and height.
  12671. @item a
  12672. These are the same as @var{w} / @var{h}.
  12673. @item sar
  12674. The input sample aspect ratio.
  12675. @item dar
  12676. The input display aspect ratio. It is the same as
  12677. (@var{w} / @var{h}) * @var{sar}.
  12678. @item hsub, vsub
  12679. Horizontal and vertical chroma subsample values. For example, for the
  12680. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12681. @end table
  12682. @subsection Examples
  12683. @itemize
  12684. @item
  12685. To change the display aspect ratio to 16:9, specify one of the following:
  12686. @example
  12687. setdar=dar=1.77777
  12688. setdar=dar=16/9
  12689. @end example
  12690. @item
  12691. To change the sample aspect ratio to 10:11, specify:
  12692. @example
  12693. setsar=sar=10/11
  12694. @end example
  12695. @item
  12696. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  12697. 1000 in the aspect ratio reduction, use the command:
  12698. @example
  12699. setdar=ratio=16/9:max=1000
  12700. @end example
  12701. @end itemize
  12702. @anchor{setfield}
  12703. @section setfield
  12704. Force field for the output video frame.
  12705. The @code{setfield} filter marks the interlace type field for the
  12706. output frames. It does not change the input frame, but only sets the
  12707. corresponding property, which affects how the frame is treated by
  12708. following filters (e.g. @code{fieldorder} or @code{yadif}).
  12709. The filter accepts the following options:
  12710. @table @option
  12711. @item mode
  12712. Available values are:
  12713. @table @samp
  12714. @item auto
  12715. Keep the same field property.
  12716. @item bff
  12717. Mark the frame as bottom-field-first.
  12718. @item tff
  12719. Mark the frame as top-field-first.
  12720. @item prog
  12721. Mark the frame as progressive.
  12722. @end table
  12723. @end table
  12724. @anchor{setparams}
  12725. @section setparams
  12726. Force frame parameter for the output video frame.
  12727. The @code{setparams} filter marks interlace and color range for the
  12728. output frames. It does not change the input frame, but only sets the
  12729. corresponding property, which affects how the frame is treated by
  12730. filters/encoders.
  12731. @table @option
  12732. @item field_mode
  12733. Available values are:
  12734. @table @samp
  12735. @item auto
  12736. Keep the same field property (default).
  12737. @item bff
  12738. Mark the frame as bottom-field-first.
  12739. @item tff
  12740. Mark the frame as top-field-first.
  12741. @item prog
  12742. Mark the frame as progressive.
  12743. @end table
  12744. @item range
  12745. Available values are:
  12746. @table @samp
  12747. @item auto
  12748. Keep the same color range property (default).
  12749. @item unspecified, unknown
  12750. Mark the frame as unspecified color range.
  12751. @item limited, tv, mpeg
  12752. Mark the frame as limited range.
  12753. @item full, pc, jpeg
  12754. Mark the frame as full range.
  12755. @end table
  12756. @item color_primaries
  12757. Set the color primaries.
  12758. Available values are:
  12759. @table @samp
  12760. @item auto
  12761. Keep the same color primaries property (default).
  12762. @item bt709
  12763. @item unknown
  12764. @item bt470m
  12765. @item bt470bg
  12766. @item smpte170m
  12767. @item smpte240m
  12768. @item film
  12769. @item bt2020
  12770. @item smpte428
  12771. @item smpte431
  12772. @item smpte432
  12773. @item jedec-p22
  12774. @end table
  12775. @item color_trc
  12776. Set the color transfer.
  12777. Available values are:
  12778. @table @samp
  12779. @item auto
  12780. Keep the same color trc property (default).
  12781. @item bt709
  12782. @item unknown
  12783. @item bt470m
  12784. @item bt470bg
  12785. @item smpte170m
  12786. @item smpte240m
  12787. @item linear
  12788. @item log100
  12789. @item log316
  12790. @item iec61966-2-4
  12791. @item bt1361e
  12792. @item iec61966-2-1
  12793. @item bt2020-10
  12794. @item bt2020-12
  12795. @item smpte2084
  12796. @item smpte428
  12797. @item arib-std-b67
  12798. @end table
  12799. @item colorspace
  12800. Set the colorspace.
  12801. Available values are:
  12802. @table @samp
  12803. @item auto
  12804. Keep the same colorspace property (default).
  12805. @item gbr
  12806. @item bt709
  12807. @item unknown
  12808. @item fcc
  12809. @item bt470bg
  12810. @item smpte170m
  12811. @item smpte240m
  12812. @item ycgco
  12813. @item bt2020nc
  12814. @item bt2020c
  12815. @item smpte2085
  12816. @item chroma-derived-nc
  12817. @item chroma-derived-c
  12818. @item ictcp
  12819. @end table
  12820. @end table
  12821. @section showinfo
  12822. Show a line containing various information for each input video frame.
  12823. The input video is not modified.
  12824. This filter supports the following options:
  12825. @table @option
  12826. @item checksum
  12827. Calculate checksums of each plane. By default enabled.
  12828. @end table
  12829. The shown line contains a sequence of key/value pairs of the form
  12830. @var{key}:@var{value}.
  12831. The following values are shown in the output:
  12832. @table @option
  12833. @item n
  12834. The (sequential) number of the input frame, starting from 0.
  12835. @item pts
  12836. The Presentation TimeStamp of the input frame, expressed as a number of
  12837. time base units. The time base unit depends on the filter input pad.
  12838. @item pts_time
  12839. The Presentation TimeStamp of the input frame, expressed as a number of
  12840. seconds.
  12841. @item pos
  12842. The position of the frame in the input stream, or -1 if this information is
  12843. unavailable and/or meaningless (for example in case of synthetic video).
  12844. @item fmt
  12845. The pixel format name.
  12846. @item sar
  12847. The sample aspect ratio of the input frame, expressed in the form
  12848. @var{num}/@var{den}.
  12849. @item s
  12850. The size of the input frame. For the syntax of this option, check the
  12851. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12852. @item i
  12853. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  12854. for bottom field first).
  12855. @item iskey
  12856. This is 1 if the frame is a key frame, 0 otherwise.
  12857. @item type
  12858. The picture type of the input frame ("I" for an I-frame, "P" for a
  12859. P-frame, "B" for a B-frame, or "?" for an unknown type).
  12860. Also refer to the documentation of the @code{AVPictureType} enum and of
  12861. the @code{av_get_picture_type_char} function defined in
  12862. @file{libavutil/avutil.h}.
  12863. @item checksum
  12864. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  12865. @item plane_checksum
  12866. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  12867. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  12868. @item mean
  12869. The mean value of pixels in each plane of the input frame, expressed in the form
  12870. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  12871. @item stdev
  12872. The standard deviation of pixel values in each plane of the input frame, expressed
  12873. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  12874. @end table
  12875. @section showpalette
  12876. Displays the 256 colors palette of each frame. This filter is only relevant for
  12877. @var{pal8} pixel format frames.
  12878. It accepts the following option:
  12879. @table @option
  12880. @item s
  12881. Set the size of the box used to represent one palette color entry. Default is
  12882. @code{30} (for a @code{30x30} pixel box).
  12883. @end table
  12884. @section shuffleframes
  12885. Reorder and/or duplicate and/or drop video frames.
  12886. It accepts the following parameters:
  12887. @table @option
  12888. @item mapping
  12889. Set the destination indexes of input frames.
  12890. This is space or '|' separated list of indexes that maps input frames to output
  12891. frames. Number of indexes also sets maximal value that each index may have.
  12892. '-1' index have special meaning and that is to drop frame.
  12893. @end table
  12894. The first frame has the index 0. The default is to keep the input unchanged.
  12895. @subsection Examples
  12896. @itemize
  12897. @item
  12898. Swap second and third frame of every three frames of the input:
  12899. @example
  12900. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  12901. @end example
  12902. @item
  12903. Swap 10th and 1st frame of every ten frames of the input:
  12904. @example
  12905. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  12906. @end example
  12907. @end itemize
  12908. @section shuffleplanes
  12909. Reorder and/or duplicate video planes.
  12910. It accepts the following parameters:
  12911. @table @option
  12912. @item map0
  12913. The index of the input plane to be used as the first output plane.
  12914. @item map1
  12915. The index of the input plane to be used as the second output plane.
  12916. @item map2
  12917. The index of the input plane to be used as the third output plane.
  12918. @item map3
  12919. The index of the input plane to be used as the fourth output plane.
  12920. @end table
  12921. The first plane has the index 0. The default is to keep the input unchanged.
  12922. @subsection Examples
  12923. @itemize
  12924. @item
  12925. Swap the second and third planes of the input:
  12926. @example
  12927. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  12928. @end example
  12929. @end itemize
  12930. @anchor{signalstats}
  12931. @section signalstats
  12932. Evaluate various visual metrics that assist in determining issues associated
  12933. with the digitization of analog video media.
  12934. By default the filter will log these metadata values:
  12935. @table @option
  12936. @item YMIN
  12937. Display the minimal Y value contained within the input frame. Expressed in
  12938. range of [0-255].
  12939. @item YLOW
  12940. Display the Y value at the 10% percentile within the input frame. Expressed in
  12941. range of [0-255].
  12942. @item YAVG
  12943. Display the average Y value within the input frame. Expressed in range of
  12944. [0-255].
  12945. @item YHIGH
  12946. Display the Y value at the 90% percentile within the input frame. Expressed in
  12947. range of [0-255].
  12948. @item YMAX
  12949. Display the maximum Y value contained within the input frame. Expressed in
  12950. range of [0-255].
  12951. @item UMIN
  12952. Display the minimal U value contained within the input frame. Expressed in
  12953. range of [0-255].
  12954. @item ULOW
  12955. Display the U value at the 10% percentile within the input frame. Expressed in
  12956. range of [0-255].
  12957. @item UAVG
  12958. Display the average U value within the input frame. Expressed in range of
  12959. [0-255].
  12960. @item UHIGH
  12961. Display the U value at the 90% percentile within the input frame. Expressed in
  12962. range of [0-255].
  12963. @item UMAX
  12964. Display the maximum U value contained within the input frame. Expressed in
  12965. range of [0-255].
  12966. @item VMIN
  12967. Display the minimal V value contained within the input frame. Expressed in
  12968. range of [0-255].
  12969. @item VLOW
  12970. Display the V value at the 10% percentile within the input frame. Expressed in
  12971. range of [0-255].
  12972. @item VAVG
  12973. Display the average V value within the input frame. Expressed in range of
  12974. [0-255].
  12975. @item VHIGH
  12976. Display the V value at the 90% percentile within the input frame. Expressed in
  12977. range of [0-255].
  12978. @item VMAX
  12979. Display the maximum V value contained within the input frame. Expressed in
  12980. range of [0-255].
  12981. @item SATMIN
  12982. Display the minimal saturation value contained within the input frame.
  12983. Expressed in range of [0-~181.02].
  12984. @item SATLOW
  12985. Display the saturation value at the 10% percentile within the input frame.
  12986. Expressed in range of [0-~181.02].
  12987. @item SATAVG
  12988. Display the average saturation value within the input frame. Expressed in range
  12989. of [0-~181.02].
  12990. @item SATHIGH
  12991. Display the saturation value at the 90% percentile within the input frame.
  12992. Expressed in range of [0-~181.02].
  12993. @item SATMAX
  12994. Display the maximum saturation value contained within the input frame.
  12995. Expressed in range of [0-~181.02].
  12996. @item HUEMED
  12997. Display the median value for hue within the input frame. Expressed in range of
  12998. [0-360].
  12999. @item HUEAVG
  13000. Display the average value for hue within the input frame. Expressed in range of
  13001. [0-360].
  13002. @item YDIF
  13003. Display the average of sample value difference between all values of the Y
  13004. plane in the current frame and corresponding values of the previous input frame.
  13005. Expressed in range of [0-255].
  13006. @item UDIF
  13007. Display the average of sample value difference between all values of the U
  13008. plane in the current frame and corresponding values of the previous input frame.
  13009. Expressed in range of [0-255].
  13010. @item VDIF
  13011. Display the average of sample value difference between all values of the V
  13012. plane in the current frame and corresponding values of the previous input frame.
  13013. Expressed in range of [0-255].
  13014. @item YBITDEPTH
  13015. Display bit depth of Y plane in current frame.
  13016. Expressed in range of [0-16].
  13017. @item UBITDEPTH
  13018. Display bit depth of U plane in current frame.
  13019. Expressed in range of [0-16].
  13020. @item VBITDEPTH
  13021. Display bit depth of V plane in current frame.
  13022. Expressed in range of [0-16].
  13023. @end table
  13024. The filter accepts the following options:
  13025. @table @option
  13026. @item stat
  13027. @item out
  13028. @option{stat} specify an additional form of image analysis.
  13029. @option{out} output video with the specified type of pixel highlighted.
  13030. Both options accept the following values:
  13031. @table @samp
  13032. @item tout
  13033. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  13034. unlike the neighboring pixels of the same field. Examples of temporal outliers
  13035. include the results of video dropouts, head clogs, or tape tracking issues.
  13036. @item vrep
  13037. Identify @var{vertical line repetition}. Vertical line repetition includes
  13038. similar rows of pixels within a frame. In born-digital video vertical line
  13039. repetition is common, but this pattern is uncommon in video digitized from an
  13040. analog source. When it occurs in video that results from the digitization of an
  13041. analog source it can indicate concealment from a dropout compensator.
  13042. @item brng
  13043. Identify pixels that fall outside of legal broadcast range.
  13044. @end table
  13045. @item color, c
  13046. Set the highlight color for the @option{out} option. The default color is
  13047. yellow.
  13048. @end table
  13049. @subsection Examples
  13050. @itemize
  13051. @item
  13052. Output data of various video metrics:
  13053. @example
  13054. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  13055. @end example
  13056. @item
  13057. Output specific data about the minimum and maximum values of the Y plane per frame:
  13058. @example
  13059. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  13060. @end example
  13061. @item
  13062. Playback video while highlighting pixels that are outside of broadcast range in red.
  13063. @example
  13064. ffplay example.mov -vf signalstats="out=brng:color=red"
  13065. @end example
  13066. @item
  13067. Playback video with signalstats metadata drawn over the frame.
  13068. @example
  13069. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  13070. @end example
  13071. The contents of signalstat_drawtext.txt used in the command are:
  13072. @example
  13073. time %@{pts:hms@}
  13074. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  13075. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  13076. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  13077. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  13078. @end example
  13079. @end itemize
  13080. @anchor{signature}
  13081. @section signature
  13082. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  13083. input. In this case the matching between the inputs can be calculated additionally.
  13084. The filter always passes through the first input. The signature of each stream can
  13085. be written into a file.
  13086. It accepts the following options:
  13087. @table @option
  13088. @item detectmode
  13089. Enable or disable the matching process.
  13090. Available values are:
  13091. @table @samp
  13092. @item off
  13093. Disable the calculation of a matching (default).
  13094. @item full
  13095. Calculate the matching for the whole video and output whether the whole video
  13096. matches or only parts.
  13097. @item fast
  13098. Calculate only until a matching is found or the video ends. Should be faster in
  13099. some cases.
  13100. @end table
  13101. @item nb_inputs
  13102. Set the number of inputs. The option value must be a non negative integer.
  13103. Default value is 1.
  13104. @item filename
  13105. Set the path to which the output is written. If there is more than one input,
  13106. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  13107. integer), that will be replaced with the input number. If no filename is
  13108. specified, no output will be written. This is the default.
  13109. @item format
  13110. Choose the output format.
  13111. Available values are:
  13112. @table @samp
  13113. @item binary
  13114. Use the specified binary representation (default).
  13115. @item xml
  13116. Use the specified xml representation.
  13117. @end table
  13118. @item th_d
  13119. Set threshold to detect one word as similar. The option value must be an integer
  13120. greater than zero. The default value is 9000.
  13121. @item th_dc
  13122. Set threshold to detect all words as similar. The option value must be an integer
  13123. greater than zero. The default value is 60000.
  13124. @item th_xh
  13125. Set threshold to detect frames as similar. The option value must be an integer
  13126. greater than zero. The default value is 116.
  13127. @item th_di
  13128. Set the minimum length of a sequence in frames to recognize it as matching
  13129. sequence. The option value must be a non negative integer value.
  13130. The default value is 0.
  13131. @item th_it
  13132. Set the minimum relation, that matching frames to all frames must have.
  13133. The option value must be a double value between 0 and 1. The default value is 0.5.
  13134. @end table
  13135. @subsection Examples
  13136. @itemize
  13137. @item
  13138. To calculate the signature of an input video and store it in signature.bin:
  13139. @example
  13140. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  13141. @end example
  13142. @item
  13143. To detect whether two videos match and store the signatures in XML format in
  13144. signature0.xml and signature1.xml:
  13145. @example
  13146. 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 -
  13147. @end example
  13148. @end itemize
  13149. @anchor{smartblur}
  13150. @section smartblur
  13151. Blur the input video without impacting the outlines.
  13152. It accepts the following options:
  13153. @table @option
  13154. @item luma_radius, lr
  13155. Set the luma radius. The option value must be a float number in
  13156. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13157. used to blur the image (slower if larger). Default value is 1.0.
  13158. @item luma_strength, ls
  13159. Set the luma strength. The option value must be a float number
  13160. in the range [-1.0,1.0] that configures the blurring. A value included
  13161. in [0.0,1.0] will blur the image whereas a value included in
  13162. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  13163. @item luma_threshold, lt
  13164. Set the luma threshold used as a coefficient to determine
  13165. whether a pixel should be blurred or not. The option value must be an
  13166. integer in the range [-30,30]. A value of 0 will filter all the image,
  13167. a value included in [0,30] will filter flat areas and a value included
  13168. in [-30,0] will filter edges. Default value is 0.
  13169. @item chroma_radius, cr
  13170. Set the chroma radius. The option value must be a float number in
  13171. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13172. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  13173. @item chroma_strength, cs
  13174. Set the chroma strength. The option value must be a float number
  13175. in the range [-1.0,1.0] that configures the blurring. A value included
  13176. in [0.0,1.0] will blur the image whereas a value included in
  13177. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  13178. @item chroma_threshold, ct
  13179. Set the chroma threshold used as a coefficient to determine
  13180. whether a pixel should be blurred or not. The option value must be an
  13181. integer in the range [-30,30]. A value of 0 will filter all the image,
  13182. a value included in [0,30] will filter flat areas and a value included
  13183. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  13184. @end table
  13185. If a chroma option is not explicitly set, the corresponding luma value
  13186. is set.
  13187. @section sobel
  13188. Apply sobel operator to input video stream.
  13189. The filter accepts the following option:
  13190. @table @option
  13191. @item planes
  13192. Set which planes will be processed, unprocessed planes will be copied.
  13193. By default value 0xf, all planes will be processed.
  13194. @item scale
  13195. Set value which will be multiplied with filtered result.
  13196. @item delta
  13197. Set value which will be added to filtered result.
  13198. @end table
  13199. @anchor{spp}
  13200. @section spp
  13201. Apply a simple postprocessing filter that compresses and decompresses the image
  13202. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  13203. and average the results.
  13204. The filter accepts the following options:
  13205. @table @option
  13206. @item quality
  13207. Set quality. This option defines the number of levels for averaging. It accepts
  13208. an integer in the range 0-6. If set to @code{0}, the filter will have no
  13209. effect. A value of @code{6} means the higher quality. For each increment of
  13210. that value the speed drops by a factor of approximately 2. Default value is
  13211. @code{3}.
  13212. @item qp
  13213. Force a constant quantization parameter. If not set, the filter will use the QP
  13214. from the video stream (if available).
  13215. @item mode
  13216. Set thresholding mode. Available modes are:
  13217. @table @samp
  13218. @item hard
  13219. Set hard thresholding (default).
  13220. @item soft
  13221. Set soft thresholding (better de-ringing effect, but likely blurrier).
  13222. @end table
  13223. @item use_bframe_qp
  13224. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  13225. option may cause flicker since the B-Frames have often larger QP. Default is
  13226. @code{0} (not enabled).
  13227. @end table
  13228. @subsection Commands
  13229. This filter supports the following commands:
  13230. @table @option
  13231. @item quality, level
  13232. Set quality level. The value @code{max} can be used to set the maximum level,
  13233. currently @code{6}.
  13234. @end table
  13235. @anchor{sr}
  13236. @section sr
  13237. Scale the input by applying one of the super-resolution methods based on
  13238. convolutional neural networks. Supported models:
  13239. @itemize
  13240. @item
  13241. Super-Resolution Convolutional Neural Network model (SRCNN).
  13242. See @url{https://arxiv.org/abs/1501.00092}.
  13243. @item
  13244. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  13245. See @url{https://arxiv.org/abs/1609.05158}.
  13246. @end itemize
  13247. Training scripts as well as scripts for model file (.pb) saving can be found at
  13248. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  13249. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  13250. Native model files (.model) can be generated from TensorFlow model
  13251. files (.pb) by using tools/python/convert.py
  13252. The filter accepts the following options:
  13253. @table @option
  13254. @item dnn_backend
  13255. Specify which DNN backend to use for model loading and execution. This option accepts
  13256. the following values:
  13257. @table @samp
  13258. @item native
  13259. Native implementation of DNN loading and execution.
  13260. @item tensorflow
  13261. TensorFlow backend. To enable this backend you
  13262. need to install the TensorFlow for C library (see
  13263. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  13264. @code{--enable-libtensorflow}
  13265. @end table
  13266. Default value is @samp{native}.
  13267. @item model
  13268. Set path to model file specifying network architecture and its parameters.
  13269. Note that different backends use different file formats. TensorFlow backend
  13270. can load files for both formats, while native backend can load files for only
  13271. its format.
  13272. @item scale_factor
  13273. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  13274. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  13275. input upscaled using bicubic upscaling with proper scale factor.
  13276. @end table
  13277. This feature can also be finished with @ref{dnn_processing} filter.
  13278. @section ssim
  13279. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  13280. This filter takes in input two input videos, the first input is
  13281. considered the "main" source and is passed unchanged to the
  13282. output. The second input is used as a "reference" video for computing
  13283. the SSIM.
  13284. Both video inputs must have the same resolution and pixel format for
  13285. this filter to work correctly. Also it assumes that both inputs
  13286. have the same number of frames, which are compared one by one.
  13287. The filter stores the calculated SSIM of each frame.
  13288. The description of the accepted parameters follows.
  13289. @table @option
  13290. @item stats_file, f
  13291. If specified the filter will use the named file to save the SSIM of
  13292. each individual frame. When filename equals "-" the data is sent to
  13293. standard output.
  13294. @end table
  13295. The file printed if @var{stats_file} is selected, contains a sequence of
  13296. key/value pairs of the form @var{key}:@var{value} for each compared
  13297. couple of frames.
  13298. A description of each shown parameter follows:
  13299. @table @option
  13300. @item n
  13301. sequential number of the input frame, starting from 1
  13302. @item Y, U, V, R, G, B
  13303. SSIM of the compared frames for the component specified by the suffix.
  13304. @item All
  13305. SSIM of the compared frames for the whole frame.
  13306. @item dB
  13307. Same as above but in dB representation.
  13308. @end table
  13309. This filter also supports the @ref{framesync} options.
  13310. @subsection Examples
  13311. @itemize
  13312. @item
  13313. For example:
  13314. @example
  13315. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  13316. [main][ref] ssim="stats_file=stats.log" [out]
  13317. @end example
  13318. On this example the input file being processed is compared with the
  13319. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  13320. is stored in @file{stats.log}.
  13321. @item
  13322. Another example with both psnr and ssim at same time:
  13323. @example
  13324. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  13325. @end example
  13326. @item
  13327. Another example with different containers:
  13328. @example
  13329. ffmpeg -i main.mpg -i ref.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[main][ref]ssim" -f null -
  13330. @end example
  13331. @end itemize
  13332. @section stereo3d
  13333. Convert between different stereoscopic image formats.
  13334. The filters accept the following options:
  13335. @table @option
  13336. @item in
  13337. Set stereoscopic image format of input.
  13338. Available values for input image formats are:
  13339. @table @samp
  13340. @item sbsl
  13341. side by side parallel (left eye left, right eye right)
  13342. @item sbsr
  13343. side by side crosseye (right eye left, left eye right)
  13344. @item sbs2l
  13345. side by side parallel with half width resolution
  13346. (left eye left, right eye right)
  13347. @item sbs2r
  13348. side by side crosseye with half width resolution
  13349. (right eye left, left eye right)
  13350. @item abl
  13351. @item tbl
  13352. above-below (left eye above, right eye below)
  13353. @item abr
  13354. @item tbr
  13355. above-below (right eye above, left eye below)
  13356. @item ab2l
  13357. @item tb2l
  13358. above-below with half height resolution
  13359. (left eye above, right eye below)
  13360. @item ab2r
  13361. @item tb2r
  13362. above-below with half height resolution
  13363. (right eye above, left eye below)
  13364. @item al
  13365. alternating frames (left eye first, right eye second)
  13366. @item ar
  13367. alternating frames (right eye first, left eye second)
  13368. @item irl
  13369. interleaved rows (left eye has top row, right eye starts on next row)
  13370. @item irr
  13371. interleaved rows (right eye has top row, left eye starts on next row)
  13372. @item icl
  13373. interleaved columns, left eye first
  13374. @item icr
  13375. interleaved columns, right eye first
  13376. Default value is @samp{sbsl}.
  13377. @end table
  13378. @item out
  13379. Set stereoscopic image format of output.
  13380. @table @samp
  13381. @item sbsl
  13382. side by side parallel (left eye left, right eye right)
  13383. @item sbsr
  13384. side by side crosseye (right eye left, left eye right)
  13385. @item sbs2l
  13386. side by side parallel with half width resolution
  13387. (left eye left, right eye right)
  13388. @item sbs2r
  13389. side by side crosseye with half width resolution
  13390. (right eye left, left eye right)
  13391. @item abl
  13392. @item tbl
  13393. above-below (left eye above, right eye below)
  13394. @item abr
  13395. @item tbr
  13396. above-below (right eye above, left eye below)
  13397. @item ab2l
  13398. @item tb2l
  13399. above-below with half height resolution
  13400. (left eye above, right eye below)
  13401. @item ab2r
  13402. @item tb2r
  13403. above-below with half height resolution
  13404. (right eye above, left eye below)
  13405. @item al
  13406. alternating frames (left eye first, right eye second)
  13407. @item ar
  13408. alternating frames (right eye first, left eye second)
  13409. @item irl
  13410. interleaved rows (left eye has top row, right eye starts on next row)
  13411. @item irr
  13412. interleaved rows (right eye has top row, left eye starts on next row)
  13413. @item arbg
  13414. anaglyph red/blue gray
  13415. (red filter on left eye, blue filter on right eye)
  13416. @item argg
  13417. anaglyph red/green gray
  13418. (red filter on left eye, green filter on right eye)
  13419. @item arcg
  13420. anaglyph red/cyan gray
  13421. (red filter on left eye, cyan filter on right eye)
  13422. @item arch
  13423. anaglyph red/cyan half colored
  13424. (red filter on left eye, cyan filter on right eye)
  13425. @item arcc
  13426. anaglyph red/cyan color
  13427. (red filter on left eye, cyan filter on right eye)
  13428. @item arcd
  13429. anaglyph red/cyan color optimized with the least squares projection of dubois
  13430. (red filter on left eye, cyan filter on right eye)
  13431. @item agmg
  13432. anaglyph green/magenta gray
  13433. (green filter on left eye, magenta filter on right eye)
  13434. @item agmh
  13435. anaglyph green/magenta half colored
  13436. (green filter on left eye, magenta filter on right eye)
  13437. @item agmc
  13438. anaglyph green/magenta colored
  13439. (green filter on left eye, magenta filter on right eye)
  13440. @item agmd
  13441. anaglyph green/magenta color optimized with the least squares projection of dubois
  13442. (green filter on left eye, magenta filter on right eye)
  13443. @item aybg
  13444. anaglyph yellow/blue gray
  13445. (yellow filter on left eye, blue filter on right eye)
  13446. @item aybh
  13447. anaglyph yellow/blue half colored
  13448. (yellow filter on left eye, blue filter on right eye)
  13449. @item aybc
  13450. anaglyph yellow/blue colored
  13451. (yellow filter on left eye, blue filter on right eye)
  13452. @item aybd
  13453. anaglyph yellow/blue color optimized with the least squares projection of dubois
  13454. (yellow filter on left eye, blue filter on right eye)
  13455. @item ml
  13456. mono output (left eye only)
  13457. @item mr
  13458. mono output (right eye only)
  13459. @item chl
  13460. checkerboard, left eye first
  13461. @item chr
  13462. checkerboard, right eye first
  13463. @item icl
  13464. interleaved columns, left eye first
  13465. @item icr
  13466. interleaved columns, right eye first
  13467. @item hdmi
  13468. HDMI frame pack
  13469. @end table
  13470. Default value is @samp{arcd}.
  13471. @end table
  13472. @subsection Examples
  13473. @itemize
  13474. @item
  13475. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  13476. @example
  13477. stereo3d=sbsl:aybd
  13478. @end example
  13479. @item
  13480. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  13481. @example
  13482. stereo3d=abl:sbsr
  13483. @end example
  13484. @end itemize
  13485. @section streamselect, astreamselect
  13486. Select video or audio streams.
  13487. The filter accepts the following options:
  13488. @table @option
  13489. @item inputs
  13490. Set number of inputs. Default is 2.
  13491. @item map
  13492. Set input indexes to remap to outputs.
  13493. @end table
  13494. @subsection Commands
  13495. The @code{streamselect} and @code{astreamselect} filter supports the following
  13496. commands:
  13497. @table @option
  13498. @item map
  13499. Set input indexes to remap to outputs.
  13500. @end table
  13501. @subsection Examples
  13502. @itemize
  13503. @item
  13504. Select first 5 seconds 1st stream and rest of time 2nd stream:
  13505. @example
  13506. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  13507. @end example
  13508. @item
  13509. Same as above, but for audio:
  13510. @example
  13511. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  13512. @end example
  13513. @end itemize
  13514. @anchor{subtitles}
  13515. @section subtitles
  13516. Draw subtitles on top of input video using the libass library.
  13517. To enable compilation of this filter you need to configure FFmpeg with
  13518. @code{--enable-libass}. This filter also requires a build with libavcodec and
  13519. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  13520. Alpha) subtitles format.
  13521. The filter accepts the following options:
  13522. @table @option
  13523. @item filename, f
  13524. Set the filename of the subtitle file to read. It must be specified.
  13525. @item original_size
  13526. Specify the size of the original video, the video for which the ASS file
  13527. was composed. For the syntax of this option, check the
  13528. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13529. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  13530. correctly scale the fonts if the aspect ratio has been changed.
  13531. @item fontsdir
  13532. Set a directory path containing fonts that can be used by the filter.
  13533. These fonts will be used in addition to whatever the font provider uses.
  13534. @item alpha
  13535. Process alpha channel, by default alpha channel is untouched.
  13536. @item charenc
  13537. Set subtitles input character encoding. @code{subtitles} filter only. Only
  13538. useful if not UTF-8.
  13539. @item stream_index, si
  13540. Set subtitles stream index. @code{subtitles} filter only.
  13541. @item force_style
  13542. Override default style or script info parameters of the subtitles. It accepts a
  13543. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  13544. @end table
  13545. If the first key is not specified, it is assumed that the first value
  13546. specifies the @option{filename}.
  13547. For example, to render the file @file{sub.srt} on top of the input
  13548. video, use the command:
  13549. @example
  13550. subtitles=sub.srt
  13551. @end example
  13552. which is equivalent to:
  13553. @example
  13554. subtitles=filename=sub.srt
  13555. @end example
  13556. To render the default subtitles stream from file @file{video.mkv}, use:
  13557. @example
  13558. subtitles=video.mkv
  13559. @end example
  13560. To render the second subtitles stream from that file, use:
  13561. @example
  13562. subtitles=video.mkv:si=1
  13563. @end example
  13564. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  13565. @code{DejaVu Serif}, use:
  13566. @example
  13567. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  13568. @end example
  13569. @section super2xsai
  13570. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  13571. Interpolate) pixel art scaling algorithm.
  13572. Useful for enlarging pixel art images without reducing sharpness.
  13573. @section swaprect
  13574. Swap two rectangular objects in video.
  13575. This filter accepts the following options:
  13576. @table @option
  13577. @item w
  13578. Set object width.
  13579. @item h
  13580. Set object height.
  13581. @item x1
  13582. Set 1st rect x coordinate.
  13583. @item y1
  13584. Set 1st rect y coordinate.
  13585. @item x2
  13586. Set 2nd rect x coordinate.
  13587. @item y2
  13588. Set 2nd rect y coordinate.
  13589. All expressions are evaluated once for each frame.
  13590. @end table
  13591. The all options are expressions containing the following constants:
  13592. @table @option
  13593. @item w
  13594. @item h
  13595. The input width and height.
  13596. @item a
  13597. same as @var{w} / @var{h}
  13598. @item sar
  13599. input sample aspect ratio
  13600. @item dar
  13601. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  13602. @item n
  13603. The number of the input frame, starting from 0.
  13604. @item t
  13605. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  13606. @item pos
  13607. the position in the file of the input frame, NAN if unknown
  13608. @end table
  13609. @section swapuv
  13610. Swap U & V plane.
  13611. @section tblend
  13612. Blend successive video frames.
  13613. See @ref{blend}
  13614. @section telecine
  13615. Apply telecine process to the video.
  13616. This filter accepts the following options:
  13617. @table @option
  13618. @item first_field
  13619. @table @samp
  13620. @item top, t
  13621. top field first
  13622. @item bottom, b
  13623. bottom field first
  13624. The default value is @code{top}.
  13625. @end table
  13626. @item pattern
  13627. A string of numbers representing the pulldown pattern you wish to apply.
  13628. The default value is @code{23}.
  13629. @end table
  13630. @example
  13631. Some typical patterns:
  13632. NTSC output (30i):
  13633. 27.5p: 32222
  13634. 24p: 23 (classic)
  13635. 24p: 2332 (preferred)
  13636. 20p: 33
  13637. 18p: 334
  13638. 16p: 3444
  13639. PAL output (25i):
  13640. 27.5p: 12222
  13641. 24p: 222222222223 ("Euro pulldown")
  13642. 16.67p: 33
  13643. 16p: 33333334
  13644. @end example
  13645. @section thistogram
  13646. Compute and draw a color distribution histogram for the input video across time.
  13647. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  13648. at certain time, this filter shows also past histograms of number of frames defined
  13649. by @code{width} option.
  13650. The computed histogram is a representation of the color component
  13651. distribution in an image.
  13652. The filter accepts the following options:
  13653. @table @option
  13654. @item width, w
  13655. Set width of single color component output. Default value is @code{0}.
  13656. Value of @code{0} means width will be picked from input video.
  13657. This also set number of passed histograms to keep.
  13658. Allowed range is [0, 8192].
  13659. @item display_mode, d
  13660. Set display mode.
  13661. It accepts the following values:
  13662. @table @samp
  13663. @item stack
  13664. Per color component graphs are placed below each other.
  13665. @item parade
  13666. Per color component graphs are placed side by side.
  13667. @item overlay
  13668. Presents information identical to that in the @code{parade}, except
  13669. that the graphs representing color components are superimposed directly
  13670. over one another.
  13671. @end table
  13672. Default is @code{stack}.
  13673. @item levels_mode, m
  13674. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  13675. Default is @code{linear}.
  13676. @item components, c
  13677. Set what color components to display.
  13678. Default is @code{7}.
  13679. @item bgopacity, b
  13680. Set background opacity. Default is @code{0.9}.
  13681. @item envelope, e
  13682. Show envelope. Default is disabled.
  13683. @item ecolor, ec
  13684. Set envelope color. Default is @code{gold}.
  13685. @end table
  13686. @section threshold
  13687. Apply threshold effect to video stream.
  13688. This filter needs four video streams to perform thresholding.
  13689. First stream is stream we are filtering.
  13690. Second stream is holding threshold values, third stream is holding min values,
  13691. and last, fourth stream is holding max values.
  13692. The filter accepts the following option:
  13693. @table @option
  13694. @item planes
  13695. Set which planes will be processed, unprocessed planes will be copied.
  13696. By default value 0xf, all planes will be processed.
  13697. @end table
  13698. For example if first stream pixel's component value is less then threshold value
  13699. of pixel component from 2nd threshold stream, third stream value will picked,
  13700. otherwise fourth stream pixel component value will be picked.
  13701. Using color source filter one can perform various types of thresholding:
  13702. @subsection Examples
  13703. @itemize
  13704. @item
  13705. Binary threshold, using gray color as threshold:
  13706. @example
  13707. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  13708. @end example
  13709. @item
  13710. Inverted binary threshold, using gray color as threshold:
  13711. @example
  13712. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  13713. @end example
  13714. @item
  13715. Truncate binary threshold, using gray color as threshold:
  13716. @example
  13717. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  13718. @end example
  13719. @item
  13720. Threshold to zero, using gray color as threshold:
  13721. @example
  13722. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  13723. @end example
  13724. @item
  13725. Inverted threshold to zero, using gray color as threshold:
  13726. @example
  13727. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  13728. @end example
  13729. @end itemize
  13730. @section thumbnail
  13731. Select the most representative frame in a given sequence of consecutive frames.
  13732. The filter accepts the following options:
  13733. @table @option
  13734. @item n
  13735. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  13736. will pick one of them, and then handle the next batch of @var{n} frames until
  13737. the end. Default is @code{100}.
  13738. @end table
  13739. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  13740. value will result in a higher memory usage, so a high value is not recommended.
  13741. @subsection Examples
  13742. @itemize
  13743. @item
  13744. Extract one picture each 50 frames:
  13745. @example
  13746. thumbnail=50
  13747. @end example
  13748. @item
  13749. Complete example of a thumbnail creation with @command{ffmpeg}:
  13750. @example
  13751. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  13752. @end example
  13753. @end itemize
  13754. @section tile
  13755. Tile several successive frames together.
  13756. The filter accepts the following options:
  13757. @table @option
  13758. @item layout
  13759. Set the grid size (i.e. the number of lines and columns). For the syntax of
  13760. this option, check the
  13761. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13762. @item nb_frames
  13763. Set the maximum number of frames to render in the given area. It must be less
  13764. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  13765. the area will be used.
  13766. @item margin
  13767. Set the outer border margin in pixels.
  13768. @item padding
  13769. Set the inner border thickness (i.e. the number of pixels between frames). For
  13770. more advanced padding options (such as having different values for the edges),
  13771. refer to the pad video filter.
  13772. @item color
  13773. Specify the color of the unused area. For the syntax of this option, check the
  13774. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13775. The default value of @var{color} is "black".
  13776. @item overlap
  13777. Set the number of frames to overlap when tiling several successive frames together.
  13778. The value must be between @code{0} and @var{nb_frames - 1}.
  13779. @item init_padding
  13780. Set the number of frames to initially be empty before displaying first output frame.
  13781. This controls how soon will one get first output frame.
  13782. The value must be between @code{0} and @var{nb_frames - 1}.
  13783. @end table
  13784. @subsection Examples
  13785. @itemize
  13786. @item
  13787. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  13788. @example
  13789. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  13790. @end example
  13791. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  13792. duplicating each output frame to accommodate the originally detected frame
  13793. rate.
  13794. @item
  13795. Display @code{5} pictures in an area of @code{3x2} frames,
  13796. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  13797. mixed flat and named options:
  13798. @example
  13799. tile=3x2:nb_frames=5:padding=7:margin=2
  13800. @end example
  13801. @end itemize
  13802. @section tinterlace
  13803. Perform various types of temporal field interlacing.
  13804. Frames are counted starting from 1, so the first input frame is
  13805. considered odd.
  13806. The filter accepts the following options:
  13807. @table @option
  13808. @item mode
  13809. Specify the mode of the interlacing. This option can also be specified
  13810. as a value alone. See below for a list of values for this option.
  13811. Available values are:
  13812. @table @samp
  13813. @item merge, 0
  13814. Move odd frames into the upper field, even into the lower field,
  13815. generating a double height frame at half frame rate.
  13816. @example
  13817. ------> time
  13818. Input:
  13819. Frame 1 Frame 2 Frame 3 Frame 4
  13820. 11111 22222 33333 44444
  13821. 11111 22222 33333 44444
  13822. 11111 22222 33333 44444
  13823. 11111 22222 33333 44444
  13824. Output:
  13825. 11111 33333
  13826. 22222 44444
  13827. 11111 33333
  13828. 22222 44444
  13829. 11111 33333
  13830. 22222 44444
  13831. 11111 33333
  13832. 22222 44444
  13833. @end example
  13834. @item drop_even, 1
  13835. Only output odd frames, even frames are dropped, generating a frame with
  13836. unchanged height at half frame rate.
  13837. @example
  13838. ------> time
  13839. Input:
  13840. Frame 1 Frame 2 Frame 3 Frame 4
  13841. 11111 22222 33333 44444
  13842. 11111 22222 33333 44444
  13843. 11111 22222 33333 44444
  13844. 11111 22222 33333 44444
  13845. Output:
  13846. 11111 33333
  13847. 11111 33333
  13848. 11111 33333
  13849. 11111 33333
  13850. @end example
  13851. @item drop_odd, 2
  13852. Only output even frames, odd frames are dropped, generating a frame with
  13853. unchanged height at half frame rate.
  13854. @example
  13855. ------> time
  13856. Input:
  13857. Frame 1 Frame 2 Frame 3 Frame 4
  13858. 11111 22222 33333 44444
  13859. 11111 22222 33333 44444
  13860. 11111 22222 33333 44444
  13861. 11111 22222 33333 44444
  13862. Output:
  13863. 22222 44444
  13864. 22222 44444
  13865. 22222 44444
  13866. 22222 44444
  13867. @end example
  13868. @item pad, 3
  13869. Expand each frame to full height, but pad alternate lines with black,
  13870. generating a frame with double height at the same input frame rate.
  13871. @example
  13872. ------> time
  13873. Input:
  13874. Frame 1 Frame 2 Frame 3 Frame 4
  13875. 11111 22222 33333 44444
  13876. 11111 22222 33333 44444
  13877. 11111 22222 33333 44444
  13878. 11111 22222 33333 44444
  13879. Output:
  13880. 11111 ..... 33333 .....
  13881. ..... 22222 ..... 44444
  13882. 11111 ..... 33333 .....
  13883. ..... 22222 ..... 44444
  13884. 11111 ..... 33333 .....
  13885. ..... 22222 ..... 44444
  13886. 11111 ..... 33333 .....
  13887. ..... 22222 ..... 44444
  13888. @end example
  13889. @item interleave_top, 4
  13890. Interleave the upper field from odd frames with the lower field from
  13891. even frames, generating a frame with unchanged height at half frame rate.
  13892. @example
  13893. ------> time
  13894. Input:
  13895. Frame 1 Frame 2 Frame 3 Frame 4
  13896. 11111<- 22222 33333<- 44444
  13897. 11111 22222<- 33333 44444<-
  13898. 11111<- 22222 33333<- 44444
  13899. 11111 22222<- 33333 44444<-
  13900. Output:
  13901. 11111 33333
  13902. 22222 44444
  13903. 11111 33333
  13904. 22222 44444
  13905. @end example
  13906. @item interleave_bottom, 5
  13907. Interleave the lower field from odd frames with the upper field from
  13908. even frames, generating a frame with unchanged height at half frame rate.
  13909. @example
  13910. ------> time
  13911. Input:
  13912. Frame 1 Frame 2 Frame 3 Frame 4
  13913. 11111 22222<- 33333 44444<-
  13914. 11111<- 22222 33333<- 44444
  13915. 11111 22222<- 33333 44444<-
  13916. 11111<- 22222 33333<- 44444
  13917. Output:
  13918. 22222 44444
  13919. 11111 33333
  13920. 22222 44444
  13921. 11111 33333
  13922. @end example
  13923. @item interlacex2, 6
  13924. Double frame rate with unchanged height. Frames are inserted each
  13925. containing the second temporal field from the previous input frame and
  13926. the first temporal field from the next input frame. This mode relies on
  13927. the top_field_first flag. Useful for interlaced video displays with no
  13928. field synchronisation.
  13929. @example
  13930. ------> time
  13931. Input:
  13932. Frame 1 Frame 2 Frame 3 Frame 4
  13933. 11111 22222 33333 44444
  13934. 11111 22222 33333 44444
  13935. 11111 22222 33333 44444
  13936. 11111 22222 33333 44444
  13937. Output:
  13938. 11111 22222 22222 33333 33333 44444 44444
  13939. 11111 11111 22222 22222 33333 33333 44444
  13940. 11111 22222 22222 33333 33333 44444 44444
  13941. 11111 11111 22222 22222 33333 33333 44444
  13942. @end example
  13943. @item mergex2, 7
  13944. Move odd frames into the upper field, even into the lower field,
  13945. generating a double height frame at same frame rate.
  13946. @example
  13947. ------> time
  13948. Input:
  13949. Frame 1 Frame 2 Frame 3 Frame 4
  13950. 11111 22222 33333 44444
  13951. 11111 22222 33333 44444
  13952. 11111 22222 33333 44444
  13953. 11111 22222 33333 44444
  13954. Output:
  13955. 11111 33333 33333 55555
  13956. 22222 22222 44444 44444
  13957. 11111 33333 33333 55555
  13958. 22222 22222 44444 44444
  13959. 11111 33333 33333 55555
  13960. 22222 22222 44444 44444
  13961. 11111 33333 33333 55555
  13962. 22222 22222 44444 44444
  13963. @end example
  13964. @end table
  13965. Numeric values are deprecated but are accepted for backward
  13966. compatibility reasons.
  13967. Default mode is @code{merge}.
  13968. @item flags
  13969. Specify flags influencing the filter process.
  13970. Available value for @var{flags} is:
  13971. @table @option
  13972. @item low_pass_filter, vlpf
  13973. Enable linear vertical low-pass filtering in the filter.
  13974. Vertical low-pass filtering is required when creating an interlaced
  13975. destination from a progressive source which contains high-frequency
  13976. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  13977. patterning.
  13978. @item complex_filter, cvlpf
  13979. Enable complex vertical low-pass filtering.
  13980. This will slightly less reduce interlace 'twitter' and Moire
  13981. patterning but better retain detail and subjective sharpness impression.
  13982. @item bypass_il
  13983. Bypass already interlaced frames, only adjust the frame rate.
  13984. @end table
  13985. Vertical low-pass filtering and bypassing already interlaced frames can only be
  13986. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  13987. @end table
  13988. @section tmix
  13989. Mix successive video frames.
  13990. A description of the accepted options follows.
  13991. @table @option
  13992. @item frames
  13993. The number of successive frames to mix. If unspecified, it defaults to 3.
  13994. @item weights
  13995. Specify weight of each input video frame.
  13996. Each weight is separated by space. If number of weights is smaller than
  13997. number of @var{frames} last specified weight will be used for all remaining
  13998. unset weights.
  13999. @item scale
  14000. Specify scale, if it is set it will be multiplied with sum
  14001. of each weight multiplied with pixel values to give final destination
  14002. pixel value. By default @var{scale} is auto scaled to sum of weights.
  14003. @end table
  14004. @subsection Examples
  14005. @itemize
  14006. @item
  14007. Average 7 successive frames:
  14008. @example
  14009. tmix=frames=7:weights="1 1 1 1 1 1 1"
  14010. @end example
  14011. @item
  14012. Apply simple temporal convolution:
  14013. @example
  14014. tmix=frames=3:weights="-1 3 -1"
  14015. @end example
  14016. @item
  14017. Similar as above but only showing temporal differences:
  14018. @example
  14019. tmix=frames=3:weights="-1 2 -1":scale=1
  14020. @end example
  14021. @end itemize
  14022. @anchor{tonemap}
  14023. @section tonemap
  14024. Tone map colors from different dynamic ranges.
  14025. This filter expects data in single precision floating point, as it needs to
  14026. operate on (and can output) out-of-range values. Another filter, such as
  14027. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  14028. The tonemapping algorithms implemented only work on linear light, so input
  14029. data should be linearized beforehand (and possibly correctly tagged).
  14030. @example
  14031. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  14032. @end example
  14033. @subsection Options
  14034. The filter accepts the following options.
  14035. @table @option
  14036. @item tonemap
  14037. Set the tone map algorithm to use.
  14038. Possible values are:
  14039. @table @var
  14040. @item none
  14041. Do not apply any tone map, only desaturate overbright pixels.
  14042. @item clip
  14043. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  14044. in-range values, while distorting out-of-range values.
  14045. @item linear
  14046. Stretch the entire reference gamut to a linear multiple of the display.
  14047. @item gamma
  14048. Fit a logarithmic transfer between the tone curves.
  14049. @item reinhard
  14050. Preserve overall image brightness with a simple curve, using nonlinear
  14051. contrast, which results in flattening details and degrading color accuracy.
  14052. @item hable
  14053. Preserve both dark and bright details better than @var{reinhard}, at the cost
  14054. of slightly darkening everything. Use it when detail preservation is more
  14055. important than color and brightness accuracy.
  14056. @item mobius
  14057. Smoothly map out-of-range values, while retaining contrast and colors for
  14058. in-range material as much as possible. Use it when color accuracy is more
  14059. important than detail preservation.
  14060. @end table
  14061. Default is none.
  14062. @item param
  14063. Tune the tone mapping algorithm.
  14064. This affects the following algorithms:
  14065. @table @var
  14066. @item none
  14067. Ignored.
  14068. @item linear
  14069. Specifies the scale factor to use while stretching.
  14070. Default to 1.0.
  14071. @item gamma
  14072. Specifies the exponent of the function.
  14073. Default to 1.8.
  14074. @item clip
  14075. Specify an extra linear coefficient to multiply into the signal before clipping.
  14076. Default to 1.0.
  14077. @item reinhard
  14078. Specify the local contrast coefficient at the display peak.
  14079. Default to 0.5, which means that in-gamut values will be about half as bright
  14080. as when clipping.
  14081. @item hable
  14082. Ignored.
  14083. @item mobius
  14084. Specify the transition point from linear to mobius transform. Every value
  14085. below this point is guaranteed to be mapped 1:1. The higher the value, the
  14086. more accurate the result will be, at the cost of losing bright details.
  14087. Default to 0.3, which due to the steep initial slope still preserves in-range
  14088. colors fairly accurately.
  14089. @end table
  14090. @item desat
  14091. Apply desaturation for highlights that exceed this level of brightness. The
  14092. higher the parameter, the more color information will be preserved. This
  14093. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14094. (smoothly) turning into white instead. This makes images feel more natural,
  14095. at the cost of reducing information about out-of-range colors.
  14096. The default of 2.0 is somewhat conservative and will mostly just apply to
  14097. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  14098. This option works only if the input frame has a supported color tag.
  14099. @item peak
  14100. Override signal/nominal/reference peak with this value. Useful when the
  14101. embedded peak information in display metadata is not reliable or when tone
  14102. mapping from a lower range to a higher range.
  14103. @end table
  14104. @section tpad
  14105. Temporarily pad video frames.
  14106. The filter accepts the following options:
  14107. @table @option
  14108. @item start
  14109. Specify number of delay frames before input video stream. Default is 0.
  14110. @item stop
  14111. Specify number of padding frames after input video stream.
  14112. Set to -1 to pad indefinitely. Default is 0.
  14113. @item start_mode
  14114. Set kind of frames added to beginning of stream.
  14115. Can be either @var{add} or @var{clone}.
  14116. With @var{add} frames of solid-color are added.
  14117. With @var{clone} frames are clones of first frame.
  14118. Default is @var{add}.
  14119. @item stop_mode
  14120. Set kind of frames added to end of stream.
  14121. Can be either @var{add} or @var{clone}.
  14122. With @var{add} frames of solid-color are added.
  14123. With @var{clone} frames are clones of last frame.
  14124. Default is @var{add}.
  14125. @item start_duration, stop_duration
  14126. Specify the duration of the start/stop delay. See
  14127. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14128. for the accepted syntax.
  14129. These options override @var{start} and @var{stop}. Default is 0.
  14130. @item color
  14131. Specify the color of the padded area. For the syntax of this option,
  14132. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14133. manual,ffmpeg-utils}.
  14134. The default value of @var{color} is "black".
  14135. @end table
  14136. @anchor{transpose}
  14137. @section transpose
  14138. Transpose rows with columns in the input video and optionally flip it.
  14139. It accepts the following parameters:
  14140. @table @option
  14141. @item dir
  14142. Specify the transposition direction.
  14143. Can assume the following values:
  14144. @table @samp
  14145. @item 0, 4, cclock_flip
  14146. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  14147. @example
  14148. L.R L.l
  14149. . . -> . .
  14150. l.r R.r
  14151. @end example
  14152. @item 1, 5, clock
  14153. Rotate by 90 degrees clockwise, that is:
  14154. @example
  14155. L.R l.L
  14156. . . -> . .
  14157. l.r r.R
  14158. @end example
  14159. @item 2, 6, cclock
  14160. Rotate by 90 degrees counterclockwise, that is:
  14161. @example
  14162. L.R R.r
  14163. . . -> . .
  14164. l.r L.l
  14165. @end example
  14166. @item 3, 7, clock_flip
  14167. Rotate by 90 degrees clockwise and vertically flip, that is:
  14168. @example
  14169. L.R r.R
  14170. . . -> . .
  14171. l.r l.L
  14172. @end example
  14173. @end table
  14174. For values between 4-7, the transposition is only done if the input
  14175. video geometry is portrait and not landscape. These values are
  14176. deprecated, the @code{passthrough} option should be used instead.
  14177. Numerical values are deprecated, and should be dropped in favor of
  14178. symbolic constants.
  14179. @item passthrough
  14180. Do not apply the transposition if the input geometry matches the one
  14181. specified by the specified value. It accepts the following values:
  14182. @table @samp
  14183. @item none
  14184. Always apply transposition.
  14185. @item portrait
  14186. Preserve portrait geometry (when @var{height} >= @var{width}).
  14187. @item landscape
  14188. Preserve landscape geometry (when @var{width} >= @var{height}).
  14189. @end table
  14190. Default value is @code{none}.
  14191. @end table
  14192. For example to rotate by 90 degrees clockwise and preserve portrait
  14193. layout:
  14194. @example
  14195. transpose=dir=1:passthrough=portrait
  14196. @end example
  14197. The command above can also be specified as:
  14198. @example
  14199. transpose=1:portrait
  14200. @end example
  14201. @section transpose_npp
  14202. Transpose rows with columns in the input video and optionally flip it.
  14203. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  14204. It accepts the following parameters:
  14205. @table @option
  14206. @item dir
  14207. Specify the transposition direction.
  14208. Can assume the following values:
  14209. @table @samp
  14210. @item cclock_flip
  14211. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  14212. @item clock
  14213. Rotate by 90 degrees clockwise.
  14214. @item cclock
  14215. Rotate by 90 degrees counterclockwise.
  14216. @item clock_flip
  14217. Rotate by 90 degrees clockwise and vertically flip.
  14218. @end table
  14219. @item passthrough
  14220. Do not apply the transposition if the input geometry matches the one
  14221. specified by the specified value. It accepts the following values:
  14222. @table @samp
  14223. @item none
  14224. Always apply transposition. (default)
  14225. @item portrait
  14226. Preserve portrait geometry (when @var{height} >= @var{width}).
  14227. @item landscape
  14228. Preserve landscape geometry (when @var{width} >= @var{height}).
  14229. @end table
  14230. @end table
  14231. @section trim
  14232. Trim the input so that the output contains one continuous subpart of the input.
  14233. It accepts the following parameters:
  14234. @table @option
  14235. @item start
  14236. Specify the time of the start of the kept section, i.e. the frame with the
  14237. timestamp @var{start} will be the first frame in the output.
  14238. @item end
  14239. Specify the time of the first frame that will be dropped, i.e. the frame
  14240. immediately preceding the one with the timestamp @var{end} will be the last
  14241. frame in the output.
  14242. @item start_pts
  14243. This is the same as @var{start}, except this option sets the start timestamp
  14244. in timebase units instead of seconds.
  14245. @item end_pts
  14246. This is the same as @var{end}, except this option sets the end timestamp
  14247. in timebase units instead of seconds.
  14248. @item duration
  14249. The maximum duration of the output in seconds.
  14250. @item start_frame
  14251. The number of the first frame that should be passed to the output.
  14252. @item end_frame
  14253. The number of the first frame that should be dropped.
  14254. @end table
  14255. @option{start}, @option{end}, and @option{duration} are expressed as time
  14256. duration specifications; see
  14257. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14258. for the accepted syntax.
  14259. Note that the first two sets of the start/end options and the @option{duration}
  14260. option look at the frame timestamp, while the _frame variants simply count the
  14261. frames that pass through the filter. Also note that this filter does not modify
  14262. the timestamps. If you wish for the output timestamps to start at zero, insert a
  14263. setpts filter after the trim filter.
  14264. If multiple start or end options are set, this filter tries to be greedy and
  14265. keep all the frames that match at least one of the specified constraints. To keep
  14266. only the part that matches all the constraints at once, chain multiple trim
  14267. filters.
  14268. The defaults are such that all the input is kept. So it is possible to set e.g.
  14269. just the end values to keep everything before the specified time.
  14270. Examples:
  14271. @itemize
  14272. @item
  14273. Drop everything except the second minute of input:
  14274. @example
  14275. ffmpeg -i INPUT -vf trim=60:120
  14276. @end example
  14277. @item
  14278. Keep only the first second:
  14279. @example
  14280. ffmpeg -i INPUT -vf trim=duration=1
  14281. @end example
  14282. @end itemize
  14283. @section unpremultiply
  14284. Apply alpha unpremultiply effect to input video stream using first plane
  14285. of second stream as alpha.
  14286. Both streams must have same dimensions and same pixel format.
  14287. The filter accepts the following option:
  14288. @table @option
  14289. @item planes
  14290. Set which planes will be processed, unprocessed planes will be copied.
  14291. By default value 0xf, all planes will be processed.
  14292. If the format has 1 or 2 components, then luma is bit 0.
  14293. If the format has 3 or 4 components:
  14294. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  14295. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  14296. If present, the alpha channel is always the last bit.
  14297. @item inplace
  14298. Do not require 2nd input for processing, instead use alpha plane from input stream.
  14299. @end table
  14300. @anchor{unsharp}
  14301. @section unsharp
  14302. Sharpen or blur the input video.
  14303. It accepts the following parameters:
  14304. @table @option
  14305. @item luma_msize_x, lx
  14306. Set the luma matrix horizontal size. It must be an odd integer between
  14307. 3 and 23. The default value is 5.
  14308. @item luma_msize_y, ly
  14309. Set the luma matrix vertical size. It must be an odd integer between 3
  14310. and 23. The default value is 5.
  14311. @item luma_amount, la
  14312. Set the luma effect strength. It must be a floating point number, reasonable
  14313. values lay between -1.5 and 1.5.
  14314. Negative values will blur the input video, while positive values will
  14315. sharpen it, a value of zero will disable the effect.
  14316. Default value is 1.0.
  14317. @item chroma_msize_x, cx
  14318. Set the chroma matrix horizontal size. It must be an odd integer
  14319. between 3 and 23. The default value is 5.
  14320. @item chroma_msize_y, cy
  14321. Set the chroma matrix vertical size. It must be an odd integer
  14322. between 3 and 23. The default value is 5.
  14323. @item chroma_amount, ca
  14324. Set the chroma effect strength. It must be a floating point number, reasonable
  14325. values lay between -1.5 and 1.5.
  14326. Negative values will blur the input video, while positive values will
  14327. sharpen it, a value of zero will disable the effect.
  14328. Default value is 0.0.
  14329. @end table
  14330. All parameters are optional and default to the equivalent of the
  14331. string '5:5:1.0:5:5:0.0'.
  14332. @subsection Examples
  14333. @itemize
  14334. @item
  14335. Apply strong luma sharpen effect:
  14336. @example
  14337. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  14338. @end example
  14339. @item
  14340. Apply a strong blur of both luma and chroma parameters:
  14341. @example
  14342. unsharp=7:7:-2:7:7:-2
  14343. @end example
  14344. @end itemize
  14345. @section uspp
  14346. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  14347. the image at several (or - in the case of @option{quality} level @code{8} - all)
  14348. shifts and average the results.
  14349. The way this differs from the behavior of spp is that uspp actually encodes &
  14350. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  14351. DCT similar to MJPEG.
  14352. The filter accepts the following options:
  14353. @table @option
  14354. @item quality
  14355. Set quality. This option defines the number of levels for averaging. It accepts
  14356. an integer in the range 0-8. If set to @code{0}, the filter will have no
  14357. effect. A value of @code{8} means the higher quality. For each increment of
  14358. that value the speed drops by a factor of approximately 2. Default value is
  14359. @code{3}.
  14360. @item qp
  14361. Force a constant quantization parameter. If not set, the filter will use the QP
  14362. from the video stream (if available).
  14363. @end table
  14364. @section v360
  14365. Convert 360 videos between various formats.
  14366. The filter accepts the following options:
  14367. @table @option
  14368. @item input
  14369. @item output
  14370. Set format of the input/output video.
  14371. Available formats:
  14372. @table @samp
  14373. @item e
  14374. @item equirect
  14375. Equirectangular projection.
  14376. @item c3x2
  14377. @item c6x1
  14378. @item c1x6
  14379. Cubemap with 3x2/6x1/1x6 layout.
  14380. Format specific options:
  14381. @table @option
  14382. @item in_pad
  14383. @item out_pad
  14384. Set padding proportion for the input/output cubemap. Values in decimals.
  14385. Example values:
  14386. @table @samp
  14387. @item 0
  14388. No padding.
  14389. @item 0.01
  14390. 1% of face is padding. For example, with 1920x1280 resolution face size would be 640x640 and padding would be 3 pixels from each side. (640 * 0.01 = 6 pixels)
  14391. @end table
  14392. Default value is @b{@samp{0}}.
  14393. @item fin_pad
  14394. @item fout_pad
  14395. Set fixed padding for the input/output cubemap. Values in pixels.
  14396. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  14397. @item in_forder
  14398. @item out_forder
  14399. Set order of faces for the input/output cubemap. Choose one direction for each position.
  14400. Designation of directions:
  14401. @table @samp
  14402. @item r
  14403. right
  14404. @item l
  14405. left
  14406. @item u
  14407. up
  14408. @item d
  14409. down
  14410. @item f
  14411. forward
  14412. @item b
  14413. back
  14414. @end table
  14415. Default value is @b{@samp{rludfb}}.
  14416. @item in_frot
  14417. @item out_frot
  14418. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  14419. Designation of angles:
  14420. @table @samp
  14421. @item 0
  14422. 0 degrees clockwise
  14423. @item 1
  14424. 90 degrees clockwise
  14425. @item 2
  14426. 180 degrees clockwise
  14427. @item 3
  14428. 270 degrees clockwise
  14429. @end table
  14430. Default value is @b{@samp{000000}}.
  14431. @end table
  14432. @item eac
  14433. Equi-Angular Cubemap.
  14434. @item flat
  14435. @item gnomonic
  14436. @item rectilinear
  14437. Regular video.
  14438. Format specific options:
  14439. @table @option
  14440. @item h_fov
  14441. @item v_fov
  14442. @item d_fov
  14443. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14444. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14445. @item ih_fov
  14446. @item iv_fov
  14447. @item id_fov
  14448. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14449. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14450. @end table
  14451. @item dfisheye
  14452. Dual fisheye.
  14453. Format specific options:
  14454. @table @option
  14455. @item in_pad
  14456. @item out_pad
  14457. Set padding proportion. Values in decimals.
  14458. Example values:
  14459. @table @samp
  14460. @item 0
  14461. No padding.
  14462. @item 0.01
  14463. 1% padding.
  14464. @end table
  14465. Default value is @b{@samp{0}}.
  14466. @end table
  14467. @item barrel
  14468. @item fb
  14469. @item barrelsplit
  14470. Facebook's 360 formats.
  14471. @item sg
  14472. Stereographic format.
  14473. Format specific options:
  14474. @table @option
  14475. @item h_fov
  14476. @item v_fov
  14477. @item d_fov
  14478. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14479. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14480. @item ih_fov
  14481. @item iv_fov
  14482. @item id_fov
  14483. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14484. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14485. @end table
  14486. @item mercator
  14487. Mercator format.
  14488. @item ball
  14489. Ball format, gives significant distortion toward the back.
  14490. @item hammer
  14491. Hammer-Aitoff map projection format.
  14492. @item sinusoidal
  14493. Sinusoidal map projection format.
  14494. @item fisheye
  14495. Fisheye projection.
  14496. Format specific options:
  14497. @table @option
  14498. @item h_fov
  14499. @item v_fov
  14500. @item d_fov
  14501. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14502. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14503. @item ih_fov
  14504. @item iv_fov
  14505. @item id_fov
  14506. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14507. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14508. @end table
  14509. @item pannini
  14510. Pannini projection.
  14511. Format specific options:
  14512. @table @option
  14513. @item h_fov
  14514. Set output pannini parameter.
  14515. @item ih_fov
  14516. Set input pannini parameter.
  14517. @end table
  14518. @item cylindrical
  14519. Cylindrical projection.
  14520. Format specific options:
  14521. @table @option
  14522. @item h_fov
  14523. @item v_fov
  14524. @item d_fov
  14525. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14526. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14527. @item ih_fov
  14528. @item iv_fov
  14529. @item id_fov
  14530. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14531. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14532. @end table
  14533. @item perspective
  14534. Perspective projection. @i{(output only)}
  14535. Format specific options:
  14536. @table @option
  14537. @item v_fov
  14538. Set perspective parameter.
  14539. @end table
  14540. @item tetrahedron
  14541. Tetrahedron projection.
  14542. @item tsp
  14543. Truncated square pyramid projection.
  14544. @item he
  14545. @item hequirect
  14546. Half equirectangular projection.
  14547. @end table
  14548. @item interp
  14549. Set interpolation method.@*
  14550. @i{Note: more complex interpolation methods require much more memory to run.}
  14551. Available methods:
  14552. @table @samp
  14553. @item near
  14554. @item nearest
  14555. Nearest neighbour.
  14556. @item line
  14557. @item linear
  14558. Bilinear interpolation.
  14559. @item lagrange9
  14560. Lagrange9 interpolation.
  14561. @item cube
  14562. @item cubic
  14563. Bicubic interpolation.
  14564. @item lanc
  14565. @item lanczos
  14566. Lanczos interpolation.
  14567. @item sp16
  14568. @item spline16
  14569. Spline16 interpolation.
  14570. @item gauss
  14571. @item gaussian
  14572. Gaussian interpolation.
  14573. @end table
  14574. Default value is @b{@samp{line}}.
  14575. @item w
  14576. @item h
  14577. Set the output video resolution.
  14578. Default resolution depends on formats.
  14579. @item in_stereo
  14580. @item out_stereo
  14581. Set the input/output stereo format.
  14582. @table @samp
  14583. @item 2d
  14584. 2D mono
  14585. @item sbs
  14586. Side by side
  14587. @item tb
  14588. Top bottom
  14589. @end table
  14590. Default value is @b{@samp{2d}} for input and output format.
  14591. @item yaw
  14592. @item pitch
  14593. @item roll
  14594. Set rotation for the output video. Values in degrees.
  14595. @item rorder
  14596. Set rotation order for the output video. Choose one item for each position.
  14597. @table @samp
  14598. @item y, Y
  14599. yaw
  14600. @item p, P
  14601. pitch
  14602. @item r, R
  14603. roll
  14604. @end table
  14605. Default value is @b{@samp{ypr}}.
  14606. @item h_flip
  14607. @item v_flip
  14608. @item d_flip
  14609. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  14610. @item ih_flip
  14611. @item iv_flip
  14612. Set if input video is flipped horizontally/vertically. Boolean values.
  14613. @item in_trans
  14614. Set if input video is transposed. Boolean value, by default disabled.
  14615. @item out_trans
  14616. Set if output video needs to be transposed. Boolean value, by default disabled.
  14617. @item alpha_mask
  14618. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  14619. @end table
  14620. @subsection Examples
  14621. @itemize
  14622. @item
  14623. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  14624. @example
  14625. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  14626. @end example
  14627. @item
  14628. Extract back view of Equi-Angular Cubemap:
  14629. @example
  14630. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  14631. @end example
  14632. @item
  14633. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  14634. @example
  14635. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  14636. @end example
  14637. @end itemize
  14638. @subsection Commands
  14639. This filter supports subset of above options as @ref{commands}.
  14640. @section vaguedenoiser
  14641. Apply a wavelet based denoiser.
  14642. It transforms each frame from the video input into the wavelet domain,
  14643. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  14644. the obtained coefficients. It does an inverse wavelet transform after.
  14645. Due to wavelet properties, it should give a nice smoothed result, and
  14646. reduced noise, without blurring picture features.
  14647. This filter accepts the following options:
  14648. @table @option
  14649. @item threshold
  14650. The filtering strength. The higher, the more filtered the video will be.
  14651. Hard thresholding can use a higher threshold than soft thresholding
  14652. before the video looks overfiltered. Default value is 2.
  14653. @item method
  14654. The filtering method the filter will use.
  14655. It accepts the following values:
  14656. @table @samp
  14657. @item hard
  14658. All values under the threshold will be zeroed.
  14659. @item soft
  14660. All values under the threshold will be zeroed. All values above will be
  14661. reduced by the threshold.
  14662. @item garrote
  14663. Scales or nullifies coefficients - intermediary between (more) soft and
  14664. (less) hard thresholding.
  14665. @end table
  14666. Default is garrote.
  14667. @item nsteps
  14668. Number of times, the wavelet will decompose the picture. Picture can't
  14669. be decomposed beyond a particular point (typically, 8 for a 640x480
  14670. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  14671. @item percent
  14672. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  14673. @item planes
  14674. A list of the planes to process. By default all planes are processed.
  14675. @end table
  14676. @section vectorscope
  14677. Display 2 color component values in the two dimensional graph (which is called
  14678. a vectorscope).
  14679. This filter accepts the following options:
  14680. @table @option
  14681. @item mode, m
  14682. Set vectorscope mode.
  14683. It accepts the following values:
  14684. @table @samp
  14685. @item gray
  14686. @item tint
  14687. Gray values are displayed on graph, higher brightness means more pixels have
  14688. same component color value on location in graph. This is the default mode.
  14689. @item color
  14690. Gray values are displayed on graph. Surrounding pixels values which are not
  14691. present in video frame are drawn in gradient of 2 color components which are
  14692. set by option @code{x} and @code{y}. The 3rd color component is static.
  14693. @item color2
  14694. Actual color components values present in video frame are displayed on graph.
  14695. @item color3
  14696. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  14697. on graph increases value of another color component, which is luminance by
  14698. default values of @code{x} and @code{y}.
  14699. @item color4
  14700. Actual colors present in video frame are displayed on graph. If two different
  14701. colors map to same position on graph then color with higher value of component
  14702. not present in graph is picked.
  14703. @item color5
  14704. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  14705. component picked from radial gradient.
  14706. @end table
  14707. @item x
  14708. Set which color component will be represented on X-axis. Default is @code{1}.
  14709. @item y
  14710. Set which color component will be represented on Y-axis. Default is @code{2}.
  14711. @item intensity, i
  14712. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  14713. of color component which represents frequency of (X, Y) location in graph.
  14714. @item envelope, e
  14715. @table @samp
  14716. @item none
  14717. No envelope, this is default.
  14718. @item instant
  14719. Instant envelope, even darkest single pixel will be clearly highlighted.
  14720. @item peak
  14721. Hold maximum and minimum values presented in graph over time. This way you
  14722. can still spot out of range values without constantly looking at vectorscope.
  14723. @item peak+instant
  14724. Peak and instant envelope combined together.
  14725. @end table
  14726. @item graticule, g
  14727. Set what kind of graticule to draw.
  14728. @table @samp
  14729. @item none
  14730. @item green
  14731. @item color
  14732. @item invert
  14733. @end table
  14734. @item opacity, o
  14735. Set graticule opacity.
  14736. @item flags, f
  14737. Set graticule flags.
  14738. @table @samp
  14739. @item white
  14740. Draw graticule for white point.
  14741. @item black
  14742. Draw graticule for black point.
  14743. @item name
  14744. Draw color points short names.
  14745. @end table
  14746. @item bgopacity, b
  14747. Set background opacity.
  14748. @item lthreshold, l
  14749. Set low threshold for color component not represented on X or Y axis.
  14750. Values lower than this value will be ignored. Default is 0.
  14751. Note this value is multiplied with actual max possible value one pixel component
  14752. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  14753. is 0.1 * 255 = 25.
  14754. @item hthreshold, h
  14755. Set high threshold for color component not represented on X or Y axis.
  14756. Values higher than this value will be ignored. Default is 1.
  14757. Note this value is multiplied with actual max possible value one pixel component
  14758. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  14759. is 0.9 * 255 = 230.
  14760. @item colorspace, c
  14761. Set what kind of colorspace to use when drawing graticule.
  14762. @table @samp
  14763. @item auto
  14764. @item 601
  14765. @item 709
  14766. @end table
  14767. Default is auto.
  14768. @item tint0, t0
  14769. @item tint1, t1
  14770. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  14771. This means no tint, and output will remain gray.
  14772. @end table
  14773. @anchor{vidstabdetect}
  14774. @section vidstabdetect
  14775. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  14776. @ref{vidstabtransform} for pass 2.
  14777. This filter generates a file with relative translation and rotation
  14778. transform information about subsequent frames, which is then used by
  14779. the @ref{vidstabtransform} filter.
  14780. To enable compilation of this filter you need to configure FFmpeg with
  14781. @code{--enable-libvidstab}.
  14782. This filter accepts the following options:
  14783. @table @option
  14784. @item result
  14785. Set the path to the file used to write the transforms information.
  14786. Default value is @file{transforms.trf}.
  14787. @item shakiness
  14788. Set how shaky the video is and how quick the camera is. It accepts an
  14789. integer in the range 1-10, a value of 1 means little shakiness, a
  14790. value of 10 means strong shakiness. Default value is 5.
  14791. @item accuracy
  14792. Set the accuracy of the detection process. It must be a value in the
  14793. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  14794. accuracy. Default value is 15.
  14795. @item stepsize
  14796. Set stepsize of the search process. The region around minimum is
  14797. scanned with 1 pixel resolution. Default value is 6.
  14798. @item mincontrast
  14799. Set minimum contrast. Below this value a local measurement field is
  14800. discarded. Must be a floating point value in the range 0-1. Default
  14801. value is 0.3.
  14802. @item tripod
  14803. Set reference frame number for tripod mode.
  14804. If enabled, the motion of the frames is compared to a reference frame
  14805. in the filtered stream, identified by the specified number. The idea
  14806. is to compensate all movements in a more-or-less static scene and keep
  14807. the camera view absolutely still.
  14808. If set to 0, it is disabled. The frames are counted starting from 1.
  14809. @item show
  14810. Show fields and transforms in the resulting frames. It accepts an
  14811. integer in the range 0-2. Default value is 0, which disables any
  14812. visualization.
  14813. @end table
  14814. @subsection Examples
  14815. @itemize
  14816. @item
  14817. Use default values:
  14818. @example
  14819. vidstabdetect
  14820. @end example
  14821. @item
  14822. Analyze strongly shaky movie and put the results in file
  14823. @file{mytransforms.trf}:
  14824. @example
  14825. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  14826. @end example
  14827. @item
  14828. Visualize the result of internal transformations in the resulting
  14829. video:
  14830. @example
  14831. vidstabdetect=show=1
  14832. @end example
  14833. @item
  14834. Analyze a video with medium shakiness using @command{ffmpeg}:
  14835. @example
  14836. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  14837. @end example
  14838. @end itemize
  14839. @anchor{vidstabtransform}
  14840. @section vidstabtransform
  14841. Video stabilization/deshaking: pass 2 of 2,
  14842. see @ref{vidstabdetect} for pass 1.
  14843. Read a file with transform information for each frame and
  14844. apply/compensate them. Together with the @ref{vidstabdetect}
  14845. filter this can be used to deshake videos. See also
  14846. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  14847. the @ref{unsharp} filter, see below.
  14848. To enable compilation of this filter you need to configure FFmpeg with
  14849. @code{--enable-libvidstab}.
  14850. @subsection Options
  14851. @table @option
  14852. @item input
  14853. Set path to the file used to read the transforms. Default value is
  14854. @file{transforms.trf}.
  14855. @item smoothing
  14856. Set the number of frames (value*2 + 1) used for lowpass filtering the
  14857. camera movements. Default value is 10.
  14858. For example a number of 10 means that 21 frames are used (10 in the
  14859. past and 10 in the future) to smoothen the motion in the video. A
  14860. larger value leads to a smoother video, but limits the acceleration of
  14861. the camera (pan/tilt movements). 0 is a special case where a static
  14862. camera is simulated.
  14863. @item optalgo
  14864. Set the camera path optimization algorithm.
  14865. Accepted values are:
  14866. @table @samp
  14867. @item gauss
  14868. gaussian kernel low-pass filter on camera motion (default)
  14869. @item avg
  14870. averaging on transformations
  14871. @end table
  14872. @item maxshift
  14873. Set maximal number of pixels to translate frames. Default value is -1,
  14874. meaning no limit.
  14875. @item maxangle
  14876. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  14877. value is -1, meaning no limit.
  14878. @item crop
  14879. Specify how to deal with borders that may be visible due to movement
  14880. compensation.
  14881. Available values are:
  14882. @table @samp
  14883. @item keep
  14884. keep image information from previous frame (default)
  14885. @item black
  14886. fill the border black
  14887. @end table
  14888. @item invert
  14889. Invert transforms if set to 1. Default value is 0.
  14890. @item relative
  14891. Consider transforms as relative to previous frame if set to 1,
  14892. absolute if set to 0. Default value is 0.
  14893. @item zoom
  14894. Set percentage to zoom. A positive value will result in a zoom-in
  14895. effect, a negative value in a zoom-out effect. Default value is 0 (no
  14896. zoom).
  14897. @item optzoom
  14898. Set optimal zooming to avoid borders.
  14899. Accepted values are:
  14900. @table @samp
  14901. @item 0
  14902. disabled
  14903. @item 1
  14904. optimal static zoom value is determined (only very strong movements
  14905. will lead to visible borders) (default)
  14906. @item 2
  14907. optimal adaptive zoom value is determined (no borders will be
  14908. visible), see @option{zoomspeed}
  14909. @end table
  14910. Note that the value given at zoom is added to the one calculated here.
  14911. @item zoomspeed
  14912. Set percent to zoom maximally each frame (enabled when
  14913. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  14914. 0.25.
  14915. @item interpol
  14916. Specify type of interpolation.
  14917. Available values are:
  14918. @table @samp
  14919. @item no
  14920. no interpolation
  14921. @item linear
  14922. linear only horizontal
  14923. @item bilinear
  14924. linear in both directions (default)
  14925. @item bicubic
  14926. cubic in both directions (slow)
  14927. @end table
  14928. @item tripod
  14929. Enable virtual tripod mode if set to 1, which is equivalent to
  14930. @code{relative=0:smoothing=0}. Default value is 0.
  14931. Use also @code{tripod} option of @ref{vidstabdetect}.
  14932. @item debug
  14933. Increase log verbosity if set to 1. Also the detected global motions
  14934. are written to the temporary file @file{global_motions.trf}. Default
  14935. value is 0.
  14936. @end table
  14937. @subsection Examples
  14938. @itemize
  14939. @item
  14940. Use @command{ffmpeg} for a typical stabilization with default values:
  14941. @example
  14942. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  14943. @end example
  14944. Note the use of the @ref{unsharp} filter which is always recommended.
  14945. @item
  14946. Zoom in a bit more and load transform data from a given file:
  14947. @example
  14948. vidstabtransform=zoom=5:input="mytransforms.trf"
  14949. @end example
  14950. @item
  14951. Smoothen the video even more:
  14952. @example
  14953. vidstabtransform=smoothing=30
  14954. @end example
  14955. @end itemize
  14956. @section vflip
  14957. Flip the input video vertically.
  14958. For example, to vertically flip a video with @command{ffmpeg}:
  14959. @example
  14960. ffmpeg -i in.avi -vf "vflip" out.avi
  14961. @end example
  14962. @section vfrdet
  14963. Detect variable frame rate video.
  14964. This filter tries to detect if the input is variable or constant frame rate.
  14965. At end it will output number of frames detected as having variable delta pts,
  14966. and ones with constant delta pts.
  14967. If there was frames with variable delta, than it will also show min, max and
  14968. average delta encountered.
  14969. @section vibrance
  14970. Boost or alter saturation.
  14971. The filter accepts the following options:
  14972. @table @option
  14973. @item intensity
  14974. Set strength of boost if positive value or strength of alter if negative value.
  14975. Default is 0. Allowed range is from -2 to 2.
  14976. @item rbal
  14977. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  14978. @item gbal
  14979. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  14980. @item bbal
  14981. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  14982. @item rlum
  14983. Set the red luma coefficient.
  14984. @item glum
  14985. Set the green luma coefficient.
  14986. @item blum
  14987. Set the blue luma coefficient.
  14988. @item alternate
  14989. If @code{intensity} is negative and this is set to 1, colors will change,
  14990. otherwise colors will be less saturated, more towards gray.
  14991. @end table
  14992. @subsection Commands
  14993. This filter supports the all above options as @ref{commands}.
  14994. @anchor{vignette}
  14995. @section vignette
  14996. Make or reverse a natural vignetting effect.
  14997. The filter accepts the following options:
  14998. @table @option
  14999. @item angle, a
  15000. Set lens angle expression as a number of radians.
  15001. The value is clipped in the @code{[0,PI/2]} range.
  15002. Default value: @code{"PI/5"}
  15003. @item x0
  15004. @item y0
  15005. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  15006. by default.
  15007. @item mode
  15008. Set forward/backward mode.
  15009. Available modes are:
  15010. @table @samp
  15011. @item forward
  15012. The larger the distance from the central point, the darker the image becomes.
  15013. @item backward
  15014. The larger the distance from the central point, the brighter the image becomes.
  15015. This can be used to reverse a vignette effect, though there is no automatic
  15016. detection to extract the lens @option{angle} and other settings (yet). It can
  15017. also be used to create a burning effect.
  15018. @end table
  15019. Default value is @samp{forward}.
  15020. @item eval
  15021. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  15022. It accepts the following values:
  15023. @table @samp
  15024. @item init
  15025. Evaluate expressions only once during the filter initialization.
  15026. @item frame
  15027. Evaluate expressions for each incoming frame. This is way slower than the
  15028. @samp{init} mode since it requires all the scalers to be re-computed, but it
  15029. allows advanced dynamic expressions.
  15030. @end table
  15031. Default value is @samp{init}.
  15032. @item dither
  15033. Set dithering to reduce the circular banding effects. Default is @code{1}
  15034. (enabled).
  15035. @item aspect
  15036. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  15037. Setting this value to the SAR of the input will make a rectangular vignetting
  15038. following the dimensions of the video.
  15039. Default is @code{1/1}.
  15040. @end table
  15041. @subsection Expressions
  15042. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  15043. following parameters.
  15044. @table @option
  15045. @item w
  15046. @item h
  15047. input width and height
  15048. @item n
  15049. the number of input frame, starting from 0
  15050. @item pts
  15051. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  15052. @var{TB} units, NAN if undefined
  15053. @item r
  15054. frame rate of the input video, NAN if the input frame rate is unknown
  15055. @item t
  15056. the PTS (Presentation TimeStamp) of the filtered video frame,
  15057. expressed in seconds, NAN if undefined
  15058. @item tb
  15059. time base of the input video
  15060. @end table
  15061. @subsection Examples
  15062. @itemize
  15063. @item
  15064. Apply simple strong vignetting effect:
  15065. @example
  15066. vignette=PI/4
  15067. @end example
  15068. @item
  15069. Make a flickering vignetting:
  15070. @example
  15071. vignette='PI/4+random(1)*PI/50':eval=frame
  15072. @end example
  15073. @end itemize
  15074. @section vmafmotion
  15075. Obtain the average VMAF motion score of a video.
  15076. It is one of the component metrics of VMAF.
  15077. The obtained average motion score is printed through the logging system.
  15078. The filter accepts the following options:
  15079. @table @option
  15080. @item stats_file
  15081. If specified, the filter will use the named file to save the motion score of
  15082. each frame with respect to the previous frame.
  15083. When filename equals "-" the data is sent to standard output.
  15084. @end table
  15085. Example:
  15086. @example
  15087. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  15088. @end example
  15089. @section vstack
  15090. Stack input videos vertically.
  15091. All streams must be of same pixel format and of same width.
  15092. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  15093. to create same output.
  15094. The filter accepts the following options:
  15095. @table @option
  15096. @item inputs
  15097. Set number of input streams. Default is 2.
  15098. @item shortest
  15099. If set to 1, force the output to terminate when the shortest input
  15100. terminates. Default value is 0.
  15101. @end table
  15102. @section w3fdif
  15103. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  15104. Deinterlacing Filter").
  15105. Based on the process described by Martin Weston for BBC R&D, and
  15106. implemented based on the de-interlace algorithm written by Jim
  15107. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  15108. uses filter coefficients calculated by BBC R&D.
  15109. This filter uses field-dominance information in frame to decide which
  15110. of each pair of fields to place first in the output.
  15111. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  15112. There are two sets of filter coefficients, so called "simple"
  15113. and "complex". Which set of filter coefficients is used can
  15114. be set by passing an optional parameter:
  15115. @table @option
  15116. @item filter
  15117. Set the interlacing filter coefficients. Accepts one of the following values:
  15118. @table @samp
  15119. @item simple
  15120. Simple filter coefficient set.
  15121. @item complex
  15122. More-complex filter coefficient set.
  15123. @end table
  15124. Default value is @samp{complex}.
  15125. @item deint
  15126. Specify which frames to deinterlace. Accepts one of the following values:
  15127. @table @samp
  15128. @item all
  15129. Deinterlace all frames,
  15130. @item interlaced
  15131. Only deinterlace frames marked as interlaced.
  15132. @end table
  15133. Default value is @samp{all}.
  15134. @end table
  15135. @section waveform
  15136. Video waveform monitor.
  15137. The waveform monitor plots color component intensity. By default luminance
  15138. only. Each column of the waveform corresponds to a column of pixels in the
  15139. source video.
  15140. It accepts the following options:
  15141. @table @option
  15142. @item mode, m
  15143. Can be either @code{row}, or @code{column}. Default is @code{column}.
  15144. In row mode, the graph on the left side represents color component value 0 and
  15145. the right side represents value = 255. In column mode, the top side represents
  15146. color component value = 0 and bottom side represents value = 255.
  15147. @item intensity, i
  15148. Set intensity. Smaller values are useful to find out how many values of the same
  15149. luminance are distributed across input rows/columns.
  15150. Default value is @code{0.04}. Allowed range is [0, 1].
  15151. @item mirror, r
  15152. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  15153. In mirrored mode, higher values will be represented on the left
  15154. side for @code{row} mode and at the top for @code{column} mode. Default is
  15155. @code{1} (mirrored).
  15156. @item display, d
  15157. Set display mode.
  15158. It accepts the following values:
  15159. @table @samp
  15160. @item overlay
  15161. Presents information identical to that in the @code{parade}, except
  15162. that the graphs representing color components are superimposed directly
  15163. over one another.
  15164. This display mode makes it easier to spot relative differences or similarities
  15165. in overlapping areas of the color components that are supposed to be identical,
  15166. such as neutral whites, grays, or blacks.
  15167. @item stack
  15168. Display separate graph for the color components side by side in
  15169. @code{row} mode or one below the other in @code{column} mode.
  15170. @item parade
  15171. Display separate graph for the color components side by side in
  15172. @code{column} mode or one below the other in @code{row} mode.
  15173. Using this display mode makes it easy to spot color casts in the highlights
  15174. and shadows of an image, by comparing the contours of the top and the bottom
  15175. graphs of each waveform. Since whites, grays, and blacks are characterized
  15176. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  15177. should display three waveforms of roughly equal width/height. If not, the
  15178. correction is easy to perform by making level adjustments the three waveforms.
  15179. @end table
  15180. Default is @code{stack}.
  15181. @item components, c
  15182. Set which color components to display. Default is 1, which means only luminance
  15183. or red color component if input is in RGB colorspace. If is set for example to
  15184. 7 it will display all 3 (if) available color components.
  15185. @item envelope, e
  15186. @table @samp
  15187. @item none
  15188. No envelope, this is default.
  15189. @item instant
  15190. Instant envelope, minimum and maximum values presented in graph will be easily
  15191. visible even with small @code{step} value.
  15192. @item peak
  15193. Hold minimum and maximum values presented in graph across time. This way you
  15194. can still spot out of range values without constantly looking at waveforms.
  15195. @item peak+instant
  15196. Peak and instant envelope combined together.
  15197. @end table
  15198. @item filter, f
  15199. @table @samp
  15200. @item lowpass
  15201. No filtering, this is default.
  15202. @item flat
  15203. Luma and chroma combined together.
  15204. @item aflat
  15205. Similar as above, but shows difference between blue and red chroma.
  15206. @item xflat
  15207. Similar as above, but use different colors.
  15208. @item yflat
  15209. Similar as above, but again with different colors.
  15210. @item chroma
  15211. Displays only chroma.
  15212. @item color
  15213. Displays actual color value on waveform.
  15214. @item acolor
  15215. Similar as above, but with luma showing frequency of chroma values.
  15216. @end table
  15217. @item graticule, g
  15218. Set which graticule to display.
  15219. @table @samp
  15220. @item none
  15221. Do not display graticule.
  15222. @item green
  15223. Display green graticule showing legal broadcast ranges.
  15224. @item orange
  15225. Display orange graticule showing legal broadcast ranges.
  15226. @item invert
  15227. Display invert graticule showing legal broadcast ranges.
  15228. @end table
  15229. @item opacity, o
  15230. Set graticule opacity.
  15231. @item flags, fl
  15232. Set graticule flags.
  15233. @table @samp
  15234. @item numbers
  15235. Draw numbers above lines. By default enabled.
  15236. @item dots
  15237. Draw dots instead of lines.
  15238. @end table
  15239. @item scale, s
  15240. Set scale used for displaying graticule.
  15241. @table @samp
  15242. @item digital
  15243. @item millivolts
  15244. @item ire
  15245. @end table
  15246. Default is digital.
  15247. @item bgopacity, b
  15248. Set background opacity.
  15249. @item tint0, t0
  15250. @item tint1, t1
  15251. Set tint for output.
  15252. Only used with lowpass filter and when display is not overlay and input
  15253. pixel formats are not RGB.
  15254. @end table
  15255. @section weave, doubleweave
  15256. The @code{weave} takes a field-based video input and join
  15257. each two sequential fields into single frame, producing a new double
  15258. height clip with half the frame rate and half the frame count.
  15259. The @code{doubleweave} works same as @code{weave} but without
  15260. halving frame rate and frame count.
  15261. It accepts the following option:
  15262. @table @option
  15263. @item first_field
  15264. Set first field. Available values are:
  15265. @table @samp
  15266. @item top, t
  15267. Set the frame as top-field-first.
  15268. @item bottom, b
  15269. Set the frame as bottom-field-first.
  15270. @end table
  15271. @end table
  15272. @subsection Examples
  15273. @itemize
  15274. @item
  15275. Interlace video using @ref{select} and @ref{separatefields} filter:
  15276. @example
  15277. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  15278. @end example
  15279. @end itemize
  15280. @section xbr
  15281. Apply the xBR high-quality magnification filter which is designed for pixel
  15282. art. It follows a set of edge-detection rules, see
  15283. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  15284. It accepts the following option:
  15285. @table @option
  15286. @item n
  15287. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  15288. @code{3xBR} and @code{4} for @code{4xBR}.
  15289. Default is @code{3}.
  15290. @end table
  15291. @section xfade
  15292. Apply cross fade from one input video stream to another input video stream.
  15293. The cross fade is applied for specified duration.
  15294. The filter accepts the following options:
  15295. @table @option
  15296. @item transition
  15297. Set one of available transition effects:
  15298. @table @samp
  15299. @item custom
  15300. @item fade
  15301. @item wipeleft
  15302. @item wiperight
  15303. @item wipeup
  15304. @item wipedown
  15305. @item slideleft
  15306. @item slideright
  15307. @item slideup
  15308. @item slidedown
  15309. @item circlecrop
  15310. @item rectcrop
  15311. @item distance
  15312. @item fadeblack
  15313. @item fadewhite
  15314. @item radial
  15315. @item smoothleft
  15316. @item smoothright
  15317. @item smoothup
  15318. @item smoothdown
  15319. @item circleopen
  15320. @item circleclose
  15321. @item vertopen
  15322. @item vertclose
  15323. @item horzopen
  15324. @item horzclose
  15325. @item dissolve
  15326. @item pixelize
  15327. @item diagtl
  15328. @item diagtr
  15329. @item diagbl
  15330. @item diagbr
  15331. @item hlslice
  15332. @item hrslice
  15333. @item vuslice
  15334. @item vdslice
  15335. @end table
  15336. Default transition effect is fade.
  15337. @item duration
  15338. Set cross fade duration in seconds.
  15339. Default duration is 1 second.
  15340. @item offset
  15341. Set cross fade start relative to first input stream in seconds.
  15342. Default offset is 0.
  15343. @item expr
  15344. Set expression for custom transition effect.
  15345. The expressions can use the following variables and functions:
  15346. @table @option
  15347. @item X
  15348. @item Y
  15349. The coordinates of the current sample.
  15350. @item W
  15351. @item H
  15352. The width and height of the image.
  15353. @item P
  15354. Progress of transition effect.
  15355. @item PLANE
  15356. Currently processed plane.
  15357. @item A
  15358. Return value of first input at current location and plane.
  15359. @item B
  15360. Return value of second input at current location and plane.
  15361. @item a0(x, y)
  15362. @item a1(x, y)
  15363. @item a2(x, y)
  15364. @item a3(x, y)
  15365. Return the value of the pixel at location (@var{x},@var{y}) of the
  15366. first/second/third/fourth component of first input.
  15367. @item b0(x, y)
  15368. @item b1(x, y)
  15369. @item b2(x, y)
  15370. @item b3(x, y)
  15371. Return the value of the pixel at location (@var{x},@var{y}) of the
  15372. first/second/third/fourth component of second input.
  15373. @end table
  15374. @end table
  15375. @subsection Examples
  15376. @itemize
  15377. @item
  15378. Cross fade from one input video to another input video, with fade transition and duration of transition
  15379. of 2 seconds starting at offset of 5 seconds:
  15380. @example
  15381. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  15382. @end example
  15383. @end itemize
  15384. @section xmedian
  15385. Pick median pixels from several input videos.
  15386. The filter accepts the following options:
  15387. @table @option
  15388. @item inputs
  15389. Set number of inputs.
  15390. Default is 3. Allowed range is from 3 to 255.
  15391. If number of inputs is even number, than result will be mean value between two median values.
  15392. @item planes
  15393. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  15394. @item percentile
  15395. Set median percentile. Default value is @code{0.5}.
  15396. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  15397. minimum values, and @code{1} maximum values.
  15398. @end table
  15399. @section xstack
  15400. Stack video inputs into custom layout.
  15401. All streams must be of same pixel format.
  15402. The filter accepts the following options:
  15403. @table @option
  15404. @item inputs
  15405. Set number of input streams. Default is 2.
  15406. @item layout
  15407. Specify layout of inputs.
  15408. This option requires the desired layout configuration to be explicitly set by the user.
  15409. This sets position of each video input in output. Each input
  15410. is separated by '|'.
  15411. The first number represents the column, and the second number represents the row.
  15412. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  15413. where X is video input from which to take width or height.
  15414. Multiple values can be used when separated by '+'. In such
  15415. case values are summed together.
  15416. Note that if inputs are of different sizes gaps may appear, as not all of
  15417. the output video frame will be filled. Similarly, videos can overlap each
  15418. other if their position doesn't leave enough space for the full frame of
  15419. adjoining videos.
  15420. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  15421. a layout must be set by the user.
  15422. @item shortest
  15423. If set to 1, force the output to terminate when the shortest input
  15424. terminates. Default value is 0.
  15425. @item fill
  15426. If set to valid color, all unused pixels will be filled with that color.
  15427. By default fill is set to none, so it is disabled.
  15428. @end table
  15429. @subsection Examples
  15430. @itemize
  15431. @item
  15432. Display 4 inputs into 2x2 grid.
  15433. Layout:
  15434. @example
  15435. input1(0, 0) | input3(w0, 0)
  15436. input2(0, h0) | input4(w0, h0)
  15437. @end example
  15438. @example
  15439. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  15440. @end example
  15441. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15442. @item
  15443. Display 4 inputs into 1x4 grid.
  15444. Layout:
  15445. @example
  15446. input1(0, 0)
  15447. input2(0, h0)
  15448. input3(0, h0+h1)
  15449. input4(0, h0+h1+h2)
  15450. @end example
  15451. @example
  15452. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  15453. @end example
  15454. Note that if inputs are of different widths, unused space will appear.
  15455. @item
  15456. Display 9 inputs into 3x3 grid.
  15457. Layout:
  15458. @example
  15459. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  15460. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  15461. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  15462. @end example
  15463. @example
  15464. xstack=inputs=9:layout=0_0|0_h0|0_h0+h1|w0_0|w0_h0|w0_h0+h1|w0+w3_0|w0+w3_h0|w0+w3_h0+h1
  15465. @end example
  15466. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15467. @item
  15468. Display 16 inputs into 4x4 grid.
  15469. Layout:
  15470. @example
  15471. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  15472. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  15473. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  15474. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  15475. @end example
  15476. @example
  15477. xstack=inputs=16:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2|w0_0|w0_h0|w0_h0+h1|w0_h0+h1+h2|w0+w4_0|
  15478. w0+w4_h0|w0+w4_h0+h1|w0+w4_h0+h1+h2|w0+w4+w8_0|w0+w4+w8_h0|w0+w4+w8_h0+h1|w0+w4+w8_h0+h1+h2
  15479. @end example
  15480. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15481. @end itemize
  15482. @anchor{yadif}
  15483. @section yadif
  15484. Deinterlace the input video ("yadif" means "yet another deinterlacing
  15485. filter").
  15486. It accepts the following parameters:
  15487. @table @option
  15488. @item mode
  15489. The interlacing mode to adopt. It accepts one of the following values:
  15490. @table @option
  15491. @item 0, send_frame
  15492. Output one frame for each frame.
  15493. @item 1, send_field
  15494. Output one frame for each field.
  15495. @item 2, send_frame_nospatial
  15496. Like @code{send_frame}, but it skips the spatial interlacing check.
  15497. @item 3, send_field_nospatial
  15498. Like @code{send_field}, but it skips the spatial interlacing check.
  15499. @end table
  15500. The default value is @code{send_frame}.
  15501. @item parity
  15502. The picture field parity assumed for the input interlaced video. It accepts one
  15503. of the following values:
  15504. @table @option
  15505. @item 0, tff
  15506. Assume the top field is first.
  15507. @item 1, bff
  15508. Assume the bottom field is first.
  15509. @item -1, auto
  15510. Enable automatic detection of field parity.
  15511. @end table
  15512. The default value is @code{auto}.
  15513. If the interlacing is unknown or the decoder does not export this information,
  15514. top field first will be assumed.
  15515. @item deint
  15516. Specify which frames to deinterlace. Accepts one of the following
  15517. values:
  15518. @table @option
  15519. @item 0, all
  15520. Deinterlace all frames.
  15521. @item 1, interlaced
  15522. Only deinterlace frames marked as interlaced.
  15523. @end table
  15524. The default value is @code{all}.
  15525. @end table
  15526. @section yadif_cuda
  15527. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  15528. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  15529. and/or nvenc.
  15530. It accepts the following parameters:
  15531. @table @option
  15532. @item mode
  15533. The interlacing mode to adopt. It accepts one of the following values:
  15534. @table @option
  15535. @item 0, send_frame
  15536. Output one frame for each frame.
  15537. @item 1, send_field
  15538. Output one frame for each field.
  15539. @item 2, send_frame_nospatial
  15540. Like @code{send_frame}, but it skips the spatial interlacing check.
  15541. @item 3, send_field_nospatial
  15542. Like @code{send_field}, but it skips the spatial interlacing check.
  15543. @end table
  15544. The default value is @code{send_frame}.
  15545. @item parity
  15546. The picture field parity assumed for the input interlaced video. It accepts one
  15547. of the following values:
  15548. @table @option
  15549. @item 0, tff
  15550. Assume the top field is first.
  15551. @item 1, bff
  15552. Assume the bottom field is first.
  15553. @item -1, auto
  15554. Enable automatic detection of field parity.
  15555. @end table
  15556. The default value is @code{auto}.
  15557. If the interlacing is unknown or the decoder does not export this information,
  15558. top field first will be assumed.
  15559. @item deint
  15560. Specify which frames to deinterlace. Accepts one of the following
  15561. values:
  15562. @table @option
  15563. @item 0, all
  15564. Deinterlace all frames.
  15565. @item 1, interlaced
  15566. Only deinterlace frames marked as interlaced.
  15567. @end table
  15568. The default value is @code{all}.
  15569. @end table
  15570. @section yaepblur
  15571. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  15572. The algorithm is described in
  15573. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  15574. It accepts the following parameters:
  15575. @table @option
  15576. @item radius, r
  15577. Set the window radius. Default value is 3.
  15578. @item planes, p
  15579. Set which planes to filter. Default is only the first plane.
  15580. @item sigma, s
  15581. Set blur strength. Default value is 128.
  15582. @end table
  15583. @subsection Commands
  15584. This filter supports same @ref{commands} as options.
  15585. @section zoompan
  15586. Apply Zoom & Pan effect.
  15587. This filter accepts the following options:
  15588. @table @option
  15589. @item zoom, z
  15590. Set the zoom expression. Range is 1-10. Default is 1.
  15591. @item x
  15592. @item y
  15593. Set the x and y expression. Default is 0.
  15594. @item d
  15595. Set the duration expression in number of frames.
  15596. This sets for how many number of frames effect will last for
  15597. single input image.
  15598. @item s
  15599. Set the output image size, default is 'hd720'.
  15600. @item fps
  15601. Set the output frame rate, default is '25'.
  15602. @end table
  15603. Each expression can contain the following constants:
  15604. @table @option
  15605. @item in_w, iw
  15606. Input width.
  15607. @item in_h, ih
  15608. Input height.
  15609. @item out_w, ow
  15610. Output width.
  15611. @item out_h, oh
  15612. Output height.
  15613. @item in
  15614. Input frame count.
  15615. @item on
  15616. Output frame count.
  15617. @item x
  15618. @item y
  15619. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  15620. for current input frame.
  15621. @item px
  15622. @item py
  15623. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  15624. not yet such frame (first input frame).
  15625. @item zoom
  15626. Last calculated zoom from 'z' expression for current input frame.
  15627. @item pzoom
  15628. Last calculated zoom of last output frame of previous input frame.
  15629. @item duration
  15630. Number of output frames for current input frame. Calculated from 'd' expression
  15631. for each input frame.
  15632. @item pduration
  15633. number of output frames created for previous input frame
  15634. @item a
  15635. Rational number: input width / input height
  15636. @item sar
  15637. sample aspect ratio
  15638. @item dar
  15639. display aspect ratio
  15640. @end table
  15641. @subsection Examples
  15642. @itemize
  15643. @item
  15644. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  15645. @example
  15646. 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
  15647. @end example
  15648. @item
  15649. Zoom-in up to 1.5 and pan always at center of picture:
  15650. @example
  15651. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  15652. @end example
  15653. @item
  15654. Same as above but without pausing:
  15655. @example
  15656. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  15657. @end example
  15658. @end itemize
  15659. @anchor{zscale}
  15660. @section zscale
  15661. Scale (resize) the input video, using the z.lib library:
  15662. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  15663. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  15664. The zscale filter forces the output display aspect ratio to be the same
  15665. as the input, by changing the output sample aspect ratio.
  15666. If the input image format is different from the format requested by
  15667. the next filter, the zscale filter will convert the input to the
  15668. requested format.
  15669. @subsection Options
  15670. The filter accepts the following options.
  15671. @table @option
  15672. @item width, w
  15673. @item height, h
  15674. Set the output video dimension expression. Default value is the input
  15675. dimension.
  15676. If the @var{width} or @var{w} value is 0, the input width is used for
  15677. the output. If the @var{height} or @var{h} value is 0, the input height
  15678. is used for the output.
  15679. If one and only one of the values is -n with n >= 1, the zscale filter
  15680. will use a value that maintains the aspect ratio of the input image,
  15681. calculated from the other specified dimension. After that it will,
  15682. however, make sure that the calculated dimension is divisible by n and
  15683. adjust the value if necessary.
  15684. If both values are -n with n >= 1, the behavior will be identical to
  15685. both values being set to 0 as previously detailed.
  15686. See below for the list of accepted constants for use in the dimension
  15687. expression.
  15688. @item size, s
  15689. Set the video size. For the syntax of this option, check the
  15690. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15691. @item dither, d
  15692. Set the dither type.
  15693. Possible values are:
  15694. @table @var
  15695. @item none
  15696. @item ordered
  15697. @item random
  15698. @item error_diffusion
  15699. @end table
  15700. Default is none.
  15701. @item filter, f
  15702. Set the resize filter type.
  15703. Possible values are:
  15704. @table @var
  15705. @item point
  15706. @item bilinear
  15707. @item bicubic
  15708. @item spline16
  15709. @item spline36
  15710. @item lanczos
  15711. @end table
  15712. Default is bilinear.
  15713. @item range, r
  15714. Set the color range.
  15715. Possible values are:
  15716. @table @var
  15717. @item input
  15718. @item limited
  15719. @item full
  15720. @end table
  15721. Default is same as input.
  15722. @item primaries, p
  15723. Set the color primaries.
  15724. Possible values are:
  15725. @table @var
  15726. @item input
  15727. @item 709
  15728. @item unspecified
  15729. @item 170m
  15730. @item 240m
  15731. @item 2020
  15732. @end table
  15733. Default is same as input.
  15734. @item transfer, t
  15735. Set the transfer characteristics.
  15736. Possible values are:
  15737. @table @var
  15738. @item input
  15739. @item 709
  15740. @item unspecified
  15741. @item 601
  15742. @item linear
  15743. @item 2020_10
  15744. @item 2020_12
  15745. @item smpte2084
  15746. @item iec61966-2-1
  15747. @item arib-std-b67
  15748. @end table
  15749. Default is same as input.
  15750. @item matrix, m
  15751. Set the colorspace matrix.
  15752. Possible value are:
  15753. @table @var
  15754. @item input
  15755. @item 709
  15756. @item unspecified
  15757. @item 470bg
  15758. @item 170m
  15759. @item 2020_ncl
  15760. @item 2020_cl
  15761. @end table
  15762. Default is same as input.
  15763. @item rangein, rin
  15764. Set the input color range.
  15765. Possible values are:
  15766. @table @var
  15767. @item input
  15768. @item limited
  15769. @item full
  15770. @end table
  15771. Default is same as input.
  15772. @item primariesin, pin
  15773. Set the input color primaries.
  15774. Possible values are:
  15775. @table @var
  15776. @item input
  15777. @item 709
  15778. @item unspecified
  15779. @item 170m
  15780. @item 240m
  15781. @item 2020
  15782. @end table
  15783. Default is same as input.
  15784. @item transferin, tin
  15785. Set the input transfer characteristics.
  15786. Possible values are:
  15787. @table @var
  15788. @item input
  15789. @item 709
  15790. @item unspecified
  15791. @item 601
  15792. @item linear
  15793. @item 2020_10
  15794. @item 2020_12
  15795. @end table
  15796. Default is same as input.
  15797. @item matrixin, min
  15798. Set the input colorspace matrix.
  15799. Possible value are:
  15800. @table @var
  15801. @item input
  15802. @item 709
  15803. @item unspecified
  15804. @item 470bg
  15805. @item 170m
  15806. @item 2020_ncl
  15807. @item 2020_cl
  15808. @end table
  15809. @item chromal, c
  15810. Set the output chroma location.
  15811. Possible values are:
  15812. @table @var
  15813. @item input
  15814. @item left
  15815. @item center
  15816. @item topleft
  15817. @item top
  15818. @item bottomleft
  15819. @item bottom
  15820. @end table
  15821. @item chromalin, cin
  15822. Set the input chroma location.
  15823. Possible values are:
  15824. @table @var
  15825. @item input
  15826. @item left
  15827. @item center
  15828. @item topleft
  15829. @item top
  15830. @item bottomleft
  15831. @item bottom
  15832. @end table
  15833. @item npl
  15834. Set the nominal peak luminance.
  15835. @end table
  15836. The values of the @option{w} and @option{h} options are expressions
  15837. containing the following constants:
  15838. @table @var
  15839. @item in_w
  15840. @item in_h
  15841. The input width and height
  15842. @item iw
  15843. @item ih
  15844. These are the same as @var{in_w} and @var{in_h}.
  15845. @item out_w
  15846. @item out_h
  15847. The output (scaled) width and height
  15848. @item ow
  15849. @item oh
  15850. These are the same as @var{out_w} and @var{out_h}
  15851. @item a
  15852. The same as @var{iw} / @var{ih}
  15853. @item sar
  15854. input sample aspect ratio
  15855. @item dar
  15856. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  15857. @item hsub
  15858. @item vsub
  15859. horizontal and vertical input chroma subsample values. For example for the
  15860. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15861. @item ohsub
  15862. @item ovsub
  15863. horizontal and vertical output chroma subsample values. For example for the
  15864. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15865. @end table
  15866. @subsection Commands
  15867. This filter supports the following commands:
  15868. @table @option
  15869. @item width, w
  15870. @item height, h
  15871. Set the output video dimension expression.
  15872. The command accepts the same syntax of the corresponding option.
  15873. If the specified expression is not valid, it is kept at its current
  15874. value.
  15875. @end table
  15876. @c man end VIDEO FILTERS
  15877. @chapter OpenCL Video Filters
  15878. @c man begin OPENCL VIDEO FILTERS
  15879. Below is a description of the currently available OpenCL video filters.
  15880. To enable compilation of these filters you need to configure FFmpeg with
  15881. @code{--enable-opencl}.
  15882. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  15883. @table @option
  15884. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  15885. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  15886. given device parameters.
  15887. @item -filter_hw_device @var{name}
  15888. Pass the hardware device called @var{name} to all filters in any filter graph.
  15889. @end table
  15890. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  15891. @itemize
  15892. @item
  15893. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  15894. @example
  15895. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  15896. @end example
  15897. @end itemize
  15898. 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.
  15899. @section avgblur_opencl
  15900. Apply average blur filter.
  15901. The filter accepts the following options:
  15902. @table @option
  15903. @item sizeX
  15904. Set horizontal radius size.
  15905. Range is @code{[1, 1024]} and default value is @code{1}.
  15906. @item planes
  15907. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15908. @item sizeY
  15909. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  15910. @end table
  15911. @subsection Example
  15912. @itemize
  15913. @item
  15914. 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.
  15915. @example
  15916. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  15917. @end example
  15918. @end itemize
  15919. @section boxblur_opencl
  15920. Apply a boxblur algorithm to the input video.
  15921. It accepts the following parameters:
  15922. @table @option
  15923. @item luma_radius, lr
  15924. @item luma_power, lp
  15925. @item chroma_radius, cr
  15926. @item chroma_power, cp
  15927. @item alpha_radius, ar
  15928. @item alpha_power, ap
  15929. @end table
  15930. A description of the accepted options follows.
  15931. @table @option
  15932. @item luma_radius, lr
  15933. @item chroma_radius, cr
  15934. @item alpha_radius, ar
  15935. Set an expression for the box radius in pixels used for blurring the
  15936. corresponding input plane.
  15937. The radius value must be a non-negative number, and must not be
  15938. greater than the value of the expression @code{min(w,h)/2} for the
  15939. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  15940. planes.
  15941. Default value for @option{luma_radius} is "2". If not specified,
  15942. @option{chroma_radius} and @option{alpha_radius} default to the
  15943. corresponding value set for @option{luma_radius}.
  15944. The expressions can contain the following constants:
  15945. @table @option
  15946. @item w
  15947. @item h
  15948. The input width and height in pixels.
  15949. @item cw
  15950. @item ch
  15951. The input chroma image width and height in pixels.
  15952. @item hsub
  15953. @item vsub
  15954. The horizontal and vertical chroma subsample values. For example, for the
  15955. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  15956. @end table
  15957. @item luma_power, lp
  15958. @item chroma_power, cp
  15959. @item alpha_power, ap
  15960. Specify how many times the boxblur filter is applied to the
  15961. corresponding plane.
  15962. Default value for @option{luma_power} is 2. If not specified,
  15963. @option{chroma_power} and @option{alpha_power} default to the
  15964. corresponding value set for @option{luma_power}.
  15965. A value of 0 will disable the effect.
  15966. @end table
  15967. @subsection Examples
  15968. 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.
  15969. @itemize
  15970. @item
  15971. Apply a boxblur filter with the luma, chroma, and alpha radius
  15972. 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.
  15973. @example
  15974. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  15975. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  15976. @end example
  15977. @item
  15978. 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.
  15979. For the luma plane, a 2x2 box radius will be run once.
  15980. For the chroma plane, a 4x4 box radius will be run 5 times.
  15981. For the alpha plane, a 3x3 box radius will be run 7 times.
  15982. @example
  15983. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  15984. @end example
  15985. @end itemize
  15986. @section colorkey_opencl
  15987. RGB colorspace color keying.
  15988. The filter accepts the following options:
  15989. @table @option
  15990. @item color
  15991. The color which will be replaced with transparency.
  15992. @item similarity
  15993. Similarity percentage with the key color.
  15994. 0.01 matches only the exact key color, while 1.0 matches everything.
  15995. @item blend
  15996. Blend percentage.
  15997. 0.0 makes pixels either fully transparent, or not transparent at all.
  15998. Higher values result in semi-transparent pixels, with a higher transparency
  15999. the more similar the pixels color is to the key color.
  16000. @end table
  16001. @subsection Examples
  16002. @itemize
  16003. @item
  16004. Make every semi-green pixel in the input transparent with some slight blending:
  16005. @example
  16006. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  16007. @end example
  16008. @end itemize
  16009. @section convolution_opencl
  16010. Apply convolution of 3x3, 5x5, 7x7 matrix.
  16011. The filter accepts the following options:
  16012. @table @option
  16013. @item 0m
  16014. @item 1m
  16015. @item 2m
  16016. @item 3m
  16017. Set matrix for each plane.
  16018. Matrix is sequence of 9, 25 or 49 signed numbers.
  16019. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  16020. @item 0rdiv
  16021. @item 1rdiv
  16022. @item 2rdiv
  16023. @item 3rdiv
  16024. Set multiplier for calculated value for each plane.
  16025. If unset or 0, it will be sum of all matrix elements.
  16026. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  16027. @item 0bias
  16028. @item 1bias
  16029. @item 2bias
  16030. @item 3bias
  16031. Set bias for each plane. This value is added to the result of the multiplication.
  16032. Useful for making the overall image brighter or darker.
  16033. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  16034. @end table
  16035. @subsection Examples
  16036. @itemize
  16037. @item
  16038. Apply sharpen:
  16039. @example
  16040. -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
  16041. @end example
  16042. @item
  16043. Apply blur:
  16044. @example
  16045. -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
  16046. @end example
  16047. @item
  16048. Apply edge enhance:
  16049. @example
  16050. -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
  16051. @end example
  16052. @item
  16053. Apply edge detect:
  16054. @example
  16055. -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
  16056. @end example
  16057. @item
  16058. Apply laplacian edge detector which includes diagonals:
  16059. @example
  16060. -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
  16061. @end example
  16062. @item
  16063. Apply emboss:
  16064. @example
  16065. -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
  16066. @end example
  16067. @end itemize
  16068. @section erosion_opencl
  16069. Apply erosion effect to the video.
  16070. This filter replaces the pixel by the local(3x3) minimum.
  16071. It accepts the following options:
  16072. @table @option
  16073. @item threshold0
  16074. @item threshold1
  16075. @item threshold2
  16076. @item threshold3
  16077. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16078. If @code{0}, plane will remain unchanged.
  16079. @item coordinates
  16080. Flag which specifies the pixel to refer to.
  16081. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16082. Flags to local 3x3 coordinates region centered on @code{x}:
  16083. 1 2 3
  16084. 4 x 5
  16085. 6 7 8
  16086. @end table
  16087. @subsection Example
  16088. @itemize
  16089. @item
  16090. 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.
  16091. @example
  16092. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16093. @end example
  16094. @end itemize
  16095. @section deshake_opencl
  16096. Feature-point based video stabilization filter.
  16097. The filter accepts the following options:
  16098. @table @option
  16099. @item tripod
  16100. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  16101. @item debug
  16102. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  16103. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  16104. Viewing point matches in the output video is only supported for RGB input.
  16105. Defaults to @code{0}.
  16106. @item adaptive_crop
  16107. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  16108. Defaults to @code{1}.
  16109. @item refine_features
  16110. Whether or not feature points should be refined at a sub-pixel level.
  16111. This can be turned off for a slight performance gain at the cost of precision.
  16112. Defaults to @code{1}.
  16113. @item smooth_strength
  16114. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  16115. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  16116. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  16117. Defaults to @code{0.0}.
  16118. @item smooth_window_multiplier
  16119. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  16120. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  16121. Acceptable values range from @code{0.1} to @code{10.0}.
  16122. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  16123. potentially improving smoothness, but also increase latency and memory usage.
  16124. Defaults to @code{2.0}.
  16125. @end table
  16126. @subsection Examples
  16127. @itemize
  16128. @item
  16129. Stabilize a video with a fixed, medium smoothing strength:
  16130. @example
  16131. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  16132. @end example
  16133. @item
  16134. Stabilize a video with debugging (both in console and in rendered video):
  16135. @example
  16136. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  16137. @end example
  16138. @end itemize
  16139. @section dilation_opencl
  16140. Apply dilation effect to the video.
  16141. This filter replaces the pixel by the local(3x3) maximum.
  16142. It accepts the following options:
  16143. @table @option
  16144. @item threshold0
  16145. @item threshold1
  16146. @item threshold2
  16147. @item threshold3
  16148. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16149. If @code{0}, plane will remain unchanged.
  16150. @item coordinates
  16151. Flag which specifies the pixel to refer to.
  16152. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16153. Flags to local 3x3 coordinates region centered on @code{x}:
  16154. 1 2 3
  16155. 4 x 5
  16156. 6 7 8
  16157. @end table
  16158. @subsection Example
  16159. @itemize
  16160. @item
  16161. 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.
  16162. @example
  16163. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16164. @end example
  16165. @end itemize
  16166. @section nlmeans_opencl
  16167. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  16168. @section overlay_opencl
  16169. Overlay one video on top of another.
  16170. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  16171. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  16172. The filter accepts the following options:
  16173. @table @option
  16174. @item x
  16175. Set the x coordinate of the overlaid video on the main video.
  16176. Default value is @code{0}.
  16177. @item y
  16178. Set the y coordinate of the overlaid video on the main video.
  16179. Default value is @code{0}.
  16180. @end table
  16181. @subsection Examples
  16182. @itemize
  16183. @item
  16184. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  16185. @example
  16186. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16187. @end example
  16188. @item
  16189. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  16190. @example
  16191. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16192. @end example
  16193. @end itemize
  16194. @section pad_opencl
  16195. Add paddings to the input image, and place the original input at the
  16196. provided @var{x}, @var{y} coordinates.
  16197. It accepts the following options:
  16198. @table @option
  16199. @item width, w
  16200. @item height, h
  16201. Specify an expression for the size of the output image with the
  16202. paddings added. If the value for @var{width} or @var{height} is 0, the
  16203. corresponding input size is used for the output.
  16204. The @var{width} expression can reference the value set by the
  16205. @var{height} expression, and vice versa.
  16206. The default value of @var{width} and @var{height} is 0.
  16207. @item x
  16208. @item y
  16209. Specify the offsets to place the input image at within the padded area,
  16210. with respect to the top/left border of the output image.
  16211. The @var{x} expression can reference the value set by the @var{y}
  16212. expression, and vice versa.
  16213. The default value of @var{x} and @var{y} is 0.
  16214. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  16215. so the input image is centered on the padded area.
  16216. @item color
  16217. Specify the color of the padded area. For the syntax of this option,
  16218. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  16219. manual,ffmpeg-utils}.
  16220. @item aspect
  16221. Pad to an aspect instead to a resolution.
  16222. @end table
  16223. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  16224. options are expressions containing the following constants:
  16225. @table @option
  16226. @item in_w
  16227. @item in_h
  16228. The input video width and height.
  16229. @item iw
  16230. @item ih
  16231. These are the same as @var{in_w} and @var{in_h}.
  16232. @item out_w
  16233. @item out_h
  16234. The output width and height (the size of the padded area), as
  16235. specified by the @var{width} and @var{height} expressions.
  16236. @item ow
  16237. @item oh
  16238. These are the same as @var{out_w} and @var{out_h}.
  16239. @item x
  16240. @item y
  16241. The x and y offsets as specified by the @var{x} and @var{y}
  16242. expressions, or NAN if not yet specified.
  16243. @item a
  16244. same as @var{iw} / @var{ih}
  16245. @item sar
  16246. input sample aspect ratio
  16247. @item dar
  16248. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  16249. @end table
  16250. @section prewitt_opencl
  16251. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  16252. The filter accepts the following option:
  16253. @table @option
  16254. @item planes
  16255. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16256. @item scale
  16257. Set value which will be multiplied with filtered result.
  16258. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16259. @item delta
  16260. Set value which will be added to filtered result.
  16261. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16262. @end table
  16263. @subsection Example
  16264. @itemize
  16265. @item
  16266. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  16267. @example
  16268. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16269. @end example
  16270. @end itemize
  16271. @anchor{program_opencl}
  16272. @section program_opencl
  16273. Filter video using an OpenCL program.
  16274. @table @option
  16275. @item source
  16276. OpenCL program source file.
  16277. @item kernel
  16278. Kernel name in program.
  16279. @item inputs
  16280. Number of inputs to the filter. Defaults to 1.
  16281. @item size, s
  16282. Size of output frames. Defaults to the same as the first input.
  16283. @end table
  16284. The @code{program_opencl} filter also supports the @ref{framesync} options.
  16285. The program source file must contain a kernel function with the given name,
  16286. which will be run once for each plane of the output. Each run on a plane
  16287. gets enqueued as a separate 2D global NDRange with one work-item for each
  16288. pixel to be generated. The global ID offset for each work-item is therefore
  16289. the coordinates of a pixel in the destination image.
  16290. The kernel function needs to take the following arguments:
  16291. @itemize
  16292. @item
  16293. Destination image, @var{__write_only image2d_t}.
  16294. This image will become the output; the kernel should write all of it.
  16295. @item
  16296. Frame index, @var{unsigned int}.
  16297. This is a counter starting from zero and increasing by one for each frame.
  16298. @item
  16299. Source images, @var{__read_only image2d_t}.
  16300. These are the most recent images on each input. The kernel may read from
  16301. them to generate the output, but they can't be written to.
  16302. @end itemize
  16303. Example programs:
  16304. @itemize
  16305. @item
  16306. Copy the input to the output (output must be the same size as the input).
  16307. @verbatim
  16308. __kernel void copy(__write_only image2d_t destination,
  16309. unsigned int index,
  16310. __read_only image2d_t source)
  16311. {
  16312. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  16313. int2 location = (int2)(get_global_id(0), get_global_id(1));
  16314. float4 value = read_imagef(source, sampler, location);
  16315. write_imagef(destination, location, value);
  16316. }
  16317. @end verbatim
  16318. @item
  16319. Apply a simple transformation, rotating the input by an amount increasing
  16320. with the index counter. Pixel values are linearly interpolated by the
  16321. sampler, and the output need not have the same dimensions as the input.
  16322. @verbatim
  16323. __kernel void rotate_image(__write_only image2d_t dst,
  16324. unsigned int index,
  16325. __read_only image2d_t src)
  16326. {
  16327. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16328. CLK_FILTER_LINEAR);
  16329. float angle = (float)index / 100.0f;
  16330. float2 dst_dim = convert_float2(get_image_dim(dst));
  16331. float2 src_dim = convert_float2(get_image_dim(src));
  16332. float2 dst_cen = dst_dim / 2.0f;
  16333. float2 src_cen = src_dim / 2.0f;
  16334. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  16335. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  16336. float2 src_pos = {
  16337. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  16338. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  16339. };
  16340. src_pos = src_pos * src_dim / dst_dim;
  16341. float2 src_loc = src_pos + src_cen;
  16342. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  16343. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  16344. write_imagef(dst, dst_loc, 0.5f);
  16345. else
  16346. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  16347. }
  16348. @end verbatim
  16349. @item
  16350. Blend two inputs together, with the amount of each input used varying
  16351. with the index counter.
  16352. @verbatim
  16353. __kernel void blend_images(__write_only image2d_t dst,
  16354. unsigned int index,
  16355. __read_only image2d_t src1,
  16356. __read_only image2d_t src2)
  16357. {
  16358. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16359. CLK_FILTER_LINEAR);
  16360. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  16361. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  16362. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  16363. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  16364. float4 val1 = read_imagef(src1, sampler, src1_loc);
  16365. float4 val2 = read_imagef(src2, sampler, src2_loc);
  16366. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  16367. }
  16368. @end verbatim
  16369. @end itemize
  16370. @section roberts_opencl
  16371. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  16372. The filter accepts the following option:
  16373. @table @option
  16374. @item planes
  16375. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16376. @item scale
  16377. Set value which will be multiplied with filtered result.
  16378. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16379. @item delta
  16380. Set value which will be added to filtered result.
  16381. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16382. @end table
  16383. @subsection Example
  16384. @itemize
  16385. @item
  16386. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  16387. @example
  16388. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16389. @end example
  16390. @end itemize
  16391. @section sobel_opencl
  16392. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  16393. The filter accepts the following option:
  16394. @table @option
  16395. @item planes
  16396. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16397. @item scale
  16398. Set value which will be multiplied with filtered result.
  16399. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16400. @item delta
  16401. Set value which will be added to filtered result.
  16402. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16403. @end table
  16404. @subsection Example
  16405. @itemize
  16406. @item
  16407. Apply sobel operator with scale set to 2 and delta set to 10
  16408. @example
  16409. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16410. @end example
  16411. @end itemize
  16412. @section tonemap_opencl
  16413. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  16414. It accepts the following parameters:
  16415. @table @option
  16416. @item tonemap
  16417. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  16418. @item param
  16419. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  16420. @item desat
  16421. Apply desaturation for highlights that exceed this level of brightness. The
  16422. higher the parameter, the more color information will be preserved. This
  16423. setting helps prevent unnaturally blown-out colors for super-highlights, by
  16424. (smoothly) turning into white instead. This makes images feel more natural,
  16425. at the cost of reducing information about out-of-range colors.
  16426. The default value is 0.5, and the algorithm here is a little different from
  16427. the cpu version tonemap currently. A setting of 0.0 disables this option.
  16428. @item threshold
  16429. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  16430. is used to detect whether the scene has changed or not. If the distance between
  16431. the current frame average brightness and the current running average exceeds
  16432. a threshold value, we would re-calculate scene average and peak brightness.
  16433. The default value is 0.2.
  16434. @item format
  16435. Specify the output pixel format.
  16436. Currently supported formats are:
  16437. @table @var
  16438. @item p010
  16439. @item nv12
  16440. @end table
  16441. @item range, r
  16442. Set the output color range.
  16443. Possible values are:
  16444. @table @var
  16445. @item tv/mpeg
  16446. @item pc/jpeg
  16447. @end table
  16448. Default is same as input.
  16449. @item primaries, p
  16450. Set the output color primaries.
  16451. Possible values are:
  16452. @table @var
  16453. @item bt709
  16454. @item bt2020
  16455. @end table
  16456. Default is same as input.
  16457. @item transfer, t
  16458. Set the output transfer characteristics.
  16459. Possible values are:
  16460. @table @var
  16461. @item bt709
  16462. @item bt2020
  16463. @end table
  16464. Default is bt709.
  16465. @item matrix, m
  16466. Set the output colorspace matrix.
  16467. Possible value are:
  16468. @table @var
  16469. @item bt709
  16470. @item bt2020
  16471. @end table
  16472. Default is same as input.
  16473. @end table
  16474. @subsection Example
  16475. @itemize
  16476. @item
  16477. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  16478. @example
  16479. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  16480. @end example
  16481. @end itemize
  16482. @section unsharp_opencl
  16483. Sharpen or blur the input video.
  16484. It accepts the following parameters:
  16485. @table @option
  16486. @item luma_msize_x, lx
  16487. Set the luma matrix horizontal size.
  16488. Range is @code{[1, 23]} and default value is @code{5}.
  16489. @item luma_msize_y, ly
  16490. Set the luma matrix vertical size.
  16491. Range is @code{[1, 23]} and default value is @code{5}.
  16492. @item luma_amount, la
  16493. Set the luma effect strength.
  16494. Range is @code{[-10, 10]} and default value is @code{1.0}.
  16495. Negative values will blur the input video, while positive values will
  16496. sharpen it, a value of zero will disable the effect.
  16497. @item chroma_msize_x, cx
  16498. Set the chroma matrix horizontal size.
  16499. Range is @code{[1, 23]} and default value is @code{5}.
  16500. @item chroma_msize_y, cy
  16501. Set the chroma matrix vertical size.
  16502. Range is @code{[1, 23]} and default value is @code{5}.
  16503. @item chroma_amount, ca
  16504. Set the chroma effect strength.
  16505. Range is @code{[-10, 10]} and default value is @code{0.0}.
  16506. Negative values will blur the input video, while positive values will
  16507. sharpen it, a value of zero will disable the effect.
  16508. @end table
  16509. All parameters are optional and default to the equivalent of the
  16510. string '5:5:1.0:5:5:0.0'.
  16511. @subsection Examples
  16512. @itemize
  16513. @item
  16514. Apply strong luma sharpen effect:
  16515. @example
  16516. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  16517. @end example
  16518. @item
  16519. Apply a strong blur of both luma and chroma parameters:
  16520. @example
  16521. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  16522. @end example
  16523. @end itemize
  16524. @section xfade_opencl
  16525. Cross fade two videos with custom transition effect by using OpenCL.
  16526. It accepts the following options:
  16527. @table @option
  16528. @item transition
  16529. Set one of possible transition effects.
  16530. @table @option
  16531. @item custom
  16532. Select custom transition effect, the actual transition description
  16533. will be picked from source and kernel options.
  16534. @item fade
  16535. @item wipeleft
  16536. @item wiperight
  16537. @item wipeup
  16538. @item wipedown
  16539. @item slideleft
  16540. @item slideright
  16541. @item slideup
  16542. @item slidedown
  16543. Default transition is fade.
  16544. @end table
  16545. @item source
  16546. OpenCL program source file for custom transition.
  16547. @item kernel
  16548. Set name of kernel to use for custom transition from program source file.
  16549. @item duration
  16550. Set duration of video transition.
  16551. @item offset
  16552. Set time of start of transition relative to first video.
  16553. @end table
  16554. The program source file must contain a kernel function with the given name,
  16555. which will be run once for each plane of the output. Each run on a plane
  16556. gets enqueued as a separate 2D global NDRange with one work-item for each
  16557. pixel to be generated. The global ID offset for each work-item is therefore
  16558. the coordinates of a pixel in the destination image.
  16559. The kernel function needs to take the following arguments:
  16560. @itemize
  16561. @item
  16562. Destination image, @var{__write_only image2d_t}.
  16563. This image will become the output; the kernel should write all of it.
  16564. @item
  16565. First Source image, @var{__read_only image2d_t}.
  16566. Second Source image, @var{__read_only image2d_t}.
  16567. These are the most recent images on each input. The kernel may read from
  16568. them to generate the output, but they can't be written to.
  16569. @item
  16570. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  16571. @end itemize
  16572. Example programs:
  16573. @itemize
  16574. @item
  16575. Apply dots curtain transition effect:
  16576. @verbatim
  16577. __kernel void blend_images(__write_only image2d_t dst,
  16578. __read_only image2d_t src1,
  16579. __read_only image2d_t src2,
  16580. float progress)
  16581. {
  16582. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16583. CLK_FILTER_LINEAR);
  16584. int2 p = (int2)(get_global_id(0), get_global_id(1));
  16585. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  16586. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  16587. rp = rp / dim;
  16588. float2 dots = (float2)(20.0, 20.0);
  16589. float2 center = (float2)(0,0);
  16590. float2 unused;
  16591. float4 val1 = read_imagef(src1, sampler, p);
  16592. float4 val2 = read_imagef(src2, sampler, p);
  16593. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  16594. write_imagef(dst, p, next ? val1 : val2);
  16595. }
  16596. @end verbatim
  16597. @end itemize
  16598. @c man end OPENCL VIDEO FILTERS
  16599. @chapter VAAPI Video Filters
  16600. @c man begin VAAPI VIDEO FILTERS
  16601. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  16602. To enable compilation of these filters you need to configure FFmpeg with
  16603. @code{--enable-vaapi}.
  16604. To use vaapi filters, you need to setup the vaapi device correctly. For more information, please read @url{https://trac.ffmpeg.org/wiki/Hardware/VAAPI}
  16605. @section tonemap_vaapi
  16606. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  16607. It maps the dynamic range of HDR10 content to the SDR content.
  16608. It currently only accepts HDR10 as input.
  16609. It accepts the following parameters:
  16610. @table @option
  16611. @item format
  16612. Specify the output pixel format.
  16613. Currently supported formats are:
  16614. @table @var
  16615. @item p010
  16616. @item nv12
  16617. @end table
  16618. Default is nv12.
  16619. @item primaries, p
  16620. Set the output color primaries.
  16621. Default is same as input.
  16622. @item transfer, t
  16623. Set the output transfer characteristics.
  16624. Default is bt709.
  16625. @item matrix, m
  16626. Set the output colorspace matrix.
  16627. Default is same as input.
  16628. @end table
  16629. @subsection Example
  16630. @itemize
  16631. @item
  16632. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  16633. @example
  16634. tonemap_vaapi=format=p010:t=bt2020-10
  16635. @end example
  16636. @end itemize
  16637. @c man end VAAPI VIDEO FILTERS
  16638. @chapter Video Sources
  16639. @c man begin VIDEO SOURCES
  16640. Below is a description of the currently available video sources.
  16641. @section buffer
  16642. Buffer video frames, and make them available to the filter chain.
  16643. This source is mainly intended for a programmatic use, in particular
  16644. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  16645. It accepts the following parameters:
  16646. @table @option
  16647. @item video_size
  16648. Specify the size (width and height) of the buffered video frames. For the
  16649. syntax of this option, check the
  16650. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16651. @item width
  16652. The input video width.
  16653. @item height
  16654. The input video height.
  16655. @item pix_fmt
  16656. A string representing the pixel format of the buffered video frames.
  16657. It may be a number corresponding to a pixel format, or a pixel format
  16658. name.
  16659. @item time_base
  16660. Specify the timebase assumed by the timestamps of the buffered frames.
  16661. @item frame_rate
  16662. Specify the frame rate expected for the video stream.
  16663. @item pixel_aspect, sar
  16664. The sample (pixel) aspect ratio of the input video.
  16665. @item sws_param
  16666. This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
  16667. to the filtergraph description to specify swscale flags for automatically
  16668. inserted scalers. See @ref{Filtergraph syntax}.
  16669. @item hw_frames_ctx
  16670. When using a hardware pixel format, this should be a reference to an
  16671. AVHWFramesContext describing input frames.
  16672. @end table
  16673. For example:
  16674. @example
  16675. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  16676. @end example
  16677. will instruct the source to accept video frames with size 320x240 and
  16678. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  16679. square pixels (1:1 sample aspect ratio).
  16680. Since the pixel format with name "yuv410p" corresponds to the number 6
  16681. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  16682. this example corresponds to:
  16683. @example
  16684. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  16685. @end example
  16686. Alternatively, the options can be specified as a flat string, but this
  16687. syntax is deprecated:
  16688. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  16689. @section cellauto
  16690. Create a pattern generated by an elementary cellular automaton.
  16691. The initial state of the cellular automaton can be defined through the
  16692. @option{filename} and @option{pattern} options. If such options are
  16693. not specified an initial state is created randomly.
  16694. At each new frame a new row in the video is filled with the result of
  16695. the cellular automaton next generation. The behavior when the whole
  16696. frame is filled is defined by the @option{scroll} option.
  16697. This source accepts the following options:
  16698. @table @option
  16699. @item filename, f
  16700. Read the initial cellular automaton state, i.e. the starting row, from
  16701. the specified file.
  16702. In the file, each non-whitespace character is considered an alive
  16703. cell, a newline will terminate the row, and further characters in the
  16704. file will be ignored.
  16705. @item pattern, p
  16706. Read the initial cellular automaton state, i.e. the starting row, from
  16707. the specified string.
  16708. Each non-whitespace character in the string is considered an alive
  16709. cell, a newline will terminate the row, and further characters in the
  16710. string will be ignored.
  16711. @item rate, r
  16712. Set the video rate, that is the number of frames generated per second.
  16713. Default is 25.
  16714. @item random_fill_ratio, ratio
  16715. Set the random fill ratio for the initial cellular automaton row. It
  16716. is a floating point number value ranging from 0 to 1, defaults to
  16717. 1/PHI.
  16718. This option is ignored when a file or a pattern is specified.
  16719. @item random_seed, seed
  16720. Set the seed for filling randomly the initial row, must be an integer
  16721. included between 0 and UINT32_MAX. If not specified, or if explicitly
  16722. set to -1, the filter will try to use a good random seed on a best
  16723. effort basis.
  16724. @item rule
  16725. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  16726. Default value is 110.
  16727. @item size, s
  16728. Set the size of the output video. For the syntax of this option, check the
  16729. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16730. If @option{filename} or @option{pattern} is specified, the size is set
  16731. by default to the width of the specified initial state row, and the
  16732. height is set to @var{width} * PHI.
  16733. If @option{size} is set, it must contain the width of the specified
  16734. pattern string, and the specified pattern will be centered in the
  16735. larger row.
  16736. If a filename or a pattern string is not specified, the size value
  16737. defaults to "320x518" (used for a randomly generated initial state).
  16738. @item scroll
  16739. If set to 1, scroll the output upward when all the rows in the output
  16740. have been already filled. If set to 0, the new generated row will be
  16741. written over the top row just after the bottom row is filled.
  16742. Defaults to 1.
  16743. @item start_full, full
  16744. If set to 1, completely fill the output with generated rows before
  16745. outputting the first frame.
  16746. This is the default behavior, for disabling set the value to 0.
  16747. @item stitch
  16748. If set to 1, stitch the left and right row edges together.
  16749. This is the default behavior, for disabling set the value to 0.
  16750. @end table
  16751. @subsection Examples
  16752. @itemize
  16753. @item
  16754. Read the initial state from @file{pattern}, and specify an output of
  16755. size 200x400.
  16756. @example
  16757. cellauto=f=pattern:s=200x400
  16758. @end example
  16759. @item
  16760. Generate a random initial row with a width of 200 cells, with a fill
  16761. ratio of 2/3:
  16762. @example
  16763. cellauto=ratio=2/3:s=200x200
  16764. @end example
  16765. @item
  16766. Create a pattern generated by rule 18 starting by a single alive cell
  16767. centered on an initial row with width 100:
  16768. @example
  16769. cellauto=p=@@:s=100x400:full=0:rule=18
  16770. @end example
  16771. @item
  16772. Specify a more elaborated initial pattern:
  16773. @example
  16774. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  16775. @end example
  16776. @end itemize
  16777. @anchor{coreimagesrc}
  16778. @section coreimagesrc
  16779. Video source generated on GPU using Apple's CoreImage API on OSX.
  16780. This video source is a specialized version of the @ref{coreimage} video filter.
  16781. Use a core image generator at the beginning of the applied filterchain to
  16782. generate the content.
  16783. The coreimagesrc video source accepts the following options:
  16784. @table @option
  16785. @item list_generators
  16786. List all available generators along with all their respective options as well as
  16787. possible minimum and maximum values along with the default values.
  16788. @example
  16789. list_generators=true
  16790. @end example
  16791. @item size, s
  16792. Specify the size of the sourced video. For the syntax of this option, check the
  16793. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16794. The default value is @code{320x240}.
  16795. @item rate, r
  16796. Specify the frame rate of the sourced video, as the number of frames
  16797. generated per second. It has to be a string in the format
  16798. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  16799. number or a valid video frame rate abbreviation. The default value is
  16800. "25".
  16801. @item sar
  16802. Set the sample aspect ratio of the sourced video.
  16803. @item duration, d
  16804. Set the duration of the sourced video. See
  16805. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16806. for the accepted syntax.
  16807. If not specified, or the expressed duration is negative, the video is
  16808. supposed to be generated forever.
  16809. @end table
  16810. Additionally, all options of the @ref{coreimage} video filter are accepted.
  16811. A complete filterchain can be used for further processing of the
  16812. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  16813. and examples for details.
  16814. @subsection Examples
  16815. @itemize
  16816. @item
  16817. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  16818. given as complete and escaped command-line for Apple's standard bash shell:
  16819. @example
  16820. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  16821. @end example
  16822. This example is equivalent to the QRCode example of @ref{coreimage} without the
  16823. need for a nullsrc video source.
  16824. @end itemize
  16825. @section mandelbrot
  16826. Generate a Mandelbrot set fractal, and progressively zoom towards the
  16827. point specified with @var{start_x} and @var{start_y}.
  16828. This source accepts the following options:
  16829. @table @option
  16830. @item end_pts
  16831. Set the terminal pts value. Default value is 400.
  16832. @item end_scale
  16833. Set the terminal scale value.
  16834. Must be a floating point value. Default value is 0.3.
  16835. @item inner
  16836. Set the inner coloring mode, that is the algorithm used to draw the
  16837. Mandelbrot fractal internal region.
  16838. It shall assume one of the following values:
  16839. @table @option
  16840. @item black
  16841. Set black mode.
  16842. @item convergence
  16843. Show time until convergence.
  16844. @item mincol
  16845. Set color based on point closest to the origin of the iterations.
  16846. @item period
  16847. Set period mode.
  16848. @end table
  16849. Default value is @var{mincol}.
  16850. @item bailout
  16851. Set the bailout value. Default value is 10.0.
  16852. @item maxiter
  16853. Set the maximum of iterations performed by the rendering
  16854. algorithm. Default value is 7189.
  16855. @item outer
  16856. Set outer coloring mode.
  16857. It shall assume one of following values:
  16858. @table @option
  16859. @item iteration_count
  16860. Set iteration count mode.
  16861. @item normalized_iteration_count
  16862. set normalized iteration count mode.
  16863. @end table
  16864. Default value is @var{normalized_iteration_count}.
  16865. @item rate, r
  16866. Set frame rate, expressed as number of frames per second. Default
  16867. value is "25".
  16868. @item size, s
  16869. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  16870. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  16871. @item start_scale
  16872. Set the initial scale value. Default value is 3.0.
  16873. @item start_x
  16874. Set the initial x position. Must be a floating point value between
  16875. -100 and 100. Default value is -0.743643887037158704752191506114774.
  16876. @item start_y
  16877. Set the initial y position. Must be a floating point value between
  16878. -100 and 100. Default value is -0.131825904205311970493132056385139.
  16879. @end table
  16880. @section mptestsrc
  16881. Generate various test patterns, as generated by the MPlayer test filter.
  16882. The size of the generated video is fixed, and is 256x256.
  16883. This source is useful in particular for testing encoding features.
  16884. This source accepts the following options:
  16885. @table @option
  16886. @item rate, r
  16887. Specify the frame rate of the sourced video, as the number of frames
  16888. generated per second. It has to be a string in the format
  16889. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  16890. number or a valid video frame rate abbreviation. The default value is
  16891. "25".
  16892. @item duration, d
  16893. Set the duration of the sourced video. See
  16894. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16895. for the accepted syntax.
  16896. If not specified, or the expressed duration is negative, the video is
  16897. supposed to be generated forever.
  16898. @item test, t
  16899. Set the number or the name of the test to perform. Supported tests are:
  16900. @table @option
  16901. @item dc_luma
  16902. @item dc_chroma
  16903. @item freq_luma
  16904. @item freq_chroma
  16905. @item amp_luma
  16906. @item amp_chroma
  16907. @item cbp
  16908. @item mv
  16909. @item ring1
  16910. @item ring2
  16911. @item all
  16912. @item max_frames, m
  16913. Set the maximum number of frames generated for each test, default value is 30.
  16914. @end table
  16915. Default value is "all", which will cycle through the list of all tests.
  16916. @end table
  16917. Some examples:
  16918. @example
  16919. mptestsrc=t=dc_luma
  16920. @end example
  16921. will generate a "dc_luma" test pattern.
  16922. @section frei0r_src
  16923. Provide a frei0r source.
  16924. To enable compilation of this filter you need to install the frei0r
  16925. header and configure FFmpeg with @code{--enable-frei0r}.
  16926. This source accepts the following parameters:
  16927. @table @option
  16928. @item size
  16929. The size of the video to generate. For the syntax of this option, check the
  16930. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16931. @item framerate
  16932. The framerate of the generated video. It may be a string of the form
  16933. @var{num}/@var{den} or a frame rate abbreviation.
  16934. @item filter_name
  16935. The name to the frei0r source to load. For more information regarding frei0r and
  16936. how to set the parameters, read the @ref{frei0r} section in the video filters
  16937. documentation.
  16938. @item filter_params
  16939. A '|'-separated list of parameters to pass to the frei0r source.
  16940. @end table
  16941. For example, to generate a frei0r partik0l source with size 200x200
  16942. and frame rate 10 which is overlaid on the overlay filter main input:
  16943. @example
  16944. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  16945. @end example
  16946. @section life
  16947. Generate a life pattern.
  16948. This source is based on a generalization of John Conway's life game.
  16949. The sourced input represents a life grid, each pixel represents a cell
  16950. which can be in one of two possible states, alive or dead. Every cell
  16951. interacts with its eight neighbours, which are the cells that are
  16952. horizontally, vertically, or diagonally adjacent.
  16953. At each interaction the grid evolves according to the adopted rule,
  16954. which specifies the number of neighbor alive cells which will make a
  16955. cell stay alive or born. The @option{rule} option allows one to specify
  16956. the rule to adopt.
  16957. This source accepts the following options:
  16958. @table @option
  16959. @item filename, f
  16960. Set the file from which to read the initial grid state. In the file,
  16961. each non-whitespace character is considered an alive cell, and newline
  16962. is used to delimit the end of each row.
  16963. If this option is not specified, the initial grid is generated
  16964. randomly.
  16965. @item rate, r
  16966. Set the video rate, that is the number of frames generated per second.
  16967. Default is 25.
  16968. @item random_fill_ratio, ratio
  16969. Set the random fill ratio for the initial random grid. It is a
  16970. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  16971. It is ignored when a file is specified.
  16972. @item random_seed, seed
  16973. Set the seed for filling the initial random grid, must be an integer
  16974. included between 0 and UINT32_MAX. If not specified, or if explicitly
  16975. set to -1, the filter will try to use a good random seed on a best
  16976. effort basis.
  16977. @item rule
  16978. Set the life rule.
  16979. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  16980. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  16981. @var{NS} specifies the number of alive neighbor cells which make a
  16982. live cell stay alive, and @var{NB} the number of alive neighbor cells
  16983. which make a dead cell to become alive (i.e. to "born").
  16984. "s" and "b" can be used in place of "S" and "B", respectively.
  16985. Alternatively a rule can be specified by an 18-bits integer. The 9
  16986. high order bits are used to encode the next cell state if it is alive
  16987. for each number of neighbor alive cells, the low order bits specify
  16988. the rule for "borning" new cells. Higher order bits encode for an
  16989. higher number of neighbor cells.
  16990. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  16991. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  16992. Default value is "S23/B3", which is the original Conway's game of life
  16993. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  16994. cells, and will born a new cell if there are three alive cells around
  16995. a dead cell.
  16996. @item size, s
  16997. Set the size of the output video. For the syntax of this option, check the
  16998. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16999. If @option{filename} is specified, the size is set by default to the
  17000. same size of the input file. If @option{size} is set, it must contain
  17001. the size specified in the input file, and the initial grid defined in
  17002. that file is centered in the larger resulting area.
  17003. If a filename is not specified, the size value defaults to "320x240"
  17004. (used for a randomly generated initial grid).
  17005. @item stitch
  17006. If set to 1, stitch the left and right grid edges together, and the
  17007. top and bottom edges also. Defaults to 1.
  17008. @item mold
  17009. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  17010. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  17011. value from 0 to 255.
  17012. @item life_color
  17013. Set the color of living (or new born) cells.
  17014. @item death_color
  17015. Set the color of dead cells. If @option{mold} is set, this is the first color
  17016. used to represent a dead cell.
  17017. @item mold_color
  17018. Set mold color, for definitely dead and moldy cells.
  17019. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  17020. ffmpeg-utils manual,ffmpeg-utils}.
  17021. @end table
  17022. @subsection Examples
  17023. @itemize
  17024. @item
  17025. Read a grid from @file{pattern}, and center it on a grid of size
  17026. 300x300 pixels:
  17027. @example
  17028. life=f=pattern:s=300x300
  17029. @end example
  17030. @item
  17031. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  17032. @example
  17033. life=ratio=2/3:s=200x200
  17034. @end example
  17035. @item
  17036. Specify a custom rule for evolving a randomly generated grid:
  17037. @example
  17038. life=rule=S14/B34
  17039. @end example
  17040. @item
  17041. Full example with slow death effect (mold) using @command{ffplay}:
  17042. @example
  17043. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  17044. @end example
  17045. @end itemize
  17046. @anchor{allrgb}
  17047. @anchor{allyuv}
  17048. @anchor{color}
  17049. @anchor{haldclutsrc}
  17050. @anchor{nullsrc}
  17051. @anchor{pal75bars}
  17052. @anchor{pal100bars}
  17053. @anchor{rgbtestsrc}
  17054. @anchor{smptebars}
  17055. @anchor{smptehdbars}
  17056. @anchor{testsrc}
  17057. @anchor{testsrc2}
  17058. @anchor{yuvtestsrc}
  17059. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  17060. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  17061. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  17062. The @code{color} source provides an uniformly colored input.
  17063. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  17064. @ref{haldclut} filter.
  17065. The @code{nullsrc} source returns unprocessed video frames. It is
  17066. mainly useful to be employed in analysis / debugging tools, or as the
  17067. source for filters which ignore the input data.
  17068. The @code{pal75bars} source generates a color bars pattern, based on
  17069. EBU PAL recommendations with 75% color levels.
  17070. The @code{pal100bars} source generates a color bars pattern, based on
  17071. EBU PAL recommendations with 100% color levels.
  17072. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  17073. detecting RGB vs BGR issues. You should see a red, green and blue
  17074. stripe from top to bottom.
  17075. The @code{smptebars} source generates a color bars pattern, based on
  17076. the SMPTE Engineering Guideline EG 1-1990.
  17077. The @code{smptehdbars} source generates a color bars pattern, based on
  17078. the SMPTE RP 219-2002.
  17079. The @code{testsrc} source generates a test video pattern, showing a
  17080. color pattern, a scrolling gradient and a timestamp. This is mainly
  17081. intended for testing purposes.
  17082. The @code{testsrc2} source is similar to testsrc, but supports more
  17083. pixel formats instead of just @code{rgb24}. This allows using it as an
  17084. input for other tests without requiring a format conversion.
  17085. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  17086. see a y, cb and cr stripe from top to bottom.
  17087. The sources accept the following parameters:
  17088. @table @option
  17089. @item level
  17090. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  17091. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  17092. pixels to be used as identity matrix for 3D lookup tables. Each component is
  17093. coded on a @code{1/(N*N)} scale.
  17094. @item color, c
  17095. Specify the color of the source, only available in the @code{color}
  17096. source. For the syntax of this option, check the
  17097. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17098. @item size, s
  17099. Specify the size of the sourced video. For the syntax of this option, check the
  17100. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17101. The default value is @code{320x240}.
  17102. This option is not available with the @code{allrgb}, @code{allyuv}, and
  17103. @code{haldclutsrc} filters.
  17104. @item rate, r
  17105. Specify the frame rate of the sourced video, as the number of frames
  17106. generated per second. It has to be a string in the format
  17107. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17108. number or a valid video frame rate abbreviation. The default value is
  17109. "25".
  17110. @item duration, d
  17111. Set the duration of the sourced video. See
  17112. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17113. for the accepted syntax.
  17114. If not specified, or the expressed duration is negative, the video is
  17115. supposed to be generated forever.
  17116. @item sar
  17117. Set the sample aspect ratio of the sourced video.
  17118. @item alpha
  17119. Specify the alpha (opacity) of the background, only available in the
  17120. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  17121. 255 (fully opaque, the default).
  17122. @item decimals, n
  17123. Set the number of decimals to show in the timestamp, only available in the
  17124. @code{testsrc} source.
  17125. The displayed timestamp value will correspond to the original
  17126. timestamp value multiplied by the power of 10 of the specified
  17127. value. Default value is 0.
  17128. @end table
  17129. @subsection Examples
  17130. @itemize
  17131. @item
  17132. Generate a video with a duration of 5.3 seconds, with size
  17133. 176x144 and a frame rate of 10 frames per second:
  17134. @example
  17135. testsrc=duration=5.3:size=qcif:rate=10
  17136. @end example
  17137. @item
  17138. The following graph description will generate a red source
  17139. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  17140. frames per second:
  17141. @example
  17142. color=c=red@@0.2:s=qcif:r=10
  17143. @end example
  17144. @item
  17145. If the input content is to be ignored, @code{nullsrc} can be used. The
  17146. following command generates noise in the luminance plane by employing
  17147. the @code{geq} filter:
  17148. @example
  17149. nullsrc=s=256x256, geq=random(1)*255:128:128
  17150. @end example
  17151. @end itemize
  17152. @subsection Commands
  17153. The @code{color} source supports the following commands:
  17154. @table @option
  17155. @item c, color
  17156. Set the color of the created image. Accepts the same syntax of the
  17157. corresponding @option{color} option.
  17158. @end table
  17159. @section openclsrc
  17160. Generate video using an OpenCL program.
  17161. @table @option
  17162. @item source
  17163. OpenCL program source file.
  17164. @item kernel
  17165. Kernel name in program.
  17166. @item size, s
  17167. Size of frames to generate. This must be set.
  17168. @item format
  17169. Pixel format to use for the generated frames. This must be set.
  17170. @item rate, r
  17171. Number of frames generated every second. Default value is '25'.
  17172. @end table
  17173. For details of how the program loading works, see the @ref{program_opencl}
  17174. filter.
  17175. Example programs:
  17176. @itemize
  17177. @item
  17178. Generate a colour ramp by setting pixel values from the position of the pixel
  17179. in the output image. (Note that this will work with all pixel formats, but
  17180. the generated output will not be the same.)
  17181. @verbatim
  17182. __kernel void ramp(__write_only image2d_t dst,
  17183. unsigned int index)
  17184. {
  17185. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17186. float4 val;
  17187. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  17188. write_imagef(dst, loc, val);
  17189. }
  17190. @end verbatim
  17191. @item
  17192. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  17193. @verbatim
  17194. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  17195. unsigned int index)
  17196. {
  17197. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17198. float4 value = 0.0f;
  17199. int x = loc.x + index;
  17200. int y = loc.y + index;
  17201. while (x > 0 || y > 0) {
  17202. if (x % 3 == 1 && y % 3 == 1) {
  17203. value = 1.0f;
  17204. break;
  17205. }
  17206. x /= 3;
  17207. y /= 3;
  17208. }
  17209. write_imagef(dst, loc, value);
  17210. }
  17211. @end verbatim
  17212. @end itemize
  17213. @section sierpinski
  17214. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  17215. This source accepts the following options:
  17216. @table @option
  17217. @item size, s
  17218. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17219. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17220. @item rate, r
  17221. Set frame rate, expressed as number of frames per second. Default
  17222. value is "25".
  17223. @item seed
  17224. Set seed which is used for random panning.
  17225. @item jump
  17226. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  17227. @item type
  17228. Set fractal type, can be default @code{carpet} or @code{triangle}.
  17229. @end table
  17230. @c man end VIDEO SOURCES
  17231. @chapter Video Sinks
  17232. @c man begin VIDEO SINKS
  17233. Below is a description of the currently available video sinks.
  17234. @section buffersink
  17235. Buffer video frames, and make them available to the end of the filter
  17236. graph.
  17237. This sink is mainly intended for programmatic use, in particular
  17238. through the interface defined in @file{libavfilter/buffersink.h}
  17239. or the options system.
  17240. It accepts a pointer to an AVBufferSinkContext structure, which
  17241. defines the incoming buffers' formats, to be passed as the opaque
  17242. parameter to @code{avfilter_init_filter} for initialization.
  17243. @section nullsink
  17244. Null video sink: do absolutely nothing with the input video. It is
  17245. mainly useful as a template and for use in analysis / debugging
  17246. tools.
  17247. @c man end VIDEO SINKS
  17248. @chapter Multimedia Filters
  17249. @c man begin MULTIMEDIA FILTERS
  17250. Below is a description of the currently available multimedia filters.
  17251. @section abitscope
  17252. Convert input audio to a video output, displaying the audio bit scope.
  17253. The filter accepts the following options:
  17254. @table @option
  17255. @item rate, r
  17256. Set frame rate, expressed as number of frames per second. Default
  17257. value is "25".
  17258. @item size, s
  17259. Specify the video size for the output. For the syntax of this option, check the
  17260. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17261. Default value is @code{1024x256}.
  17262. @item colors
  17263. Specify list of colors separated by space or by '|' which will be used to
  17264. draw channels. Unrecognized or missing colors will be replaced
  17265. by white color.
  17266. @end table
  17267. @section adrawgraph
  17268. Draw a graph using input audio metadata.
  17269. See @ref{drawgraph}
  17270. @section agraphmonitor
  17271. See @ref{graphmonitor}.
  17272. @section ahistogram
  17273. Convert input audio to a video output, displaying the volume histogram.
  17274. The filter accepts the following options:
  17275. @table @option
  17276. @item dmode
  17277. Specify how histogram is calculated.
  17278. It accepts the following values:
  17279. @table @samp
  17280. @item single
  17281. Use single histogram for all channels.
  17282. @item separate
  17283. Use separate histogram for each channel.
  17284. @end table
  17285. Default is @code{single}.
  17286. @item rate, r
  17287. Set frame rate, expressed as number of frames per second. Default
  17288. value is "25".
  17289. @item size, s
  17290. Specify the video size for the output. For the syntax of this option, check the
  17291. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17292. Default value is @code{hd720}.
  17293. @item scale
  17294. Set display scale.
  17295. It accepts the following values:
  17296. @table @samp
  17297. @item log
  17298. logarithmic
  17299. @item sqrt
  17300. square root
  17301. @item cbrt
  17302. cubic root
  17303. @item lin
  17304. linear
  17305. @item rlog
  17306. reverse logarithmic
  17307. @end table
  17308. Default is @code{log}.
  17309. @item ascale
  17310. Set amplitude scale.
  17311. It accepts the following values:
  17312. @table @samp
  17313. @item log
  17314. logarithmic
  17315. @item lin
  17316. linear
  17317. @end table
  17318. Default is @code{log}.
  17319. @item acount
  17320. Set how much frames to accumulate in histogram.
  17321. Default is 1. Setting this to -1 accumulates all frames.
  17322. @item rheight
  17323. Set histogram ratio of window height.
  17324. @item slide
  17325. Set sonogram sliding.
  17326. It accepts the following values:
  17327. @table @samp
  17328. @item replace
  17329. replace old rows with new ones.
  17330. @item scroll
  17331. scroll from top to bottom.
  17332. @end table
  17333. Default is @code{replace}.
  17334. @end table
  17335. @section aphasemeter
  17336. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  17337. representing mean phase of current audio frame. A video output can also be produced and is
  17338. enabled by default. The audio is passed through as first output.
  17339. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  17340. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  17341. and @code{1} means channels are in phase.
  17342. The filter accepts the following options, all related to its video output:
  17343. @table @option
  17344. @item rate, r
  17345. Set the output frame rate. Default value is @code{25}.
  17346. @item size, s
  17347. Set the video size for the output. For the syntax of this option, check the
  17348. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17349. Default value is @code{800x400}.
  17350. @item rc
  17351. @item gc
  17352. @item bc
  17353. Specify the red, green, blue contrast. Default values are @code{2},
  17354. @code{7} and @code{1}.
  17355. Allowed range is @code{[0, 255]}.
  17356. @item mpc
  17357. Set color which will be used for drawing median phase. If color is
  17358. @code{none} which is default, no median phase value will be drawn.
  17359. @item video
  17360. Enable video output. Default is enabled.
  17361. @end table
  17362. @section avectorscope
  17363. Convert input audio to a video output, representing the audio vector
  17364. scope.
  17365. The filter is used to measure the difference between channels of stereo
  17366. audio stream. A monaural signal, consisting of identical left and right
  17367. signal, results in straight vertical line. Any stereo separation is visible
  17368. as a deviation from this line, creating a Lissajous figure.
  17369. If the straight (or deviation from it) but horizontal line appears this
  17370. indicates that the left and right channels are out of phase.
  17371. The filter accepts the following options:
  17372. @table @option
  17373. @item mode, m
  17374. Set the vectorscope mode.
  17375. Available values are:
  17376. @table @samp
  17377. @item lissajous
  17378. Lissajous rotated by 45 degrees.
  17379. @item lissajous_xy
  17380. Same as above but not rotated.
  17381. @item polar
  17382. Shape resembling half of circle.
  17383. @end table
  17384. Default value is @samp{lissajous}.
  17385. @item size, s
  17386. Set the video size for the output. For the syntax of this option, check the
  17387. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17388. Default value is @code{400x400}.
  17389. @item rate, r
  17390. Set the output frame rate. Default value is @code{25}.
  17391. @item rc
  17392. @item gc
  17393. @item bc
  17394. @item ac
  17395. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  17396. @code{160}, @code{80} and @code{255}.
  17397. Allowed range is @code{[0, 255]}.
  17398. @item rf
  17399. @item gf
  17400. @item bf
  17401. @item af
  17402. Specify the red, green, blue and alpha fade. Default values are @code{15},
  17403. @code{10}, @code{5} and @code{5}.
  17404. Allowed range is @code{[0, 255]}.
  17405. @item zoom
  17406. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  17407. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  17408. @item draw
  17409. Set the vectorscope drawing mode.
  17410. Available values are:
  17411. @table @samp
  17412. @item dot
  17413. Draw dot for each sample.
  17414. @item line
  17415. Draw line between previous and current sample.
  17416. @end table
  17417. Default value is @samp{dot}.
  17418. @item scale
  17419. Specify amplitude scale of audio samples.
  17420. Available values are:
  17421. @table @samp
  17422. @item lin
  17423. Linear.
  17424. @item sqrt
  17425. Square root.
  17426. @item cbrt
  17427. Cubic root.
  17428. @item log
  17429. Logarithmic.
  17430. @end table
  17431. @item swap
  17432. Swap left channel axis with right channel axis.
  17433. @item mirror
  17434. Mirror axis.
  17435. @table @samp
  17436. @item none
  17437. No mirror.
  17438. @item x
  17439. Mirror only x axis.
  17440. @item y
  17441. Mirror only y axis.
  17442. @item xy
  17443. Mirror both axis.
  17444. @end table
  17445. @end table
  17446. @subsection Examples
  17447. @itemize
  17448. @item
  17449. Complete example using @command{ffplay}:
  17450. @example
  17451. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  17452. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  17453. @end example
  17454. @end itemize
  17455. @section bench, abench
  17456. Benchmark part of a filtergraph.
  17457. The filter accepts the following options:
  17458. @table @option
  17459. @item action
  17460. Start or stop a timer.
  17461. Available values are:
  17462. @table @samp
  17463. @item start
  17464. Get the current time, set it as frame metadata (using the key
  17465. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  17466. @item stop
  17467. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  17468. the input frame metadata to get the time difference. Time difference, average,
  17469. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  17470. @code{min}) are then printed. The timestamps are expressed in seconds.
  17471. @end table
  17472. @end table
  17473. @subsection Examples
  17474. @itemize
  17475. @item
  17476. Benchmark @ref{selectivecolor} filter:
  17477. @example
  17478. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  17479. @end example
  17480. @end itemize
  17481. @section concat
  17482. Concatenate audio and video streams, joining them together one after the
  17483. other.
  17484. The filter works on segments of synchronized video and audio streams. All
  17485. segments must have the same number of streams of each type, and that will
  17486. also be the number of streams at output.
  17487. The filter accepts the following options:
  17488. @table @option
  17489. @item n
  17490. Set the number of segments. Default is 2.
  17491. @item v
  17492. Set the number of output video streams, that is also the number of video
  17493. streams in each segment. Default is 1.
  17494. @item a
  17495. Set the number of output audio streams, that is also the number of audio
  17496. streams in each segment. Default is 0.
  17497. @item unsafe
  17498. Activate unsafe mode: do not fail if segments have a different format.
  17499. @end table
  17500. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  17501. @var{a} audio outputs.
  17502. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  17503. segment, in the same order as the outputs, then the inputs for the second
  17504. segment, etc.
  17505. Related streams do not always have exactly the same duration, for various
  17506. reasons including codec frame size or sloppy authoring. For that reason,
  17507. related synchronized streams (e.g. a video and its audio track) should be
  17508. concatenated at once. The concat filter will use the duration of the longest
  17509. stream in each segment (except the last one), and if necessary pad shorter
  17510. audio streams with silence.
  17511. For this filter to work correctly, all segments must start at timestamp 0.
  17512. All corresponding streams must have the same parameters in all segments; the
  17513. filtering system will automatically select a common pixel format for video
  17514. streams, and a common sample format, sample rate and channel layout for
  17515. audio streams, but other settings, such as resolution, must be converted
  17516. explicitly by the user.
  17517. Different frame rates are acceptable but will result in variable frame rate
  17518. at output; be sure to configure the output file to handle it.
  17519. @subsection Examples
  17520. @itemize
  17521. @item
  17522. Concatenate an opening, an episode and an ending, all in bilingual version
  17523. (video in stream 0, audio in streams 1 and 2):
  17524. @example
  17525. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  17526. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  17527. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  17528. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  17529. @end example
  17530. @item
  17531. Concatenate two parts, handling audio and video separately, using the
  17532. (a)movie sources, and adjusting the resolution:
  17533. @example
  17534. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  17535. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  17536. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  17537. @end example
  17538. Note that a desync will happen at the stitch if the audio and video streams
  17539. do not have exactly the same duration in the first file.
  17540. @end itemize
  17541. @subsection Commands
  17542. This filter supports the following commands:
  17543. @table @option
  17544. @item next
  17545. Close the current segment and step to the next one
  17546. @end table
  17547. @anchor{ebur128}
  17548. @section ebur128
  17549. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  17550. level. By default, it logs a message at a frequency of 10Hz with the
  17551. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  17552. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  17553. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  17554. sample format is double-precision floating point. The input stream will be converted to
  17555. this specification, if needed. Users may need to insert aformat and/or aresample filters
  17556. after this filter to obtain the original parameters.
  17557. The filter also has a video output (see the @var{video} option) with a real
  17558. time graph to observe the loudness evolution. The graphic contains the logged
  17559. message mentioned above, so it is not printed anymore when this option is set,
  17560. unless the verbose logging is set. The main graphing area contains the
  17561. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  17562. the momentary loudness (400 milliseconds), but can optionally be configured
  17563. to instead display short-term loudness (see @var{gauge}).
  17564. The green area marks a +/- 1LU target range around the target loudness
  17565. (-23LUFS by default, unless modified through @var{target}).
  17566. More information about the Loudness Recommendation EBU R128 on
  17567. @url{http://tech.ebu.ch/loudness}.
  17568. The filter accepts the following options:
  17569. @table @option
  17570. @item video
  17571. Activate the video output. The audio stream is passed unchanged whether this
  17572. option is set or no. The video stream will be the first output stream if
  17573. activated. Default is @code{0}.
  17574. @item size
  17575. Set the video size. This option is for video only. For the syntax of this
  17576. option, check the
  17577. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17578. Default and minimum resolution is @code{640x480}.
  17579. @item meter
  17580. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  17581. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  17582. other integer value between this range is allowed.
  17583. @item metadata
  17584. Set metadata injection. If set to @code{1}, the audio input will be segmented
  17585. into 100ms output frames, each of them containing various loudness information
  17586. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  17587. Default is @code{0}.
  17588. @item framelog
  17589. Force the frame logging level.
  17590. Available values are:
  17591. @table @samp
  17592. @item info
  17593. information logging level
  17594. @item verbose
  17595. verbose logging level
  17596. @end table
  17597. By default, the logging level is set to @var{info}. If the @option{video} or
  17598. the @option{metadata} options are set, it switches to @var{verbose}.
  17599. @item peak
  17600. Set peak mode(s).
  17601. Available modes can be cumulated (the option is a @code{flag} type). Possible
  17602. values are:
  17603. @table @samp
  17604. @item none
  17605. Disable any peak mode (default).
  17606. @item sample
  17607. Enable sample-peak mode.
  17608. Simple peak mode looking for the higher sample value. It logs a message
  17609. for sample-peak (identified by @code{SPK}).
  17610. @item true
  17611. Enable true-peak mode.
  17612. If enabled, the peak lookup is done on an over-sampled version of the input
  17613. stream for better peak accuracy. It logs a message for true-peak.
  17614. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  17615. This mode requires a build with @code{libswresample}.
  17616. @end table
  17617. @item dualmono
  17618. Treat mono input files as "dual mono". If a mono file is intended for playback
  17619. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  17620. If set to @code{true}, this option will compensate for this effect.
  17621. Multi-channel input files are not affected by this option.
  17622. @item panlaw
  17623. Set a specific pan law to be used for the measurement of dual mono files.
  17624. This parameter is optional, and has a default value of -3.01dB.
  17625. @item target
  17626. Set a specific target level (in LUFS) used as relative zero in the visualization.
  17627. This parameter is optional and has a default value of -23LUFS as specified
  17628. by EBU R128. However, material published online may prefer a level of -16LUFS
  17629. (e.g. for use with podcasts or video platforms).
  17630. @item gauge
  17631. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  17632. @code{shortterm}. By default the momentary value will be used, but in certain
  17633. scenarios it may be more useful to observe the short term value instead (e.g.
  17634. live mixing).
  17635. @item scale
  17636. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  17637. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  17638. video output, not the summary or continuous log output.
  17639. @end table
  17640. @subsection Examples
  17641. @itemize
  17642. @item
  17643. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  17644. @example
  17645. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  17646. @end example
  17647. @item
  17648. Run an analysis with @command{ffmpeg}:
  17649. @example
  17650. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  17651. @end example
  17652. @end itemize
  17653. @section interleave, ainterleave
  17654. Temporally interleave frames from several inputs.
  17655. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  17656. These filters read frames from several inputs and send the oldest
  17657. queued frame to the output.
  17658. Input streams must have well defined, monotonically increasing frame
  17659. timestamp values.
  17660. In order to submit one frame to output, these filters need to enqueue
  17661. at least one frame for each input, so they cannot work in case one
  17662. input is not yet terminated and will not receive incoming frames.
  17663. For example consider the case when one input is a @code{select} filter
  17664. which always drops input frames. The @code{interleave} filter will keep
  17665. reading from that input, but it will never be able to send new frames
  17666. to output until the input sends an end-of-stream signal.
  17667. Also, depending on inputs synchronization, the filters will drop
  17668. frames in case one input receives more frames than the other ones, and
  17669. the queue is already filled.
  17670. These filters accept the following options:
  17671. @table @option
  17672. @item nb_inputs, n
  17673. Set the number of different inputs, it is 2 by default.
  17674. @end table
  17675. @subsection Examples
  17676. @itemize
  17677. @item
  17678. Interleave frames belonging to different streams using @command{ffmpeg}:
  17679. @example
  17680. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  17681. @end example
  17682. @item
  17683. Add flickering blur effect:
  17684. @example
  17685. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  17686. @end example
  17687. @end itemize
  17688. @section metadata, ametadata
  17689. Manipulate frame metadata.
  17690. This filter accepts the following options:
  17691. @table @option
  17692. @item mode
  17693. Set mode of operation of the filter.
  17694. Can be one of the following:
  17695. @table @samp
  17696. @item select
  17697. If both @code{value} and @code{key} is set, select frames
  17698. which have such metadata. If only @code{key} is set, select
  17699. every frame that has such key in metadata.
  17700. @item add
  17701. Add new metadata @code{key} and @code{value}. If key is already available
  17702. do nothing.
  17703. @item modify
  17704. Modify value of already present key.
  17705. @item delete
  17706. If @code{value} is set, delete only keys that have such value.
  17707. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  17708. the frame.
  17709. @item print
  17710. Print key and its value if metadata was found. If @code{key} is not set print all
  17711. metadata values available in frame.
  17712. @end table
  17713. @item key
  17714. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  17715. @item value
  17716. Set metadata value which will be used. This option is mandatory for
  17717. @code{modify} and @code{add} mode.
  17718. @item function
  17719. Which function to use when comparing metadata value and @code{value}.
  17720. Can be one of following:
  17721. @table @samp
  17722. @item same_str
  17723. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  17724. @item starts_with
  17725. Values are interpreted as strings, returns true if metadata value starts with
  17726. the @code{value} option string.
  17727. @item less
  17728. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  17729. @item equal
  17730. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  17731. @item greater
  17732. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  17733. @item expr
  17734. Values are interpreted as floats, returns true if expression from option @code{expr}
  17735. evaluates to true.
  17736. @item ends_with
  17737. Values are interpreted as strings, returns true if metadata value ends with
  17738. the @code{value} option string.
  17739. @end table
  17740. @item expr
  17741. Set expression which is used when @code{function} is set to @code{expr}.
  17742. The expression is evaluated through the eval API and can contain the following
  17743. constants:
  17744. @table @option
  17745. @item VALUE1
  17746. Float representation of @code{value} from metadata key.
  17747. @item VALUE2
  17748. Float representation of @code{value} as supplied by user in @code{value} option.
  17749. @end table
  17750. @item file
  17751. If specified in @code{print} mode, output is written to the named file. Instead of
  17752. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  17753. for standard output. If @code{file} option is not set, output is written to the log
  17754. with AV_LOG_INFO loglevel.
  17755. @item direct
  17756. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  17757. @end table
  17758. @subsection Examples
  17759. @itemize
  17760. @item
  17761. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  17762. between 0 and 1.
  17763. @example
  17764. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  17765. @end example
  17766. @item
  17767. Print silencedetect output to file @file{metadata.txt}.
  17768. @example
  17769. silencedetect,ametadata=mode=print:file=metadata.txt
  17770. @end example
  17771. @item
  17772. Direct all metadata to a pipe with file descriptor 4.
  17773. @example
  17774. metadata=mode=print:file='pipe\:4'
  17775. @end example
  17776. @end itemize
  17777. @section perms, aperms
  17778. Set read/write permissions for the output frames.
  17779. These filters are mainly aimed at developers to test direct path in the
  17780. following filter in the filtergraph.
  17781. The filters accept the following options:
  17782. @table @option
  17783. @item mode
  17784. Select the permissions mode.
  17785. It accepts the following values:
  17786. @table @samp
  17787. @item none
  17788. Do nothing. This is the default.
  17789. @item ro
  17790. Set all the output frames read-only.
  17791. @item rw
  17792. Set all the output frames directly writable.
  17793. @item toggle
  17794. Make the frame read-only if writable, and writable if read-only.
  17795. @item random
  17796. Set each output frame read-only or writable randomly.
  17797. @end table
  17798. @item seed
  17799. Set the seed for the @var{random} mode, must be an integer included between
  17800. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  17801. @code{-1}, the filter will try to use a good random seed on a best effort
  17802. basis.
  17803. @end table
  17804. Note: in case of auto-inserted filter between the permission filter and the
  17805. following one, the permission might not be received as expected in that
  17806. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  17807. perms/aperms filter can avoid this problem.
  17808. @section realtime, arealtime
  17809. Slow down filtering to match real time approximately.
  17810. These filters will pause the filtering for a variable amount of time to
  17811. match the output rate with the input timestamps.
  17812. They are similar to the @option{re} option to @code{ffmpeg}.
  17813. They accept the following options:
  17814. @table @option
  17815. @item limit
  17816. Time limit for the pauses. Any pause longer than that will be considered
  17817. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  17818. @item speed
  17819. Speed factor for processing. The value must be a float larger than zero.
  17820. Values larger than 1.0 will result in faster than realtime processing,
  17821. smaller will slow processing down. The @var{limit} is automatically adapted
  17822. accordingly. Default is 1.0.
  17823. A processing speed faster than what is possible without these filters cannot
  17824. be achieved.
  17825. @end table
  17826. @anchor{select}
  17827. @section select, aselect
  17828. Select frames to pass in output.
  17829. This filter accepts the following options:
  17830. @table @option
  17831. @item expr, e
  17832. Set expression, which is evaluated for each input frame.
  17833. If the expression is evaluated to zero, the frame is discarded.
  17834. If the evaluation result is negative or NaN, the frame is sent to the
  17835. first output; otherwise it is sent to the output with index
  17836. @code{ceil(val)-1}, assuming that the input index starts from 0.
  17837. For example a value of @code{1.2} corresponds to the output with index
  17838. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  17839. @item outputs, n
  17840. Set the number of outputs. The output to which to send the selected
  17841. frame is based on the result of the evaluation. Default value is 1.
  17842. @end table
  17843. The expression can contain the following constants:
  17844. @table @option
  17845. @item n
  17846. The (sequential) number of the filtered frame, starting from 0.
  17847. @item selected_n
  17848. The (sequential) number of the selected frame, starting from 0.
  17849. @item prev_selected_n
  17850. The sequential number of the last selected frame. It's NAN if undefined.
  17851. @item TB
  17852. The timebase of the input timestamps.
  17853. @item pts
  17854. The PTS (Presentation TimeStamp) of the filtered video frame,
  17855. expressed in @var{TB} units. It's NAN if undefined.
  17856. @item t
  17857. The PTS of the filtered video frame,
  17858. expressed in seconds. It's NAN if undefined.
  17859. @item prev_pts
  17860. The PTS of the previously filtered video frame. It's NAN if undefined.
  17861. @item prev_selected_pts
  17862. The PTS of the last previously filtered video frame. It's NAN if undefined.
  17863. @item prev_selected_t
  17864. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  17865. @item start_pts
  17866. The PTS of the first video frame in the video. It's NAN if undefined.
  17867. @item start_t
  17868. The time of the first video frame in the video. It's NAN if undefined.
  17869. @item pict_type @emph{(video only)}
  17870. The type of the filtered frame. It can assume one of the following
  17871. values:
  17872. @table @option
  17873. @item I
  17874. @item P
  17875. @item B
  17876. @item S
  17877. @item SI
  17878. @item SP
  17879. @item BI
  17880. @end table
  17881. @item interlace_type @emph{(video only)}
  17882. The frame interlace type. It can assume one of the following values:
  17883. @table @option
  17884. @item PROGRESSIVE
  17885. The frame is progressive (not interlaced).
  17886. @item TOPFIRST
  17887. The frame is top-field-first.
  17888. @item BOTTOMFIRST
  17889. The frame is bottom-field-first.
  17890. @end table
  17891. @item consumed_sample_n @emph{(audio only)}
  17892. the number of selected samples before the current frame
  17893. @item samples_n @emph{(audio only)}
  17894. the number of samples in the current frame
  17895. @item sample_rate @emph{(audio only)}
  17896. the input sample rate
  17897. @item key
  17898. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  17899. @item pos
  17900. the position in the file of the filtered frame, -1 if the information
  17901. is not available (e.g. for synthetic video)
  17902. @item scene @emph{(video only)}
  17903. value between 0 and 1 to indicate a new scene; a low value reflects a low
  17904. probability for the current frame to introduce a new scene, while a higher
  17905. value means the current frame is more likely to be one (see the example below)
  17906. @item concatdec_select
  17907. The concat demuxer can select only part of a concat input file by setting an
  17908. inpoint and an outpoint, but the output packets may not be entirely contained
  17909. in the selected interval. By using this variable, it is possible to skip frames
  17910. generated by the concat demuxer which are not exactly contained in the selected
  17911. interval.
  17912. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  17913. and the @var{lavf.concat.duration} packet metadata values which are also
  17914. present in the decoded frames.
  17915. The @var{concatdec_select} variable is -1 if the frame pts is at least
  17916. start_time and either the duration metadata is missing or the frame pts is less
  17917. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  17918. missing.
  17919. That basically means that an input frame is selected if its pts is within the
  17920. interval set by the concat demuxer.
  17921. @end table
  17922. The default value of the select expression is "1".
  17923. @subsection Examples
  17924. @itemize
  17925. @item
  17926. Select all frames in input:
  17927. @example
  17928. select
  17929. @end example
  17930. The example above is the same as:
  17931. @example
  17932. select=1
  17933. @end example
  17934. @item
  17935. Skip all frames:
  17936. @example
  17937. select=0
  17938. @end example
  17939. @item
  17940. Select only I-frames:
  17941. @example
  17942. select='eq(pict_type\,I)'
  17943. @end example
  17944. @item
  17945. Select one frame every 100:
  17946. @example
  17947. select='not(mod(n\,100))'
  17948. @end example
  17949. @item
  17950. Select only frames contained in the 10-20 time interval:
  17951. @example
  17952. select=between(t\,10\,20)
  17953. @end example
  17954. @item
  17955. Select only I-frames contained in the 10-20 time interval:
  17956. @example
  17957. select=between(t\,10\,20)*eq(pict_type\,I)
  17958. @end example
  17959. @item
  17960. Select frames with a minimum distance of 10 seconds:
  17961. @example
  17962. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  17963. @end example
  17964. @item
  17965. Use aselect to select only audio frames with samples number > 100:
  17966. @example
  17967. aselect='gt(samples_n\,100)'
  17968. @end example
  17969. @item
  17970. Create a mosaic of the first scenes:
  17971. @example
  17972. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  17973. @end example
  17974. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  17975. choice.
  17976. @item
  17977. Send even and odd frames to separate outputs, and compose them:
  17978. @example
  17979. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  17980. @end example
  17981. @item
  17982. Select useful frames from an ffconcat file which is using inpoints and
  17983. outpoints but where the source files are not intra frame only.
  17984. @example
  17985. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  17986. @end example
  17987. @end itemize
  17988. @section sendcmd, asendcmd
  17989. Send commands to filters in the filtergraph.
  17990. These filters read commands to be sent to other filters in the
  17991. filtergraph.
  17992. @code{sendcmd} must be inserted between two video filters,
  17993. @code{asendcmd} must be inserted between two audio filters, but apart
  17994. from that they act the same way.
  17995. The specification of commands can be provided in the filter arguments
  17996. with the @var{commands} option, or in a file specified by the
  17997. @var{filename} option.
  17998. These filters accept the following options:
  17999. @table @option
  18000. @item commands, c
  18001. Set the commands to be read and sent to the other filters.
  18002. @item filename, f
  18003. Set the filename of the commands to be read and sent to the other
  18004. filters.
  18005. @end table
  18006. @subsection Commands syntax
  18007. A commands description consists of a sequence of interval
  18008. specifications, comprising a list of commands to be executed when a
  18009. particular event related to that interval occurs. The occurring event
  18010. is typically the current frame time entering or leaving a given time
  18011. interval.
  18012. An interval is specified by the following syntax:
  18013. @example
  18014. @var{START}[-@var{END}] @var{COMMANDS};
  18015. @end example
  18016. The time interval is specified by the @var{START} and @var{END} times.
  18017. @var{END} is optional and defaults to the maximum time.
  18018. The current frame time is considered within the specified interval if
  18019. it is included in the interval [@var{START}, @var{END}), that is when
  18020. the time is greater or equal to @var{START} and is lesser than
  18021. @var{END}.
  18022. @var{COMMANDS} consists of a sequence of one or more command
  18023. specifications, separated by ",", relating to that interval. The
  18024. syntax of a command specification is given by:
  18025. @example
  18026. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  18027. @end example
  18028. @var{FLAGS} is optional and specifies the type of events relating to
  18029. the time interval which enable sending the specified command, and must
  18030. be a non-null sequence of identifier flags separated by "+" or "|" and
  18031. enclosed between "[" and "]".
  18032. The following flags are recognized:
  18033. @table @option
  18034. @item enter
  18035. The command is sent when the current frame timestamp enters the
  18036. specified interval. In other words, the command is sent when the
  18037. previous frame timestamp was not in the given interval, and the
  18038. current is.
  18039. @item leave
  18040. The command is sent when the current frame timestamp leaves the
  18041. specified interval. In other words, the command is sent when the
  18042. previous frame timestamp was in the given interval, and the
  18043. current is not.
  18044. @item expr
  18045. The command @var{ARG} is interpreted as expression and result of
  18046. expression is passed as @var{ARG}.
  18047. The expression is evaluated through the eval API and can contain the following
  18048. constants:
  18049. @table @option
  18050. @item POS
  18051. Original position in the file of the frame, or undefined if undefined
  18052. for the current frame.
  18053. @item PTS
  18054. The presentation timestamp in input.
  18055. @item N
  18056. The count of the input frame for video or audio, starting from 0.
  18057. @item T
  18058. The time in seconds of the current frame.
  18059. @item TS
  18060. The start time in seconds of the current command interval.
  18061. @item TE
  18062. The end time in seconds of the current command interval.
  18063. @item TI
  18064. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  18065. @end table
  18066. @end table
  18067. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  18068. assumed.
  18069. @var{TARGET} specifies the target of the command, usually the name of
  18070. the filter class or a specific filter instance name.
  18071. @var{COMMAND} specifies the name of the command for the target filter.
  18072. @var{ARG} is optional and specifies the optional list of argument for
  18073. the given @var{COMMAND}.
  18074. Between one interval specification and another, whitespaces, or
  18075. sequences of characters starting with @code{#} until the end of line,
  18076. are ignored and can be used to annotate comments.
  18077. A simplified BNF description of the commands specification syntax
  18078. follows:
  18079. @example
  18080. @var{COMMAND_FLAG} ::= "enter" | "leave"
  18081. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  18082. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  18083. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  18084. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  18085. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  18086. @end example
  18087. @subsection Examples
  18088. @itemize
  18089. @item
  18090. Specify audio tempo change at second 4:
  18091. @example
  18092. asendcmd=c='4.0 atempo tempo 1.5',atempo
  18093. @end example
  18094. @item
  18095. Target a specific filter instance:
  18096. @example
  18097. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  18098. @end example
  18099. @item
  18100. Specify a list of drawtext and hue commands in a file.
  18101. @example
  18102. # show text in the interval 5-10
  18103. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  18104. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  18105. # desaturate the image in the interval 15-20
  18106. 15.0-20.0 [enter] hue s 0,
  18107. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  18108. [leave] hue s 1,
  18109. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  18110. # apply an exponential saturation fade-out effect, starting from time 25
  18111. 25 [enter] hue s exp(25-t)
  18112. @end example
  18113. A filtergraph allowing to read and process the above command list
  18114. stored in a file @file{test.cmd}, can be specified with:
  18115. @example
  18116. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  18117. @end example
  18118. @end itemize
  18119. @anchor{setpts}
  18120. @section setpts, asetpts
  18121. Change the PTS (presentation timestamp) of the input frames.
  18122. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  18123. This filter accepts the following options:
  18124. @table @option
  18125. @item expr
  18126. The expression which is evaluated for each frame to construct its timestamp.
  18127. @end table
  18128. The expression is evaluated through the eval API and can contain the following
  18129. constants:
  18130. @table @option
  18131. @item FRAME_RATE, FR
  18132. frame rate, only defined for constant frame-rate video
  18133. @item PTS
  18134. The presentation timestamp in input
  18135. @item N
  18136. The count of the input frame for video or the number of consumed samples,
  18137. not including the current frame for audio, starting from 0.
  18138. @item NB_CONSUMED_SAMPLES
  18139. The number of consumed samples, not including the current frame (only
  18140. audio)
  18141. @item NB_SAMPLES, S
  18142. The number of samples in the current frame (only audio)
  18143. @item SAMPLE_RATE, SR
  18144. The audio sample rate.
  18145. @item STARTPTS
  18146. The PTS of the first frame.
  18147. @item STARTT
  18148. the time in seconds of the first frame
  18149. @item INTERLACED
  18150. State whether the current frame is interlaced.
  18151. @item T
  18152. the time in seconds of the current frame
  18153. @item POS
  18154. original position in the file of the frame, or undefined if undefined
  18155. for the current frame
  18156. @item PREV_INPTS
  18157. The previous input PTS.
  18158. @item PREV_INT
  18159. previous input time in seconds
  18160. @item PREV_OUTPTS
  18161. The previous output PTS.
  18162. @item PREV_OUTT
  18163. previous output time in seconds
  18164. @item RTCTIME
  18165. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  18166. instead.
  18167. @item RTCSTART
  18168. The wallclock (RTC) time at the start of the movie in microseconds.
  18169. @item TB
  18170. The timebase of the input timestamps.
  18171. @end table
  18172. @subsection Examples
  18173. @itemize
  18174. @item
  18175. Start counting PTS from zero
  18176. @example
  18177. setpts=PTS-STARTPTS
  18178. @end example
  18179. @item
  18180. Apply fast motion effect:
  18181. @example
  18182. setpts=0.5*PTS
  18183. @end example
  18184. @item
  18185. Apply slow motion effect:
  18186. @example
  18187. setpts=2.0*PTS
  18188. @end example
  18189. @item
  18190. Set fixed rate of 25 frames per second:
  18191. @example
  18192. setpts=N/(25*TB)
  18193. @end example
  18194. @item
  18195. Set fixed rate 25 fps with some jitter:
  18196. @example
  18197. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  18198. @end example
  18199. @item
  18200. Apply an offset of 10 seconds to the input PTS:
  18201. @example
  18202. setpts=PTS+10/TB
  18203. @end example
  18204. @item
  18205. Generate timestamps from a "live source" and rebase onto the current timebase:
  18206. @example
  18207. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  18208. @end example
  18209. @item
  18210. Generate timestamps by counting samples:
  18211. @example
  18212. asetpts=N/SR/TB
  18213. @end example
  18214. @end itemize
  18215. @section setrange
  18216. Force color range for the output video frame.
  18217. The @code{setrange} filter marks the color range property for the
  18218. output frames. It does not change the input frame, but only sets the
  18219. corresponding property, which affects how the frame is treated by
  18220. following filters.
  18221. The filter accepts the following options:
  18222. @table @option
  18223. @item range
  18224. Available values are:
  18225. @table @samp
  18226. @item auto
  18227. Keep the same color range property.
  18228. @item unspecified, unknown
  18229. Set the color range as unspecified.
  18230. @item limited, tv, mpeg
  18231. Set the color range as limited.
  18232. @item full, pc, jpeg
  18233. Set the color range as full.
  18234. @end table
  18235. @end table
  18236. @section settb, asettb
  18237. Set the timebase to use for the output frames timestamps.
  18238. It is mainly useful for testing timebase configuration.
  18239. It accepts the following parameters:
  18240. @table @option
  18241. @item expr, tb
  18242. The expression which is evaluated into the output timebase.
  18243. @end table
  18244. The value for @option{tb} is an arithmetic expression representing a
  18245. rational. The expression can contain the constants "AVTB" (the default
  18246. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  18247. audio only). Default value is "intb".
  18248. @subsection Examples
  18249. @itemize
  18250. @item
  18251. Set the timebase to 1/25:
  18252. @example
  18253. settb=expr=1/25
  18254. @end example
  18255. @item
  18256. Set the timebase to 1/10:
  18257. @example
  18258. settb=expr=0.1
  18259. @end example
  18260. @item
  18261. Set the timebase to 1001/1000:
  18262. @example
  18263. settb=1+0.001
  18264. @end example
  18265. @item
  18266. Set the timebase to 2*intb:
  18267. @example
  18268. settb=2*intb
  18269. @end example
  18270. @item
  18271. Set the default timebase value:
  18272. @example
  18273. settb=AVTB
  18274. @end example
  18275. @end itemize
  18276. @section showcqt
  18277. Convert input audio to a video output representing frequency spectrum
  18278. logarithmically using Brown-Puckette constant Q transform algorithm with
  18279. direct frequency domain coefficient calculation (but the transform itself
  18280. is not really constant Q, instead the Q factor is actually variable/clamped),
  18281. with musical tone scale, from E0 to D#10.
  18282. The filter accepts the following options:
  18283. @table @option
  18284. @item size, s
  18285. Specify the video size for the output. It must be even. For the syntax of this option,
  18286. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18287. Default value is @code{1920x1080}.
  18288. @item fps, rate, r
  18289. Set the output frame rate. Default value is @code{25}.
  18290. @item bar_h
  18291. Set the bargraph height. It must be even. Default value is @code{-1} which
  18292. computes the bargraph height automatically.
  18293. @item axis_h
  18294. Set the axis height. It must be even. Default value is @code{-1} which computes
  18295. the axis height automatically.
  18296. @item sono_h
  18297. Set the sonogram height. It must be even. Default value is @code{-1} which
  18298. computes the sonogram height automatically.
  18299. @item fullhd
  18300. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  18301. instead. Default value is @code{1}.
  18302. @item sono_v, volume
  18303. Specify the sonogram volume expression. It can contain variables:
  18304. @table @option
  18305. @item bar_v
  18306. the @var{bar_v} evaluated expression
  18307. @item frequency, freq, f
  18308. the frequency where it is evaluated
  18309. @item timeclamp, tc
  18310. the value of @var{timeclamp} option
  18311. @end table
  18312. and functions:
  18313. @table @option
  18314. @item a_weighting(f)
  18315. A-weighting of equal loudness
  18316. @item b_weighting(f)
  18317. B-weighting of equal loudness
  18318. @item c_weighting(f)
  18319. C-weighting of equal loudness.
  18320. @end table
  18321. Default value is @code{16}.
  18322. @item bar_v, volume2
  18323. Specify the bargraph volume expression. It can contain variables:
  18324. @table @option
  18325. @item sono_v
  18326. the @var{sono_v} evaluated expression
  18327. @item frequency, freq, f
  18328. the frequency where it is evaluated
  18329. @item timeclamp, tc
  18330. the value of @var{timeclamp} option
  18331. @end table
  18332. and functions:
  18333. @table @option
  18334. @item a_weighting(f)
  18335. A-weighting of equal loudness
  18336. @item b_weighting(f)
  18337. B-weighting of equal loudness
  18338. @item c_weighting(f)
  18339. C-weighting of equal loudness.
  18340. @end table
  18341. Default value is @code{sono_v}.
  18342. @item sono_g, gamma
  18343. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  18344. higher gamma makes the spectrum having more range. Default value is @code{3}.
  18345. Acceptable range is @code{[1, 7]}.
  18346. @item bar_g, gamma2
  18347. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  18348. @code{[1, 7]}.
  18349. @item bar_t
  18350. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  18351. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  18352. @item timeclamp, tc
  18353. Specify the transform timeclamp. At low frequency, there is trade-off between
  18354. accuracy in time domain and frequency domain. If timeclamp is lower,
  18355. event in time domain is represented more accurately (such as fast bass drum),
  18356. otherwise event in frequency domain is represented more accurately
  18357. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  18358. @item attack
  18359. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  18360. limits future samples by applying asymmetric windowing in time domain, useful
  18361. when low latency is required. Accepted range is @code{[0, 1]}.
  18362. @item basefreq
  18363. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  18364. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  18365. @item endfreq
  18366. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  18367. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  18368. @item coeffclamp
  18369. This option is deprecated and ignored.
  18370. @item tlength
  18371. Specify the transform length in time domain. Use this option to control accuracy
  18372. trade-off between time domain and frequency domain at every frequency sample.
  18373. It can contain variables:
  18374. @table @option
  18375. @item frequency, freq, f
  18376. the frequency where it is evaluated
  18377. @item timeclamp, tc
  18378. the value of @var{timeclamp} option.
  18379. @end table
  18380. Default value is @code{384*tc/(384+tc*f)}.
  18381. @item count
  18382. Specify the transform count for every video frame. Default value is @code{6}.
  18383. Acceptable range is @code{[1, 30]}.
  18384. @item fcount
  18385. Specify the transform count for every single pixel. Default value is @code{0},
  18386. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  18387. @item fontfile
  18388. Specify font file for use with freetype to draw the axis. If not specified,
  18389. use embedded font. Note that drawing with font file or embedded font is not
  18390. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  18391. option instead.
  18392. @item font
  18393. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  18394. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  18395. escaping.
  18396. @item fontcolor
  18397. Specify font color expression. This is arithmetic expression that should return
  18398. integer value 0xRRGGBB. It can contain variables:
  18399. @table @option
  18400. @item frequency, freq, f
  18401. the frequency where it is evaluated
  18402. @item timeclamp, tc
  18403. the value of @var{timeclamp} option
  18404. @end table
  18405. and functions:
  18406. @table @option
  18407. @item midi(f)
  18408. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  18409. @item r(x), g(x), b(x)
  18410. red, green, and blue value of intensity x.
  18411. @end table
  18412. Default value is @code{st(0, (midi(f)-59.5)/12);
  18413. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  18414. r(1-ld(1)) + b(ld(1))}.
  18415. @item axisfile
  18416. Specify image file to draw the axis. This option override @var{fontfile} and
  18417. @var{fontcolor} option.
  18418. @item axis, text
  18419. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  18420. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  18421. Default value is @code{1}.
  18422. @item csp
  18423. Set colorspace. The accepted values are:
  18424. @table @samp
  18425. @item unspecified
  18426. Unspecified (default)
  18427. @item bt709
  18428. BT.709
  18429. @item fcc
  18430. FCC
  18431. @item bt470bg
  18432. BT.470BG or BT.601-6 625
  18433. @item smpte170m
  18434. SMPTE-170M or BT.601-6 525
  18435. @item smpte240m
  18436. SMPTE-240M
  18437. @item bt2020ncl
  18438. BT.2020 with non-constant luminance
  18439. @end table
  18440. @item cscheme
  18441. Set spectrogram color scheme. This is list of floating point values with format
  18442. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  18443. The default is @code{1|0.5|0|0|0.5|1}.
  18444. @end table
  18445. @subsection Examples
  18446. @itemize
  18447. @item
  18448. Playing audio while showing the spectrum:
  18449. @example
  18450. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  18451. @end example
  18452. @item
  18453. Same as above, but with frame rate 30 fps:
  18454. @example
  18455. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  18456. @end example
  18457. @item
  18458. Playing at 1280x720:
  18459. @example
  18460. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  18461. @end example
  18462. @item
  18463. Disable sonogram display:
  18464. @example
  18465. sono_h=0
  18466. @end example
  18467. @item
  18468. A1 and its harmonics: A1, A2, (near)E3, A3:
  18469. @example
  18470. 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),
  18471. asplit[a][out1]; [a] showcqt [out0]'
  18472. @end example
  18473. @item
  18474. Same as above, but with more accuracy in frequency domain:
  18475. @example
  18476. 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),
  18477. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  18478. @end example
  18479. @item
  18480. Custom volume:
  18481. @example
  18482. bar_v=10:sono_v=bar_v*a_weighting(f)
  18483. @end example
  18484. @item
  18485. Custom gamma, now spectrum is linear to the amplitude.
  18486. @example
  18487. bar_g=2:sono_g=2
  18488. @end example
  18489. @item
  18490. Custom tlength equation:
  18491. @example
  18492. 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)))'
  18493. @end example
  18494. @item
  18495. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  18496. @example
  18497. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  18498. @end example
  18499. @item
  18500. Custom font using fontconfig:
  18501. @example
  18502. font='Courier New,Monospace,mono|bold'
  18503. @end example
  18504. @item
  18505. Custom frequency range with custom axis using image file:
  18506. @example
  18507. axisfile=myaxis.png:basefreq=40:endfreq=10000
  18508. @end example
  18509. @end itemize
  18510. @section showfreqs
  18511. Convert input audio to video output representing the audio power spectrum.
  18512. Audio amplitude is on Y-axis while frequency is on X-axis.
  18513. The filter accepts the following options:
  18514. @table @option
  18515. @item size, s
  18516. Specify size of video. For the syntax of this option, check the
  18517. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18518. Default is @code{1024x512}.
  18519. @item mode
  18520. Set display mode.
  18521. This set how each frequency bin will be represented.
  18522. It accepts the following values:
  18523. @table @samp
  18524. @item line
  18525. @item bar
  18526. @item dot
  18527. @end table
  18528. Default is @code{bar}.
  18529. @item ascale
  18530. Set amplitude scale.
  18531. It accepts the following values:
  18532. @table @samp
  18533. @item lin
  18534. Linear scale.
  18535. @item sqrt
  18536. Square root scale.
  18537. @item cbrt
  18538. Cubic root scale.
  18539. @item log
  18540. Logarithmic scale.
  18541. @end table
  18542. Default is @code{log}.
  18543. @item fscale
  18544. Set frequency scale.
  18545. It accepts the following values:
  18546. @table @samp
  18547. @item lin
  18548. Linear scale.
  18549. @item log
  18550. Logarithmic scale.
  18551. @item rlog
  18552. Reverse logarithmic scale.
  18553. @end table
  18554. Default is @code{lin}.
  18555. @item win_size
  18556. Set window size. Allowed range is from 16 to 65536.
  18557. Default is @code{2048}
  18558. @item win_func
  18559. Set windowing function.
  18560. It accepts the following values:
  18561. @table @samp
  18562. @item rect
  18563. @item bartlett
  18564. @item hanning
  18565. @item hamming
  18566. @item blackman
  18567. @item welch
  18568. @item flattop
  18569. @item bharris
  18570. @item bnuttall
  18571. @item bhann
  18572. @item sine
  18573. @item nuttall
  18574. @item lanczos
  18575. @item gauss
  18576. @item tukey
  18577. @item dolph
  18578. @item cauchy
  18579. @item parzen
  18580. @item poisson
  18581. @item bohman
  18582. @end table
  18583. Default is @code{hanning}.
  18584. @item overlap
  18585. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  18586. which means optimal overlap for selected window function will be picked.
  18587. @item averaging
  18588. Set time averaging. Setting this to 0 will display current maximal peaks.
  18589. Default is @code{1}, which means time averaging is disabled.
  18590. @item colors
  18591. Specify list of colors separated by space or by '|' which will be used to
  18592. draw channel frequencies. Unrecognized or missing colors will be replaced
  18593. by white color.
  18594. @item cmode
  18595. Set channel display mode.
  18596. It accepts the following values:
  18597. @table @samp
  18598. @item combined
  18599. @item separate
  18600. @end table
  18601. Default is @code{combined}.
  18602. @item minamp
  18603. Set minimum amplitude used in @code{log} amplitude scaler.
  18604. @end table
  18605. @section showspatial
  18606. Convert stereo input audio to a video output, representing the spatial relationship
  18607. between two channels.
  18608. The filter accepts the following options:
  18609. @table @option
  18610. @item size, s
  18611. Specify the video size for the output. For the syntax of this option, check the
  18612. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18613. Default value is @code{512x512}.
  18614. @item win_size
  18615. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  18616. @item win_func
  18617. Set window function.
  18618. It accepts the following values:
  18619. @table @samp
  18620. @item rect
  18621. @item bartlett
  18622. @item hann
  18623. @item hanning
  18624. @item hamming
  18625. @item blackman
  18626. @item welch
  18627. @item flattop
  18628. @item bharris
  18629. @item bnuttall
  18630. @item bhann
  18631. @item sine
  18632. @item nuttall
  18633. @item lanczos
  18634. @item gauss
  18635. @item tukey
  18636. @item dolph
  18637. @item cauchy
  18638. @item parzen
  18639. @item poisson
  18640. @item bohman
  18641. @end table
  18642. Default value is @code{hann}.
  18643. @item overlap
  18644. Set ratio of overlap window. Default value is @code{0.5}.
  18645. When value is @code{1} overlap is set to recommended size for specific
  18646. window function currently used.
  18647. @end table
  18648. @anchor{showspectrum}
  18649. @section showspectrum
  18650. Convert input audio to a video output, representing the audio frequency
  18651. spectrum.
  18652. The filter accepts the following options:
  18653. @table @option
  18654. @item size, s
  18655. Specify the video size for the output. For the syntax of this option, check the
  18656. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18657. Default value is @code{640x512}.
  18658. @item slide
  18659. Specify how the spectrum should slide along the window.
  18660. It accepts the following values:
  18661. @table @samp
  18662. @item replace
  18663. the samples start again on the left when they reach the right
  18664. @item scroll
  18665. the samples scroll from right to left
  18666. @item fullframe
  18667. frames are only produced when the samples reach the right
  18668. @item rscroll
  18669. the samples scroll from left to right
  18670. @end table
  18671. Default value is @code{replace}.
  18672. @item mode
  18673. Specify display mode.
  18674. It accepts the following values:
  18675. @table @samp
  18676. @item combined
  18677. all channels are displayed in the same row
  18678. @item separate
  18679. all channels are displayed in separate rows
  18680. @end table
  18681. Default value is @samp{combined}.
  18682. @item color
  18683. Specify display color mode.
  18684. It accepts the following values:
  18685. @table @samp
  18686. @item channel
  18687. each channel is displayed in a separate color
  18688. @item intensity
  18689. each channel is displayed using the same color scheme
  18690. @item rainbow
  18691. each channel is displayed using the rainbow color scheme
  18692. @item moreland
  18693. each channel is displayed using the moreland color scheme
  18694. @item nebulae
  18695. each channel is displayed using the nebulae color scheme
  18696. @item fire
  18697. each channel is displayed using the fire color scheme
  18698. @item fiery
  18699. each channel is displayed using the fiery color scheme
  18700. @item fruit
  18701. each channel is displayed using the fruit color scheme
  18702. @item cool
  18703. each channel is displayed using the cool color scheme
  18704. @item magma
  18705. each channel is displayed using the magma color scheme
  18706. @item green
  18707. each channel is displayed using the green color scheme
  18708. @item viridis
  18709. each channel is displayed using the viridis color scheme
  18710. @item plasma
  18711. each channel is displayed using the plasma color scheme
  18712. @item cividis
  18713. each channel is displayed using the cividis color scheme
  18714. @item terrain
  18715. each channel is displayed using the terrain color scheme
  18716. @end table
  18717. Default value is @samp{channel}.
  18718. @item scale
  18719. Specify scale used for calculating intensity color values.
  18720. It accepts the following values:
  18721. @table @samp
  18722. @item lin
  18723. linear
  18724. @item sqrt
  18725. square root, default
  18726. @item cbrt
  18727. cubic root
  18728. @item log
  18729. logarithmic
  18730. @item 4thrt
  18731. 4th root
  18732. @item 5thrt
  18733. 5th root
  18734. @end table
  18735. Default value is @samp{sqrt}.
  18736. @item fscale
  18737. Specify frequency scale.
  18738. It accepts the following values:
  18739. @table @samp
  18740. @item lin
  18741. linear
  18742. @item log
  18743. logarithmic
  18744. @end table
  18745. Default value is @samp{lin}.
  18746. @item saturation
  18747. Set saturation modifier for displayed colors. Negative values provide
  18748. alternative color scheme. @code{0} is no saturation at all.
  18749. Saturation must be in [-10.0, 10.0] range.
  18750. Default value is @code{1}.
  18751. @item win_func
  18752. Set window function.
  18753. It accepts the following values:
  18754. @table @samp
  18755. @item rect
  18756. @item bartlett
  18757. @item hann
  18758. @item hanning
  18759. @item hamming
  18760. @item blackman
  18761. @item welch
  18762. @item flattop
  18763. @item bharris
  18764. @item bnuttall
  18765. @item bhann
  18766. @item sine
  18767. @item nuttall
  18768. @item lanczos
  18769. @item gauss
  18770. @item tukey
  18771. @item dolph
  18772. @item cauchy
  18773. @item parzen
  18774. @item poisson
  18775. @item bohman
  18776. @end table
  18777. Default value is @code{hann}.
  18778. @item orientation
  18779. Set orientation of time vs frequency axis. Can be @code{vertical} or
  18780. @code{horizontal}. Default is @code{vertical}.
  18781. @item overlap
  18782. Set ratio of overlap window. Default value is @code{0}.
  18783. When value is @code{1} overlap is set to recommended size for specific
  18784. window function currently used.
  18785. @item gain
  18786. Set scale gain for calculating intensity color values.
  18787. Default value is @code{1}.
  18788. @item data
  18789. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  18790. @item rotation
  18791. Set color rotation, must be in [-1.0, 1.0] range.
  18792. Default value is @code{0}.
  18793. @item start
  18794. Set start frequency from which to display spectrogram. Default is @code{0}.
  18795. @item stop
  18796. Set stop frequency to which to display spectrogram. Default is @code{0}.
  18797. @item fps
  18798. Set upper frame rate limit. Default is @code{auto}, unlimited.
  18799. @item legend
  18800. Draw time and frequency axes and legends. Default is disabled.
  18801. @end table
  18802. The usage is very similar to the showwaves filter; see the examples in that
  18803. section.
  18804. @subsection Examples
  18805. @itemize
  18806. @item
  18807. Large window with logarithmic color scaling:
  18808. @example
  18809. showspectrum=s=1280x480:scale=log
  18810. @end example
  18811. @item
  18812. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  18813. @example
  18814. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  18815. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  18816. @end example
  18817. @end itemize
  18818. @section showspectrumpic
  18819. Convert input audio to a single video frame, representing the audio frequency
  18820. spectrum.
  18821. The filter accepts the following options:
  18822. @table @option
  18823. @item size, s
  18824. Specify the video size for the output. For the syntax of this option, check the
  18825. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18826. Default value is @code{4096x2048}.
  18827. @item mode
  18828. Specify display mode.
  18829. It accepts the following values:
  18830. @table @samp
  18831. @item combined
  18832. all channels are displayed in the same row
  18833. @item separate
  18834. all channels are displayed in separate rows
  18835. @end table
  18836. Default value is @samp{combined}.
  18837. @item color
  18838. Specify display color mode.
  18839. It accepts the following values:
  18840. @table @samp
  18841. @item channel
  18842. each channel is displayed in a separate color
  18843. @item intensity
  18844. each channel is displayed using the same color scheme
  18845. @item rainbow
  18846. each channel is displayed using the rainbow color scheme
  18847. @item moreland
  18848. each channel is displayed using the moreland color scheme
  18849. @item nebulae
  18850. each channel is displayed using the nebulae color scheme
  18851. @item fire
  18852. each channel is displayed using the fire color scheme
  18853. @item fiery
  18854. each channel is displayed using the fiery color scheme
  18855. @item fruit
  18856. each channel is displayed using the fruit color scheme
  18857. @item cool
  18858. each channel is displayed using the cool color scheme
  18859. @item magma
  18860. each channel is displayed using the magma color scheme
  18861. @item green
  18862. each channel is displayed using the green color scheme
  18863. @item viridis
  18864. each channel is displayed using the viridis color scheme
  18865. @item plasma
  18866. each channel is displayed using the plasma color scheme
  18867. @item cividis
  18868. each channel is displayed using the cividis color scheme
  18869. @item terrain
  18870. each channel is displayed using the terrain color scheme
  18871. @end table
  18872. Default value is @samp{intensity}.
  18873. @item scale
  18874. Specify scale used for calculating intensity color values.
  18875. It accepts the following values:
  18876. @table @samp
  18877. @item lin
  18878. linear
  18879. @item sqrt
  18880. square root, default
  18881. @item cbrt
  18882. cubic root
  18883. @item log
  18884. logarithmic
  18885. @item 4thrt
  18886. 4th root
  18887. @item 5thrt
  18888. 5th root
  18889. @end table
  18890. Default value is @samp{log}.
  18891. @item fscale
  18892. Specify frequency scale.
  18893. It accepts the following values:
  18894. @table @samp
  18895. @item lin
  18896. linear
  18897. @item log
  18898. logarithmic
  18899. @end table
  18900. Default value is @samp{lin}.
  18901. @item saturation
  18902. Set saturation modifier for displayed colors. Negative values provide
  18903. alternative color scheme. @code{0} is no saturation at all.
  18904. Saturation must be in [-10.0, 10.0] range.
  18905. Default value is @code{1}.
  18906. @item win_func
  18907. Set window function.
  18908. It accepts the following values:
  18909. @table @samp
  18910. @item rect
  18911. @item bartlett
  18912. @item hann
  18913. @item hanning
  18914. @item hamming
  18915. @item blackman
  18916. @item welch
  18917. @item flattop
  18918. @item bharris
  18919. @item bnuttall
  18920. @item bhann
  18921. @item sine
  18922. @item nuttall
  18923. @item lanczos
  18924. @item gauss
  18925. @item tukey
  18926. @item dolph
  18927. @item cauchy
  18928. @item parzen
  18929. @item poisson
  18930. @item bohman
  18931. @end table
  18932. Default value is @code{hann}.
  18933. @item orientation
  18934. Set orientation of time vs frequency axis. Can be @code{vertical} or
  18935. @code{horizontal}. Default is @code{vertical}.
  18936. @item gain
  18937. Set scale gain for calculating intensity color values.
  18938. Default value is @code{1}.
  18939. @item legend
  18940. Draw time and frequency axes and legends. Default is enabled.
  18941. @item rotation
  18942. Set color rotation, must be in [-1.0, 1.0] range.
  18943. Default value is @code{0}.
  18944. @item start
  18945. Set start frequency from which to display spectrogram. Default is @code{0}.
  18946. @item stop
  18947. Set stop frequency to which to display spectrogram. Default is @code{0}.
  18948. @end table
  18949. @subsection Examples
  18950. @itemize
  18951. @item
  18952. Extract an audio spectrogram of a whole audio track
  18953. in a 1024x1024 picture using @command{ffmpeg}:
  18954. @example
  18955. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  18956. @end example
  18957. @end itemize
  18958. @section showvolume
  18959. Convert input audio volume to a video output.
  18960. The filter accepts the following options:
  18961. @table @option
  18962. @item rate, r
  18963. Set video rate.
  18964. @item b
  18965. Set border width, allowed range is [0, 5]. Default is 1.
  18966. @item w
  18967. Set channel width, allowed range is [80, 8192]. Default is 400.
  18968. @item h
  18969. Set channel height, allowed range is [1, 900]. Default is 20.
  18970. @item f
  18971. Set fade, allowed range is [0, 1]. Default is 0.95.
  18972. @item c
  18973. Set volume color expression.
  18974. The expression can use the following variables:
  18975. @table @option
  18976. @item VOLUME
  18977. Current max volume of channel in dB.
  18978. @item PEAK
  18979. Current peak.
  18980. @item CHANNEL
  18981. Current channel number, starting from 0.
  18982. @end table
  18983. @item t
  18984. If set, displays channel names. Default is enabled.
  18985. @item v
  18986. If set, displays volume values. Default is enabled.
  18987. @item o
  18988. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  18989. default is @code{h}.
  18990. @item s
  18991. Set step size, allowed range is [0, 5]. Default is 0, which means
  18992. step is disabled.
  18993. @item p
  18994. Set background opacity, allowed range is [0, 1]. Default is 0.
  18995. @item m
  18996. Set metering mode, can be peak: @code{p} or rms: @code{r},
  18997. default is @code{p}.
  18998. @item ds
  18999. Set display scale, can be linear: @code{lin} or log: @code{log},
  19000. default is @code{lin}.
  19001. @item dm
  19002. In second.
  19003. If set to > 0., display a line for the max level
  19004. in the previous seconds.
  19005. default is disabled: @code{0.}
  19006. @item dmc
  19007. The color of the max line. Use when @code{dm} option is set to > 0.
  19008. default is: @code{orange}
  19009. @end table
  19010. @section showwaves
  19011. Convert input audio to a video output, representing the samples waves.
  19012. The filter accepts the following options:
  19013. @table @option
  19014. @item size, s
  19015. Specify the video size for the output. For the syntax of this option, check the
  19016. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19017. Default value is @code{600x240}.
  19018. @item mode
  19019. Set display mode.
  19020. Available values are:
  19021. @table @samp
  19022. @item point
  19023. Draw a point for each sample.
  19024. @item line
  19025. Draw a vertical line for each sample.
  19026. @item p2p
  19027. Draw a point for each sample and a line between them.
  19028. @item cline
  19029. Draw a centered vertical line for each sample.
  19030. @end table
  19031. Default value is @code{point}.
  19032. @item n
  19033. Set the number of samples which are printed on the same column. A
  19034. larger value will decrease the frame rate. Must be a positive
  19035. integer. This option can be set only if the value for @var{rate}
  19036. is not explicitly specified.
  19037. @item rate, r
  19038. Set the (approximate) output frame rate. This is done by setting the
  19039. option @var{n}. Default value is "25".
  19040. @item split_channels
  19041. Set if channels should be drawn separately or overlap. Default value is 0.
  19042. @item colors
  19043. Set colors separated by '|' which are going to be used for drawing of each channel.
  19044. @item scale
  19045. Set amplitude scale.
  19046. Available values are:
  19047. @table @samp
  19048. @item lin
  19049. Linear.
  19050. @item log
  19051. Logarithmic.
  19052. @item sqrt
  19053. Square root.
  19054. @item cbrt
  19055. Cubic root.
  19056. @end table
  19057. Default is linear.
  19058. @item draw
  19059. Set the draw mode. This is mostly useful to set for high @var{n}.
  19060. Available values are:
  19061. @table @samp
  19062. @item scale
  19063. Scale pixel values for each drawn sample.
  19064. @item full
  19065. Draw every sample directly.
  19066. @end table
  19067. Default value is @code{scale}.
  19068. @end table
  19069. @subsection Examples
  19070. @itemize
  19071. @item
  19072. Output the input file audio and the corresponding video representation
  19073. at the same time:
  19074. @example
  19075. amovie=a.mp3,asplit[out0],showwaves[out1]
  19076. @end example
  19077. @item
  19078. Create a synthetic signal and show it with showwaves, forcing a
  19079. frame rate of 30 frames per second:
  19080. @example
  19081. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  19082. @end example
  19083. @end itemize
  19084. @section showwavespic
  19085. Convert input audio to a single video frame, representing the samples waves.
  19086. The filter accepts the following options:
  19087. @table @option
  19088. @item size, s
  19089. Specify the video size for the output. For the syntax of this option, check the
  19090. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19091. Default value is @code{600x240}.
  19092. @item split_channels
  19093. Set if channels should be drawn separately or overlap. Default value is 0.
  19094. @item colors
  19095. Set colors separated by '|' which are going to be used for drawing of each channel.
  19096. @item scale
  19097. Set amplitude scale.
  19098. Available values are:
  19099. @table @samp
  19100. @item lin
  19101. Linear.
  19102. @item log
  19103. Logarithmic.
  19104. @item sqrt
  19105. Square root.
  19106. @item cbrt
  19107. Cubic root.
  19108. @end table
  19109. Default is linear.
  19110. @item draw
  19111. Set the draw mode.
  19112. Available values are:
  19113. @table @samp
  19114. @item scale
  19115. Scale pixel values for each drawn sample.
  19116. @item full
  19117. Draw every sample directly.
  19118. @end table
  19119. Default value is @code{scale}.
  19120. @end table
  19121. @subsection Examples
  19122. @itemize
  19123. @item
  19124. Extract a channel split representation of the wave form of a whole audio track
  19125. in a 1024x800 picture using @command{ffmpeg}:
  19126. @example
  19127. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  19128. @end example
  19129. @end itemize
  19130. @section sidedata, asidedata
  19131. Delete frame side data, or select frames based on it.
  19132. This filter accepts the following options:
  19133. @table @option
  19134. @item mode
  19135. Set mode of operation of the filter.
  19136. Can be one of the following:
  19137. @table @samp
  19138. @item select
  19139. Select every frame with side data of @code{type}.
  19140. @item delete
  19141. Delete side data of @code{type}. If @code{type} is not set, delete all side
  19142. data in the frame.
  19143. @end table
  19144. @item type
  19145. Set side data type used with all modes. Must be set for @code{select} mode. For
  19146. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  19147. in @file{libavutil/frame.h}. For example, to choose
  19148. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  19149. @end table
  19150. @section spectrumsynth
  19151. Synthesize audio from 2 input video spectrums, first input stream represents
  19152. magnitude across time and second represents phase across time.
  19153. The filter will transform from frequency domain as displayed in videos back
  19154. to time domain as presented in audio output.
  19155. This filter is primarily created for reversing processed @ref{showspectrum}
  19156. filter outputs, but can synthesize sound from other spectrograms too.
  19157. But in such case results are going to be poor if the phase data is not
  19158. available, because in such cases phase data need to be recreated, usually
  19159. it's just recreated from random noise.
  19160. For best results use gray only output (@code{channel} color mode in
  19161. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  19162. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  19163. @code{data} option. Inputs videos should generally use @code{fullframe}
  19164. slide mode as that saves resources needed for decoding video.
  19165. The filter accepts the following options:
  19166. @table @option
  19167. @item sample_rate
  19168. Specify sample rate of output audio, the sample rate of audio from which
  19169. spectrum was generated may differ.
  19170. @item channels
  19171. Set number of channels represented in input video spectrums.
  19172. @item scale
  19173. Set scale which was used when generating magnitude input spectrum.
  19174. Can be @code{lin} or @code{log}. Default is @code{log}.
  19175. @item slide
  19176. Set slide which was used when generating inputs spectrums.
  19177. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  19178. Default is @code{fullframe}.
  19179. @item win_func
  19180. Set window function used for resynthesis.
  19181. @item overlap
  19182. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  19183. which means optimal overlap for selected window function will be picked.
  19184. @item orientation
  19185. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  19186. Default is @code{vertical}.
  19187. @end table
  19188. @subsection Examples
  19189. @itemize
  19190. @item
  19191. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  19192. then resynthesize videos back to audio with spectrumsynth:
  19193. @example
  19194. 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
  19195. 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
  19196. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  19197. @end example
  19198. @end itemize
  19199. @section split, asplit
  19200. Split input into several identical outputs.
  19201. @code{asplit} works with audio input, @code{split} with video.
  19202. The filter accepts a single parameter which specifies the number of outputs. If
  19203. unspecified, it defaults to 2.
  19204. @subsection Examples
  19205. @itemize
  19206. @item
  19207. Create two separate outputs from the same input:
  19208. @example
  19209. [in] split [out0][out1]
  19210. @end example
  19211. @item
  19212. To create 3 or more outputs, you need to specify the number of
  19213. outputs, like in:
  19214. @example
  19215. [in] asplit=3 [out0][out1][out2]
  19216. @end example
  19217. @item
  19218. Create two separate outputs from the same input, one cropped and
  19219. one padded:
  19220. @example
  19221. [in] split [splitout1][splitout2];
  19222. [splitout1] crop=100:100:0:0 [cropout];
  19223. [splitout2] pad=200:200:100:100 [padout];
  19224. @end example
  19225. @item
  19226. Create 5 copies of the input audio with @command{ffmpeg}:
  19227. @example
  19228. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  19229. @end example
  19230. @end itemize
  19231. @section zmq, azmq
  19232. Receive commands sent through a libzmq client, and forward them to
  19233. filters in the filtergraph.
  19234. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  19235. must be inserted between two video filters, @code{azmq} between two
  19236. audio filters. Both are capable to send messages to any filter type.
  19237. To enable these filters you need to install the libzmq library and
  19238. headers and configure FFmpeg with @code{--enable-libzmq}.
  19239. For more information about libzmq see:
  19240. @url{http://www.zeromq.org/}
  19241. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  19242. receives messages sent through a network interface defined by the
  19243. @option{bind_address} (or the abbreviation "@option{b}") option.
  19244. Default value of this option is @file{tcp://localhost:5555}. You may
  19245. want to alter this value to your needs, but do not forget to escape any
  19246. ':' signs (see @ref{filtergraph escaping}).
  19247. The received message must be in the form:
  19248. @example
  19249. @var{TARGET} @var{COMMAND} [@var{ARG}]
  19250. @end example
  19251. @var{TARGET} specifies the target of the command, usually the name of
  19252. the filter class or a specific filter instance name. The default
  19253. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  19254. but you can override this by using the @samp{filter_name@@id} syntax
  19255. (see @ref{Filtergraph syntax}).
  19256. @var{COMMAND} specifies the name of the command for the target filter.
  19257. @var{ARG} is optional and specifies the optional argument list for the
  19258. given @var{COMMAND}.
  19259. Upon reception, the message is processed and the corresponding command
  19260. is injected into the filtergraph. Depending on the result, the filter
  19261. will send a reply to the client, adopting the format:
  19262. @example
  19263. @var{ERROR_CODE} @var{ERROR_REASON}
  19264. @var{MESSAGE}
  19265. @end example
  19266. @var{MESSAGE} is optional.
  19267. @subsection Examples
  19268. Look at @file{tools/zmqsend} for an example of a zmq client which can
  19269. be used to send commands processed by these filters.
  19270. Consider the following filtergraph generated by @command{ffplay}.
  19271. In this example the last overlay filter has an instance name. All other
  19272. filters will have default instance names.
  19273. @example
  19274. ffplay -dumpgraph 1 -f lavfi "
  19275. color=s=100x100:c=red [l];
  19276. color=s=100x100:c=blue [r];
  19277. nullsrc=s=200x100, zmq [bg];
  19278. [bg][l] overlay [bg+l];
  19279. [bg+l][r] overlay@@my=x=100 "
  19280. @end example
  19281. To change the color of the left side of the video, the following
  19282. command can be used:
  19283. @example
  19284. echo Parsed_color_0 c yellow | tools/zmqsend
  19285. @end example
  19286. To change the right side:
  19287. @example
  19288. echo Parsed_color_1 c pink | tools/zmqsend
  19289. @end example
  19290. To change the position of the right side:
  19291. @example
  19292. echo overlay@@my x 150 | tools/zmqsend
  19293. @end example
  19294. @c man end MULTIMEDIA FILTERS
  19295. @chapter Multimedia Sources
  19296. @c man begin MULTIMEDIA SOURCES
  19297. Below is a description of the currently available multimedia sources.
  19298. @section amovie
  19299. This is the same as @ref{movie} source, except it selects an audio
  19300. stream by default.
  19301. @anchor{movie}
  19302. @section movie
  19303. Read audio and/or video stream(s) from a movie container.
  19304. It accepts the following parameters:
  19305. @table @option
  19306. @item filename
  19307. The name of the resource to read (not necessarily a file; it can also be a
  19308. device or a stream accessed through some protocol).
  19309. @item format_name, f
  19310. Specifies the format assumed for the movie to read, and can be either
  19311. the name of a container or an input device. If not specified, the
  19312. format is guessed from @var{movie_name} or by probing.
  19313. @item seek_point, sp
  19314. Specifies the seek point in seconds. The frames will be output
  19315. starting from this seek point. The parameter is evaluated with
  19316. @code{av_strtod}, so the numerical value may be suffixed by an IS
  19317. postfix. The default value is "0".
  19318. @item streams, s
  19319. Specifies the streams to read. Several streams can be specified,
  19320. separated by "+". The source will then have as many outputs, in the
  19321. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  19322. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  19323. respectively the default (best suited) video and audio stream. Default
  19324. is "dv", or "da" if the filter is called as "amovie".
  19325. @item stream_index, si
  19326. Specifies the index of the video stream to read. If the value is -1,
  19327. the most suitable video stream will be automatically selected. The default
  19328. value is "-1". Deprecated. If the filter is called "amovie", it will select
  19329. audio instead of video.
  19330. @item loop
  19331. Specifies how many times to read the stream in sequence.
  19332. If the value is 0, the stream will be looped infinitely.
  19333. Default value is "1".
  19334. Note that when the movie is looped the source timestamps are not
  19335. changed, so it will generate non monotonically increasing timestamps.
  19336. @item discontinuity
  19337. Specifies the time difference between frames above which the point is
  19338. considered a timestamp discontinuity which is removed by adjusting the later
  19339. timestamps.
  19340. @end table
  19341. It allows overlaying a second video on top of the main input of
  19342. a filtergraph, as shown in this graph:
  19343. @example
  19344. input -----------> deltapts0 --> overlay --> output
  19345. ^
  19346. |
  19347. movie --> scale--> deltapts1 -------+
  19348. @end example
  19349. @subsection Examples
  19350. @itemize
  19351. @item
  19352. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  19353. on top of the input labelled "in":
  19354. @example
  19355. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  19356. [in] setpts=PTS-STARTPTS [main];
  19357. [main][over] overlay=16:16 [out]
  19358. @end example
  19359. @item
  19360. Read from a video4linux2 device, and overlay it on top of the input
  19361. labelled "in":
  19362. @example
  19363. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  19364. [in] setpts=PTS-STARTPTS [main];
  19365. [main][over] overlay=16:16 [out]
  19366. @end example
  19367. @item
  19368. Read the first video stream and the audio stream with id 0x81 from
  19369. dvd.vob; the video is connected to the pad named "video" and the audio is
  19370. connected to the pad named "audio":
  19371. @example
  19372. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  19373. @end example
  19374. @end itemize
  19375. @subsection Commands
  19376. Both movie and amovie support the following commands:
  19377. @table @option
  19378. @item seek
  19379. Perform seek using "av_seek_frame".
  19380. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  19381. @itemize
  19382. @item
  19383. @var{stream_index}: If stream_index is -1, a default
  19384. stream is selected, and @var{timestamp} is automatically converted
  19385. from AV_TIME_BASE units to the stream specific time_base.
  19386. @item
  19387. @var{timestamp}: Timestamp in AVStream.time_base units
  19388. or, if no stream is specified, in AV_TIME_BASE units.
  19389. @item
  19390. @var{flags}: Flags which select direction and seeking mode.
  19391. @end itemize
  19392. @item get_duration
  19393. Get movie duration in AV_TIME_BASE units.
  19394. @end table
  19395. @c man end MULTIMEDIA SOURCES