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.

24065 lines
639KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{framesync}
  252. @chapter Options for filters with several inputs (framesync)
  253. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  254. Some filters with several inputs support a common set of options.
  255. These options can only be set by name, not with the short notation.
  256. @table @option
  257. @item eof_action
  258. The action to take when EOF is encountered on the secondary input; it accepts
  259. one of the following values:
  260. @table @option
  261. @item repeat
  262. Repeat the last frame (the default).
  263. @item endall
  264. End both streams.
  265. @item pass
  266. Pass the main input through.
  267. @end table
  268. @item shortest
  269. If set to 1, force the output to terminate when the shortest input
  270. terminates. Default value is 0.
  271. @item repeatlast
  272. If set to 1, force the filter to extend the last frame of secondary streams
  273. until the end of the primary stream. A value of 0 disables this behavior.
  274. Default value is 1.
  275. @end table
  276. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  277. @chapter Audio Filters
  278. @c man begin AUDIO FILTERS
  279. When you configure your FFmpeg build, you can disable any of the
  280. existing filters using @code{--disable-filters}.
  281. The configure output will show the audio filters included in your
  282. build.
  283. Below is a description of the currently available audio filters.
  284. @section acompressor
  285. A compressor is mainly used to reduce the dynamic range of a signal.
  286. Especially modern music is mostly compressed at a high ratio to
  287. improve the overall loudness. It's done to get the highest attention
  288. of a listener, "fatten" the sound and bring more "power" to the track.
  289. If a signal is compressed too much it may sound dull or "dead"
  290. afterwards or it may start to "pump" (which could be a powerful effect
  291. but can also destroy a track completely).
  292. The right compression is the key to reach a professional sound and is
  293. the high art of mixing and mastering. Because of its complex settings
  294. it may take a long time to get the right feeling for this kind of effect.
  295. Compression is done by detecting the volume above a chosen level
  296. @code{threshold} and dividing it by the factor set with @code{ratio}.
  297. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  298. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  299. the signal would cause distortion of the waveform the reduction can be
  300. levelled over the time. This is done by setting "Attack" and "Release".
  301. @code{attack} determines how long the signal has to rise above the threshold
  302. before any reduction will occur and @code{release} sets the time the signal
  303. has to fall below the threshold to reduce the reduction again. Shorter signals
  304. than the chosen attack time will be left untouched.
  305. The overall reduction of the signal can be made up afterwards with the
  306. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  307. raising the makeup to this level results in a signal twice as loud than the
  308. source. To gain a softer entry in the compression the @code{knee} flattens the
  309. hard edge at the threshold in the range of the chosen decibels.
  310. The filter accepts the following options:
  311. @table @option
  312. @item level_in
  313. Set input gain. Default is 1. Range is between 0.015625 and 64.
  314. @item mode
  315. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  316. Default is @code{downward}.
  317. @item threshold
  318. If a signal of stream rises above this level it will affect the gain
  319. reduction.
  320. By default it is 0.125. Range is between 0.00097563 and 1.
  321. @item ratio
  322. Set a ratio by which the signal is reduced. 1:2 means that if the level
  323. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  324. Default is 2. Range is between 1 and 20.
  325. @item attack
  326. Amount of milliseconds the signal has to rise above the threshold before gain
  327. reduction starts. Default is 20. Range is between 0.01 and 2000.
  328. @item release
  329. Amount of milliseconds the signal has to fall below the threshold before
  330. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  331. @item makeup
  332. Set the amount by how much signal will be amplified after processing.
  333. Default is 1. Range is from 1 to 64.
  334. @item knee
  335. Curve the sharp knee around the threshold to enter gain reduction more softly.
  336. Default is 2.82843. Range is between 1 and 8.
  337. @item link
  338. Choose if the @code{average} level between all channels of input stream
  339. or the louder(@code{maximum}) channel of input stream affects the
  340. reduction. Default is @code{average}.
  341. @item detection
  342. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  343. of @code{rms}. Default is @code{rms} which is mostly smoother.
  344. @item mix
  345. How much to use compressed signal in output. Default is 1.
  346. Range is between 0 and 1.
  347. @end table
  348. @section acontrast
  349. Simple audio dynamic range compression/expansion filter.
  350. The filter accepts the following options:
  351. @table @option
  352. @item contrast
  353. Set contrast. Default is 33. Allowed range is between 0 and 100.
  354. @end table
  355. @section acopy
  356. Copy the input audio source unchanged to the output. This is mainly useful for
  357. testing purposes.
  358. @section acrossfade
  359. Apply cross fade from one input audio stream to another input audio stream.
  360. The cross fade is applied for specified duration near the end of first stream.
  361. The filter accepts the following options:
  362. @table @option
  363. @item nb_samples, ns
  364. Specify the number of samples for which the cross fade effect has to last.
  365. At the end of the cross fade effect the first input audio will be completely
  366. silent. Default is 44100.
  367. @item duration, d
  368. Specify the duration of the cross fade effect. See
  369. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  370. for the accepted syntax.
  371. By default the duration is determined by @var{nb_samples}.
  372. If set this option is used instead of @var{nb_samples}.
  373. @item overlap, o
  374. Should first stream end overlap with second stream start. Default is enabled.
  375. @item curve1
  376. Set curve for cross fade transition for first stream.
  377. @item curve2
  378. Set curve for cross fade transition for second stream.
  379. For description of available curve types see @ref{afade} filter description.
  380. @end table
  381. @subsection Examples
  382. @itemize
  383. @item
  384. Cross fade from one input to another:
  385. @example
  386. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  387. @end example
  388. @item
  389. Cross fade from one input to another but without overlapping:
  390. @example
  391. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  392. @end example
  393. @end itemize
  394. @section acrossover
  395. Split audio stream into several bands.
  396. This filter splits audio stream into two or more frequency ranges.
  397. Summing all streams back will give flat output.
  398. The filter accepts the following options:
  399. @table @option
  400. @item split
  401. Set split frequencies. Those must be positive and increasing.
  402. @item order
  403. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  404. Default is @var{4th}.
  405. @end table
  406. @section acrusher
  407. Reduce audio bit resolution.
  408. This filter is bit crusher with enhanced functionality. A bit crusher
  409. is used to audibly reduce number of bits an audio signal is sampled
  410. with. This doesn't change the bit depth at all, it just produces the
  411. effect. Material reduced in bit depth sounds more harsh and "digital".
  412. This filter is able to even round to continuous values instead of discrete
  413. bit depths.
  414. Additionally it has a D/C offset which results in different crushing of
  415. the lower and the upper half of the signal.
  416. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  417. Another feature of this filter is the logarithmic mode.
  418. This setting switches from linear distances between bits to logarithmic ones.
  419. The result is a much more "natural" sounding crusher which doesn't gate low
  420. signals for example. The human ear has a logarithmic perception,
  421. so this kind of crushing is much more pleasant.
  422. Logarithmic crushing is also able to get anti-aliased.
  423. The filter accepts the following options:
  424. @table @option
  425. @item level_in
  426. Set level in.
  427. @item level_out
  428. Set level out.
  429. @item bits
  430. Set bit reduction.
  431. @item mix
  432. Set mixing amount.
  433. @item mode
  434. Can be linear: @code{lin} or logarithmic: @code{log}.
  435. @item dc
  436. Set DC.
  437. @item aa
  438. Set anti-aliasing.
  439. @item samples
  440. Set sample reduction.
  441. @item lfo
  442. Enable LFO. By default disabled.
  443. @item lforange
  444. Set LFO range.
  445. @item lforate
  446. Set LFO rate.
  447. @end table
  448. @section acue
  449. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  450. filter.
  451. @section adeclick
  452. Remove impulsive noise from input audio.
  453. Samples detected as impulsive noise are replaced by interpolated samples using
  454. autoregressive modelling.
  455. @table @option
  456. @item w
  457. Set window size, in milliseconds. Allowed range is from @code{10} to
  458. @code{100}. Default value is @code{55} milliseconds.
  459. This sets size of window which will be processed at once.
  460. @item o
  461. Set window overlap, in percentage of window size. Allowed range is from
  462. @code{50} to @code{95}. Default value is @code{75} percent.
  463. Setting this to a very high value increases impulsive noise removal but makes
  464. whole process much slower.
  465. @item a
  466. Set autoregression order, in percentage of window size. Allowed range is from
  467. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  468. controls quality of interpolated samples using neighbour good samples.
  469. @item t
  470. Set threshold value. Allowed range is from @code{1} to @code{100}.
  471. Default value is @code{2}.
  472. This controls the strength of impulsive noise which is going to be removed.
  473. The lower value, the more samples will be detected as impulsive noise.
  474. @item b
  475. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  476. @code{10}. Default value is @code{2}.
  477. If any two samples detected as noise are spaced less than this value then any
  478. sample between those two samples will be also detected as noise.
  479. @item m
  480. Set overlap method.
  481. It accepts the following values:
  482. @table @option
  483. @item a
  484. Select overlap-add method. Even not interpolated samples are slightly
  485. changed with this method.
  486. @item s
  487. Select overlap-save method. Not interpolated samples remain unchanged.
  488. @end table
  489. Default value is @code{a}.
  490. @end table
  491. @section adeclip
  492. Remove clipped samples from input audio.
  493. Samples detected as clipped are replaced by interpolated samples using
  494. autoregressive modelling.
  495. @table @option
  496. @item w
  497. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  498. Default value is @code{55} milliseconds.
  499. This sets size of window which will be processed at once.
  500. @item o
  501. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  502. to @code{95}. Default value is @code{75} percent.
  503. @item a
  504. Set autoregression order, in percentage of window size. Allowed range is from
  505. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  506. quality of interpolated samples using neighbour good samples.
  507. @item t
  508. Set threshold value. Allowed range is from @code{1} to @code{100}.
  509. Default value is @code{10}. Higher values make clip detection less aggressive.
  510. @item n
  511. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  512. Default value is @code{1000}. Higher values make clip detection less aggressive.
  513. @item m
  514. Set overlap method.
  515. It accepts the following values:
  516. @table @option
  517. @item a
  518. Select overlap-add method. Even not interpolated samples are slightly changed
  519. with this method.
  520. @item s
  521. Select overlap-save method. Not interpolated samples remain unchanged.
  522. @end table
  523. Default value is @code{a}.
  524. @end table
  525. @section adelay
  526. Delay one or more audio channels.
  527. Samples in delayed channel are filled with silence.
  528. The filter accepts the following option:
  529. @table @option
  530. @item delays
  531. Set list of delays in milliseconds for each channel separated by '|'.
  532. Unused delays will be silently ignored. If number of given delays is
  533. smaller than number of channels all remaining channels will not be delayed.
  534. If you want to delay exact number of samples, append 'S' to number.
  535. If you want instead to delay in seconds, append 's' to number.
  536. @end table
  537. @subsection Examples
  538. @itemize
  539. @item
  540. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  541. the second channel (and any other channels that may be present) unchanged.
  542. @example
  543. adelay=1500|0|500
  544. @end example
  545. @item
  546. Delay second channel by 500 samples, the third channel by 700 samples and leave
  547. the first channel (and any other channels that may be present) unchanged.
  548. @example
  549. adelay=0|500S|700S
  550. @end example
  551. @end itemize
  552. @section aderivative, aintegral
  553. Compute derivative/integral of audio stream.
  554. Applying both filters one after another produces original audio.
  555. @section aecho
  556. Apply echoing to the input audio.
  557. Echoes are reflected sound and can occur naturally amongst mountains
  558. (and sometimes large buildings) when talking or shouting; digital echo
  559. effects emulate this behaviour and are often used to help fill out the
  560. sound of a single instrument or vocal. The time difference between the
  561. original signal and the reflection is the @code{delay}, and the
  562. loudness of the reflected signal is the @code{decay}.
  563. Multiple echoes can have different delays and decays.
  564. A description of the accepted parameters follows.
  565. @table @option
  566. @item in_gain
  567. Set input gain of reflected signal. Default is @code{0.6}.
  568. @item out_gain
  569. Set output gain of reflected signal. Default is @code{0.3}.
  570. @item delays
  571. Set list of time intervals in milliseconds between original signal and reflections
  572. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  573. Default is @code{1000}.
  574. @item decays
  575. Set list of loudness of reflected signals separated by '|'.
  576. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  577. Default is @code{0.5}.
  578. @end table
  579. @subsection Examples
  580. @itemize
  581. @item
  582. Make it sound as if there are twice as many instruments as are actually playing:
  583. @example
  584. aecho=0.8:0.88:60:0.4
  585. @end example
  586. @item
  587. If delay is very short, then it sounds like a (metallic) robot playing music:
  588. @example
  589. aecho=0.8:0.88:6:0.4
  590. @end example
  591. @item
  592. A longer delay will sound like an open air concert in the mountains:
  593. @example
  594. aecho=0.8:0.9:1000:0.3
  595. @end example
  596. @item
  597. Same as above but with one more mountain:
  598. @example
  599. aecho=0.8:0.9:1000|1800:0.3|0.25
  600. @end example
  601. @end itemize
  602. @section aemphasis
  603. Audio emphasis filter creates or restores material directly taken from LPs or
  604. emphased CDs with different filter curves. E.g. to store music on vinyl the
  605. signal has to be altered by a filter first to even out the disadvantages of
  606. this recording medium.
  607. Once the material is played back the inverse filter has to be applied to
  608. restore the distortion of the frequency response.
  609. The filter accepts the following options:
  610. @table @option
  611. @item level_in
  612. Set input gain.
  613. @item level_out
  614. Set output gain.
  615. @item mode
  616. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  617. use @code{production} mode. Default is @code{reproduction} mode.
  618. @item type
  619. Set filter type. Selects medium. Can be one of the following:
  620. @table @option
  621. @item col
  622. select Columbia.
  623. @item emi
  624. select EMI.
  625. @item bsi
  626. select BSI (78RPM).
  627. @item riaa
  628. select RIAA.
  629. @item cd
  630. select Compact Disc (CD).
  631. @item 50fm
  632. select 50µs (FM).
  633. @item 75fm
  634. select 75µs (FM).
  635. @item 50kf
  636. select 50µs (FM-KF).
  637. @item 75kf
  638. select 75µs (FM-KF).
  639. @end table
  640. @end table
  641. @section aeval
  642. Modify an audio signal according to the specified expressions.
  643. This filter accepts one or more expressions (one for each channel),
  644. which are evaluated and used to modify a corresponding audio signal.
  645. It accepts the following parameters:
  646. @table @option
  647. @item exprs
  648. Set the '|'-separated expressions list for each separate channel. If
  649. the number of input channels is greater than the number of
  650. expressions, the last specified expression is used for the remaining
  651. output channels.
  652. @item channel_layout, c
  653. Set output channel layout. If not specified, the channel layout is
  654. specified by the number of expressions. If set to @samp{same}, it will
  655. use by default the same input channel layout.
  656. @end table
  657. Each expression in @var{exprs} can contain the following constants and functions:
  658. @table @option
  659. @item ch
  660. channel number of the current expression
  661. @item n
  662. number of the evaluated sample, starting from 0
  663. @item s
  664. sample rate
  665. @item t
  666. time of the evaluated sample expressed in seconds
  667. @item nb_in_channels
  668. @item nb_out_channels
  669. input and output number of channels
  670. @item val(CH)
  671. the value of input channel with number @var{CH}
  672. @end table
  673. Note: this filter is slow. For faster processing you should use a
  674. dedicated filter.
  675. @subsection Examples
  676. @itemize
  677. @item
  678. Half volume:
  679. @example
  680. aeval=val(ch)/2:c=same
  681. @end example
  682. @item
  683. Invert phase of the second channel:
  684. @example
  685. aeval=val(0)|-val(1)
  686. @end example
  687. @end itemize
  688. @anchor{afade}
  689. @section afade
  690. Apply fade-in/out effect to input audio.
  691. A description of the accepted parameters follows.
  692. @table @option
  693. @item type, t
  694. Specify the effect type, can be either @code{in} for fade-in, or
  695. @code{out} for a fade-out effect. Default is @code{in}.
  696. @item start_sample, ss
  697. Specify the number of the start sample for starting to apply the fade
  698. effect. Default is 0.
  699. @item nb_samples, ns
  700. Specify the number of samples for which the fade effect has to last. At
  701. the end of the fade-in effect the output audio will have the same
  702. volume as the input audio, at the end of the fade-out transition
  703. the output audio will be silence. Default is 44100.
  704. @item start_time, st
  705. Specify the start time of the fade effect. Default is 0.
  706. The value must be specified as a time duration; see
  707. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  708. for the accepted syntax.
  709. If set this option is used instead of @var{start_sample}.
  710. @item duration, d
  711. Specify the duration of the fade effect. See
  712. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  713. for the accepted syntax.
  714. At the end of the fade-in effect the output audio will have the same
  715. volume as the input audio, at the end of the fade-out transition
  716. the output audio will be silence.
  717. By default the duration is determined by @var{nb_samples}.
  718. If set this option is used instead of @var{nb_samples}.
  719. @item curve
  720. Set curve for fade transition.
  721. It accepts the following values:
  722. @table @option
  723. @item tri
  724. select triangular, linear slope (default)
  725. @item qsin
  726. select quarter of sine wave
  727. @item hsin
  728. select half of sine wave
  729. @item esin
  730. select exponential sine wave
  731. @item log
  732. select logarithmic
  733. @item ipar
  734. select inverted parabola
  735. @item qua
  736. select quadratic
  737. @item cub
  738. select cubic
  739. @item squ
  740. select square root
  741. @item cbr
  742. select cubic root
  743. @item par
  744. select parabola
  745. @item exp
  746. select exponential
  747. @item iqsin
  748. select inverted quarter of sine wave
  749. @item ihsin
  750. select inverted half of sine wave
  751. @item dese
  752. select double-exponential seat
  753. @item desi
  754. select double-exponential sigmoid
  755. @item losi
  756. select logistic sigmoid
  757. @item nofade
  758. no fade applied
  759. @end table
  760. @end table
  761. @subsection Examples
  762. @itemize
  763. @item
  764. Fade in first 15 seconds of audio:
  765. @example
  766. afade=t=in:ss=0:d=15
  767. @end example
  768. @item
  769. Fade out last 25 seconds of a 900 seconds audio:
  770. @example
  771. afade=t=out:st=875:d=25
  772. @end example
  773. @end itemize
  774. @section afftdn
  775. Denoise audio samples with FFT.
  776. A description of the accepted parameters follows.
  777. @table @option
  778. @item nr
  779. Set the noise reduction in dB, allowed range is 0.01 to 97.
  780. Default value is 12 dB.
  781. @item nf
  782. Set the noise floor in dB, allowed range is -80 to -20.
  783. Default value is -50 dB.
  784. @item nt
  785. Set the noise type.
  786. It accepts the following values:
  787. @table @option
  788. @item w
  789. Select white noise.
  790. @item v
  791. Select vinyl noise.
  792. @item s
  793. Select shellac noise.
  794. @item c
  795. Select custom noise, defined in @code{bn} option.
  796. Default value is white noise.
  797. @end table
  798. @item bn
  799. Set custom band noise for every one of 15 bands.
  800. Bands are separated by ' ' or '|'.
  801. @item rf
  802. Set the residual floor in dB, allowed range is -80 to -20.
  803. Default value is -38 dB.
  804. @item tn
  805. Enable noise tracking. By default is disabled.
  806. With this enabled, noise floor is automatically adjusted.
  807. @item tr
  808. Enable residual tracking. By default is disabled.
  809. @item om
  810. Set the output mode.
  811. It accepts the following values:
  812. @table @option
  813. @item i
  814. Pass input unchanged.
  815. @item o
  816. Pass noise filtered out.
  817. @item n
  818. Pass only noise.
  819. Default value is @var{o}.
  820. @end table
  821. @end table
  822. @subsection Commands
  823. This filter supports the following commands:
  824. @table @option
  825. @item sample_noise, sn
  826. Start or stop measuring noise profile.
  827. Syntax for the command is : "start" or "stop" string.
  828. After measuring noise profile is stopped it will be
  829. automatically applied in filtering.
  830. @item noise_reduction, nr
  831. Change noise reduction. Argument is single float number.
  832. Syntax for the command is : "@var{noise_reduction}"
  833. @item noise_floor, nf
  834. Change noise floor. Argument is single float number.
  835. Syntax for the command is : "@var{noise_floor}"
  836. @item output_mode, om
  837. Change output mode operation.
  838. Syntax for the command is : "i", "o" or "n" string.
  839. @end table
  840. @section afftfilt
  841. Apply arbitrary expressions to samples in frequency domain.
  842. @table @option
  843. @item real
  844. Set frequency domain real expression for each separate channel separated
  845. by '|'. Default is "re".
  846. If the number of input channels is greater than the number of
  847. expressions, the last specified expression is used for the remaining
  848. output channels.
  849. @item imag
  850. Set frequency domain imaginary expression for each separate channel
  851. separated by '|'. Default is "im".
  852. Each expression in @var{real} and @var{imag} can contain the following
  853. constants and functions:
  854. @table @option
  855. @item sr
  856. sample rate
  857. @item b
  858. current frequency bin number
  859. @item nb
  860. number of available bins
  861. @item ch
  862. channel number of the current expression
  863. @item chs
  864. number of channels
  865. @item pts
  866. current frame pts
  867. @item re
  868. current real part of frequency bin of current channel
  869. @item im
  870. current imaginary part of frequency bin of current channel
  871. @item real(b, ch)
  872. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  873. @item imag(b, ch)
  874. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  875. @end table
  876. @item win_size
  877. Set window size. Allowed range is from 16 to 131072.
  878. Default is @code{4096}
  879. @item win_func
  880. Set window function. Default is @code{hann}.
  881. @item overlap
  882. Set window overlap. If set to 1, the recommended overlap for selected
  883. window function will be picked. Default is @code{0.75}.
  884. @end table
  885. @subsection Examples
  886. @itemize
  887. @item
  888. Leave almost only low frequencies in audio:
  889. @example
  890. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  891. @end example
  892. @end itemize
  893. @anchor{afir}
  894. @section afir
  895. Apply an arbitrary Frequency Impulse Response filter.
  896. This filter is designed for applying long FIR filters,
  897. up to 60 seconds long.
  898. It can be used as component for digital crossover filters,
  899. room equalization, cross talk cancellation, wavefield synthesis,
  900. auralization, ambiophonics, ambisonics and spatialization.
  901. This filter uses the second stream as FIR coefficients.
  902. If the second stream holds a single channel, it will be used
  903. for all input channels in the first stream, otherwise
  904. the number of channels in the second stream must be same as
  905. the number of channels in the first stream.
  906. It accepts the following parameters:
  907. @table @option
  908. @item dry
  909. Set dry gain. This sets input gain.
  910. @item wet
  911. Set wet gain. This sets final output gain.
  912. @item length
  913. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  914. @item gtype
  915. Enable applying gain measured from power of IR.
  916. Set which approach to use for auto gain measurement.
  917. @table @option
  918. @item none
  919. Do not apply any gain.
  920. @item peak
  921. select peak gain, very conservative approach. This is default value.
  922. @item dc
  923. select DC gain, limited application.
  924. @item gn
  925. select gain to noise approach, this is most popular one.
  926. @end table
  927. @item irgain
  928. Set gain to be applied to IR coefficients before filtering.
  929. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  930. @item irfmt
  931. Set format of IR stream. Can be @code{mono} or @code{input}.
  932. Default is @code{input}.
  933. @item maxir
  934. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  935. Allowed range is 0.1 to 60 seconds.
  936. @item response
  937. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  938. By default it is disabled.
  939. @item channel
  940. Set for which IR channel to display frequency response. By default is first channel
  941. displayed. This option is used only when @var{response} is enabled.
  942. @item size
  943. Set video stream size. This option is used only when @var{response} is enabled.
  944. @item rate
  945. Set video stream frame rate. This option is used only when @var{response} is enabled.
  946. @item minp
  947. Set minimal partition size used for convolution. Default is @var{8192}.
  948. Allowed range is from @var{8} to @var{32768}.
  949. Lower values decreases latency at cost of higher CPU usage.
  950. @item maxp
  951. Set maximal partition size used for convolution. Default is @var{8192}.
  952. Allowed range is from @var{8} to @var{32768}.
  953. Lower values may increase CPU usage.
  954. @end table
  955. @subsection Examples
  956. @itemize
  957. @item
  958. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  959. @example
  960. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  961. @end example
  962. @end itemize
  963. @anchor{aformat}
  964. @section aformat
  965. Set output format constraints for the input audio. The framework will
  966. negotiate the most appropriate format to minimize conversions.
  967. It accepts the following parameters:
  968. @table @option
  969. @item sample_fmts
  970. A '|'-separated list of requested sample formats.
  971. @item sample_rates
  972. A '|'-separated list of requested sample rates.
  973. @item channel_layouts
  974. A '|'-separated list of requested channel layouts.
  975. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  976. for the required syntax.
  977. @end table
  978. If a parameter is omitted, all values are allowed.
  979. Force the output to either unsigned 8-bit or signed 16-bit stereo
  980. @example
  981. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  982. @end example
  983. @section agate
  984. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  985. processing reduces disturbing noise between useful signals.
  986. Gating is done by detecting the volume below a chosen level @var{threshold}
  987. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  988. floor is set via @var{range}. Because an exact manipulation of the signal
  989. would cause distortion of the waveform the reduction can be levelled over
  990. time. This is done by setting @var{attack} and @var{release}.
  991. @var{attack} determines how long the signal has to fall below the threshold
  992. before any reduction will occur and @var{release} sets the time the signal
  993. has to rise above the threshold to reduce the reduction again.
  994. Shorter signals than the chosen attack time will be left untouched.
  995. @table @option
  996. @item level_in
  997. Set input level before filtering.
  998. Default is 1. Allowed range is from 0.015625 to 64.
  999. @item mode
  1000. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1001. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1002. will be amplified, expanding dynamic range in upward direction.
  1003. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1004. @item range
  1005. Set the level of gain reduction when the signal is below the threshold.
  1006. Default is 0.06125. Allowed range is from 0 to 1.
  1007. Setting this to 0 disables reduction and then filter behaves like expander.
  1008. @item threshold
  1009. If a signal rises above this level the gain reduction is released.
  1010. Default is 0.125. Allowed range is from 0 to 1.
  1011. @item ratio
  1012. Set a ratio by which the signal is reduced.
  1013. Default is 2. Allowed range is from 1 to 9000.
  1014. @item attack
  1015. Amount of milliseconds the signal has to rise above the threshold before gain
  1016. reduction stops.
  1017. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1018. @item release
  1019. Amount of milliseconds the signal has to fall below the threshold before the
  1020. reduction is increased again. Default is 250 milliseconds.
  1021. Allowed range is from 0.01 to 9000.
  1022. @item makeup
  1023. Set amount of amplification of signal after processing.
  1024. Default is 1. Allowed range is from 1 to 64.
  1025. @item knee
  1026. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1027. Default is 2.828427125. Allowed range is from 1 to 8.
  1028. @item detection
  1029. Choose if exact signal should be taken for detection or an RMS like one.
  1030. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1031. @item link
  1032. Choose if the average level between all channels or the louder channel affects
  1033. the reduction.
  1034. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1035. @end table
  1036. @section aiir
  1037. Apply an arbitrary Infinite Impulse Response filter.
  1038. It accepts the following parameters:
  1039. @table @option
  1040. @item z
  1041. Set numerator/zeros coefficients.
  1042. @item p
  1043. Set denominator/poles coefficients.
  1044. @item k
  1045. Set channels gains.
  1046. @item dry_gain
  1047. Set input gain.
  1048. @item wet_gain
  1049. Set output gain.
  1050. @item f
  1051. Set coefficients format.
  1052. @table @samp
  1053. @item tf
  1054. transfer function
  1055. @item zp
  1056. Z-plane zeros/poles, cartesian (default)
  1057. @item pr
  1058. Z-plane zeros/poles, polar radians
  1059. @item pd
  1060. Z-plane zeros/poles, polar degrees
  1061. @end table
  1062. @item r
  1063. Set kind of processing.
  1064. Can be @code{d} - direct or @code{s} - serial cascading. Default is @code{s}.
  1065. @item e
  1066. Set filtering precision.
  1067. @table @samp
  1068. @item dbl
  1069. double-precision floating-point (default)
  1070. @item flt
  1071. single-precision floating-point
  1072. @item i32
  1073. 32-bit integers
  1074. @item i16
  1075. 16-bit integers
  1076. @end table
  1077. @item mix
  1078. How much to use filtered signal in output. Default is 1.
  1079. Range is between 0 and 1.
  1080. @item response
  1081. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1082. By default it is disabled.
  1083. @item channel
  1084. Set for which IR channel to display frequency response. By default is first channel
  1085. displayed. This option is used only when @var{response} is enabled.
  1086. @item size
  1087. Set video stream size. This option is used only when @var{response} is enabled.
  1088. @end table
  1089. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1090. order.
  1091. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1092. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1093. imaginary unit.
  1094. Different coefficients and gains can be provided for every channel, in such case
  1095. use '|' to separate coefficients or gains. Last provided coefficients will be
  1096. used for all remaining channels.
  1097. @subsection Examples
  1098. @itemize
  1099. @item
  1100. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1101. @example
  1102. aiir=k=1:z=7.957584807809675810E-1 -2.575128568908332300 3.674839853930788710 -2.57512875289799137 7.957586296317130880E-1:p=1 -2.86950072432325953 3.63022088054647218 -2.28075678147272232 6.361362326477423500E-1:f=tf:r=d
  1103. @end example
  1104. @item
  1105. Same as above but in @code{zp} format:
  1106. @example
  1107. aiir=k=0.79575848078096756:z=0.80918701+0.58773007i 0.80918701-0.58773007i 0.80884700+0.58784055i 0.80884700-0.58784055i:p=0.63892345+0.59951235i 0.63892345-0.59951235i 0.79582691+0.44198673i 0.79582691-0.44198673i:f=zp:r=s
  1108. @end example
  1109. @end itemize
  1110. @section alimiter
  1111. The limiter prevents an input signal from rising over a desired threshold.
  1112. This limiter uses lookahead technology to prevent your signal from distorting.
  1113. It means that there is a small delay after the signal is processed. Keep in mind
  1114. that the delay it produces is the attack time you set.
  1115. The filter accepts the following options:
  1116. @table @option
  1117. @item level_in
  1118. Set input gain. Default is 1.
  1119. @item level_out
  1120. Set output gain. Default is 1.
  1121. @item limit
  1122. Don't let signals above this level pass the limiter. Default is 1.
  1123. @item attack
  1124. The limiter will reach its attenuation level in this amount of time in
  1125. milliseconds. Default is 5 milliseconds.
  1126. @item release
  1127. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1128. Default is 50 milliseconds.
  1129. @item asc
  1130. When gain reduction is always needed ASC takes care of releasing to an
  1131. average reduction level rather than reaching a reduction of 0 in the release
  1132. time.
  1133. @item asc_level
  1134. Select how much the release time is affected by ASC, 0 means nearly no changes
  1135. in release time while 1 produces higher release times.
  1136. @item level
  1137. Auto level output signal. Default is enabled.
  1138. This normalizes audio back to 0dB if enabled.
  1139. @end table
  1140. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1141. with @ref{aresample} before applying this filter.
  1142. @section allpass
  1143. Apply a two-pole all-pass filter with central frequency (in Hz)
  1144. @var{frequency}, and filter-width @var{width}.
  1145. An all-pass filter changes the audio's frequency to phase relationship
  1146. without changing its frequency to amplitude relationship.
  1147. The filter accepts the following options:
  1148. @table @option
  1149. @item frequency, f
  1150. Set frequency in Hz.
  1151. @item width_type, t
  1152. Set method to specify band-width of filter.
  1153. @table @option
  1154. @item h
  1155. Hz
  1156. @item q
  1157. Q-Factor
  1158. @item o
  1159. octave
  1160. @item s
  1161. slope
  1162. @item k
  1163. kHz
  1164. @end table
  1165. @item width, w
  1166. Specify the band-width of a filter in width_type units.
  1167. @item mix, m
  1168. How much to use filtered signal in output. Default is 1.
  1169. Range is between 0 and 1.
  1170. @item channels, c
  1171. Specify which channels to filter, by default all available are filtered.
  1172. @end table
  1173. @subsection Commands
  1174. This filter supports the following commands:
  1175. @table @option
  1176. @item frequency, f
  1177. Change allpass frequency.
  1178. Syntax for the command is : "@var{frequency}"
  1179. @item width_type, t
  1180. Change allpass width_type.
  1181. Syntax for the command is : "@var{width_type}"
  1182. @item width, w
  1183. Change allpass width.
  1184. Syntax for the command is : "@var{width}"
  1185. @item mix, m
  1186. Change allpass mix.
  1187. Syntax for the command is : "@var{mix}"
  1188. @end table
  1189. @section aloop
  1190. Loop audio samples.
  1191. The filter accepts the following options:
  1192. @table @option
  1193. @item loop
  1194. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1195. Default is 0.
  1196. @item size
  1197. Set maximal number of samples. Default is 0.
  1198. @item start
  1199. Set first sample of loop. Default is 0.
  1200. @end table
  1201. @anchor{amerge}
  1202. @section amerge
  1203. Merge two or more audio streams into a single multi-channel stream.
  1204. The filter accepts the following options:
  1205. @table @option
  1206. @item inputs
  1207. Set the number of inputs. Default is 2.
  1208. @end table
  1209. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1210. the channel layout of the output will be set accordingly and the channels
  1211. will be reordered as necessary. If the channel layouts of the inputs are not
  1212. disjoint, the output will have all the channels of the first input then all
  1213. the channels of the second input, in that order, and the channel layout of
  1214. the output will be the default value corresponding to the total number of
  1215. channels.
  1216. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1217. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1218. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1219. first input, b1 is the first channel of the second input).
  1220. On the other hand, if both input are in stereo, the output channels will be
  1221. in the default order: a1, a2, b1, b2, and the channel layout will be
  1222. arbitrarily set to 4.0, which may or may not be the expected value.
  1223. All inputs must have the same sample rate, and format.
  1224. If inputs do not have the same duration, the output will stop with the
  1225. shortest.
  1226. @subsection Examples
  1227. @itemize
  1228. @item
  1229. Merge two mono files into a stereo stream:
  1230. @example
  1231. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1232. @end example
  1233. @item
  1234. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1235. @example
  1236. ffmpeg -i input.mkv -filter_complex "[0:1][0:2][0:3][0:4][0:5][0:6] amerge=inputs=6" -c:a pcm_s16le output.mkv
  1237. @end example
  1238. @end itemize
  1239. @section amix
  1240. Mixes multiple audio inputs into a single output.
  1241. Note that this filter only supports float samples (the @var{amerge}
  1242. and @var{pan} audio filters support many formats). If the @var{amix}
  1243. input has integer samples then @ref{aresample} will be automatically
  1244. inserted to perform the conversion to float samples.
  1245. For example
  1246. @example
  1247. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1248. @end example
  1249. will mix 3 input audio streams to a single output with the same duration as the
  1250. first input and a dropout transition time of 3 seconds.
  1251. It accepts the following parameters:
  1252. @table @option
  1253. @item inputs
  1254. The number of inputs. If unspecified, it defaults to 2.
  1255. @item duration
  1256. How to determine the end-of-stream.
  1257. @table @option
  1258. @item longest
  1259. The duration of the longest input. (default)
  1260. @item shortest
  1261. The duration of the shortest input.
  1262. @item first
  1263. The duration of the first input.
  1264. @end table
  1265. @item dropout_transition
  1266. The transition time, in seconds, for volume renormalization when an input
  1267. stream ends. The default value is 2 seconds.
  1268. @item weights
  1269. Specify weight of each input audio stream as sequence.
  1270. Each weight is separated by space. By default all inputs have same weight.
  1271. @end table
  1272. @section amultiply
  1273. Multiply first audio stream with second audio stream and store result
  1274. in output audio stream. Multiplication is done by multiplying each
  1275. sample from first stream with sample at same position from second stream.
  1276. With this element-wise multiplication one can create amplitude fades and
  1277. amplitude modulations.
  1278. @section anequalizer
  1279. High-order parametric multiband equalizer for each channel.
  1280. It accepts the following parameters:
  1281. @table @option
  1282. @item params
  1283. This option string is in format:
  1284. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1285. Each equalizer band is separated by '|'.
  1286. @table @option
  1287. @item chn
  1288. Set channel number to which equalization will be applied.
  1289. If input doesn't have that channel the entry is ignored.
  1290. @item f
  1291. Set central frequency for band.
  1292. If input doesn't have that frequency the entry is ignored.
  1293. @item w
  1294. Set band width in hertz.
  1295. @item g
  1296. Set band gain in dB.
  1297. @item t
  1298. Set filter type for band, optional, can be:
  1299. @table @samp
  1300. @item 0
  1301. Butterworth, this is default.
  1302. @item 1
  1303. Chebyshev type 1.
  1304. @item 2
  1305. Chebyshev type 2.
  1306. @end table
  1307. @end table
  1308. @item curves
  1309. With this option activated frequency response of anequalizer is displayed
  1310. in video stream.
  1311. @item size
  1312. Set video stream size. Only useful if curves option is activated.
  1313. @item mgain
  1314. Set max gain that will be displayed. Only useful if curves option is activated.
  1315. Setting this to a reasonable value makes it possible to display gain which is derived from
  1316. neighbour bands which are too close to each other and thus produce higher gain
  1317. when both are activated.
  1318. @item fscale
  1319. Set frequency scale used to draw frequency response in video output.
  1320. Can be linear or logarithmic. Default is logarithmic.
  1321. @item colors
  1322. Set color for each channel curve which is going to be displayed in video stream.
  1323. This is list of color names separated by space or by '|'.
  1324. Unrecognised or missing colors will be replaced by white color.
  1325. @end table
  1326. @subsection Examples
  1327. @itemize
  1328. @item
  1329. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1330. for first 2 channels using Chebyshev type 1 filter:
  1331. @example
  1332. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1333. @end example
  1334. @end itemize
  1335. @subsection Commands
  1336. This filter supports the following commands:
  1337. @table @option
  1338. @item change
  1339. Alter existing filter parameters.
  1340. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1341. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1342. error is returned.
  1343. @var{freq} set new frequency parameter.
  1344. @var{width} set new width parameter in herz.
  1345. @var{gain} set new gain parameter in dB.
  1346. Full filter invocation with asendcmd may look like this:
  1347. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1348. @end table
  1349. @section anlmdn
  1350. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1351. Each sample is adjusted by looking for other samples with similar contexts. This
  1352. context similarity is defined by comparing their surrounding patches of size
  1353. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1354. The filter accepts the following options:
  1355. @table @option
  1356. @item s
  1357. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1358. @item p
  1359. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1360. Default value is 2 milliseconds.
  1361. @item r
  1362. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1363. Default value is 6 milliseconds.
  1364. @item o
  1365. Set the output mode.
  1366. It accepts the following values:
  1367. @table @option
  1368. @item i
  1369. Pass input unchanged.
  1370. @item o
  1371. Pass noise filtered out.
  1372. @item n
  1373. Pass only noise.
  1374. Default value is @var{o}.
  1375. @end table
  1376. @item m
  1377. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1378. @end table
  1379. @subsection Commands
  1380. This filter supports the following commands:
  1381. @table @option
  1382. @item s
  1383. Change denoise strength. Argument is single float number.
  1384. Syntax for the command is : "@var{s}"
  1385. @item o
  1386. Change output mode.
  1387. Syntax for the command is : "i", "o" or "n" string.
  1388. @end table
  1389. @section anlms
  1390. Apply Normalized Least-Mean-Squares algorithm to the first audio stream using the second audio stream.
  1391. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1392. relate to producing the least mean square of the error signal (difference between the desired,
  1393. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1394. A description of the accepted options follows.
  1395. @table @option
  1396. @item order
  1397. Set filter order.
  1398. @item mu
  1399. Set filter mu.
  1400. @item eps
  1401. Set the filter eps.
  1402. @item leakage
  1403. Set the filter leakage.
  1404. @item out_mode
  1405. It accepts the following values:
  1406. @table @option
  1407. @item i
  1408. Pass the 1st input.
  1409. @item d
  1410. Pass the 2nd input.
  1411. @item o
  1412. Pass filtered samples.
  1413. @item n
  1414. Pass difference between desired and filtered samples.
  1415. Default value is @var{o}.
  1416. @end table
  1417. @end table
  1418. @subsection Examples
  1419. @itemize
  1420. @item
  1421. One of many usages of this filter is noise reduction, input audio is filtered
  1422. with same samples that are delayed by fixed ammount, one such example for stereo audio is:
  1423. @example
  1424. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1425. @end example
  1426. @end itemize
  1427. @section anull
  1428. Pass the audio source unchanged to the output.
  1429. @section apad
  1430. Pad the end of an audio stream with silence.
  1431. This can be used together with @command{ffmpeg} @option{-shortest} to
  1432. extend audio streams to the same length as the video stream.
  1433. A description of the accepted options follows.
  1434. @table @option
  1435. @item packet_size
  1436. Set silence packet size. Default value is 4096.
  1437. @item pad_len
  1438. Set the number of samples of silence to add to the end. After the
  1439. value is reached, the stream is terminated. This option is mutually
  1440. exclusive with @option{whole_len}.
  1441. @item whole_len
  1442. Set the minimum total number of samples in the output audio stream. If
  1443. the value is longer than the input audio length, silence is added to
  1444. the end, until the value is reached. This option is mutually exclusive
  1445. with @option{pad_len}.
  1446. @item pad_dur
  1447. Specify the duration of samples of silence to add. See
  1448. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1449. for the accepted syntax. Used only if set to non-zero value.
  1450. @item whole_dur
  1451. Specify the minimum total duration in the output audio stream. See
  1452. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1453. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1454. the input audio length, silence is added to the end, until the value is reached.
  1455. This option is mutually exclusive with @option{pad_dur}
  1456. @end table
  1457. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1458. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1459. the input stream indefinitely.
  1460. @subsection Examples
  1461. @itemize
  1462. @item
  1463. Add 1024 samples of silence to the end of the input:
  1464. @example
  1465. apad=pad_len=1024
  1466. @end example
  1467. @item
  1468. Make sure the audio output will contain at least 10000 samples, pad
  1469. the input with silence if required:
  1470. @example
  1471. apad=whole_len=10000
  1472. @end example
  1473. @item
  1474. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1475. video stream will always result the shortest and will be converted
  1476. until the end in the output file when using the @option{shortest}
  1477. option:
  1478. @example
  1479. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1480. @end example
  1481. @end itemize
  1482. @section aphaser
  1483. Add a phasing effect to the input audio.
  1484. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1485. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1486. A description of the accepted parameters follows.
  1487. @table @option
  1488. @item in_gain
  1489. Set input gain. Default is 0.4.
  1490. @item out_gain
  1491. Set output gain. Default is 0.74
  1492. @item delay
  1493. Set delay in milliseconds. Default is 3.0.
  1494. @item decay
  1495. Set decay. Default is 0.4.
  1496. @item speed
  1497. Set modulation speed in Hz. Default is 0.5.
  1498. @item type
  1499. Set modulation type. Default is triangular.
  1500. It accepts the following values:
  1501. @table @samp
  1502. @item triangular, t
  1503. @item sinusoidal, s
  1504. @end table
  1505. @end table
  1506. @section apulsator
  1507. Audio pulsator is something between an autopanner and a tremolo.
  1508. But it can produce funny stereo effects as well. Pulsator changes the volume
  1509. of the left and right channel based on a LFO (low frequency oscillator) with
  1510. different waveforms and shifted phases.
  1511. This filter have the ability to define an offset between left and right
  1512. channel. An offset of 0 means that both LFO shapes match each other.
  1513. The left and right channel are altered equally - a conventional tremolo.
  1514. An offset of 50% means that the shape of the right channel is exactly shifted
  1515. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1516. an autopanner. At 1 both curves match again. Every setting in between moves the
  1517. phase shift gapless between all stages and produces some "bypassing" sounds with
  1518. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1519. the 0.5) the faster the signal passes from the left to the right speaker.
  1520. The filter accepts the following options:
  1521. @table @option
  1522. @item level_in
  1523. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1524. @item level_out
  1525. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1526. @item mode
  1527. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1528. sawup or sawdown. Default is sine.
  1529. @item amount
  1530. Set modulation. Define how much of original signal is affected by the LFO.
  1531. @item offset_l
  1532. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1533. @item offset_r
  1534. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1535. @item width
  1536. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1537. @item timing
  1538. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1539. @item bpm
  1540. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1541. is set to bpm.
  1542. @item ms
  1543. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1544. is set to ms.
  1545. @item hz
  1546. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1547. if timing is set to hz.
  1548. @end table
  1549. @anchor{aresample}
  1550. @section aresample
  1551. Resample the input audio to the specified parameters, using the
  1552. libswresample library. If none are specified then the filter will
  1553. automatically convert between its input and output.
  1554. This filter is also able to stretch/squeeze the audio data to make it match
  1555. the timestamps or to inject silence / cut out audio to make it match the
  1556. timestamps, do a combination of both or do neither.
  1557. The filter accepts the syntax
  1558. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1559. expresses a sample rate and @var{resampler_options} is a list of
  1560. @var{key}=@var{value} pairs, separated by ":". See the
  1561. @ref{Resampler Options,,"Resampler Options" section in the
  1562. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1563. for the complete list of supported options.
  1564. @subsection Examples
  1565. @itemize
  1566. @item
  1567. Resample the input audio to 44100Hz:
  1568. @example
  1569. aresample=44100
  1570. @end example
  1571. @item
  1572. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1573. samples per second compensation:
  1574. @example
  1575. aresample=async=1000
  1576. @end example
  1577. @end itemize
  1578. @section areverse
  1579. Reverse an audio clip.
  1580. Warning: This filter requires memory to buffer the entire clip, so trimming
  1581. is suggested.
  1582. @subsection Examples
  1583. @itemize
  1584. @item
  1585. Take the first 5 seconds of a clip, and reverse it.
  1586. @example
  1587. atrim=end=5,areverse
  1588. @end example
  1589. @end itemize
  1590. @section asetnsamples
  1591. Set the number of samples per each output audio frame.
  1592. The last output packet may contain a different number of samples, as
  1593. the filter will flush all the remaining samples when the input audio
  1594. signals its end.
  1595. The filter accepts the following options:
  1596. @table @option
  1597. @item nb_out_samples, n
  1598. Set the number of frames per each output audio frame. The number is
  1599. intended as the number of samples @emph{per each channel}.
  1600. Default value is 1024.
  1601. @item pad, p
  1602. If set to 1, the filter will pad the last audio frame with zeroes, so
  1603. that the last frame will contain the same number of samples as the
  1604. previous ones. Default value is 1.
  1605. @end table
  1606. For example, to set the number of per-frame samples to 1234 and
  1607. disable padding for the last frame, use:
  1608. @example
  1609. asetnsamples=n=1234:p=0
  1610. @end example
  1611. @section asetrate
  1612. Set the sample rate without altering the PCM data.
  1613. This will result in a change of speed and pitch.
  1614. The filter accepts the following options:
  1615. @table @option
  1616. @item sample_rate, r
  1617. Set the output sample rate. Default is 44100 Hz.
  1618. @end table
  1619. @section ashowinfo
  1620. Show a line containing various information for each input audio frame.
  1621. The input audio is not modified.
  1622. The shown line contains a sequence of key/value pairs of the form
  1623. @var{key}:@var{value}.
  1624. The following values are shown in the output:
  1625. @table @option
  1626. @item n
  1627. The (sequential) number of the input frame, starting from 0.
  1628. @item pts
  1629. The presentation timestamp of the input frame, in time base units; the time base
  1630. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1631. @item pts_time
  1632. The presentation timestamp of the input frame in seconds.
  1633. @item pos
  1634. position of the frame in the input stream, -1 if this information in
  1635. unavailable and/or meaningless (for example in case of synthetic audio)
  1636. @item fmt
  1637. The sample format.
  1638. @item chlayout
  1639. The channel layout.
  1640. @item rate
  1641. The sample rate for the audio frame.
  1642. @item nb_samples
  1643. The number of samples (per channel) in the frame.
  1644. @item checksum
  1645. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1646. audio, the data is treated as if all the planes were concatenated.
  1647. @item plane_checksums
  1648. A list of Adler-32 checksums for each data plane.
  1649. @end table
  1650. @section asoftclip
  1651. Apply audio soft clipping.
  1652. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1653. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1654. This filter accepts the following options:
  1655. @table @option
  1656. @item type
  1657. Set type of soft-clipping.
  1658. It accepts the following values:
  1659. @table @option
  1660. @item tanh
  1661. @item atan
  1662. @item cubic
  1663. @item exp
  1664. @item alg
  1665. @item quintic
  1666. @item sin
  1667. @end table
  1668. @item param
  1669. Set additional parameter which controls sigmoid function.
  1670. @end table
  1671. @section asr
  1672. Automatic Speech Recognition
  1673. This filter uses PocketSphinx for speech recognition. To enable
  1674. compilation of this filter, you need to configure FFmpeg with
  1675. @code{--enable-pocketsphinx}.
  1676. It accepts the following options:
  1677. @table @option
  1678. @item rate
  1679. Set sampling rate of input audio. Defaults is @code{16000}.
  1680. This need to match speech models, otherwise one will get poor results.
  1681. @item hmm
  1682. Set dictionary containing acoustic model files.
  1683. @item dict
  1684. Set pronunciation dictionary.
  1685. @item lm
  1686. Set language model file.
  1687. @item lmctl
  1688. Set language model set.
  1689. @item lmname
  1690. Set which language model to use.
  1691. @item logfn
  1692. Set output for log messages.
  1693. @end table
  1694. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1695. @anchor{astats}
  1696. @section astats
  1697. Display time domain statistical information about the audio channels.
  1698. Statistics are calculated and displayed for each audio channel and,
  1699. where applicable, an overall figure is also given.
  1700. It accepts the following option:
  1701. @table @option
  1702. @item length
  1703. Short window length in seconds, used for peak and trough RMS measurement.
  1704. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1705. @item metadata
  1706. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1707. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1708. disabled.
  1709. Available keys for each channel are:
  1710. DC_offset
  1711. Min_level
  1712. Max_level
  1713. Min_difference
  1714. Max_difference
  1715. Mean_difference
  1716. RMS_difference
  1717. Peak_level
  1718. RMS_peak
  1719. RMS_trough
  1720. Crest_factor
  1721. Flat_factor
  1722. Peak_count
  1723. Bit_depth
  1724. Dynamic_range
  1725. Zero_crossings
  1726. Zero_crossings_rate
  1727. Number_of_NaNs
  1728. Number_of_Infs
  1729. Number_of_denormals
  1730. and for Overall:
  1731. DC_offset
  1732. Min_level
  1733. Max_level
  1734. Min_difference
  1735. Max_difference
  1736. Mean_difference
  1737. RMS_difference
  1738. Peak_level
  1739. RMS_level
  1740. RMS_peak
  1741. RMS_trough
  1742. Flat_factor
  1743. Peak_count
  1744. Bit_depth
  1745. Number_of_samples
  1746. Number_of_NaNs
  1747. Number_of_Infs
  1748. Number_of_denormals
  1749. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1750. this @code{lavfi.astats.Overall.Peak_count}.
  1751. For description what each key means read below.
  1752. @item reset
  1753. Set number of frame after which stats are going to be recalculated.
  1754. Default is disabled.
  1755. @item measure_perchannel
  1756. Select the entries which need to be measured per channel. The metadata keys can
  1757. be used as flags, default is @option{all} which measures everything.
  1758. @option{none} disables all per channel measurement.
  1759. @item measure_overall
  1760. Select the entries which need to be measured overall. The metadata keys can
  1761. be used as flags, default is @option{all} which measures everything.
  1762. @option{none} disables all overall measurement.
  1763. @end table
  1764. A description of each shown parameter follows:
  1765. @table @option
  1766. @item DC offset
  1767. Mean amplitude displacement from zero.
  1768. @item Min level
  1769. Minimal sample level.
  1770. @item Max level
  1771. Maximal sample level.
  1772. @item Min difference
  1773. Minimal difference between two consecutive samples.
  1774. @item Max difference
  1775. Maximal difference between two consecutive samples.
  1776. @item Mean difference
  1777. Mean difference between two consecutive samples.
  1778. The average of each difference between two consecutive samples.
  1779. @item RMS difference
  1780. Root Mean Square difference between two consecutive samples.
  1781. @item Peak level dB
  1782. @item RMS level dB
  1783. Standard peak and RMS level measured in dBFS.
  1784. @item RMS peak dB
  1785. @item RMS trough dB
  1786. Peak and trough values for RMS level measured over a short window.
  1787. @item Crest factor
  1788. Standard ratio of peak to RMS level (note: not in dB).
  1789. @item Flat factor
  1790. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1791. (i.e. either @var{Min level} or @var{Max level}).
  1792. @item Peak count
  1793. Number of occasions (not the number of samples) that the signal attained either
  1794. @var{Min level} or @var{Max level}.
  1795. @item Bit depth
  1796. Overall bit depth of audio. Number of bits used for each sample.
  1797. @item Dynamic range
  1798. Measured dynamic range of audio in dB.
  1799. @item Zero crossings
  1800. Number of points where the waveform crosses the zero level axis.
  1801. @item Zero crossings rate
  1802. Rate of Zero crossings and number of audio samples.
  1803. @end table
  1804. @section atempo
  1805. Adjust audio tempo.
  1806. The filter accepts exactly one parameter, the audio tempo. If not
  1807. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1808. be in the [0.5, 100.0] range.
  1809. Note that tempo greater than 2 will skip some samples rather than
  1810. blend them in. If for any reason this is a concern it is always
  1811. possible to daisy-chain several instances of atempo to achieve the
  1812. desired product tempo.
  1813. @subsection Examples
  1814. @itemize
  1815. @item
  1816. Slow down audio to 80% tempo:
  1817. @example
  1818. atempo=0.8
  1819. @end example
  1820. @item
  1821. To speed up audio to 300% tempo:
  1822. @example
  1823. atempo=3
  1824. @end example
  1825. @item
  1826. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1827. @example
  1828. atempo=sqrt(3),atempo=sqrt(3)
  1829. @end example
  1830. @end itemize
  1831. @section atrim
  1832. Trim the input so that the output contains one continuous subpart of the input.
  1833. It accepts the following parameters:
  1834. @table @option
  1835. @item start
  1836. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1837. sample with the timestamp @var{start} will be the first sample in the output.
  1838. @item end
  1839. Specify time of the first audio sample that will be dropped, i.e. the
  1840. audio sample immediately preceding the one with the timestamp @var{end} will be
  1841. the last sample in the output.
  1842. @item start_pts
  1843. Same as @var{start}, except this option sets the start timestamp in samples
  1844. instead of seconds.
  1845. @item end_pts
  1846. Same as @var{end}, except this option sets the end timestamp in samples instead
  1847. of seconds.
  1848. @item duration
  1849. The maximum duration of the output in seconds.
  1850. @item start_sample
  1851. The number of the first sample that should be output.
  1852. @item end_sample
  1853. The number of the first sample that should be dropped.
  1854. @end table
  1855. @option{start}, @option{end}, and @option{duration} are expressed as time
  1856. duration specifications; see
  1857. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1858. Note that the first two sets of the start/end options and the @option{duration}
  1859. option look at the frame timestamp, while the _sample options simply count the
  1860. samples that pass through the filter. So start/end_pts and start/end_sample will
  1861. give different results when the timestamps are wrong, inexact or do not start at
  1862. zero. Also note that this filter does not modify the timestamps. If you wish
  1863. to have the output timestamps start at zero, insert the asetpts filter after the
  1864. atrim filter.
  1865. If multiple start or end options are set, this filter tries to be greedy and
  1866. keep all samples that match at least one of the specified constraints. To keep
  1867. only the part that matches all the constraints at once, chain multiple atrim
  1868. filters.
  1869. The defaults are such that all the input is kept. So it is possible to set e.g.
  1870. just the end values to keep everything before the specified time.
  1871. Examples:
  1872. @itemize
  1873. @item
  1874. Drop everything except the second minute of input:
  1875. @example
  1876. ffmpeg -i INPUT -af atrim=60:120
  1877. @end example
  1878. @item
  1879. Keep only the first 1000 samples:
  1880. @example
  1881. ffmpeg -i INPUT -af atrim=end_sample=1000
  1882. @end example
  1883. @end itemize
  1884. @section bandpass
  1885. Apply a two-pole Butterworth band-pass filter with central
  1886. frequency @var{frequency}, and (3dB-point) band-width width.
  1887. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1888. instead of the default: constant 0dB peak gain.
  1889. The filter roll off at 6dB per octave (20dB per decade).
  1890. The filter accepts the following options:
  1891. @table @option
  1892. @item frequency, f
  1893. Set the filter's central frequency. Default is @code{3000}.
  1894. @item csg
  1895. Constant skirt gain if set to 1. Defaults to 0.
  1896. @item width_type, t
  1897. Set method to specify band-width of filter.
  1898. @table @option
  1899. @item h
  1900. Hz
  1901. @item q
  1902. Q-Factor
  1903. @item o
  1904. octave
  1905. @item s
  1906. slope
  1907. @item k
  1908. kHz
  1909. @end table
  1910. @item width, w
  1911. Specify the band-width of a filter in width_type units.
  1912. @item mix, m
  1913. How much to use filtered signal in output. Default is 1.
  1914. Range is between 0 and 1.
  1915. @item channels, c
  1916. Specify which channels to filter, by default all available are filtered.
  1917. @end table
  1918. @subsection Commands
  1919. This filter supports the following commands:
  1920. @table @option
  1921. @item frequency, f
  1922. Change bandpass frequency.
  1923. Syntax for the command is : "@var{frequency}"
  1924. @item width_type, t
  1925. Change bandpass width_type.
  1926. Syntax for the command is : "@var{width_type}"
  1927. @item width, w
  1928. Change bandpass width.
  1929. Syntax for the command is : "@var{width}"
  1930. @item mix, m
  1931. Change bandpass mix.
  1932. Syntax for the command is : "@var{mix}"
  1933. @end table
  1934. @section bandreject
  1935. Apply a two-pole Butterworth band-reject filter with central
  1936. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1937. The filter roll off at 6dB per octave (20dB per decade).
  1938. The filter accepts the following options:
  1939. @table @option
  1940. @item frequency, f
  1941. Set the filter's central frequency. Default is @code{3000}.
  1942. @item width_type, t
  1943. Set method to specify band-width of filter.
  1944. @table @option
  1945. @item h
  1946. Hz
  1947. @item q
  1948. Q-Factor
  1949. @item o
  1950. octave
  1951. @item s
  1952. slope
  1953. @item k
  1954. kHz
  1955. @end table
  1956. @item width, w
  1957. Specify the band-width of a filter in width_type units.
  1958. @item mix, m
  1959. How much to use filtered signal in output. Default is 1.
  1960. Range is between 0 and 1.
  1961. @item channels, c
  1962. Specify which channels to filter, by default all available are filtered.
  1963. @end table
  1964. @subsection Commands
  1965. This filter supports the following commands:
  1966. @table @option
  1967. @item frequency, f
  1968. Change bandreject frequency.
  1969. Syntax for the command is : "@var{frequency}"
  1970. @item width_type, t
  1971. Change bandreject width_type.
  1972. Syntax for the command is : "@var{width_type}"
  1973. @item width, w
  1974. Change bandreject width.
  1975. Syntax for the command is : "@var{width}"
  1976. @item mix, m
  1977. Change bandreject mix.
  1978. Syntax for the command is : "@var{mix}"
  1979. @end table
  1980. @section bass, lowshelf
  1981. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1982. shelving filter with a response similar to that of a standard
  1983. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1984. The filter accepts the following options:
  1985. @table @option
  1986. @item gain, g
  1987. Give the gain at 0 Hz. Its useful range is about -20
  1988. (for a large cut) to +20 (for a large boost).
  1989. Beware of clipping when using a positive gain.
  1990. @item frequency, f
  1991. Set the filter's central frequency and so can be used
  1992. to extend or reduce the frequency range to be boosted or cut.
  1993. The default value is @code{100} Hz.
  1994. @item width_type, t
  1995. Set method to specify band-width of filter.
  1996. @table @option
  1997. @item h
  1998. Hz
  1999. @item q
  2000. Q-Factor
  2001. @item o
  2002. octave
  2003. @item s
  2004. slope
  2005. @item k
  2006. kHz
  2007. @end table
  2008. @item width, w
  2009. Determine how steep is the filter's shelf transition.
  2010. @item mix, m
  2011. How much to use filtered signal in output. Default is 1.
  2012. Range is between 0 and 1.
  2013. @item channels, c
  2014. Specify which channels to filter, by default all available are filtered.
  2015. @end table
  2016. @subsection Commands
  2017. This filter supports the following commands:
  2018. @table @option
  2019. @item frequency, f
  2020. Change bass frequency.
  2021. Syntax for the command is : "@var{frequency}"
  2022. @item width_type, t
  2023. Change bass width_type.
  2024. Syntax for the command is : "@var{width_type}"
  2025. @item width, w
  2026. Change bass width.
  2027. Syntax for the command is : "@var{width}"
  2028. @item gain, g
  2029. Change bass gain.
  2030. Syntax for the command is : "@var{gain}"
  2031. @item mix, m
  2032. Change bass mix.
  2033. Syntax for the command is : "@var{mix}"
  2034. @end table
  2035. @section biquad
  2036. Apply a biquad IIR filter with the given coefficients.
  2037. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2038. are the numerator and denominator coefficients respectively.
  2039. and @var{channels}, @var{c} specify which channels to filter, by default all
  2040. available are filtered.
  2041. @subsection Commands
  2042. This filter supports the following commands:
  2043. @table @option
  2044. @item a0
  2045. @item a1
  2046. @item a2
  2047. @item b0
  2048. @item b1
  2049. @item b2
  2050. Change biquad parameter.
  2051. Syntax for the command is : "@var{value}"
  2052. @item mix, m
  2053. How much to use filtered signal in output. Default is 1.
  2054. Range is between 0 and 1.
  2055. @end table
  2056. @section bs2b
  2057. Bauer stereo to binaural transformation, which improves headphone listening of
  2058. stereo audio records.
  2059. To enable compilation of this filter you need to configure FFmpeg with
  2060. @code{--enable-libbs2b}.
  2061. It accepts the following parameters:
  2062. @table @option
  2063. @item profile
  2064. Pre-defined crossfeed level.
  2065. @table @option
  2066. @item default
  2067. Default level (fcut=700, feed=50).
  2068. @item cmoy
  2069. Chu Moy circuit (fcut=700, feed=60).
  2070. @item jmeier
  2071. Jan Meier circuit (fcut=650, feed=95).
  2072. @end table
  2073. @item fcut
  2074. Cut frequency (in Hz).
  2075. @item feed
  2076. Feed level (in Hz).
  2077. @end table
  2078. @section channelmap
  2079. Remap input channels to new locations.
  2080. It accepts the following parameters:
  2081. @table @option
  2082. @item map
  2083. Map channels from input to output. The argument is a '|'-separated list of
  2084. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2085. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2086. channel (e.g. FL for front left) or its index in the input channel layout.
  2087. @var{out_channel} is the name of the output channel or its index in the output
  2088. channel layout. If @var{out_channel} is not given then it is implicitly an
  2089. index, starting with zero and increasing by one for each mapping.
  2090. @item channel_layout
  2091. The channel layout of the output stream.
  2092. @end table
  2093. If no mapping is present, the filter will implicitly map input channels to
  2094. output channels, preserving indices.
  2095. @subsection Examples
  2096. @itemize
  2097. @item
  2098. For example, assuming a 5.1+downmix input MOV file,
  2099. @example
  2100. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2101. @end example
  2102. will create an output WAV file tagged as stereo from the downmix channels of
  2103. the input.
  2104. @item
  2105. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2106. @example
  2107. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2108. @end example
  2109. @end itemize
  2110. @section channelsplit
  2111. Split each channel from an input audio stream into a separate output stream.
  2112. It accepts the following parameters:
  2113. @table @option
  2114. @item channel_layout
  2115. The channel layout of the input stream. The default is "stereo".
  2116. @item channels
  2117. A channel layout describing the channels to be extracted as separate output streams
  2118. or "all" to extract each input channel as a separate stream. The default is "all".
  2119. Choosing channels not present in channel layout in the input will result in an error.
  2120. @end table
  2121. @subsection Examples
  2122. @itemize
  2123. @item
  2124. For example, assuming a stereo input MP3 file,
  2125. @example
  2126. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2127. @end example
  2128. will create an output Matroska file with two audio streams, one containing only
  2129. the left channel and the other the right channel.
  2130. @item
  2131. Split a 5.1 WAV file into per-channel files:
  2132. @example
  2133. ffmpeg -i in.wav -filter_complex
  2134. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2135. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2136. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2137. side_right.wav
  2138. @end example
  2139. @item
  2140. Extract only LFE from a 5.1 WAV file:
  2141. @example
  2142. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2143. -map '[LFE]' lfe.wav
  2144. @end example
  2145. @end itemize
  2146. @section chorus
  2147. Add a chorus effect to the audio.
  2148. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2149. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2150. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2151. The modulation depth defines the range the modulated delay is played before or after
  2152. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2153. sound tuned around the original one, like in a chorus where some vocals are slightly
  2154. off key.
  2155. It accepts the following parameters:
  2156. @table @option
  2157. @item in_gain
  2158. Set input gain. Default is 0.4.
  2159. @item out_gain
  2160. Set output gain. Default is 0.4.
  2161. @item delays
  2162. Set delays. A typical delay is around 40ms to 60ms.
  2163. @item decays
  2164. Set decays.
  2165. @item speeds
  2166. Set speeds.
  2167. @item depths
  2168. Set depths.
  2169. @end table
  2170. @subsection Examples
  2171. @itemize
  2172. @item
  2173. A single delay:
  2174. @example
  2175. chorus=0.7:0.9:55:0.4:0.25:2
  2176. @end example
  2177. @item
  2178. Two delays:
  2179. @example
  2180. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2181. @end example
  2182. @item
  2183. Fuller sounding chorus with three delays:
  2184. @example
  2185. 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
  2186. @end example
  2187. @end itemize
  2188. @section compand
  2189. Compress or expand the audio's dynamic range.
  2190. It accepts the following parameters:
  2191. @table @option
  2192. @item attacks
  2193. @item decays
  2194. A list of times in seconds for each channel over which the instantaneous level
  2195. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2196. increase of volume and @var{decays} refers to decrease of volume. For most
  2197. situations, the attack time (response to the audio getting louder) should be
  2198. shorter than the decay time, because the human ear is more sensitive to sudden
  2199. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2200. a typical value for decay is 0.8 seconds.
  2201. If specified number of attacks & decays is lower than number of channels, the last
  2202. set attack/decay will be used for all remaining channels.
  2203. @item points
  2204. A list of points for the transfer function, specified in dB relative to the
  2205. maximum possible signal amplitude. Each key points list must be defined using
  2206. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2207. @code{x0/y0 x1/y1 x2/y2 ....}
  2208. The input values must be in strictly increasing order but the transfer function
  2209. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2210. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2211. function are @code{-70/-70|-60/-20|1/0}.
  2212. @item soft-knee
  2213. Set the curve radius in dB for all joints. It defaults to 0.01.
  2214. @item gain
  2215. Set the additional gain in dB to be applied at all points on the transfer
  2216. function. This allows for easy adjustment of the overall gain.
  2217. It defaults to 0.
  2218. @item volume
  2219. Set an initial volume, in dB, to be assumed for each channel when filtering
  2220. starts. This permits the user to supply a nominal level initially, so that, for
  2221. example, a very large gain is not applied to initial signal levels before the
  2222. companding has begun to operate. A typical value for audio which is initially
  2223. quiet is -90 dB. It defaults to 0.
  2224. @item delay
  2225. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2226. delayed before being fed to the volume adjuster. Specifying a delay
  2227. approximately equal to the attack/decay times allows the filter to effectively
  2228. operate in predictive rather than reactive mode. It defaults to 0.
  2229. @end table
  2230. @subsection Examples
  2231. @itemize
  2232. @item
  2233. Make music with both quiet and loud passages suitable for listening to in a
  2234. noisy environment:
  2235. @example
  2236. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2237. @end example
  2238. Another example for audio with whisper and explosion parts:
  2239. @example
  2240. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2241. @end example
  2242. @item
  2243. A noise gate for when the noise is at a lower level than the signal:
  2244. @example
  2245. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2246. @end example
  2247. @item
  2248. Here is another noise gate, this time for when the noise is at a higher level
  2249. than the signal (making it, in some ways, similar to squelch):
  2250. @example
  2251. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2252. @end example
  2253. @item
  2254. 2:1 compression starting at -6dB:
  2255. @example
  2256. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2257. @end example
  2258. @item
  2259. 2:1 compression starting at -9dB:
  2260. @example
  2261. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2262. @end example
  2263. @item
  2264. 2:1 compression starting at -12dB:
  2265. @example
  2266. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2267. @end example
  2268. @item
  2269. 2:1 compression starting at -18dB:
  2270. @example
  2271. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2272. @end example
  2273. @item
  2274. 3:1 compression starting at -15dB:
  2275. @example
  2276. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2277. @end example
  2278. @item
  2279. Compressor/Gate:
  2280. @example
  2281. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2282. @end example
  2283. @item
  2284. Expander:
  2285. @example
  2286. 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
  2287. @end example
  2288. @item
  2289. Hard limiter at -6dB:
  2290. @example
  2291. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2292. @end example
  2293. @item
  2294. Hard limiter at -12dB:
  2295. @example
  2296. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2297. @end example
  2298. @item
  2299. Hard noise gate at -35 dB:
  2300. @example
  2301. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2302. @end example
  2303. @item
  2304. Soft limiter:
  2305. @example
  2306. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2307. @end example
  2308. @end itemize
  2309. @section compensationdelay
  2310. Compensation Delay Line is a metric based delay to compensate differing
  2311. positions of microphones or speakers.
  2312. For example, you have recorded guitar with two microphones placed in
  2313. different locations. Because the front of sound wave has fixed speed in
  2314. normal conditions, the phasing of microphones can vary and depends on
  2315. their location and interposition. The best sound mix can be achieved when
  2316. these microphones are in phase (synchronized). Note that a distance of
  2317. ~30 cm between microphones makes one microphone capture the signal in
  2318. antiphase to the other microphone. That makes the final mix sound moody.
  2319. This filter helps to solve phasing problems by adding different delays
  2320. to each microphone track and make them synchronized.
  2321. The best result can be reached when you take one track as base and
  2322. synchronize other tracks one by one with it.
  2323. Remember that synchronization/delay tolerance depends on sample rate, too.
  2324. Higher sample rates will give more tolerance.
  2325. The filter accepts the following parameters:
  2326. @table @option
  2327. @item mm
  2328. Set millimeters distance. This is compensation distance for fine tuning.
  2329. Default is 0.
  2330. @item cm
  2331. Set cm distance. This is compensation distance for tightening distance setup.
  2332. Default is 0.
  2333. @item m
  2334. Set meters distance. This is compensation distance for hard distance setup.
  2335. Default is 0.
  2336. @item dry
  2337. Set dry amount. Amount of unprocessed (dry) signal.
  2338. Default is 0.
  2339. @item wet
  2340. Set wet amount. Amount of processed (wet) signal.
  2341. Default is 1.
  2342. @item temp
  2343. Set temperature in degrees Celsius. This is the temperature of the environment.
  2344. Default is 20.
  2345. @end table
  2346. @section crossfeed
  2347. Apply headphone crossfeed filter.
  2348. Crossfeed is the process of blending the left and right channels of stereo
  2349. audio recording.
  2350. It is mainly used to reduce extreme stereo separation of low frequencies.
  2351. The intent is to produce more speaker like sound to the listener.
  2352. The filter accepts the following options:
  2353. @table @option
  2354. @item strength
  2355. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2356. This sets gain of low shelf filter for side part of stereo image.
  2357. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2358. @item range
  2359. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2360. This sets cut off frequency of low shelf filter. Default is cut off near
  2361. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2362. @item level_in
  2363. Set input gain. Default is 0.9.
  2364. @item level_out
  2365. Set output gain. Default is 1.
  2366. @end table
  2367. @section crystalizer
  2368. Simple algorithm to expand audio dynamic range.
  2369. The filter accepts the following options:
  2370. @table @option
  2371. @item i
  2372. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2373. (unchanged sound) to 10.0 (maximum effect).
  2374. @item c
  2375. Enable clipping. By default is enabled.
  2376. @end table
  2377. @section dcshift
  2378. Apply a DC shift to the audio.
  2379. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2380. in the recording chain) from the audio. The effect of a DC offset is reduced
  2381. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2382. a signal has a DC offset.
  2383. @table @option
  2384. @item shift
  2385. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2386. the audio.
  2387. @item limitergain
  2388. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2389. used to prevent clipping.
  2390. @end table
  2391. @section deesser
  2392. Apply de-essing to the audio samples.
  2393. @table @option
  2394. @item i
  2395. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2396. Default is 0.
  2397. @item m
  2398. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2399. Default is 0.5.
  2400. @item f
  2401. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2402. Default is 0.5.
  2403. @item s
  2404. Set the output mode.
  2405. It accepts the following values:
  2406. @table @option
  2407. @item i
  2408. Pass input unchanged.
  2409. @item o
  2410. Pass ess filtered out.
  2411. @item e
  2412. Pass only ess.
  2413. Default value is @var{o}.
  2414. @end table
  2415. @end table
  2416. @section drmeter
  2417. Measure audio dynamic range.
  2418. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2419. is found in transition material. And anything less that 8 have very poor dynamics
  2420. and is very compressed.
  2421. The filter accepts the following options:
  2422. @table @option
  2423. @item length
  2424. Set window length in seconds used to split audio into segments of equal length.
  2425. Default is 3 seconds.
  2426. @end table
  2427. @section dynaudnorm
  2428. Dynamic Audio Normalizer.
  2429. This filter applies a certain amount of gain to the input audio in order
  2430. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2431. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2432. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2433. This allows for applying extra gain to the "quiet" sections of the audio
  2434. while avoiding distortions or clipping the "loud" sections. In other words:
  2435. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2436. sections, in the sense that the volume of each section is brought to the
  2437. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2438. this goal *without* applying "dynamic range compressing". It will retain 100%
  2439. of the dynamic range *within* each section of the audio file.
  2440. @table @option
  2441. @item framelen, f
  2442. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2443. Default is 500 milliseconds.
  2444. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2445. referred to as frames. This is required, because a peak magnitude has no
  2446. meaning for just a single sample value. Instead, we need to determine the
  2447. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2448. normalizer would simply use the peak magnitude of the complete file, the
  2449. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2450. frame. The length of a frame is specified in milliseconds. By default, the
  2451. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2452. been found to give good results with most files.
  2453. Note that the exact frame length, in number of samples, will be determined
  2454. automatically, based on the sampling rate of the individual input audio file.
  2455. @item gausssize, g
  2456. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2457. number. Default is 31.
  2458. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2459. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2460. is specified in frames, centered around the current frame. For the sake of
  2461. simplicity, this must be an odd number. Consequently, the default value of 31
  2462. takes into account the current frame, as well as the 15 preceding frames and
  2463. the 15 subsequent frames. Using a larger window results in a stronger
  2464. smoothing effect and thus in less gain variation, i.e. slower gain
  2465. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2466. effect and thus in more gain variation, i.e. faster gain adaptation.
  2467. In other words, the more you increase this value, the more the Dynamic Audio
  2468. Normalizer will behave like a "traditional" normalization filter. On the
  2469. contrary, the more you decrease this value, the more the Dynamic Audio
  2470. Normalizer will behave like a dynamic range compressor.
  2471. @item peak, p
  2472. Set the target peak value. This specifies the highest permissible magnitude
  2473. level for the normalized audio input. This filter will try to approach the
  2474. target peak magnitude as closely as possible, but at the same time it also
  2475. makes sure that the normalized signal will never exceed the peak magnitude.
  2476. A frame's maximum local gain factor is imposed directly by the target peak
  2477. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2478. It is not recommended to go above this value.
  2479. @item maxgain, m
  2480. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2481. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2482. factor for each input frame, i.e. the maximum gain factor that does not
  2483. result in clipping or distortion. The maximum gain factor is determined by
  2484. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2485. additionally bounds the frame's maximum gain factor by a predetermined
  2486. (global) maximum gain factor. This is done in order to avoid excessive gain
  2487. factors in "silent" or almost silent frames. By default, the maximum gain
  2488. factor is 10.0, For most inputs the default value should be sufficient and
  2489. it usually is not recommended to increase this value. Though, for input
  2490. with an extremely low overall volume level, it may be necessary to allow even
  2491. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2492. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2493. Instead, a "sigmoid" threshold function will be applied. This way, the
  2494. gain factors will smoothly approach the threshold value, but never exceed that
  2495. value.
  2496. @item targetrms, r
  2497. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2498. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2499. This means that the maximum local gain factor for each frame is defined
  2500. (only) by the frame's highest magnitude sample. This way, the samples can
  2501. be amplified as much as possible without exceeding the maximum signal
  2502. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2503. Normalizer can also take into account the frame's root mean square,
  2504. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2505. determine the power of a time-varying signal. It is therefore considered
  2506. that the RMS is a better approximation of the "perceived loudness" than
  2507. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2508. frames to a constant RMS value, a uniform "perceived loudness" can be
  2509. established. If a target RMS value has been specified, a frame's local gain
  2510. factor is defined as the factor that would result in exactly that RMS value.
  2511. Note, however, that the maximum local gain factor is still restricted by the
  2512. frame's highest magnitude sample, in order to prevent clipping.
  2513. @item coupling, n
  2514. Enable channels coupling. By default is enabled.
  2515. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2516. amount. This means the same gain factor will be applied to all channels, i.e.
  2517. the maximum possible gain factor is determined by the "loudest" channel.
  2518. However, in some recordings, it may happen that the volume of the different
  2519. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2520. In this case, this option can be used to disable the channel coupling. This way,
  2521. the gain factor will be determined independently for each channel, depending
  2522. only on the individual channel's highest magnitude sample. This allows for
  2523. harmonizing the volume of the different channels.
  2524. @item correctdc, c
  2525. Enable DC bias correction. By default is disabled.
  2526. An audio signal (in the time domain) is a sequence of sample values.
  2527. In the Dynamic Audio Normalizer these sample values are represented in the
  2528. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2529. audio signal, or "waveform", should be centered around the zero point.
  2530. That means if we calculate the mean value of all samples in a file, or in a
  2531. single frame, then the result should be 0.0 or at least very close to that
  2532. value. If, however, there is a significant deviation of the mean value from
  2533. 0.0, in either positive or negative direction, this is referred to as a
  2534. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2535. Audio Normalizer provides optional DC bias correction.
  2536. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2537. the mean value, or "DC correction" offset, of each input frame and subtract
  2538. that value from all of the frame's sample values which ensures those samples
  2539. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2540. boundaries, the DC correction offset values will be interpolated smoothly
  2541. between neighbouring frames.
  2542. @item altboundary, b
  2543. Enable alternative boundary mode. By default is disabled.
  2544. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2545. around each frame. This includes the preceding frames as well as the
  2546. subsequent frames. However, for the "boundary" frames, located at the very
  2547. beginning and at the very end of the audio file, not all neighbouring
  2548. frames are available. In particular, for the first few frames in the audio
  2549. file, the preceding frames are not known. And, similarly, for the last few
  2550. frames in the audio file, the subsequent frames are not known. Thus, the
  2551. question arises which gain factors should be assumed for the missing frames
  2552. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2553. to deal with this situation. The default boundary mode assumes a gain factor
  2554. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2555. "fade out" at the beginning and at the end of the input, respectively.
  2556. @item compress, s
  2557. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2558. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2559. compression. This means that signal peaks will not be pruned and thus the
  2560. full dynamic range will be retained within each local neighbourhood. However,
  2561. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2562. normalization algorithm with a more "traditional" compression.
  2563. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2564. (thresholding) function. If (and only if) the compression feature is enabled,
  2565. all input frames will be processed by a soft knee thresholding function prior
  2566. to the actual normalization process. Put simply, the thresholding function is
  2567. going to prune all samples whose magnitude exceeds a certain threshold value.
  2568. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2569. value. Instead, the threshold value will be adjusted for each individual
  2570. frame.
  2571. In general, smaller parameters result in stronger compression, and vice versa.
  2572. Values below 3.0 are not recommended, because audible distortion may appear.
  2573. @end table
  2574. @section earwax
  2575. Make audio easier to listen to on headphones.
  2576. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2577. so that when listened to on headphones the stereo image is moved from
  2578. inside your head (standard for headphones) to outside and in front of
  2579. the listener (standard for speakers).
  2580. Ported from SoX.
  2581. @section equalizer
  2582. Apply a two-pole peaking equalisation (EQ) filter. With this
  2583. filter, the signal-level at and around a selected frequency can
  2584. be increased or decreased, whilst (unlike bandpass and bandreject
  2585. filters) that at all other frequencies is unchanged.
  2586. In order to produce complex equalisation curves, this filter can
  2587. be given several times, each with a different central frequency.
  2588. The filter accepts the following options:
  2589. @table @option
  2590. @item frequency, f
  2591. Set the filter's central frequency in Hz.
  2592. @item width_type, t
  2593. Set method to specify band-width of filter.
  2594. @table @option
  2595. @item h
  2596. Hz
  2597. @item q
  2598. Q-Factor
  2599. @item o
  2600. octave
  2601. @item s
  2602. slope
  2603. @item k
  2604. kHz
  2605. @end table
  2606. @item width, w
  2607. Specify the band-width of a filter in width_type units.
  2608. @item gain, g
  2609. Set the required gain or attenuation in dB.
  2610. Beware of clipping when using a positive gain.
  2611. @item mix, m
  2612. How much to use filtered signal in output. Default is 1.
  2613. Range is between 0 and 1.
  2614. @item channels, c
  2615. Specify which channels to filter, by default all available are filtered.
  2616. @end table
  2617. @subsection Examples
  2618. @itemize
  2619. @item
  2620. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2621. @example
  2622. equalizer=f=1000:t=h:width=200:g=-10
  2623. @end example
  2624. @item
  2625. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2626. @example
  2627. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2628. @end example
  2629. @end itemize
  2630. @subsection Commands
  2631. This filter supports the following commands:
  2632. @table @option
  2633. @item frequency, f
  2634. Change equalizer frequency.
  2635. Syntax for the command is : "@var{frequency}"
  2636. @item width_type, t
  2637. Change equalizer width_type.
  2638. Syntax for the command is : "@var{width_type}"
  2639. @item width, w
  2640. Change equalizer width.
  2641. Syntax for the command is : "@var{width}"
  2642. @item gain, g
  2643. Change equalizer gain.
  2644. Syntax for the command is : "@var{gain}"
  2645. @item mix, m
  2646. Change equalizer mix.
  2647. Syntax for the command is : "@var{mix}"
  2648. @end table
  2649. @section extrastereo
  2650. Linearly increases the difference between left and right channels which
  2651. adds some sort of "live" effect to playback.
  2652. The filter accepts the following options:
  2653. @table @option
  2654. @item m
  2655. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2656. (average of both channels), with 1.0 sound will be unchanged, with
  2657. -1.0 left and right channels will be swapped.
  2658. @item c
  2659. Enable clipping. By default is enabled.
  2660. @end table
  2661. @section firequalizer
  2662. Apply FIR Equalization using arbitrary frequency response.
  2663. The filter accepts the following option:
  2664. @table @option
  2665. @item gain
  2666. Set gain curve equation (in dB). The expression can contain variables:
  2667. @table @option
  2668. @item f
  2669. the evaluated frequency
  2670. @item sr
  2671. sample rate
  2672. @item ch
  2673. channel number, set to 0 when multichannels evaluation is disabled
  2674. @item chid
  2675. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2676. multichannels evaluation is disabled
  2677. @item chs
  2678. number of channels
  2679. @item chlayout
  2680. channel_layout, see libavutil/channel_layout.h
  2681. @end table
  2682. and functions:
  2683. @table @option
  2684. @item gain_interpolate(f)
  2685. interpolate gain on frequency f based on gain_entry
  2686. @item cubic_interpolate(f)
  2687. same as gain_interpolate, but smoother
  2688. @end table
  2689. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2690. @item gain_entry
  2691. Set gain entry for gain_interpolate function. The expression can
  2692. contain functions:
  2693. @table @option
  2694. @item entry(f, g)
  2695. store gain entry at frequency f with value g
  2696. @end table
  2697. This option is also available as command.
  2698. @item delay
  2699. Set filter delay in seconds. Higher value means more accurate.
  2700. Default is @code{0.01}.
  2701. @item accuracy
  2702. Set filter accuracy in Hz. Lower value means more accurate.
  2703. Default is @code{5}.
  2704. @item wfunc
  2705. Set window function. Acceptable values are:
  2706. @table @option
  2707. @item rectangular
  2708. rectangular window, useful when gain curve is already smooth
  2709. @item hann
  2710. hann window (default)
  2711. @item hamming
  2712. hamming window
  2713. @item blackman
  2714. blackman window
  2715. @item nuttall3
  2716. 3-terms continuous 1st derivative nuttall window
  2717. @item mnuttall3
  2718. minimum 3-terms discontinuous nuttall window
  2719. @item nuttall
  2720. 4-terms continuous 1st derivative nuttall window
  2721. @item bnuttall
  2722. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2723. @item bharris
  2724. blackman-harris window
  2725. @item tukey
  2726. tukey window
  2727. @end table
  2728. @item fixed
  2729. If enabled, use fixed number of audio samples. This improves speed when
  2730. filtering with large delay. Default is disabled.
  2731. @item multi
  2732. Enable multichannels evaluation on gain. Default is disabled.
  2733. @item zero_phase
  2734. Enable zero phase mode by subtracting timestamp to compensate delay.
  2735. Default is disabled.
  2736. @item scale
  2737. Set scale used by gain. Acceptable values are:
  2738. @table @option
  2739. @item linlin
  2740. linear frequency, linear gain
  2741. @item linlog
  2742. linear frequency, logarithmic (in dB) gain (default)
  2743. @item loglin
  2744. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2745. @item loglog
  2746. logarithmic frequency, logarithmic gain
  2747. @end table
  2748. @item dumpfile
  2749. Set file for dumping, suitable for gnuplot.
  2750. @item dumpscale
  2751. Set scale for dumpfile. Acceptable values are same with scale option.
  2752. Default is linlog.
  2753. @item fft2
  2754. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2755. Default is disabled.
  2756. @item min_phase
  2757. Enable minimum phase impulse response. Default is disabled.
  2758. @end table
  2759. @subsection Examples
  2760. @itemize
  2761. @item
  2762. lowpass at 1000 Hz:
  2763. @example
  2764. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2765. @end example
  2766. @item
  2767. lowpass at 1000 Hz with gain_entry:
  2768. @example
  2769. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2770. @end example
  2771. @item
  2772. custom equalization:
  2773. @example
  2774. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2775. @end example
  2776. @item
  2777. higher delay with zero phase to compensate delay:
  2778. @example
  2779. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2780. @end example
  2781. @item
  2782. lowpass on left channel, highpass on right channel:
  2783. @example
  2784. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2785. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2786. @end example
  2787. @end itemize
  2788. @section flanger
  2789. Apply a flanging effect to the audio.
  2790. The filter accepts the following options:
  2791. @table @option
  2792. @item delay
  2793. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2794. @item depth
  2795. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2796. @item regen
  2797. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2798. Default value is 0.
  2799. @item width
  2800. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2801. Default value is 71.
  2802. @item speed
  2803. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2804. @item shape
  2805. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2806. Default value is @var{sinusoidal}.
  2807. @item phase
  2808. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2809. Default value is 25.
  2810. @item interp
  2811. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2812. Default is @var{linear}.
  2813. @end table
  2814. @section haas
  2815. Apply Haas effect to audio.
  2816. Note that this makes most sense to apply on mono signals.
  2817. With this filter applied to mono signals it give some directionality and
  2818. stretches its stereo image.
  2819. The filter accepts the following options:
  2820. @table @option
  2821. @item level_in
  2822. Set input level. By default is @var{1}, or 0dB
  2823. @item level_out
  2824. Set output level. By default is @var{1}, or 0dB.
  2825. @item side_gain
  2826. Set gain applied to side part of signal. By default is @var{1}.
  2827. @item middle_source
  2828. Set kind of middle source. Can be one of the following:
  2829. @table @samp
  2830. @item left
  2831. Pick left channel.
  2832. @item right
  2833. Pick right channel.
  2834. @item mid
  2835. Pick middle part signal of stereo image.
  2836. @item side
  2837. Pick side part signal of stereo image.
  2838. @end table
  2839. @item middle_phase
  2840. Change middle phase. By default is disabled.
  2841. @item left_delay
  2842. Set left channel delay. By default is @var{2.05} milliseconds.
  2843. @item left_balance
  2844. Set left channel balance. By default is @var{-1}.
  2845. @item left_gain
  2846. Set left channel gain. By default is @var{1}.
  2847. @item left_phase
  2848. Change left phase. By default is disabled.
  2849. @item right_delay
  2850. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2851. @item right_balance
  2852. Set right channel balance. By default is @var{1}.
  2853. @item right_gain
  2854. Set right channel gain. By default is @var{1}.
  2855. @item right_phase
  2856. Change right phase. By default is enabled.
  2857. @end table
  2858. @section hdcd
  2859. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2860. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2861. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2862. of HDCD, and detects the Transient Filter flag.
  2863. @example
  2864. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2865. @end example
  2866. When using the filter with wav, note the default encoding for wav is 16-bit,
  2867. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2868. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2869. @example
  2870. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2871. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2872. @end example
  2873. The filter accepts the following options:
  2874. @table @option
  2875. @item disable_autoconvert
  2876. Disable any automatic format conversion or resampling in the filter graph.
  2877. @item process_stereo
  2878. Process the stereo channels together. If target_gain does not match between
  2879. channels, consider it invalid and use the last valid target_gain.
  2880. @item cdt_ms
  2881. Set the code detect timer period in ms.
  2882. @item force_pe
  2883. Always extend peaks above -3dBFS even if PE isn't signaled.
  2884. @item analyze_mode
  2885. Replace audio with a solid tone and adjust the amplitude to signal some
  2886. specific aspect of the decoding process. The output file can be loaded in
  2887. an audio editor alongside the original to aid analysis.
  2888. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2889. Modes are:
  2890. @table @samp
  2891. @item 0, off
  2892. Disabled
  2893. @item 1, lle
  2894. Gain adjustment level at each sample
  2895. @item 2, pe
  2896. Samples where peak extend occurs
  2897. @item 3, cdt
  2898. Samples where the code detect timer is active
  2899. @item 4, tgm
  2900. Samples where the target gain does not match between channels
  2901. @end table
  2902. @end table
  2903. @section headphone
  2904. Apply head-related transfer functions (HRTFs) to create virtual
  2905. loudspeakers around the user for binaural listening via headphones.
  2906. The HRIRs are provided via additional streams, for each channel
  2907. one stereo input stream is needed.
  2908. The filter accepts the following options:
  2909. @table @option
  2910. @item map
  2911. Set mapping of input streams for convolution.
  2912. The argument is a '|'-separated list of channel names in order as they
  2913. are given as additional stream inputs for filter.
  2914. This also specify number of input streams. Number of input streams
  2915. must be not less than number of channels in first stream plus one.
  2916. @item gain
  2917. Set gain applied to audio. Value is in dB. Default is 0.
  2918. @item type
  2919. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2920. processing audio in time domain which is slow.
  2921. @var{freq} is processing audio in frequency domain which is fast.
  2922. Default is @var{freq}.
  2923. @item lfe
  2924. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2925. @item size
  2926. Set size of frame in number of samples which will be processed at once.
  2927. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2928. @item hrir
  2929. Set format of hrir stream.
  2930. Default value is @var{stereo}. Alternative value is @var{multich}.
  2931. If value is set to @var{stereo}, number of additional streams should
  2932. be greater or equal to number of input channels in first input stream.
  2933. Also each additional stream should have stereo number of channels.
  2934. If value is set to @var{multich}, number of additional streams should
  2935. be exactly one. Also number of input channels of additional stream
  2936. should be equal or greater than twice number of channels of first input
  2937. stream.
  2938. @end table
  2939. @subsection Examples
  2940. @itemize
  2941. @item
  2942. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2943. each amovie filter use stereo file with IR coefficients as input.
  2944. The files give coefficients for each position of virtual loudspeaker:
  2945. @example
  2946. ffmpeg -i input.wav
  2947. -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"
  2948. output.wav
  2949. @end example
  2950. @item
  2951. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2952. but now in @var{multich} @var{hrir} format.
  2953. @example
  2954. 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"
  2955. output.wav
  2956. @end example
  2957. @end itemize
  2958. @section highpass
  2959. Apply a high-pass filter with 3dB point frequency.
  2960. The filter can be either single-pole, or double-pole (the default).
  2961. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2962. The filter accepts the following options:
  2963. @table @option
  2964. @item frequency, f
  2965. Set frequency in Hz. Default is 3000.
  2966. @item poles, p
  2967. Set number of poles. Default is 2.
  2968. @item width_type, t
  2969. Set method to specify band-width of filter.
  2970. @table @option
  2971. @item h
  2972. Hz
  2973. @item q
  2974. Q-Factor
  2975. @item o
  2976. octave
  2977. @item s
  2978. slope
  2979. @item k
  2980. kHz
  2981. @end table
  2982. @item width, w
  2983. Specify the band-width of a filter in width_type units.
  2984. Applies only to double-pole filter.
  2985. The default is 0.707q and gives a Butterworth response.
  2986. @item mix, m
  2987. How much to use filtered signal in output. Default is 1.
  2988. Range is between 0 and 1.
  2989. @item channels, c
  2990. Specify which channels to filter, by default all available are filtered.
  2991. @end table
  2992. @subsection Commands
  2993. This filter supports the following commands:
  2994. @table @option
  2995. @item frequency, f
  2996. Change highpass frequency.
  2997. Syntax for the command is : "@var{frequency}"
  2998. @item width_type, t
  2999. Change highpass width_type.
  3000. Syntax for the command is : "@var{width_type}"
  3001. @item width, w
  3002. Change highpass width.
  3003. Syntax for the command is : "@var{width}"
  3004. @item mix, m
  3005. Change highpass mix.
  3006. Syntax for the command is : "@var{mix}"
  3007. @end table
  3008. @section join
  3009. Join multiple input streams into one multi-channel stream.
  3010. It accepts the following parameters:
  3011. @table @option
  3012. @item inputs
  3013. The number of input streams. It defaults to 2.
  3014. @item channel_layout
  3015. The desired output channel layout. It defaults to stereo.
  3016. @item map
  3017. Map channels from inputs to output. The argument is a '|'-separated list of
  3018. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3019. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3020. can be either the name of the input channel (e.g. FL for front left) or its
  3021. index in the specified input stream. @var{out_channel} is the name of the output
  3022. channel.
  3023. @end table
  3024. The filter will attempt to guess the mappings when they are not specified
  3025. explicitly. It does so by first trying to find an unused matching input channel
  3026. and if that fails it picks the first unused input channel.
  3027. Join 3 inputs (with properly set channel layouts):
  3028. @example
  3029. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3030. @end example
  3031. Build a 5.1 output from 6 single-channel streams:
  3032. @example
  3033. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3034. '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'
  3035. out
  3036. @end example
  3037. @section ladspa
  3038. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3039. To enable compilation of this filter you need to configure FFmpeg with
  3040. @code{--enable-ladspa}.
  3041. @table @option
  3042. @item file, f
  3043. Specifies the name of LADSPA plugin library to load. If the environment
  3044. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3045. each one of the directories specified by the colon separated list in
  3046. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3047. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3048. @file{/usr/lib/ladspa/}.
  3049. @item plugin, p
  3050. Specifies the plugin within the library. Some libraries contain only
  3051. one plugin, but others contain many of them. If this is not set filter
  3052. will list all available plugins within the specified library.
  3053. @item controls, c
  3054. Set the '|' separated list of controls which are zero or more floating point
  3055. values that determine the behavior of the loaded plugin (for example delay,
  3056. threshold or gain).
  3057. Controls need to be defined using the following syntax:
  3058. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3059. @var{valuei} is the value set on the @var{i}-th control.
  3060. Alternatively they can be also defined using the following syntax:
  3061. @var{value0}|@var{value1}|@var{value2}|..., where
  3062. @var{valuei} is the value set on the @var{i}-th control.
  3063. If @option{controls} is set to @code{help}, all available controls and
  3064. their valid ranges are printed.
  3065. @item sample_rate, s
  3066. Specify the sample rate, default to 44100. Only used if plugin have
  3067. zero inputs.
  3068. @item nb_samples, n
  3069. Set the number of samples per channel per each output frame, default
  3070. is 1024. Only used if plugin have zero inputs.
  3071. @item duration, d
  3072. Set the minimum duration of the sourced audio. See
  3073. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3074. for the accepted syntax.
  3075. Note that the resulting duration may be greater than the specified duration,
  3076. as the generated audio is always cut at the end of a complete frame.
  3077. If not specified, or the expressed duration is negative, the audio is
  3078. supposed to be generated forever.
  3079. Only used if plugin have zero inputs.
  3080. @end table
  3081. @subsection Examples
  3082. @itemize
  3083. @item
  3084. List all available plugins within amp (LADSPA example plugin) library:
  3085. @example
  3086. ladspa=file=amp
  3087. @end example
  3088. @item
  3089. List all available controls and their valid ranges for @code{vcf_notch}
  3090. plugin from @code{VCF} library:
  3091. @example
  3092. ladspa=f=vcf:p=vcf_notch:c=help
  3093. @end example
  3094. @item
  3095. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3096. plugin library:
  3097. @example
  3098. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3099. @end example
  3100. @item
  3101. Add reverberation to the audio using TAP-plugins
  3102. (Tom's Audio Processing plugins):
  3103. @example
  3104. ladspa=file=tap_reverb:tap_reverb
  3105. @end example
  3106. @item
  3107. Generate white noise, with 0.2 amplitude:
  3108. @example
  3109. ladspa=file=cmt:noise_source_white:c=c0=.2
  3110. @end example
  3111. @item
  3112. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3113. @code{C* Audio Plugin Suite} (CAPS) library:
  3114. @example
  3115. ladspa=file=caps:Click:c=c1=20'
  3116. @end example
  3117. @item
  3118. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3119. @example
  3120. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3121. @end example
  3122. @item
  3123. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3124. @code{SWH Plugins} collection:
  3125. @example
  3126. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3127. @end example
  3128. @item
  3129. Attenuate low frequencies using Multiband EQ from Steve Harris
  3130. @code{SWH Plugins} collection:
  3131. @example
  3132. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3133. @end example
  3134. @item
  3135. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3136. (CAPS) library:
  3137. @example
  3138. ladspa=caps:Narrower
  3139. @end example
  3140. @item
  3141. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3142. @example
  3143. ladspa=caps:White:.2
  3144. @end example
  3145. @item
  3146. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3147. @example
  3148. ladspa=caps:Fractal:c=c1=1
  3149. @end example
  3150. @item
  3151. Dynamic volume normalization using @code{VLevel} plugin:
  3152. @example
  3153. ladspa=vlevel-ladspa:vlevel_mono
  3154. @end example
  3155. @end itemize
  3156. @subsection Commands
  3157. This filter supports the following commands:
  3158. @table @option
  3159. @item cN
  3160. Modify the @var{N}-th control value.
  3161. If the specified value is not valid, it is ignored and prior one is kept.
  3162. @end table
  3163. @section loudnorm
  3164. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3165. Support for both single pass (livestreams, files) and double pass (files) modes.
  3166. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  3167. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  3168. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3169. The filter accepts the following options:
  3170. @table @option
  3171. @item I, i
  3172. Set integrated loudness target.
  3173. Range is -70.0 - -5.0. Default value is -24.0.
  3174. @item LRA, lra
  3175. Set loudness range target.
  3176. Range is 1.0 - 20.0. Default value is 7.0.
  3177. @item TP, tp
  3178. Set maximum true peak.
  3179. Range is -9.0 - +0.0. Default value is -2.0.
  3180. @item measured_I, measured_i
  3181. Measured IL of input file.
  3182. Range is -99.0 - +0.0.
  3183. @item measured_LRA, measured_lra
  3184. Measured LRA of input file.
  3185. Range is 0.0 - 99.0.
  3186. @item measured_TP, measured_tp
  3187. Measured true peak of input file.
  3188. Range is -99.0 - +99.0.
  3189. @item measured_thresh
  3190. Measured threshold of input file.
  3191. Range is -99.0 - +0.0.
  3192. @item offset
  3193. Set offset gain. Gain is applied before the true-peak limiter.
  3194. Range is -99.0 - +99.0. Default is +0.0.
  3195. @item linear
  3196. Normalize linearly if possible.
  3197. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  3198. to be specified in order to use this mode.
  3199. Options are true or false. Default is true.
  3200. @item dual_mono
  3201. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3202. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3203. If set to @code{true}, this option will compensate for this effect.
  3204. Multi-channel input files are not affected by this option.
  3205. Options are true or false. Default is false.
  3206. @item print_format
  3207. Set print format for stats. Options are summary, json, or none.
  3208. Default value is none.
  3209. @end table
  3210. @section lowpass
  3211. Apply a low-pass filter with 3dB point frequency.
  3212. The filter can be either single-pole or double-pole (the default).
  3213. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3214. The filter accepts the following options:
  3215. @table @option
  3216. @item frequency, f
  3217. Set frequency in Hz. Default is 500.
  3218. @item poles, p
  3219. Set number of poles. Default is 2.
  3220. @item width_type, t
  3221. Set method to specify band-width of filter.
  3222. @table @option
  3223. @item h
  3224. Hz
  3225. @item q
  3226. Q-Factor
  3227. @item o
  3228. octave
  3229. @item s
  3230. slope
  3231. @item k
  3232. kHz
  3233. @end table
  3234. @item width, w
  3235. Specify the band-width of a filter in width_type units.
  3236. Applies only to double-pole filter.
  3237. The default is 0.707q and gives a Butterworth response.
  3238. @item mix, m
  3239. How much to use filtered signal in output. Default is 1.
  3240. Range is between 0 and 1.
  3241. @item channels, c
  3242. Specify which channels to filter, by default all available are filtered.
  3243. @end table
  3244. @subsection Examples
  3245. @itemize
  3246. @item
  3247. Lowpass only LFE channel, it LFE is not present it does nothing:
  3248. @example
  3249. lowpass=c=LFE
  3250. @end example
  3251. @end itemize
  3252. @subsection Commands
  3253. This filter supports the following commands:
  3254. @table @option
  3255. @item frequency, f
  3256. Change lowpass frequency.
  3257. Syntax for the command is : "@var{frequency}"
  3258. @item width_type, t
  3259. Change lowpass width_type.
  3260. Syntax for the command is : "@var{width_type}"
  3261. @item width, w
  3262. Change lowpass width.
  3263. Syntax for the command is : "@var{width}"
  3264. @item mix, m
  3265. Change lowpass mix.
  3266. Syntax for the command is : "@var{mix}"
  3267. @end table
  3268. @section lv2
  3269. Load a LV2 (LADSPA Version 2) plugin.
  3270. To enable compilation of this filter you need to configure FFmpeg with
  3271. @code{--enable-lv2}.
  3272. @table @option
  3273. @item plugin, p
  3274. Specifies the plugin URI. You may need to escape ':'.
  3275. @item controls, c
  3276. Set the '|' separated list of controls which are zero or more floating point
  3277. values that determine the behavior of the loaded plugin (for example delay,
  3278. threshold or gain).
  3279. If @option{controls} is set to @code{help}, all available controls and
  3280. their valid ranges are printed.
  3281. @item sample_rate, s
  3282. Specify the sample rate, default to 44100. Only used if plugin have
  3283. zero inputs.
  3284. @item nb_samples, n
  3285. Set the number of samples per channel per each output frame, default
  3286. is 1024. Only used if plugin have zero inputs.
  3287. @item duration, d
  3288. Set the minimum duration of the sourced audio. See
  3289. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3290. for the accepted syntax.
  3291. Note that the resulting duration may be greater than the specified duration,
  3292. as the generated audio is always cut at the end of a complete frame.
  3293. If not specified, or the expressed duration is negative, the audio is
  3294. supposed to be generated forever.
  3295. Only used if plugin have zero inputs.
  3296. @end table
  3297. @subsection Examples
  3298. @itemize
  3299. @item
  3300. Apply bass enhancer plugin from Calf:
  3301. @example
  3302. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3303. @end example
  3304. @item
  3305. Apply vinyl plugin from Calf:
  3306. @example
  3307. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3308. @end example
  3309. @item
  3310. Apply bit crusher plugin from ArtyFX:
  3311. @example
  3312. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3313. @end example
  3314. @end itemize
  3315. @section mcompand
  3316. Multiband Compress or expand the audio's dynamic range.
  3317. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3318. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3319. response when absent compander action.
  3320. It accepts the following parameters:
  3321. @table @option
  3322. @item args
  3323. This option syntax is:
  3324. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3325. For explanation of each item refer to compand filter documentation.
  3326. @end table
  3327. @anchor{pan}
  3328. @section pan
  3329. Mix channels with specific gain levels. The filter accepts the output
  3330. channel layout followed by a set of channels definitions.
  3331. This filter is also designed to efficiently remap the channels of an audio
  3332. stream.
  3333. The filter accepts parameters of the form:
  3334. "@var{l}|@var{outdef}|@var{outdef}|..."
  3335. @table @option
  3336. @item l
  3337. output channel layout or number of channels
  3338. @item outdef
  3339. output channel specification, of the form:
  3340. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3341. @item out_name
  3342. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3343. number (c0, c1, etc.)
  3344. @item gain
  3345. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3346. @item in_name
  3347. input channel to use, see out_name for details; it is not possible to mix
  3348. named and numbered input channels
  3349. @end table
  3350. If the `=' in a channel specification is replaced by `<', then the gains for
  3351. that specification will be renormalized so that the total is 1, thus
  3352. avoiding clipping noise.
  3353. @subsection Mixing examples
  3354. For example, if you want to down-mix from stereo to mono, but with a bigger
  3355. factor for the left channel:
  3356. @example
  3357. pan=1c|c0=0.9*c0+0.1*c1
  3358. @end example
  3359. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3360. 7-channels surround:
  3361. @example
  3362. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3363. @end example
  3364. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3365. that should be preferred (see "-ac" option) unless you have very specific
  3366. needs.
  3367. @subsection Remapping examples
  3368. The channel remapping will be effective if, and only if:
  3369. @itemize
  3370. @item gain coefficients are zeroes or ones,
  3371. @item only one input per channel output,
  3372. @end itemize
  3373. If all these conditions are satisfied, the filter will notify the user ("Pure
  3374. channel mapping detected"), and use an optimized and lossless method to do the
  3375. remapping.
  3376. For example, if you have a 5.1 source and want a stereo audio stream by
  3377. dropping the extra channels:
  3378. @example
  3379. pan="stereo| c0=FL | c1=FR"
  3380. @end example
  3381. Given the same source, you can also switch front left and front right channels
  3382. and keep the input channel layout:
  3383. @example
  3384. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3385. @end example
  3386. If the input is a stereo audio stream, you can mute the front left channel (and
  3387. still keep the stereo channel layout) with:
  3388. @example
  3389. pan="stereo|c1=c1"
  3390. @end example
  3391. Still with a stereo audio stream input, you can copy the right channel in both
  3392. front left and right:
  3393. @example
  3394. pan="stereo| c0=FR | c1=FR"
  3395. @end example
  3396. @section replaygain
  3397. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3398. outputs it unchanged.
  3399. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3400. @section resample
  3401. Convert the audio sample format, sample rate and channel layout. It is
  3402. not meant to be used directly.
  3403. @section rubberband
  3404. Apply time-stretching and pitch-shifting with librubberband.
  3405. To enable compilation of this filter, you need to configure FFmpeg with
  3406. @code{--enable-librubberband}.
  3407. The filter accepts the following options:
  3408. @table @option
  3409. @item tempo
  3410. Set tempo scale factor.
  3411. @item pitch
  3412. Set pitch scale factor.
  3413. @item transients
  3414. Set transients detector.
  3415. Possible values are:
  3416. @table @var
  3417. @item crisp
  3418. @item mixed
  3419. @item smooth
  3420. @end table
  3421. @item detector
  3422. Set detector.
  3423. Possible values are:
  3424. @table @var
  3425. @item compound
  3426. @item percussive
  3427. @item soft
  3428. @end table
  3429. @item phase
  3430. Set phase.
  3431. Possible values are:
  3432. @table @var
  3433. @item laminar
  3434. @item independent
  3435. @end table
  3436. @item window
  3437. Set processing window size.
  3438. Possible values are:
  3439. @table @var
  3440. @item standard
  3441. @item short
  3442. @item long
  3443. @end table
  3444. @item smoothing
  3445. Set smoothing.
  3446. Possible values are:
  3447. @table @var
  3448. @item off
  3449. @item on
  3450. @end table
  3451. @item formant
  3452. Enable formant preservation when shift pitching.
  3453. Possible values are:
  3454. @table @var
  3455. @item shifted
  3456. @item preserved
  3457. @end table
  3458. @item pitchq
  3459. Set pitch quality.
  3460. Possible values are:
  3461. @table @var
  3462. @item quality
  3463. @item speed
  3464. @item consistency
  3465. @end table
  3466. @item channels
  3467. Set channels.
  3468. Possible values are:
  3469. @table @var
  3470. @item apart
  3471. @item together
  3472. @end table
  3473. @end table
  3474. @section sidechaincompress
  3475. This filter acts like normal compressor but has the ability to compress
  3476. detected signal using second input signal.
  3477. It needs two input streams and returns one output stream.
  3478. First input stream will be processed depending on second stream signal.
  3479. The filtered signal then can be filtered with other filters in later stages of
  3480. processing. See @ref{pan} and @ref{amerge} filter.
  3481. The filter accepts the following options:
  3482. @table @option
  3483. @item level_in
  3484. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3485. @item mode
  3486. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3487. Default is @code{downward}.
  3488. @item threshold
  3489. If a signal of second stream raises above this level it will affect the gain
  3490. reduction of first stream.
  3491. By default is 0.125. Range is between 0.00097563 and 1.
  3492. @item ratio
  3493. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3494. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3495. Default is 2. Range is between 1 and 20.
  3496. @item attack
  3497. Amount of milliseconds the signal has to rise above the threshold before gain
  3498. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3499. @item release
  3500. Amount of milliseconds the signal has to fall below the threshold before
  3501. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3502. @item makeup
  3503. Set the amount by how much signal will be amplified after processing.
  3504. Default is 1. Range is from 1 to 64.
  3505. @item knee
  3506. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3507. Default is 2.82843. Range is between 1 and 8.
  3508. @item link
  3509. Choose if the @code{average} level between all channels of side-chain stream
  3510. or the louder(@code{maximum}) channel of side-chain stream affects the
  3511. reduction. Default is @code{average}.
  3512. @item detection
  3513. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3514. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3515. @item level_sc
  3516. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3517. @item mix
  3518. How much to use compressed signal in output. Default is 1.
  3519. Range is between 0 and 1.
  3520. @end table
  3521. @subsection Examples
  3522. @itemize
  3523. @item
  3524. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3525. depending on the signal of 2nd input and later compressed signal to be
  3526. merged with 2nd input:
  3527. @example
  3528. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3529. @end example
  3530. @end itemize
  3531. @section sidechaingate
  3532. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3533. filter the detected signal before sending it to the gain reduction stage.
  3534. Normally a gate uses the full range signal to detect a level above the
  3535. threshold.
  3536. For example: If you cut all lower frequencies from your sidechain signal
  3537. the gate will decrease the volume of your track only if not enough highs
  3538. appear. With this technique you are able to reduce the resonation of a
  3539. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3540. guitar.
  3541. It needs two input streams and returns one output stream.
  3542. First input stream will be processed depending on second stream signal.
  3543. The filter accepts the following options:
  3544. @table @option
  3545. @item level_in
  3546. Set input level before filtering.
  3547. Default is 1. Allowed range is from 0.015625 to 64.
  3548. @item mode
  3549. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3550. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3551. will be amplified, expanding dynamic range in upward direction.
  3552. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3553. @item range
  3554. Set the level of gain reduction when the signal is below the threshold.
  3555. Default is 0.06125. Allowed range is from 0 to 1.
  3556. Setting this to 0 disables reduction and then filter behaves like expander.
  3557. @item threshold
  3558. If a signal rises above this level the gain reduction is released.
  3559. Default is 0.125. Allowed range is from 0 to 1.
  3560. @item ratio
  3561. Set a ratio about which the signal is reduced.
  3562. Default is 2. Allowed range is from 1 to 9000.
  3563. @item attack
  3564. Amount of milliseconds the signal has to rise above the threshold before gain
  3565. reduction stops.
  3566. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3567. @item release
  3568. Amount of milliseconds the signal has to fall below the threshold before the
  3569. reduction is increased again. Default is 250 milliseconds.
  3570. Allowed range is from 0.01 to 9000.
  3571. @item makeup
  3572. Set amount of amplification of signal after processing.
  3573. Default is 1. Allowed range is from 1 to 64.
  3574. @item knee
  3575. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3576. Default is 2.828427125. Allowed range is from 1 to 8.
  3577. @item detection
  3578. Choose if exact signal should be taken for detection or an RMS like one.
  3579. Default is rms. Can be peak or rms.
  3580. @item link
  3581. Choose if the average level between all channels or the louder channel affects
  3582. the reduction.
  3583. Default is average. Can be average or maximum.
  3584. @item level_sc
  3585. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3586. @end table
  3587. @section silencedetect
  3588. Detect silence in an audio stream.
  3589. This filter logs a message when it detects that the input audio volume is less
  3590. or equal to a noise tolerance value for a duration greater or equal to the
  3591. minimum detected noise duration.
  3592. The printed times and duration are expressed in seconds.
  3593. The filter accepts the following options:
  3594. @table @option
  3595. @item noise, n
  3596. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3597. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3598. @item duration, d
  3599. Set silence duration until notification (default is 2 seconds).
  3600. @item mono, m
  3601. Process each channel separately, instead of combined. By default is disabled.
  3602. @end table
  3603. @subsection Examples
  3604. @itemize
  3605. @item
  3606. Detect 5 seconds of silence with -50dB noise tolerance:
  3607. @example
  3608. silencedetect=n=-50dB:d=5
  3609. @end example
  3610. @item
  3611. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3612. tolerance in @file{silence.mp3}:
  3613. @example
  3614. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3615. @end example
  3616. @end itemize
  3617. @section silenceremove
  3618. Remove silence from the beginning, middle or end of the audio.
  3619. The filter accepts the following options:
  3620. @table @option
  3621. @item start_periods
  3622. This value is used to indicate if audio should be trimmed at beginning of
  3623. the audio. A value of zero indicates no silence should be trimmed from the
  3624. beginning. When specifying a non-zero value, it trims audio up until it
  3625. finds non-silence. Normally, when trimming silence from beginning of audio
  3626. the @var{start_periods} will be @code{1} but it can be increased to higher
  3627. values to trim all audio up to specific count of non-silence periods.
  3628. Default value is @code{0}.
  3629. @item start_duration
  3630. Specify the amount of time that non-silence must be detected before it stops
  3631. trimming audio. By increasing the duration, bursts of noises can be treated
  3632. as silence and trimmed off. Default value is @code{0}.
  3633. @item start_threshold
  3634. This indicates what sample value should be treated as silence. For digital
  3635. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3636. you may wish to increase the value to account for background noise.
  3637. Can be specified in dB (in case "dB" is appended to the specified value)
  3638. or amplitude ratio. Default value is @code{0}.
  3639. @item start_silence
  3640. Specify max duration of silence at beginning that will be kept after
  3641. trimming. Default is 0, which is equal to trimming all samples detected
  3642. as silence.
  3643. @item start_mode
  3644. Specify mode of detection of silence end in start of multi-channel audio.
  3645. Can be @var{any} or @var{all}. Default is @var{any}.
  3646. With @var{any}, any sample that is detected as non-silence will cause
  3647. stopped trimming of silence.
  3648. With @var{all}, only if all channels are detected as non-silence will cause
  3649. stopped trimming of silence.
  3650. @item stop_periods
  3651. Set the count for trimming silence from the end of audio.
  3652. To remove silence from the middle of a file, specify a @var{stop_periods}
  3653. that is negative. This value is then treated as a positive value and is
  3654. used to indicate the effect should restart processing as specified by
  3655. @var{start_periods}, making it suitable for removing periods of silence
  3656. in the middle of the audio.
  3657. Default value is @code{0}.
  3658. @item stop_duration
  3659. Specify a duration of silence that must exist before audio is not copied any
  3660. more. By specifying a higher duration, silence that is wanted can be left in
  3661. the audio.
  3662. Default value is @code{0}.
  3663. @item stop_threshold
  3664. This is the same as @option{start_threshold} but for trimming silence from
  3665. the end of audio.
  3666. Can be specified in dB (in case "dB" is appended to the specified value)
  3667. or amplitude ratio. Default value is @code{0}.
  3668. @item stop_silence
  3669. Specify max duration of silence at end that will be kept after
  3670. trimming. Default is 0, which is equal to trimming all samples detected
  3671. as silence.
  3672. @item stop_mode
  3673. Specify mode of detection of silence start in end of multi-channel audio.
  3674. Can be @var{any} or @var{all}. Default is @var{any}.
  3675. With @var{any}, any sample that is detected as non-silence will cause
  3676. stopped trimming of silence.
  3677. With @var{all}, only if all channels are detected as non-silence will cause
  3678. stopped trimming of silence.
  3679. @item detection
  3680. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3681. and works better with digital silence which is exactly 0.
  3682. Default value is @code{rms}.
  3683. @item window
  3684. Set duration in number of seconds used to calculate size of window in number
  3685. of samples for detecting silence.
  3686. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3687. @end table
  3688. @subsection Examples
  3689. @itemize
  3690. @item
  3691. The following example shows how this filter can be used to start a recording
  3692. that does not contain the delay at the start which usually occurs between
  3693. pressing the record button and the start of the performance:
  3694. @example
  3695. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3696. @end example
  3697. @item
  3698. Trim all silence encountered from beginning to end where there is more than 1
  3699. second of silence in audio:
  3700. @example
  3701. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3702. @end example
  3703. @item
  3704. Trim all digital silence samples, using peak detection, from beginning to end
  3705. where there is more than 0 samples of digital silence in audio and digital
  3706. silence is detected in all channels at same positions in stream:
  3707. @example
  3708. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  3709. @end example
  3710. @end itemize
  3711. @section sofalizer
  3712. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3713. loudspeakers around the user for binaural listening via headphones (audio
  3714. formats up to 9 channels supported).
  3715. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3716. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3717. Austrian Academy of Sciences.
  3718. To enable compilation of this filter you need to configure FFmpeg with
  3719. @code{--enable-libmysofa}.
  3720. The filter accepts the following options:
  3721. @table @option
  3722. @item sofa
  3723. Set the SOFA file used for rendering.
  3724. @item gain
  3725. Set gain applied to audio. Value is in dB. Default is 0.
  3726. @item rotation
  3727. Set rotation of virtual loudspeakers in deg. Default is 0.
  3728. @item elevation
  3729. Set elevation of virtual speakers in deg. Default is 0.
  3730. @item radius
  3731. Set distance in meters between loudspeakers and the listener with near-field
  3732. HRTFs. Default is 1.
  3733. @item type
  3734. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3735. processing audio in time domain which is slow.
  3736. @var{freq} is processing audio in frequency domain which is fast.
  3737. Default is @var{freq}.
  3738. @item speakers
  3739. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3740. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3741. Each virtual loudspeaker is described with short channel name following with
  3742. azimuth and elevation in degrees.
  3743. Each virtual loudspeaker description is separated by '|'.
  3744. For example to override front left and front right channel positions use:
  3745. 'speakers=FL 45 15|FR 345 15'.
  3746. Descriptions with unrecognised channel names are ignored.
  3747. @item lfegain
  3748. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3749. @item framesize
  3750. Set custom frame size in number of samples. Default is 1024.
  3751. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3752. is set to @var{freq}.
  3753. @item normalize
  3754. Should all IRs be normalized upon importing SOFA file.
  3755. By default is enabled.
  3756. @item interpolate
  3757. Should nearest IRs be interpolated with neighbor IRs if exact position
  3758. does not match. By default is disabled.
  3759. @item minphase
  3760. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3761. @item anglestep
  3762. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3763. @item radstep
  3764. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3765. @end table
  3766. @subsection Examples
  3767. @itemize
  3768. @item
  3769. Using ClubFritz6 sofa file:
  3770. @example
  3771. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3772. @end example
  3773. @item
  3774. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3775. @example
  3776. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3777. @end example
  3778. @item
  3779. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3780. and also with custom gain:
  3781. @example
  3782. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3783. @end example
  3784. @end itemize
  3785. @section stereotools
  3786. This filter has some handy utilities to manage stereo signals, for converting
  3787. M/S stereo recordings to L/R signal while having control over the parameters
  3788. or spreading the stereo image of master track.
  3789. The filter accepts the following options:
  3790. @table @option
  3791. @item level_in
  3792. Set input level before filtering for both channels. Defaults is 1.
  3793. Allowed range is from 0.015625 to 64.
  3794. @item level_out
  3795. Set output level after filtering for both channels. Defaults is 1.
  3796. Allowed range is from 0.015625 to 64.
  3797. @item balance_in
  3798. Set input balance between both channels. Default is 0.
  3799. Allowed range is from -1 to 1.
  3800. @item balance_out
  3801. Set output balance between both channels. Default is 0.
  3802. Allowed range is from -1 to 1.
  3803. @item softclip
  3804. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3805. clipping. Disabled by default.
  3806. @item mutel
  3807. Mute the left channel. Disabled by default.
  3808. @item muter
  3809. Mute the right channel. Disabled by default.
  3810. @item phasel
  3811. Change the phase of the left channel. Disabled by default.
  3812. @item phaser
  3813. Change the phase of the right channel. Disabled by default.
  3814. @item mode
  3815. Set stereo mode. Available values are:
  3816. @table @samp
  3817. @item lr>lr
  3818. Left/Right to Left/Right, this is default.
  3819. @item lr>ms
  3820. Left/Right to Mid/Side.
  3821. @item ms>lr
  3822. Mid/Side to Left/Right.
  3823. @item lr>ll
  3824. Left/Right to Left/Left.
  3825. @item lr>rr
  3826. Left/Right to Right/Right.
  3827. @item lr>l+r
  3828. Left/Right to Left + Right.
  3829. @item lr>rl
  3830. Left/Right to Right/Left.
  3831. @item ms>ll
  3832. Mid/Side to Left/Left.
  3833. @item ms>rr
  3834. Mid/Side to Right/Right.
  3835. @end table
  3836. @item slev
  3837. Set level of side signal. Default is 1.
  3838. Allowed range is from 0.015625 to 64.
  3839. @item sbal
  3840. Set balance of side signal. Default is 0.
  3841. Allowed range is from -1 to 1.
  3842. @item mlev
  3843. Set level of the middle signal. Default is 1.
  3844. Allowed range is from 0.015625 to 64.
  3845. @item mpan
  3846. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3847. @item base
  3848. Set stereo base between mono and inversed channels. Default is 0.
  3849. Allowed range is from -1 to 1.
  3850. @item delay
  3851. Set delay in milliseconds how much to delay left from right channel and
  3852. vice versa. Default is 0. Allowed range is from -20 to 20.
  3853. @item sclevel
  3854. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3855. @item phase
  3856. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3857. @item bmode_in, bmode_out
  3858. Set balance mode for balance_in/balance_out option.
  3859. Can be one of the following:
  3860. @table @samp
  3861. @item balance
  3862. Classic balance mode. Attenuate one channel at time.
  3863. Gain is raised up to 1.
  3864. @item amplitude
  3865. Similar as classic mode above but gain is raised up to 2.
  3866. @item power
  3867. Equal power distribution, from -6dB to +6dB range.
  3868. @end table
  3869. @end table
  3870. @subsection Examples
  3871. @itemize
  3872. @item
  3873. Apply karaoke like effect:
  3874. @example
  3875. stereotools=mlev=0.015625
  3876. @end example
  3877. @item
  3878. Convert M/S signal to L/R:
  3879. @example
  3880. "stereotools=mode=ms>lr"
  3881. @end example
  3882. @end itemize
  3883. @section stereowiden
  3884. This filter enhance the stereo effect by suppressing signal common to both
  3885. channels and by delaying the signal of left into right and vice versa,
  3886. thereby widening the stereo effect.
  3887. The filter accepts the following options:
  3888. @table @option
  3889. @item delay
  3890. Time in milliseconds of the delay of left signal into right and vice versa.
  3891. Default is 20 milliseconds.
  3892. @item feedback
  3893. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3894. effect of left signal in right output and vice versa which gives widening
  3895. effect. Default is 0.3.
  3896. @item crossfeed
  3897. Cross feed of left into right with inverted phase. This helps in suppressing
  3898. the mono. If the value is 1 it will cancel all the signal common to both
  3899. channels. Default is 0.3.
  3900. @item drymix
  3901. Set level of input signal of original channel. Default is 0.8.
  3902. @end table
  3903. @section superequalizer
  3904. Apply 18 band equalizer.
  3905. The filter accepts the following options:
  3906. @table @option
  3907. @item 1b
  3908. Set 65Hz band gain.
  3909. @item 2b
  3910. Set 92Hz band gain.
  3911. @item 3b
  3912. Set 131Hz band gain.
  3913. @item 4b
  3914. Set 185Hz band gain.
  3915. @item 5b
  3916. Set 262Hz band gain.
  3917. @item 6b
  3918. Set 370Hz band gain.
  3919. @item 7b
  3920. Set 523Hz band gain.
  3921. @item 8b
  3922. Set 740Hz band gain.
  3923. @item 9b
  3924. Set 1047Hz band gain.
  3925. @item 10b
  3926. Set 1480Hz band gain.
  3927. @item 11b
  3928. Set 2093Hz band gain.
  3929. @item 12b
  3930. Set 2960Hz band gain.
  3931. @item 13b
  3932. Set 4186Hz band gain.
  3933. @item 14b
  3934. Set 5920Hz band gain.
  3935. @item 15b
  3936. Set 8372Hz band gain.
  3937. @item 16b
  3938. Set 11840Hz band gain.
  3939. @item 17b
  3940. Set 16744Hz band gain.
  3941. @item 18b
  3942. Set 20000Hz band gain.
  3943. @end table
  3944. @section surround
  3945. Apply audio surround upmix filter.
  3946. This filter allows to produce multichannel output from audio stream.
  3947. The filter accepts the following options:
  3948. @table @option
  3949. @item chl_out
  3950. Set output channel layout. By default, this is @var{5.1}.
  3951. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3952. for the required syntax.
  3953. @item chl_in
  3954. Set input channel layout. By default, this is @var{stereo}.
  3955. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3956. for the required syntax.
  3957. @item level_in
  3958. Set input volume level. By default, this is @var{1}.
  3959. @item level_out
  3960. Set output volume level. By default, this is @var{1}.
  3961. @item lfe
  3962. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3963. @item lfe_low
  3964. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3965. @item lfe_high
  3966. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3967. @item lfe_mode
  3968. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  3969. In @var{add} mode, LFE channel is created from input audio and added to output.
  3970. In @var{sub} mode, LFE channel is created from input audio and added to output but
  3971. also all non-LFE output channels are subtracted with output LFE channel.
  3972. @item angle
  3973. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  3974. Default is @var{90}.
  3975. @item fc_in
  3976. Set front center input volume. By default, this is @var{1}.
  3977. @item fc_out
  3978. Set front center output volume. By default, this is @var{1}.
  3979. @item fl_in
  3980. Set front left input volume. By default, this is @var{1}.
  3981. @item fl_out
  3982. Set front left output volume. By default, this is @var{1}.
  3983. @item fr_in
  3984. Set front right input volume. By default, this is @var{1}.
  3985. @item fr_out
  3986. Set front right output volume. By default, this is @var{1}.
  3987. @item sl_in
  3988. Set side left input volume. By default, this is @var{1}.
  3989. @item sl_out
  3990. Set side left output volume. By default, this is @var{1}.
  3991. @item sr_in
  3992. Set side right input volume. By default, this is @var{1}.
  3993. @item sr_out
  3994. Set side right output volume. By default, this is @var{1}.
  3995. @item bl_in
  3996. Set back left input volume. By default, this is @var{1}.
  3997. @item bl_out
  3998. Set back left output volume. By default, this is @var{1}.
  3999. @item br_in
  4000. Set back right input volume. By default, this is @var{1}.
  4001. @item br_out
  4002. Set back right output volume. By default, this is @var{1}.
  4003. @item bc_in
  4004. Set back center input volume. By default, this is @var{1}.
  4005. @item bc_out
  4006. Set back center output volume. By default, this is @var{1}.
  4007. @item lfe_in
  4008. Set LFE input volume. By default, this is @var{1}.
  4009. @item lfe_out
  4010. Set LFE output volume. By default, this is @var{1}.
  4011. @item allx
  4012. Set spread usage of stereo image across X axis for all channels.
  4013. @item ally
  4014. Set spread usage of stereo image across Y axis for all channels.
  4015. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4016. Set spread usage of stereo image across X axis for each channel.
  4017. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4018. Set spread usage of stereo image across Y axis for each channel.
  4019. @item win_size
  4020. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4021. @item win_func
  4022. Set window function.
  4023. It accepts the following values:
  4024. @table @samp
  4025. @item rect
  4026. @item bartlett
  4027. @item hann, hanning
  4028. @item hamming
  4029. @item blackman
  4030. @item welch
  4031. @item flattop
  4032. @item bharris
  4033. @item bnuttall
  4034. @item bhann
  4035. @item sine
  4036. @item nuttall
  4037. @item lanczos
  4038. @item gauss
  4039. @item tukey
  4040. @item dolph
  4041. @item cauchy
  4042. @item parzen
  4043. @item poisson
  4044. @item bohman
  4045. @end table
  4046. Default is @code{hann}.
  4047. @item overlap
  4048. Set window overlap. If set to 1, the recommended overlap for selected
  4049. window function will be picked. Default is @code{0.5}.
  4050. @end table
  4051. @section treble, highshelf
  4052. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4053. shelving filter with a response similar to that of a standard
  4054. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4055. The filter accepts the following options:
  4056. @table @option
  4057. @item gain, g
  4058. Give the gain at whichever is the lower of ~22 kHz and the
  4059. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4060. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4061. @item frequency, f
  4062. Set the filter's central frequency and so can be used
  4063. to extend or reduce the frequency range to be boosted or cut.
  4064. The default value is @code{3000} Hz.
  4065. @item width_type, t
  4066. Set method to specify band-width of filter.
  4067. @table @option
  4068. @item h
  4069. Hz
  4070. @item q
  4071. Q-Factor
  4072. @item o
  4073. octave
  4074. @item s
  4075. slope
  4076. @item k
  4077. kHz
  4078. @end table
  4079. @item width, w
  4080. Determine how steep is the filter's shelf transition.
  4081. @item mix, m
  4082. How much to use filtered signal in output. Default is 1.
  4083. Range is between 0 and 1.
  4084. @item channels, c
  4085. Specify which channels to filter, by default all available are filtered.
  4086. @end table
  4087. @subsection Commands
  4088. This filter supports the following commands:
  4089. @table @option
  4090. @item frequency, f
  4091. Change treble frequency.
  4092. Syntax for the command is : "@var{frequency}"
  4093. @item width_type, t
  4094. Change treble width_type.
  4095. Syntax for the command is : "@var{width_type}"
  4096. @item width, w
  4097. Change treble width.
  4098. Syntax for the command is : "@var{width}"
  4099. @item gain, g
  4100. Change treble gain.
  4101. Syntax for the command is : "@var{gain}"
  4102. @item mix, m
  4103. Change treble mix.
  4104. Syntax for the command is : "@var{mix}"
  4105. @end table
  4106. @section tremolo
  4107. Sinusoidal amplitude modulation.
  4108. The filter accepts the following options:
  4109. @table @option
  4110. @item f
  4111. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4112. (20 Hz or lower) will result in a tremolo effect.
  4113. This filter may also be used as a ring modulator by specifying
  4114. a modulation frequency higher than 20 Hz.
  4115. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4116. @item d
  4117. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4118. Default value is 0.5.
  4119. @end table
  4120. @section vibrato
  4121. Sinusoidal phase modulation.
  4122. The filter accepts the following options:
  4123. @table @option
  4124. @item f
  4125. Modulation frequency in Hertz.
  4126. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4127. @item d
  4128. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4129. Default value is 0.5.
  4130. @end table
  4131. @section volume
  4132. Adjust the input audio volume.
  4133. It accepts the following parameters:
  4134. @table @option
  4135. @item volume
  4136. Set audio volume expression.
  4137. Output values are clipped to the maximum value.
  4138. The output audio volume is given by the relation:
  4139. @example
  4140. @var{output_volume} = @var{volume} * @var{input_volume}
  4141. @end example
  4142. The default value for @var{volume} is "1.0".
  4143. @item precision
  4144. This parameter represents the mathematical precision.
  4145. It determines which input sample formats will be allowed, which affects the
  4146. precision of the volume scaling.
  4147. @table @option
  4148. @item fixed
  4149. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4150. @item float
  4151. 32-bit floating-point; this limits input sample format to FLT. (default)
  4152. @item double
  4153. 64-bit floating-point; this limits input sample format to DBL.
  4154. @end table
  4155. @item replaygain
  4156. Choose the behaviour on encountering ReplayGain side data in input frames.
  4157. @table @option
  4158. @item drop
  4159. Remove ReplayGain side data, ignoring its contents (the default).
  4160. @item ignore
  4161. Ignore ReplayGain side data, but leave it in the frame.
  4162. @item track
  4163. Prefer the track gain, if present.
  4164. @item album
  4165. Prefer the album gain, if present.
  4166. @end table
  4167. @item replaygain_preamp
  4168. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4169. Default value for @var{replaygain_preamp} is 0.0.
  4170. @item eval
  4171. Set when the volume expression is evaluated.
  4172. It accepts the following values:
  4173. @table @samp
  4174. @item once
  4175. only evaluate expression once during the filter initialization, or
  4176. when the @samp{volume} command is sent
  4177. @item frame
  4178. evaluate expression for each incoming frame
  4179. @end table
  4180. Default value is @samp{once}.
  4181. @end table
  4182. The volume expression can contain the following parameters.
  4183. @table @option
  4184. @item n
  4185. frame number (starting at zero)
  4186. @item nb_channels
  4187. number of channels
  4188. @item nb_consumed_samples
  4189. number of samples consumed by the filter
  4190. @item nb_samples
  4191. number of samples in the current frame
  4192. @item pos
  4193. original frame position in the file
  4194. @item pts
  4195. frame PTS
  4196. @item sample_rate
  4197. sample rate
  4198. @item startpts
  4199. PTS at start of stream
  4200. @item startt
  4201. time at start of stream
  4202. @item t
  4203. frame time
  4204. @item tb
  4205. timestamp timebase
  4206. @item volume
  4207. last set volume value
  4208. @end table
  4209. Note that when @option{eval} is set to @samp{once} only the
  4210. @var{sample_rate} and @var{tb} variables are available, all other
  4211. variables will evaluate to NAN.
  4212. @subsection Commands
  4213. This filter supports the following commands:
  4214. @table @option
  4215. @item volume
  4216. Modify the volume expression.
  4217. The command accepts the same syntax of the corresponding option.
  4218. If the specified expression is not valid, it is kept at its current
  4219. value.
  4220. @item replaygain_noclip
  4221. Prevent clipping by limiting the gain applied.
  4222. Default value for @var{replaygain_noclip} is 1.
  4223. @end table
  4224. @subsection Examples
  4225. @itemize
  4226. @item
  4227. Halve the input audio volume:
  4228. @example
  4229. volume=volume=0.5
  4230. volume=volume=1/2
  4231. volume=volume=-6.0206dB
  4232. @end example
  4233. In all the above example the named key for @option{volume} can be
  4234. omitted, for example like in:
  4235. @example
  4236. volume=0.5
  4237. @end example
  4238. @item
  4239. Increase input audio power by 6 decibels using fixed-point precision:
  4240. @example
  4241. volume=volume=6dB:precision=fixed
  4242. @end example
  4243. @item
  4244. Fade volume after time 10 with an annihilation period of 5 seconds:
  4245. @example
  4246. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4247. @end example
  4248. @end itemize
  4249. @section volumedetect
  4250. Detect the volume of the input video.
  4251. The filter has no parameters. The input is not modified. Statistics about
  4252. the volume will be printed in the log when the input stream end is reached.
  4253. In particular it will show the mean volume (root mean square), maximum
  4254. volume (on a per-sample basis), and the beginning of a histogram of the
  4255. registered volume values (from the maximum value to a cumulated 1/1000 of
  4256. the samples).
  4257. All volumes are in decibels relative to the maximum PCM value.
  4258. @subsection Examples
  4259. Here is an excerpt of the output:
  4260. @example
  4261. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4262. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4263. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4264. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4265. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4266. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4267. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4268. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4269. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4270. @end example
  4271. It means that:
  4272. @itemize
  4273. @item
  4274. The mean square energy is approximately -27 dB, or 10^-2.7.
  4275. @item
  4276. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4277. @item
  4278. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4279. @end itemize
  4280. In other words, raising the volume by +4 dB does not cause any clipping,
  4281. raising it by +5 dB causes clipping for 6 samples, etc.
  4282. @c man end AUDIO FILTERS
  4283. @chapter Audio Sources
  4284. @c man begin AUDIO SOURCES
  4285. Below is a description of the currently available audio sources.
  4286. @section abuffer
  4287. Buffer audio frames, and make them available to the filter chain.
  4288. This source is mainly intended for a programmatic use, in particular
  4289. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4290. It accepts the following parameters:
  4291. @table @option
  4292. @item time_base
  4293. The timebase which will be used for timestamps of submitted frames. It must be
  4294. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4295. @item sample_rate
  4296. The sample rate of the incoming audio buffers.
  4297. @item sample_fmt
  4298. The sample format of the incoming audio buffers.
  4299. Either a sample format name or its corresponding integer representation from
  4300. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4301. @item channel_layout
  4302. The channel layout of the incoming audio buffers.
  4303. Either a channel layout name from channel_layout_map in
  4304. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4305. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4306. @item channels
  4307. The number of channels of the incoming audio buffers.
  4308. If both @var{channels} and @var{channel_layout} are specified, then they
  4309. must be consistent.
  4310. @end table
  4311. @subsection Examples
  4312. @example
  4313. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4314. @end example
  4315. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4316. Since the sample format with name "s16p" corresponds to the number
  4317. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4318. equivalent to:
  4319. @example
  4320. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4321. @end example
  4322. @section aevalsrc
  4323. Generate an audio signal specified by an expression.
  4324. This source accepts in input one or more expressions (one for each
  4325. channel), which are evaluated and used to generate a corresponding
  4326. audio signal.
  4327. This source accepts the following options:
  4328. @table @option
  4329. @item exprs
  4330. Set the '|'-separated expressions list for each separate channel. In case the
  4331. @option{channel_layout} option is not specified, the selected channel layout
  4332. depends on the number of provided expressions. Otherwise the last
  4333. specified expression is applied to the remaining output channels.
  4334. @item channel_layout, c
  4335. Set the channel layout. The number of channels in the specified layout
  4336. must be equal to the number of specified expressions.
  4337. @item duration, d
  4338. Set the minimum duration of the sourced audio. See
  4339. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4340. for the accepted syntax.
  4341. Note that the resulting duration may be greater than the specified
  4342. duration, as the generated audio is always cut at the end of a
  4343. complete frame.
  4344. If not specified, or the expressed duration is negative, the audio is
  4345. supposed to be generated forever.
  4346. @item nb_samples, n
  4347. Set the number of samples per channel per each output frame,
  4348. default to 1024.
  4349. @item sample_rate, s
  4350. Specify the sample rate, default to 44100.
  4351. @end table
  4352. Each expression in @var{exprs} can contain the following constants:
  4353. @table @option
  4354. @item n
  4355. number of the evaluated sample, starting from 0
  4356. @item t
  4357. time of the evaluated sample expressed in seconds, starting from 0
  4358. @item s
  4359. sample rate
  4360. @end table
  4361. @subsection Examples
  4362. @itemize
  4363. @item
  4364. Generate silence:
  4365. @example
  4366. aevalsrc=0
  4367. @end example
  4368. @item
  4369. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4370. 8000 Hz:
  4371. @example
  4372. aevalsrc="sin(440*2*PI*t):s=8000"
  4373. @end example
  4374. @item
  4375. Generate a two channels signal, specify the channel layout (Front
  4376. Center + Back Center) explicitly:
  4377. @example
  4378. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4379. @end example
  4380. @item
  4381. Generate white noise:
  4382. @example
  4383. aevalsrc="-2+random(0)"
  4384. @end example
  4385. @item
  4386. Generate an amplitude modulated signal:
  4387. @example
  4388. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4389. @end example
  4390. @item
  4391. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4392. @example
  4393. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4394. @end example
  4395. @end itemize
  4396. @section anullsrc
  4397. The null audio source, return unprocessed audio frames. It is mainly useful
  4398. as a template and to be employed in analysis / debugging tools, or as
  4399. the source for filters which ignore the input data (for example the sox
  4400. synth filter).
  4401. This source accepts the following options:
  4402. @table @option
  4403. @item channel_layout, cl
  4404. Specifies the channel layout, and can be either an integer or a string
  4405. representing a channel layout. The default value of @var{channel_layout}
  4406. is "stereo".
  4407. Check the channel_layout_map definition in
  4408. @file{libavutil/channel_layout.c} for the mapping between strings and
  4409. channel layout values.
  4410. @item sample_rate, r
  4411. Specifies the sample rate, and defaults to 44100.
  4412. @item nb_samples, n
  4413. Set the number of samples per requested frames.
  4414. @end table
  4415. @subsection Examples
  4416. @itemize
  4417. @item
  4418. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4419. @example
  4420. anullsrc=r=48000:cl=4
  4421. @end example
  4422. @item
  4423. Do the same operation with a more obvious syntax:
  4424. @example
  4425. anullsrc=r=48000:cl=mono
  4426. @end example
  4427. @end itemize
  4428. All the parameters need to be explicitly defined.
  4429. @section flite
  4430. Synthesize a voice utterance using the libflite library.
  4431. To enable compilation of this filter you need to configure FFmpeg with
  4432. @code{--enable-libflite}.
  4433. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4434. The filter accepts the following options:
  4435. @table @option
  4436. @item list_voices
  4437. If set to 1, list the names of the available voices and exit
  4438. immediately. Default value is 0.
  4439. @item nb_samples, n
  4440. Set the maximum number of samples per frame. Default value is 512.
  4441. @item textfile
  4442. Set the filename containing the text to speak.
  4443. @item text
  4444. Set the text to speak.
  4445. @item voice, v
  4446. Set the voice to use for the speech synthesis. Default value is
  4447. @code{kal}. See also the @var{list_voices} option.
  4448. @end table
  4449. @subsection Examples
  4450. @itemize
  4451. @item
  4452. Read from file @file{speech.txt}, and synthesize the text using the
  4453. standard flite voice:
  4454. @example
  4455. flite=textfile=speech.txt
  4456. @end example
  4457. @item
  4458. Read the specified text selecting the @code{slt} voice:
  4459. @example
  4460. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4461. @end example
  4462. @item
  4463. Input text to ffmpeg:
  4464. @example
  4465. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4466. @end example
  4467. @item
  4468. Make @file{ffplay} speak the specified text, using @code{flite} and
  4469. the @code{lavfi} device:
  4470. @example
  4471. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4472. @end example
  4473. @end itemize
  4474. For more information about libflite, check:
  4475. @url{http://www.festvox.org/flite/}
  4476. @section anoisesrc
  4477. Generate a noise audio signal.
  4478. The filter accepts the following options:
  4479. @table @option
  4480. @item sample_rate, r
  4481. Specify the sample rate. Default value is 48000 Hz.
  4482. @item amplitude, a
  4483. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4484. is 1.0.
  4485. @item duration, d
  4486. Specify the duration of the generated audio stream. Not specifying this option
  4487. results in noise with an infinite length.
  4488. @item color, colour, c
  4489. Specify the color of noise. Available noise colors are white, pink, brown,
  4490. blue and violet. Default color is white.
  4491. @item seed, s
  4492. Specify a value used to seed the PRNG.
  4493. @item nb_samples, n
  4494. Set the number of samples per each output frame, default is 1024.
  4495. @end table
  4496. @subsection Examples
  4497. @itemize
  4498. @item
  4499. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4500. @example
  4501. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4502. @end example
  4503. @end itemize
  4504. @section hilbert
  4505. Generate odd-tap Hilbert transform FIR coefficients.
  4506. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4507. the signal by 90 degrees.
  4508. This is used in many matrix coding schemes and for analytic signal generation.
  4509. The process is often written as a multiplication by i (or j), the imaginary unit.
  4510. The filter accepts the following options:
  4511. @table @option
  4512. @item sample_rate, s
  4513. Set sample rate, default is 44100.
  4514. @item taps, t
  4515. Set length of FIR filter, default is 22051.
  4516. @item nb_samples, n
  4517. Set number of samples per each frame.
  4518. @item win_func, w
  4519. Set window function to be used when generating FIR coefficients.
  4520. @end table
  4521. @section sinc
  4522. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4523. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4524. The filter accepts the following options:
  4525. @table @option
  4526. @item sample_rate, r
  4527. Set sample rate, default is 44100.
  4528. @item nb_samples, n
  4529. Set number of samples per each frame. Default is 1024.
  4530. @item hp
  4531. Set high-pass frequency. Default is 0.
  4532. @item lp
  4533. Set low-pass frequency. Default is 0.
  4534. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4535. is higher than 0 then filter will create band-pass filter coefficients,
  4536. otherwise band-reject filter coefficients.
  4537. @item phase
  4538. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4539. @item beta
  4540. Set Kaiser window beta.
  4541. @item att
  4542. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4543. @item round
  4544. Enable rounding, by default is disabled.
  4545. @item hptaps
  4546. Set number of taps for high-pass filter.
  4547. @item lptaps
  4548. Set number of taps for low-pass filter.
  4549. @end table
  4550. @section sine
  4551. Generate an audio signal made of a sine wave with amplitude 1/8.
  4552. The audio signal is bit-exact.
  4553. The filter accepts the following options:
  4554. @table @option
  4555. @item frequency, f
  4556. Set the carrier frequency. Default is 440 Hz.
  4557. @item beep_factor, b
  4558. Enable a periodic beep every second with frequency @var{beep_factor} times
  4559. the carrier frequency. Default is 0, meaning the beep is disabled.
  4560. @item sample_rate, r
  4561. Specify the sample rate, default is 44100.
  4562. @item duration, d
  4563. Specify the duration of the generated audio stream.
  4564. @item samples_per_frame
  4565. Set the number of samples per output frame.
  4566. The expression can contain the following constants:
  4567. @table @option
  4568. @item n
  4569. The (sequential) number of the output audio frame, starting from 0.
  4570. @item pts
  4571. The PTS (Presentation TimeStamp) of the output audio frame,
  4572. expressed in @var{TB} units.
  4573. @item t
  4574. The PTS of the output audio frame, expressed in seconds.
  4575. @item TB
  4576. The timebase of the output audio frames.
  4577. @end table
  4578. Default is @code{1024}.
  4579. @end table
  4580. @subsection Examples
  4581. @itemize
  4582. @item
  4583. Generate a simple 440 Hz sine wave:
  4584. @example
  4585. sine
  4586. @end example
  4587. @item
  4588. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4589. @example
  4590. sine=220:4:d=5
  4591. sine=f=220:b=4:d=5
  4592. sine=frequency=220:beep_factor=4:duration=5
  4593. @end example
  4594. @item
  4595. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4596. pattern:
  4597. @example
  4598. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4599. @end example
  4600. @end itemize
  4601. @c man end AUDIO SOURCES
  4602. @chapter Audio Sinks
  4603. @c man begin AUDIO SINKS
  4604. Below is a description of the currently available audio sinks.
  4605. @section abuffersink
  4606. Buffer audio frames, and make them available to the end of filter chain.
  4607. This sink is mainly intended for programmatic use, in particular
  4608. through the interface defined in @file{libavfilter/buffersink.h}
  4609. or the options system.
  4610. It accepts a pointer to an AVABufferSinkContext structure, which
  4611. defines the incoming buffers' formats, to be passed as the opaque
  4612. parameter to @code{avfilter_init_filter} for initialization.
  4613. @section anullsink
  4614. Null audio sink; do absolutely nothing with the input audio. It is
  4615. mainly useful as a template and for use in analysis / debugging
  4616. tools.
  4617. @c man end AUDIO SINKS
  4618. @chapter Video Filters
  4619. @c man begin VIDEO FILTERS
  4620. When you configure your FFmpeg build, you can disable any of the
  4621. existing filters using @code{--disable-filters}.
  4622. The configure output will show the video filters included in your
  4623. build.
  4624. Below is a description of the currently available video filters.
  4625. @section addroi
  4626. Mark a region of interest in a video frame.
  4627. The frame data is passed through unchanged, but metadata is attached
  4628. to the frame indicating regions of interest which can affect the
  4629. behaviour of later encoding. Multiple regions can be marked by
  4630. applying the filter multiple times.
  4631. @table @option
  4632. @item x
  4633. Region distance in pixels from the left edge of the frame.
  4634. @item y
  4635. Region distance in pixels from the top edge of the frame.
  4636. @item w
  4637. Region width in pixels.
  4638. @item h
  4639. Region height in pixels.
  4640. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  4641. and may contain the following variables:
  4642. @table @option
  4643. @item iw
  4644. Width of the input frame.
  4645. @item ih
  4646. Height of the input frame.
  4647. @end table
  4648. @item qoffset
  4649. Quantisation offset to apply within the region.
  4650. This must be a real value in the range -1 to +1. A value of zero
  4651. indicates no quality change. A negative value asks for better quality
  4652. (less quantisation), while a positive value asks for worse quality
  4653. (greater quantisation).
  4654. The range is calibrated so that the extreme values indicate the
  4655. largest possible offset - if the rest of the frame is encoded with the
  4656. worst possible quality, an offset of -1 indicates that this region
  4657. should be encoded with the best possible quality anyway. Intermediate
  4658. values are then interpolated in some codec-dependent way.
  4659. For example, in 10-bit H.264 the quantisation parameter varies between
  4660. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  4661. this region should be encoded with a QP around one-tenth of the full
  4662. range better than the rest of the frame. So, if most of the frame
  4663. were to be encoded with a QP of around 30, this region would get a QP
  4664. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  4665. An extreme value of -1 would indicate that this region should be
  4666. encoded with the best possible quality regardless of the treatment of
  4667. the rest of the frame - that is, should be encoded at a QP of -12.
  4668. @item clear
  4669. If set to true, remove any existing regions of interest marked on the
  4670. frame before adding the new one.
  4671. @end table
  4672. @subsection Examples
  4673. @itemize
  4674. @item
  4675. Mark the centre quarter of the frame as interesting.
  4676. @example
  4677. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  4678. @end example
  4679. @item
  4680. Mark the 100-pixel-wide region on the left edge of the frame as very
  4681. uninteresting (to be encoded at much lower quality than the rest of
  4682. the frame).
  4683. @example
  4684. addroi=0:0:100:ih:+1/5
  4685. @end example
  4686. @end itemize
  4687. @section alphaextract
  4688. Extract the alpha component from the input as a grayscale video. This
  4689. is especially useful with the @var{alphamerge} filter.
  4690. @section alphamerge
  4691. Add or replace the alpha component of the primary input with the
  4692. grayscale value of a second input. This is intended for use with
  4693. @var{alphaextract} to allow the transmission or storage of frame
  4694. sequences that have alpha in a format that doesn't support an alpha
  4695. channel.
  4696. For example, to reconstruct full frames from a normal YUV-encoded video
  4697. and a separate video created with @var{alphaextract}, you might use:
  4698. @example
  4699. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4700. @end example
  4701. Since this filter is designed for reconstruction, it operates on frame
  4702. sequences without considering timestamps, and terminates when either
  4703. input reaches end of stream. This will cause problems if your encoding
  4704. pipeline drops frames. If you're trying to apply an image as an
  4705. overlay to a video stream, consider the @var{overlay} filter instead.
  4706. @section amplify
  4707. Amplify differences between current pixel and pixels of adjacent frames in
  4708. same pixel location.
  4709. This filter accepts the following options:
  4710. @table @option
  4711. @item radius
  4712. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4713. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4714. @item factor
  4715. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4716. @item threshold
  4717. Set threshold for difference amplification. Any difference greater or equal to
  4718. this value will not alter source pixel. Default is 10.
  4719. Allowed range is from 0 to 65535.
  4720. @item tolerance
  4721. Set tolerance for difference amplification. Any difference lower to
  4722. this value will not alter source pixel. Default is 0.
  4723. Allowed range is from 0 to 65535.
  4724. @item low
  4725. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4726. This option controls maximum possible value that will decrease source pixel value.
  4727. @item high
  4728. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4729. This option controls maximum possible value that will increase source pixel value.
  4730. @item planes
  4731. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4732. @end table
  4733. @section ass
  4734. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4735. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4736. Substation Alpha) subtitles files.
  4737. This filter accepts the following option in addition to the common options from
  4738. the @ref{subtitles} filter:
  4739. @table @option
  4740. @item shaping
  4741. Set the shaping engine
  4742. Available values are:
  4743. @table @samp
  4744. @item auto
  4745. The default libass shaping engine, which is the best available.
  4746. @item simple
  4747. Fast, font-agnostic shaper that can do only substitutions
  4748. @item complex
  4749. Slower shaper using OpenType for substitutions and positioning
  4750. @end table
  4751. The default is @code{auto}.
  4752. @end table
  4753. @section atadenoise
  4754. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4755. The filter accepts the following options:
  4756. @table @option
  4757. @item 0a
  4758. Set threshold A for 1st plane. Default is 0.02.
  4759. Valid range is 0 to 0.3.
  4760. @item 0b
  4761. Set threshold B for 1st plane. Default is 0.04.
  4762. Valid range is 0 to 5.
  4763. @item 1a
  4764. Set threshold A for 2nd plane. Default is 0.02.
  4765. Valid range is 0 to 0.3.
  4766. @item 1b
  4767. Set threshold B for 2nd plane. Default is 0.04.
  4768. Valid range is 0 to 5.
  4769. @item 2a
  4770. Set threshold A for 3rd plane. Default is 0.02.
  4771. Valid range is 0 to 0.3.
  4772. @item 2b
  4773. Set threshold B for 3rd plane. Default is 0.04.
  4774. Valid range is 0 to 5.
  4775. Threshold A is designed to react on abrupt changes in the input signal and
  4776. threshold B is designed to react on continuous changes in the input signal.
  4777. @item s
  4778. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4779. number in range [5, 129].
  4780. @item p
  4781. Set what planes of frame filter will use for averaging. Default is all.
  4782. @end table
  4783. @section avgblur
  4784. Apply average blur filter.
  4785. The filter accepts the following options:
  4786. @table @option
  4787. @item sizeX
  4788. Set horizontal radius size.
  4789. @item planes
  4790. Set which planes to filter. By default all planes are filtered.
  4791. @item sizeY
  4792. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4793. Default is @code{0}.
  4794. @end table
  4795. @subsection Commands
  4796. This filter supports same commands as options.
  4797. The command accepts the same syntax of the corresponding option.
  4798. If the specified expression is not valid, it is kept at its current
  4799. value.
  4800. @section bbox
  4801. Compute the bounding box for the non-black pixels in the input frame
  4802. luminance plane.
  4803. This filter computes the bounding box containing all the pixels with a
  4804. luminance value greater than the minimum allowed value.
  4805. The parameters describing the bounding box are printed on the filter
  4806. log.
  4807. The filter accepts the following option:
  4808. @table @option
  4809. @item min_val
  4810. Set the minimal luminance value. Default is @code{16}.
  4811. @end table
  4812. @section bitplanenoise
  4813. Show and measure bit plane noise.
  4814. The filter accepts the following options:
  4815. @table @option
  4816. @item bitplane
  4817. Set which plane to analyze. Default is @code{1}.
  4818. @item filter
  4819. Filter out noisy pixels from @code{bitplane} set above.
  4820. Default is disabled.
  4821. @end table
  4822. @section blackdetect
  4823. Detect video intervals that are (almost) completely black. Can be
  4824. useful to detect chapter transitions, commercials, or invalid
  4825. recordings. Output lines contains the time for the start, end and
  4826. duration of the detected black interval expressed in seconds.
  4827. In order to display the output lines, you need to set the loglevel at
  4828. least to the AV_LOG_INFO value.
  4829. The filter accepts the following options:
  4830. @table @option
  4831. @item black_min_duration, d
  4832. Set the minimum detected black duration expressed in seconds. It must
  4833. be a non-negative floating point number.
  4834. Default value is 2.0.
  4835. @item picture_black_ratio_th, pic_th
  4836. Set the threshold for considering a picture "black".
  4837. Express the minimum value for the ratio:
  4838. @example
  4839. @var{nb_black_pixels} / @var{nb_pixels}
  4840. @end example
  4841. for which a picture is considered black.
  4842. Default value is 0.98.
  4843. @item pixel_black_th, pix_th
  4844. Set the threshold for considering a pixel "black".
  4845. The threshold expresses the maximum pixel luminance value for which a
  4846. pixel is considered "black". The provided value is scaled according to
  4847. the following equation:
  4848. @example
  4849. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4850. @end example
  4851. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4852. the input video format, the range is [0-255] for YUV full-range
  4853. formats and [16-235] for YUV non full-range formats.
  4854. Default value is 0.10.
  4855. @end table
  4856. The following example sets the maximum pixel threshold to the minimum
  4857. value, and detects only black intervals of 2 or more seconds:
  4858. @example
  4859. blackdetect=d=2:pix_th=0.00
  4860. @end example
  4861. @section blackframe
  4862. Detect frames that are (almost) completely black. Can be useful to
  4863. detect chapter transitions or commercials. Output lines consist of
  4864. the frame number of the detected frame, the percentage of blackness,
  4865. the position in the file if known or -1 and the timestamp in seconds.
  4866. In order to display the output lines, you need to set the loglevel at
  4867. least to the AV_LOG_INFO value.
  4868. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4869. The value represents the percentage of pixels in the picture that
  4870. are below the threshold value.
  4871. It accepts the following parameters:
  4872. @table @option
  4873. @item amount
  4874. The percentage of the pixels that have to be below the threshold; it defaults to
  4875. @code{98}.
  4876. @item threshold, thresh
  4877. The threshold below which a pixel value is considered black; it defaults to
  4878. @code{32}.
  4879. @end table
  4880. @section blend, tblend
  4881. Blend two video frames into each other.
  4882. The @code{blend} filter takes two input streams and outputs one
  4883. stream, the first input is the "top" layer and second input is
  4884. "bottom" layer. By default, the output terminates when the longest input terminates.
  4885. The @code{tblend} (time blend) filter takes two consecutive frames
  4886. from one single stream, and outputs the result obtained by blending
  4887. the new frame on top of the old frame.
  4888. A description of the accepted options follows.
  4889. @table @option
  4890. @item c0_mode
  4891. @item c1_mode
  4892. @item c2_mode
  4893. @item c3_mode
  4894. @item all_mode
  4895. Set blend mode for specific pixel component or all pixel components in case
  4896. of @var{all_mode}. Default value is @code{normal}.
  4897. Available values for component modes are:
  4898. @table @samp
  4899. @item addition
  4900. @item grainmerge
  4901. @item and
  4902. @item average
  4903. @item burn
  4904. @item darken
  4905. @item difference
  4906. @item grainextract
  4907. @item divide
  4908. @item dodge
  4909. @item freeze
  4910. @item exclusion
  4911. @item extremity
  4912. @item glow
  4913. @item hardlight
  4914. @item hardmix
  4915. @item heat
  4916. @item lighten
  4917. @item linearlight
  4918. @item multiply
  4919. @item multiply128
  4920. @item negation
  4921. @item normal
  4922. @item or
  4923. @item overlay
  4924. @item phoenix
  4925. @item pinlight
  4926. @item reflect
  4927. @item screen
  4928. @item softlight
  4929. @item subtract
  4930. @item vividlight
  4931. @item xor
  4932. @end table
  4933. @item c0_opacity
  4934. @item c1_opacity
  4935. @item c2_opacity
  4936. @item c3_opacity
  4937. @item all_opacity
  4938. Set blend opacity for specific pixel component or all pixel components in case
  4939. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4940. @item c0_expr
  4941. @item c1_expr
  4942. @item c2_expr
  4943. @item c3_expr
  4944. @item all_expr
  4945. Set blend expression for specific pixel component or all pixel components in case
  4946. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4947. The expressions can use the following variables:
  4948. @table @option
  4949. @item N
  4950. The sequential number of the filtered frame, starting from @code{0}.
  4951. @item X
  4952. @item Y
  4953. the coordinates of the current sample
  4954. @item W
  4955. @item H
  4956. the width and height of currently filtered plane
  4957. @item SW
  4958. @item SH
  4959. Width and height scale for the plane being filtered. It is the
  4960. ratio between the dimensions of the current plane to the luma plane,
  4961. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4962. the luma plane and @code{0.5,0.5} for the chroma planes.
  4963. @item T
  4964. Time of the current frame, expressed in seconds.
  4965. @item TOP, A
  4966. Value of pixel component at current location for first video frame (top layer).
  4967. @item BOTTOM, B
  4968. Value of pixel component at current location for second video frame (bottom layer).
  4969. @end table
  4970. @end table
  4971. The @code{blend} filter also supports the @ref{framesync} options.
  4972. @subsection Examples
  4973. @itemize
  4974. @item
  4975. Apply transition from bottom layer to top layer in first 10 seconds:
  4976. @example
  4977. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4978. @end example
  4979. @item
  4980. Apply linear horizontal transition from top layer to bottom layer:
  4981. @example
  4982. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4983. @end example
  4984. @item
  4985. Apply 1x1 checkerboard effect:
  4986. @example
  4987. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4988. @end example
  4989. @item
  4990. Apply uncover left effect:
  4991. @example
  4992. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4993. @end example
  4994. @item
  4995. Apply uncover down effect:
  4996. @example
  4997. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4998. @end example
  4999. @item
  5000. Apply uncover up-left effect:
  5001. @example
  5002. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5003. @end example
  5004. @item
  5005. Split diagonally video and shows top and bottom layer on each side:
  5006. @example
  5007. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5008. @end example
  5009. @item
  5010. Display differences between the current and the previous frame:
  5011. @example
  5012. tblend=all_mode=grainextract
  5013. @end example
  5014. @end itemize
  5015. @section bm3d
  5016. Denoise frames using Block-Matching 3D algorithm.
  5017. The filter accepts the following options.
  5018. @table @option
  5019. @item sigma
  5020. Set denoising strength. Default value is 1.
  5021. Allowed range is from 0 to 999.9.
  5022. The denoising algorithm is very sensitive to sigma, so adjust it
  5023. according to the source.
  5024. @item block
  5025. Set local patch size. This sets dimensions in 2D.
  5026. @item bstep
  5027. Set sliding step for processing blocks. Default value is 4.
  5028. Allowed range is from 1 to 64.
  5029. Smaller values allows processing more reference blocks and is slower.
  5030. @item group
  5031. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5032. When set to 1, no block matching is done. Larger values allows more blocks
  5033. in single group.
  5034. Allowed range is from 1 to 256.
  5035. @item range
  5036. Set radius for search block matching. Default is 9.
  5037. Allowed range is from 1 to INT32_MAX.
  5038. @item mstep
  5039. Set step between two search locations for block matching. Default is 1.
  5040. Allowed range is from 1 to 64. Smaller is slower.
  5041. @item thmse
  5042. Set threshold of mean square error for block matching. Valid range is 0 to
  5043. INT32_MAX.
  5044. @item hdthr
  5045. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5046. Larger values results in stronger hard-thresholding filtering in frequency
  5047. domain.
  5048. @item estim
  5049. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5050. Default is @code{basic}.
  5051. @item ref
  5052. If enabled, filter will use 2nd stream for block matching.
  5053. Default is disabled for @code{basic} value of @var{estim} option,
  5054. and always enabled if value of @var{estim} is @code{final}.
  5055. @item planes
  5056. Set planes to filter. Default is all available except alpha.
  5057. @end table
  5058. @subsection Examples
  5059. @itemize
  5060. @item
  5061. Basic filtering with bm3d:
  5062. @example
  5063. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5064. @end example
  5065. @item
  5066. Same as above, but filtering only luma:
  5067. @example
  5068. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5069. @end example
  5070. @item
  5071. Same as above, but with both estimation modes:
  5072. @example
  5073. 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
  5074. @end example
  5075. @item
  5076. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5077. @example
  5078. 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
  5079. @end example
  5080. @end itemize
  5081. @section boxblur
  5082. Apply a boxblur algorithm to the input video.
  5083. It accepts the following parameters:
  5084. @table @option
  5085. @item luma_radius, lr
  5086. @item luma_power, lp
  5087. @item chroma_radius, cr
  5088. @item chroma_power, cp
  5089. @item alpha_radius, ar
  5090. @item alpha_power, ap
  5091. @end table
  5092. A description of the accepted options follows.
  5093. @table @option
  5094. @item luma_radius, lr
  5095. @item chroma_radius, cr
  5096. @item alpha_radius, ar
  5097. Set an expression for the box radius in pixels used for blurring the
  5098. corresponding input plane.
  5099. The radius value must be a non-negative number, and must not be
  5100. greater than the value of the expression @code{min(w,h)/2} for the
  5101. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5102. planes.
  5103. Default value for @option{luma_radius} is "2". If not specified,
  5104. @option{chroma_radius} and @option{alpha_radius} default to the
  5105. corresponding value set for @option{luma_radius}.
  5106. The expressions can contain the following constants:
  5107. @table @option
  5108. @item w
  5109. @item h
  5110. The input width and height in pixels.
  5111. @item cw
  5112. @item ch
  5113. The input chroma image width and height in pixels.
  5114. @item hsub
  5115. @item vsub
  5116. The horizontal and vertical chroma subsample values. For example, for the
  5117. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5118. @end table
  5119. @item luma_power, lp
  5120. @item chroma_power, cp
  5121. @item alpha_power, ap
  5122. Specify how many times the boxblur filter is applied to the
  5123. corresponding plane.
  5124. Default value for @option{luma_power} is 2. If not specified,
  5125. @option{chroma_power} and @option{alpha_power} default to the
  5126. corresponding value set for @option{luma_power}.
  5127. A value of 0 will disable the effect.
  5128. @end table
  5129. @subsection Examples
  5130. @itemize
  5131. @item
  5132. Apply a boxblur filter with the luma, chroma, and alpha radii
  5133. set to 2:
  5134. @example
  5135. boxblur=luma_radius=2:luma_power=1
  5136. boxblur=2:1
  5137. @end example
  5138. @item
  5139. Set the luma radius to 2, and alpha and chroma radius to 0:
  5140. @example
  5141. boxblur=2:1:cr=0:ar=0
  5142. @end example
  5143. @item
  5144. Set the luma and chroma radii to a fraction of the video dimension:
  5145. @example
  5146. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5147. @end example
  5148. @end itemize
  5149. @section bwdif
  5150. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5151. Deinterlacing Filter").
  5152. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5153. interpolation algorithms.
  5154. It accepts the following parameters:
  5155. @table @option
  5156. @item mode
  5157. The interlacing mode to adopt. It accepts one of the following values:
  5158. @table @option
  5159. @item 0, send_frame
  5160. Output one frame for each frame.
  5161. @item 1, send_field
  5162. Output one frame for each field.
  5163. @end table
  5164. The default value is @code{send_field}.
  5165. @item parity
  5166. The picture field parity assumed for the input interlaced video. It accepts one
  5167. of the following values:
  5168. @table @option
  5169. @item 0, tff
  5170. Assume the top field is first.
  5171. @item 1, bff
  5172. Assume the bottom field is first.
  5173. @item -1, auto
  5174. Enable automatic detection of field parity.
  5175. @end table
  5176. The default value is @code{auto}.
  5177. If the interlacing is unknown or the decoder does not export this information,
  5178. top field first will be assumed.
  5179. @item deint
  5180. Specify which frames to deinterlace. Accepts one of the following
  5181. values:
  5182. @table @option
  5183. @item 0, all
  5184. Deinterlace all frames.
  5185. @item 1, interlaced
  5186. Only deinterlace frames marked as interlaced.
  5187. @end table
  5188. The default value is @code{all}.
  5189. @end table
  5190. @section chromahold
  5191. Remove all color information for all colors except for certain one.
  5192. The filter accepts the following options:
  5193. @table @option
  5194. @item color
  5195. The color which will not be replaced with neutral chroma.
  5196. @item similarity
  5197. Similarity percentage with the above color.
  5198. 0.01 matches only the exact key color, while 1.0 matches everything.
  5199. @item blend
  5200. Blend percentage.
  5201. 0.0 makes pixels either fully gray, or not gray at all.
  5202. Higher values result in more preserved color.
  5203. @item yuv
  5204. Signals that the color passed is already in YUV instead of RGB.
  5205. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5206. This can be used to pass exact YUV values as hexadecimal numbers.
  5207. @end table
  5208. @section chromakey
  5209. YUV colorspace color/chroma keying.
  5210. The filter accepts the following options:
  5211. @table @option
  5212. @item color
  5213. The color which will be replaced with transparency.
  5214. @item similarity
  5215. Similarity percentage with the key color.
  5216. 0.01 matches only the exact key color, while 1.0 matches everything.
  5217. @item blend
  5218. Blend percentage.
  5219. 0.0 makes pixels either fully transparent, or not transparent at all.
  5220. Higher values result in semi-transparent pixels, with a higher transparency
  5221. the more similar the pixels color is to the key color.
  5222. @item yuv
  5223. Signals that the color passed is already in YUV instead of RGB.
  5224. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5225. This can be used to pass exact YUV values as hexadecimal numbers.
  5226. @end table
  5227. @subsection Examples
  5228. @itemize
  5229. @item
  5230. Make every green pixel in the input image transparent:
  5231. @example
  5232. ffmpeg -i input.png -vf chromakey=green out.png
  5233. @end example
  5234. @item
  5235. Overlay a greenscreen-video on top of a static black background.
  5236. @example
  5237. 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
  5238. @end example
  5239. @end itemize
  5240. @section chromashift
  5241. Shift chroma pixels horizontally and/or vertically.
  5242. The filter accepts the following options:
  5243. @table @option
  5244. @item cbh
  5245. Set amount to shift chroma-blue horizontally.
  5246. @item cbv
  5247. Set amount to shift chroma-blue vertically.
  5248. @item crh
  5249. Set amount to shift chroma-red horizontally.
  5250. @item crv
  5251. Set amount to shift chroma-red vertically.
  5252. @item edge
  5253. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5254. @end table
  5255. @section ciescope
  5256. Display CIE color diagram with pixels overlaid onto it.
  5257. The filter accepts the following options:
  5258. @table @option
  5259. @item system
  5260. Set color system.
  5261. @table @samp
  5262. @item ntsc, 470m
  5263. @item ebu, 470bg
  5264. @item smpte
  5265. @item 240m
  5266. @item apple
  5267. @item widergb
  5268. @item cie1931
  5269. @item rec709, hdtv
  5270. @item uhdtv, rec2020
  5271. @item dcip3
  5272. @end table
  5273. @item cie
  5274. Set CIE system.
  5275. @table @samp
  5276. @item xyy
  5277. @item ucs
  5278. @item luv
  5279. @end table
  5280. @item gamuts
  5281. Set what gamuts to draw.
  5282. See @code{system} option for available values.
  5283. @item size, s
  5284. Set ciescope size, by default set to 512.
  5285. @item intensity, i
  5286. Set intensity used to map input pixel values to CIE diagram.
  5287. @item contrast
  5288. Set contrast used to draw tongue colors that are out of active color system gamut.
  5289. @item corrgamma
  5290. Correct gamma displayed on scope, by default enabled.
  5291. @item showwhite
  5292. Show white point on CIE diagram, by default disabled.
  5293. @item gamma
  5294. Set input gamma. Used only with XYZ input color space.
  5295. @end table
  5296. @section codecview
  5297. Visualize information exported by some codecs.
  5298. Some codecs can export information through frames using side-data or other
  5299. means. For example, some MPEG based codecs export motion vectors through the
  5300. @var{export_mvs} flag in the codec @option{flags2} option.
  5301. The filter accepts the following option:
  5302. @table @option
  5303. @item mv
  5304. Set motion vectors to visualize.
  5305. Available flags for @var{mv} are:
  5306. @table @samp
  5307. @item pf
  5308. forward predicted MVs of P-frames
  5309. @item bf
  5310. forward predicted MVs of B-frames
  5311. @item bb
  5312. backward predicted MVs of B-frames
  5313. @end table
  5314. @item qp
  5315. Display quantization parameters using the chroma planes.
  5316. @item mv_type, mvt
  5317. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5318. Available flags for @var{mv_type} are:
  5319. @table @samp
  5320. @item fp
  5321. forward predicted MVs
  5322. @item bp
  5323. backward predicted MVs
  5324. @end table
  5325. @item frame_type, ft
  5326. Set frame type to visualize motion vectors of.
  5327. Available flags for @var{frame_type} are:
  5328. @table @samp
  5329. @item if
  5330. intra-coded frames (I-frames)
  5331. @item pf
  5332. predicted frames (P-frames)
  5333. @item bf
  5334. bi-directionally predicted frames (B-frames)
  5335. @end table
  5336. @end table
  5337. @subsection Examples
  5338. @itemize
  5339. @item
  5340. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5341. @example
  5342. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5343. @end example
  5344. @item
  5345. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5346. @example
  5347. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5348. @end example
  5349. @end itemize
  5350. @section colorbalance
  5351. Modify intensity of primary colors (red, green and blue) of input frames.
  5352. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5353. regions for the red-cyan, green-magenta or blue-yellow balance.
  5354. A positive adjustment value shifts the balance towards the primary color, a negative
  5355. value towards the complementary color.
  5356. The filter accepts the following options:
  5357. @table @option
  5358. @item rs
  5359. @item gs
  5360. @item bs
  5361. Adjust red, green and blue shadows (darkest pixels).
  5362. @item rm
  5363. @item gm
  5364. @item bm
  5365. Adjust red, green and blue midtones (medium pixels).
  5366. @item rh
  5367. @item gh
  5368. @item bh
  5369. Adjust red, green and blue highlights (brightest pixels).
  5370. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5371. @end table
  5372. @subsection Examples
  5373. @itemize
  5374. @item
  5375. Add red color cast to shadows:
  5376. @example
  5377. colorbalance=rs=.3
  5378. @end example
  5379. @end itemize
  5380. @section colorchannelmixer
  5381. Adjust video input frames by re-mixing color channels.
  5382. This filter modifies a color channel by adding the values associated to
  5383. the other channels of the same pixels. For example if the value to
  5384. modify is red, the output value will be:
  5385. @example
  5386. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5387. @end example
  5388. The filter accepts the following options:
  5389. @table @option
  5390. @item rr
  5391. @item rg
  5392. @item rb
  5393. @item ra
  5394. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5395. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5396. @item gr
  5397. @item gg
  5398. @item gb
  5399. @item ga
  5400. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5401. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5402. @item br
  5403. @item bg
  5404. @item bb
  5405. @item ba
  5406. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5407. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5408. @item ar
  5409. @item ag
  5410. @item ab
  5411. @item aa
  5412. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5413. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5414. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5415. @end table
  5416. @subsection Examples
  5417. @itemize
  5418. @item
  5419. Convert source to grayscale:
  5420. @example
  5421. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5422. @end example
  5423. @item
  5424. Simulate sepia tones:
  5425. @example
  5426. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5427. @end example
  5428. @end itemize
  5429. @section colorkey
  5430. RGB colorspace color keying.
  5431. The filter accepts the following options:
  5432. @table @option
  5433. @item color
  5434. The color which will be replaced with transparency.
  5435. @item similarity
  5436. Similarity percentage with the key color.
  5437. 0.01 matches only the exact key color, while 1.0 matches everything.
  5438. @item blend
  5439. Blend percentage.
  5440. 0.0 makes pixels either fully transparent, or not transparent at all.
  5441. Higher values result in semi-transparent pixels, with a higher transparency
  5442. the more similar the pixels color is to the key color.
  5443. @end table
  5444. @subsection Examples
  5445. @itemize
  5446. @item
  5447. Make every green pixel in the input image transparent:
  5448. @example
  5449. ffmpeg -i input.png -vf colorkey=green out.png
  5450. @end example
  5451. @item
  5452. Overlay a greenscreen-video on top of a static background image.
  5453. @example
  5454. 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
  5455. @end example
  5456. @end itemize
  5457. @section colorhold
  5458. Remove all color information for all RGB colors except for certain one.
  5459. The filter accepts the following options:
  5460. @table @option
  5461. @item color
  5462. The color which will not be replaced with neutral gray.
  5463. @item similarity
  5464. Similarity percentage with the above color.
  5465. 0.01 matches only the exact key color, while 1.0 matches everything.
  5466. @item blend
  5467. Blend percentage. 0.0 makes pixels fully gray.
  5468. Higher values result in more preserved color.
  5469. @end table
  5470. @section colorlevels
  5471. Adjust video input frames using levels.
  5472. The filter accepts the following options:
  5473. @table @option
  5474. @item rimin
  5475. @item gimin
  5476. @item bimin
  5477. @item aimin
  5478. Adjust red, green, blue and alpha input black point.
  5479. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5480. @item rimax
  5481. @item gimax
  5482. @item bimax
  5483. @item aimax
  5484. Adjust red, green, blue and alpha input white point.
  5485. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5486. Input levels are used to lighten highlights (bright tones), darken shadows
  5487. (dark tones), change the balance of bright and dark tones.
  5488. @item romin
  5489. @item gomin
  5490. @item bomin
  5491. @item aomin
  5492. Adjust red, green, blue and alpha output black point.
  5493. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5494. @item romax
  5495. @item gomax
  5496. @item bomax
  5497. @item aomax
  5498. Adjust red, green, blue and alpha output white point.
  5499. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5500. Output levels allows manual selection of a constrained output level range.
  5501. @end table
  5502. @subsection Examples
  5503. @itemize
  5504. @item
  5505. Make video output darker:
  5506. @example
  5507. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5508. @end example
  5509. @item
  5510. Increase contrast:
  5511. @example
  5512. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5513. @end example
  5514. @item
  5515. Make video output lighter:
  5516. @example
  5517. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5518. @end example
  5519. @item
  5520. Increase brightness:
  5521. @example
  5522. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5523. @end example
  5524. @end itemize
  5525. @section colormatrix
  5526. Convert color matrix.
  5527. The filter accepts the following options:
  5528. @table @option
  5529. @item src
  5530. @item dst
  5531. Specify the source and destination color matrix. Both values must be
  5532. specified.
  5533. The accepted values are:
  5534. @table @samp
  5535. @item bt709
  5536. BT.709
  5537. @item fcc
  5538. FCC
  5539. @item bt601
  5540. BT.601
  5541. @item bt470
  5542. BT.470
  5543. @item bt470bg
  5544. BT.470BG
  5545. @item smpte170m
  5546. SMPTE-170M
  5547. @item smpte240m
  5548. SMPTE-240M
  5549. @item bt2020
  5550. BT.2020
  5551. @end table
  5552. @end table
  5553. For example to convert from BT.601 to SMPTE-240M, use the command:
  5554. @example
  5555. colormatrix=bt601:smpte240m
  5556. @end example
  5557. @section colorspace
  5558. Convert colorspace, transfer characteristics or color primaries.
  5559. Input video needs to have an even size.
  5560. The filter accepts the following options:
  5561. @table @option
  5562. @anchor{all}
  5563. @item all
  5564. Specify all color properties at once.
  5565. The accepted values are:
  5566. @table @samp
  5567. @item bt470m
  5568. BT.470M
  5569. @item bt470bg
  5570. BT.470BG
  5571. @item bt601-6-525
  5572. BT.601-6 525
  5573. @item bt601-6-625
  5574. BT.601-6 625
  5575. @item bt709
  5576. BT.709
  5577. @item smpte170m
  5578. SMPTE-170M
  5579. @item smpte240m
  5580. SMPTE-240M
  5581. @item bt2020
  5582. BT.2020
  5583. @end table
  5584. @anchor{space}
  5585. @item space
  5586. Specify output colorspace.
  5587. The accepted values are:
  5588. @table @samp
  5589. @item bt709
  5590. BT.709
  5591. @item fcc
  5592. FCC
  5593. @item bt470bg
  5594. BT.470BG or BT.601-6 625
  5595. @item smpte170m
  5596. SMPTE-170M or BT.601-6 525
  5597. @item smpte240m
  5598. SMPTE-240M
  5599. @item ycgco
  5600. YCgCo
  5601. @item bt2020ncl
  5602. BT.2020 with non-constant luminance
  5603. @end table
  5604. @anchor{trc}
  5605. @item trc
  5606. Specify output transfer characteristics.
  5607. The accepted values are:
  5608. @table @samp
  5609. @item bt709
  5610. BT.709
  5611. @item bt470m
  5612. BT.470M
  5613. @item bt470bg
  5614. BT.470BG
  5615. @item gamma22
  5616. Constant gamma of 2.2
  5617. @item gamma28
  5618. Constant gamma of 2.8
  5619. @item smpte170m
  5620. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5621. @item smpte240m
  5622. SMPTE-240M
  5623. @item srgb
  5624. SRGB
  5625. @item iec61966-2-1
  5626. iec61966-2-1
  5627. @item iec61966-2-4
  5628. iec61966-2-4
  5629. @item xvycc
  5630. xvycc
  5631. @item bt2020-10
  5632. BT.2020 for 10-bits content
  5633. @item bt2020-12
  5634. BT.2020 for 12-bits content
  5635. @end table
  5636. @anchor{primaries}
  5637. @item primaries
  5638. Specify output color primaries.
  5639. The accepted values are:
  5640. @table @samp
  5641. @item bt709
  5642. BT.709
  5643. @item bt470m
  5644. BT.470M
  5645. @item bt470bg
  5646. BT.470BG or BT.601-6 625
  5647. @item smpte170m
  5648. SMPTE-170M or BT.601-6 525
  5649. @item smpte240m
  5650. SMPTE-240M
  5651. @item film
  5652. film
  5653. @item smpte431
  5654. SMPTE-431
  5655. @item smpte432
  5656. SMPTE-432
  5657. @item bt2020
  5658. BT.2020
  5659. @item jedec-p22
  5660. JEDEC P22 phosphors
  5661. @end table
  5662. @anchor{range}
  5663. @item range
  5664. Specify output color range.
  5665. The accepted values are:
  5666. @table @samp
  5667. @item tv
  5668. TV (restricted) range
  5669. @item mpeg
  5670. MPEG (restricted) range
  5671. @item pc
  5672. PC (full) range
  5673. @item jpeg
  5674. JPEG (full) range
  5675. @end table
  5676. @item format
  5677. Specify output color format.
  5678. The accepted values are:
  5679. @table @samp
  5680. @item yuv420p
  5681. YUV 4:2:0 planar 8-bits
  5682. @item yuv420p10
  5683. YUV 4:2:0 planar 10-bits
  5684. @item yuv420p12
  5685. YUV 4:2:0 planar 12-bits
  5686. @item yuv422p
  5687. YUV 4:2:2 planar 8-bits
  5688. @item yuv422p10
  5689. YUV 4:2:2 planar 10-bits
  5690. @item yuv422p12
  5691. YUV 4:2:2 planar 12-bits
  5692. @item yuv444p
  5693. YUV 4:4:4 planar 8-bits
  5694. @item yuv444p10
  5695. YUV 4:4:4 planar 10-bits
  5696. @item yuv444p12
  5697. YUV 4:4:4 planar 12-bits
  5698. @end table
  5699. @item fast
  5700. Do a fast conversion, which skips gamma/primary correction. This will take
  5701. significantly less CPU, but will be mathematically incorrect. To get output
  5702. compatible with that produced by the colormatrix filter, use fast=1.
  5703. @item dither
  5704. Specify dithering mode.
  5705. The accepted values are:
  5706. @table @samp
  5707. @item none
  5708. No dithering
  5709. @item fsb
  5710. Floyd-Steinberg dithering
  5711. @end table
  5712. @item wpadapt
  5713. Whitepoint adaptation mode.
  5714. The accepted values are:
  5715. @table @samp
  5716. @item bradford
  5717. Bradford whitepoint adaptation
  5718. @item vonkries
  5719. von Kries whitepoint adaptation
  5720. @item identity
  5721. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5722. @end table
  5723. @item iall
  5724. Override all input properties at once. Same accepted values as @ref{all}.
  5725. @item ispace
  5726. Override input colorspace. Same accepted values as @ref{space}.
  5727. @item iprimaries
  5728. Override input color primaries. Same accepted values as @ref{primaries}.
  5729. @item itrc
  5730. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5731. @item irange
  5732. Override input color range. Same accepted values as @ref{range}.
  5733. @end table
  5734. The filter converts the transfer characteristics, color space and color
  5735. primaries to the specified user values. The output value, if not specified,
  5736. is set to a default value based on the "all" property. If that property is
  5737. also not specified, the filter will log an error. The output color range and
  5738. format default to the same value as the input color range and format. The
  5739. input transfer characteristics, color space, color primaries and color range
  5740. should be set on the input data. If any of these are missing, the filter will
  5741. log an error and no conversion will take place.
  5742. For example to convert the input to SMPTE-240M, use the command:
  5743. @example
  5744. colorspace=smpte240m
  5745. @end example
  5746. @section convolution
  5747. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5748. The filter accepts the following options:
  5749. @table @option
  5750. @item 0m
  5751. @item 1m
  5752. @item 2m
  5753. @item 3m
  5754. Set matrix for each plane.
  5755. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5756. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5757. @item 0rdiv
  5758. @item 1rdiv
  5759. @item 2rdiv
  5760. @item 3rdiv
  5761. Set multiplier for calculated value for each plane.
  5762. If unset or 0, it will be sum of all matrix elements.
  5763. @item 0bias
  5764. @item 1bias
  5765. @item 2bias
  5766. @item 3bias
  5767. Set bias for each plane. This value is added to the result of the multiplication.
  5768. Useful for making the overall image brighter or darker. Default is 0.0.
  5769. @item 0mode
  5770. @item 1mode
  5771. @item 2mode
  5772. @item 3mode
  5773. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5774. Default is @var{square}.
  5775. @end table
  5776. @subsection Examples
  5777. @itemize
  5778. @item
  5779. Apply sharpen:
  5780. @example
  5781. 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"
  5782. @end example
  5783. @item
  5784. Apply blur:
  5785. @example
  5786. 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"
  5787. @end example
  5788. @item
  5789. Apply edge enhance:
  5790. @example
  5791. 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"
  5792. @end example
  5793. @item
  5794. Apply edge detect:
  5795. @example
  5796. 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"
  5797. @end example
  5798. @item
  5799. Apply laplacian edge detector which includes diagonals:
  5800. @example
  5801. 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"
  5802. @end example
  5803. @item
  5804. Apply emboss:
  5805. @example
  5806. 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"
  5807. @end example
  5808. @end itemize
  5809. @section convolve
  5810. Apply 2D convolution of video stream in frequency domain using second stream
  5811. as impulse.
  5812. The filter accepts the following options:
  5813. @table @option
  5814. @item planes
  5815. Set which planes to process.
  5816. @item impulse
  5817. Set which impulse video frames will be processed, can be @var{first}
  5818. or @var{all}. Default is @var{all}.
  5819. @end table
  5820. The @code{convolve} filter also supports the @ref{framesync} options.
  5821. @section copy
  5822. Copy the input video source unchanged to the output. This is mainly useful for
  5823. testing purposes.
  5824. @anchor{coreimage}
  5825. @section coreimage
  5826. Video filtering on GPU using Apple's CoreImage API on OSX.
  5827. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5828. processed by video hardware. However, software-based OpenGL implementations
  5829. exist which means there is no guarantee for hardware processing. It depends on
  5830. the respective OSX.
  5831. There are many filters and image generators provided by Apple that come with a
  5832. large variety of options. The filter has to be referenced by its name along
  5833. with its options.
  5834. The coreimage filter accepts the following options:
  5835. @table @option
  5836. @item list_filters
  5837. List all available filters and generators along with all their respective
  5838. options as well as possible minimum and maximum values along with the default
  5839. values.
  5840. @example
  5841. list_filters=true
  5842. @end example
  5843. @item filter
  5844. Specify all filters by their respective name and options.
  5845. Use @var{list_filters} to determine all valid filter names and options.
  5846. Numerical options are specified by a float value and are automatically clamped
  5847. to their respective value range. Vector and color options have to be specified
  5848. by a list of space separated float values. Character escaping has to be done.
  5849. A special option name @code{default} is available to use default options for a
  5850. filter.
  5851. It is required to specify either @code{default} or at least one of the filter options.
  5852. All omitted options are used with their default values.
  5853. The syntax of the filter string is as follows:
  5854. @example
  5855. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5856. @end example
  5857. @item output_rect
  5858. Specify a rectangle where the output of the filter chain is copied into the
  5859. input image. It is given by a list of space separated float values:
  5860. @example
  5861. output_rect=x\ y\ width\ height
  5862. @end example
  5863. If not given, the output rectangle equals the dimensions of the input image.
  5864. The output rectangle is automatically cropped at the borders of the input
  5865. image. Negative values are valid for each component.
  5866. @example
  5867. output_rect=25\ 25\ 100\ 100
  5868. @end example
  5869. @end table
  5870. Several filters can be chained for successive processing without GPU-HOST
  5871. transfers allowing for fast processing of complex filter chains.
  5872. Currently, only filters with zero (generators) or exactly one (filters) input
  5873. image and one output image are supported. Also, transition filters are not yet
  5874. usable as intended.
  5875. Some filters generate output images with additional padding depending on the
  5876. respective filter kernel. The padding is automatically removed to ensure the
  5877. filter output has the same size as the input image.
  5878. For image generators, the size of the output image is determined by the
  5879. previous output image of the filter chain or the input image of the whole
  5880. filterchain, respectively. The generators do not use the pixel information of
  5881. this image to generate their output. However, the generated output is
  5882. blended onto this image, resulting in partial or complete coverage of the
  5883. output image.
  5884. The @ref{coreimagesrc} video source can be used for generating input images
  5885. which are directly fed into the filter chain. By using it, providing input
  5886. images by another video source or an input video is not required.
  5887. @subsection Examples
  5888. @itemize
  5889. @item
  5890. List all filters available:
  5891. @example
  5892. coreimage=list_filters=true
  5893. @end example
  5894. @item
  5895. Use the CIBoxBlur filter with default options to blur an image:
  5896. @example
  5897. coreimage=filter=CIBoxBlur@@default
  5898. @end example
  5899. @item
  5900. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5901. its center at 100x100 and a radius of 50 pixels:
  5902. @example
  5903. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5904. @end example
  5905. @item
  5906. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5907. given as complete and escaped command-line for Apple's standard bash shell:
  5908. @example
  5909. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5910. @end example
  5911. @end itemize
  5912. @section cover_rect
  5913. Cover a rectangular object
  5914. It accepts the following options:
  5915. @table @option
  5916. @item cover
  5917. Filepath of the optional cover image, needs to be in yuv420.
  5918. @item mode
  5919. Set covering mode.
  5920. It accepts the following values:
  5921. @table @samp
  5922. @item cover
  5923. cover it by the supplied image
  5924. @item blur
  5925. cover it by interpolating the surrounding pixels
  5926. @end table
  5927. Default value is @var{blur}.
  5928. @end table
  5929. @subsection Examples
  5930. @itemize
  5931. @item
  5932. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  5933. @example
  5934. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  5935. @end example
  5936. @end itemize
  5937. @section crop
  5938. Crop the input video to given dimensions.
  5939. It accepts the following parameters:
  5940. @table @option
  5941. @item w, out_w
  5942. The width of the output video. It defaults to @code{iw}.
  5943. This expression is evaluated only once during the filter
  5944. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5945. @item h, out_h
  5946. The height of the output video. It defaults to @code{ih}.
  5947. This expression is evaluated only once during the filter
  5948. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5949. @item x
  5950. The horizontal position, in the input video, of the left edge of the output
  5951. video. It defaults to @code{(in_w-out_w)/2}.
  5952. This expression is evaluated per-frame.
  5953. @item y
  5954. The vertical position, in the input video, of the top edge of the output video.
  5955. It defaults to @code{(in_h-out_h)/2}.
  5956. This expression is evaluated per-frame.
  5957. @item keep_aspect
  5958. If set to 1 will force the output display aspect ratio
  5959. to be the same of the input, by changing the output sample aspect
  5960. ratio. It defaults to 0.
  5961. @item exact
  5962. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5963. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5964. It defaults to 0.
  5965. @end table
  5966. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5967. expressions containing the following constants:
  5968. @table @option
  5969. @item x
  5970. @item y
  5971. The computed values for @var{x} and @var{y}. They are evaluated for
  5972. each new frame.
  5973. @item in_w
  5974. @item in_h
  5975. The input width and height.
  5976. @item iw
  5977. @item ih
  5978. These are the same as @var{in_w} and @var{in_h}.
  5979. @item out_w
  5980. @item out_h
  5981. The output (cropped) width and height.
  5982. @item ow
  5983. @item oh
  5984. These are the same as @var{out_w} and @var{out_h}.
  5985. @item a
  5986. same as @var{iw} / @var{ih}
  5987. @item sar
  5988. input sample aspect ratio
  5989. @item dar
  5990. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5991. @item hsub
  5992. @item vsub
  5993. horizontal and vertical chroma subsample values. For example for the
  5994. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5995. @item n
  5996. The number of the input frame, starting from 0.
  5997. @item pos
  5998. the position in the file of the input frame, NAN if unknown
  5999. @item t
  6000. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6001. @end table
  6002. The expression for @var{out_w} may depend on the value of @var{out_h},
  6003. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6004. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6005. evaluated after @var{out_w} and @var{out_h}.
  6006. The @var{x} and @var{y} parameters specify the expressions for the
  6007. position of the top-left corner of the output (non-cropped) area. They
  6008. are evaluated for each frame. If the evaluated value is not valid, it
  6009. is approximated to the nearest valid value.
  6010. The expression for @var{x} may depend on @var{y}, and the expression
  6011. for @var{y} may depend on @var{x}.
  6012. @subsection Examples
  6013. @itemize
  6014. @item
  6015. Crop area with size 100x100 at position (12,34).
  6016. @example
  6017. crop=100:100:12:34
  6018. @end example
  6019. Using named options, the example above becomes:
  6020. @example
  6021. crop=w=100:h=100:x=12:y=34
  6022. @end example
  6023. @item
  6024. Crop the central input area with size 100x100:
  6025. @example
  6026. crop=100:100
  6027. @end example
  6028. @item
  6029. Crop the central input area with size 2/3 of the input video:
  6030. @example
  6031. crop=2/3*in_w:2/3*in_h
  6032. @end example
  6033. @item
  6034. Crop the input video central square:
  6035. @example
  6036. crop=out_w=in_h
  6037. crop=in_h
  6038. @end example
  6039. @item
  6040. Delimit the rectangle with the top-left corner placed at position
  6041. 100:100 and the right-bottom corner corresponding to the right-bottom
  6042. corner of the input image.
  6043. @example
  6044. crop=in_w-100:in_h-100:100:100
  6045. @end example
  6046. @item
  6047. Crop 10 pixels from the left and right borders, and 20 pixels from
  6048. the top and bottom borders
  6049. @example
  6050. crop=in_w-2*10:in_h-2*20
  6051. @end example
  6052. @item
  6053. Keep only the bottom right quarter of the input image:
  6054. @example
  6055. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6056. @end example
  6057. @item
  6058. Crop height for getting Greek harmony:
  6059. @example
  6060. crop=in_w:1/PHI*in_w
  6061. @end example
  6062. @item
  6063. Apply trembling effect:
  6064. @example
  6065. 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)
  6066. @end example
  6067. @item
  6068. Apply erratic camera effect depending on timestamp:
  6069. @example
  6070. 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)"
  6071. @end example
  6072. @item
  6073. Set x depending on the value of y:
  6074. @example
  6075. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6076. @end example
  6077. @end itemize
  6078. @subsection Commands
  6079. This filter supports the following commands:
  6080. @table @option
  6081. @item w, out_w
  6082. @item h, out_h
  6083. @item x
  6084. @item y
  6085. Set width/height of the output video and the horizontal/vertical position
  6086. in the input video.
  6087. The command accepts the same syntax of the corresponding option.
  6088. If the specified expression is not valid, it is kept at its current
  6089. value.
  6090. @end table
  6091. @section cropdetect
  6092. Auto-detect the crop size.
  6093. It calculates the necessary cropping parameters and prints the
  6094. recommended parameters via the logging system. The detected dimensions
  6095. correspond to the non-black area of the input video.
  6096. It accepts the following parameters:
  6097. @table @option
  6098. @item limit
  6099. Set higher black value threshold, which can be optionally specified
  6100. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6101. value greater to the set value is considered non-black. It defaults to 24.
  6102. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6103. on the bitdepth of the pixel format.
  6104. @item round
  6105. The value which the width/height should be divisible by. It defaults to
  6106. 16. The offset is automatically adjusted to center the video. Use 2 to
  6107. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6108. encoding to most video codecs.
  6109. @item reset_count, reset
  6110. Set the counter that determines after how many frames cropdetect will
  6111. reset the previously detected largest video area and start over to
  6112. detect the current optimal crop area. Default value is 0.
  6113. This can be useful when channel logos distort the video area. 0
  6114. indicates 'never reset', and returns the largest area encountered during
  6115. playback.
  6116. @end table
  6117. @anchor{cue}
  6118. @section cue
  6119. Delay video filtering until a given wallclock timestamp. The filter first
  6120. passes on @option{preroll} amount of frames, then it buffers at most
  6121. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6122. it forwards the buffered frames and also any subsequent frames coming in its
  6123. input.
  6124. The filter can be used synchronize the output of multiple ffmpeg processes for
  6125. realtime output devices like decklink. By putting the delay in the filtering
  6126. chain and pre-buffering frames the process can pass on data to output almost
  6127. immediately after the target wallclock timestamp is reached.
  6128. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6129. some use cases.
  6130. @table @option
  6131. @item cue
  6132. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6133. @item preroll
  6134. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6135. @item buffer
  6136. The maximum duration of content to buffer before waiting for the cue expressed
  6137. in seconds. Default is 0.
  6138. @end table
  6139. @anchor{curves}
  6140. @section curves
  6141. Apply color adjustments using curves.
  6142. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6143. component (red, green and blue) has its values defined by @var{N} key points
  6144. tied from each other using a smooth curve. The x-axis represents the pixel
  6145. values from the input frame, and the y-axis the new pixel values to be set for
  6146. the output frame.
  6147. By default, a component curve is defined by the two points @var{(0;0)} and
  6148. @var{(1;1)}. This creates a straight line where each original pixel value is
  6149. "adjusted" to its own value, which means no change to the image.
  6150. The filter allows you to redefine these two points and add some more. A new
  6151. curve (using a natural cubic spline interpolation) will be define to pass
  6152. smoothly through all these new coordinates. The new defined points needs to be
  6153. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6154. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6155. the vector spaces, the values will be clipped accordingly.
  6156. The filter accepts the following options:
  6157. @table @option
  6158. @item preset
  6159. Select one of the available color presets. This option can be used in addition
  6160. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6161. options takes priority on the preset values.
  6162. Available presets are:
  6163. @table @samp
  6164. @item none
  6165. @item color_negative
  6166. @item cross_process
  6167. @item darker
  6168. @item increase_contrast
  6169. @item lighter
  6170. @item linear_contrast
  6171. @item medium_contrast
  6172. @item negative
  6173. @item strong_contrast
  6174. @item vintage
  6175. @end table
  6176. Default is @code{none}.
  6177. @item master, m
  6178. Set the master key points. These points will define a second pass mapping. It
  6179. is sometimes called a "luminance" or "value" mapping. It can be used with
  6180. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6181. post-processing LUT.
  6182. @item red, r
  6183. Set the key points for the red component.
  6184. @item green, g
  6185. Set the key points for the green component.
  6186. @item blue, b
  6187. Set the key points for the blue component.
  6188. @item all
  6189. Set the key points for all components (not including master).
  6190. Can be used in addition to the other key points component
  6191. options. In this case, the unset component(s) will fallback on this
  6192. @option{all} setting.
  6193. @item psfile
  6194. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6195. @item plot
  6196. Save Gnuplot script of the curves in specified file.
  6197. @end table
  6198. To avoid some filtergraph syntax conflicts, each key points list need to be
  6199. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6200. @subsection Examples
  6201. @itemize
  6202. @item
  6203. Increase slightly the middle level of blue:
  6204. @example
  6205. curves=blue='0/0 0.5/0.58 1/1'
  6206. @end example
  6207. @item
  6208. Vintage effect:
  6209. @example
  6210. 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'
  6211. @end example
  6212. Here we obtain the following coordinates for each components:
  6213. @table @var
  6214. @item red
  6215. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6216. @item green
  6217. @code{(0;0) (0.50;0.48) (1;1)}
  6218. @item blue
  6219. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6220. @end table
  6221. @item
  6222. The previous example can also be achieved with the associated built-in preset:
  6223. @example
  6224. curves=preset=vintage
  6225. @end example
  6226. @item
  6227. Or simply:
  6228. @example
  6229. curves=vintage
  6230. @end example
  6231. @item
  6232. Use a Photoshop preset and redefine the points of the green component:
  6233. @example
  6234. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6235. @end example
  6236. @item
  6237. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6238. and @command{gnuplot}:
  6239. @example
  6240. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6241. gnuplot -p /tmp/curves.plt
  6242. @end example
  6243. @end itemize
  6244. @section datascope
  6245. Video data analysis filter.
  6246. This filter shows hexadecimal pixel values of part of video.
  6247. The filter accepts the following options:
  6248. @table @option
  6249. @item size, s
  6250. Set output video size.
  6251. @item x
  6252. Set x offset from where to pick pixels.
  6253. @item y
  6254. Set y offset from where to pick pixels.
  6255. @item mode
  6256. Set scope mode, can be one of the following:
  6257. @table @samp
  6258. @item mono
  6259. Draw hexadecimal pixel values with white color on black background.
  6260. @item color
  6261. Draw hexadecimal pixel values with input video pixel color on black
  6262. background.
  6263. @item color2
  6264. Draw hexadecimal pixel values on color background picked from input video,
  6265. the text color is picked in such way so its always visible.
  6266. @end table
  6267. @item axis
  6268. Draw rows and columns numbers on left and top of video.
  6269. @item opacity
  6270. Set background opacity.
  6271. @end table
  6272. @section dctdnoiz
  6273. Denoise frames using 2D DCT (frequency domain filtering).
  6274. This filter is not designed for real time.
  6275. The filter accepts the following options:
  6276. @table @option
  6277. @item sigma, s
  6278. Set the noise sigma constant.
  6279. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6280. coefficient (absolute value) below this threshold with be dropped.
  6281. If you need a more advanced filtering, see @option{expr}.
  6282. Default is @code{0}.
  6283. @item overlap
  6284. Set number overlapping pixels for each block. Since the filter can be slow, you
  6285. may want to reduce this value, at the cost of a less effective filter and the
  6286. risk of various artefacts.
  6287. If the overlapping value doesn't permit processing the whole input width or
  6288. height, a warning will be displayed and according borders won't be denoised.
  6289. Default value is @var{blocksize}-1, which is the best possible setting.
  6290. @item expr, e
  6291. Set the coefficient factor expression.
  6292. For each coefficient of a DCT block, this expression will be evaluated as a
  6293. multiplier value for the coefficient.
  6294. If this is option is set, the @option{sigma} option will be ignored.
  6295. The absolute value of the coefficient can be accessed through the @var{c}
  6296. variable.
  6297. @item n
  6298. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6299. @var{blocksize}, which is the width and height of the processed blocks.
  6300. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6301. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6302. on the speed processing. Also, a larger block size does not necessarily means a
  6303. better de-noising.
  6304. @end table
  6305. @subsection Examples
  6306. Apply a denoise with a @option{sigma} of @code{4.5}:
  6307. @example
  6308. dctdnoiz=4.5
  6309. @end example
  6310. The same operation can be achieved using the expression system:
  6311. @example
  6312. dctdnoiz=e='gte(c, 4.5*3)'
  6313. @end example
  6314. Violent denoise using a block size of @code{16x16}:
  6315. @example
  6316. dctdnoiz=15:n=4
  6317. @end example
  6318. @section deband
  6319. Remove banding artifacts from input video.
  6320. It works by replacing banded pixels with average value of referenced pixels.
  6321. The filter accepts the following options:
  6322. @table @option
  6323. @item 1thr
  6324. @item 2thr
  6325. @item 3thr
  6326. @item 4thr
  6327. Set banding detection threshold for each plane. Default is 0.02.
  6328. Valid range is 0.00003 to 0.5.
  6329. If difference between current pixel and reference pixel is less than threshold,
  6330. it will be considered as banded.
  6331. @item range, r
  6332. Banding detection range in pixels. Default is 16. If positive, random number
  6333. in range 0 to set value will be used. If negative, exact absolute value
  6334. will be used.
  6335. The range defines square of four pixels around current pixel.
  6336. @item direction, d
  6337. Set direction in radians from which four pixel will be compared. If positive,
  6338. random direction from 0 to set direction will be picked. If negative, exact of
  6339. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6340. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6341. column.
  6342. @item blur, b
  6343. If enabled, current pixel is compared with average value of all four
  6344. surrounding pixels. The default is enabled. If disabled current pixel is
  6345. compared with all four surrounding pixels. The pixel is considered banded
  6346. if only all four differences with surrounding pixels are less than threshold.
  6347. @item coupling, c
  6348. If enabled, current pixel is changed if and only if all pixel components are banded,
  6349. e.g. banding detection threshold is triggered for all color components.
  6350. The default is disabled.
  6351. @end table
  6352. @section deblock
  6353. Remove blocking artifacts from input video.
  6354. The filter accepts the following options:
  6355. @table @option
  6356. @item filter
  6357. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6358. This controls what kind of deblocking is applied.
  6359. @item block
  6360. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6361. @item alpha
  6362. @item beta
  6363. @item gamma
  6364. @item delta
  6365. Set blocking detection thresholds. Allowed range is 0 to 1.
  6366. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6367. Using higher threshold gives more deblocking strength.
  6368. Setting @var{alpha} controls threshold detection at exact edge of block.
  6369. Remaining options controls threshold detection near the edge. Each one for
  6370. below/above or left/right. Setting any of those to @var{0} disables
  6371. deblocking.
  6372. @item planes
  6373. Set planes to filter. Default is to filter all available planes.
  6374. @end table
  6375. @subsection Examples
  6376. @itemize
  6377. @item
  6378. Deblock using weak filter and block size of 4 pixels.
  6379. @example
  6380. deblock=filter=weak:block=4
  6381. @end example
  6382. @item
  6383. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6384. deblocking more edges.
  6385. @example
  6386. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6387. @end example
  6388. @item
  6389. Similar as above, but filter only first plane.
  6390. @example
  6391. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6392. @end example
  6393. @item
  6394. Similar as above, but filter only second and third plane.
  6395. @example
  6396. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6397. @end example
  6398. @end itemize
  6399. @anchor{decimate}
  6400. @section decimate
  6401. Drop duplicated frames at regular intervals.
  6402. The filter accepts the following options:
  6403. @table @option
  6404. @item cycle
  6405. Set the number of frames from which one will be dropped. Setting this to
  6406. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6407. Default is @code{5}.
  6408. @item dupthresh
  6409. Set the threshold for duplicate detection. If the difference metric for a frame
  6410. is less than or equal to this value, then it is declared as duplicate. Default
  6411. is @code{1.1}
  6412. @item scthresh
  6413. Set scene change threshold. Default is @code{15}.
  6414. @item blockx
  6415. @item blocky
  6416. Set the size of the x and y-axis blocks used during metric calculations.
  6417. Larger blocks give better noise suppression, but also give worse detection of
  6418. small movements. Must be a power of two. Default is @code{32}.
  6419. @item ppsrc
  6420. Mark main input as a pre-processed input and activate clean source input
  6421. stream. This allows the input to be pre-processed with various filters to help
  6422. the metrics calculation while keeping the frame selection lossless. When set to
  6423. @code{1}, the first stream is for the pre-processed input, and the second
  6424. stream is the clean source from where the kept frames are chosen. Default is
  6425. @code{0}.
  6426. @item chroma
  6427. Set whether or not chroma is considered in the metric calculations. Default is
  6428. @code{1}.
  6429. @end table
  6430. @section deconvolve
  6431. Apply 2D deconvolution of video stream in frequency domain using second stream
  6432. as impulse.
  6433. The filter accepts the following options:
  6434. @table @option
  6435. @item planes
  6436. Set which planes to process.
  6437. @item impulse
  6438. Set which impulse video frames will be processed, can be @var{first}
  6439. or @var{all}. Default is @var{all}.
  6440. @item noise
  6441. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6442. and height are not same and not power of 2 or if stream prior to convolving
  6443. had noise.
  6444. @end table
  6445. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6446. @section dedot
  6447. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6448. It accepts the following options:
  6449. @table @option
  6450. @item m
  6451. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6452. @var{rainbows} for cross-color reduction.
  6453. @item lt
  6454. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6455. @item tl
  6456. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6457. @item tc
  6458. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6459. @item ct
  6460. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6461. @end table
  6462. @section deflate
  6463. Apply deflate effect to the video.
  6464. This filter replaces the pixel by the local(3x3) average by taking into account
  6465. only values lower than the pixel.
  6466. It accepts the following options:
  6467. @table @option
  6468. @item threshold0
  6469. @item threshold1
  6470. @item threshold2
  6471. @item threshold3
  6472. Limit the maximum change for each plane, default is 65535.
  6473. If 0, plane will remain unchanged.
  6474. @end table
  6475. @section deflicker
  6476. Remove temporal frame luminance variations.
  6477. It accepts the following options:
  6478. @table @option
  6479. @item size, s
  6480. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6481. @item mode, m
  6482. Set averaging mode to smooth temporal luminance variations.
  6483. Available values are:
  6484. @table @samp
  6485. @item am
  6486. Arithmetic mean
  6487. @item gm
  6488. Geometric mean
  6489. @item hm
  6490. Harmonic mean
  6491. @item qm
  6492. Quadratic mean
  6493. @item cm
  6494. Cubic mean
  6495. @item pm
  6496. Power mean
  6497. @item median
  6498. Median
  6499. @end table
  6500. @item bypass
  6501. Do not actually modify frame. Useful when one only wants metadata.
  6502. @end table
  6503. @section dejudder
  6504. Remove judder produced by partially interlaced telecined content.
  6505. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6506. source was partially telecined content then the output of @code{pullup,dejudder}
  6507. will have a variable frame rate. May change the recorded frame rate of the
  6508. container. Aside from that change, this filter will not affect constant frame
  6509. rate video.
  6510. The option available in this filter is:
  6511. @table @option
  6512. @item cycle
  6513. Specify the length of the window over which the judder repeats.
  6514. Accepts any integer greater than 1. Useful values are:
  6515. @table @samp
  6516. @item 4
  6517. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6518. @item 5
  6519. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6520. @item 20
  6521. If a mixture of the two.
  6522. @end table
  6523. The default is @samp{4}.
  6524. @end table
  6525. @section delogo
  6526. Suppress a TV station logo by a simple interpolation of the surrounding
  6527. pixels. Just set a rectangle covering the logo and watch it disappear
  6528. (and sometimes something even uglier appear - your mileage may vary).
  6529. It accepts the following parameters:
  6530. @table @option
  6531. @item x
  6532. @item y
  6533. Specify the top left corner coordinates of the logo. They must be
  6534. specified.
  6535. @item w
  6536. @item h
  6537. Specify the width and height of the logo to clear. They must be
  6538. specified.
  6539. @item band, t
  6540. Specify the thickness of the fuzzy edge of the rectangle (added to
  6541. @var{w} and @var{h}). The default value is 1. This option is
  6542. deprecated, setting higher values should no longer be necessary and
  6543. is not recommended.
  6544. @item show
  6545. When set to 1, a green rectangle is drawn on the screen to simplify
  6546. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6547. The default value is 0.
  6548. The rectangle is drawn on the outermost pixels which will be (partly)
  6549. replaced with interpolated values. The values of the next pixels
  6550. immediately outside this rectangle in each direction will be used to
  6551. compute the interpolated pixel values inside the rectangle.
  6552. @end table
  6553. @subsection Examples
  6554. @itemize
  6555. @item
  6556. Set a rectangle covering the area with top left corner coordinates 0,0
  6557. and size 100x77, and a band of size 10:
  6558. @example
  6559. delogo=x=0:y=0:w=100:h=77:band=10
  6560. @end example
  6561. @end itemize
  6562. @section derain
  6563. Remove the rain in the input image/video by applying the derain methods based on
  6564. convolutional neural networks. Supported models:
  6565. @itemize
  6566. @item
  6567. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  6568. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  6569. @end itemize
  6570. Training as well as model generation scripts are provided in
  6571. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  6572. Native model files (.model) can be generated from TensorFlow model
  6573. files (.pb) by using tools/python/convert.py
  6574. The filter accepts the following options:
  6575. @table @option
  6576. @item filter_type
  6577. Specify which filter to use. This option accepts the following values:
  6578. @table @samp
  6579. @item derain
  6580. Derain filter. To conduct derain filter, you need to use a derain model.
  6581. @item dehaze
  6582. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  6583. @end table
  6584. Default value is @samp{derain}.
  6585. @item dnn_backend
  6586. Specify which DNN backend to use for model loading and execution. This option accepts
  6587. the following values:
  6588. @table @samp
  6589. @item native
  6590. Native implementation of DNN loading and execution.
  6591. @item tensorflow
  6592. TensorFlow backend. To enable this backend you
  6593. need to install the TensorFlow for C library (see
  6594. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  6595. @code{--enable-libtensorflow}
  6596. @end table
  6597. Default value is @samp{native}.
  6598. @item model
  6599. Set path to model file specifying network architecture and its parameters.
  6600. Note that different backends use different file formats. TensorFlow and native
  6601. backend can load files for only its format.
  6602. @end table
  6603. @section deshake
  6604. Attempt to fix small changes in horizontal and/or vertical shift. This
  6605. filter helps remove camera shake from hand-holding a camera, bumping a
  6606. tripod, moving on a vehicle, etc.
  6607. The filter accepts the following options:
  6608. @table @option
  6609. @item x
  6610. @item y
  6611. @item w
  6612. @item h
  6613. Specify a rectangular area where to limit the search for motion
  6614. vectors.
  6615. If desired the search for motion vectors can be limited to a
  6616. rectangular area of the frame defined by its top left corner, width
  6617. and height. These parameters have the same meaning as the drawbox
  6618. filter which can be used to visualise the position of the bounding
  6619. box.
  6620. This is useful when simultaneous movement of subjects within the frame
  6621. might be confused for camera motion by the motion vector search.
  6622. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6623. then the full frame is used. This allows later options to be set
  6624. without specifying the bounding box for the motion vector search.
  6625. Default - search the whole frame.
  6626. @item rx
  6627. @item ry
  6628. Specify the maximum extent of movement in x and y directions in the
  6629. range 0-64 pixels. Default 16.
  6630. @item edge
  6631. Specify how to generate pixels to fill blanks at the edge of the
  6632. frame. Available values are:
  6633. @table @samp
  6634. @item blank, 0
  6635. Fill zeroes at blank locations
  6636. @item original, 1
  6637. Original image at blank locations
  6638. @item clamp, 2
  6639. Extruded edge value at blank locations
  6640. @item mirror, 3
  6641. Mirrored edge at blank locations
  6642. @end table
  6643. Default value is @samp{mirror}.
  6644. @item blocksize
  6645. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6646. default 8.
  6647. @item contrast
  6648. Specify the contrast threshold for blocks. Only blocks with more than
  6649. the specified contrast (difference between darkest and lightest
  6650. pixels) will be considered. Range 1-255, default 125.
  6651. @item search
  6652. Specify the search strategy. Available values are:
  6653. @table @samp
  6654. @item exhaustive, 0
  6655. Set exhaustive search
  6656. @item less, 1
  6657. Set less exhaustive search.
  6658. @end table
  6659. Default value is @samp{exhaustive}.
  6660. @item filename
  6661. If set then a detailed log of the motion search is written to the
  6662. specified file.
  6663. @end table
  6664. @section despill
  6665. Remove unwanted contamination of foreground colors, caused by reflected color of
  6666. greenscreen or bluescreen.
  6667. This filter accepts the following options:
  6668. @table @option
  6669. @item type
  6670. Set what type of despill to use.
  6671. @item mix
  6672. Set how spillmap will be generated.
  6673. @item expand
  6674. Set how much to get rid of still remaining spill.
  6675. @item red
  6676. Controls amount of red in spill area.
  6677. @item green
  6678. Controls amount of green in spill area.
  6679. Should be -1 for greenscreen.
  6680. @item blue
  6681. Controls amount of blue in spill area.
  6682. Should be -1 for bluescreen.
  6683. @item brightness
  6684. Controls brightness of spill area, preserving colors.
  6685. @item alpha
  6686. Modify alpha from generated spillmap.
  6687. @end table
  6688. @section detelecine
  6689. Apply an exact inverse of the telecine operation. It requires a predefined
  6690. pattern specified using the pattern option which must be the same as that passed
  6691. to the telecine filter.
  6692. This filter accepts the following options:
  6693. @table @option
  6694. @item first_field
  6695. @table @samp
  6696. @item top, t
  6697. top field first
  6698. @item bottom, b
  6699. bottom field first
  6700. The default value is @code{top}.
  6701. @end table
  6702. @item pattern
  6703. A string of numbers representing the pulldown pattern you wish to apply.
  6704. The default value is @code{23}.
  6705. @item start_frame
  6706. A number representing position of the first frame with respect to the telecine
  6707. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6708. @end table
  6709. @section dilation
  6710. Apply dilation effect to the video.
  6711. This filter replaces the pixel by the local(3x3) maximum.
  6712. It accepts the following options:
  6713. @table @option
  6714. @item threshold0
  6715. @item threshold1
  6716. @item threshold2
  6717. @item threshold3
  6718. Limit the maximum change for each plane, default is 65535.
  6719. If 0, plane will remain unchanged.
  6720. @item coordinates
  6721. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6722. pixels are used.
  6723. Flags to local 3x3 coordinates maps like this:
  6724. 1 2 3
  6725. 4 5
  6726. 6 7 8
  6727. @end table
  6728. @section displace
  6729. Displace pixels as indicated by second and third input stream.
  6730. It takes three input streams and outputs one stream, the first input is the
  6731. source, and second and third input are displacement maps.
  6732. The second input specifies how much to displace pixels along the
  6733. x-axis, while the third input specifies how much to displace pixels
  6734. along the y-axis.
  6735. If one of displacement map streams terminates, last frame from that
  6736. displacement map will be used.
  6737. Note that once generated, displacements maps can be reused over and over again.
  6738. A description of the accepted options follows.
  6739. @table @option
  6740. @item edge
  6741. Set displace behavior for pixels that are out of range.
  6742. Available values are:
  6743. @table @samp
  6744. @item blank
  6745. Missing pixels are replaced by black pixels.
  6746. @item smear
  6747. Adjacent pixels will spread out to replace missing pixels.
  6748. @item wrap
  6749. Out of range pixels are wrapped so they point to pixels of other side.
  6750. @item mirror
  6751. Out of range pixels will be replaced with mirrored pixels.
  6752. @end table
  6753. Default is @samp{smear}.
  6754. @end table
  6755. @subsection Examples
  6756. @itemize
  6757. @item
  6758. Add ripple effect to rgb input of video size hd720:
  6759. @example
  6760. 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
  6761. @end example
  6762. @item
  6763. Add wave effect to rgb input of video size hd720:
  6764. @example
  6765. 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
  6766. @end example
  6767. @end itemize
  6768. @section drawbox
  6769. Draw a colored box on the input image.
  6770. It accepts the following parameters:
  6771. @table @option
  6772. @item x
  6773. @item y
  6774. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6775. @item width, w
  6776. @item height, h
  6777. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6778. the input width and height. It defaults to 0.
  6779. @item color, c
  6780. Specify the color of the box to write. For the general syntax of this option,
  6781. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6782. value @code{invert} is used, the box edge color is the same as the
  6783. video with inverted luma.
  6784. @item thickness, t
  6785. The expression which sets the thickness of the box edge.
  6786. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6787. See below for the list of accepted constants.
  6788. @item replace
  6789. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6790. will overwrite the video's color and alpha pixels.
  6791. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6792. @end table
  6793. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6794. following constants:
  6795. @table @option
  6796. @item dar
  6797. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6798. @item hsub
  6799. @item vsub
  6800. horizontal and vertical chroma subsample values. For example for the
  6801. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6802. @item in_h, ih
  6803. @item in_w, iw
  6804. The input width and height.
  6805. @item sar
  6806. The input sample aspect ratio.
  6807. @item x
  6808. @item y
  6809. The x and y offset coordinates where the box is drawn.
  6810. @item w
  6811. @item h
  6812. The width and height of the drawn box.
  6813. @item t
  6814. The thickness of the drawn box.
  6815. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6816. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6817. @end table
  6818. @subsection Examples
  6819. @itemize
  6820. @item
  6821. Draw a black box around the edge of the input image:
  6822. @example
  6823. drawbox
  6824. @end example
  6825. @item
  6826. Draw a box with color red and an opacity of 50%:
  6827. @example
  6828. drawbox=10:20:200:60:red@@0.5
  6829. @end example
  6830. The previous example can be specified as:
  6831. @example
  6832. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6833. @end example
  6834. @item
  6835. Fill the box with pink color:
  6836. @example
  6837. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6838. @end example
  6839. @item
  6840. Draw a 2-pixel red 2.40:1 mask:
  6841. @example
  6842. 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
  6843. @end example
  6844. @end itemize
  6845. @subsection Commands
  6846. This filter supports same commands as options.
  6847. The command accepts the same syntax of the corresponding option.
  6848. If the specified expression is not valid, it is kept at its current
  6849. value.
  6850. @section drawgrid
  6851. Draw a grid on the input image.
  6852. It accepts the following parameters:
  6853. @table @option
  6854. @item x
  6855. @item y
  6856. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6857. @item width, w
  6858. @item height, h
  6859. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6860. input width and height, respectively, minus @code{thickness}, so image gets
  6861. framed. Default to 0.
  6862. @item color, c
  6863. Specify the color of the grid. For the general syntax of this option,
  6864. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6865. value @code{invert} is used, the grid color is the same as the
  6866. video with inverted luma.
  6867. @item thickness, t
  6868. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6869. See below for the list of accepted constants.
  6870. @item replace
  6871. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6872. will overwrite the video's color and alpha pixels.
  6873. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6874. @end table
  6875. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6876. following constants:
  6877. @table @option
  6878. @item dar
  6879. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6880. @item hsub
  6881. @item vsub
  6882. horizontal and vertical chroma subsample values. For example for the
  6883. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6884. @item in_h, ih
  6885. @item in_w, iw
  6886. The input grid cell width and height.
  6887. @item sar
  6888. The input sample aspect ratio.
  6889. @item x
  6890. @item y
  6891. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6892. @item w
  6893. @item h
  6894. The width and height of the drawn cell.
  6895. @item t
  6896. The thickness of the drawn cell.
  6897. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6898. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6899. @end table
  6900. @subsection Examples
  6901. @itemize
  6902. @item
  6903. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6904. @example
  6905. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6906. @end example
  6907. @item
  6908. Draw a white 3x3 grid with an opacity of 50%:
  6909. @example
  6910. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6911. @end example
  6912. @end itemize
  6913. @subsection Commands
  6914. This filter supports same commands as options.
  6915. The command accepts the same syntax of the corresponding option.
  6916. If the specified expression is not valid, it is kept at its current
  6917. value.
  6918. @anchor{drawtext}
  6919. @section drawtext
  6920. Draw a text string or text from a specified file on top of a video, using the
  6921. libfreetype library.
  6922. To enable compilation of this filter, you need to configure FFmpeg with
  6923. @code{--enable-libfreetype}.
  6924. To enable default font fallback and the @var{font} option you need to
  6925. configure FFmpeg with @code{--enable-libfontconfig}.
  6926. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6927. @code{--enable-libfribidi}.
  6928. @subsection Syntax
  6929. It accepts the following parameters:
  6930. @table @option
  6931. @item box
  6932. Used to draw a box around text using the background color.
  6933. The value must be either 1 (enable) or 0 (disable).
  6934. The default value of @var{box} is 0.
  6935. @item boxborderw
  6936. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6937. The default value of @var{boxborderw} is 0.
  6938. @item boxcolor
  6939. The color to be used for drawing box around text. For the syntax of this
  6940. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6941. The default value of @var{boxcolor} is "white".
  6942. @item line_spacing
  6943. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6944. The default value of @var{line_spacing} is 0.
  6945. @item borderw
  6946. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6947. The default value of @var{borderw} is 0.
  6948. @item bordercolor
  6949. Set the color to be used for drawing border around text. For the syntax of this
  6950. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6951. The default value of @var{bordercolor} is "black".
  6952. @item expansion
  6953. Select how the @var{text} is expanded. Can be either @code{none},
  6954. @code{strftime} (deprecated) or
  6955. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6956. below for details.
  6957. @item basetime
  6958. Set a start time for the count. Value is in microseconds. Only applied
  6959. in the deprecated strftime expansion mode. To emulate in normal expansion
  6960. mode use the @code{pts} function, supplying the start time (in seconds)
  6961. as the second argument.
  6962. @item fix_bounds
  6963. If true, check and fix text coords to avoid clipping.
  6964. @item fontcolor
  6965. The color to be used for drawing fonts. For the syntax of this option, check
  6966. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6967. The default value of @var{fontcolor} is "black".
  6968. @item fontcolor_expr
  6969. String which is expanded the same way as @var{text} to obtain dynamic
  6970. @var{fontcolor} value. By default this option has empty value and is not
  6971. processed. When this option is set, it overrides @var{fontcolor} option.
  6972. @item font
  6973. The font family to be used for drawing text. By default Sans.
  6974. @item fontfile
  6975. The font file to be used for drawing text. The path must be included.
  6976. This parameter is mandatory if the fontconfig support is disabled.
  6977. @item alpha
  6978. Draw the text applying alpha blending. The value can
  6979. be a number between 0.0 and 1.0.
  6980. The expression accepts the same variables @var{x, y} as well.
  6981. The default value is 1.
  6982. Please see @var{fontcolor_expr}.
  6983. @item fontsize
  6984. The font size to be used for drawing text.
  6985. The default value of @var{fontsize} is 16.
  6986. @item text_shaping
  6987. If set to 1, attempt to shape the text (for example, reverse the order of
  6988. right-to-left text and join Arabic characters) before drawing it.
  6989. Otherwise, just draw the text exactly as given.
  6990. By default 1 (if supported).
  6991. @item ft_load_flags
  6992. The flags to be used for loading the fonts.
  6993. The flags map the corresponding flags supported by libfreetype, and are
  6994. a combination of the following values:
  6995. @table @var
  6996. @item default
  6997. @item no_scale
  6998. @item no_hinting
  6999. @item render
  7000. @item no_bitmap
  7001. @item vertical_layout
  7002. @item force_autohint
  7003. @item crop_bitmap
  7004. @item pedantic
  7005. @item ignore_global_advance_width
  7006. @item no_recurse
  7007. @item ignore_transform
  7008. @item monochrome
  7009. @item linear_design
  7010. @item no_autohint
  7011. @end table
  7012. Default value is "default".
  7013. For more information consult the documentation for the FT_LOAD_*
  7014. libfreetype flags.
  7015. @item shadowcolor
  7016. The color to be used for drawing a shadow behind the drawn text. For the
  7017. syntax of this option, check the @ref{color syntax,,"Color" section in the
  7018. ffmpeg-utils manual,ffmpeg-utils}.
  7019. The default value of @var{shadowcolor} is "black".
  7020. @item shadowx
  7021. @item shadowy
  7022. The x and y offsets for the text shadow position with respect to the
  7023. position of the text. They can be either positive or negative
  7024. values. The default value for both is "0".
  7025. @item start_number
  7026. The starting frame number for the n/frame_num variable. The default value
  7027. is "0".
  7028. @item tabsize
  7029. The size in number of spaces to use for rendering the tab.
  7030. Default value is 4.
  7031. @item timecode
  7032. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  7033. format. It can be used with or without text parameter. @var{timecode_rate}
  7034. option must be specified.
  7035. @item timecode_rate, rate, r
  7036. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  7037. integer. Minimum value is "1".
  7038. Drop-frame timecode is supported for frame rates 30 & 60.
  7039. @item tc24hmax
  7040. If set to 1, the output of the timecode option will wrap around at 24 hours.
  7041. Default is 0 (disabled).
  7042. @item text
  7043. The text string to be drawn. The text must be a sequence of UTF-8
  7044. encoded characters.
  7045. This parameter is mandatory if no file is specified with the parameter
  7046. @var{textfile}.
  7047. @item textfile
  7048. A text file containing text to be drawn. The text must be a sequence
  7049. of UTF-8 encoded characters.
  7050. This parameter is mandatory if no text string is specified with the
  7051. parameter @var{text}.
  7052. If both @var{text} and @var{textfile} are specified, an error is thrown.
  7053. @item reload
  7054. If set to 1, the @var{textfile} will be reloaded before each frame.
  7055. Be sure to update it atomically, or it may be read partially, or even fail.
  7056. @item x
  7057. @item y
  7058. The expressions which specify the offsets where text will be drawn
  7059. within the video frame. They are relative to the top/left border of the
  7060. output image.
  7061. The default value of @var{x} and @var{y} is "0".
  7062. See below for the list of accepted constants and functions.
  7063. @end table
  7064. The parameters for @var{x} and @var{y} are expressions containing the
  7065. following constants and functions:
  7066. @table @option
  7067. @item dar
  7068. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  7069. @item hsub
  7070. @item vsub
  7071. horizontal and vertical chroma subsample values. For example for the
  7072. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7073. @item line_h, lh
  7074. the height of each text line
  7075. @item main_h, h, H
  7076. the input height
  7077. @item main_w, w, W
  7078. the input width
  7079. @item max_glyph_a, ascent
  7080. the maximum distance from the baseline to the highest/upper grid
  7081. coordinate used to place a glyph outline point, for all the rendered
  7082. glyphs.
  7083. It is a positive value, due to the grid's orientation with the Y axis
  7084. upwards.
  7085. @item max_glyph_d, descent
  7086. the maximum distance from the baseline to the lowest grid coordinate
  7087. used to place a glyph outline point, for all the rendered glyphs.
  7088. This is a negative value, due to the grid's orientation, with the Y axis
  7089. upwards.
  7090. @item max_glyph_h
  7091. maximum glyph height, that is the maximum height for all the glyphs
  7092. contained in the rendered text, it is equivalent to @var{ascent} -
  7093. @var{descent}.
  7094. @item max_glyph_w
  7095. maximum glyph width, that is the maximum width for all the glyphs
  7096. contained in the rendered text
  7097. @item n
  7098. the number of input frame, starting from 0
  7099. @item rand(min, max)
  7100. return a random number included between @var{min} and @var{max}
  7101. @item sar
  7102. The input sample aspect ratio.
  7103. @item t
  7104. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7105. @item text_h, th
  7106. the height of the rendered text
  7107. @item text_w, tw
  7108. the width of the rendered text
  7109. @item x
  7110. @item y
  7111. the x and y offset coordinates where the text is drawn.
  7112. These parameters allow the @var{x} and @var{y} expressions to refer
  7113. to each other, so you can for example specify @code{y=x/dar}.
  7114. @item pict_type
  7115. A one character description of the current frame's picture type.
  7116. @item pkt_pos
  7117. The current packet's position in the input file or stream
  7118. (in bytes, from the start of the input). A value of -1 indicates
  7119. this info is not available.
  7120. @item pkt_duration
  7121. The current packet's duration, in seconds.
  7122. @item pkt_size
  7123. The current packet's size (in bytes).
  7124. @end table
  7125. @anchor{drawtext_expansion}
  7126. @subsection Text expansion
  7127. If @option{expansion} is set to @code{strftime},
  7128. the filter recognizes strftime() sequences in the provided text and
  7129. expands them accordingly. Check the documentation of strftime(). This
  7130. feature is deprecated.
  7131. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  7132. If @option{expansion} is set to @code{normal} (which is the default),
  7133. the following expansion mechanism is used.
  7134. The backslash character @samp{\}, followed by any character, always expands to
  7135. the second character.
  7136. Sequences of the form @code{%@{...@}} are expanded. The text between the
  7137. braces is a function name, possibly followed by arguments separated by ':'.
  7138. If the arguments contain special characters or delimiters (':' or '@}'),
  7139. they should be escaped.
  7140. Note that they probably must also be escaped as the value for the
  7141. @option{text} option in the filter argument string and as the filter
  7142. argument in the filtergraph description, and possibly also for the shell,
  7143. that makes up to four levels of escaping; using a text file avoids these
  7144. problems.
  7145. The following functions are available:
  7146. @table @command
  7147. @item expr, e
  7148. The expression evaluation result.
  7149. It must take one argument specifying the expression to be evaluated,
  7150. which accepts the same constants and functions as the @var{x} and
  7151. @var{y} values. Note that not all constants should be used, for
  7152. example the text size is not known when evaluating the expression, so
  7153. the constants @var{text_w} and @var{text_h} will have an undefined
  7154. value.
  7155. @item expr_int_format, eif
  7156. Evaluate the expression's value and output as formatted integer.
  7157. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  7158. The second argument specifies the output format. Allowed values are @samp{x},
  7159. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  7160. @code{printf} function.
  7161. The third parameter is optional and sets the number of positions taken by the output.
  7162. It can be used to add padding with zeros from the left.
  7163. @item gmtime
  7164. The time at which the filter is running, expressed in UTC.
  7165. It can accept an argument: a strftime() format string.
  7166. @item localtime
  7167. The time at which the filter is running, expressed in the local time zone.
  7168. It can accept an argument: a strftime() format string.
  7169. @item metadata
  7170. Frame metadata. Takes one or two arguments.
  7171. The first argument is mandatory and specifies the metadata key.
  7172. The second argument is optional and specifies a default value, used when the
  7173. metadata key is not found or empty.
  7174. Available metadata can be identified by inspecting entries
  7175. starting with TAG included within each frame section
  7176. printed by running @code{ffprobe -show_frames}.
  7177. String metadata generated in filters leading to
  7178. the drawtext filter are also available.
  7179. @item n, frame_num
  7180. The frame number, starting from 0.
  7181. @item pict_type
  7182. A one character description of the current picture type.
  7183. @item pts
  7184. The timestamp of the current frame.
  7185. It can take up to three arguments.
  7186. The first argument is the format of the timestamp; it defaults to @code{flt}
  7187. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  7188. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  7189. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  7190. @code{localtime} stands for the timestamp of the frame formatted as
  7191. local time zone time.
  7192. The second argument is an offset added to the timestamp.
  7193. If the format is set to @code{hms}, a third argument @code{24HH} may be
  7194. supplied to present the hour part of the formatted timestamp in 24h format
  7195. (00-23).
  7196. If the format is set to @code{localtime} or @code{gmtime},
  7197. a third argument may be supplied: a strftime() format string.
  7198. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  7199. @end table
  7200. @subsection Commands
  7201. This filter supports altering parameters via commands:
  7202. @table @option
  7203. @item reinit
  7204. Alter existing filter parameters.
  7205. Syntax for the argument is the same as for filter invocation, e.g.
  7206. @example
  7207. fontsize=56:fontcolor=green:text='Hello World'
  7208. @end example
  7209. Full filter invocation with sendcmd would look like this:
  7210. @example
  7211. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7212. @end example
  7213. @end table
  7214. If the entire argument can't be parsed or applied as valid values then the filter will
  7215. continue with its existing parameters.
  7216. @subsection Examples
  7217. @itemize
  7218. @item
  7219. Draw "Test Text" with font FreeSerif, using the default values for the
  7220. optional parameters.
  7221. @example
  7222. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7223. @end example
  7224. @item
  7225. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7226. and y=50 (counting from the top-left corner of the screen), text is
  7227. yellow with a red box around it. Both the text and the box have an
  7228. opacity of 20%.
  7229. @example
  7230. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7231. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7232. @end example
  7233. Note that the double quotes are not necessary if spaces are not used
  7234. within the parameter list.
  7235. @item
  7236. Show the text at the center of the video frame:
  7237. @example
  7238. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7239. @end example
  7240. @item
  7241. Show the text at a random position, switching to a new position every 30 seconds:
  7242. @example
  7243. 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)"
  7244. @end example
  7245. @item
  7246. Show a text line sliding from right to left in the last row of the video
  7247. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7248. with no newlines.
  7249. @example
  7250. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7251. @end example
  7252. @item
  7253. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7254. @example
  7255. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7256. @end example
  7257. @item
  7258. Draw a single green letter "g", at the center of the input video.
  7259. The glyph baseline is placed at half screen height.
  7260. @example
  7261. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7262. @end example
  7263. @item
  7264. Show text for 1 second every 3 seconds:
  7265. @example
  7266. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7267. @end example
  7268. @item
  7269. Use fontconfig to set the font. Note that the colons need to be escaped.
  7270. @example
  7271. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7272. @end example
  7273. @item
  7274. Print the date of a real-time encoding (see strftime(3)):
  7275. @example
  7276. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7277. @end example
  7278. @item
  7279. Show text fading in and out (appearing/disappearing):
  7280. @example
  7281. #!/bin/sh
  7282. DS=1.0 # display start
  7283. DE=10.0 # display end
  7284. FID=1.5 # fade in duration
  7285. FOD=5 # fade out duration
  7286. 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 @}"
  7287. @end example
  7288. @item
  7289. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7290. and the @option{fontsize} value are included in the @option{y} offset.
  7291. @example
  7292. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7293. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7294. @end example
  7295. @end itemize
  7296. For more information about libfreetype, check:
  7297. @url{http://www.freetype.org/}.
  7298. For more information about fontconfig, check:
  7299. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7300. For more information about libfribidi, check:
  7301. @url{http://fribidi.org/}.
  7302. @section edgedetect
  7303. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7304. The filter accepts the following options:
  7305. @table @option
  7306. @item low
  7307. @item high
  7308. Set low and high threshold values used by the Canny thresholding
  7309. algorithm.
  7310. The high threshold selects the "strong" edge pixels, which are then
  7311. connected through 8-connectivity with the "weak" edge pixels selected
  7312. by the low threshold.
  7313. @var{low} and @var{high} threshold values must be chosen in the range
  7314. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7315. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  7316. is @code{50/255}.
  7317. @item mode
  7318. Define the drawing mode.
  7319. @table @samp
  7320. @item wires
  7321. Draw white/gray wires on black background.
  7322. @item colormix
  7323. Mix the colors to create a paint/cartoon effect.
  7324. @item canny
  7325. Apply Canny edge detector on all selected planes.
  7326. @end table
  7327. Default value is @var{wires}.
  7328. @item planes
  7329. Select planes for filtering. By default all available planes are filtered.
  7330. @end table
  7331. @subsection Examples
  7332. @itemize
  7333. @item
  7334. Standard edge detection with custom values for the hysteresis thresholding:
  7335. @example
  7336. edgedetect=low=0.1:high=0.4
  7337. @end example
  7338. @item
  7339. Painting effect without thresholding:
  7340. @example
  7341. edgedetect=mode=colormix:high=0
  7342. @end example
  7343. @end itemize
  7344. @section elbg
  7345. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7346. For each input image, the filter will compute the optimal mapping from
  7347. the input to the output given the codebook length, that is the number
  7348. of distinct output colors.
  7349. This filter accepts the following options.
  7350. @table @option
  7351. @item codebook_length, l
  7352. Set codebook length. The value must be a positive integer, and
  7353. represents the number of distinct output colors. Default value is 256.
  7354. @item nb_steps, n
  7355. Set the maximum number of iterations to apply for computing the optimal
  7356. mapping. The higher the value the better the result and the higher the
  7357. computation time. Default value is 1.
  7358. @item seed, s
  7359. Set a random seed, must be an integer included between 0 and
  7360. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7361. will try to use a good random seed on a best effort basis.
  7362. @item pal8
  7363. Set pal8 output pixel format. This option does not work with codebook
  7364. length greater than 256.
  7365. @end table
  7366. @section entropy
  7367. Measure graylevel entropy in histogram of color channels of video frames.
  7368. It accepts the following parameters:
  7369. @table @option
  7370. @item mode
  7371. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7372. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7373. between neighbour histogram values.
  7374. @end table
  7375. @section eq
  7376. Set brightness, contrast, saturation and approximate gamma adjustment.
  7377. The filter accepts the following options:
  7378. @table @option
  7379. @item contrast
  7380. Set the contrast expression. The value must be a float value in range
  7381. @code{-1000.0} to @code{1000.0}. The default value is "1".
  7382. @item brightness
  7383. Set the brightness expression. The value must be a float value in
  7384. range @code{-1.0} to @code{1.0}. The default value is "0".
  7385. @item saturation
  7386. Set the saturation expression. The value must be a float in
  7387. range @code{0.0} to @code{3.0}. The default value is "1".
  7388. @item gamma
  7389. Set the gamma expression. The value must be a float in range
  7390. @code{0.1} to @code{10.0}. The default value is "1".
  7391. @item gamma_r
  7392. Set the gamma expression for red. The value must be a float in
  7393. range @code{0.1} to @code{10.0}. The default value is "1".
  7394. @item gamma_g
  7395. Set the gamma expression for green. The value must be a float in range
  7396. @code{0.1} to @code{10.0}. The default value is "1".
  7397. @item gamma_b
  7398. Set the gamma expression for blue. The value must be a float in range
  7399. @code{0.1} to @code{10.0}. The default value is "1".
  7400. @item gamma_weight
  7401. Set the gamma weight expression. It can be used to reduce the effect
  7402. of a high gamma value on bright image areas, e.g. keep them from
  7403. getting overamplified and just plain white. The value must be a float
  7404. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7405. gamma correction all the way down while @code{1.0} leaves it at its
  7406. full strength. Default is "1".
  7407. @item eval
  7408. Set when the expressions for brightness, contrast, saturation and
  7409. gamma expressions are evaluated.
  7410. It accepts the following values:
  7411. @table @samp
  7412. @item init
  7413. only evaluate expressions once during the filter initialization or
  7414. when a command is processed
  7415. @item frame
  7416. evaluate expressions for each incoming frame
  7417. @end table
  7418. Default value is @samp{init}.
  7419. @end table
  7420. The expressions accept the following parameters:
  7421. @table @option
  7422. @item n
  7423. frame count of the input frame starting from 0
  7424. @item pos
  7425. byte position of the corresponding packet in the input file, NAN if
  7426. unspecified
  7427. @item r
  7428. frame rate of the input video, NAN if the input frame rate is unknown
  7429. @item t
  7430. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7431. @end table
  7432. @subsection Commands
  7433. The filter supports the following commands:
  7434. @table @option
  7435. @item contrast
  7436. Set the contrast expression.
  7437. @item brightness
  7438. Set the brightness expression.
  7439. @item saturation
  7440. Set the saturation expression.
  7441. @item gamma
  7442. Set the gamma expression.
  7443. @item gamma_r
  7444. Set the gamma_r expression.
  7445. @item gamma_g
  7446. Set gamma_g expression.
  7447. @item gamma_b
  7448. Set gamma_b expression.
  7449. @item gamma_weight
  7450. Set gamma_weight expression.
  7451. The command accepts the same syntax of the corresponding option.
  7452. If the specified expression is not valid, it is kept at its current
  7453. value.
  7454. @end table
  7455. @section erosion
  7456. Apply erosion effect to the video.
  7457. This filter replaces the pixel by the local(3x3) minimum.
  7458. It accepts the following options:
  7459. @table @option
  7460. @item threshold0
  7461. @item threshold1
  7462. @item threshold2
  7463. @item threshold3
  7464. Limit the maximum change for each plane, default is 65535.
  7465. If 0, plane will remain unchanged.
  7466. @item coordinates
  7467. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7468. pixels are used.
  7469. Flags to local 3x3 coordinates maps like this:
  7470. 1 2 3
  7471. 4 5
  7472. 6 7 8
  7473. @end table
  7474. @section extractplanes
  7475. Extract color channel components from input video stream into
  7476. separate grayscale video streams.
  7477. The filter accepts the following option:
  7478. @table @option
  7479. @item planes
  7480. Set plane(s) to extract.
  7481. Available values for planes are:
  7482. @table @samp
  7483. @item y
  7484. @item u
  7485. @item v
  7486. @item a
  7487. @item r
  7488. @item g
  7489. @item b
  7490. @end table
  7491. Choosing planes not available in the input will result in an error.
  7492. That means you cannot select @code{r}, @code{g}, @code{b} planes
  7493. with @code{y}, @code{u}, @code{v} planes at same time.
  7494. @end table
  7495. @subsection Examples
  7496. @itemize
  7497. @item
  7498. Extract luma, u and v color channel component from input video frame
  7499. into 3 grayscale outputs:
  7500. @example
  7501. 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
  7502. @end example
  7503. @end itemize
  7504. @section fade
  7505. Apply a fade-in/out effect to the input video.
  7506. It accepts the following parameters:
  7507. @table @option
  7508. @item type, t
  7509. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7510. effect.
  7511. Default is @code{in}.
  7512. @item start_frame, s
  7513. Specify the number of the frame to start applying the fade
  7514. effect at. Default is 0.
  7515. @item nb_frames, n
  7516. The number of frames that the fade effect lasts. At the end of the
  7517. fade-in effect, the output video will have the same intensity as the input video.
  7518. At the end of the fade-out transition, the output video will be filled with the
  7519. selected @option{color}.
  7520. Default is 25.
  7521. @item alpha
  7522. If set to 1, fade only alpha channel, if one exists on the input.
  7523. Default value is 0.
  7524. @item start_time, st
  7525. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7526. effect. If both start_frame and start_time are specified, the fade will start at
  7527. whichever comes last. Default is 0.
  7528. @item duration, d
  7529. The number of seconds for which the fade effect has to last. At the end of the
  7530. fade-in effect the output video will have the same intensity as the input video,
  7531. at the end of the fade-out transition the output video will be filled with the
  7532. selected @option{color}.
  7533. If both duration and nb_frames are specified, duration is used. Default is 0
  7534. (nb_frames is used by default).
  7535. @item color, c
  7536. Specify the color of the fade. Default is "black".
  7537. @end table
  7538. @subsection Examples
  7539. @itemize
  7540. @item
  7541. Fade in the first 30 frames of video:
  7542. @example
  7543. fade=in:0:30
  7544. @end example
  7545. The command above is equivalent to:
  7546. @example
  7547. fade=t=in:s=0:n=30
  7548. @end example
  7549. @item
  7550. Fade out the last 45 frames of a 200-frame video:
  7551. @example
  7552. fade=out:155:45
  7553. fade=type=out:start_frame=155:nb_frames=45
  7554. @end example
  7555. @item
  7556. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7557. @example
  7558. fade=in:0:25, fade=out:975:25
  7559. @end example
  7560. @item
  7561. Make the first 5 frames yellow, then fade in from frame 5-24:
  7562. @example
  7563. fade=in:5:20:color=yellow
  7564. @end example
  7565. @item
  7566. Fade in alpha over first 25 frames of video:
  7567. @example
  7568. fade=in:0:25:alpha=1
  7569. @end example
  7570. @item
  7571. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7572. @example
  7573. fade=t=in:st=5.5:d=0.5
  7574. @end example
  7575. @end itemize
  7576. @section fftdnoiz
  7577. Denoise frames using 3D FFT (frequency domain filtering).
  7578. The filter accepts the following options:
  7579. @table @option
  7580. @item sigma
  7581. Set the noise sigma constant. This sets denoising strength.
  7582. Default value is 1. Allowed range is from 0 to 30.
  7583. Using very high sigma with low overlap may give blocking artifacts.
  7584. @item amount
  7585. Set amount of denoising. By default all detected noise is reduced.
  7586. Default value is 1. Allowed range is from 0 to 1.
  7587. @item block
  7588. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7589. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7590. block size in pixels is 2^4 which is 16.
  7591. @item overlap
  7592. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7593. @item prev
  7594. Set number of previous frames to use for denoising. By default is set to 0.
  7595. @item next
  7596. Set number of next frames to to use for denoising. By default is set to 0.
  7597. @item planes
  7598. Set planes which will be filtered, by default are all available filtered
  7599. except alpha.
  7600. @end table
  7601. @section fftfilt
  7602. Apply arbitrary expressions to samples in frequency domain
  7603. @table @option
  7604. @item dc_Y
  7605. Adjust the dc value (gain) of the luma plane of the image. The filter
  7606. accepts an integer value in range @code{0} to @code{1000}. The default
  7607. value is set to @code{0}.
  7608. @item dc_U
  7609. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7610. filter accepts an integer value in range @code{0} to @code{1000}. The
  7611. default value is set to @code{0}.
  7612. @item dc_V
  7613. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7614. filter accepts an integer value in range @code{0} to @code{1000}. The
  7615. default value is set to @code{0}.
  7616. @item weight_Y
  7617. Set the frequency domain weight expression for the luma plane.
  7618. @item weight_U
  7619. Set the frequency domain weight expression for the 1st chroma plane.
  7620. @item weight_V
  7621. Set the frequency domain weight expression for the 2nd chroma plane.
  7622. @item eval
  7623. Set when the expressions are evaluated.
  7624. It accepts the following values:
  7625. @table @samp
  7626. @item init
  7627. Only evaluate expressions once during the filter initialization.
  7628. @item frame
  7629. Evaluate expressions for each incoming frame.
  7630. @end table
  7631. Default value is @samp{init}.
  7632. The filter accepts the following variables:
  7633. @item X
  7634. @item Y
  7635. The coordinates of the current sample.
  7636. @item W
  7637. @item H
  7638. The width and height of the image.
  7639. @item N
  7640. The number of input frame, starting from 0.
  7641. @end table
  7642. @subsection Examples
  7643. @itemize
  7644. @item
  7645. High-pass:
  7646. @example
  7647. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7648. @end example
  7649. @item
  7650. Low-pass:
  7651. @example
  7652. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7653. @end example
  7654. @item
  7655. Sharpen:
  7656. @example
  7657. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7658. @end example
  7659. @item
  7660. Blur:
  7661. @example
  7662. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7663. @end example
  7664. @end itemize
  7665. @section field
  7666. Extract a single field from an interlaced image using stride
  7667. arithmetic to avoid wasting CPU time. The output frames are marked as
  7668. non-interlaced.
  7669. The filter accepts the following options:
  7670. @table @option
  7671. @item type
  7672. Specify whether to extract the top (if the value is @code{0} or
  7673. @code{top}) or the bottom field (if the value is @code{1} or
  7674. @code{bottom}).
  7675. @end table
  7676. @section fieldhint
  7677. Create new frames by copying the top and bottom fields from surrounding frames
  7678. supplied as numbers by the hint file.
  7679. @table @option
  7680. @item hint
  7681. Set file containing hints: absolute/relative frame numbers.
  7682. There must be one line for each frame in a clip. Each line must contain two
  7683. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7684. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7685. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7686. for @code{relative} mode. First number tells from which frame to pick up top
  7687. field and second number tells from which frame to pick up bottom field.
  7688. If optionally followed by @code{+} output frame will be marked as interlaced,
  7689. else if followed by @code{-} output frame will be marked as progressive, else
  7690. it will be marked same as input frame.
  7691. If line starts with @code{#} or @code{;} that line is skipped.
  7692. @item mode
  7693. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7694. @end table
  7695. Example of first several lines of @code{hint} file for @code{relative} mode:
  7696. @example
  7697. 0,0 - # first frame
  7698. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7699. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7700. 1,0 -
  7701. 0,0 -
  7702. 0,0 -
  7703. 1,0 -
  7704. 1,0 -
  7705. 1,0 -
  7706. 0,0 -
  7707. 0,0 -
  7708. 1,0 -
  7709. 1,0 -
  7710. 1,0 -
  7711. 0,0 -
  7712. @end example
  7713. @section fieldmatch
  7714. Field matching filter for inverse telecine. It is meant to reconstruct the
  7715. progressive frames from a telecined stream. The filter does not drop duplicated
  7716. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7717. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7718. The separation of the field matching and the decimation is notably motivated by
  7719. the possibility of inserting a de-interlacing filter fallback between the two.
  7720. If the source has mixed telecined and real interlaced content,
  7721. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7722. But these remaining combed frames will be marked as interlaced, and thus can be
  7723. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7724. In addition to the various configuration options, @code{fieldmatch} can take an
  7725. optional second stream, activated through the @option{ppsrc} option. If
  7726. enabled, the frames reconstruction will be based on the fields and frames from
  7727. this second stream. This allows the first input to be pre-processed in order to
  7728. help the various algorithms of the filter, while keeping the output lossless
  7729. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7730. or brightness/contrast adjustments can help.
  7731. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7732. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7733. which @code{fieldmatch} is based on. While the semantic and usage are very
  7734. close, some behaviour and options names can differ.
  7735. The @ref{decimate} filter currently only works for constant frame rate input.
  7736. If your input has mixed telecined (30fps) and progressive content with a lower
  7737. framerate like 24fps use the following filterchain to produce the necessary cfr
  7738. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7739. The filter accepts the following options:
  7740. @table @option
  7741. @item order
  7742. Specify the assumed field order of the input stream. Available values are:
  7743. @table @samp
  7744. @item auto
  7745. Auto detect parity (use FFmpeg's internal parity value).
  7746. @item bff
  7747. Assume bottom field first.
  7748. @item tff
  7749. Assume top field first.
  7750. @end table
  7751. Note that it is sometimes recommended not to trust the parity announced by the
  7752. stream.
  7753. Default value is @var{auto}.
  7754. @item mode
  7755. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7756. sense that it won't risk creating jerkiness due to duplicate frames when
  7757. possible, but if there are bad edits or blended fields it will end up
  7758. outputting combed frames when a good match might actually exist. On the other
  7759. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7760. but will almost always find a good frame if there is one. The other values are
  7761. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7762. jerkiness and creating duplicate frames versus finding good matches in sections
  7763. with bad edits, orphaned fields, blended fields, etc.
  7764. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7765. Available values are:
  7766. @table @samp
  7767. @item pc
  7768. 2-way matching (p/c)
  7769. @item pc_n
  7770. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7771. @item pc_u
  7772. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7773. @item pc_n_ub
  7774. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7775. still combed (p/c + n + u/b)
  7776. @item pcn
  7777. 3-way matching (p/c/n)
  7778. @item pcn_ub
  7779. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7780. detected as combed (p/c/n + u/b)
  7781. @end table
  7782. The parenthesis at the end indicate the matches that would be used for that
  7783. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7784. @var{top}).
  7785. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7786. the slowest.
  7787. Default value is @var{pc_n}.
  7788. @item ppsrc
  7789. Mark the main input stream as a pre-processed input, and enable the secondary
  7790. input stream as the clean source to pick the fields from. See the filter
  7791. introduction for more details. It is similar to the @option{clip2} feature from
  7792. VFM/TFM.
  7793. Default value is @code{0} (disabled).
  7794. @item field
  7795. Set the field to match from. It is recommended to set this to the same value as
  7796. @option{order} unless you experience matching failures with that setting. In
  7797. certain circumstances changing the field that is used to match from can have a
  7798. large impact on matching performance. Available values are:
  7799. @table @samp
  7800. @item auto
  7801. Automatic (same value as @option{order}).
  7802. @item bottom
  7803. Match from the bottom field.
  7804. @item top
  7805. Match from the top field.
  7806. @end table
  7807. Default value is @var{auto}.
  7808. @item mchroma
  7809. Set whether or not chroma is included during the match comparisons. In most
  7810. cases it is recommended to leave this enabled. You should set this to @code{0}
  7811. only if your clip has bad chroma problems such as heavy rainbowing or other
  7812. artifacts. Setting this to @code{0} could also be used to speed things up at
  7813. the cost of some accuracy.
  7814. Default value is @code{1}.
  7815. @item y0
  7816. @item y1
  7817. These define an exclusion band which excludes the lines between @option{y0} and
  7818. @option{y1} from being included in the field matching decision. An exclusion
  7819. band can be used to ignore subtitles, a logo, or other things that may
  7820. interfere with the matching. @option{y0} sets the starting scan line and
  7821. @option{y1} sets the ending line; all lines in between @option{y0} and
  7822. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7823. @option{y0} and @option{y1} to the same value will disable the feature.
  7824. @option{y0} and @option{y1} defaults to @code{0}.
  7825. @item scthresh
  7826. Set the scene change detection threshold as a percentage of maximum change on
  7827. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7828. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7829. @option{scthresh} is @code{[0.0, 100.0]}.
  7830. Default value is @code{12.0}.
  7831. @item combmatch
  7832. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7833. account the combed scores of matches when deciding what match to use as the
  7834. final match. Available values are:
  7835. @table @samp
  7836. @item none
  7837. No final matching based on combed scores.
  7838. @item sc
  7839. Combed scores are only used when a scene change is detected.
  7840. @item full
  7841. Use combed scores all the time.
  7842. @end table
  7843. Default is @var{sc}.
  7844. @item combdbg
  7845. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7846. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7847. Available values are:
  7848. @table @samp
  7849. @item none
  7850. No forced calculation.
  7851. @item pcn
  7852. Force p/c/n calculations.
  7853. @item pcnub
  7854. Force p/c/n/u/b calculations.
  7855. @end table
  7856. Default value is @var{none}.
  7857. @item cthresh
  7858. This is the area combing threshold used for combed frame detection. This
  7859. essentially controls how "strong" or "visible" combing must be to be detected.
  7860. Larger values mean combing must be more visible and smaller values mean combing
  7861. can be less visible or strong and still be detected. Valid settings are from
  7862. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7863. be detected as combed). This is basically a pixel difference value. A good
  7864. range is @code{[8, 12]}.
  7865. Default value is @code{9}.
  7866. @item chroma
  7867. Sets whether or not chroma is considered in the combed frame decision. Only
  7868. disable this if your source has chroma problems (rainbowing, etc.) that are
  7869. causing problems for the combed frame detection with chroma enabled. Actually,
  7870. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7871. where there is chroma only combing in the source.
  7872. Default value is @code{0}.
  7873. @item blockx
  7874. @item blocky
  7875. Respectively set the x-axis and y-axis size of the window used during combed
  7876. frame detection. This has to do with the size of the area in which
  7877. @option{combpel} pixels are required to be detected as combed for a frame to be
  7878. declared combed. See the @option{combpel} parameter description for more info.
  7879. Possible values are any number that is a power of 2 starting at 4 and going up
  7880. to 512.
  7881. Default value is @code{16}.
  7882. @item combpel
  7883. The number of combed pixels inside any of the @option{blocky} by
  7884. @option{blockx} size blocks on the frame for the frame to be detected as
  7885. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7886. setting controls "how much" combing there must be in any localized area (a
  7887. window defined by the @option{blockx} and @option{blocky} settings) on the
  7888. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7889. which point no frames will ever be detected as combed). This setting is known
  7890. as @option{MI} in TFM/VFM vocabulary.
  7891. Default value is @code{80}.
  7892. @end table
  7893. @anchor{p/c/n/u/b meaning}
  7894. @subsection p/c/n/u/b meaning
  7895. @subsubsection p/c/n
  7896. We assume the following telecined stream:
  7897. @example
  7898. Top fields: 1 2 2 3 4
  7899. Bottom fields: 1 2 3 4 4
  7900. @end example
  7901. The numbers correspond to the progressive frame the fields relate to. Here, the
  7902. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7903. When @code{fieldmatch} is configured to run a matching from bottom
  7904. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7905. @example
  7906. Input stream:
  7907. T 1 2 2 3 4
  7908. B 1 2 3 4 4 <-- matching reference
  7909. Matches: c c n n c
  7910. Output stream:
  7911. T 1 2 3 4 4
  7912. B 1 2 3 4 4
  7913. @end example
  7914. As a result of the field matching, we can see that some frames get duplicated.
  7915. To perform a complete inverse telecine, you need to rely on a decimation filter
  7916. after this operation. See for instance the @ref{decimate} filter.
  7917. The same operation now matching from top fields (@option{field}=@var{top})
  7918. looks like this:
  7919. @example
  7920. Input stream:
  7921. T 1 2 2 3 4 <-- matching reference
  7922. B 1 2 3 4 4
  7923. Matches: c c p p c
  7924. Output stream:
  7925. T 1 2 2 3 4
  7926. B 1 2 2 3 4
  7927. @end example
  7928. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7929. basically, they refer to the frame and field of the opposite parity:
  7930. @itemize
  7931. @item @var{p} matches the field of the opposite parity in the previous frame
  7932. @item @var{c} matches the field of the opposite parity in the current frame
  7933. @item @var{n} matches the field of the opposite parity in the next frame
  7934. @end itemize
  7935. @subsubsection u/b
  7936. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7937. from the opposite parity flag. In the following examples, we assume that we are
  7938. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7939. 'x' is placed above and below each matched fields.
  7940. With bottom matching (@option{field}=@var{bottom}):
  7941. @example
  7942. Match: c p n b u
  7943. x x x x x
  7944. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7945. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7946. x x x x x
  7947. Output frames:
  7948. 2 1 2 2 2
  7949. 2 2 2 1 3
  7950. @end example
  7951. With top matching (@option{field}=@var{top}):
  7952. @example
  7953. Match: c p n b u
  7954. x x x x x
  7955. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7956. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7957. x x x x x
  7958. Output frames:
  7959. 2 2 2 1 2
  7960. 2 1 3 2 2
  7961. @end example
  7962. @subsection Examples
  7963. Simple IVTC of a top field first telecined stream:
  7964. @example
  7965. fieldmatch=order=tff:combmatch=none, decimate
  7966. @end example
  7967. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7968. @example
  7969. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7970. @end example
  7971. @section fieldorder
  7972. Transform the field order of the input video.
  7973. It accepts the following parameters:
  7974. @table @option
  7975. @item order
  7976. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7977. for bottom field first.
  7978. @end table
  7979. The default value is @samp{tff}.
  7980. The transformation is done by shifting the picture content up or down
  7981. by one line, and filling the remaining line with appropriate picture content.
  7982. This method is consistent with most broadcast field order converters.
  7983. If the input video is not flagged as being interlaced, or it is already
  7984. flagged as being of the required output field order, then this filter does
  7985. not alter the incoming video.
  7986. It is very useful when converting to or from PAL DV material,
  7987. which is bottom field first.
  7988. For example:
  7989. @example
  7990. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7991. @end example
  7992. @section fifo, afifo
  7993. Buffer input images and send them when they are requested.
  7994. It is mainly useful when auto-inserted by the libavfilter
  7995. framework.
  7996. It does not take parameters.
  7997. @section fillborders
  7998. Fill borders of the input video, without changing video stream dimensions.
  7999. Sometimes video can have garbage at the four edges and you may not want to
  8000. crop video input to keep size multiple of some number.
  8001. This filter accepts the following options:
  8002. @table @option
  8003. @item left
  8004. Number of pixels to fill from left border.
  8005. @item right
  8006. Number of pixels to fill from right border.
  8007. @item top
  8008. Number of pixels to fill from top border.
  8009. @item bottom
  8010. Number of pixels to fill from bottom border.
  8011. @item mode
  8012. Set fill mode.
  8013. It accepts the following values:
  8014. @table @samp
  8015. @item smear
  8016. fill pixels using outermost pixels
  8017. @item mirror
  8018. fill pixels using mirroring
  8019. @item fixed
  8020. fill pixels with constant value
  8021. @end table
  8022. Default is @var{smear}.
  8023. @item color
  8024. Set color for pixels in fixed mode. Default is @var{black}.
  8025. @end table
  8026. @section find_rect
  8027. Find a rectangular object
  8028. It accepts the following options:
  8029. @table @option
  8030. @item object
  8031. Filepath of the object image, needs to be in gray8.
  8032. @item threshold
  8033. Detection threshold, default is 0.5.
  8034. @item mipmaps
  8035. Number of mipmaps, default is 3.
  8036. @item xmin, ymin, xmax, ymax
  8037. Specifies the rectangle in which to search.
  8038. @end table
  8039. @subsection Examples
  8040. @itemize
  8041. @item
  8042. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8043. @example
  8044. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8045. @end example
  8046. @end itemize
  8047. @section floodfill
  8048. Flood area with values of same pixel components with another values.
  8049. It accepts the following options:
  8050. @table @option
  8051. @item x
  8052. Set pixel x coordinate.
  8053. @item y
  8054. Set pixel y coordinate.
  8055. @item s0
  8056. Set source #0 component value.
  8057. @item s1
  8058. Set source #1 component value.
  8059. @item s2
  8060. Set source #2 component value.
  8061. @item s3
  8062. Set source #3 component value.
  8063. @item d0
  8064. Set destination #0 component value.
  8065. @item d1
  8066. Set destination #1 component value.
  8067. @item d2
  8068. Set destination #2 component value.
  8069. @item d3
  8070. Set destination #3 component value.
  8071. @end table
  8072. @anchor{format}
  8073. @section format
  8074. Convert the input video to one of the specified pixel formats.
  8075. Libavfilter will try to pick one that is suitable as input to
  8076. the next filter.
  8077. It accepts the following parameters:
  8078. @table @option
  8079. @item pix_fmts
  8080. A '|'-separated list of pixel format names, such as
  8081. "pix_fmts=yuv420p|monow|rgb24".
  8082. @end table
  8083. @subsection Examples
  8084. @itemize
  8085. @item
  8086. Convert the input video to the @var{yuv420p} format
  8087. @example
  8088. format=pix_fmts=yuv420p
  8089. @end example
  8090. Convert the input video to any of the formats in the list
  8091. @example
  8092. format=pix_fmts=yuv420p|yuv444p|yuv410p
  8093. @end example
  8094. @end itemize
  8095. @anchor{fps}
  8096. @section fps
  8097. Convert the video to specified constant frame rate by duplicating or dropping
  8098. frames as necessary.
  8099. It accepts the following parameters:
  8100. @table @option
  8101. @item fps
  8102. The desired output frame rate. The default is @code{25}.
  8103. @item start_time
  8104. Assume the first PTS should be the given value, in seconds. This allows for
  8105. padding/trimming at the start of stream. By default, no assumption is made
  8106. about the first frame's expected PTS, so no padding or trimming is done.
  8107. For example, this could be set to 0 to pad the beginning with duplicates of
  8108. the first frame if a video stream starts after the audio stream or to trim any
  8109. frames with a negative PTS.
  8110. @item round
  8111. Timestamp (PTS) rounding method.
  8112. Possible values are:
  8113. @table @option
  8114. @item zero
  8115. round towards 0
  8116. @item inf
  8117. round away from 0
  8118. @item down
  8119. round towards -infinity
  8120. @item up
  8121. round towards +infinity
  8122. @item near
  8123. round to nearest
  8124. @end table
  8125. The default is @code{near}.
  8126. @item eof_action
  8127. Action performed when reading the last frame.
  8128. Possible values are:
  8129. @table @option
  8130. @item round
  8131. Use same timestamp rounding method as used for other frames.
  8132. @item pass
  8133. Pass through last frame if input duration has not been reached yet.
  8134. @end table
  8135. The default is @code{round}.
  8136. @end table
  8137. Alternatively, the options can be specified as a flat string:
  8138. @var{fps}[:@var{start_time}[:@var{round}]].
  8139. See also the @ref{setpts} filter.
  8140. @subsection Examples
  8141. @itemize
  8142. @item
  8143. A typical usage in order to set the fps to 25:
  8144. @example
  8145. fps=fps=25
  8146. @end example
  8147. @item
  8148. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  8149. @example
  8150. fps=fps=film:round=near
  8151. @end example
  8152. @end itemize
  8153. @section framepack
  8154. Pack two different video streams into a stereoscopic video, setting proper
  8155. metadata on supported codecs. The two views should have the same size and
  8156. framerate and processing will stop when the shorter video ends. Please note
  8157. that you may conveniently adjust view properties with the @ref{scale} and
  8158. @ref{fps} filters.
  8159. It accepts the following parameters:
  8160. @table @option
  8161. @item format
  8162. The desired packing format. Supported values are:
  8163. @table @option
  8164. @item sbs
  8165. The views are next to each other (default).
  8166. @item tab
  8167. The views are on top of each other.
  8168. @item lines
  8169. The views are packed by line.
  8170. @item columns
  8171. The views are packed by column.
  8172. @item frameseq
  8173. The views are temporally interleaved.
  8174. @end table
  8175. @end table
  8176. Some examples:
  8177. @example
  8178. # Convert left and right views into a frame-sequential video
  8179. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8180. # Convert views into a side-by-side video with the same output resolution as the input
  8181. 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
  8182. @end example
  8183. @section framerate
  8184. Change the frame rate by interpolating new video output frames from the source
  8185. frames.
  8186. This filter is not designed to function correctly with interlaced media. If
  8187. you wish to change the frame rate of interlaced media then you are required
  8188. to deinterlace before this filter and re-interlace after this filter.
  8189. A description of the accepted options follows.
  8190. @table @option
  8191. @item fps
  8192. Specify the output frames per second. This option can also be specified
  8193. as a value alone. The default is @code{50}.
  8194. @item interp_start
  8195. Specify the start of a range where the output frame will be created as a
  8196. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8197. the default is @code{15}.
  8198. @item interp_end
  8199. Specify the end of a range where the output frame will be created as a
  8200. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8201. the default is @code{240}.
  8202. @item scene
  8203. Specify the level at which a scene change is detected as a value between
  8204. 0 and 100 to indicate a new scene; a low value reflects a low
  8205. probability for the current frame to introduce a new scene, while a higher
  8206. value means the current frame is more likely to be one.
  8207. The default is @code{8.2}.
  8208. @item flags
  8209. Specify flags influencing the filter process.
  8210. Available value for @var{flags} is:
  8211. @table @option
  8212. @item scene_change_detect, scd
  8213. Enable scene change detection using the value of the option @var{scene}.
  8214. This flag is enabled by default.
  8215. @end table
  8216. @end table
  8217. @section framestep
  8218. Select one frame every N-th frame.
  8219. This filter accepts the following option:
  8220. @table @option
  8221. @item step
  8222. Select frame after every @code{step} frames.
  8223. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8224. @end table
  8225. @section freezedetect
  8226. Detect frozen video.
  8227. This filter logs a message and sets frame metadata when it detects that the
  8228. input video has no significant change in content during a specified duration.
  8229. Video freeze detection calculates the mean average absolute difference of all
  8230. the components of video frames and compares it to a noise floor.
  8231. The printed times and duration are expressed in seconds. The
  8232. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8233. whose timestamp equals or exceeds the detection duration and it contains the
  8234. timestamp of the first frame of the freeze. The
  8235. @code{lavfi.freezedetect.freeze_duration} and
  8236. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8237. after the freeze.
  8238. The filter accepts the following options:
  8239. @table @option
  8240. @item noise, n
  8241. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8242. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8243. 0.001.
  8244. @item duration, d
  8245. Set freeze duration until notification (default is 2 seconds).
  8246. @end table
  8247. @anchor{frei0r}
  8248. @section frei0r
  8249. Apply a frei0r effect to the input video.
  8250. To enable the compilation of this filter, you need to install the frei0r
  8251. header and configure FFmpeg with @code{--enable-frei0r}.
  8252. It accepts the following parameters:
  8253. @table @option
  8254. @item filter_name
  8255. The name of the frei0r effect to load. If the environment variable
  8256. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8257. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8258. Otherwise, the standard frei0r paths are searched, in this order:
  8259. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8260. @file{/usr/lib/frei0r-1/}.
  8261. @item filter_params
  8262. A '|'-separated list of parameters to pass to the frei0r effect.
  8263. @end table
  8264. A frei0r effect parameter can be a boolean (its value is either
  8265. "y" or "n"), a double, a color (specified as
  8266. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8267. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8268. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8269. a position (specified as @var{X}/@var{Y}, where
  8270. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8271. The number and types of parameters depend on the loaded effect. If an
  8272. effect parameter is not specified, the default value is set.
  8273. @subsection Examples
  8274. @itemize
  8275. @item
  8276. Apply the distort0r effect, setting the first two double parameters:
  8277. @example
  8278. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8279. @end example
  8280. @item
  8281. Apply the colordistance effect, taking a color as the first parameter:
  8282. @example
  8283. frei0r=colordistance:0.2/0.3/0.4
  8284. frei0r=colordistance:violet
  8285. frei0r=colordistance:0x112233
  8286. @end example
  8287. @item
  8288. Apply the perspective effect, specifying the top left and top right image
  8289. positions:
  8290. @example
  8291. frei0r=perspective:0.2/0.2|0.8/0.2
  8292. @end example
  8293. @end itemize
  8294. For more information, see
  8295. @url{http://frei0r.dyne.org}
  8296. @section fspp
  8297. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8298. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8299. processing filter, one of them is performed once per block, not per pixel.
  8300. This allows for much higher speed.
  8301. The filter accepts the following options:
  8302. @table @option
  8303. @item quality
  8304. Set quality. This option defines the number of levels for averaging. It accepts
  8305. an integer in the range 4-5. Default value is @code{4}.
  8306. @item qp
  8307. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8308. If not set, the filter will use the QP from the video stream (if available).
  8309. @item strength
  8310. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8311. more details but also more artifacts, while higher values make the image smoother
  8312. but also blurrier. Default value is @code{0} − PSNR optimal.
  8313. @item use_bframe_qp
  8314. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8315. option may cause flicker since the B-Frames have often larger QP. Default is
  8316. @code{0} (not enabled).
  8317. @end table
  8318. @section gblur
  8319. Apply Gaussian blur filter.
  8320. The filter accepts the following options:
  8321. @table @option
  8322. @item sigma
  8323. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8324. @item steps
  8325. Set number of steps for Gaussian approximation. Default is @code{1}.
  8326. @item planes
  8327. Set which planes to filter. By default all planes are filtered.
  8328. @item sigmaV
  8329. Set vertical sigma, if negative it will be same as @code{sigma}.
  8330. Default is @code{-1}.
  8331. @end table
  8332. @subsection Commands
  8333. This filter supports same commands as options.
  8334. The command accepts the same syntax of the corresponding option.
  8335. If the specified expression is not valid, it is kept at its current
  8336. value.
  8337. @section geq
  8338. Apply generic equation to each pixel.
  8339. The filter accepts the following options:
  8340. @table @option
  8341. @item lum_expr, lum
  8342. Set the luminance expression.
  8343. @item cb_expr, cb
  8344. Set the chrominance blue expression.
  8345. @item cr_expr, cr
  8346. Set the chrominance red expression.
  8347. @item alpha_expr, a
  8348. Set the alpha expression.
  8349. @item red_expr, r
  8350. Set the red expression.
  8351. @item green_expr, g
  8352. Set the green expression.
  8353. @item blue_expr, b
  8354. Set the blue expression.
  8355. @end table
  8356. The colorspace is selected according to the specified options. If one
  8357. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8358. options is specified, the filter will automatically select a YCbCr
  8359. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8360. @option{blue_expr} options is specified, it will select an RGB
  8361. colorspace.
  8362. If one of the chrominance expression is not defined, it falls back on the other
  8363. one. If no alpha expression is specified it will evaluate to opaque value.
  8364. If none of chrominance expressions are specified, they will evaluate
  8365. to the luminance expression.
  8366. The expressions can use the following variables and functions:
  8367. @table @option
  8368. @item N
  8369. The sequential number of the filtered frame, starting from @code{0}.
  8370. @item X
  8371. @item Y
  8372. The coordinates of the current sample.
  8373. @item W
  8374. @item H
  8375. The width and height of the image.
  8376. @item SW
  8377. @item SH
  8378. Width and height scale depending on the currently filtered plane. It is the
  8379. ratio between the corresponding luma plane number of pixels and the current
  8380. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8381. @code{0.5,0.5} for chroma planes.
  8382. @item T
  8383. Time of the current frame, expressed in seconds.
  8384. @item p(x, y)
  8385. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8386. plane.
  8387. @item lum(x, y)
  8388. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8389. plane.
  8390. @item cb(x, y)
  8391. Return the value of the pixel at location (@var{x},@var{y}) of the
  8392. blue-difference chroma plane. Return 0 if there is no such plane.
  8393. @item cr(x, y)
  8394. Return the value of the pixel at location (@var{x},@var{y}) of the
  8395. red-difference chroma plane. Return 0 if there is no such plane.
  8396. @item r(x, y)
  8397. @item g(x, y)
  8398. @item b(x, y)
  8399. Return the value of the pixel at location (@var{x},@var{y}) of the
  8400. red/green/blue component. Return 0 if there is no such component.
  8401. @item alpha(x, y)
  8402. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8403. plane. Return 0 if there is no such plane.
  8404. @end table
  8405. For functions, if @var{x} and @var{y} are outside the area, the value will be
  8406. automatically clipped to the closer edge.
  8407. @subsection Examples
  8408. @itemize
  8409. @item
  8410. Flip the image horizontally:
  8411. @example
  8412. geq=p(W-X\,Y)
  8413. @end example
  8414. @item
  8415. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  8416. wavelength of 100 pixels:
  8417. @example
  8418. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  8419. @end example
  8420. @item
  8421. Generate a fancy enigmatic moving light:
  8422. @example
  8423. 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
  8424. @end example
  8425. @item
  8426. Generate a quick emboss effect:
  8427. @example
  8428. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  8429. @end example
  8430. @item
  8431. Modify RGB components depending on pixel position:
  8432. @example
  8433. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  8434. @end example
  8435. @item
  8436. Create a radial gradient that is the same size as the input (also see
  8437. the @ref{vignette} filter):
  8438. @example
  8439. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8440. @end example
  8441. @end itemize
  8442. @section gradfun
  8443. Fix the banding artifacts that are sometimes introduced into nearly flat
  8444. regions by truncation to 8-bit color depth.
  8445. Interpolate the gradients that should go where the bands are, and
  8446. dither them.
  8447. It is designed for playback only. Do not use it prior to
  8448. lossy compression, because compression tends to lose the dither and
  8449. bring back the bands.
  8450. It accepts the following parameters:
  8451. @table @option
  8452. @item strength
  8453. The maximum amount by which the filter will change any one pixel. This is also
  8454. the threshold for detecting nearly flat regions. Acceptable values range from
  8455. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8456. valid range.
  8457. @item radius
  8458. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8459. gradients, but also prevents the filter from modifying the pixels near detailed
  8460. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8461. values will be clipped to the valid range.
  8462. @end table
  8463. Alternatively, the options can be specified as a flat string:
  8464. @var{strength}[:@var{radius}]
  8465. @subsection Examples
  8466. @itemize
  8467. @item
  8468. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8469. @example
  8470. gradfun=3.5:8
  8471. @end example
  8472. @item
  8473. Specify radius, omitting the strength (which will fall-back to the default
  8474. value):
  8475. @example
  8476. gradfun=radius=8
  8477. @end example
  8478. @end itemize
  8479. @section graphmonitor, agraphmonitor
  8480. Show various filtergraph stats.
  8481. With this filter one can debug complete filtergraph.
  8482. Especially issues with links filling with queued frames.
  8483. The filter accepts the following options:
  8484. @table @option
  8485. @item size, s
  8486. Set video output size. Default is @var{hd720}.
  8487. @item opacity, o
  8488. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8489. @item mode, m
  8490. Set output mode, can be @var{fulll} or @var{compact}.
  8491. In @var{compact} mode only filters with some queued frames have displayed stats.
  8492. @item flags, f
  8493. Set flags which enable which stats are shown in video.
  8494. Available values for flags are:
  8495. @table @samp
  8496. @item queue
  8497. Display number of queued frames in each link.
  8498. @item frame_count_in
  8499. Display number of frames taken from filter.
  8500. @item frame_count_out
  8501. Display number of frames given out from filter.
  8502. @item pts
  8503. Display current filtered frame pts.
  8504. @item time
  8505. Display current filtered frame time.
  8506. @item timebase
  8507. Display time base for filter link.
  8508. @item format
  8509. Display used format for filter link.
  8510. @item size
  8511. Display video size or number of audio channels in case of audio used by filter link.
  8512. @item rate
  8513. Display video frame rate or sample rate in case of audio used by filter link.
  8514. @end table
  8515. @item rate, r
  8516. Set upper limit for video rate of output stream, Default value is @var{25}.
  8517. This guarantee that output video frame rate will not be higher than this value.
  8518. @end table
  8519. @section greyedge
  8520. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8521. and corrects the scene colors accordingly.
  8522. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8523. The filter accepts the following options:
  8524. @table @option
  8525. @item difford
  8526. The order of differentiation to be applied on the scene. Must be chosen in the range
  8527. [0,2] and default value is 1.
  8528. @item minknorm
  8529. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8530. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8531. max value instead of calculating Minkowski distance.
  8532. @item sigma
  8533. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8534. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8535. can't be equal to 0 if @var{difford} is greater than 0.
  8536. @end table
  8537. @subsection Examples
  8538. @itemize
  8539. @item
  8540. Grey Edge:
  8541. @example
  8542. greyedge=difford=1:minknorm=5:sigma=2
  8543. @end example
  8544. @item
  8545. Max Edge:
  8546. @example
  8547. greyedge=difford=1:minknorm=0:sigma=2
  8548. @end example
  8549. @end itemize
  8550. @anchor{haldclut}
  8551. @section haldclut
  8552. Apply a Hald CLUT to a video stream.
  8553. First input is the video stream to process, and second one is the Hald CLUT.
  8554. The Hald CLUT input can be a simple picture or a complete video stream.
  8555. The filter accepts the following options:
  8556. @table @option
  8557. @item shortest
  8558. Force termination when the shortest input terminates. Default is @code{0}.
  8559. @item repeatlast
  8560. Continue applying the last CLUT after the end of the stream. A value of
  8561. @code{0} disable the filter after the last frame of the CLUT is reached.
  8562. Default is @code{1}.
  8563. @end table
  8564. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8565. filters share the same internals).
  8566. This filter also supports the @ref{framesync} options.
  8567. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8568. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8569. @subsection Workflow examples
  8570. @subsubsection Hald CLUT video stream
  8571. Generate an identity Hald CLUT stream altered with various effects:
  8572. @example
  8573. 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
  8574. @end example
  8575. Note: make sure you use a lossless codec.
  8576. Then use it with @code{haldclut} to apply it on some random stream:
  8577. @example
  8578. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8579. @end example
  8580. The Hald CLUT will be applied to the 10 first seconds (duration of
  8581. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8582. to the remaining frames of the @code{mandelbrot} stream.
  8583. @subsubsection Hald CLUT with preview
  8584. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8585. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8586. biggest possible square starting at the top left of the picture. The remaining
  8587. padding pixels (bottom or right) will be ignored. This area can be used to add
  8588. a preview of the Hald CLUT.
  8589. Typically, the following generated Hald CLUT will be supported by the
  8590. @code{haldclut} filter:
  8591. @example
  8592. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8593. pad=iw+320 [padded_clut];
  8594. smptebars=s=320x256, split [a][b];
  8595. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8596. [main][b] overlay=W-320" -frames:v 1 clut.png
  8597. @end example
  8598. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8599. bars are displayed on the right-top, and below the same color bars processed by
  8600. the color changes.
  8601. Then, the effect of this Hald CLUT can be visualized with:
  8602. @example
  8603. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8604. @end example
  8605. @section hflip
  8606. Flip the input video horizontally.
  8607. For example, to horizontally flip the input video with @command{ffmpeg}:
  8608. @example
  8609. ffmpeg -i in.avi -vf "hflip" out.avi
  8610. @end example
  8611. @section histeq
  8612. This filter applies a global color histogram equalization on a
  8613. per-frame basis.
  8614. It can be used to correct video that has a compressed range of pixel
  8615. intensities. The filter redistributes the pixel intensities to
  8616. equalize their distribution across the intensity range. It may be
  8617. viewed as an "automatically adjusting contrast filter". This filter is
  8618. useful only for correcting degraded or poorly captured source
  8619. video.
  8620. The filter accepts the following options:
  8621. @table @option
  8622. @item strength
  8623. Determine the amount of equalization to be applied. As the strength
  8624. is reduced, the distribution of pixel intensities more-and-more
  8625. approaches that of the input frame. The value must be a float number
  8626. in the range [0,1] and defaults to 0.200.
  8627. @item intensity
  8628. Set the maximum intensity that can generated and scale the output
  8629. values appropriately. The strength should be set as desired and then
  8630. the intensity can be limited if needed to avoid washing-out. The value
  8631. must be a float number in the range [0,1] and defaults to 0.210.
  8632. @item antibanding
  8633. Set the antibanding level. If enabled the filter will randomly vary
  8634. the luminance of output pixels by a small amount to avoid banding of
  8635. the histogram. Possible values are @code{none}, @code{weak} or
  8636. @code{strong}. It defaults to @code{none}.
  8637. @end table
  8638. @section histogram
  8639. Compute and draw a color distribution histogram for the input video.
  8640. The computed histogram is a representation of the color component
  8641. distribution in an image.
  8642. Standard histogram displays the color components distribution in an image.
  8643. Displays color graph for each color component. Shows distribution of
  8644. the Y, U, V, A or R, G, B components, depending on input format, in the
  8645. current frame. Below each graph a color component scale meter is shown.
  8646. The filter accepts the following options:
  8647. @table @option
  8648. @item level_height
  8649. Set height of level. Default value is @code{200}.
  8650. Allowed range is [50, 2048].
  8651. @item scale_height
  8652. Set height of color scale. Default value is @code{12}.
  8653. Allowed range is [0, 40].
  8654. @item display_mode
  8655. Set display mode.
  8656. It accepts the following values:
  8657. @table @samp
  8658. @item stack
  8659. Per color component graphs are placed below each other.
  8660. @item parade
  8661. Per color component graphs are placed side by side.
  8662. @item overlay
  8663. Presents information identical to that in the @code{parade}, except
  8664. that the graphs representing color components are superimposed directly
  8665. over one another.
  8666. @end table
  8667. Default is @code{stack}.
  8668. @item levels_mode
  8669. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8670. Default is @code{linear}.
  8671. @item components
  8672. Set what color components to display.
  8673. Default is @code{7}.
  8674. @item fgopacity
  8675. Set foreground opacity. Default is @code{0.7}.
  8676. @item bgopacity
  8677. Set background opacity. Default is @code{0.5}.
  8678. @end table
  8679. @subsection Examples
  8680. @itemize
  8681. @item
  8682. Calculate and draw histogram:
  8683. @example
  8684. ffplay -i input -vf histogram
  8685. @end example
  8686. @end itemize
  8687. @anchor{hqdn3d}
  8688. @section hqdn3d
  8689. This is a high precision/quality 3d denoise filter. It aims to reduce
  8690. image noise, producing smooth images and making still images really
  8691. still. It should enhance compressibility.
  8692. It accepts the following optional parameters:
  8693. @table @option
  8694. @item luma_spatial
  8695. A non-negative floating point number which specifies spatial luma strength.
  8696. It defaults to 4.0.
  8697. @item chroma_spatial
  8698. A non-negative floating point number which specifies spatial chroma strength.
  8699. It defaults to 3.0*@var{luma_spatial}/4.0.
  8700. @item luma_tmp
  8701. A floating point number which specifies luma temporal strength. It defaults to
  8702. 6.0*@var{luma_spatial}/4.0.
  8703. @item chroma_tmp
  8704. A floating point number which specifies chroma temporal strength. It defaults to
  8705. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8706. @end table
  8707. @anchor{hwdownload}
  8708. @section hwdownload
  8709. Download hardware frames to system memory.
  8710. The input must be in hardware frames, and the output a non-hardware format.
  8711. Not all formats will be supported on the output - it may be necessary to insert
  8712. an additional @option{format} filter immediately following in the graph to get
  8713. the output in a supported format.
  8714. @section hwmap
  8715. Map hardware frames to system memory or to another device.
  8716. This filter has several different modes of operation; which one is used depends
  8717. on the input and output formats:
  8718. @itemize
  8719. @item
  8720. Hardware frame input, normal frame output
  8721. Map the input frames to system memory and pass them to the output. If the
  8722. original hardware frame is later required (for example, after overlaying
  8723. something else on part of it), the @option{hwmap} filter can be used again
  8724. in the next mode to retrieve it.
  8725. @item
  8726. Normal frame input, hardware frame output
  8727. If the input is actually a software-mapped hardware frame, then unmap it -
  8728. that is, return the original hardware frame.
  8729. Otherwise, a device must be provided. Create new hardware surfaces on that
  8730. device for the output, then map them back to the software format at the input
  8731. and give those frames to the preceding filter. This will then act like the
  8732. @option{hwupload} filter, but may be able to avoid an additional copy when
  8733. the input is already in a compatible format.
  8734. @item
  8735. Hardware frame input and output
  8736. A device must be supplied for the output, either directly or with the
  8737. @option{derive_device} option. The input and output devices must be of
  8738. different types and compatible - the exact meaning of this is
  8739. system-dependent, but typically it means that they must refer to the same
  8740. underlying hardware context (for example, refer to the same graphics card).
  8741. If the input frames were originally created on the output device, then unmap
  8742. to retrieve the original frames.
  8743. Otherwise, map the frames to the output device - create new hardware frames
  8744. on the output corresponding to the frames on the input.
  8745. @end itemize
  8746. The following additional parameters are accepted:
  8747. @table @option
  8748. @item mode
  8749. Set the frame mapping mode. Some combination of:
  8750. @table @var
  8751. @item read
  8752. The mapped frame should be readable.
  8753. @item write
  8754. The mapped frame should be writeable.
  8755. @item overwrite
  8756. The mapping will always overwrite the entire frame.
  8757. This may improve performance in some cases, as the original contents of the
  8758. frame need not be loaded.
  8759. @item direct
  8760. The mapping must not involve any copying.
  8761. Indirect mappings to copies of frames are created in some cases where either
  8762. direct mapping is not possible or it would have unexpected properties.
  8763. Setting this flag ensures that the mapping is direct and will fail if that is
  8764. not possible.
  8765. @end table
  8766. Defaults to @var{read+write} if not specified.
  8767. @item derive_device @var{type}
  8768. Rather than using the device supplied at initialisation, instead derive a new
  8769. device of type @var{type} from the device the input frames exist on.
  8770. @item reverse
  8771. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8772. and map them back to the source. This may be necessary in some cases where
  8773. a mapping in one direction is required but only the opposite direction is
  8774. supported by the devices being used.
  8775. This option is dangerous - it may break the preceding filter in undefined
  8776. ways if there are any additional constraints on that filter's output.
  8777. Do not use it without fully understanding the implications of its use.
  8778. @end table
  8779. @anchor{hwupload}
  8780. @section hwupload
  8781. Upload system memory frames to hardware surfaces.
  8782. The device to upload to must be supplied when the filter is initialised. If
  8783. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8784. option.
  8785. @anchor{hwupload_cuda}
  8786. @section hwupload_cuda
  8787. Upload system memory frames to a CUDA device.
  8788. It accepts the following optional parameters:
  8789. @table @option
  8790. @item device
  8791. The number of the CUDA device to use
  8792. @end table
  8793. @section hqx
  8794. Apply a high-quality magnification filter designed for pixel art. This filter
  8795. was originally created by Maxim Stepin.
  8796. It accepts the following option:
  8797. @table @option
  8798. @item n
  8799. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8800. @code{hq3x} and @code{4} for @code{hq4x}.
  8801. Default is @code{3}.
  8802. @end table
  8803. @section hstack
  8804. Stack input videos horizontally.
  8805. All streams must be of same pixel format and of same height.
  8806. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8807. to create same output.
  8808. The filter accepts the following option:
  8809. @table @option
  8810. @item inputs
  8811. Set number of input streams. Default is 2.
  8812. @item shortest
  8813. If set to 1, force the output to terminate when the shortest input
  8814. terminates. Default value is 0.
  8815. @end table
  8816. @section hue
  8817. Modify the hue and/or the saturation of the input.
  8818. It accepts the following parameters:
  8819. @table @option
  8820. @item h
  8821. Specify the hue angle as a number of degrees. It accepts an expression,
  8822. and defaults to "0".
  8823. @item s
  8824. Specify the saturation in the [-10,10] range. It accepts an expression and
  8825. defaults to "1".
  8826. @item H
  8827. Specify the hue angle as a number of radians. It accepts an
  8828. expression, and defaults to "0".
  8829. @item b
  8830. Specify the brightness in the [-10,10] range. It accepts an expression and
  8831. defaults to "0".
  8832. @end table
  8833. @option{h} and @option{H} are mutually exclusive, and can't be
  8834. specified at the same time.
  8835. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8836. expressions containing the following constants:
  8837. @table @option
  8838. @item n
  8839. frame count of the input frame starting from 0
  8840. @item pts
  8841. presentation timestamp of the input frame expressed in time base units
  8842. @item r
  8843. frame rate of the input video, NAN if the input frame rate is unknown
  8844. @item t
  8845. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8846. @item tb
  8847. time base of the input video
  8848. @end table
  8849. @subsection Examples
  8850. @itemize
  8851. @item
  8852. Set the hue to 90 degrees and the saturation to 1.0:
  8853. @example
  8854. hue=h=90:s=1
  8855. @end example
  8856. @item
  8857. Same command but expressing the hue in radians:
  8858. @example
  8859. hue=H=PI/2:s=1
  8860. @end example
  8861. @item
  8862. Rotate hue and make the saturation swing between 0
  8863. and 2 over a period of 1 second:
  8864. @example
  8865. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8866. @end example
  8867. @item
  8868. Apply a 3 seconds saturation fade-in effect starting at 0:
  8869. @example
  8870. hue="s=min(t/3\,1)"
  8871. @end example
  8872. The general fade-in expression can be written as:
  8873. @example
  8874. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8875. @end example
  8876. @item
  8877. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8878. @example
  8879. hue="s=max(0\, min(1\, (8-t)/3))"
  8880. @end example
  8881. The general fade-out expression can be written as:
  8882. @example
  8883. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8884. @end example
  8885. @end itemize
  8886. @subsection Commands
  8887. This filter supports the following commands:
  8888. @table @option
  8889. @item b
  8890. @item s
  8891. @item h
  8892. @item H
  8893. Modify the hue and/or the saturation and/or brightness of the input video.
  8894. The command accepts the same syntax of the corresponding option.
  8895. If the specified expression is not valid, it is kept at its current
  8896. value.
  8897. @end table
  8898. @section hysteresis
  8899. Grow first stream into second stream by connecting components.
  8900. This makes it possible to build more robust edge masks.
  8901. This filter accepts the following options:
  8902. @table @option
  8903. @item planes
  8904. Set which planes will be processed as bitmap, unprocessed planes will be
  8905. copied from first stream.
  8906. By default value 0xf, all planes will be processed.
  8907. @item threshold
  8908. Set threshold which is used in filtering. If pixel component value is higher than
  8909. this value filter algorithm for connecting components is activated.
  8910. By default value is 0.
  8911. @end table
  8912. @section idet
  8913. Detect video interlacing type.
  8914. This filter tries to detect if the input frames are interlaced, progressive,
  8915. top or bottom field first. It will also try to detect fields that are
  8916. repeated between adjacent frames (a sign of telecine).
  8917. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8918. Multiple frame detection incorporates the classification history of previous frames.
  8919. The filter will log these metadata values:
  8920. @table @option
  8921. @item single.current_frame
  8922. Detected type of current frame using single-frame detection. One of:
  8923. ``tff'' (top field first), ``bff'' (bottom field first),
  8924. ``progressive'', or ``undetermined''
  8925. @item single.tff
  8926. Cumulative number of frames detected as top field first using single-frame detection.
  8927. @item multiple.tff
  8928. Cumulative number of frames detected as top field first using multiple-frame detection.
  8929. @item single.bff
  8930. Cumulative number of frames detected as bottom field first using single-frame detection.
  8931. @item multiple.current_frame
  8932. Detected type of current frame using multiple-frame detection. One of:
  8933. ``tff'' (top field first), ``bff'' (bottom field first),
  8934. ``progressive'', or ``undetermined''
  8935. @item multiple.bff
  8936. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8937. @item single.progressive
  8938. Cumulative number of frames detected as progressive using single-frame detection.
  8939. @item multiple.progressive
  8940. Cumulative number of frames detected as progressive using multiple-frame detection.
  8941. @item single.undetermined
  8942. Cumulative number of frames that could not be classified using single-frame detection.
  8943. @item multiple.undetermined
  8944. Cumulative number of frames that could not be classified using multiple-frame detection.
  8945. @item repeated.current_frame
  8946. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8947. @item repeated.neither
  8948. Cumulative number of frames with no repeated field.
  8949. @item repeated.top
  8950. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8951. @item repeated.bottom
  8952. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8953. @end table
  8954. The filter accepts the following options:
  8955. @table @option
  8956. @item intl_thres
  8957. Set interlacing threshold.
  8958. @item prog_thres
  8959. Set progressive threshold.
  8960. @item rep_thres
  8961. Threshold for repeated field detection.
  8962. @item half_life
  8963. Number of frames after which a given frame's contribution to the
  8964. statistics is halved (i.e., it contributes only 0.5 to its
  8965. classification). The default of 0 means that all frames seen are given
  8966. full weight of 1.0 forever.
  8967. @item analyze_interlaced_flag
  8968. When this is not 0 then idet will use the specified number of frames to determine
  8969. if the interlaced flag is accurate, it will not count undetermined frames.
  8970. If the flag is found to be accurate it will be used without any further
  8971. computations, if it is found to be inaccurate it will be cleared without any
  8972. further computations. This allows inserting the idet filter as a low computational
  8973. method to clean up the interlaced flag
  8974. @end table
  8975. @section il
  8976. Deinterleave or interleave fields.
  8977. This filter allows one to process interlaced images fields without
  8978. deinterlacing them. Deinterleaving splits the input frame into 2
  8979. fields (so called half pictures). Odd lines are moved to the top
  8980. half of the output image, even lines to the bottom half.
  8981. You can process (filter) them independently and then re-interleave them.
  8982. The filter accepts the following options:
  8983. @table @option
  8984. @item luma_mode, l
  8985. @item chroma_mode, c
  8986. @item alpha_mode, a
  8987. Available values for @var{luma_mode}, @var{chroma_mode} and
  8988. @var{alpha_mode} are:
  8989. @table @samp
  8990. @item none
  8991. Do nothing.
  8992. @item deinterleave, d
  8993. Deinterleave fields, placing one above the other.
  8994. @item interleave, i
  8995. Interleave fields. Reverse the effect of deinterleaving.
  8996. @end table
  8997. Default value is @code{none}.
  8998. @item luma_swap, ls
  8999. @item chroma_swap, cs
  9000. @item alpha_swap, as
  9001. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  9002. @end table
  9003. @section inflate
  9004. Apply inflate effect to the video.
  9005. This filter replaces the pixel by the local(3x3) average by taking into account
  9006. only values higher than the pixel.
  9007. It accepts the following options:
  9008. @table @option
  9009. @item threshold0
  9010. @item threshold1
  9011. @item threshold2
  9012. @item threshold3
  9013. Limit the maximum change for each plane, default is 65535.
  9014. If 0, plane will remain unchanged.
  9015. @end table
  9016. @section interlace
  9017. Simple interlacing filter from progressive contents. This interleaves upper (or
  9018. lower) lines from odd frames with lower (or upper) lines from even frames,
  9019. halving the frame rate and preserving image height.
  9020. @example
  9021. Original Original New Frame
  9022. Frame 'j' Frame 'j+1' (tff)
  9023. ========== =========== ==================
  9024. Line 0 --------------------> Frame 'j' Line 0
  9025. Line 1 Line 1 ----> Frame 'j+1' Line 1
  9026. Line 2 ---------------------> Frame 'j' Line 2
  9027. Line 3 Line 3 ----> Frame 'j+1' Line 3
  9028. ... ... ...
  9029. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  9030. @end example
  9031. It accepts the following optional parameters:
  9032. @table @option
  9033. @item scan
  9034. This determines whether the interlaced frame is taken from the even
  9035. (tff - default) or odd (bff) lines of the progressive frame.
  9036. @item lowpass
  9037. Vertical lowpass filter to avoid twitter interlacing and
  9038. reduce moire patterns.
  9039. @table @samp
  9040. @item 0, off
  9041. Disable vertical lowpass filter
  9042. @item 1, linear
  9043. Enable linear filter (default)
  9044. @item 2, complex
  9045. Enable complex filter. This will slightly less reduce twitter and moire
  9046. but better retain detail and subjective sharpness impression.
  9047. @end table
  9048. @end table
  9049. @section kerndeint
  9050. Deinterlace input video by applying Donald Graft's adaptive kernel
  9051. deinterling. Work on interlaced parts of a video to produce
  9052. progressive frames.
  9053. The description of the accepted parameters follows.
  9054. @table @option
  9055. @item thresh
  9056. Set the threshold which affects the filter's tolerance when
  9057. determining if a pixel line must be processed. It must be an integer
  9058. in the range [0,255] and defaults to 10. A value of 0 will result in
  9059. applying the process on every pixels.
  9060. @item map
  9061. Paint pixels exceeding the threshold value to white if set to 1.
  9062. Default is 0.
  9063. @item order
  9064. Set the fields order. Swap fields if set to 1, leave fields alone if
  9065. 0. Default is 0.
  9066. @item sharp
  9067. Enable additional sharpening if set to 1. Default is 0.
  9068. @item twoway
  9069. Enable twoway sharpening if set to 1. Default is 0.
  9070. @end table
  9071. @subsection Examples
  9072. @itemize
  9073. @item
  9074. Apply default values:
  9075. @example
  9076. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  9077. @end example
  9078. @item
  9079. Enable additional sharpening:
  9080. @example
  9081. kerndeint=sharp=1
  9082. @end example
  9083. @item
  9084. Paint processed pixels in white:
  9085. @example
  9086. kerndeint=map=1
  9087. @end example
  9088. @end itemize
  9089. @section lagfun
  9090. Slowly update darker pixels.
  9091. This filter makes short flashes of light appear longer.
  9092. This filter accepts the following options:
  9093. @table @option
  9094. @item decay
  9095. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  9096. @item planes
  9097. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  9098. @end table
  9099. @section lenscorrection
  9100. Correct radial lens distortion
  9101. This filter can be used to correct for radial distortion as can result from the use
  9102. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  9103. one can use tools available for example as part of opencv or simply trial-and-error.
  9104. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  9105. and extract the k1 and k2 coefficients from the resulting matrix.
  9106. Note that effectively the same filter is available in the open-source tools Krita and
  9107. Digikam from the KDE project.
  9108. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  9109. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  9110. brightness distribution, so you may want to use both filters together in certain
  9111. cases, though you will have to take care of ordering, i.e. whether vignetting should
  9112. be applied before or after lens correction.
  9113. @subsection Options
  9114. The filter accepts the following options:
  9115. @table @option
  9116. @item cx
  9117. Relative x-coordinate of the focal point of the image, and thereby the center of the
  9118. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9119. width. Default is 0.5.
  9120. @item cy
  9121. Relative y-coordinate of the focal point of the image, and thereby the center of the
  9122. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9123. height. Default is 0.5.
  9124. @item k1
  9125. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  9126. no correction. Default is 0.
  9127. @item k2
  9128. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  9129. 0 means no correction. Default is 0.
  9130. @end table
  9131. The formula that generates the correction is:
  9132. @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)
  9133. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  9134. distances from the focal point in the source and target images, respectively.
  9135. @section lensfun
  9136. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  9137. The @code{lensfun} filter requires the camera make, camera model, and lens model
  9138. to apply the lens correction. The filter will load the lensfun database and
  9139. query it to find the corresponding camera and lens entries in the database. As
  9140. long as these entries can be found with the given options, the filter can
  9141. perform corrections on frames. Note that incomplete strings will result in the
  9142. filter choosing the best match with the given options, and the filter will
  9143. output the chosen camera and lens models (logged with level "info"). You must
  9144. provide the make, camera model, and lens model as they are required.
  9145. The filter accepts the following options:
  9146. @table @option
  9147. @item make
  9148. The make of the camera (for example, "Canon"). This option is required.
  9149. @item model
  9150. The model of the camera (for example, "Canon EOS 100D"). This option is
  9151. required.
  9152. @item lens_model
  9153. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  9154. option is required.
  9155. @item mode
  9156. The type of correction to apply. The following values are valid options:
  9157. @table @samp
  9158. @item vignetting
  9159. Enables fixing lens vignetting.
  9160. @item geometry
  9161. Enables fixing lens geometry. This is the default.
  9162. @item subpixel
  9163. Enables fixing chromatic aberrations.
  9164. @item vig_geo
  9165. Enables fixing lens vignetting and lens geometry.
  9166. @item vig_subpixel
  9167. Enables fixing lens vignetting and chromatic aberrations.
  9168. @item distortion
  9169. Enables fixing both lens geometry and chromatic aberrations.
  9170. @item all
  9171. Enables all possible corrections.
  9172. @end table
  9173. @item focal_length
  9174. The focal length of the image/video (zoom; expected constant for video). For
  9175. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  9176. range should be chosen when using that lens. Default 18.
  9177. @item aperture
  9178. The aperture of the image/video (expected constant for video). Note that
  9179. aperture is only used for vignetting correction. Default 3.5.
  9180. @item focus_distance
  9181. The focus distance of the image/video (expected constant for video). Note that
  9182. focus distance is only used for vignetting and only slightly affects the
  9183. vignetting correction process. If unknown, leave it at the default value (which
  9184. is 1000).
  9185. @item scale
  9186. The scale factor which is applied after transformation. After correction the
  9187. video is no longer necessarily rectangular. This parameter controls how much of
  9188. the resulting image is visible. The value 0 means that a value will be chosen
  9189. automatically such that there is little or no unmapped area in the output
  9190. image. 1.0 means that no additional scaling is done. Lower values may result
  9191. in more of the corrected image being visible, while higher values may avoid
  9192. unmapped areas in the output.
  9193. @item target_geometry
  9194. The target geometry of the output image/video. The following values are valid
  9195. options:
  9196. @table @samp
  9197. @item rectilinear (default)
  9198. @item fisheye
  9199. @item panoramic
  9200. @item equirectangular
  9201. @item fisheye_orthographic
  9202. @item fisheye_stereographic
  9203. @item fisheye_equisolid
  9204. @item fisheye_thoby
  9205. @end table
  9206. @item reverse
  9207. Apply the reverse of image correction (instead of correcting distortion, apply
  9208. it).
  9209. @item interpolation
  9210. The type of interpolation used when correcting distortion. The following values
  9211. are valid options:
  9212. @table @samp
  9213. @item nearest
  9214. @item linear (default)
  9215. @item lanczos
  9216. @end table
  9217. @end table
  9218. @subsection Examples
  9219. @itemize
  9220. @item
  9221. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9222. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9223. aperture of "8.0".
  9224. @example
  9225. 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
  9226. @end example
  9227. @item
  9228. Apply the same as before, but only for the first 5 seconds of video.
  9229. @example
  9230. 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
  9231. @end example
  9232. @end itemize
  9233. @section libvmaf
  9234. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9235. score between two input videos.
  9236. The obtained VMAF score is printed through the logging system.
  9237. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9238. After installing the library it can be enabled using:
  9239. @code{./configure --enable-libvmaf --enable-version3}.
  9240. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9241. The filter has following options:
  9242. @table @option
  9243. @item model_path
  9244. Set the model path which is to be used for SVM.
  9245. Default value: @code{"vmaf_v0.6.1.pkl"}
  9246. @item log_path
  9247. Set the file path to be used to store logs.
  9248. @item log_fmt
  9249. Set the format of the log file (xml or json).
  9250. @item enable_transform
  9251. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  9252. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  9253. Default value: @code{false}
  9254. @item phone_model
  9255. Invokes the phone model which will generate VMAF scores higher than in the
  9256. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  9257. @item psnr
  9258. Enables computing psnr along with vmaf.
  9259. @item ssim
  9260. Enables computing ssim along with vmaf.
  9261. @item ms_ssim
  9262. Enables computing ms_ssim along with vmaf.
  9263. @item pool
  9264. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  9265. @item n_threads
  9266. Set number of threads to be used when computing vmaf.
  9267. @item n_subsample
  9268. Set interval for frame subsampling used when computing vmaf.
  9269. @item enable_conf_interval
  9270. Enables confidence interval.
  9271. @end table
  9272. This filter also supports the @ref{framesync} options.
  9273. On the below examples the input file @file{main.mpg} being processed is
  9274. compared with the reference file @file{ref.mpg}.
  9275. @example
  9276. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  9277. @end example
  9278. Example with options:
  9279. @example
  9280. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  9281. @end example
  9282. @section limiter
  9283. Limits the pixel components values to the specified range [min, max].
  9284. The filter accepts the following options:
  9285. @table @option
  9286. @item min
  9287. Lower bound. Defaults to the lowest allowed value for the input.
  9288. @item max
  9289. Upper bound. Defaults to the highest allowed value for the input.
  9290. @item planes
  9291. Specify which planes will be processed. Defaults to all available.
  9292. @end table
  9293. @section loop
  9294. Loop video frames.
  9295. The filter accepts the following options:
  9296. @table @option
  9297. @item loop
  9298. Set the number of loops. Setting this value to -1 will result in infinite loops.
  9299. Default is 0.
  9300. @item size
  9301. Set maximal size in number of frames. Default is 0.
  9302. @item start
  9303. Set first frame of loop. Default is 0.
  9304. @end table
  9305. @subsection Examples
  9306. @itemize
  9307. @item
  9308. Loop single first frame infinitely:
  9309. @example
  9310. loop=loop=-1:size=1:start=0
  9311. @end example
  9312. @item
  9313. Loop single first frame 10 times:
  9314. @example
  9315. loop=loop=10:size=1:start=0
  9316. @end example
  9317. @item
  9318. Loop 10 first frames 5 times:
  9319. @example
  9320. loop=loop=5:size=10:start=0
  9321. @end example
  9322. @end itemize
  9323. @section lut1d
  9324. Apply a 1D LUT to an input video.
  9325. The filter accepts the following options:
  9326. @table @option
  9327. @item file
  9328. Set the 1D LUT file name.
  9329. Currently supported formats:
  9330. @table @samp
  9331. @item cube
  9332. Iridas
  9333. @item csp
  9334. cineSpace
  9335. @end table
  9336. @item interp
  9337. Select interpolation mode.
  9338. Available values are:
  9339. @table @samp
  9340. @item nearest
  9341. Use values from the nearest defined point.
  9342. @item linear
  9343. Interpolate values using the linear interpolation.
  9344. @item cosine
  9345. Interpolate values using the cosine interpolation.
  9346. @item cubic
  9347. Interpolate values using the cubic interpolation.
  9348. @item spline
  9349. Interpolate values using the spline interpolation.
  9350. @end table
  9351. @end table
  9352. @anchor{lut3d}
  9353. @section lut3d
  9354. Apply a 3D LUT to an input video.
  9355. The filter accepts the following options:
  9356. @table @option
  9357. @item file
  9358. Set the 3D LUT file name.
  9359. Currently supported formats:
  9360. @table @samp
  9361. @item 3dl
  9362. AfterEffects
  9363. @item cube
  9364. Iridas
  9365. @item dat
  9366. DaVinci
  9367. @item m3d
  9368. Pandora
  9369. @item csp
  9370. cineSpace
  9371. @end table
  9372. @item interp
  9373. Select interpolation mode.
  9374. Available values are:
  9375. @table @samp
  9376. @item nearest
  9377. Use values from the nearest defined point.
  9378. @item trilinear
  9379. Interpolate values using the 8 points defining a cube.
  9380. @item tetrahedral
  9381. Interpolate values using a tetrahedron.
  9382. @end table
  9383. @end table
  9384. @section lumakey
  9385. Turn certain luma values into transparency.
  9386. The filter accepts the following options:
  9387. @table @option
  9388. @item threshold
  9389. Set the luma which will be used as base for transparency.
  9390. Default value is @code{0}.
  9391. @item tolerance
  9392. Set the range of luma values to be keyed out.
  9393. Default value is @code{0}.
  9394. @item softness
  9395. Set the range of softness. Default value is @code{0}.
  9396. Use this to control gradual transition from zero to full transparency.
  9397. @end table
  9398. @section lut, lutrgb, lutyuv
  9399. Compute a look-up table for binding each pixel component input value
  9400. to an output value, and apply it to the input video.
  9401. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  9402. to an RGB input video.
  9403. These filters accept the following parameters:
  9404. @table @option
  9405. @item c0
  9406. set first pixel component expression
  9407. @item c1
  9408. set second pixel component expression
  9409. @item c2
  9410. set third pixel component expression
  9411. @item c3
  9412. set fourth pixel component expression, corresponds to the alpha component
  9413. @item r
  9414. set red component expression
  9415. @item g
  9416. set green component expression
  9417. @item b
  9418. set blue component expression
  9419. @item a
  9420. alpha component expression
  9421. @item y
  9422. set Y/luminance component expression
  9423. @item u
  9424. set U/Cb component expression
  9425. @item v
  9426. set V/Cr component expression
  9427. @end table
  9428. Each of them specifies the expression to use for computing the lookup table for
  9429. the corresponding pixel component values.
  9430. The exact component associated to each of the @var{c*} options depends on the
  9431. format in input.
  9432. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  9433. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  9434. The expressions can contain the following constants and functions:
  9435. @table @option
  9436. @item w
  9437. @item h
  9438. The input width and height.
  9439. @item val
  9440. The input value for the pixel component.
  9441. @item clipval
  9442. The input value, clipped to the @var{minval}-@var{maxval} range.
  9443. @item maxval
  9444. The maximum value for the pixel component.
  9445. @item minval
  9446. The minimum value for the pixel component.
  9447. @item negval
  9448. The negated value for the pixel component value, clipped to the
  9449. @var{minval}-@var{maxval} range; it corresponds to the expression
  9450. "maxval-clipval+minval".
  9451. @item clip(val)
  9452. The computed value in @var{val}, clipped to the
  9453. @var{minval}-@var{maxval} range.
  9454. @item gammaval(gamma)
  9455. The computed gamma correction value of the pixel component value,
  9456. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  9457. expression
  9458. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  9459. @end table
  9460. All expressions default to "val".
  9461. @subsection Examples
  9462. @itemize
  9463. @item
  9464. Negate input video:
  9465. @example
  9466. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  9467. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  9468. @end example
  9469. The above is the same as:
  9470. @example
  9471. lutrgb="r=negval:g=negval:b=negval"
  9472. lutyuv="y=negval:u=negval:v=negval"
  9473. @end example
  9474. @item
  9475. Negate luminance:
  9476. @example
  9477. lutyuv=y=negval
  9478. @end example
  9479. @item
  9480. Remove chroma components, turning the video into a graytone image:
  9481. @example
  9482. lutyuv="u=128:v=128"
  9483. @end example
  9484. @item
  9485. Apply a luma burning effect:
  9486. @example
  9487. lutyuv="y=2*val"
  9488. @end example
  9489. @item
  9490. Remove green and blue components:
  9491. @example
  9492. lutrgb="g=0:b=0"
  9493. @end example
  9494. @item
  9495. Set a constant alpha channel value on input:
  9496. @example
  9497. format=rgba,lutrgb=a="maxval-minval/2"
  9498. @end example
  9499. @item
  9500. Correct luminance gamma by a factor of 0.5:
  9501. @example
  9502. lutyuv=y=gammaval(0.5)
  9503. @end example
  9504. @item
  9505. Discard least significant bits of luma:
  9506. @example
  9507. lutyuv=y='bitand(val, 128+64+32)'
  9508. @end example
  9509. @item
  9510. Technicolor like effect:
  9511. @example
  9512. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9513. @end example
  9514. @end itemize
  9515. @section lut2, tlut2
  9516. The @code{lut2} filter takes two input streams and outputs one
  9517. stream.
  9518. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9519. from one single stream.
  9520. This filter accepts the following parameters:
  9521. @table @option
  9522. @item c0
  9523. set first pixel component expression
  9524. @item c1
  9525. set second pixel component expression
  9526. @item c2
  9527. set third pixel component expression
  9528. @item c3
  9529. set fourth pixel component expression, corresponds to the alpha component
  9530. @item d
  9531. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9532. which means bit depth is automatically picked from first input format.
  9533. @end table
  9534. Each of them specifies the expression to use for computing the lookup table for
  9535. the corresponding pixel component values.
  9536. The exact component associated to each of the @var{c*} options depends on the
  9537. format in inputs.
  9538. The expressions can contain the following constants:
  9539. @table @option
  9540. @item w
  9541. @item h
  9542. The input width and height.
  9543. @item x
  9544. The first input value for the pixel component.
  9545. @item y
  9546. The second input value for the pixel component.
  9547. @item bdx
  9548. The first input video bit depth.
  9549. @item bdy
  9550. The second input video bit depth.
  9551. @end table
  9552. All expressions default to "x".
  9553. @subsection Examples
  9554. @itemize
  9555. @item
  9556. Highlight differences between two RGB video streams:
  9557. @example
  9558. 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)'
  9559. @end example
  9560. @item
  9561. Highlight differences between two YUV video streams:
  9562. @example
  9563. 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)'
  9564. @end example
  9565. @item
  9566. Show max difference between two video streams:
  9567. @example
  9568. 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)))'
  9569. @end example
  9570. @end itemize
  9571. @section maskedclamp
  9572. Clamp the first input stream with the second input and third input stream.
  9573. Returns the value of first stream to be between second input
  9574. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9575. This filter accepts the following options:
  9576. @table @option
  9577. @item undershoot
  9578. Default value is @code{0}.
  9579. @item overshoot
  9580. Default value is @code{0}.
  9581. @item planes
  9582. Set which planes will be processed as bitmap, unprocessed planes will be
  9583. copied from first stream.
  9584. By default value 0xf, all planes will be processed.
  9585. @end table
  9586. @section maskedmerge
  9587. Merge the first input stream with the second input stream using per pixel
  9588. weights in the third input stream.
  9589. A value of 0 in the third stream pixel component means that pixel component
  9590. from first stream is returned unchanged, while maximum value (eg. 255 for
  9591. 8-bit videos) means that pixel component from second stream is returned
  9592. unchanged. Intermediate values define the amount of merging between both
  9593. input stream's pixel components.
  9594. This filter accepts the following options:
  9595. @table @option
  9596. @item planes
  9597. Set which planes will be processed as bitmap, unprocessed planes will be
  9598. copied from first stream.
  9599. By default value 0xf, all planes will be processed.
  9600. @end table
  9601. @section maskfun
  9602. Create mask from input video.
  9603. For example it is useful to create motion masks after @code{tblend} filter.
  9604. This filter accepts the following options:
  9605. @table @option
  9606. @item low
  9607. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  9608. @item high
  9609. Set high threshold. Any pixel component higher than this value will be set to max value
  9610. allowed for current pixel format.
  9611. @item planes
  9612. Set planes to filter, by default all available planes are filtered.
  9613. @item fill
  9614. Fill all frame pixels with this value.
  9615. @item sum
  9616. Set max average pixel value for frame. If sum of all pixel components is higher that this
  9617. average, output frame will be completely filled with value set by @var{fill} option.
  9618. Typically useful for scene changes when used in combination with @code{tblend} filter.
  9619. @end table
  9620. @section mcdeint
  9621. Apply motion-compensation deinterlacing.
  9622. It needs one field per frame as input and must thus be used together
  9623. with yadif=1/3 or equivalent.
  9624. This filter accepts the following options:
  9625. @table @option
  9626. @item mode
  9627. Set the deinterlacing mode.
  9628. It accepts one of the following values:
  9629. @table @samp
  9630. @item fast
  9631. @item medium
  9632. @item slow
  9633. use iterative motion estimation
  9634. @item extra_slow
  9635. like @samp{slow}, but use multiple reference frames.
  9636. @end table
  9637. Default value is @samp{fast}.
  9638. @item parity
  9639. Set the picture field parity assumed for the input video. It must be
  9640. one of the following values:
  9641. @table @samp
  9642. @item 0, tff
  9643. assume top field first
  9644. @item 1, bff
  9645. assume bottom field first
  9646. @end table
  9647. Default value is @samp{bff}.
  9648. @item qp
  9649. Set per-block quantization parameter (QP) used by the internal
  9650. encoder.
  9651. Higher values should result in a smoother motion vector field but less
  9652. optimal individual vectors. Default value is 1.
  9653. @end table
  9654. @section mergeplanes
  9655. Merge color channel components from several video streams.
  9656. The filter accepts up to 4 input streams, and merge selected input
  9657. planes to the output video.
  9658. This filter accepts the following options:
  9659. @table @option
  9660. @item mapping
  9661. Set input to output plane mapping. Default is @code{0}.
  9662. The mappings is specified as a bitmap. It should be specified as a
  9663. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  9664. mapping for the first plane of the output stream. 'A' sets the number of
  9665. the input stream to use (from 0 to 3), and 'a' the plane number of the
  9666. corresponding input to use (from 0 to 3). The rest of the mappings is
  9667. similar, 'Bb' describes the mapping for the output stream second
  9668. plane, 'Cc' describes the mapping for the output stream third plane and
  9669. 'Dd' describes the mapping for the output stream fourth plane.
  9670. @item format
  9671. Set output pixel format. Default is @code{yuva444p}.
  9672. @end table
  9673. @subsection Examples
  9674. @itemize
  9675. @item
  9676. Merge three gray video streams of same width and height into single video stream:
  9677. @example
  9678. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  9679. @end example
  9680. @item
  9681. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  9682. @example
  9683. [a0][a1]mergeplanes=0x00010210:yuva444p
  9684. @end example
  9685. @item
  9686. Swap Y and A plane in yuva444p stream:
  9687. @example
  9688. format=yuva444p,mergeplanes=0x03010200:yuva444p
  9689. @end example
  9690. @item
  9691. Swap U and V plane in yuv420p stream:
  9692. @example
  9693. format=yuv420p,mergeplanes=0x000201:yuv420p
  9694. @end example
  9695. @item
  9696. Cast a rgb24 clip to yuv444p:
  9697. @example
  9698. format=rgb24,mergeplanes=0x000102:yuv444p
  9699. @end example
  9700. @end itemize
  9701. @section mestimate
  9702. Estimate and export motion vectors using block matching algorithms.
  9703. Motion vectors are stored in frame side data to be used by other filters.
  9704. This filter accepts the following options:
  9705. @table @option
  9706. @item method
  9707. Specify the motion estimation method. Accepts one of the following values:
  9708. @table @samp
  9709. @item esa
  9710. Exhaustive search algorithm.
  9711. @item tss
  9712. Three step search algorithm.
  9713. @item tdls
  9714. Two dimensional logarithmic search algorithm.
  9715. @item ntss
  9716. New three step search algorithm.
  9717. @item fss
  9718. Four step search algorithm.
  9719. @item ds
  9720. Diamond search algorithm.
  9721. @item hexbs
  9722. Hexagon-based search algorithm.
  9723. @item epzs
  9724. Enhanced predictive zonal search algorithm.
  9725. @item umh
  9726. Uneven multi-hexagon search algorithm.
  9727. @end table
  9728. Default value is @samp{esa}.
  9729. @item mb_size
  9730. Macroblock size. Default @code{16}.
  9731. @item search_param
  9732. Search parameter. Default @code{7}.
  9733. @end table
  9734. @section midequalizer
  9735. Apply Midway Image Equalization effect using two video streams.
  9736. Midway Image Equalization adjusts a pair of images to have the same
  9737. histogram, while maintaining their dynamics as much as possible. It's
  9738. useful for e.g. matching exposures from a pair of stereo cameras.
  9739. This filter has two inputs and one output, which must be of same pixel format, but
  9740. may be of different sizes. The output of filter is first input adjusted with
  9741. midway histogram of both inputs.
  9742. This filter accepts the following option:
  9743. @table @option
  9744. @item planes
  9745. Set which planes to process. Default is @code{15}, which is all available planes.
  9746. @end table
  9747. @section minterpolate
  9748. Convert the video to specified frame rate using motion interpolation.
  9749. This filter accepts the following options:
  9750. @table @option
  9751. @item fps
  9752. 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}.
  9753. @item mi_mode
  9754. Motion interpolation mode. Following values are accepted:
  9755. @table @samp
  9756. @item dup
  9757. Duplicate previous or next frame for interpolating new ones.
  9758. @item blend
  9759. Blend source frames. Interpolated frame is mean of previous and next frames.
  9760. @item mci
  9761. Motion compensated interpolation. Following options are effective when this mode is selected:
  9762. @table @samp
  9763. @item mc_mode
  9764. Motion compensation mode. Following values are accepted:
  9765. @table @samp
  9766. @item obmc
  9767. Overlapped block motion compensation.
  9768. @item aobmc
  9769. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  9770. @end table
  9771. Default mode is @samp{obmc}.
  9772. @item me_mode
  9773. Motion estimation mode. Following values are accepted:
  9774. @table @samp
  9775. @item bidir
  9776. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  9777. @item bilat
  9778. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  9779. @end table
  9780. Default mode is @samp{bilat}.
  9781. @item me
  9782. The algorithm to be used for motion estimation. Following values are accepted:
  9783. @table @samp
  9784. @item esa
  9785. Exhaustive search algorithm.
  9786. @item tss
  9787. Three step search algorithm.
  9788. @item tdls
  9789. Two dimensional logarithmic search algorithm.
  9790. @item ntss
  9791. New three step search algorithm.
  9792. @item fss
  9793. Four step search algorithm.
  9794. @item ds
  9795. Diamond search algorithm.
  9796. @item hexbs
  9797. Hexagon-based search algorithm.
  9798. @item epzs
  9799. Enhanced predictive zonal search algorithm.
  9800. @item umh
  9801. Uneven multi-hexagon search algorithm.
  9802. @end table
  9803. Default algorithm is @samp{epzs}.
  9804. @item mb_size
  9805. Macroblock size. Default @code{16}.
  9806. @item search_param
  9807. Motion estimation search parameter. Default @code{32}.
  9808. @item vsbmc
  9809. 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).
  9810. @end table
  9811. @end table
  9812. @item scd
  9813. 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:
  9814. @table @samp
  9815. @item none
  9816. Disable scene change detection.
  9817. @item fdiff
  9818. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  9819. @end table
  9820. Default method is @samp{fdiff}.
  9821. @item scd_threshold
  9822. Scene change detection threshold. Default is @code{5.0}.
  9823. @end table
  9824. @section mix
  9825. Mix several video input streams into one video stream.
  9826. A description of the accepted options follows.
  9827. @table @option
  9828. @item nb_inputs
  9829. The number of inputs. If unspecified, it defaults to 2.
  9830. @item weights
  9831. Specify weight of each input video stream as sequence.
  9832. Each weight is separated by space. If number of weights
  9833. is smaller than number of @var{frames} last specified
  9834. weight will be used for all remaining unset weights.
  9835. @item scale
  9836. Specify scale, if it is set it will be multiplied with sum
  9837. of each weight multiplied with pixel values to give final destination
  9838. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9839. @item duration
  9840. Specify how end of stream is determined.
  9841. @table @samp
  9842. @item longest
  9843. The duration of the longest input. (default)
  9844. @item shortest
  9845. The duration of the shortest input.
  9846. @item first
  9847. The duration of the first input.
  9848. @end table
  9849. @end table
  9850. @section mpdecimate
  9851. Drop frames that do not differ greatly from the previous frame in
  9852. order to reduce frame rate.
  9853. The main use of this filter is for very-low-bitrate encoding
  9854. (e.g. streaming over dialup modem), but it could in theory be used for
  9855. fixing movies that were inverse-telecined incorrectly.
  9856. A description of the accepted options follows.
  9857. @table @option
  9858. @item max
  9859. Set the maximum number of consecutive frames which can be dropped (if
  9860. positive), or the minimum interval between dropped frames (if
  9861. negative). If the value is 0, the frame is dropped disregarding the
  9862. number of previous sequentially dropped frames.
  9863. Default value is 0.
  9864. @item hi
  9865. @item lo
  9866. @item frac
  9867. Set the dropping threshold values.
  9868. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9869. represent actual pixel value differences, so a threshold of 64
  9870. corresponds to 1 unit of difference for each pixel, or the same spread
  9871. out differently over the block.
  9872. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9873. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9874. meaning the whole image) differ by more than a threshold of @option{lo}.
  9875. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9876. 64*5, and default value for @option{frac} is 0.33.
  9877. @end table
  9878. @section negate
  9879. Negate (invert) the input video.
  9880. It accepts the following option:
  9881. @table @option
  9882. @item negate_alpha
  9883. With value 1, it negates the alpha component, if present. Default value is 0.
  9884. @end table
  9885. @anchor{nlmeans}
  9886. @section nlmeans
  9887. Denoise frames using Non-Local Means algorithm.
  9888. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9889. context similarity is defined by comparing their surrounding patches of size
  9890. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9891. around the pixel.
  9892. Note that the research area defines centers for patches, which means some
  9893. patches will be made of pixels outside that research area.
  9894. The filter accepts the following options.
  9895. @table @option
  9896. @item s
  9897. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  9898. @item p
  9899. Set patch size. Default is 7. Must be odd number in range [0, 99].
  9900. @item pc
  9901. Same as @option{p} but for chroma planes.
  9902. The default value is @var{0} and means automatic.
  9903. @item r
  9904. Set research size. Default is 15. Must be odd number in range [0, 99].
  9905. @item rc
  9906. Same as @option{r} but for chroma planes.
  9907. The default value is @var{0} and means automatic.
  9908. @end table
  9909. @section nnedi
  9910. Deinterlace video using neural network edge directed interpolation.
  9911. This filter accepts the following options:
  9912. @table @option
  9913. @item weights
  9914. Mandatory option, without binary file filter can not work.
  9915. Currently file can be found here:
  9916. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9917. @item deint
  9918. Set which frames to deinterlace, by default it is @code{all}.
  9919. Can be @code{all} or @code{interlaced}.
  9920. @item field
  9921. Set mode of operation.
  9922. Can be one of the following:
  9923. @table @samp
  9924. @item af
  9925. Use frame flags, both fields.
  9926. @item a
  9927. Use frame flags, single field.
  9928. @item t
  9929. Use top field only.
  9930. @item b
  9931. Use bottom field only.
  9932. @item tf
  9933. Use both fields, top first.
  9934. @item bf
  9935. Use both fields, bottom first.
  9936. @end table
  9937. @item planes
  9938. Set which planes to process, by default filter process all frames.
  9939. @item nsize
  9940. Set size of local neighborhood around each pixel, used by the predictor neural
  9941. network.
  9942. Can be one of the following:
  9943. @table @samp
  9944. @item s8x6
  9945. @item s16x6
  9946. @item s32x6
  9947. @item s48x6
  9948. @item s8x4
  9949. @item s16x4
  9950. @item s32x4
  9951. @end table
  9952. @item nns
  9953. Set the number of neurons in predictor neural network.
  9954. Can be one of the following:
  9955. @table @samp
  9956. @item n16
  9957. @item n32
  9958. @item n64
  9959. @item n128
  9960. @item n256
  9961. @end table
  9962. @item qual
  9963. Controls the number of different neural network predictions that are blended
  9964. together to compute the final output value. Can be @code{fast}, default or
  9965. @code{slow}.
  9966. @item etype
  9967. Set which set of weights to use in the predictor.
  9968. Can be one of the following:
  9969. @table @samp
  9970. @item a
  9971. weights trained to minimize absolute error
  9972. @item s
  9973. weights trained to minimize squared error
  9974. @end table
  9975. @item pscrn
  9976. Controls whether or not the prescreener neural network is used to decide
  9977. which pixels should be processed by the predictor neural network and which
  9978. can be handled by simple cubic interpolation.
  9979. The prescreener is trained to know whether cubic interpolation will be
  9980. sufficient for a pixel or whether it should be predicted by the predictor nn.
  9981. The computational complexity of the prescreener nn is much less than that of
  9982. the predictor nn. Since most pixels can be handled by cubic interpolation,
  9983. using the prescreener generally results in much faster processing.
  9984. The prescreener is pretty accurate, so the difference between using it and not
  9985. using it is almost always unnoticeable.
  9986. Can be one of the following:
  9987. @table @samp
  9988. @item none
  9989. @item original
  9990. @item new
  9991. @end table
  9992. Default is @code{new}.
  9993. @item fapprox
  9994. Set various debugging flags.
  9995. @end table
  9996. @section noformat
  9997. Force libavfilter not to use any of the specified pixel formats for the
  9998. input to the next filter.
  9999. It accepts the following parameters:
  10000. @table @option
  10001. @item pix_fmts
  10002. A '|'-separated list of pixel format names, such as
  10003. pix_fmts=yuv420p|monow|rgb24".
  10004. @end table
  10005. @subsection Examples
  10006. @itemize
  10007. @item
  10008. Force libavfilter to use a format different from @var{yuv420p} for the
  10009. input to the vflip filter:
  10010. @example
  10011. noformat=pix_fmts=yuv420p,vflip
  10012. @end example
  10013. @item
  10014. Convert the input video to any of the formats not contained in the list:
  10015. @example
  10016. noformat=yuv420p|yuv444p|yuv410p
  10017. @end example
  10018. @end itemize
  10019. @section noise
  10020. Add noise on video input frame.
  10021. The filter accepts the following options:
  10022. @table @option
  10023. @item all_seed
  10024. @item c0_seed
  10025. @item c1_seed
  10026. @item c2_seed
  10027. @item c3_seed
  10028. Set noise seed for specific pixel component or all pixel components in case
  10029. of @var{all_seed}. Default value is @code{123457}.
  10030. @item all_strength, alls
  10031. @item c0_strength, c0s
  10032. @item c1_strength, c1s
  10033. @item c2_strength, c2s
  10034. @item c3_strength, c3s
  10035. Set noise strength for specific pixel component or all pixel components in case
  10036. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  10037. @item all_flags, allf
  10038. @item c0_flags, c0f
  10039. @item c1_flags, c1f
  10040. @item c2_flags, c2f
  10041. @item c3_flags, c3f
  10042. Set pixel component flags or set flags for all components if @var{all_flags}.
  10043. Available values for component flags are:
  10044. @table @samp
  10045. @item a
  10046. averaged temporal noise (smoother)
  10047. @item p
  10048. mix random noise with a (semi)regular pattern
  10049. @item t
  10050. temporal noise (noise pattern changes between frames)
  10051. @item u
  10052. uniform noise (gaussian otherwise)
  10053. @end table
  10054. @end table
  10055. @subsection Examples
  10056. Add temporal and uniform noise to input video:
  10057. @example
  10058. noise=alls=20:allf=t+u
  10059. @end example
  10060. @section normalize
  10061. Normalize RGB video (aka histogram stretching, contrast stretching).
  10062. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  10063. For each channel of each frame, the filter computes the input range and maps
  10064. it linearly to the user-specified output range. The output range defaults
  10065. to the full dynamic range from pure black to pure white.
  10066. Temporal smoothing can be used on the input range to reduce flickering (rapid
  10067. changes in brightness) caused when small dark or bright objects enter or leave
  10068. the scene. This is similar to the auto-exposure (automatic gain control) on a
  10069. video camera, and, like a video camera, it may cause a period of over- or
  10070. under-exposure of the video.
  10071. The R,G,B channels can be normalized independently, which may cause some
  10072. color shifting, or linked together as a single channel, which prevents
  10073. color shifting. Linked normalization preserves hue. Independent normalization
  10074. does not, so it can be used to remove some color casts. Independent and linked
  10075. normalization can be combined in any ratio.
  10076. The normalize filter accepts the following options:
  10077. @table @option
  10078. @item blackpt
  10079. @item whitept
  10080. Colors which define the output range. The minimum input value is mapped to
  10081. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  10082. The defaults are black and white respectively. Specifying white for
  10083. @var{blackpt} and black for @var{whitept} will give color-inverted,
  10084. normalized video. Shades of grey can be used to reduce the dynamic range
  10085. (contrast). Specifying saturated colors here can create some interesting
  10086. effects.
  10087. @item smoothing
  10088. The number of previous frames to use for temporal smoothing. The input range
  10089. of each channel is smoothed using a rolling average over the current frame
  10090. and the @var{smoothing} previous frames. The default is 0 (no temporal
  10091. smoothing).
  10092. @item independence
  10093. Controls the ratio of independent (color shifting) channel normalization to
  10094. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  10095. independent. Defaults to 1.0 (fully independent).
  10096. @item strength
  10097. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  10098. expensive no-op. Defaults to 1.0 (full strength).
  10099. @end table
  10100. @subsection Examples
  10101. Stretch video contrast to use the full dynamic range, with no temporal
  10102. smoothing; may flicker depending on the source content:
  10103. @example
  10104. normalize=blackpt=black:whitept=white:smoothing=0
  10105. @end example
  10106. As above, but with 50 frames of temporal smoothing; flicker should be
  10107. reduced, depending on the source content:
  10108. @example
  10109. normalize=blackpt=black:whitept=white:smoothing=50
  10110. @end example
  10111. As above, but with hue-preserving linked channel normalization:
  10112. @example
  10113. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  10114. @end example
  10115. As above, but with half strength:
  10116. @example
  10117. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  10118. @end example
  10119. Map the darkest input color to red, the brightest input color to cyan:
  10120. @example
  10121. normalize=blackpt=red:whitept=cyan
  10122. @end example
  10123. @section null
  10124. Pass the video source unchanged to the output.
  10125. @section ocr
  10126. Optical Character Recognition
  10127. This filter uses Tesseract for optical character recognition. To enable
  10128. compilation of this filter, you need to configure FFmpeg with
  10129. @code{--enable-libtesseract}.
  10130. It accepts the following options:
  10131. @table @option
  10132. @item datapath
  10133. Set datapath to tesseract data. Default is to use whatever was
  10134. set at installation.
  10135. @item language
  10136. Set language, default is "eng".
  10137. @item whitelist
  10138. Set character whitelist.
  10139. @item blacklist
  10140. Set character blacklist.
  10141. @end table
  10142. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  10143. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  10144. @section ocv
  10145. Apply a video transform using libopencv.
  10146. To enable this filter, install the libopencv library and headers and
  10147. configure FFmpeg with @code{--enable-libopencv}.
  10148. It accepts the following parameters:
  10149. @table @option
  10150. @item filter_name
  10151. The name of the libopencv filter to apply.
  10152. @item filter_params
  10153. The parameters to pass to the libopencv filter. If not specified, the default
  10154. values are assumed.
  10155. @end table
  10156. Refer to the official libopencv documentation for more precise
  10157. information:
  10158. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  10159. Several libopencv filters are supported; see the following subsections.
  10160. @anchor{dilate}
  10161. @subsection dilate
  10162. Dilate an image by using a specific structuring element.
  10163. It corresponds to the libopencv function @code{cvDilate}.
  10164. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  10165. @var{struct_el} represents a structuring element, and has the syntax:
  10166. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  10167. @var{cols} and @var{rows} represent the number of columns and rows of
  10168. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  10169. point, and @var{shape} the shape for the structuring element. @var{shape}
  10170. must be "rect", "cross", "ellipse", or "custom".
  10171. If the value for @var{shape} is "custom", it must be followed by a
  10172. string of the form "=@var{filename}". The file with name
  10173. @var{filename} is assumed to represent a binary image, with each
  10174. printable character corresponding to a bright pixel. When a custom
  10175. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  10176. or columns and rows of the read file are assumed instead.
  10177. The default value for @var{struct_el} is "3x3+0x0/rect".
  10178. @var{nb_iterations} specifies the number of times the transform is
  10179. applied to the image, and defaults to 1.
  10180. Some examples:
  10181. @example
  10182. # Use the default values
  10183. ocv=dilate
  10184. # Dilate using a structuring element with a 5x5 cross, iterating two times
  10185. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  10186. # Read the shape from the file diamond.shape, iterating two times.
  10187. # The file diamond.shape may contain a pattern of characters like this
  10188. # *
  10189. # ***
  10190. # *****
  10191. # ***
  10192. # *
  10193. # The specified columns and rows are ignored
  10194. # but the anchor point coordinates are not
  10195. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  10196. @end example
  10197. @subsection erode
  10198. Erode an image by using a specific structuring element.
  10199. It corresponds to the libopencv function @code{cvErode}.
  10200. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  10201. with the same syntax and semantics as the @ref{dilate} filter.
  10202. @subsection smooth
  10203. Smooth the input video.
  10204. The filter takes the following parameters:
  10205. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  10206. @var{type} is the type of smooth filter to apply, and must be one of
  10207. the following values: "blur", "blur_no_scale", "median", "gaussian",
  10208. or "bilateral". The default value is "gaussian".
  10209. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  10210. depends on the smooth type. @var{param1} and
  10211. @var{param2} accept integer positive values or 0. @var{param3} and
  10212. @var{param4} accept floating point values.
  10213. The default value for @var{param1} is 3. The default value for the
  10214. other parameters is 0.
  10215. These parameters correspond to the parameters assigned to the
  10216. libopencv function @code{cvSmooth}.
  10217. @section oscilloscope
  10218. 2D Video Oscilloscope.
  10219. Useful to measure spatial impulse, step responses, chroma delays, etc.
  10220. It accepts the following parameters:
  10221. @table @option
  10222. @item x
  10223. Set scope center x position.
  10224. @item y
  10225. Set scope center y position.
  10226. @item s
  10227. Set scope size, relative to frame diagonal.
  10228. @item t
  10229. Set scope tilt/rotation.
  10230. @item o
  10231. Set trace opacity.
  10232. @item tx
  10233. Set trace center x position.
  10234. @item ty
  10235. Set trace center y position.
  10236. @item tw
  10237. Set trace width, relative to width of frame.
  10238. @item th
  10239. Set trace height, relative to height of frame.
  10240. @item c
  10241. Set which components to trace. By default it traces first three components.
  10242. @item g
  10243. Draw trace grid. By default is enabled.
  10244. @item st
  10245. Draw some statistics. By default is enabled.
  10246. @item sc
  10247. Draw scope. By default is enabled.
  10248. @end table
  10249. @subsection Examples
  10250. @itemize
  10251. @item
  10252. Inspect full first row of video frame.
  10253. @example
  10254. oscilloscope=x=0.5:y=0:s=1
  10255. @end example
  10256. @item
  10257. Inspect full last row of video frame.
  10258. @example
  10259. oscilloscope=x=0.5:y=1:s=1
  10260. @end example
  10261. @item
  10262. Inspect full 5th line of video frame of height 1080.
  10263. @example
  10264. oscilloscope=x=0.5:y=5/1080:s=1
  10265. @end example
  10266. @item
  10267. Inspect full last column of video frame.
  10268. @example
  10269. oscilloscope=x=1:y=0.5:s=1:t=1
  10270. @end example
  10271. @end itemize
  10272. @anchor{overlay}
  10273. @section overlay
  10274. Overlay one video on top of another.
  10275. It takes two inputs and has one output. The first input is the "main"
  10276. video on which the second input is overlaid.
  10277. It accepts the following parameters:
  10278. A description of the accepted options follows.
  10279. @table @option
  10280. @item x
  10281. @item y
  10282. Set the expression for the x and y coordinates of the overlaid video
  10283. on the main video. Default value is "0" for both expressions. In case
  10284. the expression is invalid, it is set to a huge value (meaning that the
  10285. overlay will not be displayed within the output visible area).
  10286. @item eof_action
  10287. See @ref{framesync}.
  10288. @item eval
  10289. Set when the expressions for @option{x}, and @option{y} are evaluated.
  10290. It accepts the following values:
  10291. @table @samp
  10292. @item init
  10293. only evaluate expressions once during the filter initialization or
  10294. when a command is processed
  10295. @item frame
  10296. evaluate expressions for each incoming frame
  10297. @end table
  10298. Default value is @samp{frame}.
  10299. @item shortest
  10300. See @ref{framesync}.
  10301. @item format
  10302. Set the format for the output video.
  10303. It accepts the following values:
  10304. @table @samp
  10305. @item yuv420
  10306. force YUV420 output
  10307. @item yuv422
  10308. force YUV422 output
  10309. @item yuv444
  10310. force YUV444 output
  10311. @item rgb
  10312. force packed RGB output
  10313. @item gbrp
  10314. force planar RGB output
  10315. @item auto
  10316. automatically pick format
  10317. @end table
  10318. Default value is @samp{yuv420}.
  10319. @item repeatlast
  10320. See @ref{framesync}.
  10321. @item alpha
  10322. Set format of alpha of the overlaid video, it can be @var{straight} or
  10323. @var{premultiplied}. Default is @var{straight}.
  10324. @end table
  10325. The @option{x}, and @option{y} expressions can contain the following
  10326. parameters.
  10327. @table @option
  10328. @item main_w, W
  10329. @item main_h, H
  10330. The main input width and height.
  10331. @item overlay_w, w
  10332. @item overlay_h, h
  10333. The overlay input width and height.
  10334. @item x
  10335. @item y
  10336. The computed values for @var{x} and @var{y}. They are evaluated for
  10337. each new frame.
  10338. @item hsub
  10339. @item vsub
  10340. horizontal and vertical chroma subsample values of the output
  10341. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  10342. @var{vsub} is 1.
  10343. @item n
  10344. the number of input frame, starting from 0
  10345. @item pos
  10346. the position in the file of the input frame, NAN if unknown
  10347. @item t
  10348. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  10349. @end table
  10350. This filter also supports the @ref{framesync} options.
  10351. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  10352. when evaluation is done @emph{per frame}, and will evaluate to NAN
  10353. when @option{eval} is set to @samp{init}.
  10354. Be aware that frames are taken from each input video in timestamp
  10355. order, hence, if their initial timestamps differ, it is a good idea
  10356. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  10357. have them begin in the same zero timestamp, as the example for
  10358. the @var{movie} filter does.
  10359. You can chain together more overlays but you should test the
  10360. efficiency of such approach.
  10361. @subsection Commands
  10362. This filter supports the following commands:
  10363. @table @option
  10364. @item x
  10365. @item y
  10366. Modify the x and y of the overlay input.
  10367. The command accepts the same syntax of the corresponding option.
  10368. If the specified expression is not valid, it is kept at its current
  10369. value.
  10370. @end table
  10371. @subsection Examples
  10372. @itemize
  10373. @item
  10374. Draw the overlay at 10 pixels from the bottom right corner of the main
  10375. video:
  10376. @example
  10377. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  10378. @end example
  10379. Using named options the example above becomes:
  10380. @example
  10381. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  10382. @end example
  10383. @item
  10384. Insert a transparent PNG logo in the bottom left corner of the input,
  10385. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  10386. @example
  10387. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  10388. @end example
  10389. @item
  10390. Insert 2 different transparent PNG logos (second logo on bottom
  10391. right corner) using the @command{ffmpeg} tool:
  10392. @example
  10393. 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
  10394. @end example
  10395. @item
  10396. Add a transparent color layer on top of the main video; @code{WxH}
  10397. must specify the size of the main input to the overlay filter:
  10398. @example
  10399. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  10400. @end example
  10401. @item
  10402. Play an original video and a filtered version (here with the deshake
  10403. filter) side by side using the @command{ffplay} tool:
  10404. @example
  10405. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  10406. @end example
  10407. The above command is the same as:
  10408. @example
  10409. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  10410. @end example
  10411. @item
  10412. Make a sliding overlay appearing from the left to the right top part of the
  10413. screen starting since time 2:
  10414. @example
  10415. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  10416. @end example
  10417. @item
  10418. Compose output by putting two input videos side to side:
  10419. @example
  10420. ffmpeg -i left.avi -i right.avi -filter_complex "
  10421. nullsrc=size=200x100 [background];
  10422. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  10423. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  10424. [background][left] overlay=shortest=1 [background+left];
  10425. [background+left][right] overlay=shortest=1:x=100 [left+right]
  10426. "
  10427. @end example
  10428. @item
  10429. Mask 10-20 seconds of a video by applying the delogo filter to a section
  10430. @example
  10431. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  10432. -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]'
  10433. masked.avi
  10434. @end example
  10435. @item
  10436. Chain several overlays in cascade:
  10437. @example
  10438. nullsrc=s=200x200 [bg];
  10439. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  10440. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  10441. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  10442. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  10443. [in3] null, [mid2] overlay=100:100 [out0]
  10444. @end example
  10445. @end itemize
  10446. @section owdenoise
  10447. Apply Overcomplete Wavelet denoiser.
  10448. The filter accepts the following options:
  10449. @table @option
  10450. @item depth
  10451. Set depth.
  10452. Larger depth values will denoise lower frequency components more, but
  10453. slow down filtering.
  10454. Must be an int in the range 8-16, default is @code{8}.
  10455. @item luma_strength, ls
  10456. Set luma strength.
  10457. Must be a double value in the range 0-1000, default is @code{1.0}.
  10458. @item chroma_strength, cs
  10459. Set chroma strength.
  10460. Must be a double value in the range 0-1000, default is @code{1.0}.
  10461. @end table
  10462. @anchor{pad}
  10463. @section pad
  10464. Add paddings to the input image, and place the original input at the
  10465. provided @var{x}, @var{y} coordinates.
  10466. It accepts the following parameters:
  10467. @table @option
  10468. @item width, w
  10469. @item height, h
  10470. Specify an expression for the size of the output image with the
  10471. paddings added. If the value for @var{width} or @var{height} is 0, the
  10472. corresponding input size is used for the output.
  10473. The @var{width} expression can reference the value set by the
  10474. @var{height} expression, and vice versa.
  10475. The default value of @var{width} and @var{height} is 0.
  10476. @item x
  10477. @item y
  10478. Specify the offsets to place the input image at within the padded area,
  10479. with respect to the top/left border of the output image.
  10480. The @var{x} expression can reference the value set by the @var{y}
  10481. expression, and vice versa.
  10482. The default value of @var{x} and @var{y} is 0.
  10483. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  10484. so the input image is centered on the padded area.
  10485. @item color
  10486. Specify the color of the padded area. For the syntax of this option,
  10487. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10488. manual,ffmpeg-utils}.
  10489. The default value of @var{color} is "black".
  10490. @item eval
  10491. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  10492. It accepts the following values:
  10493. @table @samp
  10494. @item init
  10495. Only evaluate expressions once during the filter initialization or when
  10496. a command is processed.
  10497. @item frame
  10498. Evaluate expressions for each incoming frame.
  10499. @end table
  10500. Default value is @samp{init}.
  10501. @item aspect
  10502. Pad to aspect instead to a resolution.
  10503. @end table
  10504. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  10505. options are expressions containing the following constants:
  10506. @table @option
  10507. @item in_w
  10508. @item in_h
  10509. The input video width and height.
  10510. @item iw
  10511. @item ih
  10512. These are the same as @var{in_w} and @var{in_h}.
  10513. @item out_w
  10514. @item out_h
  10515. The output width and height (the size of the padded area), as
  10516. specified by the @var{width} and @var{height} expressions.
  10517. @item ow
  10518. @item oh
  10519. These are the same as @var{out_w} and @var{out_h}.
  10520. @item x
  10521. @item y
  10522. The x and y offsets as specified by the @var{x} and @var{y}
  10523. expressions, or NAN if not yet specified.
  10524. @item a
  10525. same as @var{iw} / @var{ih}
  10526. @item sar
  10527. input sample aspect ratio
  10528. @item dar
  10529. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  10530. @item hsub
  10531. @item vsub
  10532. The horizontal and vertical chroma subsample values. For example for the
  10533. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10534. @end table
  10535. @subsection Examples
  10536. @itemize
  10537. @item
  10538. Add paddings with the color "violet" to the input video. The output video
  10539. size is 640x480, and the top-left corner of the input video is placed at
  10540. column 0, row 40
  10541. @example
  10542. pad=640:480:0:40:violet
  10543. @end example
  10544. The example above is equivalent to the following command:
  10545. @example
  10546. pad=width=640:height=480:x=0:y=40:color=violet
  10547. @end example
  10548. @item
  10549. Pad the input to get an output with dimensions increased by 3/2,
  10550. and put the input video at the center of the padded area:
  10551. @example
  10552. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10553. @end example
  10554. @item
  10555. Pad the input to get a squared output with size equal to the maximum
  10556. value between the input width and height, and put the input video at
  10557. the center of the padded area:
  10558. @example
  10559. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10560. @end example
  10561. @item
  10562. Pad the input to get a final w/h ratio of 16:9:
  10563. @example
  10564. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10565. @end example
  10566. @item
  10567. In case of anamorphic video, in order to set the output display aspect
  10568. correctly, it is necessary to use @var{sar} in the expression,
  10569. according to the relation:
  10570. @example
  10571. (ih * X / ih) * sar = output_dar
  10572. X = output_dar / sar
  10573. @end example
  10574. Thus the previous example needs to be modified to:
  10575. @example
  10576. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  10577. @end example
  10578. @item
  10579. Double the output size and put the input video in the bottom-right
  10580. corner of the output padded area:
  10581. @example
  10582. pad="2*iw:2*ih:ow-iw:oh-ih"
  10583. @end example
  10584. @end itemize
  10585. @anchor{palettegen}
  10586. @section palettegen
  10587. Generate one palette for a whole video stream.
  10588. It accepts the following options:
  10589. @table @option
  10590. @item max_colors
  10591. Set the maximum number of colors to quantize in the palette.
  10592. Note: the palette will still contain 256 colors; the unused palette entries
  10593. will be black.
  10594. @item reserve_transparent
  10595. Create a palette of 255 colors maximum and reserve the last one for
  10596. transparency. Reserving the transparency color is useful for GIF optimization.
  10597. If not set, the maximum of colors in the palette will be 256. You probably want
  10598. to disable this option for a standalone image.
  10599. Set by default.
  10600. @item transparency_color
  10601. Set the color that will be used as background for transparency.
  10602. @item stats_mode
  10603. Set statistics mode.
  10604. It accepts the following values:
  10605. @table @samp
  10606. @item full
  10607. Compute full frame histograms.
  10608. @item diff
  10609. Compute histograms only for the part that differs from previous frame. This
  10610. might be relevant to give more importance to the moving part of your input if
  10611. the background is static.
  10612. @item single
  10613. Compute new histogram for each frame.
  10614. @end table
  10615. Default value is @var{full}.
  10616. @end table
  10617. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  10618. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  10619. color quantization of the palette. This information is also visible at
  10620. @var{info} logging level.
  10621. @subsection Examples
  10622. @itemize
  10623. @item
  10624. Generate a representative palette of a given video using @command{ffmpeg}:
  10625. @example
  10626. ffmpeg -i input.mkv -vf palettegen palette.png
  10627. @end example
  10628. @end itemize
  10629. @section paletteuse
  10630. Use a palette to downsample an input video stream.
  10631. The filter takes two inputs: one video stream and a palette. The palette must
  10632. be a 256 pixels image.
  10633. It accepts the following options:
  10634. @table @option
  10635. @item dither
  10636. Select dithering mode. Available algorithms are:
  10637. @table @samp
  10638. @item bayer
  10639. Ordered 8x8 bayer dithering (deterministic)
  10640. @item heckbert
  10641. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  10642. Note: this dithering is sometimes considered "wrong" and is included as a
  10643. reference.
  10644. @item floyd_steinberg
  10645. Floyd and Steingberg dithering (error diffusion)
  10646. @item sierra2
  10647. Frankie Sierra dithering v2 (error diffusion)
  10648. @item sierra2_4a
  10649. Frankie Sierra dithering v2 "Lite" (error diffusion)
  10650. @end table
  10651. Default is @var{sierra2_4a}.
  10652. @item bayer_scale
  10653. When @var{bayer} dithering is selected, this option defines the scale of the
  10654. pattern (how much the crosshatch pattern is visible). A low value means more
  10655. visible pattern for less banding, and higher value means less visible pattern
  10656. at the cost of more banding.
  10657. The option must be an integer value in the range [0,5]. Default is @var{2}.
  10658. @item diff_mode
  10659. If set, define the zone to process
  10660. @table @samp
  10661. @item rectangle
  10662. Only the changing rectangle will be reprocessed. This is similar to GIF
  10663. cropping/offsetting compression mechanism. This option can be useful for speed
  10664. if only a part of the image is changing, and has use cases such as limiting the
  10665. scope of the error diffusal @option{dither} to the rectangle that bounds the
  10666. moving scene (it leads to more deterministic output if the scene doesn't change
  10667. much, and as a result less moving noise and better GIF compression).
  10668. @end table
  10669. Default is @var{none}.
  10670. @item new
  10671. Take new palette for each output frame.
  10672. @item alpha_threshold
  10673. Sets the alpha threshold for transparency. Alpha values above this threshold
  10674. will be treated as completely opaque, and values below this threshold will be
  10675. treated as completely transparent.
  10676. The option must be an integer value in the range [0,255]. Default is @var{128}.
  10677. @end table
  10678. @subsection Examples
  10679. @itemize
  10680. @item
  10681. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  10682. using @command{ffmpeg}:
  10683. @example
  10684. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  10685. @end example
  10686. @end itemize
  10687. @section perspective
  10688. Correct perspective of video not recorded perpendicular to the screen.
  10689. A description of the accepted parameters follows.
  10690. @table @option
  10691. @item x0
  10692. @item y0
  10693. @item x1
  10694. @item y1
  10695. @item x2
  10696. @item y2
  10697. @item x3
  10698. @item y3
  10699. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  10700. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  10701. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  10702. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  10703. then the corners of the source will be sent to the specified coordinates.
  10704. The expressions can use the following variables:
  10705. @table @option
  10706. @item W
  10707. @item H
  10708. the width and height of video frame.
  10709. @item in
  10710. Input frame count.
  10711. @item on
  10712. Output frame count.
  10713. @end table
  10714. @item interpolation
  10715. Set interpolation for perspective correction.
  10716. It accepts the following values:
  10717. @table @samp
  10718. @item linear
  10719. @item cubic
  10720. @end table
  10721. Default value is @samp{linear}.
  10722. @item sense
  10723. Set interpretation of coordinate options.
  10724. It accepts the following values:
  10725. @table @samp
  10726. @item 0, source
  10727. Send point in the source specified by the given coordinates to
  10728. the corners of the destination.
  10729. @item 1, destination
  10730. Send the corners of the source to the point in the destination specified
  10731. by the given coordinates.
  10732. Default value is @samp{source}.
  10733. @end table
  10734. @item eval
  10735. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  10736. It accepts the following values:
  10737. @table @samp
  10738. @item init
  10739. only evaluate expressions once during the filter initialization or
  10740. when a command is processed
  10741. @item frame
  10742. evaluate expressions for each incoming frame
  10743. @end table
  10744. Default value is @samp{init}.
  10745. @end table
  10746. @section phase
  10747. Delay interlaced video by one field time so that the field order changes.
  10748. The intended use is to fix PAL movies that have been captured with the
  10749. opposite field order to the film-to-video transfer.
  10750. A description of the accepted parameters follows.
  10751. @table @option
  10752. @item mode
  10753. Set phase mode.
  10754. It accepts the following values:
  10755. @table @samp
  10756. @item t
  10757. Capture field order top-first, transfer bottom-first.
  10758. Filter will delay the bottom field.
  10759. @item b
  10760. Capture field order bottom-first, transfer top-first.
  10761. Filter will delay the top field.
  10762. @item p
  10763. Capture and transfer with the same field order. This mode only exists
  10764. for the documentation of the other options to refer to, but if you
  10765. actually select it, the filter will faithfully do nothing.
  10766. @item a
  10767. Capture field order determined automatically by field flags, transfer
  10768. opposite.
  10769. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  10770. basis using field flags. If no field information is available,
  10771. then this works just like @samp{u}.
  10772. @item u
  10773. Capture unknown or varying, transfer opposite.
  10774. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  10775. analyzing the images and selecting the alternative that produces best
  10776. match between the fields.
  10777. @item T
  10778. Capture top-first, transfer unknown or varying.
  10779. Filter selects among @samp{t} and @samp{p} using image analysis.
  10780. @item B
  10781. Capture bottom-first, transfer unknown or varying.
  10782. Filter selects among @samp{b} and @samp{p} using image analysis.
  10783. @item A
  10784. Capture determined by field flags, transfer unknown or varying.
  10785. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  10786. image analysis. If no field information is available, then this works just
  10787. like @samp{U}. This is the default mode.
  10788. @item U
  10789. Both capture and transfer unknown or varying.
  10790. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  10791. @end table
  10792. @end table
  10793. @section photosensitivity
  10794. Reduce various flashes in video, so to help users with epilepsy.
  10795. It accepts the following options:
  10796. @table @option
  10797. @item frames, f
  10798. Set how many frames to use when filtering. Default is 30.
  10799. @item threshold, t
  10800. Set detection threshold factor. Default is 1.
  10801. Lower is stricter.
  10802. @item skip
  10803. Set how many pixels to skip when sampling frames. Defalt is 1.
  10804. Allowed range is from 1 to 1024.
  10805. @item bypass
  10806. Leave frames unchanged. Default is disabled.
  10807. @end table
  10808. @section pixdesctest
  10809. Pixel format descriptor test filter, mainly useful for internal
  10810. testing. The output video should be equal to the input video.
  10811. For example:
  10812. @example
  10813. format=monow, pixdesctest
  10814. @end example
  10815. can be used to test the monowhite pixel format descriptor definition.
  10816. @section pixscope
  10817. Display sample values of color channels. Mainly useful for checking color
  10818. and levels. Minimum supported resolution is 640x480.
  10819. The filters accept the following options:
  10820. @table @option
  10821. @item x
  10822. Set scope X position, relative offset on X axis.
  10823. @item y
  10824. Set scope Y position, relative offset on Y axis.
  10825. @item w
  10826. Set scope width.
  10827. @item h
  10828. Set scope height.
  10829. @item o
  10830. Set window opacity. This window also holds statistics about pixel area.
  10831. @item wx
  10832. Set window X position, relative offset on X axis.
  10833. @item wy
  10834. Set window Y position, relative offset on Y axis.
  10835. @end table
  10836. @section pp
  10837. Enable the specified chain of postprocessing subfilters using libpostproc. This
  10838. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  10839. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  10840. Each subfilter and some options have a short and a long name that can be used
  10841. interchangeably, i.e. dr/dering are the same.
  10842. The filters accept the following options:
  10843. @table @option
  10844. @item subfilters
  10845. Set postprocessing subfilters string.
  10846. @end table
  10847. All subfilters share common options to determine their scope:
  10848. @table @option
  10849. @item a/autoq
  10850. Honor the quality commands for this subfilter.
  10851. @item c/chrom
  10852. Do chrominance filtering, too (default).
  10853. @item y/nochrom
  10854. Do luminance filtering only (no chrominance).
  10855. @item n/noluma
  10856. Do chrominance filtering only (no luminance).
  10857. @end table
  10858. These options can be appended after the subfilter name, separated by a '|'.
  10859. Available subfilters are:
  10860. @table @option
  10861. @item hb/hdeblock[|difference[|flatness]]
  10862. Horizontal deblocking filter
  10863. @table @option
  10864. @item difference
  10865. Difference factor where higher values mean more deblocking (default: @code{32}).
  10866. @item flatness
  10867. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10868. @end table
  10869. @item vb/vdeblock[|difference[|flatness]]
  10870. Vertical deblocking filter
  10871. @table @option
  10872. @item difference
  10873. Difference factor where higher values mean more deblocking (default: @code{32}).
  10874. @item flatness
  10875. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10876. @end table
  10877. @item ha/hadeblock[|difference[|flatness]]
  10878. Accurate horizontal deblocking filter
  10879. @table @option
  10880. @item difference
  10881. Difference factor where higher values mean more deblocking (default: @code{32}).
  10882. @item flatness
  10883. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10884. @end table
  10885. @item va/vadeblock[|difference[|flatness]]
  10886. Accurate vertical deblocking filter
  10887. @table @option
  10888. @item difference
  10889. Difference factor where higher values mean more deblocking (default: @code{32}).
  10890. @item flatness
  10891. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10892. @end table
  10893. @end table
  10894. The horizontal and vertical deblocking filters share the difference and
  10895. flatness values so you cannot set different horizontal and vertical
  10896. thresholds.
  10897. @table @option
  10898. @item h1/x1hdeblock
  10899. Experimental horizontal deblocking filter
  10900. @item v1/x1vdeblock
  10901. Experimental vertical deblocking filter
  10902. @item dr/dering
  10903. Deringing filter
  10904. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10905. @table @option
  10906. @item threshold1
  10907. larger -> stronger filtering
  10908. @item threshold2
  10909. larger -> stronger filtering
  10910. @item threshold3
  10911. larger -> stronger filtering
  10912. @end table
  10913. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10914. @table @option
  10915. @item f/fullyrange
  10916. Stretch luminance to @code{0-255}.
  10917. @end table
  10918. @item lb/linblenddeint
  10919. Linear blend deinterlacing filter that deinterlaces the given block by
  10920. filtering all lines with a @code{(1 2 1)} filter.
  10921. @item li/linipoldeint
  10922. Linear interpolating deinterlacing filter that deinterlaces the given block by
  10923. linearly interpolating every second line.
  10924. @item ci/cubicipoldeint
  10925. Cubic interpolating deinterlacing filter deinterlaces the given block by
  10926. cubically interpolating every second line.
  10927. @item md/mediandeint
  10928. Median deinterlacing filter that deinterlaces the given block by applying a
  10929. median filter to every second line.
  10930. @item fd/ffmpegdeint
  10931. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  10932. second line with a @code{(-1 4 2 4 -1)} filter.
  10933. @item l5/lowpass5
  10934. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  10935. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  10936. @item fq/forceQuant[|quantizer]
  10937. Overrides the quantizer table from the input with the constant quantizer you
  10938. specify.
  10939. @table @option
  10940. @item quantizer
  10941. Quantizer to use
  10942. @end table
  10943. @item de/default
  10944. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  10945. @item fa/fast
  10946. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  10947. @item ac
  10948. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  10949. @end table
  10950. @subsection Examples
  10951. @itemize
  10952. @item
  10953. Apply horizontal and vertical deblocking, deringing and automatic
  10954. brightness/contrast:
  10955. @example
  10956. pp=hb/vb/dr/al
  10957. @end example
  10958. @item
  10959. Apply default filters without brightness/contrast correction:
  10960. @example
  10961. pp=de/-al
  10962. @end example
  10963. @item
  10964. Apply default filters and temporal denoiser:
  10965. @example
  10966. pp=default/tmpnoise|1|2|3
  10967. @end example
  10968. @item
  10969. Apply deblocking on luminance only, and switch vertical deblocking on or off
  10970. automatically depending on available CPU time:
  10971. @example
  10972. pp=hb|y/vb|a
  10973. @end example
  10974. @end itemize
  10975. @section pp7
  10976. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  10977. similar to spp = 6 with 7 point DCT, where only the center sample is
  10978. used after IDCT.
  10979. The filter accepts the following options:
  10980. @table @option
  10981. @item qp
  10982. Force a constant quantization parameter. It accepts an integer in range
  10983. 0 to 63. If not set, the filter will use the QP from the video stream
  10984. (if available).
  10985. @item mode
  10986. Set thresholding mode. Available modes are:
  10987. @table @samp
  10988. @item hard
  10989. Set hard thresholding.
  10990. @item soft
  10991. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10992. @item medium
  10993. Set medium thresholding (good results, default).
  10994. @end table
  10995. @end table
  10996. @section premultiply
  10997. Apply alpha premultiply effect to input video stream using first plane
  10998. of second stream as alpha.
  10999. Both streams must have same dimensions and same pixel format.
  11000. The filter accepts the following option:
  11001. @table @option
  11002. @item planes
  11003. Set which planes will be processed, unprocessed planes will be copied.
  11004. By default value 0xf, all planes will be processed.
  11005. @item inplace
  11006. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11007. @end table
  11008. @section prewitt
  11009. Apply prewitt operator to input video stream.
  11010. The filter accepts the following option:
  11011. @table @option
  11012. @item planes
  11013. Set which planes will be processed, unprocessed planes will be copied.
  11014. By default value 0xf, all planes will be processed.
  11015. @item scale
  11016. Set value which will be multiplied with filtered result.
  11017. @item delta
  11018. Set value which will be added to filtered result.
  11019. @end table
  11020. @anchor{program_opencl}
  11021. @section program_opencl
  11022. Filter video using an OpenCL program.
  11023. @table @option
  11024. @item source
  11025. OpenCL program source file.
  11026. @item kernel
  11027. Kernel name in program.
  11028. @item inputs
  11029. Number of inputs to the filter. Defaults to 1.
  11030. @item size, s
  11031. Size of output frames. Defaults to the same as the first input.
  11032. @end table
  11033. The program source file must contain a kernel function with the given name,
  11034. which will be run once for each plane of the output. Each run on a plane
  11035. gets enqueued as a separate 2D global NDRange with one work-item for each
  11036. pixel to be generated. The global ID offset for each work-item is therefore
  11037. the coordinates of a pixel in the destination image.
  11038. The kernel function needs to take the following arguments:
  11039. @itemize
  11040. @item
  11041. Destination image, @var{__write_only image2d_t}.
  11042. This image will become the output; the kernel should write all of it.
  11043. @item
  11044. Frame index, @var{unsigned int}.
  11045. This is a counter starting from zero and increasing by one for each frame.
  11046. @item
  11047. Source images, @var{__read_only image2d_t}.
  11048. These are the most recent images on each input. The kernel may read from
  11049. them to generate the output, but they can't be written to.
  11050. @end itemize
  11051. Example programs:
  11052. @itemize
  11053. @item
  11054. Copy the input to the output (output must be the same size as the input).
  11055. @verbatim
  11056. __kernel void copy(__write_only image2d_t destination,
  11057. unsigned int index,
  11058. __read_only image2d_t source)
  11059. {
  11060. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  11061. int2 location = (int2)(get_global_id(0), get_global_id(1));
  11062. float4 value = read_imagef(source, sampler, location);
  11063. write_imagef(destination, location, value);
  11064. }
  11065. @end verbatim
  11066. @item
  11067. Apply a simple transformation, rotating the input by an amount increasing
  11068. with the index counter. Pixel values are linearly interpolated by the
  11069. sampler, and the output need not have the same dimensions as the input.
  11070. @verbatim
  11071. __kernel void rotate_image(__write_only image2d_t dst,
  11072. unsigned int index,
  11073. __read_only image2d_t src)
  11074. {
  11075. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  11076. CLK_FILTER_LINEAR);
  11077. float angle = (float)index / 100.0f;
  11078. float2 dst_dim = convert_float2(get_image_dim(dst));
  11079. float2 src_dim = convert_float2(get_image_dim(src));
  11080. float2 dst_cen = dst_dim / 2.0f;
  11081. float2 src_cen = src_dim / 2.0f;
  11082. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  11083. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  11084. float2 src_pos = {
  11085. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  11086. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  11087. };
  11088. src_pos = src_pos * src_dim / dst_dim;
  11089. float2 src_loc = src_pos + src_cen;
  11090. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  11091. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  11092. write_imagef(dst, dst_loc, 0.5f);
  11093. else
  11094. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  11095. }
  11096. @end verbatim
  11097. @item
  11098. Blend two inputs together, with the amount of each input used varying
  11099. with the index counter.
  11100. @verbatim
  11101. __kernel void blend_images(__write_only image2d_t dst,
  11102. unsigned int index,
  11103. __read_only image2d_t src1,
  11104. __read_only image2d_t src2)
  11105. {
  11106. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  11107. CLK_FILTER_LINEAR);
  11108. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  11109. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  11110. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  11111. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  11112. float4 val1 = read_imagef(src1, sampler, src1_loc);
  11113. float4 val2 = read_imagef(src2, sampler, src2_loc);
  11114. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  11115. }
  11116. @end verbatim
  11117. @end itemize
  11118. @section pseudocolor
  11119. Alter frame colors in video with pseudocolors.
  11120. This filter accepts the following options:
  11121. @table @option
  11122. @item c0
  11123. set pixel first component expression
  11124. @item c1
  11125. set pixel second component expression
  11126. @item c2
  11127. set pixel third component expression
  11128. @item c3
  11129. set pixel fourth component expression, corresponds to the alpha component
  11130. @item i
  11131. set component to use as base for altering colors
  11132. @end table
  11133. Each of them specifies the expression to use for computing the lookup table for
  11134. the corresponding pixel component values.
  11135. The expressions can contain the following constants and functions:
  11136. @table @option
  11137. @item w
  11138. @item h
  11139. The input width and height.
  11140. @item val
  11141. The input value for the pixel component.
  11142. @item ymin, umin, vmin, amin
  11143. The minimum allowed component value.
  11144. @item ymax, umax, vmax, amax
  11145. The maximum allowed component value.
  11146. @end table
  11147. All expressions default to "val".
  11148. @subsection Examples
  11149. @itemize
  11150. @item
  11151. Change too high luma values to gradient:
  11152. @example
  11153. 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'"
  11154. @end example
  11155. @end itemize
  11156. @section psnr
  11157. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  11158. Ratio) between two input videos.
  11159. This filter takes in input two input videos, the first input is
  11160. considered the "main" source and is passed unchanged to the
  11161. output. The second input is used as a "reference" video for computing
  11162. the PSNR.
  11163. Both video inputs must have the same resolution and pixel format for
  11164. this filter to work correctly. Also it assumes that both inputs
  11165. have the same number of frames, which are compared one by one.
  11166. The obtained average PSNR is printed through the logging system.
  11167. The filter stores the accumulated MSE (mean squared error) of each
  11168. frame, and at the end of the processing it is averaged across all frames
  11169. equally, and the following formula is applied to obtain the PSNR:
  11170. @example
  11171. PSNR = 10*log10(MAX^2/MSE)
  11172. @end example
  11173. Where MAX is the average of the maximum values of each component of the
  11174. image.
  11175. The description of the accepted parameters follows.
  11176. @table @option
  11177. @item stats_file, f
  11178. If specified the filter will use the named file to save the PSNR of
  11179. each individual frame. When filename equals "-" the data is sent to
  11180. standard output.
  11181. @item stats_version
  11182. Specifies which version of the stats file format to use. Details of
  11183. each format are written below.
  11184. Default value is 1.
  11185. @item stats_add_max
  11186. Determines whether the max value is output to the stats log.
  11187. Default value is 0.
  11188. Requires stats_version >= 2. If this is set and stats_version < 2,
  11189. the filter will return an error.
  11190. @end table
  11191. This filter also supports the @ref{framesync} options.
  11192. The file printed if @var{stats_file} is selected, contains a sequence of
  11193. key/value pairs of the form @var{key}:@var{value} for each compared
  11194. couple of frames.
  11195. If a @var{stats_version} greater than 1 is specified, a header line precedes
  11196. the list of per-frame-pair stats, with key value pairs following the frame
  11197. format with the following parameters:
  11198. @table @option
  11199. @item psnr_log_version
  11200. The version of the log file format. Will match @var{stats_version}.
  11201. @item fields
  11202. A comma separated list of the per-frame-pair parameters included in
  11203. the log.
  11204. @end table
  11205. A description of each shown per-frame-pair parameter follows:
  11206. @table @option
  11207. @item n
  11208. sequential number of the input frame, starting from 1
  11209. @item mse_avg
  11210. Mean Square Error pixel-by-pixel average difference of the compared
  11211. frames, averaged over all the image components.
  11212. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  11213. Mean Square Error pixel-by-pixel average difference of the compared
  11214. frames for the component specified by the suffix.
  11215. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  11216. Peak Signal to Noise ratio of the compared frames for the component
  11217. specified by the suffix.
  11218. @item max_avg, max_y, max_u, max_v
  11219. Maximum allowed value for each channel, and average over all
  11220. channels.
  11221. @end table
  11222. For example:
  11223. @example
  11224. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11225. [main][ref] psnr="stats_file=stats.log" [out]
  11226. @end example
  11227. On this example the input file being processed is compared with the
  11228. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  11229. is stored in @file{stats.log}.
  11230. @anchor{pullup}
  11231. @section pullup
  11232. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  11233. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  11234. content.
  11235. The pullup filter is designed to take advantage of future context in making
  11236. its decisions. This filter is stateless in the sense that it does not lock
  11237. onto a pattern to follow, but it instead looks forward to the following
  11238. fields in order to identify matches and rebuild progressive frames.
  11239. To produce content with an even framerate, insert the fps filter after
  11240. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  11241. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  11242. The filter accepts the following options:
  11243. @table @option
  11244. @item jl
  11245. @item jr
  11246. @item jt
  11247. @item jb
  11248. These options set the amount of "junk" to ignore at the left, right, top, and
  11249. bottom of the image, respectively. Left and right are in units of 8 pixels,
  11250. while top and bottom are in units of 2 lines.
  11251. The default is 8 pixels on each side.
  11252. @item sb
  11253. Set the strict breaks. Setting this option to 1 will reduce the chances of
  11254. filter generating an occasional mismatched frame, but it may also cause an
  11255. excessive number of frames to be dropped during high motion sequences.
  11256. Conversely, setting it to -1 will make filter match fields more easily.
  11257. This may help processing of video where there is slight blurring between
  11258. the fields, but may also cause there to be interlaced frames in the output.
  11259. Default value is @code{0}.
  11260. @item mp
  11261. Set the metric plane to use. It accepts the following values:
  11262. @table @samp
  11263. @item l
  11264. Use luma plane.
  11265. @item u
  11266. Use chroma blue plane.
  11267. @item v
  11268. Use chroma red plane.
  11269. @end table
  11270. This option may be set to use chroma plane instead of the default luma plane
  11271. for doing filter's computations. This may improve accuracy on very clean
  11272. source material, but more likely will decrease accuracy, especially if there
  11273. is chroma noise (rainbow effect) or any grayscale video.
  11274. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  11275. load and make pullup usable in realtime on slow machines.
  11276. @end table
  11277. For best results (without duplicated frames in the output file) it is
  11278. necessary to change the output frame rate. For example, to inverse
  11279. telecine NTSC input:
  11280. @example
  11281. ffmpeg -i input -vf pullup -r 24000/1001 ...
  11282. @end example
  11283. @section qp
  11284. Change video quantization parameters (QP).
  11285. The filter accepts the following option:
  11286. @table @option
  11287. @item qp
  11288. Set expression for quantization parameter.
  11289. @end table
  11290. The expression is evaluated through the eval API and can contain, among others,
  11291. the following constants:
  11292. @table @var
  11293. @item known
  11294. 1 if index is not 129, 0 otherwise.
  11295. @item qp
  11296. Sequential index starting from -129 to 128.
  11297. @end table
  11298. @subsection Examples
  11299. @itemize
  11300. @item
  11301. Some equation like:
  11302. @example
  11303. qp=2+2*sin(PI*qp)
  11304. @end example
  11305. @end itemize
  11306. @section random
  11307. Flush video frames from internal cache of frames into a random order.
  11308. No frame is discarded.
  11309. Inspired by @ref{frei0r} nervous filter.
  11310. @table @option
  11311. @item frames
  11312. Set size in number of frames of internal cache, in range from @code{2} to
  11313. @code{512}. Default is @code{30}.
  11314. @item seed
  11315. Set seed for random number generator, must be an integer included between
  11316. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11317. less than @code{0}, the filter will try to use a good random seed on a
  11318. best effort basis.
  11319. @end table
  11320. @section readeia608
  11321. Read closed captioning (EIA-608) information from the top lines of a video frame.
  11322. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  11323. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  11324. with EIA-608 data (starting from 0). A description of each metadata value follows:
  11325. @table @option
  11326. @item lavfi.readeia608.X.cc
  11327. The two bytes stored as EIA-608 data (printed in hexadecimal).
  11328. @item lavfi.readeia608.X.line
  11329. The number of the line on which the EIA-608 data was identified and read.
  11330. @end table
  11331. This filter accepts the following options:
  11332. @table @option
  11333. @item scan_min
  11334. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  11335. @item scan_max
  11336. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  11337. @item mac
  11338. Set minimal acceptable amplitude change for sync codes detection.
  11339. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  11340. @item spw
  11341. Set the ratio of width reserved for sync code detection.
  11342. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  11343. @item mhd
  11344. Set the max peaks height difference for sync code detection.
  11345. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11346. @item mpd
  11347. Set max peaks period difference for sync code detection.
  11348. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11349. @item msd
  11350. Set the first two max start code bits differences.
  11351. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  11352. @item bhd
  11353. Set the minimum ratio of bits height compared to 3rd start code bit.
  11354. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  11355. @item th_w
  11356. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  11357. @item th_b
  11358. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  11359. @item chp
  11360. Enable checking the parity bit. In the event of a parity error, the filter will output
  11361. @code{0x00} for that character. Default is false.
  11362. @item lp
  11363. Lowpass lines prior to further processing. Default is disabled.
  11364. @end table
  11365. @subsection Examples
  11366. @itemize
  11367. @item
  11368. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  11369. @example
  11370. 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
  11371. @end example
  11372. @end itemize
  11373. @section readvitc
  11374. Read vertical interval timecode (VITC) information from the top lines of a
  11375. video frame.
  11376. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  11377. timecode value, if a valid timecode has been detected. Further metadata key
  11378. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  11379. timecode data has been found or not.
  11380. This filter accepts the following options:
  11381. @table @option
  11382. @item scan_max
  11383. Set the maximum number of lines to scan for VITC data. If the value is set to
  11384. @code{-1} the full video frame is scanned. Default is @code{45}.
  11385. @item thr_b
  11386. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  11387. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  11388. @item thr_w
  11389. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  11390. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  11391. @end table
  11392. @subsection Examples
  11393. @itemize
  11394. @item
  11395. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  11396. draw @code{--:--:--:--} as a placeholder:
  11397. @example
  11398. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  11399. @end example
  11400. @end itemize
  11401. @section remap
  11402. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  11403. Destination pixel at position (X, Y) will be picked from source (x, y) position
  11404. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  11405. value for pixel will be used for destination pixel.
  11406. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  11407. will have Xmap/Ymap video stream dimensions.
  11408. Xmap and Ymap input video streams are 16bit depth, single channel.
  11409. @table @option
  11410. @item format
  11411. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  11412. Default is @code{color}.
  11413. @end table
  11414. @section removegrain
  11415. The removegrain filter is a spatial denoiser for progressive video.
  11416. @table @option
  11417. @item m0
  11418. Set mode for the first plane.
  11419. @item m1
  11420. Set mode for the second plane.
  11421. @item m2
  11422. Set mode for the third plane.
  11423. @item m3
  11424. Set mode for the fourth plane.
  11425. @end table
  11426. Range of mode is from 0 to 24. Description of each mode follows:
  11427. @table @var
  11428. @item 0
  11429. Leave input plane unchanged. Default.
  11430. @item 1
  11431. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  11432. @item 2
  11433. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  11434. @item 3
  11435. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  11436. @item 4
  11437. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  11438. This is equivalent to a median filter.
  11439. @item 5
  11440. Line-sensitive clipping giving the minimal change.
  11441. @item 6
  11442. Line-sensitive clipping, intermediate.
  11443. @item 7
  11444. Line-sensitive clipping, intermediate.
  11445. @item 8
  11446. Line-sensitive clipping, intermediate.
  11447. @item 9
  11448. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  11449. @item 10
  11450. Replaces the target pixel with the closest neighbour.
  11451. @item 11
  11452. [1 2 1] horizontal and vertical kernel blur.
  11453. @item 12
  11454. Same as mode 11.
  11455. @item 13
  11456. Bob mode, interpolates top field from the line where the neighbours
  11457. pixels are the closest.
  11458. @item 14
  11459. Bob mode, interpolates bottom field from the line where the neighbours
  11460. pixels are the closest.
  11461. @item 15
  11462. Bob mode, interpolates top field. Same as 13 but with a more complicated
  11463. interpolation formula.
  11464. @item 16
  11465. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  11466. interpolation formula.
  11467. @item 17
  11468. Clips the pixel with the minimum and maximum of respectively the maximum and
  11469. minimum of each pair of opposite neighbour pixels.
  11470. @item 18
  11471. Line-sensitive clipping using opposite neighbours whose greatest distance from
  11472. the current pixel is minimal.
  11473. @item 19
  11474. Replaces the pixel with the average of its 8 neighbours.
  11475. @item 20
  11476. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  11477. @item 21
  11478. Clips pixels using the averages of opposite neighbour.
  11479. @item 22
  11480. Same as mode 21 but simpler and faster.
  11481. @item 23
  11482. Small edge and halo removal, but reputed useless.
  11483. @item 24
  11484. Similar as 23.
  11485. @end table
  11486. @section removelogo
  11487. Suppress a TV station logo, using an image file to determine which
  11488. pixels comprise the logo. It works by filling in the pixels that
  11489. comprise the logo with neighboring pixels.
  11490. The filter accepts the following options:
  11491. @table @option
  11492. @item filename, f
  11493. Set the filter bitmap file, which can be any image format supported by
  11494. libavformat. The width and height of the image file must match those of the
  11495. video stream being processed.
  11496. @end table
  11497. Pixels in the provided bitmap image with a value of zero are not
  11498. considered part of the logo, non-zero pixels are considered part of
  11499. the logo. If you use white (255) for the logo and black (0) for the
  11500. rest, you will be safe. For making the filter bitmap, it is
  11501. recommended to take a screen capture of a black frame with the logo
  11502. visible, and then using a threshold filter followed by the erode
  11503. filter once or twice.
  11504. If needed, little splotches can be fixed manually. Remember that if
  11505. logo pixels are not covered, the filter quality will be much
  11506. reduced. Marking too many pixels as part of the logo does not hurt as
  11507. much, but it will increase the amount of blurring needed to cover over
  11508. the image and will destroy more information than necessary, and extra
  11509. pixels will slow things down on a large logo.
  11510. @section repeatfields
  11511. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  11512. fields based on its value.
  11513. @section reverse
  11514. Reverse a video clip.
  11515. Warning: This filter requires memory to buffer the entire clip, so trimming
  11516. is suggested.
  11517. @subsection Examples
  11518. @itemize
  11519. @item
  11520. Take the first 5 seconds of a clip, and reverse it.
  11521. @example
  11522. trim=end=5,reverse
  11523. @end example
  11524. @end itemize
  11525. @section rgbashift
  11526. Shift R/G/B/A pixels horizontally and/or vertically.
  11527. The filter accepts the following options:
  11528. @table @option
  11529. @item rh
  11530. Set amount to shift red horizontally.
  11531. @item rv
  11532. Set amount to shift red vertically.
  11533. @item gh
  11534. Set amount to shift green horizontally.
  11535. @item gv
  11536. Set amount to shift green vertically.
  11537. @item bh
  11538. Set amount to shift blue horizontally.
  11539. @item bv
  11540. Set amount to shift blue vertically.
  11541. @item ah
  11542. Set amount to shift alpha horizontally.
  11543. @item av
  11544. Set amount to shift alpha vertically.
  11545. @item edge
  11546. Set edge mode, can be @var{smear}, default, or @var{warp}.
  11547. @end table
  11548. @section roberts
  11549. Apply roberts cross operator to input video stream.
  11550. The filter accepts the following option:
  11551. @table @option
  11552. @item planes
  11553. Set which planes will be processed, unprocessed planes will be copied.
  11554. By default value 0xf, all planes will be processed.
  11555. @item scale
  11556. Set value which will be multiplied with filtered result.
  11557. @item delta
  11558. Set value which will be added to filtered result.
  11559. @end table
  11560. @section rotate
  11561. Rotate video by an arbitrary angle expressed in radians.
  11562. The filter accepts the following options:
  11563. A description of the optional parameters follows.
  11564. @table @option
  11565. @item angle, a
  11566. Set an expression for the angle by which to rotate the input video
  11567. clockwise, expressed as a number of radians. A negative value will
  11568. result in a counter-clockwise rotation. By default it is set to "0".
  11569. This expression is evaluated for each frame.
  11570. @item out_w, ow
  11571. Set the output width expression, default value is "iw".
  11572. This expression is evaluated just once during configuration.
  11573. @item out_h, oh
  11574. Set the output height expression, default value is "ih".
  11575. This expression is evaluated just once during configuration.
  11576. @item bilinear
  11577. Enable bilinear interpolation if set to 1, a value of 0 disables
  11578. it. Default value is 1.
  11579. @item fillcolor, c
  11580. Set the color used to fill the output area not covered by the rotated
  11581. image. For the general syntax of this option, check the
  11582. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11583. If the special value "none" is selected then no
  11584. background is printed (useful for example if the background is never shown).
  11585. Default value is "black".
  11586. @end table
  11587. The expressions for the angle and the output size can contain the
  11588. following constants and functions:
  11589. @table @option
  11590. @item n
  11591. sequential number of the input frame, starting from 0. It is always NAN
  11592. before the first frame is filtered.
  11593. @item t
  11594. time in seconds of the input frame, it is set to 0 when the filter is
  11595. configured. It is always NAN before the first frame is filtered.
  11596. @item hsub
  11597. @item vsub
  11598. horizontal and vertical chroma subsample values. For example for the
  11599. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11600. @item in_w, iw
  11601. @item in_h, ih
  11602. the input video width and height
  11603. @item out_w, ow
  11604. @item out_h, oh
  11605. the output width and height, that is the size of the padded area as
  11606. specified by the @var{width} and @var{height} expressions
  11607. @item rotw(a)
  11608. @item roth(a)
  11609. the minimal width/height required for completely containing the input
  11610. video rotated by @var{a} radians.
  11611. These are only available when computing the @option{out_w} and
  11612. @option{out_h} expressions.
  11613. @end table
  11614. @subsection Examples
  11615. @itemize
  11616. @item
  11617. Rotate the input by PI/6 radians clockwise:
  11618. @example
  11619. rotate=PI/6
  11620. @end example
  11621. @item
  11622. Rotate the input by PI/6 radians counter-clockwise:
  11623. @example
  11624. rotate=-PI/6
  11625. @end example
  11626. @item
  11627. Rotate the input by 45 degrees clockwise:
  11628. @example
  11629. rotate=45*PI/180
  11630. @end example
  11631. @item
  11632. Apply a constant rotation with period T, starting from an angle of PI/3:
  11633. @example
  11634. rotate=PI/3+2*PI*t/T
  11635. @end example
  11636. @item
  11637. Make the input video rotation oscillating with a period of T
  11638. seconds and an amplitude of A radians:
  11639. @example
  11640. rotate=A*sin(2*PI/T*t)
  11641. @end example
  11642. @item
  11643. Rotate the video, output size is chosen so that the whole rotating
  11644. input video is always completely contained in the output:
  11645. @example
  11646. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  11647. @end example
  11648. @item
  11649. Rotate the video, reduce the output size so that no background is ever
  11650. shown:
  11651. @example
  11652. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  11653. @end example
  11654. @end itemize
  11655. @subsection Commands
  11656. The filter supports the following commands:
  11657. @table @option
  11658. @item a, angle
  11659. Set the angle expression.
  11660. The command accepts the same syntax of the corresponding option.
  11661. If the specified expression is not valid, it is kept at its current
  11662. value.
  11663. @end table
  11664. @section sab
  11665. Apply Shape Adaptive Blur.
  11666. The filter accepts the following options:
  11667. @table @option
  11668. @item luma_radius, lr
  11669. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  11670. value is 1.0. A greater value will result in a more blurred image, and
  11671. in slower processing.
  11672. @item luma_pre_filter_radius, lpfr
  11673. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  11674. value is 1.0.
  11675. @item luma_strength, ls
  11676. Set luma maximum difference between pixels to still be considered, must
  11677. be a value in the 0.1-100.0 range, default value is 1.0.
  11678. @item chroma_radius, cr
  11679. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  11680. greater value will result in a more blurred image, and in slower
  11681. processing.
  11682. @item chroma_pre_filter_radius, cpfr
  11683. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  11684. @item chroma_strength, cs
  11685. Set chroma maximum difference between pixels to still be considered,
  11686. must be a value in the -0.9-100.0 range.
  11687. @end table
  11688. Each chroma option value, if not explicitly specified, is set to the
  11689. corresponding luma option value.
  11690. @anchor{scale}
  11691. @section scale
  11692. Scale (resize) the input video, using the libswscale library.
  11693. The scale filter forces the output display aspect ratio to be the same
  11694. of the input, by changing the output sample aspect ratio.
  11695. If the input image format is different from the format requested by
  11696. the next filter, the scale filter will convert the input to the
  11697. requested format.
  11698. @subsection Options
  11699. The filter accepts the following options, or any of the options
  11700. supported by the libswscale scaler.
  11701. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  11702. the complete list of scaler options.
  11703. @table @option
  11704. @item width, w
  11705. @item height, h
  11706. Set the output video dimension expression. Default value is the input
  11707. dimension.
  11708. If the @var{width} or @var{w} value is 0, the input width is used for
  11709. the output. If the @var{height} or @var{h} value is 0, the input height
  11710. is used for the output.
  11711. If one and only one of the values is -n with n >= 1, the scale filter
  11712. will use a value that maintains the aspect ratio of the input image,
  11713. calculated from the other specified dimension. After that it will,
  11714. however, make sure that the calculated dimension is divisible by n and
  11715. adjust the value if necessary.
  11716. If both values are -n with n >= 1, the behavior will be identical to
  11717. both values being set to 0 as previously detailed.
  11718. See below for the list of accepted constants for use in the dimension
  11719. expression.
  11720. @item eval
  11721. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  11722. @table @samp
  11723. @item init
  11724. Only evaluate expressions once during the filter initialization or when a command is processed.
  11725. @item frame
  11726. Evaluate expressions for each incoming frame.
  11727. @end table
  11728. Default value is @samp{init}.
  11729. @item interl
  11730. Set the interlacing mode. It accepts the following values:
  11731. @table @samp
  11732. @item 1
  11733. Force interlaced aware scaling.
  11734. @item 0
  11735. Do not apply interlaced scaling.
  11736. @item -1
  11737. Select interlaced aware scaling depending on whether the source frames
  11738. are flagged as interlaced or not.
  11739. @end table
  11740. Default value is @samp{0}.
  11741. @item flags
  11742. Set libswscale scaling flags. See
  11743. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11744. complete list of values. If not explicitly specified the filter applies
  11745. the default flags.
  11746. @item param0, param1
  11747. Set libswscale input parameters for scaling algorithms that need them. See
  11748. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11749. complete documentation. If not explicitly specified the filter applies
  11750. empty parameters.
  11751. @item size, s
  11752. Set the video size. For the syntax of this option, check the
  11753. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11754. @item in_color_matrix
  11755. @item out_color_matrix
  11756. Set in/output YCbCr color space type.
  11757. This allows the autodetected value to be overridden as well as allows forcing
  11758. a specific value used for the output and encoder.
  11759. If not specified, the color space type depends on the pixel format.
  11760. Possible values:
  11761. @table @samp
  11762. @item auto
  11763. Choose automatically.
  11764. @item bt709
  11765. Format conforming to International Telecommunication Union (ITU)
  11766. Recommendation BT.709.
  11767. @item fcc
  11768. Set color space conforming to the United States Federal Communications
  11769. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  11770. @item bt601
  11771. @item bt470
  11772. @item smpte170m
  11773. Set color space conforming to:
  11774. @itemize
  11775. @item
  11776. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  11777. @item
  11778. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  11779. @item
  11780. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  11781. @end itemize
  11782. @item smpte240m
  11783. Set color space conforming to SMPTE ST 240:1999.
  11784. @item bt2020
  11785. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  11786. @end table
  11787. @item in_range
  11788. @item out_range
  11789. Set in/output YCbCr sample range.
  11790. This allows the autodetected value to be overridden as well as allows forcing
  11791. a specific value used for the output and encoder. If not specified, the
  11792. range depends on the pixel format. Possible values:
  11793. @table @samp
  11794. @item auto/unknown
  11795. Choose automatically.
  11796. @item jpeg/full/pc
  11797. Set full range (0-255 in case of 8-bit luma).
  11798. @item mpeg/limited/tv
  11799. Set "MPEG" range (16-235 in case of 8-bit luma).
  11800. @end table
  11801. @item force_original_aspect_ratio
  11802. Enable decreasing or increasing output video width or height if necessary to
  11803. keep the original aspect ratio. Possible values:
  11804. @table @samp
  11805. @item disable
  11806. Scale the video as specified and disable this feature.
  11807. @item decrease
  11808. The output video dimensions will automatically be decreased if needed.
  11809. @item increase
  11810. The output video dimensions will automatically be increased if needed.
  11811. @end table
  11812. One useful instance of this option is that when you know a specific device's
  11813. maximum allowed resolution, you can use this to limit the output video to
  11814. that, while retaining the aspect ratio. For example, device A allows
  11815. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  11816. decrease) and specifying 1280x720 to the command line makes the output
  11817. 1280x533.
  11818. Please note that this is a different thing than specifying -1 for @option{w}
  11819. or @option{h}, you still need to specify the output resolution for this option
  11820. to work.
  11821. @item force_divisible_by Ensures that the output resolution is divisible by the
  11822. given integer when used together with @option{force_original_aspect_ratio}. This
  11823. works similar to using -n in the @option{w} and @option{h} options.
  11824. This option respects the value set for @option{force_original_aspect_ratio},
  11825. increasing or decreasing the resolution accordingly. This may slightly modify
  11826. the video's aspect ration.
  11827. This can be handy, for example, if you want to have a video fit within a defined
  11828. resolution using the @option{force_original_aspect_ratio} option but have
  11829. encoder restrictions when it comes to width or height.
  11830. @end table
  11831. The values of the @option{w} and @option{h} options are expressions
  11832. containing the following constants:
  11833. @table @var
  11834. @item in_w
  11835. @item in_h
  11836. The input width and height
  11837. @item iw
  11838. @item ih
  11839. These are the same as @var{in_w} and @var{in_h}.
  11840. @item out_w
  11841. @item out_h
  11842. The output (scaled) width and height
  11843. @item ow
  11844. @item oh
  11845. These are the same as @var{out_w} and @var{out_h}
  11846. @item a
  11847. The same as @var{iw} / @var{ih}
  11848. @item sar
  11849. input sample aspect ratio
  11850. @item dar
  11851. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11852. @item hsub
  11853. @item vsub
  11854. horizontal and vertical input chroma subsample values. For example for the
  11855. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11856. @item ohsub
  11857. @item ovsub
  11858. horizontal and vertical output chroma subsample values. For example for the
  11859. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11860. @end table
  11861. @subsection Examples
  11862. @itemize
  11863. @item
  11864. Scale the input video to a size of 200x100
  11865. @example
  11866. scale=w=200:h=100
  11867. @end example
  11868. This is equivalent to:
  11869. @example
  11870. scale=200:100
  11871. @end example
  11872. or:
  11873. @example
  11874. scale=200x100
  11875. @end example
  11876. @item
  11877. Specify a size abbreviation for the output size:
  11878. @example
  11879. scale=qcif
  11880. @end example
  11881. which can also be written as:
  11882. @example
  11883. scale=size=qcif
  11884. @end example
  11885. @item
  11886. Scale the input to 2x:
  11887. @example
  11888. scale=w=2*iw:h=2*ih
  11889. @end example
  11890. @item
  11891. The above is the same as:
  11892. @example
  11893. scale=2*in_w:2*in_h
  11894. @end example
  11895. @item
  11896. Scale the input to 2x with forced interlaced scaling:
  11897. @example
  11898. scale=2*iw:2*ih:interl=1
  11899. @end example
  11900. @item
  11901. Scale the input to half size:
  11902. @example
  11903. scale=w=iw/2:h=ih/2
  11904. @end example
  11905. @item
  11906. Increase the width, and set the height to the same size:
  11907. @example
  11908. scale=3/2*iw:ow
  11909. @end example
  11910. @item
  11911. Seek Greek harmony:
  11912. @example
  11913. scale=iw:1/PHI*iw
  11914. scale=ih*PHI:ih
  11915. @end example
  11916. @item
  11917. Increase the height, and set the width to 3/2 of the height:
  11918. @example
  11919. scale=w=3/2*oh:h=3/5*ih
  11920. @end example
  11921. @item
  11922. Increase the size, making the size a multiple of the chroma
  11923. subsample values:
  11924. @example
  11925. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  11926. @end example
  11927. @item
  11928. Increase the width to a maximum of 500 pixels,
  11929. keeping the same aspect ratio as the input:
  11930. @example
  11931. scale=w='min(500\, iw*3/2):h=-1'
  11932. @end example
  11933. @item
  11934. Make pixels square by combining scale and setsar:
  11935. @example
  11936. scale='trunc(ih*dar):ih',setsar=1/1
  11937. @end example
  11938. @item
  11939. Make pixels square by combining scale and setsar,
  11940. making sure the resulting resolution is even (required by some codecs):
  11941. @example
  11942. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  11943. @end example
  11944. @end itemize
  11945. @subsection Commands
  11946. This filter supports the following commands:
  11947. @table @option
  11948. @item width, w
  11949. @item height, h
  11950. Set the output video dimension expression.
  11951. The command accepts the same syntax of the corresponding option.
  11952. If the specified expression is not valid, it is kept at its current
  11953. value.
  11954. @end table
  11955. @section scale_npp
  11956. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  11957. format conversion on CUDA video frames. Setting the output width and height
  11958. works in the same way as for the @var{scale} filter.
  11959. The following additional options are accepted:
  11960. @table @option
  11961. @item format
  11962. The pixel format of the output CUDA frames. If set to the string "same" (the
  11963. default), the input format will be kept. Note that automatic format negotiation
  11964. and conversion is not yet supported for hardware frames
  11965. @item interp_algo
  11966. The interpolation algorithm used for resizing. One of the following:
  11967. @table @option
  11968. @item nn
  11969. Nearest neighbour.
  11970. @item linear
  11971. @item cubic
  11972. @item cubic2p_bspline
  11973. 2-parameter cubic (B=1, C=0)
  11974. @item cubic2p_catmullrom
  11975. 2-parameter cubic (B=0, C=1/2)
  11976. @item cubic2p_b05c03
  11977. 2-parameter cubic (B=1/2, C=3/10)
  11978. @item super
  11979. Supersampling
  11980. @item lanczos
  11981. @end table
  11982. @end table
  11983. @section scale2ref
  11984. Scale (resize) the input video, based on a reference video.
  11985. See the scale filter for available options, scale2ref supports the same but
  11986. uses the reference video instead of the main input as basis. scale2ref also
  11987. supports the following additional constants for the @option{w} and
  11988. @option{h} options:
  11989. @table @var
  11990. @item main_w
  11991. @item main_h
  11992. The main input video's width and height
  11993. @item main_a
  11994. The same as @var{main_w} / @var{main_h}
  11995. @item main_sar
  11996. The main input video's sample aspect ratio
  11997. @item main_dar, mdar
  11998. The main input video's display aspect ratio. Calculated from
  11999. @code{(main_w / main_h) * main_sar}.
  12000. @item main_hsub
  12001. @item main_vsub
  12002. The main input video's horizontal and vertical chroma subsample values.
  12003. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  12004. is 1.
  12005. @end table
  12006. @subsection Examples
  12007. @itemize
  12008. @item
  12009. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  12010. @example
  12011. 'scale2ref[b][a];[a][b]overlay'
  12012. @end example
  12013. @item
  12014. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  12015. @example
  12016. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  12017. @end example
  12018. @end itemize
  12019. @section scroll
  12020. Scroll input video horizontally and/or vertically by constant speed.
  12021. The filter accepts the following options:
  12022. @table @option
  12023. @item horizontal, h
  12024. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12025. Negative values changes scrolling direction.
  12026. @item vertical, v
  12027. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12028. Negative values changes scrolling direction.
  12029. @item hpos
  12030. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  12031. @item vpos
  12032. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  12033. @end table
  12034. @anchor{selectivecolor}
  12035. @section selectivecolor
  12036. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  12037. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  12038. by the "purity" of the color (that is, how saturated it already is).
  12039. This filter is similar to the Adobe Photoshop Selective Color tool.
  12040. The filter accepts the following options:
  12041. @table @option
  12042. @item correction_method
  12043. Select color correction method.
  12044. Available values are:
  12045. @table @samp
  12046. @item absolute
  12047. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  12048. component value).
  12049. @item relative
  12050. Specified adjustments are relative to the original component value.
  12051. @end table
  12052. Default is @code{absolute}.
  12053. @item reds
  12054. Adjustments for red pixels (pixels where the red component is the maximum)
  12055. @item yellows
  12056. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  12057. @item greens
  12058. Adjustments for green pixels (pixels where the green component is the maximum)
  12059. @item cyans
  12060. Adjustments for cyan pixels (pixels where the red component is the minimum)
  12061. @item blues
  12062. Adjustments for blue pixels (pixels where the blue component is the maximum)
  12063. @item magentas
  12064. Adjustments for magenta pixels (pixels where the green component is the minimum)
  12065. @item whites
  12066. Adjustments for white pixels (pixels where all components are greater than 128)
  12067. @item neutrals
  12068. Adjustments for all pixels except pure black and pure white
  12069. @item blacks
  12070. Adjustments for black pixels (pixels where all components are lesser than 128)
  12071. @item psfile
  12072. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  12073. @end table
  12074. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  12075. 4 space separated floating point adjustment values in the [-1,1] range,
  12076. respectively to adjust the amount of cyan, magenta, yellow and black for the
  12077. pixels of its range.
  12078. @subsection Examples
  12079. @itemize
  12080. @item
  12081. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  12082. increase magenta by 27% in blue areas:
  12083. @example
  12084. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  12085. @end example
  12086. @item
  12087. Use a Photoshop selective color preset:
  12088. @example
  12089. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  12090. @end example
  12091. @end itemize
  12092. @anchor{separatefields}
  12093. @section separatefields
  12094. The @code{separatefields} takes a frame-based video input and splits
  12095. each frame into its components fields, producing a new half height clip
  12096. with twice the frame rate and twice the frame count.
  12097. This filter use field-dominance information in frame to decide which
  12098. of each pair of fields to place first in the output.
  12099. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  12100. @section setdar, setsar
  12101. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  12102. output video.
  12103. This is done by changing the specified Sample (aka Pixel) Aspect
  12104. Ratio, according to the following equation:
  12105. @example
  12106. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  12107. @end example
  12108. Keep in mind that the @code{setdar} filter does not modify the pixel
  12109. dimensions of the video frame. Also, the display aspect ratio set by
  12110. this filter may be changed by later filters in the filterchain,
  12111. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  12112. applied.
  12113. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  12114. the filter output video.
  12115. Note that as a consequence of the application of this filter, the
  12116. output display aspect ratio will change according to the equation
  12117. above.
  12118. Keep in mind that the sample aspect ratio set by the @code{setsar}
  12119. filter may be changed by later filters in the filterchain, e.g. if
  12120. another "setsar" or a "setdar" filter is applied.
  12121. It accepts the following parameters:
  12122. @table @option
  12123. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  12124. Set the aspect ratio used by the filter.
  12125. The parameter can be a floating point number string, an expression, or
  12126. a string of the form @var{num}:@var{den}, where @var{num} and
  12127. @var{den} are the numerator and denominator of the aspect ratio. If
  12128. the parameter is not specified, it is assumed the value "0".
  12129. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  12130. should be escaped.
  12131. @item max
  12132. Set the maximum integer value to use for expressing numerator and
  12133. denominator when reducing the expressed aspect ratio to a rational.
  12134. Default value is @code{100}.
  12135. @end table
  12136. The parameter @var{sar} is an expression containing
  12137. the following constants:
  12138. @table @option
  12139. @item E, PI, PHI
  12140. These are approximated values for the mathematical constants e
  12141. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  12142. @item w, h
  12143. The input width and height.
  12144. @item a
  12145. These are the same as @var{w} / @var{h}.
  12146. @item sar
  12147. The input sample aspect ratio.
  12148. @item dar
  12149. The input display aspect ratio. It is the same as
  12150. (@var{w} / @var{h}) * @var{sar}.
  12151. @item hsub, vsub
  12152. Horizontal and vertical chroma subsample values. For example, for the
  12153. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12154. @end table
  12155. @subsection Examples
  12156. @itemize
  12157. @item
  12158. To change the display aspect ratio to 16:9, specify one of the following:
  12159. @example
  12160. setdar=dar=1.77777
  12161. setdar=dar=16/9
  12162. @end example
  12163. @item
  12164. To change the sample aspect ratio to 10:11, specify:
  12165. @example
  12166. setsar=sar=10/11
  12167. @end example
  12168. @item
  12169. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  12170. 1000 in the aspect ratio reduction, use the command:
  12171. @example
  12172. setdar=ratio=16/9:max=1000
  12173. @end example
  12174. @end itemize
  12175. @anchor{setfield}
  12176. @section setfield
  12177. Force field for the output video frame.
  12178. The @code{setfield} filter marks the interlace type field for the
  12179. output frames. It does not change the input frame, but only sets the
  12180. corresponding property, which affects how the frame is treated by
  12181. following filters (e.g. @code{fieldorder} or @code{yadif}).
  12182. The filter accepts the following options:
  12183. @table @option
  12184. @item mode
  12185. Available values are:
  12186. @table @samp
  12187. @item auto
  12188. Keep the same field property.
  12189. @item bff
  12190. Mark the frame as bottom-field-first.
  12191. @item tff
  12192. Mark the frame as top-field-first.
  12193. @item prog
  12194. Mark the frame as progressive.
  12195. @end table
  12196. @end table
  12197. @anchor{setparams}
  12198. @section setparams
  12199. Force frame parameter for the output video frame.
  12200. The @code{setparams} filter marks interlace and color range for the
  12201. output frames. It does not change the input frame, but only sets the
  12202. corresponding property, which affects how the frame is treated by
  12203. filters/encoders.
  12204. @table @option
  12205. @item field_mode
  12206. Available values are:
  12207. @table @samp
  12208. @item auto
  12209. Keep the same field property (default).
  12210. @item bff
  12211. Mark the frame as bottom-field-first.
  12212. @item tff
  12213. Mark the frame as top-field-first.
  12214. @item prog
  12215. Mark the frame as progressive.
  12216. @end table
  12217. @item range
  12218. Available values are:
  12219. @table @samp
  12220. @item auto
  12221. Keep the same color range property (default).
  12222. @item unspecified, unknown
  12223. Mark the frame as unspecified color range.
  12224. @item limited, tv, mpeg
  12225. Mark the frame as limited range.
  12226. @item full, pc, jpeg
  12227. Mark the frame as full range.
  12228. @end table
  12229. @item color_primaries
  12230. Set the color primaries.
  12231. Available values are:
  12232. @table @samp
  12233. @item auto
  12234. Keep the same color primaries property (default).
  12235. @item bt709
  12236. @item unknown
  12237. @item bt470m
  12238. @item bt470bg
  12239. @item smpte170m
  12240. @item smpte240m
  12241. @item film
  12242. @item bt2020
  12243. @item smpte428
  12244. @item smpte431
  12245. @item smpte432
  12246. @item jedec-p22
  12247. @end table
  12248. @item color_trc
  12249. Set the color transfer.
  12250. Available values are:
  12251. @table @samp
  12252. @item auto
  12253. Keep the same color trc property (default).
  12254. @item bt709
  12255. @item unknown
  12256. @item bt470m
  12257. @item bt470bg
  12258. @item smpte170m
  12259. @item smpte240m
  12260. @item linear
  12261. @item log100
  12262. @item log316
  12263. @item iec61966-2-4
  12264. @item bt1361e
  12265. @item iec61966-2-1
  12266. @item bt2020-10
  12267. @item bt2020-12
  12268. @item smpte2084
  12269. @item smpte428
  12270. @item arib-std-b67
  12271. @end table
  12272. @item colorspace
  12273. Set the colorspace.
  12274. Available values are:
  12275. @table @samp
  12276. @item auto
  12277. Keep the same colorspace property (default).
  12278. @item gbr
  12279. @item bt709
  12280. @item unknown
  12281. @item fcc
  12282. @item bt470bg
  12283. @item smpte170m
  12284. @item smpte240m
  12285. @item ycgco
  12286. @item bt2020nc
  12287. @item bt2020c
  12288. @item smpte2085
  12289. @item chroma-derived-nc
  12290. @item chroma-derived-c
  12291. @item ictcp
  12292. @end table
  12293. @end table
  12294. @section showinfo
  12295. Show a line containing various information for each input video frame.
  12296. The input video is not modified.
  12297. This filter supports the following options:
  12298. @table @option
  12299. @item checksum
  12300. Calculate checksums of each plane. By default enabled.
  12301. @end table
  12302. The shown line contains a sequence of key/value pairs of the form
  12303. @var{key}:@var{value}.
  12304. The following values are shown in the output:
  12305. @table @option
  12306. @item n
  12307. The (sequential) number of the input frame, starting from 0.
  12308. @item pts
  12309. The Presentation TimeStamp of the input frame, expressed as a number of
  12310. time base units. The time base unit depends on the filter input pad.
  12311. @item pts_time
  12312. The Presentation TimeStamp of the input frame, expressed as a number of
  12313. seconds.
  12314. @item pos
  12315. The position of the frame in the input stream, or -1 if this information is
  12316. unavailable and/or meaningless (for example in case of synthetic video).
  12317. @item fmt
  12318. The pixel format name.
  12319. @item sar
  12320. The sample aspect ratio of the input frame, expressed in the form
  12321. @var{num}/@var{den}.
  12322. @item s
  12323. The size of the input frame. For the syntax of this option, check the
  12324. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12325. @item i
  12326. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  12327. for bottom field first).
  12328. @item iskey
  12329. This is 1 if the frame is a key frame, 0 otherwise.
  12330. @item type
  12331. The picture type of the input frame ("I" for an I-frame, "P" for a
  12332. P-frame, "B" for a B-frame, or "?" for an unknown type).
  12333. Also refer to the documentation of the @code{AVPictureType} enum and of
  12334. the @code{av_get_picture_type_char} function defined in
  12335. @file{libavutil/avutil.h}.
  12336. @item checksum
  12337. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  12338. @item plane_checksum
  12339. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  12340. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  12341. @end table
  12342. @section showpalette
  12343. Displays the 256 colors palette of each frame. This filter is only relevant for
  12344. @var{pal8} pixel format frames.
  12345. It accepts the following option:
  12346. @table @option
  12347. @item s
  12348. Set the size of the box used to represent one palette color entry. Default is
  12349. @code{30} (for a @code{30x30} pixel box).
  12350. @end table
  12351. @section shuffleframes
  12352. Reorder and/or duplicate and/or drop video frames.
  12353. It accepts the following parameters:
  12354. @table @option
  12355. @item mapping
  12356. Set the destination indexes of input frames.
  12357. This is space or '|' separated list of indexes that maps input frames to output
  12358. frames. Number of indexes also sets maximal value that each index may have.
  12359. '-1' index have special meaning and that is to drop frame.
  12360. @end table
  12361. The first frame has the index 0. The default is to keep the input unchanged.
  12362. @subsection Examples
  12363. @itemize
  12364. @item
  12365. Swap second and third frame of every three frames of the input:
  12366. @example
  12367. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  12368. @end example
  12369. @item
  12370. Swap 10th and 1st frame of every ten frames of the input:
  12371. @example
  12372. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  12373. @end example
  12374. @end itemize
  12375. @section shuffleplanes
  12376. Reorder and/or duplicate video planes.
  12377. It accepts the following parameters:
  12378. @table @option
  12379. @item map0
  12380. The index of the input plane to be used as the first output plane.
  12381. @item map1
  12382. The index of the input plane to be used as the second output plane.
  12383. @item map2
  12384. The index of the input plane to be used as the third output plane.
  12385. @item map3
  12386. The index of the input plane to be used as the fourth output plane.
  12387. @end table
  12388. The first plane has the index 0. The default is to keep the input unchanged.
  12389. @subsection Examples
  12390. @itemize
  12391. @item
  12392. Swap the second and third planes of the input:
  12393. @example
  12394. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  12395. @end example
  12396. @end itemize
  12397. @anchor{signalstats}
  12398. @section signalstats
  12399. Evaluate various visual metrics that assist in determining issues associated
  12400. with the digitization of analog video media.
  12401. By default the filter will log these metadata values:
  12402. @table @option
  12403. @item YMIN
  12404. Display the minimal Y value contained within the input frame. Expressed in
  12405. range of [0-255].
  12406. @item YLOW
  12407. Display the Y value at the 10% percentile within the input frame. Expressed in
  12408. range of [0-255].
  12409. @item YAVG
  12410. Display the average Y value within the input frame. Expressed in range of
  12411. [0-255].
  12412. @item YHIGH
  12413. Display the Y value at the 90% percentile within the input frame. Expressed in
  12414. range of [0-255].
  12415. @item YMAX
  12416. Display the maximum Y value contained within the input frame. Expressed in
  12417. range of [0-255].
  12418. @item UMIN
  12419. Display the minimal U value contained within the input frame. Expressed in
  12420. range of [0-255].
  12421. @item ULOW
  12422. Display the U value at the 10% percentile within the input frame. Expressed in
  12423. range of [0-255].
  12424. @item UAVG
  12425. Display the average U value within the input frame. Expressed in range of
  12426. [0-255].
  12427. @item UHIGH
  12428. Display the U value at the 90% percentile within the input frame. Expressed in
  12429. range of [0-255].
  12430. @item UMAX
  12431. Display the maximum U value contained within the input frame. Expressed in
  12432. range of [0-255].
  12433. @item VMIN
  12434. Display the minimal V value contained within the input frame. Expressed in
  12435. range of [0-255].
  12436. @item VLOW
  12437. Display the V value at the 10% percentile within the input frame. Expressed in
  12438. range of [0-255].
  12439. @item VAVG
  12440. Display the average V value within the input frame. Expressed in range of
  12441. [0-255].
  12442. @item VHIGH
  12443. Display the V value at the 90% percentile within the input frame. Expressed in
  12444. range of [0-255].
  12445. @item VMAX
  12446. Display the maximum V value contained within the input frame. Expressed in
  12447. range of [0-255].
  12448. @item SATMIN
  12449. Display the minimal saturation value contained within the input frame.
  12450. Expressed in range of [0-~181.02].
  12451. @item SATLOW
  12452. Display the saturation value at the 10% percentile within the input frame.
  12453. Expressed in range of [0-~181.02].
  12454. @item SATAVG
  12455. Display the average saturation value within the input frame. Expressed in range
  12456. of [0-~181.02].
  12457. @item SATHIGH
  12458. Display the saturation value at the 90% percentile within the input frame.
  12459. Expressed in range of [0-~181.02].
  12460. @item SATMAX
  12461. Display the maximum saturation value contained within the input frame.
  12462. Expressed in range of [0-~181.02].
  12463. @item HUEMED
  12464. Display the median value for hue within the input frame. Expressed in range of
  12465. [0-360].
  12466. @item HUEAVG
  12467. Display the average value for hue within the input frame. Expressed in range of
  12468. [0-360].
  12469. @item YDIF
  12470. Display the average of sample value difference between all values of the Y
  12471. plane in the current frame and corresponding values of the previous input frame.
  12472. Expressed in range of [0-255].
  12473. @item UDIF
  12474. Display the average of sample value difference between all values of the U
  12475. plane in the current frame and corresponding values of the previous input frame.
  12476. Expressed in range of [0-255].
  12477. @item VDIF
  12478. Display the average of sample value difference between all values of the V
  12479. plane in the current frame and corresponding values of the previous input frame.
  12480. Expressed in range of [0-255].
  12481. @item YBITDEPTH
  12482. Display bit depth of Y plane in current frame.
  12483. Expressed in range of [0-16].
  12484. @item UBITDEPTH
  12485. Display bit depth of U plane in current frame.
  12486. Expressed in range of [0-16].
  12487. @item VBITDEPTH
  12488. Display bit depth of V plane in current frame.
  12489. Expressed in range of [0-16].
  12490. @end table
  12491. The filter accepts the following options:
  12492. @table @option
  12493. @item stat
  12494. @item out
  12495. @option{stat} specify an additional form of image analysis.
  12496. @option{out} output video with the specified type of pixel highlighted.
  12497. Both options accept the following values:
  12498. @table @samp
  12499. @item tout
  12500. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  12501. unlike the neighboring pixels of the same field. Examples of temporal outliers
  12502. include the results of video dropouts, head clogs, or tape tracking issues.
  12503. @item vrep
  12504. Identify @var{vertical line repetition}. Vertical line repetition includes
  12505. similar rows of pixels within a frame. In born-digital video vertical line
  12506. repetition is common, but this pattern is uncommon in video digitized from an
  12507. analog source. When it occurs in video that results from the digitization of an
  12508. analog source it can indicate concealment from a dropout compensator.
  12509. @item brng
  12510. Identify pixels that fall outside of legal broadcast range.
  12511. @end table
  12512. @item color, c
  12513. Set the highlight color for the @option{out} option. The default color is
  12514. yellow.
  12515. @end table
  12516. @subsection Examples
  12517. @itemize
  12518. @item
  12519. Output data of various video metrics:
  12520. @example
  12521. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  12522. @end example
  12523. @item
  12524. Output specific data about the minimum and maximum values of the Y plane per frame:
  12525. @example
  12526. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  12527. @end example
  12528. @item
  12529. Playback video while highlighting pixels that are outside of broadcast range in red.
  12530. @example
  12531. ffplay example.mov -vf signalstats="out=brng:color=red"
  12532. @end example
  12533. @item
  12534. Playback video with signalstats metadata drawn over the frame.
  12535. @example
  12536. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  12537. @end example
  12538. The contents of signalstat_drawtext.txt used in the command are:
  12539. @example
  12540. time %@{pts:hms@}
  12541. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  12542. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  12543. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  12544. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  12545. @end example
  12546. @end itemize
  12547. @anchor{signature}
  12548. @section signature
  12549. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  12550. input. In this case the matching between the inputs can be calculated additionally.
  12551. The filter always passes through the first input. The signature of each stream can
  12552. be written into a file.
  12553. It accepts the following options:
  12554. @table @option
  12555. @item detectmode
  12556. Enable or disable the matching process.
  12557. Available values are:
  12558. @table @samp
  12559. @item off
  12560. Disable the calculation of a matching (default).
  12561. @item full
  12562. Calculate the matching for the whole video and output whether the whole video
  12563. matches or only parts.
  12564. @item fast
  12565. Calculate only until a matching is found or the video ends. Should be faster in
  12566. some cases.
  12567. @end table
  12568. @item nb_inputs
  12569. Set the number of inputs. The option value must be a non negative integer.
  12570. Default value is 1.
  12571. @item filename
  12572. Set the path to which the output is written. If there is more than one input,
  12573. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  12574. integer), that will be replaced with the input number. If no filename is
  12575. specified, no output will be written. This is the default.
  12576. @item format
  12577. Choose the output format.
  12578. Available values are:
  12579. @table @samp
  12580. @item binary
  12581. Use the specified binary representation (default).
  12582. @item xml
  12583. Use the specified xml representation.
  12584. @end table
  12585. @item th_d
  12586. Set threshold to detect one word as similar. The option value must be an integer
  12587. greater than zero. The default value is 9000.
  12588. @item th_dc
  12589. Set threshold to detect all words as similar. The option value must be an integer
  12590. greater than zero. The default value is 60000.
  12591. @item th_xh
  12592. Set threshold to detect frames as similar. The option value must be an integer
  12593. greater than zero. The default value is 116.
  12594. @item th_di
  12595. Set the minimum length of a sequence in frames to recognize it as matching
  12596. sequence. The option value must be a non negative integer value.
  12597. The default value is 0.
  12598. @item th_it
  12599. Set the minimum relation, that matching frames to all frames must have.
  12600. The option value must be a double value between 0 and 1. The default value is 0.5.
  12601. @end table
  12602. @subsection Examples
  12603. @itemize
  12604. @item
  12605. To calculate the signature of an input video and store it in signature.bin:
  12606. @example
  12607. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  12608. @end example
  12609. @item
  12610. To detect whether two videos match and store the signatures in XML format in
  12611. signature0.xml and signature1.xml:
  12612. @example
  12613. 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 -
  12614. @end example
  12615. @end itemize
  12616. @anchor{smartblur}
  12617. @section smartblur
  12618. Blur the input video without impacting the outlines.
  12619. It accepts the following options:
  12620. @table @option
  12621. @item luma_radius, lr
  12622. Set the luma radius. The option value must be a float number in
  12623. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12624. used to blur the image (slower if larger). Default value is 1.0.
  12625. @item luma_strength, ls
  12626. Set the luma strength. The option value must be a float number
  12627. in the range [-1.0,1.0] that configures the blurring. A value included
  12628. in [0.0,1.0] will blur the image whereas a value included in
  12629. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  12630. @item luma_threshold, lt
  12631. Set the luma threshold used as a coefficient to determine
  12632. whether a pixel should be blurred or not. The option value must be an
  12633. integer in the range [-30,30]. A value of 0 will filter all the image,
  12634. a value included in [0,30] will filter flat areas and a value included
  12635. in [-30,0] will filter edges. Default value is 0.
  12636. @item chroma_radius, cr
  12637. Set the chroma radius. The option value must be a float number in
  12638. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12639. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  12640. @item chroma_strength, cs
  12641. Set the chroma strength. The option value must be a float number
  12642. in the range [-1.0,1.0] that configures the blurring. A value included
  12643. in [0.0,1.0] will blur the image whereas a value included in
  12644. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  12645. @item chroma_threshold, ct
  12646. Set the chroma threshold used as a coefficient to determine
  12647. whether a pixel should be blurred or not. The option value must be an
  12648. integer in the range [-30,30]. A value of 0 will filter all the image,
  12649. a value included in [0,30] will filter flat areas and a value included
  12650. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  12651. @end table
  12652. If a chroma option is not explicitly set, the corresponding luma value
  12653. is set.
  12654. @section sobel
  12655. Apply sobel operator to input video stream.
  12656. The filter accepts the following option:
  12657. @table @option
  12658. @item planes
  12659. Set which planes will be processed, unprocessed planes will be copied.
  12660. By default value 0xf, all planes will be processed.
  12661. @item scale
  12662. Set value which will be multiplied with filtered result.
  12663. @item delta
  12664. Set value which will be added to filtered result.
  12665. @end table
  12666. @anchor{spp}
  12667. @section spp
  12668. Apply a simple postprocessing filter that compresses and decompresses the image
  12669. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  12670. and average the results.
  12671. The filter accepts the following options:
  12672. @table @option
  12673. @item quality
  12674. Set quality. This option defines the number of levels for averaging. It accepts
  12675. an integer in the range 0-6. If set to @code{0}, the filter will have no
  12676. effect. A value of @code{6} means the higher quality. For each increment of
  12677. that value the speed drops by a factor of approximately 2. Default value is
  12678. @code{3}.
  12679. @item qp
  12680. Force a constant quantization parameter. If not set, the filter will use the QP
  12681. from the video stream (if available).
  12682. @item mode
  12683. Set thresholding mode. Available modes are:
  12684. @table @samp
  12685. @item hard
  12686. Set hard thresholding (default).
  12687. @item soft
  12688. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12689. @end table
  12690. @item use_bframe_qp
  12691. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  12692. option may cause flicker since the B-Frames have often larger QP. Default is
  12693. @code{0} (not enabled).
  12694. @end table
  12695. @section sr
  12696. Scale the input by applying one of the super-resolution methods based on
  12697. convolutional neural networks. Supported models:
  12698. @itemize
  12699. @item
  12700. Super-Resolution Convolutional Neural Network model (SRCNN).
  12701. See @url{https://arxiv.org/abs/1501.00092}.
  12702. @item
  12703. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  12704. See @url{https://arxiv.org/abs/1609.05158}.
  12705. @end itemize
  12706. Training scripts as well as scripts for model file (.pb) saving can be found at
  12707. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  12708. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  12709. Native model files (.model) can be generated from TensorFlow model
  12710. files (.pb) by using tools/python/convert.py
  12711. The filter accepts the following options:
  12712. @table @option
  12713. @item dnn_backend
  12714. Specify which DNN backend to use for model loading and execution. This option accepts
  12715. the following values:
  12716. @table @samp
  12717. @item native
  12718. Native implementation of DNN loading and execution.
  12719. @item tensorflow
  12720. TensorFlow backend. To enable this backend you
  12721. need to install the TensorFlow for C library (see
  12722. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  12723. @code{--enable-libtensorflow}
  12724. @end table
  12725. Default value is @samp{native}.
  12726. @item model
  12727. Set path to model file specifying network architecture and its parameters.
  12728. Note that different backends use different file formats. TensorFlow backend
  12729. can load files for both formats, while native backend can load files for only
  12730. its format.
  12731. @item scale_factor
  12732. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  12733. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  12734. input upscaled using bicubic upscaling with proper scale factor.
  12735. @end table
  12736. @section ssim
  12737. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  12738. This filter takes in input two input videos, the first input is
  12739. considered the "main" source and is passed unchanged to the
  12740. output. The second input is used as a "reference" video for computing
  12741. the SSIM.
  12742. Both video inputs must have the same resolution and pixel format for
  12743. this filter to work correctly. Also it assumes that both inputs
  12744. have the same number of frames, which are compared one by one.
  12745. The filter stores the calculated SSIM of each frame.
  12746. The description of the accepted parameters follows.
  12747. @table @option
  12748. @item stats_file, f
  12749. If specified the filter will use the named file to save the SSIM of
  12750. each individual frame. When filename equals "-" the data is sent to
  12751. standard output.
  12752. @end table
  12753. The file printed if @var{stats_file} is selected, contains a sequence of
  12754. key/value pairs of the form @var{key}:@var{value} for each compared
  12755. couple of frames.
  12756. A description of each shown parameter follows:
  12757. @table @option
  12758. @item n
  12759. sequential number of the input frame, starting from 1
  12760. @item Y, U, V, R, G, B
  12761. SSIM of the compared frames for the component specified by the suffix.
  12762. @item All
  12763. SSIM of the compared frames for the whole frame.
  12764. @item dB
  12765. Same as above but in dB representation.
  12766. @end table
  12767. This filter also supports the @ref{framesync} options.
  12768. For example:
  12769. @example
  12770. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12771. [main][ref] ssim="stats_file=stats.log" [out]
  12772. @end example
  12773. On this example the input file being processed is compared with the
  12774. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  12775. is stored in @file{stats.log}.
  12776. Another example with both psnr and ssim at same time:
  12777. @example
  12778. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  12779. @end example
  12780. @section stereo3d
  12781. Convert between different stereoscopic image formats.
  12782. The filters accept the following options:
  12783. @table @option
  12784. @item in
  12785. Set stereoscopic image format of input.
  12786. Available values for input image formats are:
  12787. @table @samp
  12788. @item sbsl
  12789. side by side parallel (left eye left, right eye right)
  12790. @item sbsr
  12791. side by side crosseye (right eye left, left eye right)
  12792. @item sbs2l
  12793. side by side parallel with half width resolution
  12794. (left eye left, right eye right)
  12795. @item sbs2r
  12796. side by side crosseye with half width resolution
  12797. (right eye left, left eye right)
  12798. @item abl
  12799. @item tbl
  12800. above-below (left eye above, right eye below)
  12801. @item abr
  12802. @item tbr
  12803. above-below (right eye above, left eye below)
  12804. @item ab2l
  12805. @item tb2l
  12806. above-below with half height resolution
  12807. (left eye above, right eye below)
  12808. @item ab2r
  12809. @item tb2r
  12810. above-below with half height resolution
  12811. (right eye above, left eye below)
  12812. @item al
  12813. alternating frames (left eye first, right eye second)
  12814. @item ar
  12815. alternating frames (right eye first, left eye second)
  12816. @item irl
  12817. interleaved rows (left eye has top row, right eye starts on next row)
  12818. @item irr
  12819. interleaved rows (right eye has top row, left eye starts on next row)
  12820. @item icl
  12821. interleaved columns, left eye first
  12822. @item icr
  12823. interleaved columns, right eye first
  12824. Default value is @samp{sbsl}.
  12825. @end table
  12826. @item out
  12827. Set stereoscopic image format of output.
  12828. @table @samp
  12829. @item sbsl
  12830. side by side parallel (left eye left, right eye right)
  12831. @item sbsr
  12832. side by side crosseye (right eye left, left eye right)
  12833. @item sbs2l
  12834. side by side parallel with half width resolution
  12835. (left eye left, right eye right)
  12836. @item sbs2r
  12837. side by side crosseye with half width resolution
  12838. (right eye left, left eye right)
  12839. @item abl
  12840. @item tbl
  12841. above-below (left eye above, right eye below)
  12842. @item abr
  12843. @item tbr
  12844. above-below (right eye above, left eye below)
  12845. @item ab2l
  12846. @item tb2l
  12847. above-below with half height resolution
  12848. (left eye above, right eye below)
  12849. @item ab2r
  12850. @item tb2r
  12851. above-below with half height resolution
  12852. (right eye above, left eye below)
  12853. @item al
  12854. alternating frames (left eye first, right eye second)
  12855. @item ar
  12856. alternating frames (right eye first, left eye second)
  12857. @item irl
  12858. interleaved rows (left eye has top row, right eye starts on next row)
  12859. @item irr
  12860. interleaved rows (right eye has top row, left eye starts on next row)
  12861. @item arbg
  12862. anaglyph red/blue gray
  12863. (red filter on left eye, blue filter on right eye)
  12864. @item argg
  12865. anaglyph red/green gray
  12866. (red filter on left eye, green filter on right eye)
  12867. @item arcg
  12868. anaglyph red/cyan gray
  12869. (red filter on left eye, cyan filter on right eye)
  12870. @item arch
  12871. anaglyph red/cyan half colored
  12872. (red filter on left eye, cyan filter on right eye)
  12873. @item arcc
  12874. anaglyph red/cyan color
  12875. (red filter on left eye, cyan filter on right eye)
  12876. @item arcd
  12877. anaglyph red/cyan color optimized with the least squares projection of dubois
  12878. (red filter on left eye, cyan filter on right eye)
  12879. @item agmg
  12880. anaglyph green/magenta gray
  12881. (green filter on left eye, magenta filter on right eye)
  12882. @item agmh
  12883. anaglyph green/magenta half colored
  12884. (green filter on left eye, magenta filter on right eye)
  12885. @item agmc
  12886. anaglyph green/magenta colored
  12887. (green filter on left eye, magenta filter on right eye)
  12888. @item agmd
  12889. anaglyph green/magenta color optimized with the least squares projection of dubois
  12890. (green filter on left eye, magenta filter on right eye)
  12891. @item aybg
  12892. anaglyph yellow/blue gray
  12893. (yellow filter on left eye, blue filter on right eye)
  12894. @item aybh
  12895. anaglyph yellow/blue half colored
  12896. (yellow filter on left eye, blue filter on right eye)
  12897. @item aybc
  12898. anaglyph yellow/blue colored
  12899. (yellow filter on left eye, blue filter on right eye)
  12900. @item aybd
  12901. anaglyph yellow/blue color optimized with the least squares projection of dubois
  12902. (yellow filter on left eye, blue filter on right eye)
  12903. @item ml
  12904. mono output (left eye only)
  12905. @item mr
  12906. mono output (right eye only)
  12907. @item chl
  12908. checkerboard, left eye first
  12909. @item chr
  12910. checkerboard, right eye first
  12911. @item icl
  12912. interleaved columns, left eye first
  12913. @item icr
  12914. interleaved columns, right eye first
  12915. @item hdmi
  12916. HDMI frame pack
  12917. @end table
  12918. Default value is @samp{arcd}.
  12919. @end table
  12920. @subsection Examples
  12921. @itemize
  12922. @item
  12923. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  12924. @example
  12925. stereo3d=sbsl:aybd
  12926. @end example
  12927. @item
  12928. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  12929. @example
  12930. stereo3d=abl:sbsr
  12931. @end example
  12932. @end itemize
  12933. @section streamselect, astreamselect
  12934. Select video or audio streams.
  12935. The filter accepts the following options:
  12936. @table @option
  12937. @item inputs
  12938. Set number of inputs. Default is 2.
  12939. @item map
  12940. Set input indexes to remap to outputs.
  12941. @end table
  12942. @subsection Commands
  12943. The @code{streamselect} and @code{astreamselect} filter supports the following
  12944. commands:
  12945. @table @option
  12946. @item map
  12947. Set input indexes to remap to outputs.
  12948. @end table
  12949. @subsection Examples
  12950. @itemize
  12951. @item
  12952. Select first 5 seconds 1st stream and rest of time 2nd stream:
  12953. @example
  12954. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  12955. @end example
  12956. @item
  12957. Same as above, but for audio:
  12958. @example
  12959. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  12960. @end example
  12961. @end itemize
  12962. @anchor{subtitles}
  12963. @section subtitles
  12964. Draw subtitles on top of input video using the libass library.
  12965. To enable compilation of this filter you need to configure FFmpeg with
  12966. @code{--enable-libass}. This filter also requires a build with libavcodec and
  12967. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  12968. Alpha) subtitles format.
  12969. The filter accepts the following options:
  12970. @table @option
  12971. @item filename, f
  12972. Set the filename of the subtitle file to read. It must be specified.
  12973. @item original_size
  12974. Specify the size of the original video, the video for which the ASS file
  12975. was composed. For the syntax of this option, check the
  12976. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12977. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  12978. correctly scale the fonts if the aspect ratio has been changed.
  12979. @item fontsdir
  12980. Set a directory path containing fonts that can be used by the filter.
  12981. These fonts will be used in addition to whatever the font provider uses.
  12982. @item alpha
  12983. Process alpha channel, by default alpha channel is untouched.
  12984. @item charenc
  12985. Set subtitles input character encoding. @code{subtitles} filter only. Only
  12986. useful if not UTF-8.
  12987. @item stream_index, si
  12988. Set subtitles stream index. @code{subtitles} filter only.
  12989. @item force_style
  12990. Override default style or script info parameters of the subtitles. It accepts a
  12991. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  12992. @end table
  12993. If the first key is not specified, it is assumed that the first value
  12994. specifies the @option{filename}.
  12995. For example, to render the file @file{sub.srt} on top of the input
  12996. video, use the command:
  12997. @example
  12998. subtitles=sub.srt
  12999. @end example
  13000. which is equivalent to:
  13001. @example
  13002. subtitles=filename=sub.srt
  13003. @end example
  13004. To render the default subtitles stream from file @file{video.mkv}, use:
  13005. @example
  13006. subtitles=video.mkv
  13007. @end example
  13008. To render the second subtitles stream from that file, use:
  13009. @example
  13010. subtitles=video.mkv:si=1
  13011. @end example
  13012. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  13013. @code{DejaVu Serif}, use:
  13014. @example
  13015. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  13016. @end example
  13017. @section super2xsai
  13018. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  13019. Interpolate) pixel art scaling algorithm.
  13020. Useful for enlarging pixel art images without reducing sharpness.
  13021. @section swaprect
  13022. Swap two rectangular objects in video.
  13023. This filter accepts the following options:
  13024. @table @option
  13025. @item w
  13026. Set object width.
  13027. @item h
  13028. Set object height.
  13029. @item x1
  13030. Set 1st rect x coordinate.
  13031. @item y1
  13032. Set 1st rect y coordinate.
  13033. @item x2
  13034. Set 2nd rect x coordinate.
  13035. @item y2
  13036. Set 2nd rect y coordinate.
  13037. All expressions are evaluated once for each frame.
  13038. @end table
  13039. The all options are expressions containing the following constants:
  13040. @table @option
  13041. @item w
  13042. @item h
  13043. The input width and height.
  13044. @item a
  13045. same as @var{w} / @var{h}
  13046. @item sar
  13047. input sample aspect ratio
  13048. @item dar
  13049. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  13050. @item n
  13051. The number of the input frame, starting from 0.
  13052. @item t
  13053. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  13054. @item pos
  13055. the position in the file of the input frame, NAN if unknown
  13056. @end table
  13057. @section swapuv
  13058. Swap U & V plane.
  13059. @section telecine
  13060. Apply telecine process to the video.
  13061. This filter accepts the following options:
  13062. @table @option
  13063. @item first_field
  13064. @table @samp
  13065. @item top, t
  13066. top field first
  13067. @item bottom, b
  13068. bottom field first
  13069. The default value is @code{top}.
  13070. @end table
  13071. @item pattern
  13072. A string of numbers representing the pulldown pattern you wish to apply.
  13073. The default value is @code{23}.
  13074. @end table
  13075. @example
  13076. Some typical patterns:
  13077. NTSC output (30i):
  13078. 27.5p: 32222
  13079. 24p: 23 (classic)
  13080. 24p: 2332 (preferred)
  13081. 20p: 33
  13082. 18p: 334
  13083. 16p: 3444
  13084. PAL output (25i):
  13085. 27.5p: 12222
  13086. 24p: 222222222223 ("Euro pulldown")
  13087. 16.67p: 33
  13088. 16p: 33333334
  13089. @end example
  13090. @section threshold
  13091. Apply threshold effect to video stream.
  13092. This filter needs four video streams to perform thresholding.
  13093. First stream is stream we are filtering.
  13094. Second stream is holding threshold values, third stream is holding min values,
  13095. and last, fourth stream is holding max values.
  13096. The filter accepts the following option:
  13097. @table @option
  13098. @item planes
  13099. Set which planes will be processed, unprocessed planes will be copied.
  13100. By default value 0xf, all planes will be processed.
  13101. @end table
  13102. For example if first stream pixel's component value is less then threshold value
  13103. of pixel component from 2nd threshold stream, third stream value will picked,
  13104. otherwise fourth stream pixel component value will be picked.
  13105. Using color source filter one can perform various types of thresholding:
  13106. @subsection Examples
  13107. @itemize
  13108. @item
  13109. Binary threshold, using gray color as threshold:
  13110. @example
  13111. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  13112. @end example
  13113. @item
  13114. Inverted binary threshold, using gray color as threshold:
  13115. @example
  13116. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  13117. @end example
  13118. @item
  13119. Truncate binary threshold, using gray color as threshold:
  13120. @example
  13121. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  13122. @end example
  13123. @item
  13124. Threshold to zero, using gray color as threshold:
  13125. @example
  13126. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  13127. @end example
  13128. @item
  13129. Inverted threshold to zero, using gray color as threshold:
  13130. @example
  13131. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  13132. @end example
  13133. @end itemize
  13134. @section thumbnail
  13135. Select the most representative frame in a given sequence of consecutive frames.
  13136. The filter accepts the following options:
  13137. @table @option
  13138. @item n
  13139. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  13140. will pick one of them, and then handle the next batch of @var{n} frames until
  13141. the end. Default is @code{100}.
  13142. @end table
  13143. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  13144. value will result in a higher memory usage, so a high value is not recommended.
  13145. @subsection Examples
  13146. @itemize
  13147. @item
  13148. Extract one picture each 50 frames:
  13149. @example
  13150. thumbnail=50
  13151. @end example
  13152. @item
  13153. Complete example of a thumbnail creation with @command{ffmpeg}:
  13154. @example
  13155. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  13156. @end example
  13157. @end itemize
  13158. @section tile
  13159. Tile several successive frames together.
  13160. The filter accepts the following options:
  13161. @table @option
  13162. @item layout
  13163. Set the grid size (i.e. the number of lines and columns). For the syntax of
  13164. this option, check the
  13165. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13166. @item nb_frames
  13167. Set the maximum number of frames to render in the given area. It must be less
  13168. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  13169. the area will be used.
  13170. @item margin
  13171. Set the outer border margin in pixels.
  13172. @item padding
  13173. Set the inner border thickness (i.e. the number of pixels between frames). For
  13174. more advanced padding options (such as having different values for the edges),
  13175. refer to the pad video filter.
  13176. @item color
  13177. Specify the color of the unused area. For the syntax of this option, check the
  13178. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13179. The default value of @var{color} is "black".
  13180. @item overlap
  13181. Set the number of frames to overlap when tiling several successive frames together.
  13182. The value must be between @code{0} and @var{nb_frames - 1}.
  13183. @item init_padding
  13184. Set the number of frames to initially be empty before displaying first output frame.
  13185. This controls how soon will one get first output frame.
  13186. The value must be between @code{0} and @var{nb_frames - 1}.
  13187. @end table
  13188. @subsection Examples
  13189. @itemize
  13190. @item
  13191. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  13192. @example
  13193. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  13194. @end example
  13195. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  13196. duplicating each output frame to accommodate the originally detected frame
  13197. rate.
  13198. @item
  13199. Display @code{5} pictures in an area of @code{3x2} frames,
  13200. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  13201. mixed flat and named options:
  13202. @example
  13203. tile=3x2:nb_frames=5:padding=7:margin=2
  13204. @end example
  13205. @end itemize
  13206. @section tinterlace
  13207. Perform various types of temporal field interlacing.
  13208. Frames are counted starting from 1, so the first input frame is
  13209. considered odd.
  13210. The filter accepts the following options:
  13211. @table @option
  13212. @item mode
  13213. Specify the mode of the interlacing. This option can also be specified
  13214. as a value alone. See below for a list of values for this option.
  13215. Available values are:
  13216. @table @samp
  13217. @item merge, 0
  13218. Move odd frames into the upper field, even into the lower field,
  13219. generating a double height frame at half frame rate.
  13220. @example
  13221. ------> time
  13222. Input:
  13223. Frame 1 Frame 2 Frame 3 Frame 4
  13224. 11111 22222 33333 44444
  13225. 11111 22222 33333 44444
  13226. 11111 22222 33333 44444
  13227. 11111 22222 33333 44444
  13228. Output:
  13229. 11111 33333
  13230. 22222 44444
  13231. 11111 33333
  13232. 22222 44444
  13233. 11111 33333
  13234. 22222 44444
  13235. 11111 33333
  13236. 22222 44444
  13237. @end example
  13238. @item drop_even, 1
  13239. Only output odd frames, even frames are dropped, generating a frame with
  13240. unchanged height at half frame rate.
  13241. @example
  13242. ------> time
  13243. Input:
  13244. Frame 1 Frame 2 Frame 3 Frame 4
  13245. 11111 22222 33333 44444
  13246. 11111 22222 33333 44444
  13247. 11111 22222 33333 44444
  13248. 11111 22222 33333 44444
  13249. Output:
  13250. 11111 33333
  13251. 11111 33333
  13252. 11111 33333
  13253. 11111 33333
  13254. @end example
  13255. @item drop_odd, 2
  13256. Only output even frames, odd frames are dropped, generating a frame with
  13257. unchanged height at half frame rate.
  13258. @example
  13259. ------> time
  13260. Input:
  13261. Frame 1 Frame 2 Frame 3 Frame 4
  13262. 11111 22222 33333 44444
  13263. 11111 22222 33333 44444
  13264. 11111 22222 33333 44444
  13265. 11111 22222 33333 44444
  13266. Output:
  13267. 22222 44444
  13268. 22222 44444
  13269. 22222 44444
  13270. 22222 44444
  13271. @end example
  13272. @item pad, 3
  13273. Expand each frame to full height, but pad alternate lines with black,
  13274. generating a frame with double height at the same input frame rate.
  13275. @example
  13276. ------> time
  13277. Input:
  13278. Frame 1 Frame 2 Frame 3 Frame 4
  13279. 11111 22222 33333 44444
  13280. 11111 22222 33333 44444
  13281. 11111 22222 33333 44444
  13282. 11111 22222 33333 44444
  13283. Output:
  13284. 11111 ..... 33333 .....
  13285. ..... 22222 ..... 44444
  13286. 11111 ..... 33333 .....
  13287. ..... 22222 ..... 44444
  13288. 11111 ..... 33333 .....
  13289. ..... 22222 ..... 44444
  13290. 11111 ..... 33333 .....
  13291. ..... 22222 ..... 44444
  13292. @end example
  13293. @item interleave_top, 4
  13294. Interleave the upper field from odd frames with the lower field from
  13295. even frames, generating a frame with unchanged height at half frame rate.
  13296. @example
  13297. ------> time
  13298. Input:
  13299. Frame 1 Frame 2 Frame 3 Frame 4
  13300. 11111<- 22222 33333<- 44444
  13301. 11111 22222<- 33333 44444<-
  13302. 11111<- 22222 33333<- 44444
  13303. 11111 22222<- 33333 44444<-
  13304. Output:
  13305. 11111 33333
  13306. 22222 44444
  13307. 11111 33333
  13308. 22222 44444
  13309. @end example
  13310. @item interleave_bottom, 5
  13311. Interleave the lower field from odd frames with the upper field from
  13312. even frames, generating a frame with unchanged height at half frame rate.
  13313. @example
  13314. ------> time
  13315. Input:
  13316. Frame 1 Frame 2 Frame 3 Frame 4
  13317. 11111 22222<- 33333 44444<-
  13318. 11111<- 22222 33333<- 44444
  13319. 11111 22222<- 33333 44444<-
  13320. 11111<- 22222 33333<- 44444
  13321. Output:
  13322. 22222 44444
  13323. 11111 33333
  13324. 22222 44444
  13325. 11111 33333
  13326. @end example
  13327. @item interlacex2, 6
  13328. Double frame rate with unchanged height. Frames are inserted each
  13329. containing the second temporal field from the previous input frame and
  13330. the first temporal field from the next input frame. This mode relies on
  13331. the top_field_first flag. Useful for interlaced video displays with no
  13332. field synchronisation.
  13333. @example
  13334. ------> time
  13335. Input:
  13336. Frame 1 Frame 2 Frame 3 Frame 4
  13337. 11111 22222 33333 44444
  13338. 11111 22222 33333 44444
  13339. 11111 22222 33333 44444
  13340. 11111 22222 33333 44444
  13341. Output:
  13342. 11111 22222 22222 33333 33333 44444 44444
  13343. 11111 11111 22222 22222 33333 33333 44444
  13344. 11111 22222 22222 33333 33333 44444 44444
  13345. 11111 11111 22222 22222 33333 33333 44444
  13346. @end example
  13347. @item mergex2, 7
  13348. Move odd frames into the upper field, even into the lower field,
  13349. generating a double height frame at same frame rate.
  13350. @example
  13351. ------> time
  13352. Input:
  13353. Frame 1 Frame 2 Frame 3 Frame 4
  13354. 11111 22222 33333 44444
  13355. 11111 22222 33333 44444
  13356. 11111 22222 33333 44444
  13357. 11111 22222 33333 44444
  13358. Output:
  13359. 11111 33333 33333 55555
  13360. 22222 22222 44444 44444
  13361. 11111 33333 33333 55555
  13362. 22222 22222 44444 44444
  13363. 11111 33333 33333 55555
  13364. 22222 22222 44444 44444
  13365. 11111 33333 33333 55555
  13366. 22222 22222 44444 44444
  13367. @end example
  13368. @end table
  13369. Numeric values are deprecated but are accepted for backward
  13370. compatibility reasons.
  13371. Default mode is @code{merge}.
  13372. @item flags
  13373. Specify flags influencing the filter process.
  13374. Available value for @var{flags} is:
  13375. @table @option
  13376. @item low_pass_filter, vlpf
  13377. Enable linear vertical low-pass filtering in the filter.
  13378. Vertical low-pass filtering is required when creating an interlaced
  13379. destination from a progressive source which contains high-frequency
  13380. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  13381. patterning.
  13382. @item complex_filter, cvlpf
  13383. Enable complex vertical low-pass filtering.
  13384. This will slightly less reduce interlace 'twitter' and Moire
  13385. patterning but better retain detail and subjective sharpness impression.
  13386. @end table
  13387. Vertical low-pass filtering can only be enabled for @option{mode}
  13388. @var{interleave_top} and @var{interleave_bottom}.
  13389. @end table
  13390. @section tmix
  13391. Mix successive video frames.
  13392. A description of the accepted options follows.
  13393. @table @option
  13394. @item frames
  13395. The number of successive frames to mix. If unspecified, it defaults to 3.
  13396. @item weights
  13397. Specify weight of each input video frame.
  13398. Each weight is separated by space. If number of weights is smaller than
  13399. number of @var{frames} last specified weight will be used for all remaining
  13400. unset weights.
  13401. @item scale
  13402. Specify scale, if it is set it will be multiplied with sum
  13403. of each weight multiplied with pixel values to give final destination
  13404. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13405. @end table
  13406. @subsection Examples
  13407. @itemize
  13408. @item
  13409. Average 7 successive frames:
  13410. @example
  13411. tmix=frames=7:weights="1 1 1 1 1 1 1"
  13412. @end example
  13413. @item
  13414. Apply simple temporal convolution:
  13415. @example
  13416. tmix=frames=3:weights="-1 3 -1"
  13417. @end example
  13418. @item
  13419. Similar as above but only showing temporal differences:
  13420. @example
  13421. tmix=frames=3:weights="-1 2 -1":scale=1
  13422. @end example
  13423. @end itemize
  13424. @anchor{tonemap}
  13425. @section tonemap
  13426. Tone map colors from different dynamic ranges.
  13427. This filter expects data in single precision floating point, as it needs to
  13428. operate on (and can output) out-of-range values. Another filter, such as
  13429. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  13430. The tonemapping algorithms implemented only work on linear light, so input
  13431. data should be linearized beforehand (and possibly correctly tagged).
  13432. @example
  13433. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  13434. @end example
  13435. @subsection Options
  13436. The filter accepts the following options.
  13437. @table @option
  13438. @item tonemap
  13439. Set the tone map algorithm to use.
  13440. Possible values are:
  13441. @table @var
  13442. @item none
  13443. Do not apply any tone map, only desaturate overbright pixels.
  13444. @item clip
  13445. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  13446. in-range values, while distorting out-of-range values.
  13447. @item linear
  13448. Stretch the entire reference gamut to a linear multiple of the display.
  13449. @item gamma
  13450. Fit a logarithmic transfer between the tone curves.
  13451. @item reinhard
  13452. Preserve overall image brightness with a simple curve, using nonlinear
  13453. contrast, which results in flattening details and degrading color accuracy.
  13454. @item hable
  13455. Preserve both dark and bright details better than @var{reinhard}, at the cost
  13456. of slightly darkening everything. Use it when detail preservation is more
  13457. important than color and brightness accuracy.
  13458. @item mobius
  13459. Smoothly map out-of-range values, while retaining contrast and colors for
  13460. in-range material as much as possible. Use it when color accuracy is more
  13461. important than detail preservation.
  13462. @end table
  13463. Default is none.
  13464. @item param
  13465. Tune the tone mapping algorithm.
  13466. This affects the following algorithms:
  13467. @table @var
  13468. @item none
  13469. Ignored.
  13470. @item linear
  13471. Specifies the scale factor to use while stretching.
  13472. Default to 1.0.
  13473. @item gamma
  13474. Specifies the exponent of the function.
  13475. Default to 1.8.
  13476. @item clip
  13477. Specify an extra linear coefficient to multiply into the signal before clipping.
  13478. Default to 1.0.
  13479. @item reinhard
  13480. Specify the local contrast coefficient at the display peak.
  13481. Default to 0.5, which means that in-gamut values will be about half as bright
  13482. as when clipping.
  13483. @item hable
  13484. Ignored.
  13485. @item mobius
  13486. Specify the transition point from linear to mobius transform. Every value
  13487. below this point is guaranteed to be mapped 1:1. The higher the value, the
  13488. more accurate the result will be, at the cost of losing bright details.
  13489. Default to 0.3, which due to the steep initial slope still preserves in-range
  13490. colors fairly accurately.
  13491. @end table
  13492. @item desat
  13493. Apply desaturation for highlights that exceed this level of brightness. The
  13494. higher the parameter, the more color information will be preserved. This
  13495. setting helps prevent unnaturally blown-out colors for super-highlights, by
  13496. (smoothly) turning into white instead. This makes images feel more natural,
  13497. at the cost of reducing information about out-of-range colors.
  13498. The default of 2.0 is somewhat conservative and will mostly just apply to
  13499. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  13500. This option works only if the input frame has a supported color tag.
  13501. @item peak
  13502. Override signal/nominal/reference peak with this value. Useful when the
  13503. embedded peak information in display metadata is not reliable or when tone
  13504. mapping from a lower range to a higher range.
  13505. @end table
  13506. @section tpad
  13507. Temporarily pad video frames.
  13508. The filter accepts the following options:
  13509. @table @option
  13510. @item start
  13511. Specify number of delay frames before input video stream.
  13512. @item stop
  13513. Specify number of padding frames after input video stream.
  13514. Set to -1 to pad indefinitely.
  13515. @item start_mode
  13516. Set kind of frames added to beginning of stream.
  13517. Can be either @var{add} or @var{clone}.
  13518. With @var{add} frames of solid-color are added.
  13519. With @var{clone} frames are clones of first frame.
  13520. @item stop_mode
  13521. Set kind of frames added to end of stream.
  13522. Can be either @var{add} or @var{clone}.
  13523. With @var{add} frames of solid-color are added.
  13524. With @var{clone} frames are clones of last frame.
  13525. @item start_duration, stop_duration
  13526. Specify the duration of the start/stop delay. See
  13527. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13528. for the accepted syntax.
  13529. These options override @var{start} and @var{stop}.
  13530. @item color
  13531. Specify the color of the padded area. For the syntax of this option,
  13532. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  13533. manual,ffmpeg-utils}.
  13534. The default value of @var{color} is "black".
  13535. @end table
  13536. @anchor{transpose}
  13537. @section transpose
  13538. Transpose rows with columns in the input video and optionally flip it.
  13539. It accepts the following parameters:
  13540. @table @option
  13541. @item dir
  13542. Specify the transposition direction.
  13543. Can assume the following values:
  13544. @table @samp
  13545. @item 0, 4, cclock_flip
  13546. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  13547. @example
  13548. L.R L.l
  13549. . . -> . .
  13550. l.r R.r
  13551. @end example
  13552. @item 1, 5, clock
  13553. Rotate by 90 degrees clockwise, that is:
  13554. @example
  13555. L.R l.L
  13556. . . -> . .
  13557. l.r r.R
  13558. @end example
  13559. @item 2, 6, cclock
  13560. Rotate by 90 degrees counterclockwise, that is:
  13561. @example
  13562. L.R R.r
  13563. . . -> . .
  13564. l.r L.l
  13565. @end example
  13566. @item 3, 7, clock_flip
  13567. Rotate by 90 degrees clockwise and vertically flip, that is:
  13568. @example
  13569. L.R r.R
  13570. . . -> . .
  13571. l.r l.L
  13572. @end example
  13573. @end table
  13574. For values between 4-7, the transposition is only done if the input
  13575. video geometry is portrait and not landscape. These values are
  13576. deprecated, the @code{passthrough} option should be used instead.
  13577. Numerical values are deprecated, and should be dropped in favor of
  13578. symbolic constants.
  13579. @item passthrough
  13580. Do not apply the transposition if the input geometry matches the one
  13581. specified by the specified value. It accepts the following values:
  13582. @table @samp
  13583. @item none
  13584. Always apply transposition.
  13585. @item portrait
  13586. Preserve portrait geometry (when @var{height} >= @var{width}).
  13587. @item landscape
  13588. Preserve landscape geometry (when @var{width} >= @var{height}).
  13589. @end table
  13590. Default value is @code{none}.
  13591. @end table
  13592. For example to rotate by 90 degrees clockwise and preserve portrait
  13593. layout:
  13594. @example
  13595. transpose=dir=1:passthrough=portrait
  13596. @end example
  13597. The command above can also be specified as:
  13598. @example
  13599. transpose=1:portrait
  13600. @end example
  13601. @section transpose_npp
  13602. Transpose rows with columns in the input video and optionally flip it.
  13603. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  13604. It accepts the following parameters:
  13605. @table @option
  13606. @item dir
  13607. Specify the transposition direction.
  13608. Can assume the following values:
  13609. @table @samp
  13610. @item cclock_flip
  13611. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  13612. @item clock
  13613. Rotate by 90 degrees clockwise.
  13614. @item cclock
  13615. Rotate by 90 degrees counterclockwise.
  13616. @item clock_flip
  13617. Rotate by 90 degrees clockwise and vertically flip.
  13618. @end table
  13619. @item passthrough
  13620. Do not apply the transposition if the input geometry matches the one
  13621. specified by the specified value. It accepts the following values:
  13622. @table @samp
  13623. @item none
  13624. Always apply transposition. (default)
  13625. @item portrait
  13626. Preserve portrait geometry (when @var{height} >= @var{width}).
  13627. @item landscape
  13628. Preserve landscape geometry (when @var{width} >= @var{height}).
  13629. @end table
  13630. @end table
  13631. @section trim
  13632. Trim the input so that the output contains one continuous subpart of the input.
  13633. It accepts the following parameters:
  13634. @table @option
  13635. @item start
  13636. Specify the time of the start of the kept section, i.e. the frame with the
  13637. timestamp @var{start} will be the first frame in the output.
  13638. @item end
  13639. Specify the time of the first frame that will be dropped, i.e. the frame
  13640. immediately preceding the one with the timestamp @var{end} will be the last
  13641. frame in the output.
  13642. @item start_pts
  13643. This is the same as @var{start}, except this option sets the start timestamp
  13644. in timebase units instead of seconds.
  13645. @item end_pts
  13646. This is the same as @var{end}, except this option sets the end timestamp
  13647. in timebase units instead of seconds.
  13648. @item duration
  13649. The maximum duration of the output in seconds.
  13650. @item start_frame
  13651. The number of the first frame that should be passed to the output.
  13652. @item end_frame
  13653. The number of the first frame that should be dropped.
  13654. @end table
  13655. @option{start}, @option{end}, and @option{duration} are expressed as time
  13656. duration specifications; see
  13657. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13658. for the accepted syntax.
  13659. Note that the first two sets of the start/end options and the @option{duration}
  13660. option look at the frame timestamp, while the _frame variants simply count the
  13661. frames that pass through the filter. Also note that this filter does not modify
  13662. the timestamps. If you wish for the output timestamps to start at zero, insert a
  13663. setpts filter after the trim filter.
  13664. If multiple start or end options are set, this filter tries to be greedy and
  13665. keep all the frames that match at least one of the specified constraints. To keep
  13666. only the part that matches all the constraints at once, chain multiple trim
  13667. filters.
  13668. The defaults are such that all the input is kept. So it is possible to set e.g.
  13669. just the end values to keep everything before the specified time.
  13670. Examples:
  13671. @itemize
  13672. @item
  13673. Drop everything except the second minute of input:
  13674. @example
  13675. ffmpeg -i INPUT -vf trim=60:120
  13676. @end example
  13677. @item
  13678. Keep only the first second:
  13679. @example
  13680. ffmpeg -i INPUT -vf trim=duration=1
  13681. @end example
  13682. @end itemize
  13683. @section unpremultiply
  13684. Apply alpha unpremultiply effect to input video stream using first plane
  13685. of second stream as alpha.
  13686. Both streams must have same dimensions and same pixel format.
  13687. The filter accepts the following option:
  13688. @table @option
  13689. @item planes
  13690. Set which planes will be processed, unprocessed planes will be copied.
  13691. By default value 0xf, all planes will be processed.
  13692. If the format has 1 or 2 components, then luma is bit 0.
  13693. If the format has 3 or 4 components:
  13694. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  13695. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  13696. If present, the alpha channel is always the last bit.
  13697. @item inplace
  13698. Do not require 2nd input for processing, instead use alpha plane from input stream.
  13699. @end table
  13700. @anchor{unsharp}
  13701. @section unsharp
  13702. Sharpen or blur the input video.
  13703. It accepts the following parameters:
  13704. @table @option
  13705. @item luma_msize_x, lx
  13706. Set the luma matrix horizontal size. It must be an odd integer between
  13707. 3 and 23. The default value is 5.
  13708. @item luma_msize_y, ly
  13709. Set the luma matrix vertical size. It must be an odd integer between 3
  13710. and 23. The default value is 5.
  13711. @item luma_amount, la
  13712. Set the luma effect strength. It must be a floating point number, reasonable
  13713. values lay between -1.5 and 1.5.
  13714. Negative values will blur the input video, while positive values will
  13715. sharpen it, a value of zero will disable the effect.
  13716. Default value is 1.0.
  13717. @item chroma_msize_x, cx
  13718. Set the chroma matrix horizontal size. It must be an odd integer
  13719. between 3 and 23. The default value is 5.
  13720. @item chroma_msize_y, cy
  13721. Set the chroma matrix vertical size. It must be an odd integer
  13722. between 3 and 23. The default value is 5.
  13723. @item chroma_amount, ca
  13724. Set the chroma effect strength. It must be a floating point number, reasonable
  13725. values lay between -1.5 and 1.5.
  13726. Negative values will blur the input video, while positive values will
  13727. sharpen it, a value of zero will disable the effect.
  13728. Default value is 0.0.
  13729. @end table
  13730. All parameters are optional and default to the equivalent of the
  13731. string '5:5:1.0:5:5:0.0'.
  13732. @subsection Examples
  13733. @itemize
  13734. @item
  13735. Apply strong luma sharpen effect:
  13736. @example
  13737. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  13738. @end example
  13739. @item
  13740. Apply a strong blur of both luma and chroma parameters:
  13741. @example
  13742. unsharp=7:7:-2:7:7:-2
  13743. @end example
  13744. @end itemize
  13745. @section uspp
  13746. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  13747. the image at several (or - in the case of @option{quality} level @code{8} - all)
  13748. shifts and average the results.
  13749. The way this differs from the behavior of spp is that uspp actually encodes &
  13750. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  13751. DCT similar to MJPEG.
  13752. The filter accepts the following options:
  13753. @table @option
  13754. @item quality
  13755. Set quality. This option defines the number of levels for averaging. It accepts
  13756. an integer in the range 0-8. If set to @code{0}, the filter will have no
  13757. effect. A value of @code{8} means the higher quality. For each increment of
  13758. that value the speed drops by a factor of approximately 2. Default value is
  13759. @code{3}.
  13760. @item qp
  13761. Force a constant quantization parameter. If not set, the filter will use the QP
  13762. from the video stream (if available).
  13763. @end table
  13764. @section v360
  13765. Convert 360 videos between various formats.
  13766. The filter accepts the following options:
  13767. @table @option
  13768. @item input
  13769. @item output
  13770. Set format of the input/output video.
  13771. Available formats:
  13772. @table @samp
  13773. @item e
  13774. @item equirect
  13775. Equirectangular projection.
  13776. @item c3x2
  13777. @item c6x1
  13778. @item c1x6
  13779. Cubemap with 3x2/6x1/1x6 layout.
  13780. Format specific options:
  13781. @table @option
  13782. @item in_pad
  13783. @item out_pad
  13784. Set padding proportion for the input/output cubemap. Values in decimals.
  13785. Example values:
  13786. @table @samp
  13787. @item 0
  13788. No padding.
  13789. @item 0.01
  13790. 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)
  13791. @end table
  13792. Default value is @b{@samp{0}}.
  13793. @item fin_pad
  13794. @item fout_pad
  13795. Set fixed padding for the input/output cubemap. Values in pixels.
  13796. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  13797. @item in_forder
  13798. @item out_forder
  13799. Set order of faces for the input/output cubemap. Choose one direction for each position.
  13800. Designation of directions:
  13801. @table @samp
  13802. @item r
  13803. right
  13804. @item l
  13805. left
  13806. @item u
  13807. up
  13808. @item d
  13809. down
  13810. @item f
  13811. forward
  13812. @item b
  13813. back
  13814. @end table
  13815. Default value is @b{@samp{rludfb}}.
  13816. @item in_frot
  13817. @item out_frot
  13818. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  13819. Designation of angles:
  13820. @table @samp
  13821. @item 0
  13822. 0 degrees clockwise
  13823. @item 1
  13824. 90 degrees clockwise
  13825. @item 2
  13826. 180 degrees clockwise
  13827. @item 3
  13828. 270 degrees clockwise
  13829. @end table
  13830. Default value is @b{@samp{000000}}.
  13831. @end table
  13832. @item eac
  13833. Equi-Angular Cubemap.
  13834. @item flat
  13835. @item gnomonic
  13836. @item rectilinear
  13837. Regular video. @i{(output only)}
  13838. Format specific options:
  13839. @table @option
  13840. @item h_fov
  13841. @item v_fov
  13842. @item d_fov
  13843. Set horizontal/vertical/diagonal field of view. Values in degrees.
  13844. If diagonal field of view is set it overrides horizontal and vertical field of view.
  13845. @end table
  13846. @item dfisheye
  13847. Dual fisheye.
  13848. Format specific options:
  13849. @table @option
  13850. @item in_pad
  13851. @item out_pad
  13852. Set padding proportion. Values in decimals.
  13853. Example values:
  13854. @table @samp
  13855. @item 0
  13856. No padding.
  13857. @item 0.01
  13858. 1% padding.
  13859. @end table
  13860. Default value is @b{@samp{0}}.
  13861. @end table
  13862. @item barrel
  13863. @item fb
  13864. Facebook's 360 format.
  13865. @item sg
  13866. Stereographic format.
  13867. Format specific options:
  13868. @table @option
  13869. @item h_fov
  13870. @item v_fov
  13871. @item d_fov
  13872. Set horizontal/vertical/diagonal field of view. Values in degrees.
  13873. If diagonal field of view is set it overrides horizontal and vertical field of view.
  13874. @end table
  13875. @item mercator
  13876. Mercator format.
  13877. @item ball
  13878. Ball format, gives significant distortion toward the back.
  13879. @item hammer
  13880. Hammer-Aitoff map projection format.
  13881. @item sinusoidal
  13882. Sinusoidal map projection format.
  13883. @end table
  13884. @item interp
  13885. Set interpolation method.@*
  13886. @i{Note: more complex interpolation methods require much more memory to run.}
  13887. Available methods:
  13888. @table @samp
  13889. @item near
  13890. @item nearest
  13891. Nearest neighbour.
  13892. @item line
  13893. @item linear
  13894. Bilinear interpolation.
  13895. @item cube
  13896. @item cubic
  13897. Bicubic interpolation.
  13898. @item lanc
  13899. @item lanczos
  13900. Lanczos interpolation.
  13901. @end table
  13902. Default value is @b{@samp{line}}.
  13903. @item w
  13904. @item h
  13905. Set the output video resolution.
  13906. Default resolution depends on formats.
  13907. @item in_stereo
  13908. @item out_stereo
  13909. Set the input/output stereo format.
  13910. @table @samp
  13911. @item 2d
  13912. 2D mono
  13913. @item sbs
  13914. Side by side
  13915. @item tb
  13916. Top bottom
  13917. @end table
  13918. Default value is @b{@samp{2d}} for input and output format.
  13919. @item yaw
  13920. @item pitch
  13921. @item roll
  13922. Set rotation for the output video. Values in degrees.
  13923. @item rorder
  13924. Set rotation order for the output video. Choose one item for each position.
  13925. @table @samp
  13926. @item y, Y
  13927. yaw
  13928. @item p, P
  13929. pitch
  13930. @item r, R
  13931. roll
  13932. @end table
  13933. Default value is @b{@samp{ypr}}.
  13934. @item h_flip
  13935. @item v_flip
  13936. @item d_flip
  13937. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  13938. @item ih_flip
  13939. @item iv_flip
  13940. Set if input video is flipped horizontally/vertically. Boolean values.
  13941. @item in_trans
  13942. Set if input video is transposed. Boolean value, by default disabled.
  13943. @item out_trans
  13944. Set if output video needs to be transposed. Boolean value, by default disabled.
  13945. @end table
  13946. @subsection Examples
  13947. @itemize
  13948. @item
  13949. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  13950. @example
  13951. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  13952. @end example
  13953. @item
  13954. Extract back view of Equi-Angular Cubemap:
  13955. @example
  13956. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  13957. @end example
  13958. @item
  13959. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  13960. @example
  13961. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  13962. @end example
  13963. @end itemize
  13964. @section vaguedenoiser
  13965. Apply a wavelet based denoiser.
  13966. It transforms each frame from the video input into the wavelet domain,
  13967. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  13968. the obtained coefficients. It does an inverse wavelet transform after.
  13969. Due to wavelet properties, it should give a nice smoothed result, and
  13970. reduced noise, without blurring picture features.
  13971. This filter accepts the following options:
  13972. @table @option
  13973. @item threshold
  13974. The filtering strength. The higher, the more filtered the video will be.
  13975. Hard thresholding can use a higher threshold than soft thresholding
  13976. before the video looks overfiltered. Default value is 2.
  13977. @item method
  13978. The filtering method the filter will use.
  13979. It accepts the following values:
  13980. @table @samp
  13981. @item hard
  13982. All values under the threshold will be zeroed.
  13983. @item soft
  13984. All values under the threshold will be zeroed. All values above will be
  13985. reduced by the threshold.
  13986. @item garrote
  13987. Scales or nullifies coefficients - intermediary between (more) soft and
  13988. (less) hard thresholding.
  13989. @end table
  13990. Default is garrote.
  13991. @item nsteps
  13992. Number of times, the wavelet will decompose the picture. Picture can't
  13993. be decomposed beyond a particular point (typically, 8 for a 640x480
  13994. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  13995. @item percent
  13996. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  13997. @item planes
  13998. A list of the planes to process. By default all planes are processed.
  13999. @end table
  14000. @section vectorscope
  14001. Display 2 color component values in the two dimensional graph (which is called
  14002. a vectorscope).
  14003. This filter accepts the following options:
  14004. @table @option
  14005. @item mode, m
  14006. Set vectorscope mode.
  14007. It accepts the following values:
  14008. @table @samp
  14009. @item gray
  14010. Gray values are displayed on graph, higher brightness means more pixels have
  14011. same component color value on location in graph. This is the default mode.
  14012. @item color
  14013. Gray values are displayed on graph. Surrounding pixels values which are not
  14014. present in video frame are drawn in gradient of 2 color components which are
  14015. set by option @code{x} and @code{y}. The 3rd color component is static.
  14016. @item color2
  14017. Actual color components values present in video frame are displayed on graph.
  14018. @item color3
  14019. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  14020. on graph increases value of another color component, which is luminance by
  14021. default values of @code{x} and @code{y}.
  14022. @item color4
  14023. Actual colors present in video frame are displayed on graph. If two different
  14024. colors map to same position on graph then color with higher value of component
  14025. not present in graph is picked.
  14026. @item color5
  14027. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  14028. component picked from radial gradient.
  14029. @end table
  14030. @item x
  14031. Set which color component will be represented on X-axis. Default is @code{1}.
  14032. @item y
  14033. Set which color component will be represented on Y-axis. Default is @code{2}.
  14034. @item intensity, i
  14035. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  14036. of color component which represents frequency of (X, Y) location in graph.
  14037. @item envelope, e
  14038. @table @samp
  14039. @item none
  14040. No envelope, this is default.
  14041. @item instant
  14042. Instant envelope, even darkest single pixel will be clearly highlighted.
  14043. @item peak
  14044. Hold maximum and minimum values presented in graph over time. This way you
  14045. can still spot out of range values without constantly looking at vectorscope.
  14046. @item peak+instant
  14047. Peak and instant envelope combined together.
  14048. @end table
  14049. @item graticule, g
  14050. Set what kind of graticule to draw.
  14051. @table @samp
  14052. @item none
  14053. @item green
  14054. @item color
  14055. @end table
  14056. @item opacity, o
  14057. Set graticule opacity.
  14058. @item flags, f
  14059. Set graticule flags.
  14060. @table @samp
  14061. @item white
  14062. Draw graticule for white point.
  14063. @item black
  14064. Draw graticule for black point.
  14065. @item name
  14066. Draw color points short names.
  14067. @end table
  14068. @item bgopacity, b
  14069. Set background opacity.
  14070. @item lthreshold, l
  14071. Set low threshold for color component not represented on X or Y axis.
  14072. Values lower than this value will be ignored. Default is 0.
  14073. Note this value is multiplied with actual max possible value one pixel component
  14074. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  14075. is 0.1 * 255 = 25.
  14076. @item hthreshold, h
  14077. Set high threshold for color component not represented on X or Y axis.
  14078. Values higher than this value will be ignored. Default is 1.
  14079. Note this value is multiplied with actual max possible value one pixel component
  14080. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  14081. is 0.9 * 255 = 230.
  14082. @item colorspace, c
  14083. Set what kind of colorspace to use when drawing graticule.
  14084. @table @samp
  14085. @item auto
  14086. @item 601
  14087. @item 709
  14088. @end table
  14089. Default is auto.
  14090. @end table
  14091. @anchor{vidstabdetect}
  14092. @section vidstabdetect
  14093. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  14094. @ref{vidstabtransform} for pass 2.
  14095. This filter generates a file with relative translation and rotation
  14096. transform information about subsequent frames, which is then used by
  14097. the @ref{vidstabtransform} filter.
  14098. To enable compilation of this filter you need to configure FFmpeg with
  14099. @code{--enable-libvidstab}.
  14100. This filter accepts the following options:
  14101. @table @option
  14102. @item result
  14103. Set the path to the file used to write the transforms information.
  14104. Default value is @file{transforms.trf}.
  14105. @item shakiness
  14106. Set how shaky the video is and how quick the camera is. It accepts an
  14107. integer in the range 1-10, a value of 1 means little shakiness, a
  14108. value of 10 means strong shakiness. Default value is 5.
  14109. @item accuracy
  14110. Set the accuracy of the detection process. It must be a value in the
  14111. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  14112. accuracy. Default value is 15.
  14113. @item stepsize
  14114. Set stepsize of the search process. The region around minimum is
  14115. scanned with 1 pixel resolution. Default value is 6.
  14116. @item mincontrast
  14117. Set minimum contrast. Below this value a local measurement field is
  14118. discarded. Must be a floating point value in the range 0-1. Default
  14119. value is 0.3.
  14120. @item tripod
  14121. Set reference frame number for tripod mode.
  14122. If enabled, the motion of the frames is compared to a reference frame
  14123. in the filtered stream, identified by the specified number. The idea
  14124. is to compensate all movements in a more-or-less static scene and keep
  14125. the camera view absolutely still.
  14126. If set to 0, it is disabled. The frames are counted starting from 1.
  14127. @item show
  14128. Show fields and transforms in the resulting frames. It accepts an
  14129. integer in the range 0-2. Default value is 0, which disables any
  14130. visualization.
  14131. @end table
  14132. @subsection Examples
  14133. @itemize
  14134. @item
  14135. Use default values:
  14136. @example
  14137. vidstabdetect
  14138. @end example
  14139. @item
  14140. Analyze strongly shaky movie and put the results in file
  14141. @file{mytransforms.trf}:
  14142. @example
  14143. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  14144. @end example
  14145. @item
  14146. Visualize the result of internal transformations in the resulting
  14147. video:
  14148. @example
  14149. vidstabdetect=show=1
  14150. @end example
  14151. @item
  14152. Analyze a video with medium shakiness using @command{ffmpeg}:
  14153. @example
  14154. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  14155. @end example
  14156. @end itemize
  14157. @anchor{vidstabtransform}
  14158. @section vidstabtransform
  14159. Video stabilization/deshaking: pass 2 of 2,
  14160. see @ref{vidstabdetect} for pass 1.
  14161. Read a file with transform information for each frame and
  14162. apply/compensate them. Together with the @ref{vidstabdetect}
  14163. filter this can be used to deshake videos. See also
  14164. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  14165. the @ref{unsharp} filter, see below.
  14166. To enable compilation of this filter you need to configure FFmpeg with
  14167. @code{--enable-libvidstab}.
  14168. @subsection Options
  14169. @table @option
  14170. @item input
  14171. Set path to the file used to read the transforms. Default value is
  14172. @file{transforms.trf}.
  14173. @item smoothing
  14174. Set the number of frames (value*2 + 1) used for lowpass filtering the
  14175. camera movements. Default value is 10.
  14176. For example a number of 10 means that 21 frames are used (10 in the
  14177. past and 10 in the future) to smoothen the motion in the video. A
  14178. larger value leads to a smoother video, but limits the acceleration of
  14179. the camera (pan/tilt movements). 0 is a special case where a static
  14180. camera is simulated.
  14181. @item optalgo
  14182. Set the camera path optimization algorithm.
  14183. Accepted values are:
  14184. @table @samp
  14185. @item gauss
  14186. gaussian kernel low-pass filter on camera motion (default)
  14187. @item avg
  14188. averaging on transformations
  14189. @end table
  14190. @item maxshift
  14191. Set maximal number of pixels to translate frames. Default value is -1,
  14192. meaning no limit.
  14193. @item maxangle
  14194. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  14195. value is -1, meaning no limit.
  14196. @item crop
  14197. Specify how to deal with borders that may be visible due to movement
  14198. compensation.
  14199. Available values are:
  14200. @table @samp
  14201. @item keep
  14202. keep image information from previous frame (default)
  14203. @item black
  14204. fill the border black
  14205. @end table
  14206. @item invert
  14207. Invert transforms if set to 1. Default value is 0.
  14208. @item relative
  14209. Consider transforms as relative to previous frame if set to 1,
  14210. absolute if set to 0. Default value is 0.
  14211. @item zoom
  14212. Set percentage to zoom. A positive value will result in a zoom-in
  14213. effect, a negative value in a zoom-out effect. Default value is 0 (no
  14214. zoom).
  14215. @item optzoom
  14216. Set optimal zooming to avoid borders.
  14217. Accepted values are:
  14218. @table @samp
  14219. @item 0
  14220. disabled
  14221. @item 1
  14222. optimal static zoom value is determined (only very strong movements
  14223. will lead to visible borders) (default)
  14224. @item 2
  14225. optimal adaptive zoom value is determined (no borders will be
  14226. visible), see @option{zoomspeed}
  14227. @end table
  14228. Note that the value given at zoom is added to the one calculated here.
  14229. @item zoomspeed
  14230. Set percent to zoom maximally each frame (enabled when
  14231. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  14232. 0.25.
  14233. @item interpol
  14234. Specify type of interpolation.
  14235. Available values are:
  14236. @table @samp
  14237. @item no
  14238. no interpolation
  14239. @item linear
  14240. linear only horizontal
  14241. @item bilinear
  14242. linear in both directions (default)
  14243. @item bicubic
  14244. cubic in both directions (slow)
  14245. @end table
  14246. @item tripod
  14247. Enable virtual tripod mode if set to 1, which is equivalent to
  14248. @code{relative=0:smoothing=0}. Default value is 0.
  14249. Use also @code{tripod} option of @ref{vidstabdetect}.
  14250. @item debug
  14251. Increase log verbosity if set to 1. Also the detected global motions
  14252. are written to the temporary file @file{global_motions.trf}. Default
  14253. value is 0.
  14254. @end table
  14255. @subsection Examples
  14256. @itemize
  14257. @item
  14258. Use @command{ffmpeg} for a typical stabilization with default values:
  14259. @example
  14260. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  14261. @end example
  14262. Note the use of the @ref{unsharp} filter which is always recommended.
  14263. @item
  14264. Zoom in a bit more and load transform data from a given file:
  14265. @example
  14266. vidstabtransform=zoom=5:input="mytransforms.trf"
  14267. @end example
  14268. @item
  14269. Smoothen the video even more:
  14270. @example
  14271. vidstabtransform=smoothing=30
  14272. @end example
  14273. @end itemize
  14274. @section vflip
  14275. Flip the input video vertically.
  14276. For example, to vertically flip a video with @command{ffmpeg}:
  14277. @example
  14278. ffmpeg -i in.avi -vf "vflip" out.avi
  14279. @end example
  14280. @section vfrdet
  14281. Detect variable frame rate video.
  14282. This filter tries to detect if the input is variable or constant frame rate.
  14283. At end it will output number of frames detected as having variable delta pts,
  14284. and ones with constant delta pts.
  14285. If there was frames with variable delta, than it will also show min and max delta
  14286. encountered.
  14287. @section vibrance
  14288. Boost or alter saturation.
  14289. The filter accepts the following options:
  14290. @table @option
  14291. @item intensity
  14292. Set strength of boost if positive value or strength of alter if negative value.
  14293. Default is 0. Allowed range is from -2 to 2.
  14294. @item rbal
  14295. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  14296. @item gbal
  14297. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  14298. @item bbal
  14299. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  14300. @item rlum
  14301. Set the red luma coefficient.
  14302. @item glum
  14303. Set the green luma coefficient.
  14304. @item blum
  14305. Set the blue luma coefficient.
  14306. @item alternate
  14307. If @code{intensity} is negative and this is set to 1, colors will change,
  14308. otherwise colors will be less saturated, more towards gray.
  14309. @end table
  14310. @anchor{vignette}
  14311. @section vignette
  14312. Make or reverse a natural vignetting effect.
  14313. The filter accepts the following options:
  14314. @table @option
  14315. @item angle, a
  14316. Set lens angle expression as a number of radians.
  14317. The value is clipped in the @code{[0,PI/2]} range.
  14318. Default value: @code{"PI/5"}
  14319. @item x0
  14320. @item y0
  14321. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  14322. by default.
  14323. @item mode
  14324. Set forward/backward mode.
  14325. Available modes are:
  14326. @table @samp
  14327. @item forward
  14328. The larger the distance from the central point, the darker the image becomes.
  14329. @item backward
  14330. The larger the distance from the central point, the brighter the image becomes.
  14331. This can be used to reverse a vignette effect, though there is no automatic
  14332. detection to extract the lens @option{angle} and other settings (yet). It can
  14333. also be used to create a burning effect.
  14334. @end table
  14335. Default value is @samp{forward}.
  14336. @item eval
  14337. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  14338. It accepts the following values:
  14339. @table @samp
  14340. @item init
  14341. Evaluate expressions only once during the filter initialization.
  14342. @item frame
  14343. Evaluate expressions for each incoming frame. This is way slower than the
  14344. @samp{init} mode since it requires all the scalers to be re-computed, but it
  14345. allows advanced dynamic expressions.
  14346. @end table
  14347. Default value is @samp{init}.
  14348. @item dither
  14349. Set dithering to reduce the circular banding effects. Default is @code{1}
  14350. (enabled).
  14351. @item aspect
  14352. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  14353. Setting this value to the SAR of the input will make a rectangular vignetting
  14354. following the dimensions of the video.
  14355. Default is @code{1/1}.
  14356. @end table
  14357. @subsection Expressions
  14358. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  14359. following parameters.
  14360. @table @option
  14361. @item w
  14362. @item h
  14363. input width and height
  14364. @item n
  14365. the number of input frame, starting from 0
  14366. @item pts
  14367. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  14368. @var{TB} units, NAN if undefined
  14369. @item r
  14370. frame rate of the input video, NAN if the input frame rate is unknown
  14371. @item t
  14372. the PTS (Presentation TimeStamp) of the filtered video frame,
  14373. expressed in seconds, NAN if undefined
  14374. @item tb
  14375. time base of the input video
  14376. @end table
  14377. @subsection Examples
  14378. @itemize
  14379. @item
  14380. Apply simple strong vignetting effect:
  14381. @example
  14382. vignette=PI/4
  14383. @end example
  14384. @item
  14385. Make a flickering vignetting:
  14386. @example
  14387. vignette='PI/4+random(1)*PI/50':eval=frame
  14388. @end example
  14389. @end itemize
  14390. @section vmafmotion
  14391. Obtain the average vmaf motion score of a video.
  14392. It is one of the component filters of VMAF.
  14393. The obtained average motion score is printed through the logging system.
  14394. In the below example the input file @file{ref.mpg} is being processed and score
  14395. is computed.
  14396. @example
  14397. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  14398. @end example
  14399. @section vstack
  14400. Stack input videos vertically.
  14401. All streams must be of same pixel format and of same width.
  14402. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  14403. to create same output.
  14404. The filter accepts the following options:
  14405. @table @option
  14406. @item inputs
  14407. Set number of input streams. Default is 2.
  14408. @item shortest
  14409. If set to 1, force the output to terminate when the shortest input
  14410. terminates. Default value is 0.
  14411. @end table
  14412. @section w3fdif
  14413. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  14414. Deinterlacing Filter").
  14415. Based on the process described by Martin Weston for BBC R&D, and
  14416. implemented based on the de-interlace algorithm written by Jim
  14417. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  14418. uses filter coefficients calculated by BBC R&D.
  14419. This filter uses field-dominance information in frame to decide which
  14420. of each pair of fields to place first in the output.
  14421. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  14422. There are two sets of filter coefficients, so called "simple"
  14423. and "complex". Which set of filter coefficients is used can
  14424. be set by passing an optional parameter:
  14425. @table @option
  14426. @item filter
  14427. Set the interlacing filter coefficients. Accepts one of the following values:
  14428. @table @samp
  14429. @item simple
  14430. Simple filter coefficient set.
  14431. @item complex
  14432. More-complex filter coefficient set.
  14433. @end table
  14434. Default value is @samp{complex}.
  14435. @item deint
  14436. Specify which frames to deinterlace. Accepts one of the following values:
  14437. @table @samp
  14438. @item all
  14439. Deinterlace all frames,
  14440. @item interlaced
  14441. Only deinterlace frames marked as interlaced.
  14442. @end table
  14443. Default value is @samp{all}.
  14444. @end table
  14445. @section waveform
  14446. Video waveform monitor.
  14447. The waveform monitor plots color component intensity. By default luminance
  14448. only. Each column of the waveform corresponds to a column of pixels in the
  14449. source video.
  14450. It accepts the following options:
  14451. @table @option
  14452. @item mode, m
  14453. Can be either @code{row}, or @code{column}. Default is @code{column}.
  14454. In row mode, the graph on the left side represents color component value 0 and
  14455. the right side represents value = 255. In column mode, the top side represents
  14456. color component value = 0 and bottom side represents value = 255.
  14457. @item intensity, i
  14458. Set intensity. Smaller values are useful to find out how many values of the same
  14459. luminance are distributed across input rows/columns.
  14460. Default value is @code{0.04}. Allowed range is [0, 1].
  14461. @item mirror, r
  14462. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  14463. In mirrored mode, higher values will be represented on the left
  14464. side for @code{row} mode and at the top for @code{column} mode. Default is
  14465. @code{1} (mirrored).
  14466. @item display, d
  14467. Set display mode.
  14468. It accepts the following values:
  14469. @table @samp
  14470. @item overlay
  14471. Presents information identical to that in the @code{parade}, except
  14472. that the graphs representing color components are superimposed directly
  14473. over one another.
  14474. This display mode makes it easier to spot relative differences or similarities
  14475. in overlapping areas of the color components that are supposed to be identical,
  14476. such as neutral whites, grays, or blacks.
  14477. @item stack
  14478. Display separate graph for the color components side by side in
  14479. @code{row} mode or one below the other in @code{column} mode.
  14480. @item parade
  14481. Display separate graph for the color components side by side in
  14482. @code{column} mode or one below the other in @code{row} mode.
  14483. Using this display mode makes it easy to spot color casts in the highlights
  14484. and shadows of an image, by comparing the contours of the top and the bottom
  14485. graphs of each waveform. Since whites, grays, and blacks are characterized
  14486. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  14487. should display three waveforms of roughly equal width/height. If not, the
  14488. correction is easy to perform by making level adjustments the three waveforms.
  14489. @end table
  14490. Default is @code{stack}.
  14491. @item components, c
  14492. Set which color components to display. Default is 1, which means only luminance
  14493. or red color component if input is in RGB colorspace. If is set for example to
  14494. 7 it will display all 3 (if) available color components.
  14495. @item envelope, e
  14496. @table @samp
  14497. @item none
  14498. No envelope, this is default.
  14499. @item instant
  14500. Instant envelope, minimum and maximum values presented in graph will be easily
  14501. visible even with small @code{step} value.
  14502. @item peak
  14503. Hold minimum and maximum values presented in graph across time. This way you
  14504. can still spot out of range values without constantly looking at waveforms.
  14505. @item peak+instant
  14506. Peak and instant envelope combined together.
  14507. @end table
  14508. @item filter, f
  14509. @table @samp
  14510. @item lowpass
  14511. No filtering, this is default.
  14512. @item flat
  14513. Luma and chroma combined together.
  14514. @item aflat
  14515. Similar as above, but shows difference between blue and red chroma.
  14516. @item xflat
  14517. Similar as above, but use different colors.
  14518. @item chroma
  14519. Displays only chroma.
  14520. @item color
  14521. Displays actual color value on waveform.
  14522. @item acolor
  14523. Similar as above, but with luma showing frequency of chroma values.
  14524. @end table
  14525. @item graticule, g
  14526. Set which graticule to display.
  14527. @table @samp
  14528. @item none
  14529. Do not display graticule.
  14530. @item green
  14531. Display green graticule showing legal broadcast ranges.
  14532. @item orange
  14533. Display orange graticule showing legal broadcast ranges.
  14534. @end table
  14535. @item opacity, o
  14536. Set graticule opacity.
  14537. @item flags, fl
  14538. Set graticule flags.
  14539. @table @samp
  14540. @item numbers
  14541. Draw numbers above lines. By default enabled.
  14542. @item dots
  14543. Draw dots instead of lines.
  14544. @end table
  14545. @item scale, s
  14546. Set scale used for displaying graticule.
  14547. @table @samp
  14548. @item digital
  14549. @item millivolts
  14550. @item ire
  14551. @end table
  14552. Default is digital.
  14553. @item bgopacity, b
  14554. Set background opacity.
  14555. @end table
  14556. @section weave, doubleweave
  14557. The @code{weave} takes a field-based video input and join
  14558. each two sequential fields into single frame, producing a new double
  14559. height clip with half the frame rate and half the frame count.
  14560. The @code{doubleweave} works same as @code{weave} but without
  14561. halving frame rate and frame count.
  14562. It accepts the following option:
  14563. @table @option
  14564. @item first_field
  14565. Set first field. Available values are:
  14566. @table @samp
  14567. @item top, t
  14568. Set the frame as top-field-first.
  14569. @item bottom, b
  14570. Set the frame as bottom-field-first.
  14571. @end table
  14572. @end table
  14573. @subsection Examples
  14574. @itemize
  14575. @item
  14576. Interlace video using @ref{select} and @ref{separatefields} filter:
  14577. @example
  14578. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  14579. @end example
  14580. @end itemize
  14581. @section xbr
  14582. Apply the xBR high-quality magnification filter which is designed for pixel
  14583. art. It follows a set of edge-detection rules, see
  14584. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  14585. It accepts the following option:
  14586. @table @option
  14587. @item n
  14588. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  14589. @code{3xBR} and @code{4} for @code{4xBR}.
  14590. Default is @code{3}.
  14591. @end table
  14592. @section xmedian
  14593. Pick median pixels from several input videos.
  14594. The filter accepts the following options:
  14595. @table @option
  14596. @item inputs
  14597. Set number of inputs.
  14598. Default is 3. Allowed range is from 3 to 255.
  14599. If number of inputs is even number, than result will be mean value between two median values.
  14600. @item planes
  14601. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14602. @end table
  14603. @section xstack
  14604. Stack video inputs into custom layout.
  14605. All streams must be of same pixel format.
  14606. The filter accepts the following options:
  14607. @table @option
  14608. @item inputs
  14609. Set number of input streams. Default is 2.
  14610. @item layout
  14611. Specify layout of inputs.
  14612. This option requires the desired layout configuration to be explicitly set by the user.
  14613. This sets position of each video input in output. Each input
  14614. is separated by '|'.
  14615. The first number represents the column, and the second number represents the row.
  14616. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  14617. where X is video input from which to take width or height.
  14618. Multiple values can be used when separated by '+'. In such
  14619. case values are summed together.
  14620. Note that if inputs are of different sizes gaps may appear, as not all of
  14621. the output video frame will be filled. Similarly, videos can overlap each
  14622. other if their position doesn't leave enough space for the full frame of
  14623. adjoining videos.
  14624. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  14625. a layout must be set by the user.
  14626. @item shortest
  14627. If set to 1, force the output to terminate when the shortest input
  14628. terminates. Default value is 0.
  14629. @end table
  14630. @subsection Examples
  14631. @itemize
  14632. @item
  14633. Display 4 inputs into 2x2 grid.
  14634. Layout:
  14635. @example
  14636. input1(0, 0) | input3(w0, 0)
  14637. input2(0, h0) | input4(w0, h0)
  14638. @end example
  14639. @example
  14640. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  14641. @end example
  14642. Note that if inputs are of different sizes, gaps or overlaps may occur.
  14643. @item
  14644. Display 4 inputs into 1x4 grid.
  14645. Layout:
  14646. @example
  14647. input1(0, 0)
  14648. input2(0, h0)
  14649. input3(0, h0+h1)
  14650. input4(0, h0+h1+h2)
  14651. @end example
  14652. @example
  14653. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  14654. @end example
  14655. Note that if inputs are of different widths, unused space will appear.
  14656. @item
  14657. Display 9 inputs into 3x3 grid.
  14658. Layout:
  14659. @example
  14660. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  14661. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  14662. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  14663. @end example
  14664. @example
  14665. 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
  14666. @end example
  14667. Note that if inputs are of different sizes, gaps or overlaps may occur.
  14668. @item
  14669. Display 16 inputs into 4x4 grid.
  14670. Layout:
  14671. @example
  14672. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  14673. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  14674. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  14675. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  14676. @end example
  14677. @example
  14678. 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|
  14679. 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
  14680. @end example
  14681. Note that if inputs are of different sizes, gaps or overlaps may occur.
  14682. @end itemize
  14683. @anchor{yadif}
  14684. @section yadif
  14685. Deinterlace the input video ("yadif" means "yet another deinterlacing
  14686. filter").
  14687. It accepts the following parameters:
  14688. @table @option
  14689. @item mode
  14690. The interlacing mode to adopt. It accepts one of the following values:
  14691. @table @option
  14692. @item 0, send_frame
  14693. Output one frame for each frame.
  14694. @item 1, send_field
  14695. Output one frame for each field.
  14696. @item 2, send_frame_nospatial
  14697. Like @code{send_frame}, but it skips the spatial interlacing check.
  14698. @item 3, send_field_nospatial
  14699. Like @code{send_field}, but it skips the spatial interlacing check.
  14700. @end table
  14701. The default value is @code{send_frame}.
  14702. @item parity
  14703. The picture field parity assumed for the input interlaced video. It accepts one
  14704. of the following values:
  14705. @table @option
  14706. @item 0, tff
  14707. Assume the top field is first.
  14708. @item 1, bff
  14709. Assume the bottom field is first.
  14710. @item -1, auto
  14711. Enable automatic detection of field parity.
  14712. @end table
  14713. The default value is @code{auto}.
  14714. If the interlacing is unknown or the decoder does not export this information,
  14715. top field first will be assumed.
  14716. @item deint
  14717. Specify which frames to deinterlace. Accepts one of the following
  14718. values:
  14719. @table @option
  14720. @item 0, all
  14721. Deinterlace all frames.
  14722. @item 1, interlaced
  14723. Only deinterlace frames marked as interlaced.
  14724. @end table
  14725. The default value is @code{all}.
  14726. @end table
  14727. @section yadif_cuda
  14728. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  14729. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  14730. and/or nvenc.
  14731. It accepts the following parameters:
  14732. @table @option
  14733. @item mode
  14734. The interlacing mode to adopt. It accepts one of the following values:
  14735. @table @option
  14736. @item 0, send_frame
  14737. Output one frame for each frame.
  14738. @item 1, send_field
  14739. Output one frame for each field.
  14740. @item 2, send_frame_nospatial
  14741. Like @code{send_frame}, but it skips the spatial interlacing check.
  14742. @item 3, send_field_nospatial
  14743. Like @code{send_field}, but it skips the spatial interlacing check.
  14744. @end table
  14745. The default value is @code{send_frame}.
  14746. @item parity
  14747. The picture field parity assumed for the input interlaced video. It accepts one
  14748. of the following values:
  14749. @table @option
  14750. @item 0, tff
  14751. Assume the top field is first.
  14752. @item 1, bff
  14753. Assume the bottom field is first.
  14754. @item -1, auto
  14755. Enable automatic detection of field parity.
  14756. @end table
  14757. The default value is @code{auto}.
  14758. If the interlacing is unknown or the decoder does not export this information,
  14759. top field first will be assumed.
  14760. @item deint
  14761. Specify which frames to deinterlace. Accepts one of the following
  14762. values:
  14763. @table @option
  14764. @item 0, all
  14765. Deinterlace all frames.
  14766. @item 1, interlaced
  14767. Only deinterlace frames marked as interlaced.
  14768. @end table
  14769. The default value is @code{all}.
  14770. @end table
  14771. @section zoompan
  14772. Apply Zoom & Pan effect.
  14773. This filter accepts the following options:
  14774. @table @option
  14775. @item zoom, z
  14776. Set the zoom expression. Range is 1-10. Default is 1.
  14777. @item x
  14778. @item y
  14779. Set the x and y expression. Default is 0.
  14780. @item d
  14781. Set the duration expression in number of frames.
  14782. This sets for how many number of frames effect will last for
  14783. single input image.
  14784. @item s
  14785. Set the output image size, default is 'hd720'.
  14786. @item fps
  14787. Set the output frame rate, default is '25'.
  14788. @end table
  14789. Each expression can contain the following constants:
  14790. @table @option
  14791. @item in_w, iw
  14792. Input width.
  14793. @item in_h, ih
  14794. Input height.
  14795. @item out_w, ow
  14796. Output width.
  14797. @item out_h, oh
  14798. Output height.
  14799. @item in
  14800. Input frame count.
  14801. @item on
  14802. Output frame count.
  14803. @item x
  14804. @item y
  14805. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  14806. for current input frame.
  14807. @item px
  14808. @item py
  14809. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  14810. not yet such frame (first input frame).
  14811. @item zoom
  14812. Last calculated zoom from 'z' expression for current input frame.
  14813. @item pzoom
  14814. Last calculated zoom of last output frame of previous input frame.
  14815. @item duration
  14816. Number of output frames for current input frame. Calculated from 'd' expression
  14817. for each input frame.
  14818. @item pduration
  14819. number of output frames created for previous input frame
  14820. @item a
  14821. Rational number: input width / input height
  14822. @item sar
  14823. sample aspect ratio
  14824. @item dar
  14825. display aspect ratio
  14826. @end table
  14827. @subsection Examples
  14828. @itemize
  14829. @item
  14830. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  14831. @example
  14832. 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
  14833. @end example
  14834. @item
  14835. Zoom-in up to 1.5 and pan always at center of picture:
  14836. @example
  14837. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14838. @end example
  14839. @item
  14840. Same as above but without pausing:
  14841. @example
  14842. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14843. @end example
  14844. @end itemize
  14845. @anchor{zscale}
  14846. @section zscale
  14847. Scale (resize) the input video, using the z.lib library:
  14848. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  14849. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  14850. The zscale filter forces the output display aspect ratio to be the same
  14851. as the input, by changing the output sample aspect ratio.
  14852. If the input image format is different from the format requested by
  14853. the next filter, the zscale filter will convert the input to the
  14854. requested format.
  14855. @subsection Options
  14856. The filter accepts the following options.
  14857. @table @option
  14858. @item width, w
  14859. @item height, h
  14860. Set the output video dimension expression. Default value is the input
  14861. dimension.
  14862. If the @var{width} or @var{w} value is 0, the input width is used for
  14863. the output. If the @var{height} or @var{h} value is 0, the input height
  14864. is used for the output.
  14865. If one and only one of the values is -n with n >= 1, the zscale filter
  14866. will use a value that maintains the aspect ratio of the input image,
  14867. calculated from the other specified dimension. After that it will,
  14868. however, make sure that the calculated dimension is divisible by n and
  14869. adjust the value if necessary.
  14870. If both values are -n with n >= 1, the behavior will be identical to
  14871. both values being set to 0 as previously detailed.
  14872. See below for the list of accepted constants for use in the dimension
  14873. expression.
  14874. @item size, s
  14875. Set the video size. For the syntax of this option, check the
  14876. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14877. @item dither, d
  14878. Set the dither type.
  14879. Possible values are:
  14880. @table @var
  14881. @item none
  14882. @item ordered
  14883. @item random
  14884. @item error_diffusion
  14885. @end table
  14886. Default is none.
  14887. @item filter, f
  14888. Set the resize filter type.
  14889. Possible values are:
  14890. @table @var
  14891. @item point
  14892. @item bilinear
  14893. @item bicubic
  14894. @item spline16
  14895. @item spline36
  14896. @item lanczos
  14897. @end table
  14898. Default is bilinear.
  14899. @item range, r
  14900. Set the color range.
  14901. Possible values are:
  14902. @table @var
  14903. @item input
  14904. @item limited
  14905. @item full
  14906. @end table
  14907. Default is same as input.
  14908. @item primaries, p
  14909. Set the color primaries.
  14910. Possible values are:
  14911. @table @var
  14912. @item input
  14913. @item 709
  14914. @item unspecified
  14915. @item 170m
  14916. @item 240m
  14917. @item 2020
  14918. @end table
  14919. Default is same as input.
  14920. @item transfer, t
  14921. Set the transfer characteristics.
  14922. Possible values are:
  14923. @table @var
  14924. @item input
  14925. @item 709
  14926. @item unspecified
  14927. @item 601
  14928. @item linear
  14929. @item 2020_10
  14930. @item 2020_12
  14931. @item smpte2084
  14932. @item iec61966-2-1
  14933. @item arib-std-b67
  14934. @end table
  14935. Default is same as input.
  14936. @item matrix, m
  14937. Set the colorspace matrix.
  14938. Possible value are:
  14939. @table @var
  14940. @item input
  14941. @item 709
  14942. @item unspecified
  14943. @item 470bg
  14944. @item 170m
  14945. @item 2020_ncl
  14946. @item 2020_cl
  14947. @end table
  14948. Default is same as input.
  14949. @item rangein, rin
  14950. Set the input color range.
  14951. Possible values are:
  14952. @table @var
  14953. @item input
  14954. @item limited
  14955. @item full
  14956. @end table
  14957. Default is same as input.
  14958. @item primariesin, pin
  14959. Set the input color primaries.
  14960. Possible values are:
  14961. @table @var
  14962. @item input
  14963. @item 709
  14964. @item unspecified
  14965. @item 170m
  14966. @item 240m
  14967. @item 2020
  14968. @end table
  14969. Default is same as input.
  14970. @item transferin, tin
  14971. Set the input transfer characteristics.
  14972. Possible values are:
  14973. @table @var
  14974. @item input
  14975. @item 709
  14976. @item unspecified
  14977. @item 601
  14978. @item linear
  14979. @item 2020_10
  14980. @item 2020_12
  14981. @end table
  14982. Default is same as input.
  14983. @item matrixin, min
  14984. Set the input colorspace matrix.
  14985. Possible value are:
  14986. @table @var
  14987. @item input
  14988. @item 709
  14989. @item unspecified
  14990. @item 470bg
  14991. @item 170m
  14992. @item 2020_ncl
  14993. @item 2020_cl
  14994. @end table
  14995. @item chromal, c
  14996. Set the output chroma location.
  14997. Possible values are:
  14998. @table @var
  14999. @item input
  15000. @item left
  15001. @item center
  15002. @item topleft
  15003. @item top
  15004. @item bottomleft
  15005. @item bottom
  15006. @end table
  15007. @item chromalin, cin
  15008. Set the input chroma location.
  15009. Possible values are:
  15010. @table @var
  15011. @item input
  15012. @item left
  15013. @item center
  15014. @item topleft
  15015. @item top
  15016. @item bottomleft
  15017. @item bottom
  15018. @end table
  15019. @item npl
  15020. Set the nominal peak luminance.
  15021. @end table
  15022. The values of the @option{w} and @option{h} options are expressions
  15023. containing the following constants:
  15024. @table @var
  15025. @item in_w
  15026. @item in_h
  15027. The input width and height
  15028. @item iw
  15029. @item ih
  15030. These are the same as @var{in_w} and @var{in_h}.
  15031. @item out_w
  15032. @item out_h
  15033. The output (scaled) width and height
  15034. @item ow
  15035. @item oh
  15036. These are the same as @var{out_w} and @var{out_h}
  15037. @item a
  15038. The same as @var{iw} / @var{ih}
  15039. @item sar
  15040. input sample aspect ratio
  15041. @item dar
  15042. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  15043. @item hsub
  15044. @item vsub
  15045. horizontal and vertical input chroma subsample values. For example for the
  15046. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15047. @item ohsub
  15048. @item ovsub
  15049. horizontal and vertical output chroma subsample values. For example for the
  15050. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15051. @end table
  15052. @table @option
  15053. @end table
  15054. @c man end VIDEO FILTERS
  15055. @chapter OpenCL Video Filters
  15056. @c man begin OPENCL VIDEO FILTERS
  15057. Below is a description of the currently available OpenCL video filters.
  15058. To enable compilation of these filters you need to configure FFmpeg with
  15059. @code{--enable-opencl}.
  15060. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  15061. @table @option
  15062. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  15063. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  15064. given device parameters.
  15065. @item -filter_hw_device @var{name}
  15066. Pass the hardware device called @var{name} to all filters in any filter graph.
  15067. @end table
  15068. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  15069. @itemize
  15070. @item
  15071. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  15072. @example
  15073. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  15074. @end example
  15075. @end itemize
  15076. 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.
  15077. @section avgblur_opencl
  15078. Apply average blur filter.
  15079. The filter accepts the following options:
  15080. @table @option
  15081. @item sizeX
  15082. Set horizontal radius size.
  15083. Range is @code{[1, 1024]} and default value is @code{1}.
  15084. @item planes
  15085. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15086. @item sizeY
  15087. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  15088. @end table
  15089. @subsection Example
  15090. @itemize
  15091. @item
  15092. 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.
  15093. @example
  15094. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  15095. @end example
  15096. @end itemize
  15097. @section boxblur_opencl
  15098. Apply a boxblur algorithm to the input video.
  15099. It accepts the following parameters:
  15100. @table @option
  15101. @item luma_radius, lr
  15102. @item luma_power, lp
  15103. @item chroma_radius, cr
  15104. @item chroma_power, cp
  15105. @item alpha_radius, ar
  15106. @item alpha_power, ap
  15107. @end table
  15108. A description of the accepted options follows.
  15109. @table @option
  15110. @item luma_radius, lr
  15111. @item chroma_radius, cr
  15112. @item alpha_radius, ar
  15113. Set an expression for the box radius in pixels used for blurring the
  15114. corresponding input plane.
  15115. The radius value must be a non-negative number, and must not be
  15116. greater than the value of the expression @code{min(w,h)/2} for the
  15117. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  15118. planes.
  15119. Default value for @option{luma_radius} is "2". If not specified,
  15120. @option{chroma_radius} and @option{alpha_radius} default to the
  15121. corresponding value set for @option{luma_radius}.
  15122. The expressions can contain the following constants:
  15123. @table @option
  15124. @item w
  15125. @item h
  15126. The input width and height in pixels.
  15127. @item cw
  15128. @item ch
  15129. The input chroma image width and height in pixels.
  15130. @item hsub
  15131. @item vsub
  15132. The horizontal and vertical chroma subsample values. For example, for the
  15133. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  15134. @end table
  15135. @item luma_power, lp
  15136. @item chroma_power, cp
  15137. @item alpha_power, ap
  15138. Specify how many times the boxblur filter is applied to the
  15139. corresponding plane.
  15140. Default value for @option{luma_power} is 2. If not specified,
  15141. @option{chroma_power} and @option{alpha_power} default to the
  15142. corresponding value set for @option{luma_power}.
  15143. A value of 0 will disable the effect.
  15144. @end table
  15145. @subsection Examples
  15146. 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.
  15147. @itemize
  15148. @item
  15149. Apply a boxblur filter with the luma, chroma, and alpha radius
  15150. 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.
  15151. @example
  15152. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  15153. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  15154. @end example
  15155. @item
  15156. 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.
  15157. For the luma plane, a 2x2 box radius will be run once.
  15158. For the chroma plane, a 4x4 box radius will be run 5 times.
  15159. For the alpha plane, a 3x3 box radius will be run 7 times.
  15160. @example
  15161. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  15162. @end example
  15163. @end itemize
  15164. @section convolution_opencl
  15165. Apply convolution of 3x3, 5x5, 7x7 matrix.
  15166. The filter accepts the following options:
  15167. @table @option
  15168. @item 0m
  15169. @item 1m
  15170. @item 2m
  15171. @item 3m
  15172. Set matrix for each plane.
  15173. Matrix is sequence of 9, 25 or 49 signed numbers.
  15174. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  15175. @item 0rdiv
  15176. @item 1rdiv
  15177. @item 2rdiv
  15178. @item 3rdiv
  15179. Set multiplier for calculated value for each plane.
  15180. If unset or 0, it will be sum of all matrix elements.
  15181. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  15182. @item 0bias
  15183. @item 1bias
  15184. @item 2bias
  15185. @item 3bias
  15186. Set bias for each plane. This value is added to the result of the multiplication.
  15187. Useful for making the overall image brighter or darker.
  15188. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  15189. @end table
  15190. @subsection Examples
  15191. @itemize
  15192. @item
  15193. Apply sharpen:
  15194. @example
  15195. -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
  15196. @end example
  15197. @item
  15198. Apply blur:
  15199. @example
  15200. -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
  15201. @end example
  15202. @item
  15203. Apply edge enhance:
  15204. @example
  15205. -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
  15206. @end example
  15207. @item
  15208. Apply edge detect:
  15209. @example
  15210. -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
  15211. @end example
  15212. @item
  15213. Apply laplacian edge detector which includes diagonals:
  15214. @example
  15215. -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
  15216. @end example
  15217. @item
  15218. Apply emboss:
  15219. @example
  15220. -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
  15221. @end example
  15222. @end itemize
  15223. @section dilation_opencl
  15224. Apply dilation effect to the video.
  15225. This filter replaces the pixel by the local(3x3) maximum.
  15226. It accepts the following options:
  15227. @table @option
  15228. @item threshold0
  15229. @item threshold1
  15230. @item threshold2
  15231. @item threshold3
  15232. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  15233. If @code{0}, plane will remain unchanged.
  15234. @item coordinates
  15235. Flag which specifies the pixel to refer to.
  15236. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  15237. Flags to local 3x3 coordinates region centered on @code{x}:
  15238. 1 2 3
  15239. 4 x 5
  15240. 6 7 8
  15241. @end table
  15242. @subsection Example
  15243. @itemize
  15244. @item
  15245. 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.
  15246. @example
  15247. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  15248. @end example
  15249. @end itemize
  15250. @section erosion_opencl
  15251. Apply erosion effect to the video.
  15252. This filter replaces the pixel by the local(3x3) minimum.
  15253. It accepts the following options:
  15254. @table @option
  15255. @item threshold0
  15256. @item threshold1
  15257. @item threshold2
  15258. @item threshold3
  15259. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  15260. If @code{0}, plane will remain unchanged.
  15261. @item coordinates
  15262. Flag which specifies the pixel to refer to.
  15263. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  15264. Flags to local 3x3 coordinates region centered on @code{x}:
  15265. 1 2 3
  15266. 4 x 5
  15267. 6 7 8
  15268. @end table
  15269. @subsection Example
  15270. @itemize
  15271. @item
  15272. 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.
  15273. @example
  15274. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  15275. @end example
  15276. @end itemize
  15277. @section colorkey_opencl
  15278. RGB colorspace color keying.
  15279. The filter accepts the following options:
  15280. @table @option
  15281. @item color
  15282. The color which will be replaced with transparency.
  15283. @item similarity
  15284. Similarity percentage with the key color.
  15285. 0.01 matches only the exact key color, while 1.0 matches everything.
  15286. @item blend
  15287. Blend percentage.
  15288. 0.0 makes pixels either fully transparent, or not transparent at all.
  15289. Higher values result in semi-transparent pixels, with a higher transparency
  15290. the more similar the pixels color is to the key color.
  15291. @end table
  15292. @subsection Examples
  15293. @itemize
  15294. @item
  15295. Make every semi-green pixel in the input transparent with some slight blending:
  15296. @example
  15297. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  15298. @end example
  15299. @end itemize
  15300. @section deshake_opencl
  15301. Feature-point based video stabilization filter.
  15302. The filter accepts the following options:
  15303. @table @option
  15304. @item tripod
  15305. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  15306. @item debug
  15307. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  15308. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  15309. Viewing point matches in the output video is only supported for RGB input.
  15310. Defaults to @code{0}.
  15311. @item adaptive_crop
  15312. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  15313. Defaults to @code{1}.
  15314. @item refine_features
  15315. Whether or not feature points should be refined at a sub-pixel level.
  15316. This can be turned off for a slight performance gain at the cost of precision.
  15317. Defaults to @code{1}.
  15318. @item smooth_strength
  15319. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  15320. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  15321. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  15322. Defaults to @code{0.0}.
  15323. @item smooth_window_multiplier
  15324. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  15325. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  15326. Acceptable values range from @code{0.1} to @code{10.0}.
  15327. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  15328. potentially improving smoothness, but also increase latency and memory usage.
  15329. Defaults to @code{2.0}.
  15330. @end table
  15331. @subsection Examples
  15332. @itemize
  15333. @item
  15334. Stabilize a video with a fixed, medium smoothing strength:
  15335. @example
  15336. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  15337. @end example
  15338. @item
  15339. Stabilize a video with debugging (both in console and in rendered video):
  15340. @example
  15341. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  15342. @end example
  15343. @end itemize
  15344. @section nlmeans_opencl
  15345. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  15346. @section overlay_opencl
  15347. Overlay one video on top of another.
  15348. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  15349. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  15350. The filter accepts the following options:
  15351. @table @option
  15352. @item x
  15353. Set the x coordinate of the overlaid video on the main video.
  15354. Default value is @code{0}.
  15355. @item y
  15356. Set the x coordinate of the overlaid video on the main video.
  15357. Default value is @code{0}.
  15358. @end table
  15359. @subsection Examples
  15360. @itemize
  15361. @item
  15362. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  15363. @example
  15364. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  15365. @end example
  15366. @item
  15367. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  15368. @example
  15369. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  15370. @end example
  15371. @end itemize
  15372. @section prewitt_opencl
  15373. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  15374. The filter accepts the following option:
  15375. @table @option
  15376. @item planes
  15377. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15378. @item scale
  15379. Set value which will be multiplied with filtered result.
  15380. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15381. @item delta
  15382. Set value which will be added to filtered result.
  15383. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15384. @end table
  15385. @subsection Example
  15386. @itemize
  15387. @item
  15388. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  15389. @example
  15390. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15391. @end example
  15392. @end itemize
  15393. @section roberts_opencl
  15394. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  15395. The filter accepts the following option:
  15396. @table @option
  15397. @item planes
  15398. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15399. @item scale
  15400. Set value which will be multiplied with filtered result.
  15401. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15402. @item delta
  15403. Set value which will be added to filtered result.
  15404. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15405. @end table
  15406. @subsection Example
  15407. @itemize
  15408. @item
  15409. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  15410. @example
  15411. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15412. @end example
  15413. @end itemize
  15414. @section sobel_opencl
  15415. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  15416. The filter accepts the following option:
  15417. @table @option
  15418. @item planes
  15419. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15420. @item scale
  15421. Set value which will be multiplied with filtered result.
  15422. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15423. @item delta
  15424. Set value which will be added to filtered result.
  15425. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15426. @end table
  15427. @subsection Example
  15428. @itemize
  15429. @item
  15430. Apply sobel operator with scale set to 2 and delta set to 10
  15431. @example
  15432. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15433. @end example
  15434. @end itemize
  15435. @section tonemap_opencl
  15436. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  15437. It accepts the following parameters:
  15438. @table @option
  15439. @item tonemap
  15440. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  15441. @item param
  15442. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  15443. @item desat
  15444. Apply desaturation for highlights that exceed this level of brightness. The
  15445. higher the parameter, the more color information will be preserved. This
  15446. setting helps prevent unnaturally blown-out colors for super-highlights, by
  15447. (smoothly) turning into white instead. This makes images feel more natural,
  15448. at the cost of reducing information about out-of-range colors.
  15449. The default value is 0.5, and the algorithm here is a little different from
  15450. the cpu version tonemap currently. A setting of 0.0 disables this option.
  15451. @item threshold
  15452. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  15453. is used to detect whether the scene has changed or not. If the distance between
  15454. the current frame average brightness and the current running average exceeds
  15455. a threshold value, we would re-calculate scene average and peak brightness.
  15456. The default value is 0.2.
  15457. @item format
  15458. Specify the output pixel format.
  15459. Currently supported formats are:
  15460. @table @var
  15461. @item p010
  15462. @item nv12
  15463. @end table
  15464. @item range, r
  15465. Set the output color range.
  15466. Possible values are:
  15467. @table @var
  15468. @item tv/mpeg
  15469. @item pc/jpeg
  15470. @end table
  15471. Default is same as input.
  15472. @item primaries, p
  15473. Set the output color primaries.
  15474. Possible values are:
  15475. @table @var
  15476. @item bt709
  15477. @item bt2020
  15478. @end table
  15479. Default is same as input.
  15480. @item transfer, t
  15481. Set the output transfer characteristics.
  15482. Possible values are:
  15483. @table @var
  15484. @item bt709
  15485. @item bt2020
  15486. @end table
  15487. Default is bt709.
  15488. @item matrix, m
  15489. Set the output colorspace matrix.
  15490. Possible value are:
  15491. @table @var
  15492. @item bt709
  15493. @item bt2020
  15494. @end table
  15495. Default is same as input.
  15496. @end table
  15497. @subsection Example
  15498. @itemize
  15499. @item
  15500. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  15501. @example
  15502. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  15503. @end example
  15504. @end itemize
  15505. @section unsharp_opencl
  15506. Sharpen or blur the input video.
  15507. It accepts the following parameters:
  15508. @table @option
  15509. @item luma_msize_x, lx
  15510. Set the luma matrix horizontal size.
  15511. Range is @code{[1, 23]} and default value is @code{5}.
  15512. @item luma_msize_y, ly
  15513. Set the luma matrix vertical size.
  15514. Range is @code{[1, 23]} and default value is @code{5}.
  15515. @item luma_amount, la
  15516. Set the luma effect strength.
  15517. Range is @code{[-10, 10]} and default value is @code{1.0}.
  15518. Negative values will blur the input video, while positive values will
  15519. sharpen it, a value of zero will disable the effect.
  15520. @item chroma_msize_x, cx
  15521. Set the chroma matrix horizontal size.
  15522. Range is @code{[1, 23]} and default value is @code{5}.
  15523. @item chroma_msize_y, cy
  15524. Set the chroma matrix vertical size.
  15525. Range is @code{[1, 23]} and default value is @code{5}.
  15526. @item chroma_amount, ca
  15527. Set the chroma effect strength.
  15528. Range is @code{[-10, 10]} and default value is @code{0.0}.
  15529. Negative values will blur the input video, while positive values will
  15530. sharpen it, a value of zero will disable the effect.
  15531. @end table
  15532. All parameters are optional and default to the equivalent of the
  15533. string '5:5:1.0:5:5:0.0'.
  15534. @subsection Examples
  15535. @itemize
  15536. @item
  15537. Apply strong luma sharpen effect:
  15538. @example
  15539. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  15540. @end example
  15541. @item
  15542. Apply a strong blur of both luma and chroma parameters:
  15543. @example
  15544. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  15545. @end example
  15546. @end itemize
  15547. @c man end OPENCL VIDEO FILTERS
  15548. @chapter Video Sources
  15549. @c man begin VIDEO SOURCES
  15550. Below is a description of the currently available video sources.
  15551. @section buffer
  15552. Buffer video frames, and make them available to the filter chain.
  15553. This source is mainly intended for a programmatic use, in particular
  15554. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  15555. It accepts the following parameters:
  15556. @table @option
  15557. @item video_size
  15558. Specify the size (width and height) of the buffered video frames. For the
  15559. syntax of this option, check the
  15560. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15561. @item width
  15562. The input video width.
  15563. @item height
  15564. The input video height.
  15565. @item pix_fmt
  15566. A string representing the pixel format of the buffered video frames.
  15567. It may be a number corresponding to a pixel format, or a pixel format
  15568. name.
  15569. @item time_base
  15570. Specify the timebase assumed by the timestamps of the buffered frames.
  15571. @item frame_rate
  15572. Specify the frame rate expected for the video stream.
  15573. @item pixel_aspect, sar
  15574. The sample (pixel) aspect ratio of the input video.
  15575. @item sws_param
  15576. Specify the optional parameters to be used for the scale filter which
  15577. is automatically inserted when an input change is detected in the
  15578. input size or format.
  15579. @item hw_frames_ctx
  15580. When using a hardware pixel format, this should be a reference to an
  15581. AVHWFramesContext describing input frames.
  15582. @end table
  15583. For example:
  15584. @example
  15585. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  15586. @end example
  15587. will instruct the source to accept video frames with size 320x240 and
  15588. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  15589. square pixels (1:1 sample aspect ratio).
  15590. Since the pixel format with name "yuv410p" corresponds to the number 6
  15591. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  15592. this example corresponds to:
  15593. @example
  15594. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  15595. @end example
  15596. Alternatively, the options can be specified as a flat string, but this
  15597. syntax is deprecated:
  15598. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}[:@var{sws_param}]
  15599. @section cellauto
  15600. Create a pattern generated by an elementary cellular automaton.
  15601. The initial state of the cellular automaton can be defined through the
  15602. @option{filename} and @option{pattern} options. If such options are
  15603. not specified an initial state is created randomly.
  15604. At each new frame a new row in the video is filled with the result of
  15605. the cellular automaton next generation. The behavior when the whole
  15606. frame is filled is defined by the @option{scroll} option.
  15607. This source accepts the following options:
  15608. @table @option
  15609. @item filename, f
  15610. Read the initial cellular automaton state, i.e. the starting row, from
  15611. the specified file.
  15612. In the file, each non-whitespace character is considered an alive
  15613. cell, a newline will terminate the row, and further characters in the
  15614. file will be ignored.
  15615. @item pattern, p
  15616. Read the initial cellular automaton state, i.e. the starting row, from
  15617. the specified string.
  15618. Each non-whitespace character in the string is considered an alive
  15619. cell, a newline will terminate the row, and further characters in the
  15620. string will be ignored.
  15621. @item rate, r
  15622. Set the video rate, that is the number of frames generated per second.
  15623. Default is 25.
  15624. @item random_fill_ratio, ratio
  15625. Set the random fill ratio for the initial cellular automaton row. It
  15626. is a floating point number value ranging from 0 to 1, defaults to
  15627. 1/PHI.
  15628. This option is ignored when a file or a pattern is specified.
  15629. @item random_seed, seed
  15630. Set the seed for filling randomly the initial row, must be an integer
  15631. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15632. set to -1, the filter will try to use a good random seed on a best
  15633. effort basis.
  15634. @item rule
  15635. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  15636. Default value is 110.
  15637. @item size, s
  15638. Set the size of the output video. For the syntax of this option, check the
  15639. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15640. If @option{filename} or @option{pattern} is specified, the size is set
  15641. by default to the width of the specified initial state row, and the
  15642. height is set to @var{width} * PHI.
  15643. If @option{size} is set, it must contain the width of the specified
  15644. pattern string, and the specified pattern will be centered in the
  15645. larger row.
  15646. If a filename or a pattern string is not specified, the size value
  15647. defaults to "320x518" (used for a randomly generated initial state).
  15648. @item scroll
  15649. If set to 1, scroll the output upward when all the rows in the output
  15650. have been already filled. If set to 0, the new generated row will be
  15651. written over the top row just after the bottom row is filled.
  15652. Defaults to 1.
  15653. @item start_full, full
  15654. If set to 1, completely fill the output with generated rows before
  15655. outputting the first frame.
  15656. This is the default behavior, for disabling set the value to 0.
  15657. @item stitch
  15658. If set to 1, stitch the left and right row edges together.
  15659. This is the default behavior, for disabling set the value to 0.
  15660. @end table
  15661. @subsection Examples
  15662. @itemize
  15663. @item
  15664. Read the initial state from @file{pattern}, and specify an output of
  15665. size 200x400.
  15666. @example
  15667. cellauto=f=pattern:s=200x400
  15668. @end example
  15669. @item
  15670. Generate a random initial row with a width of 200 cells, with a fill
  15671. ratio of 2/3:
  15672. @example
  15673. cellauto=ratio=2/3:s=200x200
  15674. @end example
  15675. @item
  15676. Create a pattern generated by rule 18 starting by a single alive cell
  15677. centered on an initial row with width 100:
  15678. @example
  15679. cellauto=p=@@:s=100x400:full=0:rule=18
  15680. @end example
  15681. @item
  15682. Specify a more elaborated initial pattern:
  15683. @example
  15684. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  15685. @end example
  15686. @end itemize
  15687. @anchor{coreimagesrc}
  15688. @section coreimagesrc
  15689. Video source generated on GPU using Apple's CoreImage API on OSX.
  15690. This video source is a specialized version of the @ref{coreimage} video filter.
  15691. Use a core image generator at the beginning of the applied filterchain to
  15692. generate the content.
  15693. The coreimagesrc video source accepts the following options:
  15694. @table @option
  15695. @item list_generators
  15696. List all available generators along with all their respective options as well as
  15697. possible minimum and maximum values along with the default values.
  15698. @example
  15699. list_generators=true
  15700. @end example
  15701. @item size, s
  15702. Specify the size of the sourced video. For the syntax of this option, check the
  15703. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15704. The default value is @code{320x240}.
  15705. @item rate, r
  15706. Specify the frame rate of the sourced video, as the number of frames
  15707. generated per second. It has to be a string in the format
  15708. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15709. number or a valid video frame rate abbreviation. The default value is
  15710. "25".
  15711. @item sar
  15712. Set the sample aspect ratio of the sourced video.
  15713. @item duration, d
  15714. Set the duration of the sourced video. See
  15715. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15716. for the accepted syntax.
  15717. If not specified, or the expressed duration is negative, the video is
  15718. supposed to be generated forever.
  15719. @end table
  15720. Additionally, all options of the @ref{coreimage} video filter are accepted.
  15721. A complete filterchain can be used for further processing of the
  15722. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  15723. and examples for details.
  15724. @subsection Examples
  15725. @itemize
  15726. @item
  15727. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  15728. given as complete and escaped command-line for Apple's standard bash shell:
  15729. @example
  15730. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  15731. @end example
  15732. This example is equivalent to the QRCode example of @ref{coreimage} without the
  15733. need for a nullsrc video source.
  15734. @end itemize
  15735. @section mandelbrot
  15736. Generate a Mandelbrot set fractal, and progressively zoom towards the
  15737. point specified with @var{start_x} and @var{start_y}.
  15738. This source accepts the following options:
  15739. @table @option
  15740. @item end_pts
  15741. Set the terminal pts value. Default value is 400.
  15742. @item end_scale
  15743. Set the terminal scale value.
  15744. Must be a floating point value. Default value is 0.3.
  15745. @item inner
  15746. Set the inner coloring mode, that is the algorithm used to draw the
  15747. Mandelbrot fractal internal region.
  15748. It shall assume one of the following values:
  15749. @table @option
  15750. @item black
  15751. Set black mode.
  15752. @item convergence
  15753. Show time until convergence.
  15754. @item mincol
  15755. Set color based on point closest to the origin of the iterations.
  15756. @item period
  15757. Set period mode.
  15758. @end table
  15759. Default value is @var{mincol}.
  15760. @item bailout
  15761. Set the bailout value. Default value is 10.0.
  15762. @item maxiter
  15763. Set the maximum of iterations performed by the rendering
  15764. algorithm. Default value is 7189.
  15765. @item outer
  15766. Set outer coloring mode.
  15767. It shall assume one of following values:
  15768. @table @option
  15769. @item iteration_count
  15770. Set iteration count mode.
  15771. @item normalized_iteration_count
  15772. set normalized iteration count mode.
  15773. @end table
  15774. Default value is @var{normalized_iteration_count}.
  15775. @item rate, r
  15776. Set frame rate, expressed as number of frames per second. Default
  15777. value is "25".
  15778. @item size, s
  15779. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  15780. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  15781. @item start_scale
  15782. Set the initial scale value. Default value is 3.0.
  15783. @item start_x
  15784. Set the initial x position. Must be a floating point value between
  15785. -100 and 100. Default value is -0.743643887037158704752191506114774.
  15786. @item start_y
  15787. Set the initial y position. Must be a floating point value between
  15788. -100 and 100. Default value is -0.131825904205311970493132056385139.
  15789. @end table
  15790. @section mptestsrc
  15791. Generate various test patterns, as generated by the MPlayer test filter.
  15792. The size of the generated video is fixed, and is 256x256.
  15793. This source is useful in particular for testing encoding features.
  15794. This source accepts the following options:
  15795. @table @option
  15796. @item rate, r
  15797. Specify the frame rate of the sourced video, as the number of frames
  15798. generated per second. It has to be a string in the format
  15799. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15800. number or a valid video frame rate abbreviation. The default value is
  15801. "25".
  15802. @item duration, d
  15803. Set the duration of the sourced video. See
  15804. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15805. for the accepted syntax.
  15806. If not specified, or the expressed duration is negative, the video is
  15807. supposed to be generated forever.
  15808. @item test, t
  15809. Set the number or the name of the test to perform. Supported tests are:
  15810. @table @option
  15811. @item dc_luma
  15812. @item dc_chroma
  15813. @item freq_luma
  15814. @item freq_chroma
  15815. @item amp_luma
  15816. @item amp_chroma
  15817. @item cbp
  15818. @item mv
  15819. @item ring1
  15820. @item ring2
  15821. @item all
  15822. @end table
  15823. Default value is "all", which will cycle through the list of all tests.
  15824. @end table
  15825. Some examples:
  15826. @example
  15827. mptestsrc=t=dc_luma
  15828. @end example
  15829. will generate a "dc_luma" test pattern.
  15830. @section frei0r_src
  15831. Provide a frei0r source.
  15832. To enable compilation of this filter you need to install the frei0r
  15833. header and configure FFmpeg with @code{--enable-frei0r}.
  15834. This source accepts the following parameters:
  15835. @table @option
  15836. @item size
  15837. The size of the video to generate. For the syntax of this option, check the
  15838. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15839. @item framerate
  15840. The framerate of the generated video. It may be a string of the form
  15841. @var{num}/@var{den} or a frame rate abbreviation.
  15842. @item filter_name
  15843. The name to the frei0r source to load. For more information regarding frei0r and
  15844. how to set the parameters, read the @ref{frei0r} section in the video filters
  15845. documentation.
  15846. @item filter_params
  15847. A '|'-separated list of parameters to pass to the frei0r source.
  15848. @end table
  15849. For example, to generate a frei0r partik0l source with size 200x200
  15850. and frame rate 10 which is overlaid on the overlay filter main input:
  15851. @example
  15852. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  15853. @end example
  15854. @section life
  15855. Generate a life pattern.
  15856. This source is based on a generalization of John Conway's life game.
  15857. The sourced input represents a life grid, each pixel represents a cell
  15858. which can be in one of two possible states, alive or dead. Every cell
  15859. interacts with its eight neighbours, which are the cells that are
  15860. horizontally, vertically, or diagonally adjacent.
  15861. At each interaction the grid evolves according to the adopted rule,
  15862. which specifies the number of neighbor alive cells which will make a
  15863. cell stay alive or born. The @option{rule} option allows one to specify
  15864. the rule to adopt.
  15865. This source accepts the following options:
  15866. @table @option
  15867. @item filename, f
  15868. Set the file from which to read the initial grid state. In the file,
  15869. each non-whitespace character is considered an alive cell, and newline
  15870. is used to delimit the end of each row.
  15871. If this option is not specified, the initial grid is generated
  15872. randomly.
  15873. @item rate, r
  15874. Set the video rate, that is the number of frames generated per second.
  15875. Default is 25.
  15876. @item random_fill_ratio, ratio
  15877. Set the random fill ratio for the initial random grid. It is a
  15878. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  15879. It is ignored when a file is specified.
  15880. @item random_seed, seed
  15881. Set the seed for filling the initial random grid, must be an integer
  15882. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15883. set to -1, the filter will try to use a good random seed on a best
  15884. effort basis.
  15885. @item rule
  15886. Set the life rule.
  15887. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  15888. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  15889. @var{NS} specifies the number of alive neighbor cells which make a
  15890. live cell stay alive, and @var{NB} the number of alive neighbor cells
  15891. which make a dead cell to become alive (i.e. to "born").
  15892. "s" and "b" can be used in place of "S" and "B", respectively.
  15893. Alternatively a rule can be specified by an 18-bits integer. The 9
  15894. high order bits are used to encode the next cell state if it is alive
  15895. for each number of neighbor alive cells, the low order bits specify
  15896. the rule for "borning" new cells. Higher order bits encode for an
  15897. higher number of neighbor cells.
  15898. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  15899. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  15900. Default value is "S23/B3", which is the original Conway's game of life
  15901. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  15902. cells, and will born a new cell if there are three alive cells around
  15903. a dead cell.
  15904. @item size, s
  15905. Set the size of the output video. For the syntax of this option, check the
  15906. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15907. If @option{filename} is specified, the size is set by default to the
  15908. same size of the input file. If @option{size} is set, it must contain
  15909. the size specified in the input file, and the initial grid defined in
  15910. that file is centered in the larger resulting area.
  15911. If a filename is not specified, the size value defaults to "320x240"
  15912. (used for a randomly generated initial grid).
  15913. @item stitch
  15914. If set to 1, stitch the left and right grid edges together, and the
  15915. top and bottom edges also. Defaults to 1.
  15916. @item mold
  15917. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  15918. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  15919. value from 0 to 255.
  15920. @item life_color
  15921. Set the color of living (or new born) cells.
  15922. @item death_color
  15923. Set the color of dead cells. If @option{mold} is set, this is the first color
  15924. used to represent a dead cell.
  15925. @item mold_color
  15926. Set mold color, for definitely dead and moldy cells.
  15927. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  15928. ffmpeg-utils manual,ffmpeg-utils}.
  15929. @end table
  15930. @subsection Examples
  15931. @itemize
  15932. @item
  15933. Read a grid from @file{pattern}, and center it on a grid of size
  15934. 300x300 pixels:
  15935. @example
  15936. life=f=pattern:s=300x300
  15937. @end example
  15938. @item
  15939. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  15940. @example
  15941. life=ratio=2/3:s=200x200
  15942. @end example
  15943. @item
  15944. Specify a custom rule for evolving a randomly generated grid:
  15945. @example
  15946. life=rule=S14/B34
  15947. @end example
  15948. @item
  15949. Full example with slow death effect (mold) using @command{ffplay}:
  15950. @example
  15951. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  15952. @end example
  15953. @end itemize
  15954. @anchor{allrgb}
  15955. @anchor{allyuv}
  15956. @anchor{color}
  15957. @anchor{haldclutsrc}
  15958. @anchor{nullsrc}
  15959. @anchor{pal75bars}
  15960. @anchor{pal100bars}
  15961. @anchor{rgbtestsrc}
  15962. @anchor{smptebars}
  15963. @anchor{smptehdbars}
  15964. @anchor{testsrc}
  15965. @anchor{testsrc2}
  15966. @anchor{yuvtestsrc}
  15967. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  15968. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  15969. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  15970. The @code{color} source provides an uniformly colored input.
  15971. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  15972. @ref{haldclut} filter.
  15973. The @code{nullsrc} source returns unprocessed video frames. It is
  15974. mainly useful to be employed in analysis / debugging tools, or as the
  15975. source for filters which ignore the input data.
  15976. The @code{pal75bars} source generates a color bars pattern, based on
  15977. EBU PAL recommendations with 75% color levels.
  15978. The @code{pal100bars} source generates a color bars pattern, based on
  15979. EBU PAL recommendations with 100% color levels.
  15980. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  15981. detecting RGB vs BGR issues. You should see a red, green and blue
  15982. stripe from top to bottom.
  15983. The @code{smptebars} source generates a color bars pattern, based on
  15984. the SMPTE Engineering Guideline EG 1-1990.
  15985. The @code{smptehdbars} source generates a color bars pattern, based on
  15986. the SMPTE RP 219-2002.
  15987. The @code{testsrc} source generates a test video pattern, showing a
  15988. color pattern, a scrolling gradient and a timestamp. This is mainly
  15989. intended for testing purposes.
  15990. The @code{testsrc2} source is similar to testsrc, but supports more
  15991. pixel formats instead of just @code{rgb24}. This allows using it as an
  15992. input for other tests without requiring a format conversion.
  15993. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  15994. see a y, cb and cr stripe from top to bottom.
  15995. The sources accept the following parameters:
  15996. @table @option
  15997. @item level
  15998. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  15999. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  16000. pixels to be used as identity matrix for 3D lookup tables. Each component is
  16001. coded on a @code{1/(N*N)} scale.
  16002. @item color, c
  16003. Specify the color of the source, only available in the @code{color}
  16004. source. For the syntax of this option, check the
  16005. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16006. @item size, s
  16007. Specify the size of the sourced video. For the syntax of this option, check the
  16008. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16009. The default value is @code{320x240}.
  16010. This option is not available with the @code{allrgb}, @code{allyuv}, and
  16011. @code{haldclutsrc} filters.
  16012. @item rate, r
  16013. Specify the frame rate of the sourced video, as the number of frames
  16014. generated per second. It has to be a string in the format
  16015. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  16016. number or a valid video frame rate abbreviation. The default value is
  16017. "25".
  16018. @item duration, d
  16019. Set the duration of the sourced video. See
  16020. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16021. for the accepted syntax.
  16022. If not specified, or the expressed duration is negative, the video is
  16023. supposed to be generated forever.
  16024. @item sar
  16025. Set the sample aspect ratio of the sourced video.
  16026. @item alpha
  16027. Specify the alpha (opacity) of the background, only available in the
  16028. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  16029. 255 (fully opaque, the default).
  16030. @item decimals, n
  16031. Set the number of decimals to show in the timestamp, only available in the
  16032. @code{testsrc} source.
  16033. The displayed timestamp value will correspond to the original
  16034. timestamp value multiplied by the power of 10 of the specified
  16035. value. Default value is 0.
  16036. @end table
  16037. @subsection Examples
  16038. @itemize
  16039. @item
  16040. Generate a video with a duration of 5.3 seconds, with size
  16041. 176x144 and a frame rate of 10 frames per second:
  16042. @example
  16043. testsrc=duration=5.3:size=qcif:rate=10
  16044. @end example
  16045. @item
  16046. The following graph description will generate a red source
  16047. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  16048. frames per second:
  16049. @example
  16050. color=c=red@@0.2:s=qcif:r=10
  16051. @end example
  16052. @item
  16053. If the input content is to be ignored, @code{nullsrc} can be used. The
  16054. following command generates noise in the luminance plane by employing
  16055. the @code{geq} filter:
  16056. @example
  16057. nullsrc=s=256x256, geq=random(1)*255:128:128
  16058. @end example
  16059. @end itemize
  16060. @subsection Commands
  16061. The @code{color} source supports the following commands:
  16062. @table @option
  16063. @item c, color
  16064. Set the color of the created image. Accepts the same syntax of the
  16065. corresponding @option{color} option.
  16066. @end table
  16067. @section openclsrc
  16068. Generate video using an OpenCL program.
  16069. @table @option
  16070. @item source
  16071. OpenCL program source file.
  16072. @item kernel
  16073. Kernel name in program.
  16074. @item size, s
  16075. Size of frames to generate. This must be set.
  16076. @item format
  16077. Pixel format to use for the generated frames. This must be set.
  16078. @item rate, r
  16079. Number of frames generated every second. Default value is '25'.
  16080. @end table
  16081. For details of how the program loading works, see the @ref{program_opencl}
  16082. filter.
  16083. Example programs:
  16084. @itemize
  16085. @item
  16086. Generate a colour ramp by setting pixel values from the position of the pixel
  16087. in the output image. (Note that this will work with all pixel formats, but
  16088. the generated output will not be the same.)
  16089. @verbatim
  16090. __kernel void ramp(__write_only image2d_t dst,
  16091. unsigned int index)
  16092. {
  16093. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  16094. float4 val;
  16095. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  16096. write_imagef(dst, loc, val);
  16097. }
  16098. @end verbatim
  16099. @item
  16100. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  16101. @verbatim
  16102. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  16103. unsigned int index)
  16104. {
  16105. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  16106. float4 value = 0.0f;
  16107. int x = loc.x + index;
  16108. int y = loc.y + index;
  16109. while (x > 0 || y > 0) {
  16110. if (x % 3 == 1 && y % 3 == 1) {
  16111. value = 1.0f;
  16112. break;
  16113. }
  16114. x /= 3;
  16115. y /= 3;
  16116. }
  16117. write_imagef(dst, loc, value);
  16118. }
  16119. @end verbatim
  16120. @end itemize
  16121. @section sierpinski
  16122. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  16123. This source accepts the following options:
  16124. @table @option
  16125. @item size, s
  16126. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  16127. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  16128. @item rate, r
  16129. Set frame rate, expressed as number of frames per second. Default
  16130. value is "25".
  16131. @item seed
  16132. Set seed which is used for random panning.
  16133. @item jump
  16134. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  16135. @item type
  16136. Set fractal type, can be default @code{carpet} or @code{triangle}.
  16137. @end table
  16138. @c man end VIDEO SOURCES
  16139. @chapter Video Sinks
  16140. @c man begin VIDEO SINKS
  16141. Below is a description of the currently available video sinks.
  16142. @section buffersink
  16143. Buffer video frames, and make them available to the end of the filter
  16144. graph.
  16145. This sink is mainly intended for programmatic use, in particular
  16146. through the interface defined in @file{libavfilter/buffersink.h}
  16147. or the options system.
  16148. It accepts a pointer to an AVBufferSinkContext structure, which
  16149. defines the incoming buffers' formats, to be passed as the opaque
  16150. parameter to @code{avfilter_init_filter} for initialization.
  16151. @section nullsink
  16152. Null video sink: do absolutely nothing with the input video. It is
  16153. mainly useful as a template and for use in analysis / debugging
  16154. tools.
  16155. @c man end VIDEO SINKS
  16156. @chapter Multimedia Filters
  16157. @c man begin MULTIMEDIA FILTERS
  16158. Below is a description of the currently available multimedia filters.
  16159. @section abitscope
  16160. Convert input audio to a video output, displaying the audio bit scope.
  16161. The filter accepts the following options:
  16162. @table @option
  16163. @item rate, r
  16164. Set frame rate, expressed as number of frames per second. Default
  16165. value is "25".
  16166. @item size, s
  16167. Specify the video size for the output. For the syntax of this option, check the
  16168. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16169. Default value is @code{1024x256}.
  16170. @item colors
  16171. Specify list of colors separated by space or by '|' which will be used to
  16172. draw channels. Unrecognized or missing colors will be replaced
  16173. by white color.
  16174. @end table
  16175. @section ahistogram
  16176. Convert input audio to a video output, displaying the volume histogram.
  16177. The filter accepts the following options:
  16178. @table @option
  16179. @item dmode
  16180. Specify how histogram is calculated.
  16181. It accepts the following values:
  16182. @table @samp
  16183. @item single
  16184. Use single histogram for all channels.
  16185. @item separate
  16186. Use separate histogram for each channel.
  16187. @end table
  16188. Default is @code{single}.
  16189. @item rate, r
  16190. Set frame rate, expressed as number of frames per second. Default
  16191. value is "25".
  16192. @item size, s
  16193. Specify the video size for the output. For the syntax of this option, check the
  16194. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16195. Default value is @code{hd720}.
  16196. @item scale
  16197. Set display scale.
  16198. It accepts the following values:
  16199. @table @samp
  16200. @item log
  16201. logarithmic
  16202. @item sqrt
  16203. square root
  16204. @item cbrt
  16205. cubic root
  16206. @item lin
  16207. linear
  16208. @item rlog
  16209. reverse logarithmic
  16210. @end table
  16211. Default is @code{log}.
  16212. @item ascale
  16213. Set amplitude scale.
  16214. It accepts the following values:
  16215. @table @samp
  16216. @item log
  16217. logarithmic
  16218. @item lin
  16219. linear
  16220. @end table
  16221. Default is @code{log}.
  16222. @item acount
  16223. Set how much frames to accumulate in histogram.
  16224. Default is 1. Setting this to -1 accumulates all frames.
  16225. @item rheight
  16226. Set histogram ratio of window height.
  16227. @item slide
  16228. Set sonogram sliding.
  16229. It accepts the following values:
  16230. @table @samp
  16231. @item replace
  16232. replace old rows with new ones.
  16233. @item scroll
  16234. scroll from top to bottom.
  16235. @end table
  16236. Default is @code{replace}.
  16237. @end table
  16238. @section aphasemeter
  16239. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  16240. representing mean phase of current audio frame. A video output can also be produced and is
  16241. enabled by default. The audio is passed through as first output.
  16242. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  16243. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  16244. and @code{1} means channels are in phase.
  16245. The filter accepts the following options, all related to its video output:
  16246. @table @option
  16247. @item rate, r
  16248. Set the output frame rate. Default value is @code{25}.
  16249. @item size, s
  16250. Set the video size for the output. For the syntax of this option, check the
  16251. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16252. Default value is @code{800x400}.
  16253. @item rc
  16254. @item gc
  16255. @item bc
  16256. Specify the red, green, blue contrast. Default values are @code{2},
  16257. @code{7} and @code{1}.
  16258. Allowed range is @code{[0, 255]}.
  16259. @item mpc
  16260. Set color which will be used for drawing median phase. If color is
  16261. @code{none} which is default, no median phase value will be drawn.
  16262. @item video
  16263. Enable video output. Default is enabled.
  16264. @end table
  16265. @section avectorscope
  16266. Convert input audio to a video output, representing the audio vector
  16267. scope.
  16268. The filter is used to measure the difference between channels of stereo
  16269. audio stream. A monaural signal, consisting of identical left and right
  16270. signal, results in straight vertical line. Any stereo separation is visible
  16271. as a deviation from this line, creating a Lissajous figure.
  16272. If the straight (or deviation from it) but horizontal line appears this
  16273. indicates that the left and right channels are out of phase.
  16274. The filter accepts the following options:
  16275. @table @option
  16276. @item mode, m
  16277. Set the vectorscope mode.
  16278. Available values are:
  16279. @table @samp
  16280. @item lissajous
  16281. Lissajous rotated by 45 degrees.
  16282. @item lissajous_xy
  16283. Same as above but not rotated.
  16284. @item polar
  16285. Shape resembling half of circle.
  16286. @end table
  16287. Default value is @samp{lissajous}.
  16288. @item size, s
  16289. Set the video size for the output. For the syntax of this option, check the
  16290. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16291. Default value is @code{400x400}.
  16292. @item rate, r
  16293. Set the output frame rate. Default value is @code{25}.
  16294. @item rc
  16295. @item gc
  16296. @item bc
  16297. @item ac
  16298. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  16299. @code{160}, @code{80} and @code{255}.
  16300. Allowed range is @code{[0, 255]}.
  16301. @item rf
  16302. @item gf
  16303. @item bf
  16304. @item af
  16305. Specify the red, green, blue and alpha fade. Default values are @code{15},
  16306. @code{10}, @code{5} and @code{5}.
  16307. Allowed range is @code{[0, 255]}.
  16308. @item zoom
  16309. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  16310. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  16311. @item draw
  16312. Set the vectorscope drawing mode.
  16313. Available values are:
  16314. @table @samp
  16315. @item dot
  16316. Draw dot for each sample.
  16317. @item line
  16318. Draw line between previous and current sample.
  16319. @end table
  16320. Default value is @samp{dot}.
  16321. @item scale
  16322. Specify amplitude scale of audio samples.
  16323. Available values are:
  16324. @table @samp
  16325. @item lin
  16326. Linear.
  16327. @item sqrt
  16328. Square root.
  16329. @item cbrt
  16330. Cubic root.
  16331. @item log
  16332. Logarithmic.
  16333. @end table
  16334. @item swap
  16335. Swap left channel axis with right channel axis.
  16336. @item mirror
  16337. Mirror axis.
  16338. @table @samp
  16339. @item none
  16340. No mirror.
  16341. @item x
  16342. Mirror only x axis.
  16343. @item y
  16344. Mirror only y axis.
  16345. @item xy
  16346. Mirror both axis.
  16347. @end table
  16348. @end table
  16349. @subsection Examples
  16350. @itemize
  16351. @item
  16352. Complete example using @command{ffplay}:
  16353. @example
  16354. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  16355. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  16356. @end example
  16357. @end itemize
  16358. @section bench, abench
  16359. Benchmark part of a filtergraph.
  16360. The filter accepts the following options:
  16361. @table @option
  16362. @item action
  16363. Start or stop a timer.
  16364. Available values are:
  16365. @table @samp
  16366. @item start
  16367. Get the current time, set it as frame metadata (using the key
  16368. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  16369. @item stop
  16370. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  16371. the input frame metadata to get the time difference. Time difference, average,
  16372. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  16373. @code{min}) are then printed. The timestamps are expressed in seconds.
  16374. @end table
  16375. @end table
  16376. @subsection Examples
  16377. @itemize
  16378. @item
  16379. Benchmark @ref{selectivecolor} filter:
  16380. @example
  16381. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  16382. @end example
  16383. @end itemize
  16384. @section concat
  16385. Concatenate audio and video streams, joining them together one after the
  16386. other.
  16387. The filter works on segments of synchronized video and audio streams. All
  16388. segments must have the same number of streams of each type, and that will
  16389. also be the number of streams at output.
  16390. The filter accepts the following options:
  16391. @table @option
  16392. @item n
  16393. Set the number of segments. Default is 2.
  16394. @item v
  16395. Set the number of output video streams, that is also the number of video
  16396. streams in each segment. Default is 1.
  16397. @item a
  16398. Set the number of output audio streams, that is also the number of audio
  16399. streams in each segment. Default is 0.
  16400. @item unsafe
  16401. Activate unsafe mode: do not fail if segments have a different format.
  16402. @end table
  16403. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  16404. @var{a} audio outputs.
  16405. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  16406. segment, in the same order as the outputs, then the inputs for the second
  16407. segment, etc.
  16408. Related streams do not always have exactly the same duration, for various
  16409. reasons including codec frame size or sloppy authoring. For that reason,
  16410. related synchronized streams (e.g. a video and its audio track) should be
  16411. concatenated at once. The concat filter will use the duration of the longest
  16412. stream in each segment (except the last one), and if necessary pad shorter
  16413. audio streams with silence.
  16414. For this filter to work correctly, all segments must start at timestamp 0.
  16415. All corresponding streams must have the same parameters in all segments; the
  16416. filtering system will automatically select a common pixel format for video
  16417. streams, and a common sample format, sample rate and channel layout for
  16418. audio streams, but other settings, such as resolution, must be converted
  16419. explicitly by the user.
  16420. Different frame rates are acceptable but will result in variable frame rate
  16421. at output; be sure to configure the output file to handle it.
  16422. @subsection Examples
  16423. @itemize
  16424. @item
  16425. Concatenate an opening, an episode and an ending, all in bilingual version
  16426. (video in stream 0, audio in streams 1 and 2):
  16427. @example
  16428. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  16429. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  16430. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  16431. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  16432. @end example
  16433. @item
  16434. Concatenate two parts, handling audio and video separately, using the
  16435. (a)movie sources, and adjusting the resolution:
  16436. @example
  16437. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  16438. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  16439. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  16440. @end example
  16441. Note that a desync will happen at the stitch if the audio and video streams
  16442. do not have exactly the same duration in the first file.
  16443. @end itemize
  16444. @subsection Commands
  16445. This filter supports the following commands:
  16446. @table @option
  16447. @item next
  16448. Close the current segment and step to the next one
  16449. @end table
  16450. @section drawgraph, adrawgraph
  16451. Draw a graph using input video or audio metadata.
  16452. It accepts the following parameters:
  16453. @table @option
  16454. @item m1
  16455. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  16456. @item fg1
  16457. Set 1st foreground color expression.
  16458. @item m2
  16459. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  16460. @item fg2
  16461. Set 2nd foreground color expression.
  16462. @item m3
  16463. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  16464. @item fg3
  16465. Set 3rd foreground color expression.
  16466. @item m4
  16467. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  16468. @item fg4
  16469. Set 4th foreground color expression.
  16470. @item min
  16471. Set minimal value of metadata value.
  16472. @item max
  16473. Set maximal value of metadata value.
  16474. @item bg
  16475. Set graph background color. Default is white.
  16476. @item mode
  16477. Set graph mode.
  16478. Available values for mode is:
  16479. @table @samp
  16480. @item bar
  16481. @item dot
  16482. @item line
  16483. @end table
  16484. Default is @code{line}.
  16485. @item slide
  16486. Set slide mode.
  16487. Available values for slide is:
  16488. @table @samp
  16489. @item frame
  16490. Draw new frame when right border is reached.
  16491. @item replace
  16492. Replace old columns with new ones.
  16493. @item scroll
  16494. Scroll from right to left.
  16495. @item rscroll
  16496. Scroll from left to right.
  16497. @item picture
  16498. Draw single picture.
  16499. @end table
  16500. Default is @code{frame}.
  16501. @item size
  16502. Set size of graph video. For the syntax of this option, check the
  16503. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16504. The default value is @code{900x256}.
  16505. The foreground color expressions can use the following variables:
  16506. @table @option
  16507. @item MIN
  16508. Minimal value of metadata value.
  16509. @item MAX
  16510. Maximal value of metadata value.
  16511. @item VAL
  16512. Current metadata key value.
  16513. @end table
  16514. The color is defined as 0xAABBGGRR.
  16515. @end table
  16516. Example using metadata from @ref{signalstats} filter:
  16517. @example
  16518. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  16519. @end example
  16520. Example using metadata from @ref{ebur128} filter:
  16521. @example
  16522. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  16523. @end example
  16524. @anchor{ebur128}
  16525. @section ebur128
  16526. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  16527. level. By default, it logs a message at a frequency of 10Hz with the
  16528. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  16529. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  16530. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  16531. sample format is double-precision floating point. The input stream will be converted to
  16532. this specification, if needed. Users may need to insert aformat and/or aresample filters
  16533. after this filter to obtain the original parameters.
  16534. The filter also has a video output (see the @var{video} option) with a real
  16535. time graph to observe the loudness evolution. The graphic contains the logged
  16536. message mentioned above, so it is not printed anymore when this option is set,
  16537. unless the verbose logging is set. The main graphing area contains the
  16538. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  16539. the momentary loudness (400 milliseconds), but can optionally be configured
  16540. to instead display short-term loudness (see @var{gauge}).
  16541. The green area marks a +/- 1LU target range around the target loudness
  16542. (-23LUFS by default, unless modified through @var{target}).
  16543. More information about the Loudness Recommendation EBU R128 on
  16544. @url{http://tech.ebu.ch/loudness}.
  16545. The filter accepts the following options:
  16546. @table @option
  16547. @item video
  16548. Activate the video output. The audio stream is passed unchanged whether this
  16549. option is set or no. The video stream will be the first output stream if
  16550. activated. Default is @code{0}.
  16551. @item size
  16552. Set the video size. This option is for video only. For the syntax of this
  16553. option, check the
  16554. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16555. Default and minimum resolution is @code{640x480}.
  16556. @item meter
  16557. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  16558. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  16559. other integer value between this range is allowed.
  16560. @item metadata
  16561. Set metadata injection. If set to @code{1}, the audio input will be segmented
  16562. into 100ms output frames, each of them containing various loudness information
  16563. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  16564. Default is @code{0}.
  16565. @item framelog
  16566. Force the frame logging level.
  16567. Available values are:
  16568. @table @samp
  16569. @item info
  16570. information logging level
  16571. @item verbose
  16572. verbose logging level
  16573. @end table
  16574. By default, the logging level is set to @var{info}. If the @option{video} or
  16575. the @option{metadata} options are set, it switches to @var{verbose}.
  16576. @item peak
  16577. Set peak mode(s).
  16578. Available modes can be cumulated (the option is a @code{flag} type). Possible
  16579. values are:
  16580. @table @samp
  16581. @item none
  16582. Disable any peak mode (default).
  16583. @item sample
  16584. Enable sample-peak mode.
  16585. Simple peak mode looking for the higher sample value. It logs a message
  16586. for sample-peak (identified by @code{SPK}).
  16587. @item true
  16588. Enable true-peak mode.
  16589. If enabled, the peak lookup is done on an over-sampled version of the input
  16590. stream for better peak accuracy. It logs a message for true-peak.
  16591. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  16592. This mode requires a build with @code{libswresample}.
  16593. @end table
  16594. @item dualmono
  16595. Treat mono input files as "dual mono". If a mono file is intended for playback
  16596. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  16597. If set to @code{true}, this option will compensate for this effect.
  16598. Multi-channel input files are not affected by this option.
  16599. @item panlaw
  16600. Set a specific pan law to be used for the measurement of dual mono files.
  16601. This parameter is optional, and has a default value of -3.01dB.
  16602. @item target
  16603. Set a specific target level (in LUFS) used as relative zero in the visualization.
  16604. This parameter is optional and has a default value of -23LUFS as specified
  16605. by EBU R128. However, material published online may prefer a level of -16LUFS
  16606. (e.g. for use with podcasts or video platforms).
  16607. @item gauge
  16608. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  16609. @code{shortterm}. By default the momentary value will be used, but in certain
  16610. scenarios it may be more useful to observe the short term value instead (e.g.
  16611. live mixing).
  16612. @item scale
  16613. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  16614. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  16615. video output, not the summary or continuous log output.
  16616. @end table
  16617. @subsection Examples
  16618. @itemize
  16619. @item
  16620. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  16621. @example
  16622. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  16623. @end example
  16624. @item
  16625. Run an analysis with @command{ffmpeg}:
  16626. @example
  16627. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  16628. @end example
  16629. @end itemize
  16630. @section interleave, ainterleave
  16631. Temporally interleave frames from several inputs.
  16632. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  16633. These filters read frames from several inputs and send the oldest
  16634. queued frame to the output.
  16635. Input streams must have well defined, monotonically increasing frame
  16636. timestamp values.
  16637. In order to submit one frame to output, these filters need to enqueue
  16638. at least one frame for each input, so they cannot work in case one
  16639. input is not yet terminated and will not receive incoming frames.
  16640. For example consider the case when one input is a @code{select} filter
  16641. which always drops input frames. The @code{interleave} filter will keep
  16642. reading from that input, but it will never be able to send new frames
  16643. to output until the input sends an end-of-stream signal.
  16644. Also, depending on inputs synchronization, the filters will drop
  16645. frames in case one input receives more frames than the other ones, and
  16646. the queue is already filled.
  16647. These filters accept the following options:
  16648. @table @option
  16649. @item nb_inputs, n
  16650. Set the number of different inputs, it is 2 by default.
  16651. @end table
  16652. @subsection Examples
  16653. @itemize
  16654. @item
  16655. Interleave frames belonging to different streams using @command{ffmpeg}:
  16656. @example
  16657. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  16658. @end example
  16659. @item
  16660. Add flickering blur effect:
  16661. @example
  16662. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  16663. @end example
  16664. @end itemize
  16665. @section metadata, ametadata
  16666. Manipulate frame metadata.
  16667. This filter accepts the following options:
  16668. @table @option
  16669. @item mode
  16670. Set mode of operation of the filter.
  16671. Can be one of the following:
  16672. @table @samp
  16673. @item select
  16674. If both @code{value} and @code{key} is set, select frames
  16675. which have such metadata. If only @code{key} is set, select
  16676. every frame that has such key in metadata.
  16677. @item add
  16678. Add new metadata @code{key} and @code{value}. If key is already available
  16679. do nothing.
  16680. @item modify
  16681. Modify value of already present key.
  16682. @item delete
  16683. If @code{value} is set, delete only keys that have such value.
  16684. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  16685. the frame.
  16686. @item print
  16687. Print key and its value if metadata was found. If @code{key} is not set print all
  16688. metadata values available in frame.
  16689. @end table
  16690. @item key
  16691. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  16692. @item value
  16693. Set metadata value which will be used. This option is mandatory for
  16694. @code{modify} and @code{add} mode.
  16695. @item function
  16696. Which function to use when comparing metadata value and @code{value}.
  16697. Can be one of following:
  16698. @table @samp
  16699. @item same_str
  16700. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  16701. @item starts_with
  16702. Values are interpreted as strings, returns true if metadata value starts with
  16703. the @code{value} option string.
  16704. @item less
  16705. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  16706. @item equal
  16707. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  16708. @item greater
  16709. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  16710. @item expr
  16711. Values are interpreted as floats, returns true if expression from option @code{expr}
  16712. evaluates to true.
  16713. @item ends_with
  16714. Values are interpreted as strings, returns true if metadata value ends with
  16715. the @code{value} option string.
  16716. @end table
  16717. @item expr
  16718. Set expression which is used when @code{function} is set to @code{expr}.
  16719. The expression is evaluated through the eval API and can contain the following
  16720. constants:
  16721. @table @option
  16722. @item VALUE1
  16723. Float representation of @code{value} from metadata key.
  16724. @item VALUE2
  16725. Float representation of @code{value} as supplied by user in @code{value} option.
  16726. @end table
  16727. @item file
  16728. If specified in @code{print} mode, output is written to the named file. Instead of
  16729. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  16730. for standard output. If @code{file} option is not set, output is written to the log
  16731. with AV_LOG_INFO loglevel.
  16732. @end table
  16733. @subsection Examples
  16734. @itemize
  16735. @item
  16736. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  16737. between 0 and 1.
  16738. @example
  16739. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  16740. @end example
  16741. @item
  16742. Print silencedetect output to file @file{metadata.txt}.
  16743. @example
  16744. silencedetect,ametadata=mode=print:file=metadata.txt
  16745. @end example
  16746. @item
  16747. Direct all metadata to a pipe with file descriptor 4.
  16748. @example
  16749. metadata=mode=print:file='pipe\:4'
  16750. @end example
  16751. @end itemize
  16752. @section perms, aperms
  16753. Set read/write permissions for the output frames.
  16754. These filters are mainly aimed at developers to test direct path in the
  16755. following filter in the filtergraph.
  16756. The filters accept the following options:
  16757. @table @option
  16758. @item mode
  16759. Select the permissions mode.
  16760. It accepts the following values:
  16761. @table @samp
  16762. @item none
  16763. Do nothing. This is the default.
  16764. @item ro
  16765. Set all the output frames read-only.
  16766. @item rw
  16767. Set all the output frames directly writable.
  16768. @item toggle
  16769. Make the frame read-only if writable, and writable if read-only.
  16770. @item random
  16771. Set each output frame read-only or writable randomly.
  16772. @end table
  16773. @item seed
  16774. Set the seed for the @var{random} mode, must be an integer included between
  16775. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  16776. @code{-1}, the filter will try to use a good random seed on a best effort
  16777. basis.
  16778. @end table
  16779. Note: in case of auto-inserted filter between the permission filter and the
  16780. following one, the permission might not be received as expected in that
  16781. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  16782. perms/aperms filter can avoid this problem.
  16783. @section realtime, arealtime
  16784. Slow down filtering to match real time approximately.
  16785. These filters will pause the filtering for a variable amount of time to
  16786. match the output rate with the input timestamps.
  16787. They are similar to the @option{re} option to @code{ffmpeg}.
  16788. They accept the following options:
  16789. @table @option
  16790. @item limit
  16791. Time limit for the pauses. Any pause longer than that will be considered
  16792. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  16793. @item speed
  16794. Speed factor for processing. The value must be a float larger than zero.
  16795. Values larger than 1.0 will result in faster than realtime processing,
  16796. smaller will slow processing down. The @var{limit} is automatically adapted
  16797. accordingly. Default is 1.0.
  16798. A processing speed faster than what is possible without these filters cannot
  16799. be achieved.
  16800. @end table
  16801. @anchor{select}
  16802. @section select, aselect
  16803. Select frames to pass in output.
  16804. This filter accepts the following options:
  16805. @table @option
  16806. @item expr, e
  16807. Set expression, which is evaluated for each input frame.
  16808. If the expression is evaluated to zero, the frame is discarded.
  16809. If the evaluation result is negative or NaN, the frame is sent to the
  16810. first output; otherwise it is sent to the output with index
  16811. @code{ceil(val)-1}, assuming that the input index starts from 0.
  16812. For example a value of @code{1.2} corresponds to the output with index
  16813. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  16814. @item outputs, n
  16815. Set the number of outputs. The output to which to send the selected
  16816. frame is based on the result of the evaluation. Default value is 1.
  16817. @end table
  16818. The expression can contain the following constants:
  16819. @table @option
  16820. @item n
  16821. The (sequential) number of the filtered frame, starting from 0.
  16822. @item selected_n
  16823. The (sequential) number of the selected frame, starting from 0.
  16824. @item prev_selected_n
  16825. The sequential number of the last selected frame. It's NAN if undefined.
  16826. @item TB
  16827. The timebase of the input timestamps.
  16828. @item pts
  16829. The PTS (Presentation TimeStamp) of the filtered video frame,
  16830. expressed in @var{TB} units. It's NAN if undefined.
  16831. @item t
  16832. The PTS of the filtered video frame,
  16833. expressed in seconds. It's NAN if undefined.
  16834. @item prev_pts
  16835. The PTS of the previously filtered video frame. It's NAN if undefined.
  16836. @item prev_selected_pts
  16837. The PTS of the last previously filtered video frame. It's NAN if undefined.
  16838. @item prev_selected_t
  16839. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  16840. @item start_pts
  16841. The PTS of the first video frame in the video. It's NAN if undefined.
  16842. @item start_t
  16843. The time of the first video frame in the video. It's NAN if undefined.
  16844. @item pict_type @emph{(video only)}
  16845. The type of the filtered frame. It can assume one of the following
  16846. values:
  16847. @table @option
  16848. @item I
  16849. @item P
  16850. @item B
  16851. @item S
  16852. @item SI
  16853. @item SP
  16854. @item BI
  16855. @end table
  16856. @item interlace_type @emph{(video only)}
  16857. The frame interlace type. It can assume one of the following values:
  16858. @table @option
  16859. @item PROGRESSIVE
  16860. The frame is progressive (not interlaced).
  16861. @item TOPFIRST
  16862. The frame is top-field-first.
  16863. @item BOTTOMFIRST
  16864. The frame is bottom-field-first.
  16865. @end table
  16866. @item consumed_sample_n @emph{(audio only)}
  16867. the number of selected samples before the current frame
  16868. @item samples_n @emph{(audio only)}
  16869. the number of samples in the current frame
  16870. @item sample_rate @emph{(audio only)}
  16871. the input sample rate
  16872. @item key
  16873. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  16874. @item pos
  16875. the position in the file of the filtered frame, -1 if the information
  16876. is not available (e.g. for synthetic video)
  16877. @item scene @emph{(video only)}
  16878. value between 0 and 1 to indicate a new scene; a low value reflects a low
  16879. probability for the current frame to introduce a new scene, while a higher
  16880. value means the current frame is more likely to be one (see the example below)
  16881. @item concatdec_select
  16882. The concat demuxer can select only part of a concat input file by setting an
  16883. inpoint and an outpoint, but the output packets may not be entirely contained
  16884. in the selected interval. By using this variable, it is possible to skip frames
  16885. generated by the concat demuxer which are not exactly contained in the selected
  16886. interval.
  16887. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  16888. and the @var{lavf.concat.duration} packet metadata values which are also
  16889. present in the decoded frames.
  16890. The @var{concatdec_select} variable is -1 if the frame pts is at least
  16891. start_time and either the duration metadata is missing or the frame pts is less
  16892. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  16893. missing.
  16894. That basically means that an input frame is selected if its pts is within the
  16895. interval set by the concat demuxer.
  16896. @end table
  16897. The default value of the select expression is "1".
  16898. @subsection Examples
  16899. @itemize
  16900. @item
  16901. Select all frames in input:
  16902. @example
  16903. select
  16904. @end example
  16905. The example above is the same as:
  16906. @example
  16907. select=1
  16908. @end example
  16909. @item
  16910. Skip all frames:
  16911. @example
  16912. select=0
  16913. @end example
  16914. @item
  16915. Select only I-frames:
  16916. @example
  16917. select='eq(pict_type\,I)'
  16918. @end example
  16919. @item
  16920. Select one frame every 100:
  16921. @example
  16922. select='not(mod(n\,100))'
  16923. @end example
  16924. @item
  16925. Select only frames contained in the 10-20 time interval:
  16926. @example
  16927. select=between(t\,10\,20)
  16928. @end example
  16929. @item
  16930. Select only I-frames contained in the 10-20 time interval:
  16931. @example
  16932. select=between(t\,10\,20)*eq(pict_type\,I)
  16933. @end example
  16934. @item
  16935. Select frames with a minimum distance of 10 seconds:
  16936. @example
  16937. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  16938. @end example
  16939. @item
  16940. Use aselect to select only audio frames with samples number > 100:
  16941. @example
  16942. aselect='gt(samples_n\,100)'
  16943. @end example
  16944. @item
  16945. Create a mosaic of the first scenes:
  16946. @example
  16947. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  16948. @end example
  16949. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  16950. choice.
  16951. @item
  16952. Send even and odd frames to separate outputs, and compose them:
  16953. @example
  16954. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  16955. @end example
  16956. @item
  16957. Select useful frames from an ffconcat file which is using inpoints and
  16958. outpoints but where the source files are not intra frame only.
  16959. @example
  16960. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  16961. @end example
  16962. @end itemize
  16963. @section sendcmd, asendcmd
  16964. Send commands to filters in the filtergraph.
  16965. These filters read commands to be sent to other filters in the
  16966. filtergraph.
  16967. @code{sendcmd} must be inserted between two video filters,
  16968. @code{asendcmd} must be inserted between two audio filters, but apart
  16969. from that they act the same way.
  16970. The specification of commands can be provided in the filter arguments
  16971. with the @var{commands} option, or in a file specified by the
  16972. @var{filename} option.
  16973. These filters accept the following options:
  16974. @table @option
  16975. @item commands, c
  16976. Set the commands to be read and sent to the other filters.
  16977. @item filename, f
  16978. Set the filename of the commands to be read and sent to the other
  16979. filters.
  16980. @end table
  16981. @subsection Commands syntax
  16982. A commands description consists of a sequence of interval
  16983. specifications, comprising a list of commands to be executed when a
  16984. particular event related to that interval occurs. The occurring event
  16985. is typically the current frame time entering or leaving a given time
  16986. interval.
  16987. An interval is specified by the following syntax:
  16988. @example
  16989. @var{START}[-@var{END}] @var{COMMANDS};
  16990. @end example
  16991. The time interval is specified by the @var{START} and @var{END} times.
  16992. @var{END} is optional and defaults to the maximum time.
  16993. The current frame time is considered within the specified interval if
  16994. it is included in the interval [@var{START}, @var{END}), that is when
  16995. the time is greater or equal to @var{START} and is lesser than
  16996. @var{END}.
  16997. @var{COMMANDS} consists of a sequence of one or more command
  16998. specifications, separated by ",", relating to that interval. The
  16999. syntax of a command specification is given by:
  17000. @example
  17001. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  17002. @end example
  17003. @var{FLAGS} is optional and specifies the type of events relating to
  17004. the time interval which enable sending the specified command, and must
  17005. be a non-null sequence of identifier flags separated by "+" or "|" and
  17006. enclosed between "[" and "]".
  17007. The following flags are recognized:
  17008. @table @option
  17009. @item enter
  17010. The command is sent when the current frame timestamp enters the
  17011. specified interval. In other words, the command is sent when the
  17012. previous frame timestamp was not in the given interval, and the
  17013. current is.
  17014. @item leave
  17015. The command is sent when the current frame timestamp leaves the
  17016. specified interval. In other words, the command is sent when the
  17017. previous frame timestamp was in the given interval, and the
  17018. current is not.
  17019. @end table
  17020. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  17021. assumed.
  17022. @var{TARGET} specifies the target of the command, usually the name of
  17023. the filter class or a specific filter instance name.
  17024. @var{COMMAND} specifies the name of the command for the target filter.
  17025. @var{ARG} is optional and specifies the optional list of argument for
  17026. the given @var{COMMAND}.
  17027. Between one interval specification and another, whitespaces, or
  17028. sequences of characters starting with @code{#} until the end of line,
  17029. are ignored and can be used to annotate comments.
  17030. A simplified BNF description of the commands specification syntax
  17031. follows:
  17032. @example
  17033. @var{COMMAND_FLAG} ::= "enter" | "leave"
  17034. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  17035. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  17036. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  17037. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  17038. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  17039. @end example
  17040. @subsection Examples
  17041. @itemize
  17042. @item
  17043. Specify audio tempo change at second 4:
  17044. @example
  17045. asendcmd=c='4.0 atempo tempo 1.5',atempo
  17046. @end example
  17047. @item
  17048. Target a specific filter instance:
  17049. @example
  17050. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  17051. @end example
  17052. @item
  17053. Specify a list of drawtext and hue commands in a file.
  17054. @example
  17055. # show text in the interval 5-10
  17056. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  17057. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  17058. # desaturate the image in the interval 15-20
  17059. 15.0-20.0 [enter] hue s 0,
  17060. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  17061. [leave] hue s 1,
  17062. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  17063. # apply an exponential saturation fade-out effect, starting from time 25
  17064. 25 [enter] hue s exp(25-t)
  17065. @end example
  17066. A filtergraph allowing to read and process the above command list
  17067. stored in a file @file{test.cmd}, can be specified with:
  17068. @example
  17069. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  17070. @end example
  17071. @end itemize
  17072. @anchor{setpts}
  17073. @section setpts, asetpts
  17074. Change the PTS (presentation timestamp) of the input frames.
  17075. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  17076. This filter accepts the following options:
  17077. @table @option
  17078. @item expr
  17079. The expression which is evaluated for each frame to construct its timestamp.
  17080. @end table
  17081. The expression is evaluated through the eval API and can contain the following
  17082. constants:
  17083. @table @option
  17084. @item FRAME_RATE, FR
  17085. frame rate, only defined for constant frame-rate video
  17086. @item PTS
  17087. The presentation timestamp in input
  17088. @item N
  17089. The count of the input frame for video or the number of consumed samples,
  17090. not including the current frame for audio, starting from 0.
  17091. @item NB_CONSUMED_SAMPLES
  17092. The number of consumed samples, not including the current frame (only
  17093. audio)
  17094. @item NB_SAMPLES, S
  17095. The number of samples in the current frame (only audio)
  17096. @item SAMPLE_RATE, SR
  17097. The audio sample rate.
  17098. @item STARTPTS
  17099. The PTS of the first frame.
  17100. @item STARTT
  17101. the time in seconds of the first frame
  17102. @item INTERLACED
  17103. State whether the current frame is interlaced.
  17104. @item T
  17105. the time in seconds of the current frame
  17106. @item POS
  17107. original position in the file of the frame, or undefined if undefined
  17108. for the current frame
  17109. @item PREV_INPTS
  17110. The previous input PTS.
  17111. @item PREV_INT
  17112. previous input time in seconds
  17113. @item PREV_OUTPTS
  17114. The previous output PTS.
  17115. @item PREV_OUTT
  17116. previous output time in seconds
  17117. @item RTCTIME
  17118. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  17119. instead.
  17120. @item RTCSTART
  17121. The wallclock (RTC) time at the start of the movie in microseconds.
  17122. @item TB
  17123. The timebase of the input timestamps.
  17124. @end table
  17125. @subsection Examples
  17126. @itemize
  17127. @item
  17128. Start counting PTS from zero
  17129. @example
  17130. setpts=PTS-STARTPTS
  17131. @end example
  17132. @item
  17133. Apply fast motion effect:
  17134. @example
  17135. setpts=0.5*PTS
  17136. @end example
  17137. @item
  17138. Apply slow motion effect:
  17139. @example
  17140. setpts=2.0*PTS
  17141. @end example
  17142. @item
  17143. Set fixed rate of 25 frames per second:
  17144. @example
  17145. setpts=N/(25*TB)
  17146. @end example
  17147. @item
  17148. Set fixed rate 25 fps with some jitter:
  17149. @example
  17150. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  17151. @end example
  17152. @item
  17153. Apply an offset of 10 seconds to the input PTS:
  17154. @example
  17155. setpts=PTS+10/TB
  17156. @end example
  17157. @item
  17158. Generate timestamps from a "live source" and rebase onto the current timebase:
  17159. @example
  17160. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  17161. @end example
  17162. @item
  17163. Generate timestamps by counting samples:
  17164. @example
  17165. asetpts=N/SR/TB
  17166. @end example
  17167. @end itemize
  17168. @section setrange
  17169. Force color range for the output video frame.
  17170. The @code{setrange} filter marks the color range property for the
  17171. output frames. It does not change the input frame, but only sets the
  17172. corresponding property, which affects how the frame is treated by
  17173. following filters.
  17174. The filter accepts the following options:
  17175. @table @option
  17176. @item range
  17177. Available values are:
  17178. @table @samp
  17179. @item auto
  17180. Keep the same color range property.
  17181. @item unspecified, unknown
  17182. Set the color range as unspecified.
  17183. @item limited, tv, mpeg
  17184. Set the color range as limited.
  17185. @item full, pc, jpeg
  17186. Set the color range as full.
  17187. @end table
  17188. @end table
  17189. @section settb, asettb
  17190. Set the timebase to use for the output frames timestamps.
  17191. It is mainly useful for testing timebase configuration.
  17192. It accepts the following parameters:
  17193. @table @option
  17194. @item expr, tb
  17195. The expression which is evaluated into the output timebase.
  17196. @end table
  17197. The value for @option{tb} is an arithmetic expression representing a
  17198. rational. The expression can contain the constants "AVTB" (the default
  17199. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  17200. audio only). Default value is "intb".
  17201. @subsection Examples
  17202. @itemize
  17203. @item
  17204. Set the timebase to 1/25:
  17205. @example
  17206. settb=expr=1/25
  17207. @end example
  17208. @item
  17209. Set the timebase to 1/10:
  17210. @example
  17211. settb=expr=0.1
  17212. @end example
  17213. @item
  17214. Set the timebase to 1001/1000:
  17215. @example
  17216. settb=1+0.001
  17217. @end example
  17218. @item
  17219. Set the timebase to 2*intb:
  17220. @example
  17221. settb=2*intb
  17222. @end example
  17223. @item
  17224. Set the default timebase value:
  17225. @example
  17226. settb=AVTB
  17227. @end example
  17228. @end itemize
  17229. @section showcqt
  17230. Convert input audio to a video output representing frequency spectrum
  17231. logarithmically using Brown-Puckette constant Q transform algorithm with
  17232. direct frequency domain coefficient calculation (but the transform itself
  17233. is not really constant Q, instead the Q factor is actually variable/clamped),
  17234. with musical tone scale, from E0 to D#10.
  17235. The filter accepts the following options:
  17236. @table @option
  17237. @item size, s
  17238. Specify the video size for the output. It must be even. For the syntax of this option,
  17239. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17240. Default value is @code{1920x1080}.
  17241. @item fps, rate, r
  17242. Set the output frame rate. Default value is @code{25}.
  17243. @item bar_h
  17244. Set the bargraph height. It must be even. Default value is @code{-1} which
  17245. computes the bargraph height automatically.
  17246. @item axis_h
  17247. Set the axis height. It must be even. Default value is @code{-1} which computes
  17248. the axis height automatically.
  17249. @item sono_h
  17250. Set the sonogram height. It must be even. Default value is @code{-1} which
  17251. computes the sonogram height automatically.
  17252. @item fullhd
  17253. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  17254. instead. Default value is @code{1}.
  17255. @item sono_v, volume
  17256. Specify the sonogram volume expression. It can contain variables:
  17257. @table @option
  17258. @item bar_v
  17259. the @var{bar_v} evaluated expression
  17260. @item frequency, freq, f
  17261. the frequency where it is evaluated
  17262. @item timeclamp, tc
  17263. the value of @var{timeclamp} option
  17264. @end table
  17265. and functions:
  17266. @table @option
  17267. @item a_weighting(f)
  17268. A-weighting of equal loudness
  17269. @item b_weighting(f)
  17270. B-weighting of equal loudness
  17271. @item c_weighting(f)
  17272. C-weighting of equal loudness.
  17273. @end table
  17274. Default value is @code{16}.
  17275. @item bar_v, volume2
  17276. Specify the bargraph volume expression. It can contain variables:
  17277. @table @option
  17278. @item sono_v
  17279. the @var{sono_v} evaluated expression
  17280. @item frequency, freq, f
  17281. the frequency where it is evaluated
  17282. @item timeclamp, tc
  17283. the value of @var{timeclamp} option
  17284. @end table
  17285. and functions:
  17286. @table @option
  17287. @item a_weighting(f)
  17288. A-weighting of equal loudness
  17289. @item b_weighting(f)
  17290. B-weighting of equal loudness
  17291. @item c_weighting(f)
  17292. C-weighting of equal loudness.
  17293. @end table
  17294. Default value is @code{sono_v}.
  17295. @item sono_g, gamma
  17296. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  17297. higher gamma makes the spectrum having more range. Default value is @code{3}.
  17298. Acceptable range is @code{[1, 7]}.
  17299. @item bar_g, gamma2
  17300. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  17301. @code{[1, 7]}.
  17302. @item bar_t
  17303. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  17304. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  17305. @item timeclamp, tc
  17306. Specify the transform timeclamp. At low frequency, there is trade-off between
  17307. accuracy in time domain and frequency domain. If timeclamp is lower,
  17308. event in time domain is represented more accurately (such as fast bass drum),
  17309. otherwise event in frequency domain is represented more accurately
  17310. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  17311. @item attack
  17312. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  17313. limits future samples by applying asymmetric windowing in time domain, useful
  17314. when low latency is required. Accepted range is @code{[0, 1]}.
  17315. @item basefreq
  17316. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  17317. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  17318. @item endfreq
  17319. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  17320. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  17321. @item coeffclamp
  17322. This option is deprecated and ignored.
  17323. @item tlength
  17324. Specify the transform length in time domain. Use this option to control accuracy
  17325. trade-off between time domain and frequency domain at every frequency sample.
  17326. It can contain variables:
  17327. @table @option
  17328. @item frequency, freq, f
  17329. the frequency where it is evaluated
  17330. @item timeclamp, tc
  17331. the value of @var{timeclamp} option.
  17332. @end table
  17333. Default value is @code{384*tc/(384+tc*f)}.
  17334. @item count
  17335. Specify the transform count for every video frame. Default value is @code{6}.
  17336. Acceptable range is @code{[1, 30]}.
  17337. @item fcount
  17338. Specify the transform count for every single pixel. Default value is @code{0},
  17339. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  17340. @item fontfile
  17341. Specify font file for use with freetype to draw the axis. If not specified,
  17342. use embedded font. Note that drawing with font file or embedded font is not
  17343. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  17344. option instead.
  17345. @item font
  17346. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  17347. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  17348. escaping.
  17349. @item fontcolor
  17350. Specify font color expression. This is arithmetic expression that should return
  17351. integer value 0xRRGGBB. It can contain variables:
  17352. @table @option
  17353. @item frequency, freq, f
  17354. the frequency where it is evaluated
  17355. @item timeclamp, tc
  17356. the value of @var{timeclamp} option
  17357. @end table
  17358. and functions:
  17359. @table @option
  17360. @item midi(f)
  17361. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  17362. @item r(x), g(x), b(x)
  17363. red, green, and blue value of intensity x.
  17364. @end table
  17365. Default value is @code{st(0, (midi(f)-59.5)/12);
  17366. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  17367. r(1-ld(1)) + b(ld(1))}.
  17368. @item axisfile
  17369. Specify image file to draw the axis. This option override @var{fontfile} and
  17370. @var{fontcolor} option.
  17371. @item axis, text
  17372. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  17373. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  17374. Default value is @code{1}.
  17375. @item csp
  17376. Set colorspace. The accepted values are:
  17377. @table @samp
  17378. @item unspecified
  17379. Unspecified (default)
  17380. @item bt709
  17381. BT.709
  17382. @item fcc
  17383. FCC
  17384. @item bt470bg
  17385. BT.470BG or BT.601-6 625
  17386. @item smpte170m
  17387. SMPTE-170M or BT.601-6 525
  17388. @item smpte240m
  17389. SMPTE-240M
  17390. @item bt2020ncl
  17391. BT.2020 with non-constant luminance
  17392. @end table
  17393. @item cscheme
  17394. Set spectrogram color scheme. This is list of floating point values with format
  17395. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  17396. The default is @code{1|0.5|0|0|0.5|1}.
  17397. @end table
  17398. @subsection Examples
  17399. @itemize
  17400. @item
  17401. Playing audio while showing the spectrum:
  17402. @example
  17403. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  17404. @end example
  17405. @item
  17406. Same as above, but with frame rate 30 fps:
  17407. @example
  17408. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  17409. @end example
  17410. @item
  17411. Playing at 1280x720:
  17412. @example
  17413. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  17414. @end example
  17415. @item
  17416. Disable sonogram display:
  17417. @example
  17418. sono_h=0
  17419. @end example
  17420. @item
  17421. A1 and its harmonics: A1, A2, (near)E3, A3:
  17422. @example
  17423. 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),
  17424. asplit[a][out1]; [a] showcqt [out0]'
  17425. @end example
  17426. @item
  17427. Same as above, but with more accuracy in frequency domain:
  17428. @example
  17429. 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),
  17430. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  17431. @end example
  17432. @item
  17433. Custom volume:
  17434. @example
  17435. bar_v=10:sono_v=bar_v*a_weighting(f)
  17436. @end example
  17437. @item
  17438. Custom gamma, now spectrum is linear to the amplitude.
  17439. @example
  17440. bar_g=2:sono_g=2
  17441. @end example
  17442. @item
  17443. Custom tlength equation:
  17444. @example
  17445. 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)))'
  17446. @end example
  17447. @item
  17448. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  17449. @example
  17450. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  17451. @end example
  17452. @item
  17453. Custom font using fontconfig:
  17454. @example
  17455. font='Courier New,Monospace,mono|bold'
  17456. @end example
  17457. @item
  17458. Custom frequency range with custom axis using image file:
  17459. @example
  17460. axisfile=myaxis.png:basefreq=40:endfreq=10000
  17461. @end example
  17462. @end itemize
  17463. @section showfreqs
  17464. Convert input audio to video output representing the audio power spectrum.
  17465. Audio amplitude is on Y-axis while frequency is on X-axis.
  17466. The filter accepts the following options:
  17467. @table @option
  17468. @item size, s
  17469. Specify size of video. For the syntax of this option, check the
  17470. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17471. Default is @code{1024x512}.
  17472. @item mode
  17473. Set display mode.
  17474. This set how each frequency bin will be represented.
  17475. It accepts the following values:
  17476. @table @samp
  17477. @item line
  17478. @item bar
  17479. @item dot
  17480. @end table
  17481. Default is @code{bar}.
  17482. @item ascale
  17483. Set amplitude scale.
  17484. It accepts the following values:
  17485. @table @samp
  17486. @item lin
  17487. Linear scale.
  17488. @item sqrt
  17489. Square root scale.
  17490. @item cbrt
  17491. Cubic root scale.
  17492. @item log
  17493. Logarithmic scale.
  17494. @end table
  17495. Default is @code{log}.
  17496. @item fscale
  17497. Set frequency scale.
  17498. It accepts the following values:
  17499. @table @samp
  17500. @item lin
  17501. Linear scale.
  17502. @item log
  17503. Logarithmic scale.
  17504. @item rlog
  17505. Reverse logarithmic scale.
  17506. @end table
  17507. Default is @code{lin}.
  17508. @item win_size
  17509. Set window size. Allowed range is from 16 to 65536.
  17510. Default is @code{2048}
  17511. @item win_func
  17512. Set windowing function.
  17513. It accepts the following values:
  17514. @table @samp
  17515. @item rect
  17516. @item bartlett
  17517. @item hanning
  17518. @item hamming
  17519. @item blackman
  17520. @item welch
  17521. @item flattop
  17522. @item bharris
  17523. @item bnuttall
  17524. @item bhann
  17525. @item sine
  17526. @item nuttall
  17527. @item lanczos
  17528. @item gauss
  17529. @item tukey
  17530. @item dolph
  17531. @item cauchy
  17532. @item parzen
  17533. @item poisson
  17534. @item bohman
  17535. @end table
  17536. Default is @code{hanning}.
  17537. @item overlap
  17538. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17539. which means optimal overlap for selected window function will be picked.
  17540. @item averaging
  17541. Set time averaging. Setting this to 0 will display current maximal peaks.
  17542. Default is @code{1}, which means time averaging is disabled.
  17543. @item colors
  17544. Specify list of colors separated by space or by '|' which will be used to
  17545. draw channel frequencies. Unrecognized or missing colors will be replaced
  17546. by white color.
  17547. @item cmode
  17548. Set channel display mode.
  17549. It accepts the following values:
  17550. @table @samp
  17551. @item combined
  17552. @item separate
  17553. @end table
  17554. Default is @code{combined}.
  17555. @item minamp
  17556. Set minimum amplitude used in @code{log} amplitude scaler.
  17557. @end table
  17558. @section showspatial
  17559. Convert stereo input audio to a video output, representing the spatial relationship
  17560. between two channels.
  17561. The filter accepts the following options:
  17562. @table @option
  17563. @item size, s
  17564. Specify the video size for the output. For the syntax of this option, check the
  17565. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17566. Default value is @code{512x512}.
  17567. @item win_size
  17568. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  17569. @item win_func
  17570. Set window function.
  17571. It accepts the following values:
  17572. @table @samp
  17573. @item rect
  17574. @item bartlett
  17575. @item hann
  17576. @item hanning
  17577. @item hamming
  17578. @item blackman
  17579. @item welch
  17580. @item flattop
  17581. @item bharris
  17582. @item bnuttall
  17583. @item bhann
  17584. @item sine
  17585. @item nuttall
  17586. @item lanczos
  17587. @item gauss
  17588. @item tukey
  17589. @item dolph
  17590. @item cauchy
  17591. @item parzen
  17592. @item poisson
  17593. @item bohman
  17594. @end table
  17595. Default value is @code{hann}.
  17596. @item overlap
  17597. Set ratio of overlap window. Default value is @code{0.5}.
  17598. When value is @code{1} overlap is set to recommended size for specific
  17599. window function currently used.
  17600. @end table
  17601. @anchor{showspectrum}
  17602. @section showspectrum
  17603. Convert input audio to a video output, representing the audio frequency
  17604. spectrum.
  17605. The filter accepts the following options:
  17606. @table @option
  17607. @item size, s
  17608. Specify the video size for the output. For the syntax of this option, check the
  17609. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17610. Default value is @code{640x512}.
  17611. @item slide
  17612. Specify how the spectrum should slide along the window.
  17613. It accepts the following values:
  17614. @table @samp
  17615. @item replace
  17616. the samples start again on the left when they reach the right
  17617. @item scroll
  17618. the samples scroll from right to left
  17619. @item fullframe
  17620. frames are only produced when the samples reach the right
  17621. @item rscroll
  17622. the samples scroll from left to right
  17623. @end table
  17624. Default value is @code{replace}.
  17625. @item mode
  17626. Specify display mode.
  17627. It accepts the following values:
  17628. @table @samp
  17629. @item combined
  17630. all channels are displayed in the same row
  17631. @item separate
  17632. all channels are displayed in separate rows
  17633. @end table
  17634. Default value is @samp{combined}.
  17635. @item color
  17636. Specify display color mode.
  17637. It accepts the following values:
  17638. @table @samp
  17639. @item channel
  17640. each channel is displayed in a separate color
  17641. @item intensity
  17642. each channel is displayed using the same color scheme
  17643. @item rainbow
  17644. each channel is displayed using the rainbow color scheme
  17645. @item moreland
  17646. each channel is displayed using the moreland color scheme
  17647. @item nebulae
  17648. each channel is displayed using the nebulae color scheme
  17649. @item fire
  17650. each channel is displayed using the fire color scheme
  17651. @item fiery
  17652. each channel is displayed using the fiery color scheme
  17653. @item fruit
  17654. each channel is displayed using the fruit color scheme
  17655. @item cool
  17656. each channel is displayed using the cool color scheme
  17657. @item magma
  17658. each channel is displayed using the magma color scheme
  17659. @item green
  17660. each channel is displayed using the green color scheme
  17661. @item viridis
  17662. each channel is displayed using the viridis color scheme
  17663. @item plasma
  17664. each channel is displayed using the plasma color scheme
  17665. @item cividis
  17666. each channel is displayed using the cividis color scheme
  17667. @item terrain
  17668. each channel is displayed using the terrain color scheme
  17669. @end table
  17670. Default value is @samp{channel}.
  17671. @item scale
  17672. Specify scale used for calculating intensity color values.
  17673. It accepts the following values:
  17674. @table @samp
  17675. @item lin
  17676. linear
  17677. @item sqrt
  17678. square root, default
  17679. @item cbrt
  17680. cubic root
  17681. @item log
  17682. logarithmic
  17683. @item 4thrt
  17684. 4th root
  17685. @item 5thrt
  17686. 5th root
  17687. @end table
  17688. Default value is @samp{sqrt}.
  17689. @item fscale
  17690. Specify frequency scale.
  17691. It accepts the following values:
  17692. @table @samp
  17693. @item lin
  17694. linear
  17695. @item log
  17696. logarithmic
  17697. @end table
  17698. Default value is @samp{lin}.
  17699. @item saturation
  17700. Set saturation modifier for displayed colors. Negative values provide
  17701. alternative color scheme. @code{0} is no saturation at all.
  17702. Saturation must be in [-10.0, 10.0] range.
  17703. Default value is @code{1}.
  17704. @item win_func
  17705. Set window function.
  17706. It accepts the following values:
  17707. @table @samp
  17708. @item rect
  17709. @item bartlett
  17710. @item hann
  17711. @item hanning
  17712. @item hamming
  17713. @item blackman
  17714. @item welch
  17715. @item flattop
  17716. @item bharris
  17717. @item bnuttall
  17718. @item bhann
  17719. @item sine
  17720. @item nuttall
  17721. @item lanczos
  17722. @item gauss
  17723. @item tukey
  17724. @item dolph
  17725. @item cauchy
  17726. @item parzen
  17727. @item poisson
  17728. @item bohman
  17729. @end table
  17730. Default value is @code{hann}.
  17731. @item orientation
  17732. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17733. @code{horizontal}. Default is @code{vertical}.
  17734. @item overlap
  17735. Set ratio of overlap window. Default value is @code{0}.
  17736. When value is @code{1} overlap is set to recommended size for specific
  17737. window function currently used.
  17738. @item gain
  17739. Set scale gain for calculating intensity color values.
  17740. Default value is @code{1}.
  17741. @item data
  17742. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  17743. @item rotation
  17744. Set color rotation, must be in [-1.0, 1.0] range.
  17745. Default value is @code{0}.
  17746. @item start
  17747. Set start frequency from which to display spectrogram. Default is @code{0}.
  17748. @item stop
  17749. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17750. @item fps
  17751. Set upper frame rate limit. Default is @code{auto}, unlimited.
  17752. @item legend
  17753. Draw time and frequency axes and legends. Default is disabled.
  17754. @end table
  17755. The usage is very similar to the showwaves filter; see the examples in that
  17756. section.
  17757. @subsection Examples
  17758. @itemize
  17759. @item
  17760. Large window with logarithmic color scaling:
  17761. @example
  17762. showspectrum=s=1280x480:scale=log
  17763. @end example
  17764. @item
  17765. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  17766. @example
  17767. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  17768. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  17769. @end example
  17770. @end itemize
  17771. @section showspectrumpic
  17772. Convert input audio to a single video frame, representing the audio frequency
  17773. spectrum.
  17774. The filter accepts the following options:
  17775. @table @option
  17776. @item size, s
  17777. Specify the video size for the output. For the syntax of this option, check the
  17778. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17779. Default value is @code{4096x2048}.
  17780. @item mode
  17781. Specify display mode.
  17782. It accepts the following values:
  17783. @table @samp
  17784. @item combined
  17785. all channels are displayed in the same row
  17786. @item separate
  17787. all channels are displayed in separate rows
  17788. @end table
  17789. Default value is @samp{combined}.
  17790. @item color
  17791. Specify display color mode.
  17792. It accepts the following values:
  17793. @table @samp
  17794. @item channel
  17795. each channel is displayed in a separate color
  17796. @item intensity
  17797. each channel is displayed using the same color scheme
  17798. @item rainbow
  17799. each channel is displayed using the rainbow color scheme
  17800. @item moreland
  17801. each channel is displayed using the moreland color scheme
  17802. @item nebulae
  17803. each channel is displayed using the nebulae color scheme
  17804. @item fire
  17805. each channel is displayed using the fire color scheme
  17806. @item fiery
  17807. each channel is displayed using the fiery color scheme
  17808. @item fruit
  17809. each channel is displayed using the fruit color scheme
  17810. @item cool
  17811. each channel is displayed using the cool color scheme
  17812. @item magma
  17813. each channel is displayed using the magma color scheme
  17814. @item green
  17815. each channel is displayed using the green color scheme
  17816. @item viridis
  17817. each channel is displayed using the viridis color scheme
  17818. @item plasma
  17819. each channel is displayed using the plasma color scheme
  17820. @item cividis
  17821. each channel is displayed using the cividis color scheme
  17822. @item terrain
  17823. each channel is displayed using the terrain color scheme
  17824. @end table
  17825. Default value is @samp{intensity}.
  17826. @item scale
  17827. Specify scale used for calculating intensity color values.
  17828. It accepts the following values:
  17829. @table @samp
  17830. @item lin
  17831. linear
  17832. @item sqrt
  17833. square root, default
  17834. @item cbrt
  17835. cubic root
  17836. @item log
  17837. logarithmic
  17838. @item 4thrt
  17839. 4th root
  17840. @item 5thrt
  17841. 5th root
  17842. @end table
  17843. Default value is @samp{log}.
  17844. @item fscale
  17845. Specify frequency scale.
  17846. It accepts the following values:
  17847. @table @samp
  17848. @item lin
  17849. linear
  17850. @item log
  17851. logarithmic
  17852. @end table
  17853. Default value is @samp{lin}.
  17854. @item saturation
  17855. Set saturation modifier for displayed colors. Negative values provide
  17856. alternative color scheme. @code{0} is no saturation at all.
  17857. Saturation must be in [-10.0, 10.0] range.
  17858. Default value is @code{1}.
  17859. @item win_func
  17860. Set window function.
  17861. It accepts the following values:
  17862. @table @samp
  17863. @item rect
  17864. @item bartlett
  17865. @item hann
  17866. @item hanning
  17867. @item hamming
  17868. @item blackman
  17869. @item welch
  17870. @item flattop
  17871. @item bharris
  17872. @item bnuttall
  17873. @item bhann
  17874. @item sine
  17875. @item nuttall
  17876. @item lanczos
  17877. @item gauss
  17878. @item tukey
  17879. @item dolph
  17880. @item cauchy
  17881. @item parzen
  17882. @item poisson
  17883. @item bohman
  17884. @end table
  17885. Default value is @code{hann}.
  17886. @item orientation
  17887. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17888. @code{horizontal}. Default is @code{vertical}.
  17889. @item gain
  17890. Set scale gain for calculating intensity color values.
  17891. Default value is @code{1}.
  17892. @item legend
  17893. Draw time and frequency axes and legends. Default is enabled.
  17894. @item rotation
  17895. Set color rotation, must be in [-1.0, 1.0] range.
  17896. Default value is @code{0}.
  17897. @item start
  17898. Set start frequency from which to display spectrogram. Default is @code{0}.
  17899. @item stop
  17900. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17901. @end table
  17902. @subsection Examples
  17903. @itemize
  17904. @item
  17905. Extract an audio spectrogram of a whole audio track
  17906. in a 1024x1024 picture using @command{ffmpeg}:
  17907. @example
  17908. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  17909. @end example
  17910. @end itemize
  17911. @section showvolume
  17912. Convert input audio volume to a video output.
  17913. The filter accepts the following options:
  17914. @table @option
  17915. @item rate, r
  17916. Set video rate.
  17917. @item b
  17918. Set border width, allowed range is [0, 5]. Default is 1.
  17919. @item w
  17920. Set channel width, allowed range is [80, 8192]. Default is 400.
  17921. @item h
  17922. Set channel height, allowed range is [1, 900]. Default is 20.
  17923. @item f
  17924. Set fade, allowed range is [0, 1]. Default is 0.95.
  17925. @item c
  17926. Set volume color expression.
  17927. The expression can use the following variables:
  17928. @table @option
  17929. @item VOLUME
  17930. Current max volume of channel in dB.
  17931. @item PEAK
  17932. Current peak.
  17933. @item CHANNEL
  17934. Current channel number, starting from 0.
  17935. @end table
  17936. @item t
  17937. If set, displays channel names. Default is enabled.
  17938. @item v
  17939. If set, displays volume values. Default is enabled.
  17940. @item o
  17941. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  17942. default is @code{h}.
  17943. @item s
  17944. Set step size, allowed range is [0, 5]. Default is 0, which means
  17945. step is disabled.
  17946. @item p
  17947. Set background opacity, allowed range is [0, 1]. Default is 0.
  17948. @item m
  17949. Set metering mode, can be peak: @code{p} or rms: @code{r},
  17950. default is @code{p}.
  17951. @item ds
  17952. Set display scale, can be linear: @code{lin} or log: @code{log},
  17953. default is @code{lin}.
  17954. @item dm
  17955. In second.
  17956. If set to > 0., display a line for the max level
  17957. in the previous seconds.
  17958. default is disabled: @code{0.}
  17959. @item dmc
  17960. The color of the max line. Use when @code{dm} option is set to > 0.
  17961. default is: @code{orange}
  17962. @end table
  17963. @section showwaves
  17964. Convert input audio to a video output, representing the samples waves.
  17965. The filter accepts the following options:
  17966. @table @option
  17967. @item size, s
  17968. Specify the video size for the output. For the syntax of this option, check the
  17969. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17970. Default value is @code{600x240}.
  17971. @item mode
  17972. Set display mode.
  17973. Available values are:
  17974. @table @samp
  17975. @item point
  17976. Draw a point for each sample.
  17977. @item line
  17978. Draw a vertical line for each sample.
  17979. @item p2p
  17980. Draw a point for each sample and a line between them.
  17981. @item cline
  17982. Draw a centered vertical line for each sample.
  17983. @end table
  17984. Default value is @code{point}.
  17985. @item n
  17986. Set the number of samples which are printed on the same column. A
  17987. larger value will decrease the frame rate. Must be a positive
  17988. integer. This option can be set only if the value for @var{rate}
  17989. is not explicitly specified.
  17990. @item rate, r
  17991. Set the (approximate) output frame rate. This is done by setting the
  17992. option @var{n}. Default value is "25".
  17993. @item split_channels
  17994. Set if channels should be drawn separately or overlap. Default value is 0.
  17995. @item colors
  17996. Set colors separated by '|' which are going to be used for drawing of each channel.
  17997. @item scale
  17998. Set amplitude scale.
  17999. Available values are:
  18000. @table @samp
  18001. @item lin
  18002. Linear.
  18003. @item log
  18004. Logarithmic.
  18005. @item sqrt
  18006. Square root.
  18007. @item cbrt
  18008. Cubic root.
  18009. @end table
  18010. Default is linear.
  18011. @item draw
  18012. Set the draw mode. This is mostly useful to set for high @var{n}.
  18013. Available values are:
  18014. @table @samp
  18015. @item scale
  18016. Scale pixel values for each drawn sample.
  18017. @item full
  18018. Draw every sample directly.
  18019. @end table
  18020. Default value is @code{scale}.
  18021. @end table
  18022. @subsection Examples
  18023. @itemize
  18024. @item
  18025. Output the input file audio and the corresponding video representation
  18026. at the same time:
  18027. @example
  18028. amovie=a.mp3,asplit[out0],showwaves[out1]
  18029. @end example
  18030. @item
  18031. Create a synthetic signal and show it with showwaves, forcing a
  18032. frame rate of 30 frames per second:
  18033. @example
  18034. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  18035. @end example
  18036. @end itemize
  18037. @section showwavespic
  18038. Convert input audio to a single video frame, representing the samples waves.
  18039. The filter accepts the following options:
  18040. @table @option
  18041. @item size, s
  18042. Specify the video size for the output. For the syntax of this option, check the
  18043. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18044. Default value is @code{600x240}.
  18045. @item split_channels
  18046. Set if channels should be drawn separately or overlap. Default value is 0.
  18047. @item colors
  18048. Set colors separated by '|' which are going to be used for drawing of each channel.
  18049. @item scale
  18050. Set amplitude scale.
  18051. Available values are:
  18052. @table @samp
  18053. @item lin
  18054. Linear.
  18055. @item log
  18056. Logarithmic.
  18057. @item sqrt
  18058. Square root.
  18059. @item cbrt
  18060. Cubic root.
  18061. @end table
  18062. Default is linear.
  18063. @item draw
  18064. Set the draw mode.
  18065. Available values are:
  18066. @table @samp
  18067. @item scale
  18068. Scale pixel values for each drawn sample.
  18069. @item full
  18070. Draw every sample directly.
  18071. @end table
  18072. Default value is @code{scale}.
  18073. @end table
  18074. @subsection Examples
  18075. @itemize
  18076. @item
  18077. Extract a channel split representation of the wave form of a whole audio track
  18078. in a 1024x800 picture using @command{ffmpeg}:
  18079. @example
  18080. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  18081. @end example
  18082. @end itemize
  18083. @section sidedata, asidedata
  18084. Delete frame side data, or select frames based on it.
  18085. This filter accepts the following options:
  18086. @table @option
  18087. @item mode
  18088. Set mode of operation of the filter.
  18089. Can be one of the following:
  18090. @table @samp
  18091. @item select
  18092. Select every frame with side data of @code{type}.
  18093. @item delete
  18094. Delete side data of @code{type}. If @code{type} is not set, delete all side
  18095. data in the frame.
  18096. @end table
  18097. @item type
  18098. Set side data type used with all modes. Must be set for @code{select} mode. For
  18099. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  18100. in @file{libavutil/frame.h}. For example, to choose
  18101. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  18102. @end table
  18103. @section spectrumsynth
  18104. Synthesize audio from 2 input video spectrums, first input stream represents
  18105. magnitude across time and second represents phase across time.
  18106. The filter will transform from frequency domain as displayed in videos back
  18107. to time domain as presented in audio output.
  18108. This filter is primarily created for reversing processed @ref{showspectrum}
  18109. filter outputs, but can synthesize sound from other spectrograms too.
  18110. But in such case results are going to be poor if the phase data is not
  18111. available, because in such cases phase data need to be recreated, usually
  18112. it's just recreated from random noise.
  18113. For best results use gray only output (@code{channel} color mode in
  18114. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  18115. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  18116. @code{data} option. Inputs videos should generally use @code{fullframe}
  18117. slide mode as that saves resources needed for decoding video.
  18118. The filter accepts the following options:
  18119. @table @option
  18120. @item sample_rate
  18121. Specify sample rate of output audio, the sample rate of audio from which
  18122. spectrum was generated may differ.
  18123. @item channels
  18124. Set number of channels represented in input video spectrums.
  18125. @item scale
  18126. Set scale which was used when generating magnitude input spectrum.
  18127. Can be @code{lin} or @code{log}. Default is @code{log}.
  18128. @item slide
  18129. Set slide which was used when generating inputs spectrums.
  18130. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  18131. Default is @code{fullframe}.
  18132. @item win_func
  18133. Set window function used for resynthesis.
  18134. @item overlap
  18135. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  18136. which means optimal overlap for selected window function will be picked.
  18137. @item orientation
  18138. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  18139. Default is @code{vertical}.
  18140. @end table
  18141. @subsection Examples
  18142. @itemize
  18143. @item
  18144. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  18145. then resynthesize videos back to audio with spectrumsynth:
  18146. @example
  18147. 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
  18148. 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
  18149. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  18150. @end example
  18151. @end itemize
  18152. @section split, asplit
  18153. Split input into several identical outputs.
  18154. @code{asplit} works with audio input, @code{split} with video.
  18155. The filter accepts a single parameter which specifies the number of outputs. If
  18156. unspecified, it defaults to 2.
  18157. @subsection Examples
  18158. @itemize
  18159. @item
  18160. Create two separate outputs from the same input:
  18161. @example
  18162. [in] split [out0][out1]
  18163. @end example
  18164. @item
  18165. To create 3 or more outputs, you need to specify the number of
  18166. outputs, like in:
  18167. @example
  18168. [in] asplit=3 [out0][out1][out2]
  18169. @end example
  18170. @item
  18171. Create two separate outputs from the same input, one cropped and
  18172. one padded:
  18173. @example
  18174. [in] split [splitout1][splitout2];
  18175. [splitout1] crop=100:100:0:0 [cropout];
  18176. [splitout2] pad=200:200:100:100 [padout];
  18177. @end example
  18178. @item
  18179. Create 5 copies of the input audio with @command{ffmpeg}:
  18180. @example
  18181. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  18182. @end example
  18183. @end itemize
  18184. @section zmq, azmq
  18185. Receive commands sent through a libzmq client, and forward them to
  18186. filters in the filtergraph.
  18187. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  18188. must be inserted between two video filters, @code{azmq} between two
  18189. audio filters. Both are capable to send messages to any filter type.
  18190. To enable these filters you need to install the libzmq library and
  18191. headers and configure FFmpeg with @code{--enable-libzmq}.
  18192. For more information about libzmq see:
  18193. @url{http://www.zeromq.org/}
  18194. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  18195. receives messages sent through a network interface defined by the
  18196. @option{bind_address} (or the abbreviation "@option{b}") option.
  18197. Default value of this option is @file{tcp://localhost:5555}. You may
  18198. want to alter this value to your needs, but do not forget to escape any
  18199. ':' signs (see @ref{filtergraph escaping}).
  18200. The received message must be in the form:
  18201. @example
  18202. @var{TARGET} @var{COMMAND} [@var{ARG}]
  18203. @end example
  18204. @var{TARGET} specifies the target of the command, usually the name of
  18205. the filter class or a specific filter instance name. The default
  18206. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  18207. but you can override this by using the @samp{filter_name@@id} syntax
  18208. (see @ref{Filtergraph syntax}).
  18209. @var{COMMAND} specifies the name of the command for the target filter.
  18210. @var{ARG} is optional and specifies the optional argument list for the
  18211. given @var{COMMAND}.
  18212. Upon reception, the message is processed and the corresponding command
  18213. is injected into the filtergraph. Depending on the result, the filter
  18214. will send a reply to the client, adopting the format:
  18215. @example
  18216. @var{ERROR_CODE} @var{ERROR_REASON}
  18217. @var{MESSAGE}
  18218. @end example
  18219. @var{MESSAGE} is optional.
  18220. @subsection Examples
  18221. Look at @file{tools/zmqsend} for an example of a zmq client which can
  18222. be used to send commands processed by these filters.
  18223. Consider the following filtergraph generated by @command{ffplay}.
  18224. In this example the last overlay filter has an instance name. All other
  18225. filters will have default instance names.
  18226. @example
  18227. ffplay -dumpgraph 1 -f lavfi "
  18228. color=s=100x100:c=red [l];
  18229. color=s=100x100:c=blue [r];
  18230. nullsrc=s=200x100, zmq [bg];
  18231. [bg][l] overlay [bg+l];
  18232. [bg+l][r] overlay@@my=x=100 "
  18233. @end example
  18234. To change the color of the left side of the video, the following
  18235. command can be used:
  18236. @example
  18237. echo Parsed_color_0 c yellow | tools/zmqsend
  18238. @end example
  18239. To change the right side:
  18240. @example
  18241. echo Parsed_color_1 c pink | tools/zmqsend
  18242. @end example
  18243. To change the position of the right side:
  18244. @example
  18245. echo overlay@@my x 150 | tools/zmqsend
  18246. @end example
  18247. @c man end MULTIMEDIA FILTERS
  18248. @chapter Multimedia Sources
  18249. @c man begin MULTIMEDIA SOURCES
  18250. Below is a description of the currently available multimedia sources.
  18251. @section amovie
  18252. This is the same as @ref{movie} source, except it selects an audio
  18253. stream by default.
  18254. @anchor{movie}
  18255. @section movie
  18256. Read audio and/or video stream(s) from a movie container.
  18257. It accepts the following parameters:
  18258. @table @option
  18259. @item filename
  18260. The name of the resource to read (not necessarily a file; it can also be a
  18261. device or a stream accessed through some protocol).
  18262. @item format_name, f
  18263. Specifies the format assumed for the movie to read, and can be either
  18264. the name of a container or an input device. If not specified, the
  18265. format is guessed from @var{movie_name} or by probing.
  18266. @item seek_point, sp
  18267. Specifies the seek point in seconds. The frames will be output
  18268. starting from this seek point. The parameter is evaluated with
  18269. @code{av_strtod}, so the numerical value may be suffixed by an IS
  18270. postfix. The default value is "0".
  18271. @item streams, s
  18272. Specifies the streams to read. Several streams can be specified,
  18273. separated by "+". The source will then have as many outputs, in the
  18274. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  18275. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  18276. respectively the default (best suited) video and audio stream. Default
  18277. is "dv", or "da" if the filter is called as "amovie".
  18278. @item stream_index, si
  18279. Specifies the index of the video stream to read. If the value is -1,
  18280. the most suitable video stream will be automatically selected. The default
  18281. value is "-1". Deprecated. If the filter is called "amovie", it will select
  18282. audio instead of video.
  18283. @item loop
  18284. Specifies how many times to read the stream in sequence.
  18285. If the value is 0, the stream will be looped infinitely.
  18286. Default value is "1".
  18287. Note that when the movie is looped the source timestamps are not
  18288. changed, so it will generate non monotonically increasing timestamps.
  18289. @item discontinuity
  18290. Specifies the time difference between frames above which the point is
  18291. considered a timestamp discontinuity which is removed by adjusting the later
  18292. timestamps.
  18293. @end table
  18294. It allows overlaying a second video on top of the main input of
  18295. a filtergraph, as shown in this graph:
  18296. @example
  18297. input -----------> deltapts0 --> overlay --> output
  18298. ^
  18299. |
  18300. movie --> scale--> deltapts1 -------+
  18301. @end example
  18302. @subsection Examples
  18303. @itemize
  18304. @item
  18305. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  18306. on top of the input labelled "in":
  18307. @example
  18308. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  18309. [in] setpts=PTS-STARTPTS [main];
  18310. [main][over] overlay=16:16 [out]
  18311. @end example
  18312. @item
  18313. Read from a video4linux2 device, and overlay it on top of the input
  18314. labelled "in":
  18315. @example
  18316. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  18317. [in] setpts=PTS-STARTPTS [main];
  18318. [main][over] overlay=16:16 [out]
  18319. @end example
  18320. @item
  18321. Read the first video stream and the audio stream with id 0x81 from
  18322. dvd.vob; the video is connected to the pad named "video" and the audio is
  18323. connected to the pad named "audio":
  18324. @example
  18325. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  18326. @end example
  18327. @end itemize
  18328. @subsection Commands
  18329. Both movie and amovie support the following commands:
  18330. @table @option
  18331. @item seek
  18332. Perform seek using "av_seek_frame".
  18333. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  18334. @itemize
  18335. @item
  18336. @var{stream_index}: If stream_index is -1, a default
  18337. stream is selected, and @var{timestamp} is automatically converted
  18338. from AV_TIME_BASE units to the stream specific time_base.
  18339. @item
  18340. @var{timestamp}: Timestamp in AVStream.time_base units
  18341. or, if no stream is specified, in AV_TIME_BASE units.
  18342. @item
  18343. @var{flags}: Flags which select direction and seeking mode.
  18344. @end itemize
  18345. @item get_duration
  18346. Get movie duration in AV_TIME_BASE units.
  18347. @end table
  18348. @c man end MULTIMEDIA SOURCES