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.

24127 lines
640KB

  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. @item all
  537. Use last set delay for all remaining channels. By default is disabled.
  538. This option if enabled changes how option @code{delays} is interpreted.
  539. @end table
  540. @subsection Examples
  541. @itemize
  542. @item
  543. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  544. the second channel (and any other channels that may be present) unchanged.
  545. @example
  546. adelay=1500|0|500
  547. @end example
  548. @item
  549. Delay second channel by 500 samples, the third channel by 700 samples and leave
  550. the first channel (and any other channels that may be present) unchanged.
  551. @example
  552. adelay=0|500S|700S
  553. @end example
  554. @item
  555. Delay all channels by same number of samples:
  556. @example
  557. adelay=delays=64S:all=1
  558. @end example
  559. @end itemize
  560. @section aderivative, aintegral
  561. Compute derivative/integral of audio stream.
  562. Applying both filters one after another produces original audio.
  563. @section aecho
  564. Apply echoing to the input audio.
  565. Echoes are reflected sound and can occur naturally amongst mountains
  566. (and sometimes large buildings) when talking or shouting; digital echo
  567. effects emulate this behaviour and are often used to help fill out the
  568. sound of a single instrument or vocal. The time difference between the
  569. original signal and the reflection is the @code{delay}, and the
  570. loudness of the reflected signal is the @code{decay}.
  571. Multiple echoes can have different delays and decays.
  572. A description of the accepted parameters follows.
  573. @table @option
  574. @item in_gain
  575. Set input gain of reflected signal. Default is @code{0.6}.
  576. @item out_gain
  577. Set output gain of reflected signal. Default is @code{0.3}.
  578. @item delays
  579. Set list of time intervals in milliseconds between original signal and reflections
  580. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  581. Default is @code{1000}.
  582. @item decays
  583. Set list of loudness of reflected signals separated by '|'.
  584. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  585. Default is @code{0.5}.
  586. @end table
  587. @subsection Examples
  588. @itemize
  589. @item
  590. Make it sound as if there are twice as many instruments as are actually playing:
  591. @example
  592. aecho=0.8:0.88:60:0.4
  593. @end example
  594. @item
  595. If delay is very short, then it sounds like a (metallic) robot playing music:
  596. @example
  597. aecho=0.8:0.88:6:0.4
  598. @end example
  599. @item
  600. A longer delay will sound like an open air concert in the mountains:
  601. @example
  602. aecho=0.8:0.9:1000:0.3
  603. @end example
  604. @item
  605. Same as above but with one more mountain:
  606. @example
  607. aecho=0.8:0.9:1000|1800:0.3|0.25
  608. @end example
  609. @end itemize
  610. @section aemphasis
  611. Audio emphasis filter creates or restores material directly taken from LPs or
  612. emphased CDs with different filter curves. E.g. to store music on vinyl the
  613. signal has to be altered by a filter first to even out the disadvantages of
  614. this recording medium.
  615. Once the material is played back the inverse filter has to be applied to
  616. restore the distortion of the frequency response.
  617. The filter accepts the following options:
  618. @table @option
  619. @item level_in
  620. Set input gain.
  621. @item level_out
  622. Set output gain.
  623. @item mode
  624. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  625. use @code{production} mode. Default is @code{reproduction} mode.
  626. @item type
  627. Set filter type. Selects medium. Can be one of the following:
  628. @table @option
  629. @item col
  630. select Columbia.
  631. @item emi
  632. select EMI.
  633. @item bsi
  634. select BSI (78RPM).
  635. @item riaa
  636. select RIAA.
  637. @item cd
  638. select Compact Disc (CD).
  639. @item 50fm
  640. select 50µs (FM).
  641. @item 75fm
  642. select 75µs (FM).
  643. @item 50kf
  644. select 50µs (FM-KF).
  645. @item 75kf
  646. select 75µs (FM-KF).
  647. @end table
  648. @end table
  649. @section aeval
  650. Modify an audio signal according to the specified expressions.
  651. This filter accepts one or more expressions (one for each channel),
  652. which are evaluated and used to modify a corresponding audio signal.
  653. It accepts the following parameters:
  654. @table @option
  655. @item exprs
  656. Set the '|'-separated expressions list for each separate channel. If
  657. the number of input channels is greater than the number of
  658. expressions, the last specified expression is used for the remaining
  659. output channels.
  660. @item channel_layout, c
  661. Set output channel layout. If not specified, the channel layout is
  662. specified by the number of expressions. If set to @samp{same}, it will
  663. use by default the same input channel layout.
  664. @end table
  665. Each expression in @var{exprs} can contain the following constants and functions:
  666. @table @option
  667. @item ch
  668. channel number of the current expression
  669. @item n
  670. number of the evaluated sample, starting from 0
  671. @item s
  672. sample rate
  673. @item t
  674. time of the evaluated sample expressed in seconds
  675. @item nb_in_channels
  676. @item nb_out_channels
  677. input and output number of channels
  678. @item val(CH)
  679. the value of input channel with number @var{CH}
  680. @end table
  681. Note: this filter is slow. For faster processing you should use a
  682. dedicated filter.
  683. @subsection Examples
  684. @itemize
  685. @item
  686. Half volume:
  687. @example
  688. aeval=val(ch)/2:c=same
  689. @end example
  690. @item
  691. Invert phase of the second channel:
  692. @example
  693. aeval=val(0)|-val(1)
  694. @end example
  695. @end itemize
  696. @anchor{afade}
  697. @section afade
  698. Apply fade-in/out effect to input audio.
  699. A description of the accepted parameters follows.
  700. @table @option
  701. @item type, t
  702. Specify the effect type, can be either @code{in} for fade-in, or
  703. @code{out} for a fade-out effect. Default is @code{in}.
  704. @item start_sample, ss
  705. Specify the number of the start sample for starting to apply the fade
  706. effect. Default is 0.
  707. @item nb_samples, ns
  708. Specify the number of samples for which the fade effect has to last. At
  709. the end of the fade-in effect the output audio will have the same
  710. volume as the input audio, at the end of the fade-out transition
  711. the output audio will be silence. Default is 44100.
  712. @item start_time, st
  713. Specify the start time of the fade effect. Default is 0.
  714. The value must be specified as a time duration; see
  715. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  716. for the accepted syntax.
  717. If set this option is used instead of @var{start_sample}.
  718. @item duration, d
  719. Specify the duration of the fade effect. See
  720. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  721. for the accepted syntax.
  722. At the end of the fade-in effect the output audio will have the same
  723. volume as the input audio, at the end of the fade-out transition
  724. the output audio will be silence.
  725. By default the duration is determined by @var{nb_samples}.
  726. If set this option is used instead of @var{nb_samples}.
  727. @item curve
  728. Set curve for fade transition.
  729. It accepts the following values:
  730. @table @option
  731. @item tri
  732. select triangular, linear slope (default)
  733. @item qsin
  734. select quarter of sine wave
  735. @item hsin
  736. select half of sine wave
  737. @item esin
  738. select exponential sine wave
  739. @item log
  740. select logarithmic
  741. @item ipar
  742. select inverted parabola
  743. @item qua
  744. select quadratic
  745. @item cub
  746. select cubic
  747. @item squ
  748. select square root
  749. @item cbr
  750. select cubic root
  751. @item par
  752. select parabola
  753. @item exp
  754. select exponential
  755. @item iqsin
  756. select inverted quarter of sine wave
  757. @item ihsin
  758. select inverted half of sine wave
  759. @item dese
  760. select double-exponential seat
  761. @item desi
  762. select double-exponential sigmoid
  763. @item losi
  764. select logistic sigmoid
  765. @item nofade
  766. no fade applied
  767. @end table
  768. @end table
  769. @subsection Examples
  770. @itemize
  771. @item
  772. Fade in first 15 seconds of audio:
  773. @example
  774. afade=t=in:ss=0:d=15
  775. @end example
  776. @item
  777. Fade out last 25 seconds of a 900 seconds audio:
  778. @example
  779. afade=t=out:st=875:d=25
  780. @end example
  781. @end itemize
  782. @section afftdn
  783. Denoise audio samples with FFT.
  784. A description of the accepted parameters follows.
  785. @table @option
  786. @item nr
  787. Set the noise reduction in dB, allowed range is 0.01 to 97.
  788. Default value is 12 dB.
  789. @item nf
  790. Set the noise floor in dB, allowed range is -80 to -20.
  791. Default value is -50 dB.
  792. @item nt
  793. Set the noise type.
  794. It accepts the following values:
  795. @table @option
  796. @item w
  797. Select white noise.
  798. @item v
  799. Select vinyl noise.
  800. @item s
  801. Select shellac noise.
  802. @item c
  803. Select custom noise, defined in @code{bn} option.
  804. Default value is white noise.
  805. @end table
  806. @item bn
  807. Set custom band noise for every one of 15 bands.
  808. Bands are separated by ' ' or '|'.
  809. @item rf
  810. Set the residual floor in dB, allowed range is -80 to -20.
  811. Default value is -38 dB.
  812. @item tn
  813. Enable noise tracking. By default is disabled.
  814. With this enabled, noise floor is automatically adjusted.
  815. @item tr
  816. Enable residual tracking. By default is disabled.
  817. @item om
  818. Set the output mode.
  819. It accepts the following values:
  820. @table @option
  821. @item i
  822. Pass input unchanged.
  823. @item o
  824. Pass noise filtered out.
  825. @item n
  826. Pass only noise.
  827. Default value is @var{o}.
  828. @end table
  829. @end table
  830. @subsection Commands
  831. This filter supports the following commands:
  832. @table @option
  833. @item sample_noise, sn
  834. Start or stop measuring noise profile.
  835. Syntax for the command is : "start" or "stop" string.
  836. After measuring noise profile is stopped it will be
  837. automatically applied in filtering.
  838. @item noise_reduction, nr
  839. Change noise reduction. Argument is single float number.
  840. Syntax for the command is : "@var{noise_reduction}"
  841. @item noise_floor, nf
  842. Change noise floor. Argument is single float number.
  843. Syntax for the command is : "@var{noise_floor}"
  844. @item output_mode, om
  845. Change output mode operation.
  846. Syntax for the command is : "i", "o" or "n" string.
  847. @end table
  848. @section afftfilt
  849. Apply arbitrary expressions to samples in frequency domain.
  850. @table @option
  851. @item real
  852. Set frequency domain real expression for each separate channel separated
  853. by '|'. Default is "re".
  854. If the number of input channels is greater than the number of
  855. expressions, the last specified expression is used for the remaining
  856. output channels.
  857. @item imag
  858. Set frequency domain imaginary expression for each separate channel
  859. separated by '|'. Default is "im".
  860. Each expression in @var{real} and @var{imag} can contain the following
  861. constants and functions:
  862. @table @option
  863. @item sr
  864. sample rate
  865. @item b
  866. current frequency bin number
  867. @item nb
  868. number of available bins
  869. @item ch
  870. channel number of the current expression
  871. @item chs
  872. number of channels
  873. @item pts
  874. current frame pts
  875. @item re
  876. current real part of frequency bin of current channel
  877. @item im
  878. current imaginary part of frequency bin of current channel
  879. @item real(b, ch)
  880. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  881. @item imag(b, ch)
  882. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  883. @end table
  884. @item win_size
  885. Set window size. Allowed range is from 16 to 131072.
  886. Default is @code{4096}
  887. @item win_func
  888. Set window function. Default is @code{hann}.
  889. @item overlap
  890. Set window overlap. If set to 1, the recommended overlap for selected
  891. window function will be picked. Default is @code{0.75}.
  892. @end table
  893. @subsection Examples
  894. @itemize
  895. @item
  896. Leave almost only low frequencies in audio:
  897. @example
  898. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  899. @end example
  900. @item
  901. Apply robotize effect:
  902. @example
  903. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  904. @end example
  905. @item
  906. Apply whisper effect:
  907. @example
  908. afftfilt="real='hypot(re,im)*cos((random(0)*2-1)*2*3.14)':imag='hypot(re,im)*sin((random(1)*2-1)*2*3.14)':win_size=128:overlap=0.8"
  909. @end example
  910. @end itemize
  911. @anchor{afir}
  912. @section afir
  913. Apply an arbitrary Frequency Impulse Response filter.
  914. This filter is designed for applying long FIR filters,
  915. up to 60 seconds long.
  916. It can be used as component for digital crossover filters,
  917. room equalization, cross talk cancellation, wavefield synthesis,
  918. auralization, ambiophonics, ambisonics and spatialization.
  919. This filter uses the second stream as FIR coefficients.
  920. If the second stream holds a single channel, it will be used
  921. for all input channels in the first stream, otherwise
  922. the number of channels in the second stream must be same as
  923. the number of channels in the first stream.
  924. It accepts the following parameters:
  925. @table @option
  926. @item dry
  927. Set dry gain. This sets input gain.
  928. @item wet
  929. Set wet gain. This sets final output gain.
  930. @item length
  931. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  932. @item gtype
  933. Enable applying gain measured from power of IR.
  934. Set which approach to use for auto gain measurement.
  935. @table @option
  936. @item none
  937. Do not apply any gain.
  938. @item peak
  939. select peak gain, very conservative approach. This is default value.
  940. @item dc
  941. select DC gain, limited application.
  942. @item gn
  943. select gain to noise approach, this is most popular one.
  944. @end table
  945. @item irgain
  946. Set gain to be applied to IR coefficients before filtering.
  947. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  948. @item irfmt
  949. Set format of IR stream. Can be @code{mono} or @code{input}.
  950. Default is @code{input}.
  951. @item maxir
  952. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  953. Allowed range is 0.1 to 60 seconds.
  954. @item response
  955. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  956. By default it is disabled.
  957. @item channel
  958. Set for which IR channel to display frequency response. By default is first channel
  959. displayed. This option is used only when @var{response} is enabled.
  960. @item size
  961. Set video stream size. This option is used only when @var{response} is enabled.
  962. @item rate
  963. Set video stream frame rate. This option is used only when @var{response} is enabled.
  964. @item minp
  965. Set minimal partition size used for convolution. Default is @var{8192}.
  966. Allowed range is from @var{8} to @var{32768}.
  967. Lower values decreases latency at cost of higher CPU usage.
  968. @item maxp
  969. Set maximal partition size used for convolution. Default is @var{8192}.
  970. Allowed range is from @var{8} to @var{32768}.
  971. Lower values may increase CPU usage.
  972. @end table
  973. @subsection Examples
  974. @itemize
  975. @item
  976. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  977. @example
  978. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  979. @end example
  980. @end itemize
  981. @anchor{aformat}
  982. @section aformat
  983. Set output format constraints for the input audio. The framework will
  984. negotiate the most appropriate format to minimize conversions.
  985. It accepts the following parameters:
  986. @table @option
  987. @item sample_fmts
  988. A '|'-separated list of requested sample formats.
  989. @item sample_rates
  990. A '|'-separated list of requested sample rates.
  991. @item channel_layouts
  992. A '|'-separated list of requested channel layouts.
  993. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  994. for the required syntax.
  995. @end table
  996. If a parameter is omitted, all values are allowed.
  997. Force the output to either unsigned 8-bit or signed 16-bit stereo
  998. @example
  999. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1000. @end example
  1001. @section agate
  1002. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1003. processing reduces disturbing noise between useful signals.
  1004. Gating is done by detecting the volume below a chosen level @var{threshold}
  1005. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1006. floor is set via @var{range}. Because an exact manipulation of the signal
  1007. would cause distortion of the waveform the reduction can be levelled over
  1008. time. This is done by setting @var{attack} and @var{release}.
  1009. @var{attack} determines how long the signal has to fall below the threshold
  1010. before any reduction will occur and @var{release} sets the time the signal
  1011. has to rise above the threshold to reduce the reduction again.
  1012. Shorter signals than the chosen attack time will be left untouched.
  1013. @table @option
  1014. @item level_in
  1015. Set input level before filtering.
  1016. Default is 1. Allowed range is from 0.015625 to 64.
  1017. @item mode
  1018. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1019. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1020. will be amplified, expanding dynamic range in upward direction.
  1021. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1022. @item range
  1023. Set the level of gain reduction when the signal is below the threshold.
  1024. Default is 0.06125. Allowed range is from 0 to 1.
  1025. Setting this to 0 disables reduction and then filter behaves like expander.
  1026. @item threshold
  1027. If a signal rises above this level the gain reduction is released.
  1028. Default is 0.125. Allowed range is from 0 to 1.
  1029. @item ratio
  1030. Set a ratio by which the signal is reduced.
  1031. Default is 2. Allowed range is from 1 to 9000.
  1032. @item attack
  1033. Amount of milliseconds the signal has to rise above the threshold before gain
  1034. reduction stops.
  1035. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1036. @item release
  1037. Amount of milliseconds the signal has to fall below the threshold before the
  1038. reduction is increased again. Default is 250 milliseconds.
  1039. Allowed range is from 0.01 to 9000.
  1040. @item makeup
  1041. Set amount of amplification of signal after processing.
  1042. Default is 1. Allowed range is from 1 to 64.
  1043. @item knee
  1044. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1045. Default is 2.828427125. Allowed range is from 1 to 8.
  1046. @item detection
  1047. Choose if exact signal should be taken for detection or an RMS like one.
  1048. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1049. @item link
  1050. Choose if the average level between all channels or the louder channel affects
  1051. the reduction.
  1052. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1053. @end table
  1054. @section aiir
  1055. Apply an arbitrary Infinite Impulse Response filter.
  1056. It accepts the following parameters:
  1057. @table @option
  1058. @item z
  1059. Set numerator/zeros coefficients.
  1060. @item p
  1061. Set denominator/poles coefficients.
  1062. @item k
  1063. Set channels gains.
  1064. @item dry_gain
  1065. Set input gain.
  1066. @item wet_gain
  1067. Set output gain.
  1068. @item f
  1069. Set coefficients format.
  1070. @table @samp
  1071. @item tf
  1072. transfer function
  1073. @item zp
  1074. Z-plane zeros/poles, cartesian (default)
  1075. @item pr
  1076. Z-plane zeros/poles, polar radians
  1077. @item pd
  1078. Z-plane zeros/poles, polar degrees
  1079. @end table
  1080. @item r
  1081. Set kind of processing.
  1082. Can be @code{d} - direct or @code{s} - serial cascading. Default is @code{s}.
  1083. @item e
  1084. Set filtering precision.
  1085. @table @samp
  1086. @item dbl
  1087. double-precision floating-point (default)
  1088. @item flt
  1089. single-precision floating-point
  1090. @item i32
  1091. 32-bit integers
  1092. @item i16
  1093. 16-bit integers
  1094. @end table
  1095. @item mix
  1096. How much to use filtered signal in output. Default is 1.
  1097. Range is between 0 and 1.
  1098. @item response
  1099. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1100. By default it is disabled.
  1101. @item channel
  1102. Set for which IR channel to display frequency response. By default is first channel
  1103. displayed. This option is used only when @var{response} is enabled.
  1104. @item size
  1105. Set video stream size. This option is used only when @var{response} is enabled.
  1106. @end table
  1107. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1108. order.
  1109. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1110. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1111. imaginary unit.
  1112. Different coefficients and gains can be provided for every channel, in such case
  1113. use '|' to separate coefficients or gains. Last provided coefficients will be
  1114. used for all remaining channels.
  1115. @subsection Examples
  1116. @itemize
  1117. @item
  1118. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1119. @example
  1120. 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
  1121. @end example
  1122. @item
  1123. Same as above but in @code{zp} format:
  1124. @example
  1125. 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
  1126. @end example
  1127. @end itemize
  1128. @section alimiter
  1129. The limiter prevents an input signal from rising over a desired threshold.
  1130. This limiter uses lookahead technology to prevent your signal from distorting.
  1131. It means that there is a small delay after the signal is processed. Keep in mind
  1132. that the delay it produces is the attack time you set.
  1133. The filter accepts the following options:
  1134. @table @option
  1135. @item level_in
  1136. Set input gain. Default is 1.
  1137. @item level_out
  1138. Set output gain. Default is 1.
  1139. @item limit
  1140. Don't let signals above this level pass the limiter. Default is 1.
  1141. @item attack
  1142. The limiter will reach its attenuation level in this amount of time in
  1143. milliseconds. Default is 5 milliseconds.
  1144. @item release
  1145. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1146. Default is 50 milliseconds.
  1147. @item asc
  1148. When gain reduction is always needed ASC takes care of releasing to an
  1149. average reduction level rather than reaching a reduction of 0 in the release
  1150. time.
  1151. @item asc_level
  1152. Select how much the release time is affected by ASC, 0 means nearly no changes
  1153. in release time while 1 produces higher release times.
  1154. @item level
  1155. Auto level output signal. Default is enabled.
  1156. This normalizes audio back to 0dB if enabled.
  1157. @end table
  1158. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1159. with @ref{aresample} before applying this filter.
  1160. @section allpass
  1161. Apply a two-pole all-pass filter with central frequency (in Hz)
  1162. @var{frequency}, and filter-width @var{width}.
  1163. An all-pass filter changes the audio's frequency to phase relationship
  1164. without changing its frequency to amplitude relationship.
  1165. The filter accepts the following options:
  1166. @table @option
  1167. @item frequency, f
  1168. Set frequency in Hz.
  1169. @item width_type, t
  1170. Set method to specify band-width of filter.
  1171. @table @option
  1172. @item h
  1173. Hz
  1174. @item q
  1175. Q-Factor
  1176. @item o
  1177. octave
  1178. @item s
  1179. slope
  1180. @item k
  1181. kHz
  1182. @end table
  1183. @item width, w
  1184. Specify the band-width of a filter in width_type units.
  1185. @item mix, m
  1186. How much to use filtered signal in output. Default is 1.
  1187. Range is between 0 and 1.
  1188. @item channels, c
  1189. Specify which channels to filter, by default all available are filtered.
  1190. @end table
  1191. @subsection Commands
  1192. This filter supports the following commands:
  1193. @table @option
  1194. @item frequency, f
  1195. Change allpass frequency.
  1196. Syntax for the command is : "@var{frequency}"
  1197. @item width_type, t
  1198. Change allpass width_type.
  1199. Syntax for the command is : "@var{width_type}"
  1200. @item width, w
  1201. Change allpass width.
  1202. Syntax for the command is : "@var{width}"
  1203. @item mix, m
  1204. Change allpass mix.
  1205. Syntax for the command is : "@var{mix}"
  1206. @end table
  1207. @section aloop
  1208. Loop audio samples.
  1209. The filter accepts the following options:
  1210. @table @option
  1211. @item loop
  1212. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1213. Default is 0.
  1214. @item size
  1215. Set maximal number of samples. Default is 0.
  1216. @item start
  1217. Set first sample of loop. Default is 0.
  1218. @end table
  1219. @anchor{amerge}
  1220. @section amerge
  1221. Merge two or more audio streams into a single multi-channel stream.
  1222. The filter accepts the following options:
  1223. @table @option
  1224. @item inputs
  1225. Set the number of inputs. Default is 2.
  1226. @end table
  1227. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1228. the channel layout of the output will be set accordingly and the channels
  1229. will be reordered as necessary. If the channel layouts of the inputs are not
  1230. disjoint, the output will have all the channels of the first input then all
  1231. the channels of the second input, in that order, and the channel layout of
  1232. the output will be the default value corresponding to the total number of
  1233. channels.
  1234. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1235. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1236. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1237. first input, b1 is the first channel of the second input).
  1238. On the other hand, if both input are in stereo, the output channels will be
  1239. in the default order: a1, a2, b1, b2, and the channel layout will be
  1240. arbitrarily set to 4.0, which may or may not be the expected value.
  1241. All inputs must have the same sample rate, and format.
  1242. If inputs do not have the same duration, the output will stop with the
  1243. shortest.
  1244. @subsection Examples
  1245. @itemize
  1246. @item
  1247. Merge two mono files into a stereo stream:
  1248. @example
  1249. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1250. @end example
  1251. @item
  1252. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1253. @example
  1254. 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
  1255. @end example
  1256. @end itemize
  1257. @section amix
  1258. Mixes multiple audio inputs into a single output.
  1259. Note that this filter only supports float samples (the @var{amerge}
  1260. and @var{pan} audio filters support many formats). If the @var{amix}
  1261. input has integer samples then @ref{aresample} will be automatically
  1262. inserted to perform the conversion to float samples.
  1263. For example
  1264. @example
  1265. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1266. @end example
  1267. will mix 3 input audio streams to a single output with the same duration as the
  1268. first input and a dropout transition time of 3 seconds.
  1269. It accepts the following parameters:
  1270. @table @option
  1271. @item inputs
  1272. The number of inputs. If unspecified, it defaults to 2.
  1273. @item duration
  1274. How to determine the end-of-stream.
  1275. @table @option
  1276. @item longest
  1277. The duration of the longest input. (default)
  1278. @item shortest
  1279. The duration of the shortest input.
  1280. @item first
  1281. The duration of the first input.
  1282. @end table
  1283. @item dropout_transition
  1284. The transition time, in seconds, for volume renormalization when an input
  1285. stream ends. The default value is 2 seconds.
  1286. @item weights
  1287. Specify weight of each input audio stream as sequence.
  1288. Each weight is separated by space. By default all inputs have same weight.
  1289. @end table
  1290. @section amultiply
  1291. Multiply first audio stream with second audio stream and store result
  1292. in output audio stream. Multiplication is done by multiplying each
  1293. sample from first stream with sample at same position from second stream.
  1294. With this element-wise multiplication one can create amplitude fades and
  1295. amplitude modulations.
  1296. @section anequalizer
  1297. High-order parametric multiband equalizer for each channel.
  1298. It accepts the following parameters:
  1299. @table @option
  1300. @item params
  1301. This option string is in format:
  1302. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1303. Each equalizer band is separated by '|'.
  1304. @table @option
  1305. @item chn
  1306. Set channel number to which equalization will be applied.
  1307. If input doesn't have that channel the entry is ignored.
  1308. @item f
  1309. Set central frequency for band.
  1310. If input doesn't have that frequency the entry is ignored.
  1311. @item w
  1312. Set band width in hertz.
  1313. @item g
  1314. Set band gain in dB.
  1315. @item t
  1316. Set filter type for band, optional, can be:
  1317. @table @samp
  1318. @item 0
  1319. Butterworth, this is default.
  1320. @item 1
  1321. Chebyshev type 1.
  1322. @item 2
  1323. Chebyshev type 2.
  1324. @end table
  1325. @end table
  1326. @item curves
  1327. With this option activated frequency response of anequalizer is displayed
  1328. in video stream.
  1329. @item size
  1330. Set video stream size. Only useful if curves option is activated.
  1331. @item mgain
  1332. Set max gain that will be displayed. Only useful if curves option is activated.
  1333. Setting this to a reasonable value makes it possible to display gain which is derived from
  1334. neighbour bands which are too close to each other and thus produce higher gain
  1335. when both are activated.
  1336. @item fscale
  1337. Set frequency scale used to draw frequency response in video output.
  1338. Can be linear or logarithmic. Default is logarithmic.
  1339. @item colors
  1340. Set color for each channel curve which is going to be displayed in video stream.
  1341. This is list of color names separated by space or by '|'.
  1342. Unrecognised or missing colors will be replaced by white color.
  1343. @end table
  1344. @subsection Examples
  1345. @itemize
  1346. @item
  1347. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1348. for first 2 channels using Chebyshev type 1 filter:
  1349. @example
  1350. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1351. @end example
  1352. @end itemize
  1353. @subsection Commands
  1354. This filter supports the following commands:
  1355. @table @option
  1356. @item change
  1357. Alter existing filter parameters.
  1358. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1359. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1360. error is returned.
  1361. @var{freq} set new frequency parameter.
  1362. @var{width} set new width parameter in herz.
  1363. @var{gain} set new gain parameter in dB.
  1364. Full filter invocation with asendcmd may look like this:
  1365. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1366. @end table
  1367. @section anlmdn
  1368. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1369. Each sample is adjusted by looking for other samples with similar contexts. This
  1370. context similarity is defined by comparing their surrounding patches of size
  1371. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1372. The filter accepts the following options:
  1373. @table @option
  1374. @item s
  1375. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1376. @item p
  1377. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1378. Default value is 2 milliseconds.
  1379. @item r
  1380. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1381. Default value is 6 milliseconds.
  1382. @item o
  1383. Set the output mode.
  1384. It accepts the following values:
  1385. @table @option
  1386. @item i
  1387. Pass input unchanged.
  1388. @item o
  1389. Pass noise filtered out.
  1390. @item n
  1391. Pass only noise.
  1392. Default value is @var{o}.
  1393. @end table
  1394. @item m
  1395. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1396. @end table
  1397. @subsection Commands
  1398. This filter supports the following commands:
  1399. @table @option
  1400. @item s
  1401. Change denoise strength. Argument is single float number.
  1402. Syntax for the command is : "@var{s}"
  1403. @item o
  1404. Change output mode.
  1405. Syntax for the command is : "i", "o" or "n" string.
  1406. @end table
  1407. @section anlms
  1408. Apply Normalized Least-Mean-Squares algorithm to the first audio stream using the second audio stream.
  1409. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1410. relate to producing the least mean square of the error signal (difference between the desired,
  1411. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1412. A description of the accepted options follows.
  1413. @table @option
  1414. @item order
  1415. Set filter order.
  1416. @item mu
  1417. Set filter mu.
  1418. @item eps
  1419. Set the filter eps.
  1420. @item leakage
  1421. Set the filter leakage.
  1422. @item out_mode
  1423. It accepts the following values:
  1424. @table @option
  1425. @item i
  1426. Pass the 1st input.
  1427. @item d
  1428. Pass the 2nd input.
  1429. @item o
  1430. Pass filtered samples.
  1431. @item n
  1432. Pass difference between desired and filtered samples.
  1433. Default value is @var{o}.
  1434. @end table
  1435. @end table
  1436. @subsection Examples
  1437. @itemize
  1438. @item
  1439. One of many usages of this filter is noise reduction, input audio is filtered
  1440. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1441. @example
  1442. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1443. @end example
  1444. @end itemize
  1445. @subsection Commands
  1446. This filter supports the same commands as options, excluding option @code{order}.
  1447. @section anull
  1448. Pass the audio source unchanged to the output.
  1449. @section apad
  1450. Pad the end of an audio stream with silence.
  1451. This can be used together with @command{ffmpeg} @option{-shortest} to
  1452. extend audio streams to the same length as the video stream.
  1453. A description of the accepted options follows.
  1454. @table @option
  1455. @item packet_size
  1456. Set silence packet size. Default value is 4096.
  1457. @item pad_len
  1458. Set the number of samples of silence to add to the end. After the
  1459. value is reached, the stream is terminated. This option is mutually
  1460. exclusive with @option{whole_len}.
  1461. @item whole_len
  1462. Set the minimum total number of samples in the output audio stream. If
  1463. the value is longer than the input audio length, silence is added to
  1464. the end, until the value is reached. This option is mutually exclusive
  1465. with @option{pad_len}.
  1466. @item pad_dur
  1467. Specify the duration of samples of silence to add. See
  1468. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1469. for the accepted syntax. Used only if set to non-zero value.
  1470. @item whole_dur
  1471. Specify the minimum total duration in the output audio stream. See
  1472. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1473. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1474. the input audio length, silence is added to the end, until the value is reached.
  1475. This option is mutually exclusive with @option{pad_dur}
  1476. @end table
  1477. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1478. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1479. the input stream indefinitely.
  1480. @subsection Examples
  1481. @itemize
  1482. @item
  1483. Add 1024 samples of silence to the end of the input:
  1484. @example
  1485. apad=pad_len=1024
  1486. @end example
  1487. @item
  1488. Make sure the audio output will contain at least 10000 samples, pad
  1489. the input with silence if required:
  1490. @example
  1491. apad=whole_len=10000
  1492. @end example
  1493. @item
  1494. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1495. video stream will always result the shortest and will be converted
  1496. until the end in the output file when using the @option{shortest}
  1497. option:
  1498. @example
  1499. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1500. @end example
  1501. @end itemize
  1502. @section aphaser
  1503. Add a phasing effect to the input audio.
  1504. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1505. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1506. A description of the accepted parameters follows.
  1507. @table @option
  1508. @item in_gain
  1509. Set input gain. Default is 0.4.
  1510. @item out_gain
  1511. Set output gain. Default is 0.74
  1512. @item delay
  1513. Set delay in milliseconds. Default is 3.0.
  1514. @item decay
  1515. Set decay. Default is 0.4.
  1516. @item speed
  1517. Set modulation speed in Hz. Default is 0.5.
  1518. @item type
  1519. Set modulation type. Default is triangular.
  1520. It accepts the following values:
  1521. @table @samp
  1522. @item triangular, t
  1523. @item sinusoidal, s
  1524. @end table
  1525. @end table
  1526. @section apulsator
  1527. Audio pulsator is something between an autopanner and a tremolo.
  1528. But it can produce funny stereo effects as well. Pulsator changes the volume
  1529. of the left and right channel based on a LFO (low frequency oscillator) with
  1530. different waveforms and shifted phases.
  1531. This filter have the ability to define an offset between left and right
  1532. channel. An offset of 0 means that both LFO shapes match each other.
  1533. The left and right channel are altered equally - a conventional tremolo.
  1534. An offset of 50% means that the shape of the right channel is exactly shifted
  1535. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1536. an autopanner. At 1 both curves match again. Every setting in between moves the
  1537. phase shift gapless between all stages and produces some "bypassing" sounds with
  1538. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1539. the 0.5) the faster the signal passes from the left to the right speaker.
  1540. The filter accepts the following options:
  1541. @table @option
  1542. @item level_in
  1543. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1544. @item level_out
  1545. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1546. @item mode
  1547. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1548. sawup or sawdown. Default is sine.
  1549. @item amount
  1550. Set modulation. Define how much of original signal is affected by the LFO.
  1551. @item offset_l
  1552. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1553. @item offset_r
  1554. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1555. @item width
  1556. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1557. @item timing
  1558. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1559. @item bpm
  1560. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1561. is set to bpm.
  1562. @item ms
  1563. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1564. is set to ms.
  1565. @item hz
  1566. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1567. if timing is set to hz.
  1568. @end table
  1569. @anchor{aresample}
  1570. @section aresample
  1571. Resample the input audio to the specified parameters, using the
  1572. libswresample library. If none are specified then the filter will
  1573. automatically convert between its input and output.
  1574. This filter is also able to stretch/squeeze the audio data to make it match
  1575. the timestamps or to inject silence / cut out audio to make it match the
  1576. timestamps, do a combination of both or do neither.
  1577. The filter accepts the syntax
  1578. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1579. expresses a sample rate and @var{resampler_options} is a list of
  1580. @var{key}=@var{value} pairs, separated by ":". See the
  1581. @ref{Resampler Options,,"Resampler Options" section in the
  1582. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1583. for the complete list of supported options.
  1584. @subsection Examples
  1585. @itemize
  1586. @item
  1587. Resample the input audio to 44100Hz:
  1588. @example
  1589. aresample=44100
  1590. @end example
  1591. @item
  1592. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1593. samples per second compensation:
  1594. @example
  1595. aresample=async=1000
  1596. @end example
  1597. @end itemize
  1598. @section areverse
  1599. Reverse an audio clip.
  1600. Warning: This filter requires memory to buffer the entire clip, so trimming
  1601. is suggested.
  1602. @subsection Examples
  1603. @itemize
  1604. @item
  1605. Take the first 5 seconds of a clip, and reverse it.
  1606. @example
  1607. atrim=end=5,areverse
  1608. @end example
  1609. @end itemize
  1610. @section asetnsamples
  1611. Set the number of samples per each output audio frame.
  1612. The last output packet may contain a different number of samples, as
  1613. the filter will flush all the remaining samples when the input audio
  1614. signals its end.
  1615. The filter accepts the following options:
  1616. @table @option
  1617. @item nb_out_samples, n
  1618. Set the number of frames per each output audio frame. The number is
  1619. intended as the number of samples @emph{per each channel}.
  1620. Default value is 1024.
  1621. @item pad, p
  1622. If set to 1, the filter will pad the last audio frame with zeroes, so
  1623. that the last frame will contain the same number of samples as the
  1624. previous ones. Default value is 1.
  1625. @end table
  1626. For example, to set the number of per-frame samples to 1234 and
  1627. disable padding for the last frame, use:
  1628. @example
  1629. asetnsamples=n=1234:p=0
  1630. @end example
  1631. @section asetrate
  1632. Set the sample rate without altering the PCM data.
  1633. This will result in a change of speed and pitch.
  1634. The filter accepts the following options:
  1635. @table @option
  1636. @item sample_rate, r
  1637. Set the output sample rate. Default is 44100 Hz.
  1638. @end table
  1639. @section ashowinfo
  1640. Show a line containing various information for each input audio frame.
  1641. The input audio is not modified.
  1642. The shown line contains a sequence of key/value pairs of the form
  1643. @var{key}:@var{value}.
  1644. The following values are shown in the output:
  1645. @table @option
  1646. @item n
  1647. The (sequential) number of the input frame, starting from 0.
  1648. @item pts
  1649. The presentation timestamp of the input frame, in time base units; the time base
  1650. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1651. @item pts_time
  1652. The presentation timestamp of the input frame in seconds.
  1653. @item pos
  1654. position of the frame in the input stream, -1 if this information in
  1655. unavailable and/or meaningless (for example in case of synthetic audio)
  1656. @item fmt
  1657. The sample format.
  1658. @item chlayout
  1659. The channel layout.
  1660. @item rate
  1661. The sample rate for the audio frame.
  1662. @item nb_samples
  1663. The number of samples (per channel) in the frame.
  1664. @item checksum
  1665. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1666. audio, the data is treated as if all the planes were concatenated.
  1667. @item plane_checksums
  1668. A list of Adler-32 checksums for each data plane.
  1669. @end table
  1670. @section asoftclip
  1671. Apply audio soft clipping.
  1672. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1673. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1674. This filter accepts the following options:
  1675. @table @option
  1676. @item type
  1677. Set type of soft-clipping.
  1678. It accepts the following values:
  1679. @table @option
  1680. @item tanh
  1681. @item atan
  1682. @item cubic
  1683. @item exp
  1684. @item alg
  1685. @item quintic
  1686. @item sin
  1687. @end table
  1688. @item param
  1689. Set additional parameter which controls sigmoid function.
  1690. @end table
  1691. @section asr
  1692. Automatic Speech Recognition
  1693. This filter uses PocketSphinx for speech recognition. To enable
  1694. compilation of this filter, you need to configure FFmpeg with
  1695. @code{--enable-pocketsphinx}.
  1696. It accepts the following options:
  1697. @table @option
  1698. @item rate
  1699. Set sampling rate of input audio. Defaults is @code{16000}.
  1700. This need to match speech models, otherwise one will get poor results.
  1701. @item hmm
  1702. Set dictionary containing acoustic model files.
  1703. @item dict
  1704. Set pronunciation dictionary.
  1705. @item lm
  1706. Set language model file.
  1707. @item lmctl
  1708. Set language model set.
  1709. @item lmname
  1710. Set which language model to use.
  1711. @item logfn
  1712. Set output for log messages.
  1713. @end table
  1714. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1715. @anchor{astats}
  1716. @section astats
  1717. Display time domain statistical information about the audio channels.
  1718. Statistics are calculated and displayed for each audio channel and,
  1719. where applicable, an overall figure is also given.
  1720. It accepts the following option:
  1721. @table @option
  1722. @item length
  1723. Short window length in seconds, used for peak and trough RMS measurement.
  1724. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1725. @item metadata
  1726. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1727. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1728. disabled.
  1729. Available keys for each channel are:
  1730. DC_offset
  1731. Min_level
  1732. Max_level
  1733. Min_difference
  1734. Max_difference
  1735. Mean_difference
  1736. RMS_difference
  1737. Peak_level
  1738. RMS_peak
  1739. RMS_trough
  1740. Crest_factor
  1741. Flat_factor
  1742. Peak_count
  1743. Bit_depth
  1744. Dynamic_range
  1745. Zero_crossings
  1746. Zero_crossings_rate
  1747. Number_of_NaNs
  1748. Number_of_Infs
  1749. Number_of_denormals
  1750. and for Overall:
  1751. DC_offset
  1752. Min_level
  1753. Max_level
  1754. Min_difference
  1755. Max_difference
  1756. Mean_difference
  1757. RMS_difference
  1758. Peak_level
  1759. RMS_level
  1760. RMS_peak
  1761. RMS_trough
  1762. Flat_factor
  1763. Peak_count
  1764. Bit_depth
  1765. Number_of_samples
  1766. Number_of_NaNs
  1767. Number_of_Infs
  1768. Number_of_denormals
  1769. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1770. this @code{lavfi.astats.Overall.Peak_count}.
  1771. For description what each key means read below.
  1772. @item reset
  1773. Set number of frame after which stats are going to be recalculated.
  1774. Default is disabled.
  1775. @item measure_perchannel
  1776. Select the entries which need to be measured per channel. The metadata keys can
  1777. be used as flags, default is @option{all} which measures everything.
  1778. @option{none} disables all per channel measurement.
  1779. @item measure_overall
  1780. Select the entries which need to be measured overall. The metadata keys can
  1781. be used as flags, default is @option{all} which measures everything.
  1782. @option{none} disables all overall measurement.
  1783. @end table
  1784. A description of each shown parameter follows:
  1785. @table @option
  1786. @item DC offset
  1787. Mean amplitude displacement from zero.
  1788. @item Min level
  1789. Minimal sample level.
  1790. @item Max level
  1791. Maximal sample level.
  1792. @item Min difference
  1793. Minimal difference between two consecutive samples.
  1794. @item Max difference
  1795. Maximal difference between two consecutive samples.
  1796. @item Mean difference
  1797. Mean difference between two consecutive samples.
  1798. The average of each difference between two consecutive samples.
  1799. @item RMS difference
  1800. Root Mean Square difference between two consecutive samples.
  1801. @item Peak level dB
  1802. @item RMS level dB
  1803. Standard peak and RMS level measured in dBFS.
  1804. @item RMS peak dB
  1805. @item RMS trough dB
  1806. Peak and trough values for RMS level measured over a short window.
  1807. @item Crest factor
  1808. Standard ratio of peak to RMS level (note: not in dB).
  1809. @item Flat factor
  1810. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1811. (i.e. either @var{Min level} or @var{Max level}).
  1812. @item Peak count
  1813. Number of occasions (not the number of samples) that the signal attained either
  1814. @var{Min level} or @var{Max level}.
  1815. @item Bit depth
  1816. Overall bit depth of audio. Number of bits used for each sample.
  1817. @item Dynamic range
  1818. Measured dynamic range of audio in dB.
  1819. @item Zero crossings
  1820. Number of points where the waveform crosses the zero level axis.
  1821. @item Zero crossings rate
  1822. Rate of Zero crossings and number of audio samples.
  1823. @end table
  1824. @section atempo
  1825. Adjust audio tempo.
  1826. The filter accepts exactly one parameter, the audio tempo. If not
  1827. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1828. be in the [0.5, 100.0] range.
  1829. Note that tempo greater than 2 will skip some samples rather than
  1830. blend them in. If for any reason this is a concern it is always
  1831. possible to daisy-chain several instances of atempo to achieve the
  1832. desired product tempo.
  1833. @subsection Examples
  1834. @itemize
  1835. @item
  1836. Slow down audio to 80% tempo:
  1837. @example
  1838. atempo=0.8
  1839. @end example
  1840. @item
  1841. To speed up audio to 300% tempo:
  1842. @example
  1843. atempo=3
  1844. @end example
  1845. @item
  1846. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1847. @example
  1848. atempo=sqrt(3),atempo=sqrt(3)
  1849. @end example
  1850. @end itemize
  1851. @subsection Commands
  1852. This filter supports the following commands:
  1853. @table @option
  1854. @item tempo
  1855. Change filter tempo scale factor.
  1856. Syntax for the command is : "@var{tempo}"
  1857. @end table
  1858. @section atrim
  1859. Trim the input so that the output contains one continuous subpart of the input.
  1860. It accepts the following parameters:
  1861. @table @option
  1862. @item start
  1863. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1864. sample with the timestamp @var{start} will be the first sample in the output.
  1865. @item end
  1866. Specify time of the first audio sample that will be dropped, i.e. the
  1867. audio sample immediately preceding the one with the timestamp @var{end} will be
  1868. the last sample in the output.
  1869. @item start_pts
  1870. Same as @var{start}, except this option sets the start timestamp in samples
  1871. instead of seconds.
  1872. @item end_pts
  1873. Same as @var{end}, except this option sets the end timestamp in samples instead
  1874. of seconds.
  1875. @item duration
  1876. The maximum duration of the output in seconds.
  1877. @item start_sample
  1878. The number of the first sample that should be output.
  1879. @item end_sample
  1880. The number of the first sample that should be dropped.
  1881. @end table
  1882. @option{start}, @option{end}, and @option{duration} are expressed as time
  1883. duration specifications; see
  1884. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1885. Note that the first two sets of the start/end options and the @option{duration}
  1886. option look at the frame timestamp, while the _sample options simply count the
  1887. samples that pass through the filter. So start/end_pts and start/end_sample will
  1888. give different results when the timestamps are wrong, inexact or do not start at
  1889. zero. Also note that this filter does not modify the timestamps. If you wish
  1890. to have the output timestamps start at zero, insert the asetpts filter after the
  1891. atrim filter.
  1892. If multiple start or end options are set, this filter tries to be greedy and
  1893. keep all samples that match at least one of the specified constraints. To keep
  1894. only the part that matches all the constraints at once, chain multiple atrim
  1895. filters.
  1896. The defaults are such that all the input is kept. So it is possible to set e.g.
  1897. just the end values to keep everything before the specified time.
  1898. Examples:
  1899. @itemize
  1900. @item
  1901. Drop everything except the second minute of input:
  1902. @example
  1903. ffmpeg -i INPUT -af atrim=60:120
  1904. @end example
  1905. @item
  1906. Keep only the first 1000 samples:
  1907. @example
  1908. ffmpeg -i INPUT -af atrim=end_sample=1000
  1909. @end example
  1910. @end itemize
  1911. @section bandpass
  1912. Apply a two-pole Butterworth band-pass filter with central
  1913. frequency @var{frequency}, and (3dB-point) band-width width.
  1914. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1915. instead of the default: constant 0dB peak gain.
  1916. The filter roll off at 6dB per octave (20dB per decade).
  1917. The filter accepts the following options:
  1918. @table @option
  1919. @item frequency, f
  1920. Set the filter's central frequency. Default is @code{3000}.
  1921. @item csg
  1922. Constant skirt gain if set to 1. Defaults to 0.
  1923. @item width_type, t
  1924. Set method to specify band-width of filter.
  1925. @table @option
  1926. @item h
  1927. Hz
  1928. @item q
  1929. Q-Factor
  1930. @item o
  1931. octave
  1932. @item s
  1933. slope
  1934. @item k
  1935. kHz
  1936. @end table
  1937. @item width, w
  1938. Specify the band-width of a filter in width_type units.
  1939. @item mix, m
  1940. How much to use filtered signal in output. Default is 1.
  1941. Range is between 0 and 1.
  1942. @item channels, c
  1943. Specify which channels to filter, by default all available are filtered.
  1944. @end table
  1945. @subsection Commands
  1946. This filter supports the following commands:
  1947. @table @option
  1948. @item frequency, f
  1949. Change bandpass frequency.
  1950. Syntax for the command is : "@var{frequency}"
  1951. @item width_type, t
  1952. Change bandpass width_type.
  1953. Syntax for the command is : "@var{width_type}"
  1954. @item width, w
  1955. Change bandpass width.
  1956. Syntax for the command is : "@var{width}"
  1957. @item mix, m
  1958. Change bandpass mix.
  1959. Syntax for the command is : "@var{mix}"
  1960. @end table
  1961. @section bandreject
  1962. Apply a two-pole Butterworth band-reject filter with central
  1963. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1964. The filter roll off at 6dB per octave (20dB per decade).
  1965. The filter accepts the following options:
  1966. @table @option
  1967. @item frequency, f
  1968. Set the filter's central frequency. Default is @code{3000}.
  1969. @item width_type, t
  1970. Set method to specify band-width of filter.
  1971. @table @option
  1972. @item h
  1973. Hz
  1974. @item q
  1975. Q-Factor
  1976. @item o
  1977. octave
  1978. @item s
  1979. slope
  1980. @item k
  1981. kHz
  1982. @end table
  1983. @item width, w
  1984. Specify the band-width of a filter in width_type units.
  1985. @item mix, m
  1986. How much to use filtered signal in output. Default is 1.
  1987. Range is between 0 and 1.
  1988. @item channels, c
  1989. Specify which channels to filter, by default all available are filtered.
  1990. @end table
  1991. @subsection Commands
  1992. This filter supports the following commands:
  1993. @table @option
  1994. @item frequency, f
  1995. Change bandreject frequency.
  1996. Syntax for the command is : "@var{frequency}"
  1997. @item width_type, t
  1998. Change bandreject width_type.
  1999. Syntax for the command is : "@var{width_type}"
  2000. @item width, w
  2001. Change bandreject width.
  2002. Syntax for the command is : "@var{width}"
  2003. @item mix, m
  2004. Change bandreject mix.
  2005. Syntax for the command is : "@var{mix}"
  2006. @end table
  2007. @section bass, lowshelf
  2008. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2009. shelving filter with a response similar to that of a standard
  2010. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2011. The filter accepts the following options:
  2012. @table @option
  2013. @item gain, g
  2014. Give the gain at 0 Hz. Its useful range is about -20
  2015. (for a large cut) to +20 (for a large boost).
  2016. Beware of clipping when using a positive gain.
  2017. @item frequency, f
  2018. Set the filter's central frequency and so can be used
  2019. to extend or reduce the frequency range to be boosted or cut.
  2020. The default value is @code{100} Hz.
  2021. @item width_type, t
  2022. Set method to specify band-width of filter.
  2023. @table @option
  2024. @item h
  2025. Hz
  2026. @item q
  2027. Q-Factor
  2028. @item o
  2029. octave
  2030. @item s
  2031. slope
  2032. @item k
  2033. kHz
  2034. @end table
  2035. @item width, w
  2036. Determine how steep is the filter's shelf transition.
  2037. @item mix, m
  2038. How much to use filtered signal in output. Default is 1.
  2039. Range is between 0 and 1.
  2040. @item channels, c
  2041. Specify which channels to filter, by default all available are filtered.
  2042. @end table
  2043. @subsection Commands
  2044. This filter supports the following commands:
  2045. @table @option
  2046. @item frequency, f
  2047. Change bass frequency.
  2048. Syntax for the command is : "@var{frequency}"
  2049. @item width_type, t
  2050. Change bass width_type.
  2051. Syntax for the command is : "@var{width_type}"
  2052. @item width, w
  2053. Change bass width.
  2054. Syntax for the command is : "@var{width}"
  2055. @item gain, g
  2056. Change bass gain.
  2057. Syntax for the command is : "@var{gain}"
  2058. @item mix, m
  2059. Change bass mix.
  2060. Syntax for the command is : "@var{mix}"
  2061. @end table
  2062. @section biquad
  2063. Apply a biquad IIR filter with the given coefficients.
  2064. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2065. are the numerator and denominator coefficients respectively.
  2066. and @var{channels}, @var{c} specify which channels to filter, by default all
  2067. available are filtered.
  2068. @subsection Commands
  2069. This filter supports the following commands:
  2070. @table @option
  2071. @item a0
  2072. @item a1
  2073. @item a2
  2074. @item b0
  2075. @item b1
  2076. @item b2
  2077. Change biquad parameter.
  2078. Syntax for the command is : "@var{value}"
  2079. @item mix, m
  2080. How much to use filtered signal in output. Default is 1.
  2081. Range is between 0 and 1.
  2082. @end table
  2083. @section bs2b
  2084. Bauer stereo to binaural transformation, which improves headphone listening of
  2085. stereo audio records.
  2086. To enable compilation of this filter you need to configure FFmpeg with
  2087. @code{--enable-libbs2b}.
  2088. It accepts the following parameters:
  2089. @table @option
  2090. @item profile
  2091. Pre-defined crossfeed level.
  2092. @table @option
  2093. @item default
  2094. Default level (fcut=700, feed=50).
  2095. @item cmoy
  2096. Chu Moy circuit (fcut=700, feed=60).
  2097. @item jmeier
  2098. Jan Meier circuit (fcut=650, feed=95).
  2099. @end table
  2100. @item fcut
  2101. Cut frequency (in Hz).
  2102. @item feed
  2103. Feed level (in Hz).
  2104. @end table
  2105. @section channelmap
  2106. Remap input channels to new locations.
  2107. It accepts the following parameters:
  2108. @table @option
  2109. @item map
  2110. Map channels from input to output. The argument is a '|'-separated list of
  2111. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2112. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2113. channel (e.g. FL for front left) or its index in the input channel layout.
  2114. @var{out_channel} is the name of the output channel or its index in the output
  2115. channel layout. If @var{out_channel} is not given then it is implicitly an
  2116. index, starting with zero and increasing by one for each mapping.
  2117. @item channel_layout
  2118. The channel layout of the output stream.
  2119. @end table
  2120. If no mapping is present, the filter will implicitly map input channels to
  2121. output channels, preserving indices.
  2122. @subsection Examples
  2123. @itemize
  2124. @item
  2125. For example, assuming a 5.1+downmix input MOV file,
  2126. @example
  2127. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2128. @end example
  2129. will create an output WAV file tagged as stereo from the downmix channels of
  2130. the input.
  2131. @item
  2132. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2133. @example
  2134. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2135. @end example
  2136. @end itemize
  2137. @section channelsplit
  2138. Split each channel from an input audio stream into a separate output stream.
  2139. It accepts the following parameters:
  2140. @table @option
  2141. @item channel_layout
  2142. The channel layout of the input stream. The default is "stereo".
  2143. @item channels
  2144. A channel layout describing the channels to be extracted as separate output streams
  2145. or "all" to extract each input channel as a separate stream. The default is "all".
  2146. Choosing channels not present in channel layout in the input will result in an error.
  2147. @end table
  2148. @subsection Examples
  2149. @itemize
  2150. @item
  2151. For example, assuming a stereo input MP3 file,
  2152. @example
  2153. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2154. @end example
  2155. will create an output Matroska file with two audio streams, one containing only
  2156. the left channel and the other the right channel.
  2157. @item
  2158. Split a 5.1 WAV file into per-channel files:
  2159. @example
  2160. ffmpeg -i in.wav -filter_complex
  2161. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2162. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2163. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2164. side_right.wav
  2165. @end example
  2166. @item
  2167. Extract only LFE from a 5.1 WAV file:
  2168. @example
  2169. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2170. -map '[LFE]' lfe.wav
  2171. @end example
  2172. @end itemize
  2173. @section chorus
  2174. Add a chorus effect to the audio.
  2175. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2176. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2177. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2178. The modulation depth defines the range the modulated delay is played before or after
  2179. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2180. sound tuned around the original one, like in a chorus where some vocals are slightly
  2181. off key.
  2182. It accepts the following parameters:
  2183. @table @option
  2184. @item in_gain
  2185. Set input gain. Default is 0.4.
  2186. @item out_gain
  2187. Set output gain. Default is 0.4.
  2188. @item delays
  2189. Set delays. A typical delay is around 40ms to 60ms.
  2190. @item decays
  2191. Set decays.
  2192. @item speeds
  2193. Set speeds.
  2194. @item depths
  2195. Set depths.
  2196. @end table
  2197. @subsection Examples
  2198. @itemize
  2199. @item
  2200. A single delay:
  2201. @example
  2202. chorus=0.7:0.9:55:0.4:0.25:2
  2203. @end example
  2204. @item
  2205. Two delays:
  2206. @example
  2207. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2208. @end example
  2209. @item
  2210. Fuller sounding chorus with three delays:
  2211. @example
  2212. 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
  2213. @end example
  2214. @end itemize
  2215. @section compand
  2216. Compress or expand the audio's dynamic range.
  2217. It accepts the following parameters:
  2218. @table @option
  2219. @item attacks
  2220. @item decays
  2221. A list of times in seconds for each channel over which the instantaneous level
  2222. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2223. increase of volume and @var{decays} refers to decrease of volume. For most
  2224. situations, the attack time (response to the audio getting louder) should be
  2225. shorter than the decay time, because the human ear is more sensitive to sudden
  2226. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2227. a typical value for decay is 0.8 seconds.
  2228. If specified number of attacks & decays is lower than number of channels, the last
  2229. set attack/decay will be used for all remaining channels.
  2230. @item points
  2231. A list of points for the transfer function, specified in dB relative to the
  2232. maximum possible signal amplitude. Each key points list must be defined using
  2233. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2234. @code{x0/y0 x1/y1 x2/y2 ....}
  2235. The input values must be in strictly increasing order but the transfer function
  2236. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2237. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2238. function are @code{-70/-70|-60/-20|1/0}.
  2239. @item soft-knee
  2240. Set the curve radius in dB for all joints. It defaults to 0.01.
  2241. @item gain
  2242. Set the additional gain in dB to be applied at all points on the transfer
  2243. function. This allows for easy adjustment of the overall gain.
  2244. It defaults to 0.
  2245. @item volume
  2246. Set an initial volume, in dB, to be assumed for each channel when filtering
  2247. starts. This permits the user to supply a nominal level initially, so that, for
  2248. example, a very large gain is not applied to initial signal levels before the
  2249. companding has begun to operate. A typical value for audio which is initially
  2250. quiet is -90 dB. It defaults to 0.
  2251. @item delay
  2252. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2253. delayed before being fed to the volume adjuster. Specifying a delay
  2254. approximately equal to the attack/decay times allows the filter to effectively
  2255. operate in predictive rather than reactive mode. It defaults to 0.
  2256. @end table
  2257. @subsection Examples
  2258. @itemize
  2259. @item
  2260. Make music with both quiet and loud passages suitable for listening to in a
  2261. noisy environment:
  2262. @example
  2263. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2264. @end example
  2265. Another example for audio with whisper and explosion parts:
  2266. @example
  2267. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2268. @end example
  2269. @item
  2270. A noise gate for when the noise is at a lower level than the signal:
  2271. @example
  2272. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2273. @end example
  2274. @item
  2275. Here is another noise gate, this time for when the noise is at a higher level
  2276. than the signal (making it, in some ways, similar to squelch):
  2277. @example
  2278. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2279. @end example
  2280. @item
  2281. 2:1 compression starting at -6dB:
  2282. @example
  2283. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2284. @end example
  2285. @item
  2286. 2:1 compression starting at -9dB:
  2287. @example
  2288. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2289. @end example
  2290. @item
  2291. 2:1 compression starting at -12dB:
  2292. @example
  2293. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2294. @end example
  2295. @item
  2296. 2:1 compression starting at -18dB:
  2297. @example
  2298. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2299. @end example
  2300. @item
  2301. 3:1 compression starting at -15dB:
  2302. @example
  2303. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2304. @end example
  2305. @item
  2306. Compressor/Gate:
  2307. @example
  2308. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2309. @end example
  2310. @item
  2311. Expander:
  2312. @example
  2313. 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
  2314. @end example
  2315. @item
  2316. Hard limiter at -6dB:
  2317. @example
  2318. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2319. @end example
  2320. @item
  2321. Hard limiter at -12dB:
  2322. @example
  2323. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2324. @end example
  2325. @item
  2326. Hard noise gate at -35 dB:
  2327. @example
  2328. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2329. @end example
  2330. @item
  2331. Soft limiter:
  2332. @example
  2333. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2334. @end example
  2335. @end itemize
  2336. @section compensationdelay
  2337. Compensation Delay Line is a metric based delay to compensate differing
  2338. positions of microphones or speakers.
  2339. For example, you have recorded guitar with two microphones placed in
  2340. different locations. Because the front of sound wave has fixed speed in
  2341. normal conditions, the phasing of microphones can vary and depends on
  2342. their location and interposition. The best sound mix can be achieved when
  2343. these microphones are in phase (synchronized). Note that a distance of
  2344. ~30 cm between microphones makes one microphone capture the signal in
  2345. antiphase to the other microphone. That makes the final mix sound moody.
  2346. This filter helps to solve phasing problems by adding different delays
  2347. to each microphone track and make them synchronized.
  2348. The best result can be reached when you take one track as base and
  2349. synchronize other tracks one by one with it.
  2350. Remember that synchronization/delay tolerance depends on sample rate, too.
  2351. Higher sample rates will give more tolerance.
  2352. The filter accepts the following parameters:
  2353. @table @option
  2354. @item mm
  2355. Set millimeters distance. This is compensation distance for fine tuning.
  2356. Default is 0.
  2357. @item cm
  2358. Set cm distance. This is compensation distance for tightening distance setup.
  2359. Default is 0.
  2360. @item m
  2361. Set meters distance. This is compensation distance for hard distance setup.
  2362. Default is 0.
  2363. @item dry
  2364. Set dry amount. Amount of unprocessed (dry) signal.
  2365. Default is 0.
  2366. @item wet
  2367. Set wet amount. Amount of processed (wet) signal.
  2368. Default is 1.
  2369. @item temp
  2370. Set temperature in degrees Celsius. This is the temperature of the environment.
  2371. Default is 20.
  2372. @end table
  2373. @section crossfeed
  2374. Apply headphone crossfeed filter.
  2375. Crossfeed is the process of blending the left and right channels of stereo
  2376. audio recording.
  2377. It is mainly used to reduce extreme stereo separation of low frequencies.
  2378. The intent is to produce more speaker like sound to the listener.
  2379. The filter accepts the following options:
  2380. @table @option
  2381. @item strength
  2382. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2383. This sets gain of low shelf filter for side part of stereo image.
  2384. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2385. @item range
  2386. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2387. This sets cut off frequency of low shelf filter. Default is cut off near
  2388. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2389. @item level_in
  2390. Set input gain. Default is 0.9.
  2391. @item level_out
  2392. Set output gain. Default is 1.
  2393. @end table
  2394. @section crystalizer
  2395. Simple algorithm to expand audio dynamic range.
  2396. The filter accepts the following options:
  2397. @table @option
  2398. @item i
  2399. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2400. (unchanged sound) to 10.0 (maximum effect).
  2401. @item c
  2402. Enable clipping. By default is enabled.
  2403. @end table
  2404. @section dcshift
  2405. Apply a DC shift to the audio.
  2406. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2407. in the recording chain) from the audio. The effect of a DC offset is reduced
  2408. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2409. a signal has a DC offset.
  2410. @table @option
  2411. @item shift
  2412. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2413. the audio.
  2414. @item limitergain
  2415. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2416. used to prevent clipping.
  2417. @end table
  2418. @section deesser
  2419. Apply de-essing to the audio samples.
  2420. @table @option
  2421. @item i
  2422. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2423. Default is 0.
  2424. @item m
  2425. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2426. Default is 0.5.
  2427. @item f
  2428. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2429. Default is 0.5.
  2430. @item s
  2431. Set the output mode.
  2432. It accepts the following values:
  2433. @table @option
  2434. @item i
  2435. Pass input unchanged.
  2436. @item o
  2437. Pass ess filtered out.
  2438. @item e
  2439. Pass only ess.
  2440. Default value is @var{o}.
  2441. @end table
  2442. @end table
  2443. @section drmeter
  2444. Measure audio dynamic range.
  2445. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2446. is found in transition material. And anything less that 8 have very poor dynamics
  2447. and is very compressed.
  2448. The filter accepts the following options:
  2449. @table @option
  2450. @item length
  2451. Set window length in seconds used to split audio into segments of equal length.
  2452. Default is 3 seconds.
  2453. @end table
  2454. @section dynaudnorm
  2455. Dynamic Audio Normalizer.
  2456. This filter applies a certain amount of gain to the input audio in order
  2457. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2458. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2459. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2460. This allows for applying extra gain to the "quiet" sections of the audio
  2461. while avoiding distortions or clipping the "loud" sections. In other words:
  2462. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2463. sections, in the sense that the volume of each section is brought to the
  2464. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2465. this goal *without* applying "dynamic range compressing". It will retain 100%
  2466. of the dynamic range *within* each section of the audio file.
  2467. @table @option
  2468. @item framelen, f
  2469. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2470. Default is 500 milliseconds.
  2471. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2472. referred to as frames. This is required, because a peak magnitude has no
  2473. meaning for just a single sample value. Instead, we need to determine the
  2474. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2475. normalizer would simply use the peak magnitude of the complete file, the
  2476. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2477. frame. The length of a frame is specified in milliseconds. By default, the
  2478. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2479. been found to give good results with most files.
  2480. Note that the exact frame length, in number of samples, will be determined
  2481. automatically, based on the sampling rate of the individual input audio file.
  2482. @item gausssize, g
  2483. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2484. number. Default is 31.
  2485. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2486. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2487. is specified in frames, centered around the current frame. For the sake of
  2488. simplicity, this must be an odd number. Consequently, the default value of 31
  2489. takes into account the current frame, as well as the 15 preceding frames and
  2490. the 15 subsequent frames. Using a larger window results in a stronger
  2491. smoothing effect and thus in less gain variation, i.e. slower gain
  2492. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2493. effect and thus in more gain variation, i.e. faster gain adaptation.
  2494. In other words, the more you increase this value, the more the Dynamic Audio
  2495. Normalizer will behave like a "traditional" normalization filter. On the
  2496. contrary, the more you decrease this value, the more the Dynamic Audio
  2497. Normalizer will behave like a dynamic range compressor.
  2498. @item peak, p
  2499. Set the target peak value. This specifies the highest permissible magnitude
  2500. level for the normalized audio input. This filter will try to approach the
  2501. target peak magnitude as closely as possible, but at the same time it also
  2502. makes sure that the normalized signal will never exceed the peak magnitude.
  2503. A frame's maximum local gain factor is imposed directly by the target peak
  2504. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2505. It is not recommended to go above this value.
  2506. @item maxgain, m
  2507. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2508. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2509. factor for each input frame, i.e. the maximum gain factor that does not
  2510. result in clipping or distortion. The maximum gain factor is determined by
  2511. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2512. additionally bounds the frame's maximum gain factor by a predetermined
  2513. (global) maximum gain factor. This is done in order to avoid excessive gain
  2514. factors in "silent" or almost silent frames. By default, the maximum gain
  2515. factor is 10.0, For most inputs the default value should be sufficient and
  2516. it usually is not recommended to increase this value. Though, for input
  2517. with an extremely low overall volume level, it may be necessary to allow even
  2518. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2519. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2520. Instead, a "sigmoid" threshold function will be applied. This way, the
  2521. gain factors will smoothly approach the threshold value, but never exceed that
  2522. value.
  2523. @item targetrms, r
  2524. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2525. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2526. This means that the maximum local gain factor for each frame is defined
  2527. (only) by the frame's highest magnitude sample. This way, the samples can
  2528. be amplified as much as possible without exceeding the maximum signal
  2529. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2530. Normalizer can also take into account the frame's root mean square,
  2531. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2532. determine the power of a time-varying signal. It is therefore considered
  2533. that the RMS is a better approximation of the "perceived loudness" than
  2534. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2535. frames to a constant RMS value, a uniform "perceived loudness" can be
  2536. established. If a target RMS value has been specified, a frame's local gain
  2537. factor is defined as the factor that would result in exactly that RMS value.
  2538. Note, however, that the maximum local gain factor is still restricted by the
  2539. frame's highest magnitude sample, in order to prevent clipping.
  2540. @item coupling, n
  2541. Enable channels coupling. By default is enabled.
  2542. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2543. amount. This means the same gain factor will be applied to all channels, i.e.
  2544. the maximum possible gain factor is determined by the "loudest" channel.
  2545. However, in some recordings, it may happen that the volume of the different
  2546. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2547. In this case, this option can be used to disable the channel coupling. This way,
  2548. the gain factor will be determined independently for each channel, depending
  2549. only on the individual channel's highest magnitude sample. This allows for
  2550. harmonizing the volume of the different channels.
  2551. @item correctdc, c
  2552. Enable DC bias correction. By default is disabled.
  2553. An audio signal (in the time domain) is a sequence of sample values.
  2554. In the Dynamic Audio Normalizer these sample values are represented in the
  2555. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2556. audio signal, or "waveform", should be centered around the zero point.
  2557. That means if we calculate the mean value of all samples in a file, or in a
  2558. single frame, then the result should be 0.0 or at least very close to that
  2559. value. If, however, there is a significant deviation of the mean value from
  2560. 0.0, in either positive or negative direction, this is referred to as a
  2561. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2562. Audio Normalizer provides optional DC bias correction.
  2563. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2564. the mean value, or "DC correction" offset, of each input frame and subtract
  2565. that value from all of the frame's sample values which ensures those samples
  2566. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2567. boundaries, the DC correction offset values will be interpolated smoothly
  2568. between neighbouring frames.
  2569. @item altboundary, b
  2570. Enable alternative boundary mode. By default is disabled.
  2571. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2572. around each frame. This includes the preceding frames as well as the
  2573. subsequent frames. However, for the "boundary" frames, located at the very
  2574. beginning and at the very end of the audio file, not all neighbouring
  2575. frames are available. In particular, for the first few frames in the audio
  2576. file, the preceding frames are not known. And, similarly, for the last few
  2577. frames in the audio file, the subsequent frames are not known. Thus, the
  2578. question arises which gain factors should be assumed for the missing frames
  2579. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2580. to deal with this situation. The default boundary mode assumes a gain factor
  2581. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2582. "fade out" at the beginning and at the end of the input, respectively.
  2583. @item compress, s
  2584. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2585. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2586. compression. This means that signal peaks will not be pruned and thus the
  2587. full dynamic range will be retained within each local neighbourhood. However,
  2588. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2589. normalization algorithm with a more "traditional" compression.
  2590. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2591. (thresholding) function. If (and only if) the compression feature is enabled,
  2592. all input frames will be processed by a soft knee thresholding function prior
  2593. to the actual normalization process. Put simply, the thresholding function is
  2594. going to prune all samples whose magnitude exceeds a certain threshold value.
  2595. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2596. value. Instead, the threshold value will be adjusted for each individual
  2597. frame.
  2598. In general, smaller parameters result in stronger compression, and vice versa.
  2599. Values below 3.0 are not recommended, because audible distortion may appear.
  2600. @end table
  2601. @section earwax
  2602. Make audio easier to listen to on headphones.
  2603. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2604. so that when listened to on headphones the stereo image is moved from
  2605. inside your head (standard for headphones) to outside and in front of
  2606. the listener (standard for speakers).
  2607. Ported from SoX.
  2608. @section equalizer
  2609. Apply a two-pole peaking equalisation (EQ) filter. With this
  2610. filter, the signal-level at and around a selected frequency can
  2611. be increased or decreased, whilst (unlike bandpass and bandreject
  2612. filters) that at all other frequencies is unchanged.
  2613. In order to produce complex equalisation curves, this filter can
  2614. be given several times, each with a different central frequency.
  2615. The filter accepts the following options:
  2616. @table @option
  2617. @item frequency, f
  2618. Set the filter's central frequency in Hz.
  2619. @item width_type, t
  2620. Set method to specify band-width of filter.
  2621. @table @option
  2622. @item h
  2623. Hz
  2624. @item q
  2625. Q-Factor
  2626. @item o
  2627. octave
  2628. @item s
  2629. slope
  2630. @item k
  2631. kHz
  2632. @end table
  2633. @item width, w
  2634. Specify the band-width of a filter in width_type units.
  2635. @item gain, g
  2636. Set the required gain or attenuation in dB.
  2637. Beware of clipping when using a positive gain.
  2638. @item mix, m
  2639. How much to use filtered signal in output. Default is 1.
  2640. Range is between 0 and 1.
  2641. @item channels, c
  2642. Specify which channels to filter, by default all available are filtered.
  2643. @end table
  2644. @subsection Examples
  2645. @itemize
  2646. @item
  2647. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2648. @example
  2649. equalizer=f=1000:t=h:width=200:g=-10
  2650. @end example
  2651. @item
  2652. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2653. @example
  2654. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2655. @end example
  2656. @end itemize
  2657. @subsection Commands
  2658. This filter supports the following commands:
  2659. @table @option
  2660. @item frequency, f
  2661. Change equalizer frequency.
  2662. Syntax for the command is : "@var{frequency}"
  2663. @item width_type, t
  2664. Change equalizer width_type.
  2665. Syntax for the command is : "@var{width_type}"
  2666. @item width, w
  2667. Change equalizer width.
  2668. Syntax for the command is : "@var{width}"
  2669. @item gain, g
  2670. Change equalizer gain.
  2671. Syntax for the command is : "@var{gain}"
  2672. @item mix, m
  2673. Change equalizer mix.
  2674. Syntax for the command is : "@var{mix}"
  2675. @end table
  2676. @section extrastereo
  2677. Linearly increases the difference between left and right channels which
  2678. adds some sort of "live" effect to playback.
  2679. The filter accepts the following options:
  2680. @table @option
  2681. @item m
  2682. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2683. (average of both channels), with 1.0 sound will be unchanged, with
  2684. -1.0 left and right channels will be swapped.
  2685. @item c
  2686. Enable clipping. By default is enabled.
  2687. @end table
  2688. @section firequalizer
  2689. Apply FIR Equalization using arbitrary frequency response.
  2690. The filter accepts the following option:
  2691. @table @option
  2692. @item gain
  2693. Set gain curve equation (in dB). The expression can contain variables:
  2694. @table @option
  2695. @item f
  2696. the evaluated frequency
  2697. @item sr
  2698. sample rate
  2699. @item ch
  2700. channel number, set to 0 when multichannels evaluation is disabled
  2701. @item chid
  2702. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2703. multichannels evaluation is disabled
  2704. @item chs
  2705. number of channels
  2706. @item chlayout
  2707. channel_layout, see libavutil/channel_layout.h
  2708. @end table
  2709. and functions:
  2710. @table @option
  2711. @item gain_interpolate(f)
  2712. interpolate gain on frequency f based on gain_entry
  2713. @item cubic_interpolate(f)
  2714. same as gain_interpolate, but smoother
  2715. @end table
  2716. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2717. @item gain_entry
  2718. Set gain entry for gain_interpolate function. The expression can
  2719. contain functions:
  2720. @table @option
  2721. @item entry(f, g)
  2722. store gain entry at frequency f with value g
  2723. @end table
  2724. This option is also available as command.
  2725. @item delay
  2726. Set filter delay in seconds. Higher value means more accurate.
  2727. Default is @code{0.01}.
  2728. @item accuracy
  2729. Set filter accuracy in Hz. Lower value means more accurate.
  2730. Default is @code{5}.
  2731. @item wfunc
  2732. Set window function. Acceptable values are:
  2733. @table @option
  2734. @item rectangular
  2735. rectangular window, useful when gain curve is already smooth
  2736. @item hann
  2737. hann window (default)
  2738. @item hamming
  2739. hamming window
  2740. @item blackman
  2741. blackman window
  2742. @item nuttall3
  2743. 3-terms continuous 1st derivative nuttall window
  2744. @item mnuttall3
  2745. minimum 3-terms discontinuous nuttall window
  2746. @item nuttall
  2747. 4-terms continuous 1st derivative nuttall window
  2748. @item bnuttall
  2749. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2750. @item bharris
  2751. blackman-harris window
  2752. @item tukey
  2753. tukey window
  2754. @end table
  2755. @item fixed
  2756. If enabled, use fixed number of audio samples. This improves speed when
  2757. filtering with large delay. Default is disabled.
  2758. @item multi
  2759. Enable multichannels evaluation on gain. Default is disabled.
  2760. @item zero_phase
  2761. Enable zero phase mode by subtracting timestamp to compensate delay.
  2762. Default is disabled.
  2763. @item scale
  2764. Set scale used by gain. Acceptable values are:
  2765. @table @option
  2766. @item linlin
  2767. linear frequency, linear gain
  2768. @item linlog
  2769. linear frequency, logarithmic (in dB) gain (default)
  2770. @item loglin
  2771. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2772. @item loglog
  2773. logarithmic frequency, logarithmic gain
  2774. @end table
  2775. @item dumpfile
  2776. Set file for dumping, suitable for gnuplot.
  2777. @item dumpscale
  2778. Set scale for dumpfile. Acceptable values are same with scale option.
  2779. Default is linlog.
  2780. @item fft2
  2781. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2782. Default is disabled.
  2783. @item min_phase
  2784. Enable minimum phase impulse response. Default is disabled.
  2785. @end table
  2786. @subsection Examples
  2787. @itemize
  2788. @item
  2789. lowpass at 1000 Hz:
  2790. @example
  2791. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2792. @end example
  2793. @item
  2794. lowpass at 1000 Hz with gain_entry:
  2795. @example
  2796. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2797. @end example
  2798. @item
  2799. custom equalization:
  2800. @example
  2801. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2802. @end example
  2803. @item
  2804. higher delay with zero phase to compensate delay:
  2805. @example
  2806. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2807. @end example
  2808. @item
  2809. lowpass on left channel, highpass on right channel:
  2810. @example
  2811. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2812. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2813. @end example
  2814. @end itemize
  2815. @section flanger
  2816. Apply a flanging effect to the audio.
  2817. The filter accepts the following options:
  2818. @table @option
  2819. @item delay
  2820. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2821. @item depth
  2822. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2823. @item regen
  2824. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2825. Default value is 0.
  2826. @item width
  2827. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2828. Default value is 71.
  2829. @item speed
  2830. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2831. @item shape
  2832. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2833. Default value is @var{sinusoidal}.
  2834. @item phase
  2835. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2836. Default value is 25.
  2837. @item interp
  2838. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2839. Default is @var{linear}.
  2840. @end table
  2841. @section haas
  2842. Apply Haas effect to audio.
  2843. Note that this makes most sense to apply on mono signals.
  2844. With this filter applied to mono signals it give some directionality and
  2845. stretches its stereo image.
  2846. The filter accepts the following options:
  2847. @table @option
  2848. @item level_in
  2849. Set input level. By default is @var{1}, or 0dB
  2850. @item level_out
  2851. Set output level. By default is @var{1}, or 0dB.
  2852. @item side_gain
  2853. Set gain applied to side part of signal. By default is @var{1}.
  2854. @item middle_source
  2855. Set kind of middle source. Can be one of the following:
  2856. @table @samp
  2857. @item left
  2858. Pick left channel.
  2859. @item right
  2860. Pick right channel.
  2861. @item mid
  2862. Pick middle part signal of stereo image.
  2863. @item side
  2864. Pick side part signal of stereo image.
  2865. @end table
  2866. @item middle_phase
  2867. Change middle phase. By default is disabled.
  2868. @item left_delay
  2869. Set left channel delay. By default is @var{2.05} milliseconds.
  2870. @item left_balance
  2871. Set left channel balance. By default is @var{-1}.
  2872. @item left_gain
  2873. Set left channel gain. By default is @var{1}.
  2874. @item left_phase
  2875. Change left phase. By default is disabled.
  2876. @item right_delay
  2877. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2878. @item right_balance
  2879. Set right channel balance. By default is @var{1}.
  2880. @item right_gain
  2881. Set right channel gain. By default is @var{1}.
  2882. @item right_phase
  2883. Change right phase. By default is enabled.
  2884. @end table
  2885. @section hdcd
  2886. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2887. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2888. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2889. of HDCD, and detects the Transient Filter flag.
  2890. @example
  2891. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2892. @end example
  2893. When using the filter with wav, note the default encoding for wav is 16-bit,
  2894. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2895. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2896. @example
  2897. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2898. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2899. @end example
  2900. The filter accepts the following options:
  2901. @table @option
  2902. @item disable_autoconvert
  2903. Disable any automatic format conversion or resampling in the filter graph.
  2904. @item process_stereo
  2905. Process the stereo channels together. If target_gain does not match between
  2906. channels, consider it invalid and use the last valid target_gain.
  2907. @item cdt_ms
  2908. Set the code detect timer period in ms.
  2909. @item force_pe
  2910. Always extend peaks above -3dBFS even if PE isn't signaled.
  2911. @item analyze_mode
  2912. Replace audio with a solid tone and adjust the amplitude to signal some
  2913. specific aspect of the decoding process. The output file can be loaded in
  2914. an audio editor alongside the original to aid analysis.
  2915. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2916. Modes are:
  2917. @table @samp
  2918. @item 0, off
  2919. Disabled
  2920. @item 1, lle
  2921. Gain adjustment level at each sample
  2922. @item 2, pe
  2923. Samples where peak extend occurs
  2924. @item 3, cdt
  2925. Samples where the code detect timer is active
  2926. @item 4, tgm
  2927. Samples where the target gain does not match between channels
  2928. @end table
  2929. @end table
  2930. @section headphone
  2931. Apply head-related transfer functions (HRTFs) to create virtual
  2932. loudspeakers around the user for binaural listening via headphones.
  2933. The HRIRs are provided via additional streams, for each channel
  2934. one stereo input stream is needed.
  2935. The filter accepts the following options:
  2936. @table @option
  2937. @item map
  2938. Set mapping of input streams for convolution.
  2939. The argument is a '|'-separated list of channel names in order as they
  2940. are given as additional stream inputs for filter.
  2941. This also specify number of input streams. Number of input streams
  2942. must be not less than number of channels in first stream plus one.
  2943. @item gain
  2944. Set gain applied to audio. Value is in dB. Default is 0.
  2945. @item type
  2946. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2947. processing audio in time domain which is slow.
  2948. @var{freq} is processing audio in frequency domain which is fast.
  2949. Default is @var{freq}.
  2950. @item lfe
  2951. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2952. @item size
  2953. Set size of frame in number of samples which will be processed at once.
  2954. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2955. @item hrir
  2956. Set format of hrir stream.
  2957. Default value is @var{stereo}. Alternative value is @var{multich}.
  2958. If value is set to @var{stereo}, number of additional streams should
  2959. be greater or equal to number of input channels in first input stream.
  2960. Also each additional stream should have stereo number of channels.
  2961. If value is set to @var{multich}, number of additional streams should
  2962. be exactly one. Also number of input channels of additional stream
  2963. should be equal or greater than twice number of channels of first input
  2964. stream.
  2965. @end table
  2966. @subsection Examples
  2967. @itemize
  2968. @item
  2969. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2970. each amovie filter use stereo file with IR coefficients as input.
  2971. The files give coefficients for each position of virtual loudspeaker:
  2972. @example
  2973. ffmpeg -i input.wav
  2974. -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"
  2975. output.wav
  2976. @end example
  2977. @item
  2978. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2979. but now in @var{multich} @var{hrir} format.
  2980. @example
  2981. 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"
  2982. output.wav
  2983. @end example
  2984. @end itemize
  2985. @section highpass
  2986. Apply a high-pass filter with 3dB point frequency.
  2987. The filter can be either single-pole, or double-pole (the default).
  2988. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2989. The filter accepts the following options:
  2990. @table @option
  2991. @item frequency, f
  2992. Set frequency in Hz. Default is 3000.
  2993. @item poles, p
  2994. Set number of poles. Default is 2.
  2995. @item width_type, t
  2996. Set method to specify band-width of filter.
  2997. @table @option
  2998. @item h
  2999. Hz
  3000. @item q
  3001. Q-Factor
  3002. @item o
  3003. octave
  3004. @item s
  3005. slope
  3006. @item k
  3007. kHz
  3008. @end table
  3009. @item width, w
  3010. Specify the band-width of a filter in width_type units.
  3011. Applies only to double-pole filter.
  3012. The default is 0.707q and gives a Butterworth response.
  3013. @item mix, m
  3014. How much to use filtered signal in output. Default is 1.
  3015. Range is between 0 and 1.
  3016. @item channels, c
  3017. Specify which channels to filter, by default all available are filtered.
  3018. @end table
  3019. @subsection Commands
  3020. This filter supports the following commands:
  3021. @table @option
  3022. @item frequency, f
  3023. Change highpass frequency.
  3024. Syntax for the command is : "@var{frequency}"
  3025. @item width_type, t
  3026. Change highpass width_type.
  3027. Syntax for the command is : "@var{width_type}"
  3028. @item width, w
  3029. Change highpass width.
  3030. Syntax for the command is : "@var{width}"
  3031. @item mix, m
  3032. Change highpass mix.
  3033. Syntax for the command is : "@var{mix}"
  3034. @end table
  3035. @section join
  3036. Join multiple input streams into one multi-channel stream.
  3037. It accepts the following parameters:
  3038. @table @option
  3039. @item inputs
  3040. The number of input streams. It defaults to 2.
  3041. @item channel_layout
  3042. The desired output channel layout. It defaults to stereo.
  3043. @item map
  3044. Map channels from inputs to output. The argument is a '|'-separated list of
  3045. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3046. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3047. can be either the name of the input channel (e.g. FL for front left) or its
  3048. index in the specified input stream. @var{out_channel} is the name of the output
  3049. channel.
  3050. @end table
  3051. The filter will attempt to guess the mappings when they are not specified
  3052. explicitly. It does so by first trying to find an unused matching input channel
  3053. and if that fails it picks the first unused input channel.
  3054. Join 3 inputs (with properly set channel layouts):
  3055. @example
  3056. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3057. @end example
  3058. Build a 5.1 output from 6 single-channel streams:
  3059. @example
  3060. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3061. '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'
  3062. out
  3063. @end example
  3064. @section ladspa
  3065. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3066. To enable compilation of this filter you need to configure FFmpeg with
  3067. @code{--enable-ladspa}.
  3068. @table @option
  3069. @item file, f
  3070. Specifies the name of LADSPA plugin library to load. If the environment
  3071. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3072. each one of the directories specified by the colon separated list in
  3073. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3074. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3075. @file{/usr/lib/ladspa/}.
  3076. @item plugin, p
  3077. Specifies the plugin within the library. Some libraries contain only
  3078. one plugin, but others contain many of them. If this is not set filter
  3079. will list all available plugins within the specified library.
  3080. @item controls, c
  3081. Set the '|' separated list of controls which are zero or more floating point
  3082. values that determine the behavior of the loaded plugin (for example delay,
  3083. threshold or gain).
  3084. Controls need to be defined using the following syntax:
  3085. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3086. @var{valuei} is the value set on the @var{i}-th control.
  3087. Alternatively they can be also defined using the following syntax:
  3088. @var{value0}|@var{value1}|@var{value2}|..., where
  3089. @var{valuei} is the value set on the @var{i}-th control.
  3090. If @option{controls} is set to @code{help}, all available controls and
  3091. their valid ranges are printed.
  3092. @item sample_rate, s
  3093. Specify the sample rate, default to 44100. Only used if plugin have
  3094. zero inputs.
  3095. @item nb_samples, n
  3096. Set the number of samples per channel per each output frame, default
  3097. is 1024. Only used if plugin have zero inputs.
  3098. @item duration, d
  3099. Set the minimum duration of the sourced audio. See
  3100. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3101. for the accepted syntax.
  3102. Note that the resulting duration may be greater than the specified duration,
  3103. as the generated audio is always cut at the end of a complete frame.
  3104. If not specified, or the expressed duration is negative, the audio is
  3105. supposed to be generated forever.
  3106. Only used if plugin have zero inputs.
  3107. @end table
  3108. @subsection Examples
  3109. @itemize
  3110. @item
  3111. List all available plugins within amp (LADSPA example plugin) library:
  3112. @example
  3113. ladspa=file=amp
  3114. @end example
  3115. @item
  3116. List all available controls and their valid ranges for @code{vcf_notch}
  3117. plugin from @code{VCF} library:
  3118. @example
  3119. ladspa=f=vcf:p=vcf_notch:c=help
  3120. @end example
  3121. @item
  3122. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3123. plugin library:
  3124. @example
  3125. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3126. @end example
  3127. @item
  3128. Add reverberation to the audio using TAP-plugins
  3129. (Tom's Audio Processing plugins):
  3130. @example
  3131. ladspa=file=tap_reverb:tap_reverb
  3132. @end example
  3133. @item
  3134. Generate white noise, with 0.2 amplitude:
  3135. @example
  3136. ladspa=file=cmt:noise_source_white:c=c0=.2
  3137. @end example
  3138. @item
  3139. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3140. @code{C* Audio Plugin Suite} (CAPS) library:
  3141. @example
  3142. ladspa=file=caps:Click:c=c1=20'
  3143. @end example
  3144. @item
  3145. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3146. @example
  3147. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3148. @end example
  3149. @item
  3150. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3151. @code{SWH Plugins} collection:
  3152. @example
  3153. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3154. @end example
  3155. @item
  3156. Attenuate low frequencies using Multiband EQ from Steve Harris
  3157. @code{SWH Plugins} collection:
  3158. @example
  3159. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3160. @end example
  3161. @item
  3162. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3163. (CAPS) library:
  3164. @example
  3165. ladspa=caps:Narrower
  3166. @end example
  3167. @item
  3168. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3169. @example
  3170. ladspa=caps:White:.2
  3171. @end example
  3172. @item
  3173. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3174. @example
  3175. ladspa=caps:Fractal:c=c1=1
  3176. @end example
  3177. @item
  3178. Dynamic volume normalization using @code{VLevel} plugin:
  3179. @example
  3180. ladspa=vlevel-ladspa:vlevel_mono
  3181. @end example
  3182. @end itemize
  3183. @subsection Commands
  3184. This filter supports the following commands:
  3185. @table @option
  3186. @item cN
  3187. Modify the @var{N}-th control value.
  3188. If the specified value is not valid, it is ignored and prior one is kept.
  3189. @end table
  3190. @section loudnorm
  3191. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3192. Support for both single pass (livestreams, files) and double pass (files) modes.
  3193. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  3194. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  3195. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3196. The filter accepts the following options:
  3197. @table @option
  3198. @item I, i
  3199. Set integrated loudness target.
  3200. Range is -70.0 - -5.0. Default value is -24.0.
  3201. @item LRA, lra
  3202. Set loudness range target.
  3203. Range is 1.0 - 20.0. Default value is 7.0.
  3204. @item TP, tp
  3205. Set maximum true peak.
  3206. Range is -9.0 - +0.0. Default value is -2.0.
  3207. @item measured_I, measured_i
  3208. Measured IL of input file.
  3209. Range is -99.0 - +0.0.
  3210. @item measured_LRA, measured_lra
  3211. Measured LRA of input file.
  3212. Range is 0.0 - 99.0.
  3213. @item measured_TP, measured_tp
  3214. Measured true peak of input file.
  3215. Range is -99.0 - +99.0.
  3216. @item measured_thresh
  3217. Measured threshold of input file.
  3218. Range is -99.0 - +0.0.
  3219. @item offset
  3220. Set offset gain. Gain is applied before the true-peak limiter.
  3221. Range is -99.0 - +99.0. Default is +0.0.
  3222. @item linear
  3223. Normalize linearly if possible.
  3224. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  3225. to be specified in order to use this mode.
  3226. Options are true or false. Default is true.
  3227. @item dual_mono
  3228. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3229. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3230. If set to @code{true}, this option will compensate for this effect.
  3231. Multi-channel input files are not affected by this option.
  3232. Options are true or false. Default is false.
  3233. @item print_format
  3234. Set print format for stats. Options are summary, json, or none.
  3235. Default value is none.
  3236. @end table
  3237. @section lowpass
  3238. Apply a low-pass filter with 3dB point frequency.
  3239. The filter can be either single-pole or double-pole (the default).
  3240. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3241. The filter accepts the following options:
  3242. @table @option
  3243. @item frequency, f
  3244. Set frequency in Hz. Default is 500.
  3245. @item poles, p
  3246. Set number of poles. Default is 2.
  3247. @item width_type, t
  3248. Set method to specify band-width of filter.
  3249. @table @option
  3250. @item h
  3251. Hz
  3252. @item q
  3253. Q-Factor
  3254. @item o
  3255. octave
  3256. @item s
  3257. slope
  3258. @item k
  3259. kHz
  3260. @end table
  3261. @item width, w
  3262. Specify the band-width of a filter in width_type units.
  3263. Applies only to double-pole filter.
  3264. The default is 0.707q and gives a Butterworth response.
  3265. @item mix, m
  3266. How much to use filtered signal in output. Default is 1.
  3267. Range is between 0 and 1.
  3268. @item channels, c
  3269. Specify which channels to filter, by default all available are filtered.
  3270. @end table
  3271. @subsection Examples
  3272. @itemize
  3273. @item
  3274. Lowpass only LFE channel, it LFE is not present it does nothing:
  3275. @example
  3276. lowpass=c=LFE
  3277. @end example
  3278. @end itemize
  3279. @subsection Commands
  3280. This filter supports the following commands:
  3281. @table @option
  3282. @item frequency, f
  3283. Change lowpass frequency.
  3284. Syntax for the command is : "@var{frequency}"
  3285. @item width_type, t
  3286. Change lowpass width_type.
  3287. Syntax for the command is : "@var{width_type}"
  3288. @item width, w
  3289. Change lowpass width.
  3290. Syntax for the command is : "@var{width}"
  3291. @item mix, m
  3292. Change lowpass mix.
  3293. Syntax for the command is : "@var{mix}"
  3294. @end table
  3295. @section lv2
  3296. Load a LV2 (LADSPA Version 2) plugin.
  3297. To enable compilation of this filter you need to configure FFmpeg with
  3298. @code{--enable-lv2}.
  3299. @table @option
  3300. @item plugin, p
  3301. Specifies the plugin URI. You may need to escape ':'.
  3302. @item controls, c
  3303. Set the '|' separated list of controls which are zero or more floating point
  3304. values that determine the behavior of the loaded plugin (for example delay,
  3305. threshold or gain).
  3306. If @option{controls} is set to @code{help}, all available controls and
  3307. their valid ranges are printed.
  3308. @item sample_rate, s
  3309. Specify the sample rate, default to 44100. Only used if plugin have
  3310. zero inputs.
  3311. @item nb_samples, n
  3312. Set the number of samples per channel per each output frame, default
  3313. is 1024. Only used if plugin have zero inputs.
  3314. @item duration, d
  3315. Set the minimum duration of the sourced audio. See
  3316. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3317. for the accepted syntax.
  3318. Note that the resulting duration may be greater than the specified duration,
  3319. as the generated audio is always cut at the end of a complete frame.
  3320. If not specified, or the expressed duration is negative, the audio is
  3321. supposed to be generated forever.
  3322. Only used if plugin have zero inputs.
  3323. @end table
  3324. @subsection Examples
  3325. @itemize
  3326. @item
  3327. Apply bass enhancer plugin from Calf:
  3328. @example
  3329. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3330. @end example
  3331. @item
  3332. Apply vinyl plugin from Calf:
  3333. @example
  3334. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3335. @end example
  3336. @item
  3337. Apply bit crusher plugin from ArtyFX:
  3338. @example
  3339. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3340. @end example
  3341. @end itemize
  3342. @section mcompand
  3343. Multiband Compress or expand the audio's dynamic range.
  3344. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3345. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3346. response when absent compander action.
  3347. It accepts the following parameters:
  3348. @table @option
  3349. @item args
  3350. This option syntax is:
  3351. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3352. For explanation of each item refer to compand filter documentation.
  3353. @end table
  3354. @anchor{pan}
  3355. @section pan
  3356. Mix channels with specific gain levels. The filter accepts the output
  3357. channel layout followed by a set of channels definitions.
  3358. This filter is also designed to efficiently remap the channels of an audio
  3359. stream.
  3360. The filter accepts parameters of the form:
  3361. "@var{l}|@var{outdef}|@var{outdef}|..."
  3362. @table @option
  3363. @item l
  3364. output channel layout or number of channels
  3365. @item outdef
  3366. output channel specification, of the form:
  3367. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3368. @item out_name
  3369. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3370. number (c0, c1, etc.)
  3371. @item gain
  3372. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3373. @item in_name
  3374. input channel to use, see out_name for details; it is not possible to mix
  3375. named and numbered input channels
  3376. @end table
  3377. If the `=' in a channel specification is replaced by `<', then the gains for
  3378. that specification will be renormalized so that the total is 1, thus
  3379. avoiding clipping noise.
  3380. @subsection Mixing examples
  3381. For example, if you want to down-mix from stereo to mono, but with a bigger
  3382. factor for the left channel:
  3383. @example
  3384. pan=1c|c0=0.9*c0+0.1*c1
  3385. @end example
  3386. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3387. 7-channels surround:
  3388. @example
  3389. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3390. @end example
  3391. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3392. that should be preferred (see "-ac" option) unless you have very specific
  3393. needs.
  3394. @subsection Remapping examples
  3395. The channel remapping will be effective if, and only if:
  3396. @itemize
  3397. @item gain coefficients are zeroes or ones,
  3398. @item only one input per channel output,
  3399. @end itemize
  3400. If all these conditions are satisfied, the filter will notify the user ("Pure
  3401. channel mapping detected"), and use an optimized and lossless method to do the
  3402. remapping.
  3403. For example, if you have a 5.1 source and want a stereo audio stream by
  3404. dropping the extra channels:
  3405. @example
  3406. pan="stereo| c0=FL | c1=FR"
  3407. @end example
  3408. Given the same source, you can also switch front left and front right channels
  3409. and keep the input channel layout:
  3410. @example
  3411. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3412. @end example
  3413. If the input is a stereo audio stream, you can mute the front left channel (and
  3414. still keep the stereo channel layout) with:
  3415. @example
  3416. pan="stereo|c1=c1"
  3417. @end example
  3418. Still with a stereo audio stream input, you can copy the right channel in both
  3419. front left and right:
  3420. @example
  3421. pan="stereo| c0=FR | c1=FR"
  3422. @end example
  3423. @section replaygain
  3424. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3425. outputs it unchanged.
  3426. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3427. @section resample
  3428. Convert the audio sample format, sample rate and channel layout. It is
  3429. not meant to be used directly.
  3430. @section rubberband
  3431. Apply time-stretching and pitch-shifting with librubberband.
  3432. To enable compilation of this filter, you need to configure FFmpeg with
  3433. @code{--enable-librubberband}.
  3434. The filter accepts the following options:
  3435. @table @option
  3436. @item tempo
  3437. Set tempo scale factor.
  3438. @item pitch
  3439. Set pitch scale factor.
  3440. @item transients
  3441. Set transients detector.
  3442. Possible values are:
  3443. @table @var
  3444. @item crisp
  3445. @item mixed
  3446. @item smooth
  3447. @end table
  3448. @item detector
  3449. Set detector.
  3450. Possible values are:
  3451. @table @var
  3452. @item compound
  3453. @item percussive
  3454. @item soft
  3455. @end table
  3456. @item phase
  3457. Set phase.
  3458. Possible values are:
  3459. @table @var
  3460. @item laminar
  3461. @item independent
  3462. @end table
  3463. @item window
  3464. Set processing window size.
  3465. Possible values are:
  3466. @table @var
  3467. @item standard
  3468. @item short
  3469. @item long
  3470. @end table
  3471. @item smoothing
  3472. Set smoothing.
  3473. Possible values are:
  3474. @table @var
  3475. @item off
  3476. @item on
  3477. @end table
  3478. @item formant
  3479. Enable formant preservation when shift pitching.
  3480. Possible values are:
  3481. @table @var
  3482. @item shifted
  3483. @item preserved
  3484. @end table
  3485. @item pitchq
  3486. Set pitch quality.
  3487. Possible values are:
  3488. @table @var
  3489. @item quality
  3490. @item speed
  3491. @item consistency
  3492. @end table
  3493. @item channels
  3494. Set channels.
  3495. Possible values are:
  3496. @table @var
  3497. @item apart
  3498. @item together
  3499. @end table
  3500. @end table
  3501. @subsection Commands
  3502. This filter supports the following commands:
  3503. @table @option
  3504. @item tempo
  3505. Change filter tempo scale factor.
  3506. Syntax for the command is : "@var{tempo}"
  3507. @item pitch
  3508. Change filter pitch scale factor.
  3509. Syntax for the command is : "@var{pitch}"
  3510. @end table
  3511. @section sidechaincompress
  3512. This filter acts like normal compressor but has the ability to compress
  3513. detected signal using second input signal.
  3514. It needs two input streams and returns one output stream.
  3515. First input stream will be processed depending on second stream signal.
  3516. The filtered signal then can be filtered with other filters in later stages of
  3517. processing. See @ref{pan} and @ref{amerge} filter.
  3518. The filter accepts the following options:
  3519. @table @option
  3520. @item level_in
  3521. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3522. @item mode
  3523. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3524. Default is @code{downward}.
  3525. @item threshold
  3526. If a signal of second stream raises above this level it will affect the gain
  3527. reduction of first stream.
  3528. By default is 0.125. Range is between 0.00097563 and 1.
  3529. @item ratio
  3530. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3531. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3532. Default is 2. Range is between 1 and 20.
  3533. @item attack
  3534. Amount of milliseconds the signal has to rise above the threshold before gain
  3535. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3536. @item release
  3537. Amount of milliseconds the signal has to fall below the threshold before
  3538. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3539. @item makeup
  3540. Set the amount by how much signal will be amplified after processing.
  3541. Default is 1. Range is from 1 to 64.
  3542. @item knee
  3543. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3544. Default is 2.82843. Range is between 1 and 8.
  3545. @item link
  3546. Choose if the @code{average} level between all channels of side-chain stream
  3547. or the louder(@code{maximum}) channel of side-chain stream affects the
  3548. reduction. Default is @code{average}.
  3549. @item detection
  3550. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3551. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3552. @item level_sc
  3553. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3554. @item mix
  3555. How much to use compressed signal in output. Default is 1.
  3556. Range is between 0 and 1.
  3557. @end table
  3558. @subsection Examples
  3559. @itemize
  3560. @item
  3561. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3562. depending on the signal of 2nd input and later compressed signal to be
  3563. merged with 2nd input:
  3564. @example
  3565. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3566. @end example
  3567. @end itemize
  3568. @section sidechaingate
  3569. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3570. filter the detected signal before sending it to the gain reduction stage.
  3571. Normally a gate uses the full range signal to detect a level above the
  3572. threshold.
  3573. For example: If you cut all lower frequencies from your sidechain signal
  3574. the gate will decrease the volume of your track only if not enough highs
  3575. appear. With this technique you are able to reduce the resonation of a
  3576. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3577. guitar.
  3578. It needs two input streams and returns one output stream.
  3579. First input stream will be processed depending on second stream signal.
  3580. The filter accepts the following options:
  3581. @table @option
  3582. @item level_in
  3583. Set input level before filtering.
  3584. Default is 1. Allowed range is from 0.015625 to 64.
  3585. @item mode
  3586. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3587. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3588. will be amplified, expanding dynamic range in upward direction.
  3589. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3590. @item range
  3591. Set the level of gain reduction when the signal is below the threshold.
  3592. Default is 0.06125. Allowed range is from 0 to 1.
  3593. Setting this to 0 disables reduction and then filter behaves like expander.
  3594. @item threshold
  3595. If a signal rises above this level the gain reduction is released.
  3596. Default is 0.125. Allowed range is from 0 to 1.
  3597. @item ratio
  3598. Set a ratio about which the signal is reduced.
  3599. Default is 2. Allowed range is from 1 to 9000.
  3600. @item attack
  3601. Amount of milliseconds the signal has to rise above the threshold before gain
  3602. reduction stops.
  3603. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3604. @item release
  3605. Amount of milliseconds the signal has to fall below the threshold before the
  3606. reduction is increased again. Default is 250 milliseconds.
  3607. Allowed range is from 0.01 to 9000.
  3608. @item makeup
  3609. Set amount of amplification of signal after processing.
  3610. Default is 1. Allowed range is from 1 to 64.
  3611. @item knee
  3612. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3613. Default is 2.828427125. Allowed range is from 1 to 8.
  3614. @item detection
  3615. Choose if exact signal should be taken for detection or an RMS like one.
  3616. Default is rms. Can be peak or rms.
  3617. @item link
  3618. Choose if the average level between all channels or the louder channel affects
  3619. the reduction.
  3620. Default is average. Can be average or maximum.
  3621. @item level_sc
  3622. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3623. @end table
  3624. @section silencedetect
  3625. Detect silence in an audio stream.
  3626. This filter logs a message when it detects that the input audio volume is less
  3627. or equal to a noise tolerance value for a duration greater or equal to the
  3628. minimum detected noise duration.
  3629. The printed times and duration are expressed in seconds.
  3630. The filter accepts the following options:
  3631. @table @option
  3632. @item noise, n
  3633. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3634. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3635. @item duration, d
  3636. Set silence duration until notification (default is 2 seconds).
  3637. @item mono, m
  3638. Process each channel separately, instead of combined. By default is disabled.
  3639. @end table
  3640. @subsection Examples
  3641. @itemize
  3642. @item
  3643. Detect 5 seconds of silence with -50dB noise tolerance:
  3644. @example
  3645. silencedetect=n=-50dB:d=5
  3646. @end example
  3647. @item
  3648. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3649. tolerance in @file{silence.mp3}:
  3650. @example
  3651. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3652. @end example
  3653. @end itemize
  3654. @section silenceremove
  3655. Remove silence from the beginning, middle or end of the audio.
  3656. The filter accepts the following options:
  3657. @table @option
  3658. @item start_periods
  3659. This value is used to indicate if audio should be trimmed at beginning of
  3660. the audio. A value of zero indicates no silence should be trimmed from the
  3661. beginning. When specifying a non-zero value, it trims audio up until it
  3662. finds non-silence. Normally, when trimming silence from beginning of audio
  3663. the @var{start_periods} will be @code{1} but it can be increased to higher
  3664. values to trim all audio up to specific count of non-silence periods.
  3665. Default value is @code{0}.
  3666. @item start_duration
  3667. Specify the amount of time that non-silence must be detected before it stops
  3668. trimming audio. By increasing the duration, bursts of noises can be treated
  3669. as silence and trimmed off. Default value is @code{0}.
  3670. @item start_threshold
  3671. This indicates what sample value should be treated as silence. For digital
  3672. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3673. you may wish to increase the value to account for background noise.
  3674. Can be specified in dB (in case "dB" is appended to the specified value)
  3675. or amplitude ratio. Default value is @code{0}.
  3676. @item start_silence
  3677. Specify max duration of silence at beginning that will be kept after
  3678. trimming. Default is 0, which is equal to trimming all samples detected
  3679. as silence.
  3680. @item start_mode
  3681. Specify mode of detection of silence end in start of multi-channel audio.
  3682. Can be @var{any} or @var{all}. Default is @var{any}.
  3683. With @var{any}, any sample that is detected as non-silence will cause
  3684. stopped trimming of silence.
  3685. With @var{all}, only if all channels are detected as non-silence will cause
  3686. stopped trimming of silence.
  3687. @item stop_periods
  3688. Set the count for trimming silence from the end of audio.
  3689. To remove silence from the middle of a file, specify a @var{stop_periods}
  3690. that is negative. This value is then treated as a positive value and is
  3691. used to indicate the effect should restart processing as specified by
  3692. @var{start_periods}, making it suitable for removing periods of silence
  3693. in the middle of the audio.
  3694. Default value is @code{0}.
  3695. @item stop_duration
  3696. Specify a duration of silence that must exist before audio is not copied any
  3697. more. By specifying a higher duration, silence that is wanted can be left in
  3698. the audio.
  3699. Default value is @code{0}.
  3700. @item stop_threshold
  3701. This is the same as @option{start_threshold} but for trimming silence from
  3702. the end of audio.
  3703. Can be specified in dB (in case "dB" is appended to the specified value)
  3704. or amplitude ratio. Default value is @code{0}.
  3705. @item stop_silence
  3706. Specify max duration of silence at end that will be kept after
  3707. trimming. Default is 0, which is equal to trimming all samples detected
  3708. as silence.
  3709. @item stop_mode
  3710. Specify mode of detection of silence start in end of multi-channel audio.
  3711. Can be @var{any} or @var{all}. Default is @var{any}.
  3712. With @var{any}, any sample that is detected as non-silence will cause
  3713. stopped trimming of silence.
  3714. With @var{all}, only if all channels are detected as non-silence will cause
  3715. stopped trimming of silence.
  3716. @item detection
  3717. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3718. and works better with digital silence which is exactly 0.
  3719. Default value is @code{rms}.
  3720. @item window
  3721. Set duration in number of seconds used to calculate size of window in number
  3722. of samples for detecting silence.
  3723. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3724. @end table
  3725. @subsection Examples
  3726. @itemize
  3727. @item
  3728. The following example shows how this filter can be used to start a recording
  3729. that does not contain the delay at the start which usually occurs between
  3730. pressing the record button and the start of the performance:
  3731. @example
  3732. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3733. @end example
  3734. @item
  3735. Trim all silence encountered from beginning to end where there is more than 1
  3736. second of silence in audio:
  3737. @example
  3738. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3739. @end example
  3740. @item
  3741. Trim all digital silence samples, using peak detection, from beginning to end
  3742. where there is more than 0 samples of digital silence in audio and digital
  3743. silence is detected in all channels at same positions in stream:
  3744. @example
  3745. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  3746. @end example
  3747. @end itemize
  3748. @section sofalizer
  3749. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3750. loudspeakers around the user for binaural listening via headphones (audio
  3751. formats up to 9 channels supported).
  3752. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3753. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3754. Austrian Academy of Sciences.
  3755. To enable compilation of this filter you need to configure FFmpeg with
  3756. @code{--enable-libmysofa}.
  3757. The filter accepts the following options:
  3758. @table @option
  3759. @item sofa
  3760. Set the SOFA file used for rendering.
  3761. @item gain
  3762. Set gain applied to audio. Value is in dB. Default is 0.
  3763. @item rotation
  3764. Set rotation of virtual loudspeakers in deg. Default is 0.
  3765. @item elevation
  3766. Set elevation of virtual speakers in deg. Default is 0.
  3767. @item radius
  3768. Set distance in meters between loudspeakers and the listener with near-field
  3769. HRTFs. Default is 1.
  3770. @item type
  3771. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3772. processing audio in time domain which is slow.
  3773. @var{freq} is processing audio in frequency domain which is fast.
  3774. Default is @var{freq}.
  3775. @item speakers
  3776. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3777. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3778. Each virtual loudspeaker is described with short channel name following with
  3779. azimuth and elevation in degrees.
  3780. Each virtual loudspeaker description is separated by '|'.
  3781. For example to override front left and front right channel positions use:
  3782. 'speakers=FL 45 15|FR 345 15'.
  3783. Descriptions with unrecognised channel names are ignored.
  3784. @item lfegain
  3785. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3786. @item framesize
  3787. Set custom frame size in number of samples. Default is 1024.
  3788. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3789. is set to @var{freq}.
  3790. @item normalize
  3791. Should all IRs be normalized upon importing SOFA file.
  3792. By default is enabled.
  3793. @item interpolate
  3794. Should nearest IRs be interpolated with neighbor IRs if exact position
  3795. does not match. By default is disabled.
  3796. @item minphase
  3797. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3798. @item anglestep
  3799. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3800. @item radstep
  3801. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3802. @end table
  3803. @subsection Examples
  3804. @itemize
  3805. @item
  3806. Using ClubFritz6 sofa file:
  3807. @example
  3808. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3809. @end example
  3810. @item
  3811. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3812. @example
  3813. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3814. @end example
  3815. @item
  3816. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3817. and also with custom gain:
  3818. @example
  3819. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3820. @end example
  3821. @end itemize
  3822. @section stereotools
  3823. This filter has some handy utilities to manage stereo signals, for converting
  3824. M/S stereo recordings to L/R signal while having control over the parameters
  3825. or spreading the stereo image of master track.
  3826. The filter accepts the following options:
  3827. @table @option
  3828. @item level_in
  3829. Set input level before filtering for both channels. Defaults is 1.
  3830. Allowed range is from 0.015625 to 64.
  3831. @item level_out
  3832. Set output level after filtering for both channels. Defaults is 1.
  3833. Allowed range is from 0.015625 to 64.
  3834. @item balance_in
  3835. Set input balance between both channels. Default is 0.
  3836. Allowed range is from -1 to 1.
  3837. @item balance_out
  3838. Set output balance between both channels. Default is 0.
  3839. Allowed range is from -1 to 1.
  3840. @item softclip
  3841. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3842. clipping. Disabled by default.
  3843. @item mutel
  3844. Mute the left channel. Disabled by default.
  3845. @item muter
  3846. Mute the right channel. Disabled by default.
  3847. @item phasel
  3848. Change the phase of the left channel. Disabled by default.
  3849. @item phaser
  3850. Change the phase of the right channel. Disabled by default.
  3851. @item mode
  3852. Set stereo mode. Available values are:
  3853. @table @samp
  3854. @item lr>lr
  3855. Left/Right to Left/Right, this is default.
  3856. @item lr>ms
  3857. Left/Right to Mid/Side.
  3858. @item ms>lr
  3859. Mid/Side to Left/Right.
  3860. @item lr>ll
  3861. Left/Right to Left/Left.
  3862. @item lr>rr
  3863. Left/Right to Right/Right.
  3864. @item lr>l+r
  3865. Left/Right to Left + Right.
  3866. @item lr>rl
  3867. Left/Right to Right/Left.
  3868. @item ms>ll
  3869. Mid/Side to Left/Left.
  3870. @item ms>rr
  3871. Mid/Side to Right/Right.
  3872. @end table
  3873. @item slev
  3874. Set level of side signal. Default is 1.
  3875. Allowed range is from 0.015625 to 64.
  3876. @item sbal
  3877. Set balance of side signal. Default is 0.
  3878. Allowed range is from -1 to 1.
  3879. @item mlev
  3880. Set level of the middle signal. Default is 1.
  3881. Allowed range is from 0.015625 to 64.
  3882. @item mpan
  3883. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3884. @item base
  3885. Set stereo base between mono and inversed channels. Default is 0.
  3886. Allowed range is from -1 to 1.
  3887. @item delay
  3888. Set delay in milliseconds how much to delay left from right channel and
  3889. vice versa. Default is 0. Allowed range is from -20 to 20.
  3890. @item sclevel
  3891. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3892. @item phase
  3893. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3894. @item bmode_in, bmode_out
  3895. Set balance mode for balance_in/balance_out option.
  3896. Can be one of the following:
  3897. @table @samp
  3898. @item balance
  3899. Classic balance mode. Attenuate one channel at time.
  3900. Gain is raised up to 1.
  3901. @item amplitude
  3902. Similar as classic mode above but gain is raised up to 2.
  3903. @item power
  3904. Equal power distribution, from -6dB to +6dB range.
  3905. @end table
  3906. @end table
  3907. @subsection Examples
  3908. @itemize
  3909. @item
  3910. Apply karaoke like effect:
  3911. @example
  3912. stereotools=mlev=0.015625
  3913. @end example
  3914. @item
  3915. Convert M/S signal to L/R:
  3916. @example
  3917. "stereotools=mode=ms>lr"
  3918. @end example
  3919. @end itemize
  3920. @section stereowiden
  3921. This filter enhance the stereo effect by suppressing signal common to both
  3922. channels and by delaying the signal of left into right and vice versa,
  3923. thereby widening the stereo effect.
  3924. The filter accepts the following options:
  3925. @table @option
  3926. @item delay
  3927. Time in milliseconds of the delay of left signal into right and vice versa.
  3928. Default is 20 milliseconds.
  3929. @item feedback
  3930. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3931. effect of left signal in right output and vice versa which gives widening
  3932. effect. Default is 0.3.
  3933. @item crossfeed
  3934. Cross feed of left into right with inverted phase. This helps in suppressing
  3935. the mono. If the value is 1 it will cancel all the signal common to both
  3936. channels. Default is 0.3.
  3937. @item drymix
  3938. Set level of input signal of original channel. Default is 0.8.
  3939. @end table
  3940. @section superequalizer
  3941. Apply 18 band equalizer.
  3942. The filter accepts the following options:
  3943. @table @option
  3944. @item 1b
  3945. Set 65Hz band gain.
  3946. @item 2b
  3947. Set 92Hz band gain.
  3948. @item 3b
  3949. Set 131Hz band gain.
  3950. @item 4b
  3951. Set 185Hz band gain.
  3952. @item 5b
  3953. Set 262Hz band gain.
  3954. @item 6b
  3955. Set 370Hz band gain.
  3956. @item 7b
  3957. Set 523Hz band gain.
  3958. @item 8b
  3959. Set 740Hz band gain.
  3960. @item 9b
  3961. Set 1047Hz band gain.
  3962. @item 10b
  3963. Set 1480Hz band gain.
  3964. @item 11b
  3965. Set 2093Hz band gain.
  3966. @item 12b
  3967. Set 2960Hz band gain.
  3968. @item 13b
  3969. Set 4186Hz band gain.
  3970. @item 14b
  3971. Set 5920Hz band gain.
  3972. @item 15b
  3973. Set 8372Hz band gain.
  3974. @item 16b
  3975. Set 11840Hz band gain.
  3976. @item 17b
  3977. Set 16744Hz band gain.
  3978. @item 18b
  3979. Set 20000Hz band gain.
  3980. @end table
  3981. @section surround
  3982. Apply audio surround upmix filter.
  3983. This filter allows to produce multichannel output from audio stream.
  3984. The filter accepts the following options:
  3985. @table @option
  3986. @item chl_out
  3987. Set output channel layout. By default, this is @var{5.1}.
  3988. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3989. for the required syntax.
  3990. @item chl_in
  3991. Set input channel layout. By default, this is @var{stereo}.
  3992. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3993. for the required syntax.
  3994. @item level_in
  3995. Set input volume level. By default, this is @var{1}.
  3996. @item level_out
  3997. Set output volume level. By default, this is @var{1}.
  3998. @item lfe
  3999. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  4000. @item lfe_low
  4001. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  4002. @item lfe_high
  4003. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  4004. @item lfe_mode
  4005. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  4006. In @var{add} mode, LFE channel is created from input audio and added to output.
  4007. In @var{sub} mode, LFE channel is created from input audio and added to output but
  4008. also all non-LFE output channels are subtracted with output LFE channel.
  4009. @item angle
  4010. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  4011. Default is @var{90}.
  4012. @item fc_in
  4013. Set front center input volume. By default, this is @var{1}.
  4014. @item fc_out
  4015. Set front center output volume. By default, this is @var{1}.
  4016. @item fl_in
  4017. Set front left input volume. By default, this is @var{1}.
  4018. @item fl_out
  4019. Set front left output volume. By default, this is @var{1}.
  4020. @item fr_in
  4021. Set front right input volume. By default, this is @var{1}.
  4022. @item fr_out
  4023. Set front right output volume. By default, this is @var{1}.
  4024. @item sl_in
  4025. Set side left input volume. By default, this is @var{1}.
  4026. @item sl_out
  4027. Set side left output volume. By default, this is @var{1}.
  4028. @item sr_in
  4029. Set side right input volume. By default, this is @var{1}.
  4030. @item sr_out
  4031. Set side right output volume. By default, this is @var{1}.
  4032. @item bl_in
  4033. Set back left input volume. By default, this is @var{1}.
  4034. @item bl_out
  4035. Set back left output volume. By default, this is @var{1}.
  4036. @item br_in
  4037. Set back right input volume. By default, this is @var{1}.
  4038. @item br_out
  4039. Set back right output volume. By default, this is @var{1}.
  4040. @item bc_in
  4041. Set back center input volume. By default, this is @var{1}.
  4042. @item bc_out
  4043. Set back center output volume. By default, this is @var{1}.
  4044. @item lfe_in
  4045. Set LFE input volume. By default, this is @var{1}.
  4046. @item lfe_out
  4047. Set LFE output volume. By default, this is @var{1}.
  4048. @item allx
  4049. Set spread usage of stereo image across X axis for all channels.
  4050. @item ally
  4051. Set spread usage of stereo image across Y axis for all channels.
  4052. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4053. Set spread usage of stereo image across X axis for each channel.
  4054. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4055. Set spread usage of stereo image across Y axis for each channel.
  4056. @item win_size
  4057. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4058. @item win_func
  4059. Set window function.
  4060. It accepts the following values:
  4061. @table @samp
  4062. @item rect
  4063. @item bartlett
  4064. @item hann, hanning
  4065. @item hamming
  4066. @item blackman
  4067. @item welch
  4068. @item flattop
  4069. @item bharris
  4070. @item bnuttall
  4071. @item bhann
  4072. @item sine
  4073. @item nuttall
  4074. @item lanczos
  4075. @item gauss
  4076. @item tukey
  4077. @item dolph
  4078. @item cauchy
  4079. @item parzen
  4080. @item poisson
  4081. @item bohman
  4082. @end table
  4083. Default is @code{hann}.
  4084. @item overlap
  4085. Set window overlap. If set to 1, the recommended overlap for selected
  4086. window function will be picked. Default is @code{0.5}.
  4087. @end table
  4088. @section treble, highshelf
  4089. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4090. shelving filter with a response similar to that of a standard
  4091. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4092. The filter accepts the following options:
  4093. @table @option
  4094. @item gain, g
  4095. Give the gain at whichever is the lower of ~22 kHz and the
  4096. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4097. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4098. @item frequency, f
  4099. Set the filter's central frequency and so can be used
  4100. to extend or reduce the frequency range to be boosted or cut.
  4101. The default value is @code{3000} Hz.
  4102. @item width_type, t
  4103. Set method to specify band-width of filter.
  4104. @table @option
  4105. @item h
  4106. Hz
  4107. @item q
  4108. Q-Factor
  4109. @item o
  4110. octave
  4111. @item s
  4112. slope
  4113. @item k
  4114. kHz
  4115. @end table
  4116. @item width, w
  4117. Determine how steep is the filter's shelf transition.
  4118. @item mix, m
  4119. How much to use filtered signal in output. Default is 1.
  4120. Range is between 0 and 1.
  4121. @item channels, c
  4122. Specify which channels to filter, by default all available are filtered.
  4123. @end table
  4124. @subsection Commands
  4125. This filter supports the following commands:
  4126. @table @option
  4127. @item frequency, f
  4128. Change treble frequency.
  4129. Syntax for the command is : "@var{frequency}"
  4130. @item width_type, t
  4131. Change treble width_type.
  4132. Syntax for the command is : "@var{width_type}"
  4133. @item width, w
  4134. Change treble width.
  4135. Syntax for the command is : "@var{width}"
  4136. @item gain, g
  4137. Change treble gain.
  4138. Syntax for the command is : "@var{gain}"
  4139. @item mix, m
  4140. Change treble mix.
  4141. Syntax for the command is : "@var{mix}"
  4142. @end table
  4143. @section tremolo
  4144. Sinusoidal amplitude modulation.
  4145. The filter accepts the following options:
  4146. @table @option
  4147. @item f
  4148. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4149. (20 Hz or lower) will result in a tremolo effect.
  4150. This filter may also be used as a ring modulator by specifying
  4151. a modulation frequency higher than 20 Hz.
  4152. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4153. @item d
  4154. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4155. Default value is 0.5.
  4156. @end table
  4157. @section vibrato
  4158. Sinusoidal phase modulation.
  4159. The filter accepts the following options:
  4160. @table @option
  4161. @item f
  4162. Modulation frequency in Hertz.
  4163. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4164. @item d
  4165. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4166. Default value is 0.5.
  4167. @end table
  4168. @section volume
  4169. Adjust the input audio volume.
  4170. It accepts the following parameters:
  4171. @table @option
  4172. @item volume
  4173. Set audio volume expression.
  4174. Output values are clipped to the maximum value.
  4175. The output audio volume is given by the relation:
  4176. @example
  4177. @var{output_volume} = @var{volume} * @var{input_volume}
  4178. @end example
  4179. The default value for @var{volume} is "1.0".
  4180. @item precision
  4181. This parameter represents the mathematical precision.
  4182. It determines which input sample formats will be allowed, which affects the
  4183. precision of the volume scaling.
  4184. @table @option
  4185. @item fixed
  4186. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4187. @item float
  4188. 32-bit floating-point; this limits input sample format to FLT. (default)
  4189. @item double
  4190. 64-bit floating-point; this limits input sample format to DBL.
  4191. @end table
  4192. @item replaygain
  4193. Choose the behaviour on encountering ReplayGain side data in input frames.
  4194. @table @option
  4195. @item drop
  4196. Remove ReplayGain side data, ignoring its contents (the default).
  4197. @item ignore
  4198. Ignore ReplayGain side data, but leave it in the frame.
  4199. @item track
  4200. Prefer the track gain, if present.
  4201. @item album
  4202. Prefer the album gain, if present.
  4203. @end table
  4204. @item replaygain_preamp
  4205. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4206. Default value for @var{replaygain_preamp} is 0.0.
  4207. @item eval
  4208. Set when the volume expression is evaluated.
  4209. It accepts the following values:
  4210. @table @samp
  4211. @item once
  4212. only evaluate expression once during the filter initialization, or
  4213. when the @samp{volume} command is sent
  4214. @item frame
  4215. evaluate expression for each incoming frame
  4216. @end table
  4217. Default value is @samp{once}.
  4218. @end table
  4219. The volume expression can contain the following parameters.
  4220. @table @option
  4221. @item n
  4222. frame number (starting at zero)
  4223. @item nb_channels
  4224. number of channels
  4225. @item nb_consumed_samples
  4226. number of samples consumed by the filter
  4227. @item nb_samples
  4228. number of samples in the current frame
  4229. @item pos
  4230. original frame position in the file
  4231. @item pts
  4232. frame PTS
  4233. @item sample_rate
  4234. sample rate
  4235. @item startpts
  4236. PTS at start of stream
  4237. @item startt
  4238. time at start of stream
  4239. @item t
  4240. frame time
  4241. @item tb
  4242. timestamp timebase
  4243. @item volume
  4244. last set volume value
  4245. @end table
  4246. Note that when @option{eval} is set to @samp{once} only the
  4247. @var{sample_rate} and @var{tb} variables are available, all other
  4248. variables will evaluate to NAN.
  4249. @subsection Commands
  4250. This filter supports the following commands:
  4251. @table @option
  4252. @item volume
  4253. Modify the volume expression.
  4254. The command accepts the same syntax of the corresponding option.
  4255. If the specified expression is not valid, it is kept at its current
  4256. value.
  4257. @item replaygain_noclip
  4258. Prevent clipping by limiting the gain applied.
  4259. Default value for @var{replaygain_noclip} is 1.
  4260. @end table
  4261. @subsection Examples
  4262. @itemize
  4263. @item
  4264. Halve the input audio volume:
  4265. @example
  4266. volume=volume=0.5
  4267. volume=volume=1/2
  4268. volume=volume=-6.0206dB
  4269. @end example
  4270. In all the above example the named key for @option{volume} can be
  4271. omitted, for example like in:
  4272. @example
  4273. volume=0.5
  4274. @end example
  4275. @item
  4276. Increase input audio power by 6 decibels using fixed-point precision:
  4277. @example
  4278. volume=volume=6dB:precision=fixed
  4279. @end example
  4280. @item
  4281. Fade volume after time 10 with an annihilation period of 5 seconds:
  4282. @example
  4283. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4284. @end example
  4285. @end itemize
  4286. @section volumedetect
  4287. Detect the volume of the input video.
  4288. The filter has no parameters. The input is not modified. Statistics about
  4289. the volume will be printed in the log when the input stream end is reached.
  4290. In particular it will show the mean volume (root mean square), maximum
  4291. volume (on a per-sample basis), and the beginning of a histogram of the
  4292. registered volume values (from the maximum value to a cumulated 1/1000 of
  4293. the samples).
  4294. All volumes are in decibels relative to the maximum PCM value.
  4295. @subsection Examples
  4296. Here is an excerpt of the output:
  4297. @example
  4298. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4299. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4300. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4301. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4302. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4303. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4304. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4305. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4306. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4307. @end example
  4308. It means that:
  4309. @itemize
  4310. @item
  4311. The mean square energy is approximately -27 dB, or 10^-2.7.
  4312. @item
  4313. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4314. @item
  4315. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4316. @end itemize
  4317. In other words, raising the volume by +4 dB does not cause any clipping,
  4318. raising it by +5 dB causes clipping for 6 samples, etc.
  4319. @c man end AUDIO FILTERS
  4320. @chapter Audio Sources
  4321. @c man begin AUDIO SOURCES
  4322. Below is a description of the currently available audio sources.
  4323. @section abuffer
  4324. Buffer audio frames, and make them available to the filter chain.
  4325. This source is mainly intended for a programmatic use, in particular
  4326. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4327. It accepts the following parameters:
  4328. @table @option
  4329. @item time_base
  4330. The timebase which will be used for timestamps of submitted frames. It must be
  4331. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4332. @item sample_rate
  4333. The sample rate of the incoming audio buffers.
  4334. @item sample_fmt
  4335. The sample format of the incoming audio buffers.
  4336. Either a sample format name or its corresponding integer representation from
  4337. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4338. @item channel_layout
  4339. The channel layout of the incoming audio buffers.
  4340. Either a channel layout name from channel_layout_map in
  4341. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4342. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4343. @item channels
  4344. The number of channels of the incoming audio buffers.
  4345. If both @var{channels} and @var{channel_layout} are specified, then they
  4346. must be consistent.
  4347. @end table
  4348. @subsection Examples
  4349. @example
  4350. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4351. @end example
  4352. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4353. Since the sample format with name "s16p" corresponds to the number
  4354. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4355. equivalent to:
  4356. @example
  4357. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4358. @end example
  4359. @section aevalsrc
  4360. Generate an audio signal specified by an expression.
  4361. This source accepts in input one or more expressions (one for each
  4362. channel), which are evaluated and used to generate a corresponding
  4363. audio signal.
  4364. This source accepts the following options:
  4365. @table @option
  4366. @item exprs
  4367. Set the '|'-separated expressions list for each separate channel. In case the
  4368. @option{channel_layout} option is not specified, the selected channel layout
  4369. depends on the number of provided expressions. Otherwise the last
  4370. specified expression is applied to the remaining output channels.
  4371. @item channel_layout, c
  4372. Set the channel layout. The number of channels in the specified layout
  4373. must be equal to the number of specified expressions.
  4374. @item duration, d
  4375. Set the minimum duration of the sourced audio. See
  4376. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4377. for the accepted syntax.
  4378. Note that the resulting duration may be greater than the specified
  4379. duration, as the generated audio is always cut at the end of a
  4380. complete frame.
  4381. If not specified, or the expressed duration is negative, the audio is
  4382. supposed to be generated forever.
  4383. @item nb_samples, n
  4384. Set the number of samples per channel per each output frame,
  4385. default to 1024.
  4386. @item sample_rate, s
  4387. Specify the sample rate, default to 44100.
  4388. @end table
  4389. Each expression in @var{exprs} can contain the following constants:
  4390. @table @option
  4391. @item n
  4392. number of the evaluated sample, starting from 0
  4393. @item t
  4394. time of the evaluated sample expressed in seconds, starting from 0
  4395. @item s
  4396. sample rate
  4397. @end table
  4398. @subsection Examples
  4399. @itemize
  4400. @item
  4401. Generate silence:
  4402. @example
  4403. aevalsrc=0
  4404. @end example
  4405. @item
  4406. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4407. 8000 Hz:
  4408. @example
  4409. aevalsrc="sin(440*2*PI*t):s=8000"
  4410. @end example
  4411. @item
  4412. Generate a two channels signal, specify the channel layout (Front
  4413. Center + Back Center) explicitly:
  4414. @example
  4415. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4416. @end example
  4417. @item
  4418. Generate white noise:
  4419. @example
  4420. aevalsrc="-2+random(0)"
  4421. @end example
  4422. @item
  4423. Generate an amplitude modulated signal:
  4424. @example
  4425. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4426. @end example
  4427. @item
  4428. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4429. @example
  4430. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4431. @end example
  4432. @end itemize
  4433. @section anullsrc
  4434. The null audio source, return unprocessed audio frames. It is mainly useful
  4435. as a template and to be employed in analysis / debugging tools, or as
  4436. the source for filters which ignore the input data (for example the sox
  4437. synth filter).
  4438. This source accepts the following options:
  4439. @table @option
  4440. @item channel_layout, cl
  4441. Specifies the channel layout, and can be either an integer or a string
  4442. representing a channel layout. The default value of @var{channel_layout}
  4443. is "stereo".
  4444. Check the channel_layout_map definition in
  4445. @file{libavutil/channel_layout.c} for the mapping between strings and
  4446. channel layout values.
  4447. @item sample_rate, r
  4448. Specifies the sample rate, and defaults to 44100.
  4449. @item nb_samples, n
  4450. Set the number of samples per requested frames.
  4451. @end table
  4452. @subsection Examples
  4453. @itemize
  4454. @item
  4455. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4456. @example
  4457. anullsrc=r=48000:cl=4
  4458. @end example
  4459. @item
  4460. Do the same operation with a more obvious syntax:
  4461. @example
  4462. anullsrc=r=48000:cl=mono
  4463. @end example
  4464. @end itemize
  4465. All the parameters need to be explicitly defined.
  4466. @section flite
  4467. Synthesize a voice utterance using the libflite library.
  4468. To enable compilation of this filter you need to configure FFmpeg with
  4469. @code{--enable-libflite}.
  4470. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4471. The filter accepts the following options:
  4472. @table @option
  4473. @item list_voices
  4474. If set to 1, list the names of the available voices and exit
  4475. immediately. Default value is 0.
  4476. @item nb_samples, n
  4477. Set the maximum number of samples per frame. Default value is 512.
  4478. @item textfile
  4479. Set the filename containing the text to speak.
  4480. @item text
  4481. Set the text to speak.
  4482. @item voice, v
  4483. Set the voice to use for the speech synthesis. Default value is
  4484. @code{kal}. See also the @var{list_voices} option.
  4485. @end table
  4486. @subsection Examples
  4487. @itemize
  4488. @item
  4489. Read from file @file{speech.txt}, and synthesize the text using the
  4490. standard flite voice:
  4491. @example
  4492. flite=textfile=speech.txt
  4493. @end example
  4494. @item
  4495. Read the specified text selecting the @code{slt} voice:
  4496. @example
  4497. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4498. @end example
  4499. @item
  4500. Input text to ffmpeg:
  4501. @example
  4502. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4503. @end example
  4504. @item
  4505. Make @file{ffplay} speak the specified text, using @code{flite} and
  4506. the @code{lavfi} device:
  4507. @example
  4508. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4509. @end example
  4510. @end itemize
  4511. For more information about libflite, check:
  4512. @url{http://www.festvox.org/flite/}
  4513. @section anoisesrc
  4514. Generate a noise audio signal.
  4515. The filter accepts the following options:
  4516. @table @option
  4517. @item sample_rate, r
  4518. Specify the sample rate. Default value is 48000 Hz.
  4519. @item amplitude, a
  4520. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4521. is 1.0.
  4522. @item duration, d
  4523. Specify the duration of the generated audio stream. Not specifying this option
  4524. results in noise with an infinite length.
  4525. @item color, colour, c
  4526. Specify the color of noise. Available noise colors are white, pink, brown,
  4527. blue and violet. Default color is white.
  4528. @item seed, s
  4529. Specify a value used to seed the PRNG.
  4530. @item nb_samples, n
  4531. Set the number of samples per each output frame, default is 1024.
  4532. @end table
  4533. @subsection Examples
  4534. @itemize
  4535. @item
  4536. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4537. @example
  4538. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4539. @end example
  4540. @end itemize
  4541. @section hilbert
  4542. Generate odd-tap Hilbert transform FIR coefficients.
  4543. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4544. the signal by 90 degrees.
  4545. This is used in many matrix coding schemes and for analytic signal generation.
  4546. The process is often written as a multiplication by i (or j), the imaginary unit.
  4547. The filter accepts the following options:
  4548. @table @option
  4549. @item sample_rate, s
  4550. Set sample rate, default is 44100.
  4551. @item taps, t
  4552. Set length of FIR filter, default is 22051.
  4553. @item nb_samples, n
  4554. Set number of samples per each frame.
  4555. @item win_func, w
  4556. Set window function to be used when generating FIR coefficients.
  4557. @end table
  4558. @section sinc
  4559. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4560. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4561. The filter accepts the following options:
  4562. @table @option
  4563. @item sample_rate, r
  4564. Set sample rate, default is 44100.
  4565. @item nb_samples, n
  4566. Set number of samples per each frame. Default is 1024.
  4567. @item hp
  4568. Set high-pass frequency. Default is 0.
  4569. @item lp
  4570. Set low-pass frequency. Default is 0.
  4571. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4572. is higher than 0 then filter will create band-pass filter coefficients,
  4573. otherwise band-reject filter coefficients.
  4574. @item phase
  4575. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4576. @item beta
  4577. Set Kaiser window beta.
  4578. @item att
  4579. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4580. @item round
  4581. Enable rounding, by default is disabled.
  4582. @item hptaps
  4583. Set number of taps for high-pass filter.
  4584. @item lptaps
  4585. Set number of taps for low-pass filter.
  4586. @end table
  4587. @section sine
  4588. Generate an audio signal made of a sine wave with amplitude 1/8.
  4589. The audio signal is bit-exact.
  4590. The filter accepts the following options:
  4591. @table @option
  4592. @item frequency, f
  4593. Set the carrier frequency. Default is 440 Hz.
  4594. @item beep_factor, b
  4595. Enable a periodic beep every second with frequency @var{beep_factor} times
  4596. the carrier frequency. Default is 0, meaning the beep is disabled.
  4597. @item sample_rate, r
  4598. Specify the sample rate, default is 44100.
  4599. @item duration, d
  4600. Specify the duration of the generated audio stream.
  4601. @item samples_per_frame
  4602. Set the number of samples per output frame.
  4603. The expression can contain the following constants:
  4604. @table @option
  4605. @item n
  4606. The (sequential) number of the output audio frame, starting from 0.
  4607. @item pts
  4608. The PTS (Presentation TimeStamp) of the output audio frame,
  4609. expressed in @var{TB} units.
  4610. @item t
  4611. The PTS of the output audio frame, expressed in seconds.
  4612. @item TB
  4613. The timebase of the output audio frames.
  4614. @end table
  4615. Default is @code{1024}.
  4616. @end table
  4617. @subsection Examples
  4618. @itemize
  4619. @item
  4620. Generate a simple 440 Hz sine wave:
  4621. @example
  4622. sine
  4623. @end example
  4624. @item
  4625. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4626. @example
  4627. sine=220:4:d=5
  4628. sine=f=220:b=4:d=5
  4629. sine=frequency=220:beep_factor=4:duration=5
  4630. @end example
  4631. @item
  4632. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4633. pattern:
  4634. @example
  4635. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4636. @end example
  4637. @end itemize
  4638. @c man end AUDIO SOURCES
  4639. @chapter Audio Sinks
  4640. @c man begin AUDIO SINKS
  4641. Below is a description of the currently available audio sinks.
  4642. @section abuffersink
  4643. Buffer audio frames, and make them available to the end of filter chain.
  4644. This sink is mainly intended for programmatic use, in particular
  4645. through the interface defined in @file{libavfilter/buffersink.h}
  4646. or the options system.
  4647. It accepts a pointer to an AVABufferSinkContext structure, which
  4648. defines the incoming buffers' formats, to be passed as the opaque
  4649. parameter to @code{avfilter_init_filter} for initialization.
  4650. @section anullsink
  4651. Null audio sink; do absolutely nothing with the input audio. It is
  4652. mainly useful as a template and for use in analysis / debugging
  4653. tools.
  4654. @c man end AUDIO SINKS
  4655. @chapter Video Filters
  4656. @c man begin VIDEO FILTERS
  4657. When you configure your FFmpeg build, you can disable any of the
  4658. existing filters using @code{--disable-filters}.
  4659. The configure output will show the video filters included in your
  4660. build.
  4661. Below is a description of the currently available video filters.
  4662. @section addroi
  4663. Mark a region of interest in a video frame.
  4664. The frame data is passed through unchanged, but metadata is attached
  4665. to the frame indicating regions of interest which can affect the
  4666. behaviour of later encoding. Multiple regions can be marked by
  4667. applying the filter multiple times.
  4668. @table @option
  4669. @item x
  4670. Region distance in pixels from the left edge of the frame.
  4671. @item y
  4672. Region distance in pixels from the top edge of the frame.
  4673. @item w
  4674. Region width in pixels.
  4675. @item h
  4676. Region height in pixels.
  4677. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  4678. and may contain the following variables:
  4679. @table @option
  4680. @item iw
  4681. Width of the input frame.
  4682. @item ih
  4683. Height of the input frame.
  4684. @end table
  4685. @item qoffset
  4686. Quantisation offset to apply within the region.
  4687. This must be a real value in the range -1 to +1. A value of zero
  4688. indicates no quality change. A negative value asks for better quality
  4689. (less quantisation), while a positive value asks for worse quality
  4690. (greater quantisation).
  4691. The range is calibrated so that the extreme values indicate the
  4692. largest possible offset - if the rest of the frame is encoded with the
  4693. worst possible quality, an offset of -1 indicates that this region
  4694. should be encoded with the best possible quality anyway. Intermediate
  4695. values are then interpolated in some codec-dependent way.
  4696. For example, in 10-bit H.264 the quantisation parameter varies between
  4697. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  4698. this region should be encoded with a QP around one-tenth of the full
  4699. range better than the rest of the frame. So, if most of the frame
  4700. were to be encoded with a QP of around 30, this region would get a QP
  4701. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  4702. An extreme value of -1 would indicate that this region should be
  4703. encoded with the best possible quality regardless of the treatment of
  4704. the rest of the frame - that is, should be encoded at a QP of -12.
  4705. @item clear
  4706. If set to true, remove any existing regions of interest marked on the
  4707. frame before adding the new one.
  4708. @end table
  4709. @subsection Examples
  4710. @itemize
  4711. @item
  4712. Mark the centre quarter of the frame as interesting.
  4713. @example
  4714. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  4715. @end example
  4716. @item
  4717. Mark the 100-pixel-wide region on the left edge of the frame as very
  4718. uninteresting (to be encoded at much lower quality than the rest of
  4719. the frame).
  4720. @example
  4721. addroi=0:0:100:ih:+1/5
  4722. @end example
  4723. @end itemize
  4724. @section alphaextract
  4725. Extract the alpha component from the input as a grayscale video. This
  4726. is especially useful with the @var{alphamerge} filter.
  4727. @section alphamerge
  4728. Add or replace the alpha component of the primary input with the
  4729. grayscale value of a second input. This is intended for use with
  4730. @var{alphaextract} to allow the transmission or storage of frame
  4731. sequences that have alpha in a format that doesn't support an alpha
  4732. channel.
  4733. For example, to reconstruct full frames from a normal YUV-encoded video
  4734. and a separate video created with @var{alphaextract}, you might use:
  4735. @example
  4736. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4737. @end example
  4738. Since this filter is designed for reconstruction, it operates on frame
  4739. sequences without considering timestamps, and terminates when either
  4740. input reaches end of stream. This will cause problems if your encoding
  4741. pipeline drops frames. If you're trying to apply an image as an
  4742. overlay to a video stream, consider the @var{overlay} filter instead.
  4743. @section amplify
  4744. Amplify differences between current pixel and pixels of adjacent frames in
  4745. same pixel location.
  4746. This filter accepts the following options:
  4747. @table @option
  4748. @item radius
  4749. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4750. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4751. @item factor
  4752. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4753. @item threshold
  4754. Set threshold for difference amplification. Any difference greater or equal to
  4755. this value will not alter source pixel. Default is 10.
  4756. Allowed range is from 0 to 65535.
  4757. @item tolerance
  4758. Set tolerance for difference amplification. Any difference lower to
  4759. this value will not alter source pixel. Default is 0.
  4760. Allowed range is from 0 to 65535.
  4761. @item low
  4762. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4763. This option controls maximum possible value that will decrease source pixel value.
  4764. @item high
  4765. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4766. This option controls maximum possible value that will increase source pixel value.
  4767. @item planes
  4768. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4769. @end table
  4770. @section ass
  4771. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4772. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4773. Substation Alpha) subtitles files.
  4774. This filter accepts the following option in addition to the common options from
  4775. the @ref{subtitles} filter:
  4776. @table @option
  4777. @item shaping
  4778. Set the shaping engine
  4779. Available values are:
  4780. @table @samp
  4781. @item auto
  4782. The default libass shaping engine, which is the best available.
  4783. @item simple
  4784. Fast, font-agnostic shaper that can do only substitutions
  4785. @item complex
  4786. Slower shaper using OpenType for substitutions and positioning
  4787. @end table
  4788. The default is @code{auto}.
  4789. @end table
  4790. @section atadenoise
  4791. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4792. The filter accepts the following options:
  4793. @table @option
  4794. @item 0a
  4795. Set threshold A for 1st plane. Default is 0.02.
  4796. Valid range is 0 to 0.3.
  4797. @item 0b
  4798. Set threshold B for 1st plane. Default is 0.04.
  4799. Valid range is 0 to 5.
  4800. @item 1a
  4801. Set threshold A for 2nd plane. Default is 0.02.
  4802. Valid range is 0 to 0.3.
  4803. @item 1b
  4804. Set threshold B for 2nd plane. Default is 0.04.
  4805. Valid range is 0 to 5.
  4806. @item 2a
  4807. Set threshold A for 3rd plane. Default is 0.02.
  4808. Valid range is 0 to 0.3.
  4809. @item 2b
  4810. Set threshold B for 3rd plane. Default is 0.04.
  4811. Valid range is 0 to 5.
  4812. Threshold A is designed to react on abrupt changes in the input signal and
  4813. threshold B is designed to react on continuous changes in the input signal.
  4814. @item s
  4815. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4816. number in range [5, 129].
  4817. @item p
  4818. Set what planes of frame filter will use for averaging. Default is all.
  4819. @end table
  4820. @section avgblur
  4821. Apply average blur filter.
  4822. The filter accepts the following options:
  4823. @table @option
  4824. @item sizeX
  4825. Set horizontal radius size.
  4826. @item planes
  4827. Set which planes to filter. By default all planes are filtered.
  4828. @item sizeY
  4829. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4830. Default is @code{0}.
  4831. @end table
  4832. @subsection Commands
  4833. This filter supports same commands as options.
  4834. The command accepts the same syntax of the corresponding option.
  4835. If the specified expression is not valid, it is kept at its current
  4836. value.
  4837. @section bbox
  4838. Compute the bounding box for the non-black pixels in the input frame
  4839. luminance plane.
  4840. This filter computes the bounding box containing all the pixels with a
  4841. luminance value greater than the minimum allowed value.
  4842. The parameters describing the bounding box are printed on the filter
  4843. log.
  4844. The filter accepts the following option:
  4845. @table @option
  4846. @item min_val
  4847. Set the minimal luminance value. Default is @code{16}.
  4848. @end table
  4849. @section bitplanenoise
  4850. Show and measure bit plane noise.
  4851. The filter accepts the following options:
  4852. @table @option
  4853. @item bitplane
  4854. Set which plane to analyze. Default is @code{1}.
  4855. @item filter
  4856. Filter out noisy pixels from @code{bitplane} set above.
  4857. Default is disabled.
  4858. @end table
  4859. @section blackdetect
  4860. Detect video intervals that are (almost) completely black. Can be
  4861. useful to detect chapter transitions, commercials, or invalid
  4862. recordings. Output lines contains the time for the start, end and
  4863. duration of the detected black interval expressed in seconds.
  4864. In order to display the output lines, you need to set the loglevel at
  4865. least to the AV_LOG_INFO value.
  4866. The filter accepts the following options:
  4867. @table @option
  4868. @item black_min_duration, d
  4869. Set the minimum detected black duration expressed in seconds. It must
  4870. be a non-negative floating point number.
  4871. Default value is 2.0.
  4872. @item picture_black_ratio_th, pic_th
  4873. Set the threshold for considering a picture "black".
  4874. Express the minimum value for the ratio:
  4875. @example
  4876. @var{nb_black_pixels} / @var{nb_pixels}
  4877. @end example
  4878. for which a picture is considered black.
  4879. Default value is 0.98.
  4880. @item pixel_black_th, pix_th
  4881. Set the threshold for considering a pixel "black".
  4882. The threshold expresses the maximum pixel luminance value for which a
  4883. pixel is considered "black". The provided value is scaled according to
  4884. the following equation:
  4885. @example
  4886. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4887. @end example
  4888. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4889. the input video format, the range is [0-255] for YUV full-range
  4890. formats and [16-235] for YUV non full-range formats.
  4891. Default value is 0.10.
  4892. @end table
  4893. The following example sets the maximum pixel threshold to the minimum
  4894. value, and detects only black intervals of 2 or more seconds:
  4895. @example
  4896. blackdetect=d=2:pix_th=0.00
  4897. @end example
  4898. @section blackframe
  4899. Detect frames that are (almost) completely black. Can be useful to
  4900. detect chapter transitions or commercials. Output lines consist of
  4901. the frame number of the detected frame, the percentage of blackness,
  4902. the position in the file if known or -1 and the timestamp in seconds.
  4903. In order to display the output lines, you need to set the loglevel at
  4904. least to the AV_LOG_INFO value.
  4905. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4906. The value represents the percentage of pixels in the picture that
  4907. are below the threshold value.
  4908. It accepts the following parameters:
  4909. @table @option
  4910. @item amount
  4911. The percentage of the pixels that have to be below the threshold; it defaults to
  4912. @code{98}.
  4913. @item threshold, thresh
  4914. The threshold below which a pixel value is considered black; it defaults to
  4915. @code{32}.
  4916. @end table
  4917. @section blend, tblend
  4918. Blend two video frames into each other.
  4919. The @code{blend} filter takes two input streams and outputs one
  4920. stream, the first input is the "top" layer and second input is
  4921. "bottom" layer. By default, the output terminates when the longest input terminates.
  4922. The @code{tblend} (time blend) filter takes two consecutive frames
  4923. from one single stream, and outputs the result obtained by blending
  4924. the new frame on top of the old frame.
  4925. A description of the accepted options follows.
  4926. @table @option
  4927. @item c0_mode
  4928. @item c1_mode
  4929. @item c2_mode
  4930. @item c3_mode
  4931. @item all_mode
  4932. Set blend mode for specific pixel component or all pixel components in case
  4933. of @var{all_mode}. Default value is @code{normal}.
  4934. Available values for component modes are:
  4935. @table @samp
  4936. @item addition
  4937. @item grainmerge
  4938. @item and
  4939. @item average
  4940. @item burn
  4941. @item darken
  4942. @item difference
  4943. @item grainextract
  4944. @item divide
  4945. @item dodge
  4946. @item freeze
  4947. @item exclusion
  4948. @item extremity
  4949. @item glow
  4950. @item hardlight
  4951. @item hardmix
  4952. @item heat
  4953. @item lighten
  4954. @item linearlight
  4955. @item multiply
  4956. @item multiply128
  4957. @item negation
  4958. @item normal
  4959. @item or
  4960. @item overlay
  4961. @item phoenix
  4962. @item pinlight
  4963. @item reflect
  4964. @item screen
  4965. @item softlight
  4966. @item subtract
  4967. @item vividlight
  4968. @item xor
  4969. @end table
  4970. @item c0_opacity
  4971. @item c1_opacity
  4972. @item c2_opacity
  4973. @item c3_opacity
  4974. @item all_opacity
  4975. Set blend opacity for specific pixel component or all pixel components in case
  4976. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4977. @item c0_expr
  4978. @item c1_expr
  4979. @item c2_expr
  4980. @item c3_expr
  4981. @item all_expr
  4982. Set blend expression for specific pixel component or all pixel components in case
  4983. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4984. The expressions can use the following variables:
  4985. @table @option
  4986. @item N
  4987. The sequential number of the filtered frame, starting from @code{0}.
  4988. @item X
  4989. @item Y
  4990. the coordinates of the current sample
  4991. @item W
  4992. @item H
  4993. the width and height of currently filtered plane
  4994. @item SW
  4995. @item SH
  4996. Width and height scale for the plane being filtered. It is the
  4997. ratio between the dimensions of the current plane to the luma plane,
  4998. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4999. the luma plane and @code{0.5,0.5} for the chroma planes.
  5000. @item T
  5001. Time of the current frame, expressed in seconds.
  5002. @item TOP, A
  5003. Value of pixel component at current location for first video frame (top layer).
  5004. @item BOTTOM, B
  5005. Value of pixel component at current location for second video frame (bottom layer).
  5006. @end table
  5007. @end table
  5008. The @code{blend} filter also supports the @ref{framesync} options.
  5009. @subsection Examples
  5010. @itemize
  5011. @item
  5012. Apply transition from bottom layer to top layer in first 10 seconds:
  5013. @example
  5014. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  5015. @end example
  5016. @item
  5017. Apply linear horizontal transition from top layer to bottom layer:
  5018. @example
  5019. blend=all_expr='A*(X/W)+B*(1-X/W)'
  5020. @end example
  5021. @item
  5022. Apply 1x1 checkerboard effect:
  5023. @example
  5024. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  5025. @end example
  5026. @item
  5027. Apply uncover left effect:
  5028. @example
  5029. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  5030. @end example
  5031. @item
  5032. Apply uncover down effect:
  5033. @example
  5034. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  5035. @end example
  5036. @item
  5037. Apply uncover up-left effect:
  5038. @example
  5039. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5040. @end example
  5041. @item
  5042. Split diagonally video and shows top and bottom layer on each side:
  5043. @example
  5044. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5045. @end example
  5046. @item
  5047. Display differences between the current and the previous frame:
  5048. @example
  5049. tblend=all_mode=grainextract
  5050. @end example
  5051. @end itemize
  5052. @section bm3d
  5053. Denoise frames using Block-Matching 3D algorithm.
  5054. The filter accepts the following options.
  5055. @table @option
  5056. @item sigma
  5057. Set denoising strength. Default value is 1.
  5058. Allowed range is from 0 to 999.9.
  5059. The denoising algorithm is very sensitive to sigma, so adjust it
  5060. according to the source.
  5061. @item block
  5062. Set local patch size. This sets dimensions in 2D.
  5063. @item bstep
  5064. Set sliding step for processing blocks. Default value is 4.
  5065. Allowed range is from 1 to 64.
  5066. Smaller values allows processing more reference blocks and is slower.
  5067. @item group
  5068. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5069. When set to 1, no block matching is done. Larger values allows more blocks
  5070. in single group.
  5071. Allowed range is from 1 to 256.
  5072. @item range
  5073. Set radius for search block matching. Default is 9.
  5074. Allowed range is from 1 to INT32_MAX.
  5075. @item mstep
  5076. Set step between two search locations for block matching. Default is 1.
  5077. Allowed range is from 1 to 64. Smaller is slower.
  5078. @item thmse
  5079. Set threshold of mean square error for block matching. Valid range is 0 to
  5080. INT32_MAX.
  5081. @item hdthr
  5082. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5083. Larger values results in stronger hard-thresholding filtering in frequency
  5084. domain.
  5085. @item estim
  5086. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5087. Default is @code{basic}.
  5088. @item ref
  5089. If enabled, filter will use 2nd stream for block matching.
  5090. Default is disabled for @code{basic} value of @var{estim} option,
  5091. and always enabled if value of @var{estim} is @code{final}.
  5092. @item planes
  5093. Set planes to filter. Default is all available except alpha.
  5094. @end table
  5095. @subsection Examples
  5096. @itemize
  5097. @item
  5098. Basic filtering with bm3d:
  5099. @example
  5100. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5101. @end example
  5102. @item
  5103. Same as above, but filtering only luma:
  5104. @example
  5105. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5106. @end example
  5107. @item
  5108. Same as above, but with both estimation modes:
  5109. @example
  5110. 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
  5111. @end example
  5112. @item
  5113. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5114. @example
  5115. 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
  5116. @end example
  5117. @end itemize
  5118. @section boxblur
  5119. Apply a boxblur algorithm to the input video.
  5120. It accepts the following parameters:
  5121. @table @option
  5122. @item luma_radius, lr
  5123. @item luma_power, lp
  5124. @item chroma_radius, cr
  5125. @item chroma_power, cp
  5126. @item alpha_radius, ar
  5127. @item alpha_power, ap
  5128. @end table
  5129. A description of the accepted options follows.
  5130. @table @option
  5131. @item luma_radius, lr
  5132. @item chroma_radius, cr
  5133. @item alpha_radius, ar
  5134. Set an expression for the box radius in pixels used for blurring the
  5135. corresponding input plane.
  5136. The radius value must be a non-negative number, and must not be
  5137. greater than the value of the expression @code{min(w,h)/2} for the
  5138. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5139. planes.
  5140. Default value for @option{luma_radius} is "2". If not specified,
  5141. @option{chroma_radius} and @option{alpha_radius} default to the
  5142. corresponding value set for @option{luma_radius}.
  5143. The expressions can contain the following constants:
  5144. @table @option
  5145. @item w
  5146. @item h
  5147. The input width and height in pixels.
  5148. @item cw
  5149. @item ch
  5150. The input chroma image width and height in pixels.
  5151. @item hsub
  5152. @item vsub
  5153. The horizontal and vertical chroma subsample values. For example, for the
  5154. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5155. @end table
  5156. @item luma_power, lp
  5157. @item chroma_power, cp
  5158. @item alpha_power, ap
  5159. Specify how many times the boxblur filter is applied to the
  5160. corresponding plane.
  5161. Default value for @option{luma_power} is 2. If not specified,
  5162. @option{chroma_power} and @option{alpha_power} default to the
  5163. corresponding value set for @option{luma_power}.
  5164. A value of 0 will disable the effect.
  5165. @end table
  5166. @subsection Examples
  5167. @itemize
  5168. @item
  5169. Apply a boxblur filter with the luma, chroma, and alpha radii
  5170. set to 2:
  5171. @example
  5172. boxblur=luma_radius=2:luma_power=1
  5173. boxblur=2:1
  5174. @end example
  5175. @item
  5176. Set the luma radius to 2, and alpha and chroma radius to 0:
  5177. @example
  5178. boxblur=2:1:cr=0:ar=0
  5179. @end example
  5180. @item
  5181. Set the luma and chroma radii to a fraction of the video dimension:
  5182. @example
  5183. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5184. @end example
  5185. @end itemize
  5186. @section bwdif
  5187. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5188. Deinterlacing Filter").
  5189. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5190. interpolation algorithms.
  5191. It accepts the following parameters:
  5192. @table @option
  5193. @item mode
  5194. The interlacing mode to adopt. It accepts one of the following values:
  5195. @table @option
  5196. @item 0, send_frame
  5197. Output one frame for each frame.
  5198. @item 1, send_field
  5199. Output one frame for each field.
  5200. @end table
  5201. The default value is @code{send_field}.
  5202. @item parity
  5203. The picture field parity assumed for the input interlaced video. It accepts one
  5204. of the following values:
  5205. @table @option
  5206. @item 0, tff
  5207. Assume the top field is first.
  5208. @item 1, bff
  5209. Assume the bottom field is first.
  5210. @item -1, auto
  5211. Enable automatic detection of field parity.
  5212. @end table
  5213. The default value is @code{auto}.
  5214. If the interlacing is unknown or the decoder does not export this information,
  5215. top field first will be assumed.
  5216. @item deint
  5217. Specify which frames to deinterlace. Accepts one of the following
  5218. values:
  5219. @table @option
  5220. @item 0, all
  5221. Deinterlace all frames.
  5222. @item 1, interlaced
  5223. Only deinterlace frames marked as interlaced.
  5224. @end table
  5225. The default value is @code{all}.
  5226. @end table
  5227. @section chromahold
  5228. Remove all color information for all colors except for certain one.
  5229. The filter accepts the following options:
  5230. @table @option
  5231. @item color
  5232. The color which will not be replaced with neutral chroma.
  5233. @item similarity
  5234. Similarity percentage with the above color.
  5235. 0.01 matches only the exact key color, while 1.0 matches everything.
  5236. @item blend
  5237. Blend percentage.
  5238. 0.0 makes pixels either fully gray, or not gray at all.
  5239. Higher values result in more preserved color.
  5240. @item yuv
  5241. Signals that the color passed is already in YUV instead of RGB.
  5242. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5243. This can be used to pass exact YUV values as hexadecimal numbers.
  5244. @end table
  5245. @section chromakey
  5246. YUV colorspace color/chroma keying.
  5247. The filter accepts the following options:
  5248. @table @option
  5249. @item color
  5250. The color which will be replaced with transparency.
  5251. @item similarity
  5252. Similarity percentage with the key color.
  5253. 0.01 matches only the exact key color, while 1.0 matches everything.
  5254. @item blend
  5255. Blend percentage.
  5256. 0.0 makes pixels either fully transparent, or not transparent at all.
  5257. Higher values result in semi-transparent pixels, with a higher transparency
  5258. the more similar the pixels color is to the key color.
  5259. @item yuv
  5260. Signals that the color passed is already in YUV instead of RGB.
  5261. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5262. This can be used to pass exact YUV values as hexadecimal numbers.
  5263. @end table
  5264. @subsection Examples
  5265. @itemize
  5266. @item
  5267. Make every green pixel in the input image transparent:
  5268. @example
  5269. ffmpeg -i input.png -vf chromakey=green out.png
  5270. @end example
  5271. @item
  5272. Overlay a greenscreen-video on top of a static black background.
  5273. @example
  5274. 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
  5275. @end example
  5276. @end itemize
  5277. @section chromashift
  5278. Shift chroma pixels horizontally and/or vertically.
  5279. The filter accepts the following options:
  5280. @table @option
  5281. @item cbh
  5282. Set amount to shift chroma-blue horizontally.
  5283. @item cbv
  5284. Set amount to shift chroma-blue vertically.
  5285. @item crh
  5286. Set amount to shift chroma-red horizontally.
  5287. @item crv
  5288. Set amount to shift chroma-red vertically.
  5289. @item edge
  5290. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5291. @end table
  5292. @section ciescope
  5293. Display CIE color diagram with pixels overlaid onto it.
  5294. The filter accepts the following options:
  5295. @table @option
  5296. @item system
  5297. Set color system.
  5298. @table @samp
  5299. @item ntsc, 470m
  5300. @item ebu, 470bg
  5301. @item smpte
  5302. @item 240m
  5303. @item apple
  5304. @item widergb
  5305. @item cie1931
  5306. @item rec709, hdtv
  5307. @item uhdtv, rec2020
  5308. @item dcip3
  5309. @end table
  5310. @item cie
  5311. Set CIE system.
  5312. @table @samp
  5313. @item xyy
  5314. @item ucs
  5315. @item luv
  5316. @end table
  5317. @item gamuts
  5318. Set what gamuts to draw.
  5319. See @code{system} option for available values.
  5320. @item size, s
  5321. Set ciescope size, by default set to 512.
  5322. @item intensity, i
  5323. Set intensity used to map input pixel values to CIE diagram.
  5324. @item contrast
  5325. Set contrast used to draw tongue colors that are out of active color system gamut.
  5326. @item corrgamma
  5327. Correct gamma displayed on scope, by default enabled.
  5328. @item showwhite
  5329. Show white point on CIE diagram, by default disabled.
  5330. @item gamma
  5331. Set input gamma. Used only with XYZ input color space.
  5332. @end table
  5333. @section codecview
  5334. Visualize information exported by some codecs.
  5335. Some codecs can export information through frames using side-data or other
  5336. means. For example, some MPEG based codecs export motion vectors through the
  5337. @var{export_mvs} flag in the codec @option{flags2} option.
  5338. The filter accepts the following option:
  5339. @table @option
  5340. @item mv
  5341. Set motion vectors to visualize.
  5342. Available flags for @var{mv} are:
  5343. @table @samp
  5344. @item pf
  5345. forward predicted MVs of P-frames
  5346. @item bf
  5347. forward predicted MVs of B-frames
  5348. @item bb
  5349. backward predicted MVs of B-frames
  5350. @end table
  5351. @item qp
  5352. Display quantization parameters using the chroma planes.
  5353. @item mv_type, mvt
  5354. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5355. Available flags for @var{mv_type} are:
  5356. @table @samp
  5357. @item fp
  5358. forward predicted MVs
  5359. @item bp
  5360. backward predicted MVs
  5361. @end table
  5362. @item frame_type, ft
  5363. Set frame type to visualize motion vectors of.
  5364. Available flags for @var{frame_type} are:
  5365. @table @samp
  5366. @item if
  5367. intra-coded frames (I-frames)
  5368. @item pf
  5369. predicted frames (P-frames)
  5370. @item bf
  5371. bi-directionally predicted frames (B-frames)
  5372. @end table
  5373. @end table
  5374. @subsection Examples
  5375. @itemize
  5376. @item
  5377. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5378. @example
  5379. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5380. @end example
  5381. @item
  5382. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5383. @example
  5384. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5385. @end example
  5386. @end itemize
  5387. @section colorbalance
  5388. Modify intensity of primary colors (red, green and blue) of input frames.
  5389. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5390. regions for the red-cyan, green-magenta or blue-yellow balance.
  5391. A positive adjustment value shifts the balance towards the primary color, a negative
  5392. value towards the complementary color.
  5393. The filter accepts the following options:
  5394. @table @option
  5395. @item rs
  5396. @item gs
  5397. @item bs
  5398. Adjust red, green and blue shadows (darkest pixels).
  5399. @item rm
  5400. @item gm
  5401. @item bm
  5402. Adjust red, green and blue midtones (medium pixels).
  5403. @item rh
  5404. @item gh
  5405. @item bh
  5406. Adjust red, green and blue highlights (brightest pixels).
  5407. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5408. @end table
  5409. @subsection Examples
  5410. @itemize
  5411. @item
  5412. Add red color cast to shadows:
  5413. @example
  5414. colorbalance=rs=.3
  5415. @end example
  5416. @end itemize
  5417. @section colorchannelmixer
  5418. Adjust video input frames by re-mixing color channels.
  5419. This filter modifies a color channel by adding the values associated to
  5420. the other channels of the same pixels. For example if the value to
  5421. modify is red, the output value will be:
  5422. @example
  5423. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5424. @end example
  5425. The filter accepts the following options:
  5426. @table @option
  5427. @item rr
  5428. @item rg
  5429. @item rb
  5430. @item ra
  5431. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5432. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5433. @item gr
  5434. @item gg
  5435. @item gb
  5436. @item ga
  5437. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5438. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5439. @item br
  5440. @item bg
  5441. @item bb
  5442. @item ba
  5443. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5444. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5445. @item ar
  5446. @item ag
  5447. @item ab
  5448. @item aa
  5449. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5450. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5451. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5452. @end table
  5453. @subsection Examples
  5454. @itemize
  5455. @item
  5456. Convert source to grayscale:
  5457. @example
  5458. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5459. @end example
  5460. @item
  5461. Simulate sepia tones:
  5462. @example
  5463. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5464. @end example
  5465. @end itemize
  5466. @section colorkey
  5467. RGB colorspace color keying.
  5468. The filter accepts the following options:
  5469. @table @option
  5470. @item color
  5471. The color which will be replaced with transparency.
  5472. @item similarity
  5473. Similarity percentage with the key color.
  5474. 0.01 matches only the exact key color, while 1.0 matches everything.
  5475. @item blend
  5476. Blend percentage.
  5477. 0.0 makes pixels either fully transparent, or not transparent at all.
  5478. Higher values result in semi-transparent pixels, with a higher transparency
  5479. the more similar the pixels color is to the key color.
  5480. @end table
  5481. @subsection Examples
  5482. @itemize
  5483. @item
  5484. Make every green pixel in the input image transparent:
  5485. @example
  5486. ffmpeg -i input.png -vf colorkey=green out.png
  5487. @end example
  5488. @item
  5489. Overlay a greenscreen-video on top of a static background image.
  5490. @example
  5491. 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
  5492. @end example
  5493. @end itemize
  5494. @section colorhold
  5495. Remove all color information for all RGB colors except for certain one.
  5496. The filter accepts the following options:
  5497. @table @option
  5498. @item color
  5499. The color which will not be replaced with neutral gray.
  5500. @item similarity
  5501. Similarity percentage with the above color.
  5502. 0.01 matches only the exact key color, while 1.0 matches everything.
  5503. @item blend
  5504. Blend percentage. 0.0 makes pixels fully gray.
  5505. Higher values result in more preserved color.
  5506. @end table
  5507. @section colorlevels
  5508. Adjust video input frames using levels.
  5509. The filter accepts the following options:
  5510. @table @option
  5511. @item rimin
  5512. @item gimin
  5513. @item bimin
  5514. @item aimin
  5515. Adjust red, green, blue and alpha input black point.
  5516. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5517. @item rimax
  5518. @item gimax
  5519. @item bimax
  5520. @item aimax
  5521. Adjust red, green, blue and alpha input white point.
  5522. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5523. Input levels are used to lighten highlights (bright tones), darken shadows
  5524. (dark tones), change the balance of bright and dark tones.
  5525. @item romin
  5526. @item gomin
  5527. @item bomin
  5528. @item aomin
  5529. Adjust red, green, blue and alpha output black point.
  5530. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5531. @item romax
  5532. @item gomax
  5533. @item bomax
  5534. @item aomax
  5535. Adjust red, green, blue and alpha output white point.
  5536. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5537. Output levels allows manual selection of a constrained output level range.
  5538. @end table
  5539. @subsection Examples
  5540. @itemize
  5541. @item
  5542. Make video output darker:
  5543. @example
  5544. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5545. @end example
  5546. @item
  5547. Increase contrast:
  5548. @example
  5549. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5550. @end example
  5551. @item
  5552. Make video output lighter:
  5553. @example
  5554. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5555. @end example
  5556. @item
  5557. Increase brightness:
  5558. @example
  5559. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5560. @end example
  5561. @end itemize
  5562. @section colormatrix
  5563. Convert color matrix.
  5564. The filter accepts the following options:
  5565. @table @option
  5566. @item src
  5567. @item dst
  5568. Specify the source and destination color matrix. Both values must be
  5569. specified.
  5570. The accepted values are:
  5571. @table @samp
  5572. @item bt709
  5573. BT.709
  5574. @item fcc
  5575. FCC
  5576. @item bt601
  5577. BT.601
  5578. @item bt470
  5579. BT.470
  5580. @item bt470bg
  5581. BT.470BG
  5582. @item smpte170m
  5583. SMPTE-170M
  5584. @item smpte240m
  5585. SMPTE-240M
  5586. @item bt2020
  5587. BT.2020
  5588. @end table
  5589. @end table
  5590. For example to convert from BT.601 to SMPTE-240M, use the command:
  5591. @example
  5592. colormatrix=bt601:smpte240m
  5593. @end example
  5594. @section colorspace
  5595. Convert colorspace, transfer characteristics or color primaries.
  5596. Input video needs to have an even size.
  5597. The filter accepts the following options:
  5598. @table @option
  5599. @anchor{all}
  5600. @item all
  5601. Specify all color properties at once.
  5602. The accepted values are:
  5603. @table @samp
  5604. @item bt470m
  5605. BT.470M
  5606. @item bt470bg
  5607. BT.470BG
  5608. @item bt601-6-525
  5609. BT.601-6 525
  5610. @item bt601-6-625
  5611. BT.601-6 625
  5612. @item bt709
  5613. BT.709
  5614. @item smpte170m
  5615. SMPTE-170M
  5616. @item smpte240m
  5617. SMPTE-240M
  5618. @item bt2020
  5619. BT.2020
  5620. @end table
  5621. @anchor{space}
  5622. @item space
  5623. Specify output colorspace.
  5624. The accepted values are:
  5625. @table @samp
  5626. @item bt709
  5627. BT.709
  5628. @item fcc
  5629. FCC
  5630. @item bt470bg
  5631. BT.470BG or BT.601-6 625
  5632. @item smpte170m
  5633. SMPTE-170M or BT.601-6 525
  5634. @item smpte240m
  5635. SMPTE-240M
  5636. @item ycgco
  5637. YCgCo
  5638. @item bt2020ncl
  5639. BT.2020 with non-constant luminance
  5640. @end table
  5641. @anchor{trc}
  5642. @item trc
  5643. Specify output transfer characteristics.
  5644. The accepted values are:
  5645. @table @samp
  5646. @item bt709
  5647. BT.709
  5648. @item bt470m
  5649. BT.470M
  5650. @item bt470bg
  5651. BT.470BG
  5652. @item gamma22
  5653. Constant gamma of 2.2
  5654. @item gamma28
  5655. Constant gamma of 2.8
  5656. @item smpte170m
  5657. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5658. @item smpte240m
  5659. SMPTE-240M
  5660. @item srgb
  5661. SRGB
  5662. @item iec61966-2-1
  5663. iec61966-2-1
  5664. @item iec61966-2-4
  5665. iec61966-2-4
  5666. @item xvycc
  5667. xvycc
  5668. @item bt2020-10
  5669. BT.2020 for 10-bits content
  5670. @item bt2020-12
  5671. BT.2020 for 12-bits content
  5672. @end table
  5673. @anchor{primaries}
  5674. @item primaries
  5675. Specify output color primaries.
  5676. The accepted values are:
  5677. @table @samp
  5678. @item bt709
  5679. BT.709
  5680. @item bt470m
  5681. BT.470M
  5682. @item bt470bg
  5683. BT.470BG or BT.601-6 625
  5684. @item smpte170m
  5685. SMPTE-170M or BT.601-6 525
  5686. @item smpte240m
  5687. SMPTE-240M
  5688. @item film
  5689. film
  5690. @item smpte431
  5691. SMPTE-431
  5692. @item smpte432
  5693. SMPTE-432
  5694. @item bt2020
  5695. BT.2020
  5696. @item jedec-p22
  5697. JEDEC P22 phosphors
  5698. @end table
  5699. @anchor{range}
  5700. @item range
  5701. Specify output color range.
  5702. The accepted values are:
  5703. @table @samp
  5704. @item tv
  5705. TV (restricted) range
  5706. @item mpeg
  5707. MPEG (restricted) range
  5708. @item pc
  5709. PC (full) range
  5710. @item jpeg
  5711. JPEG (full) range
  5712. @end table
  5713. @item format
  5714. Specify output color format.
  5715. The accepted values are:
  5716. @table @samp
  5717. @item yuv420p
  5718. YUV 4:2:0 planar 8-bits
  5719. @item yuv420p10
  5720. YUV 4:2:0 planar 10-bits
  5721. @item yuv420p12
  5722. YUV 4:2:0 planar 12-bits
  5723. @item yuv422p
  5724. YUV 4:2:2 planar 8-bits
  5725. @item yuv422p10
  5726. YUV 4:2:2 planar 10-bits
  5727. @item yuv422p12
  5728. YUV 4:2:2 planar 12-bits
  5729. @item yuv444p
  5730. YUV 4:4:4 planar 8-bits
  5731. @item yuv444p10
  5732. YUV 4:4:4 planar 10-bits
  5733. @item yuv444p12
  5734. YUV 4:4:4 planar 12-bits
  5735. @end table
  5736. @item fast
  5737. Do a fast conversion, which skips gamma/primary correction. This will take
  5738. significantly less CPU, but will be mathematically incorrect. To get output
  5739. compatible with that produced by the colormatrix filter, use fast=1.
  5740. @item dither
  5741. Specify dithering mode.
  5742. The accepted values are:
  5743. @table @samp
  5744. @item none
  5745. No dithering
  5746. @item fsb
  5747. Floyd-Steinberg dithering
  5748. @end table
  5749. @item wpadapt
  5750. Whitepoint adaptation mode.
  5751. The accepted values are:
  5752. @table @samp
  5753. @item bradford
  5754. Bradford whitepoint adaptation
  5755. @item vonkries
  5756. von Kries whitepoint adaptation
  5757. @item identity
  5758. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5759. @end table
  5760. @item iall
  5761. Override all input properties at once. Same accepted values as @ref{all}.
  5762. @item ispace
  5763. Override input colorspace. Same accepted values as @ref{space}.
  5764. @item iprimaries
  5765. Override input color primaries. Same accepted values as @ref{primaries}.
  5766. @item itrc
  5767. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5768. @item irange
  5769. Override input color range. Same accepted values as @ref{range}.
  5770. @end table
  5771. The filter converts the transfer characteristics, color space and color
  5772. primaries to the specified user values. The output value, if not specified,
  5773. is set to a default value based on the "all" property. If that property is
  5774. also not specified, the filter will log an error. The output color range and
  5775. format default to the same value as the input color range and format. The
  5776. input transfer characteristics, color space, color primaries and color range
  5777. should be set on the input data. If any of these are missing, the filter will
  5778. log an error and no conversion will take place.
  5779. For example to convert the input to SMPTE-240M, use the command:
  5780. @example
  5781. colorspace=smpte240m
  5782. @end example
  5783. @section convolution
  5784. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5785. The filter accepts the following options:
  5786. @table @option
  5787. @item 0m
  5788. @item 1m
  5789. @item 2m
  5790. @item 3m
  5791. Set matrix for each plane.
  5792. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5793. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5794. @item 0rdiv
  5795. @item 1rdiv
  5796. @item 2rdiv
  5797. @item 3rdiv
  5798. Set multiplier for calculated value for each plane.
  5799. If unset or 0, it will be sum of all matrix elements.
  5800. @item 0bias
  5801. @item 1bias
  5802. @item 2bias
  5803. @item 3bias
  5804. Set bias for each plane. This value is added to the result of the multiplication.
  5805. Useful for making the overall image brighter or darker. Default is 0.0.
  5806. @item 0mode
  5807. @item 1mode
  5808. @item 2mode
  5809. @item 3mode
  5810. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5811. Default is @var{square}.
  5812. @end table
  5813. @subsection Examples
  5814. @itemize
  5815. @item
  5816. Apply sharpen:
  5817. @example
  5818. 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"
  5819. @end example
  5820. @item
  5821. Apply blur:
  5822. @example
  5823. 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"
  5824. @end example
  5825. @item
  5826. Apply edge enhance:
  5827. @example
  5828. 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"
  5829. @end example
  5830. @item
  5831. Apply edge detect:
  5832. @example
  5833. 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"
  5834. @end example
  5835. @item
  5836. Apply laplacian edge detector which includes diagonals:
  5837. @example
  5838. 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"
  5839. @end example
  5840. @item
  5841. Apply emboss:
  5842. @example
  5843. 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"
  5844. @end example
  5845. @end itemize
  5846. @section convolve
  5847. Apply 2D convolution of video stream in frequency domain using second stream
  5848. as impulse.
  5849. The filter accepts the following options:
  5850. @table @option
  5851. @item planes
  5852. Set which planes to process.
  5853. @item impulse
  5854. Set which impulse video frames will be processed, can be @var{first}
  5855. or @var{all}. Default is @var{all}.
  5856. @end table
  5857. The @code{convolve} filter also supports the @ref{framesync} options.
  5858. @section copy
  5859. Copy the input video source unchanged to the output. This is mainly useful for
  5860. testing purposes.
  5861. @anchor{coreimage}
  5862. @section coreimage
  5863. Video filtering on GPU using Apple's CoreImage API on OSX.
  5864. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5865. processed by video hardware. However, software-based OpenGL implementations
  5866. exist which means there is no guarantee for hardware processing. It depends on
  5867. the respective OSX.
  5868. There are many filters and image generators provided by Apple that come with a
  5869. large variety of options. The filter has to be referenced by its name along
  5870. with its options.
  5871. The coreimage filter accepts the following options:
  5872. @table @option
  5873. @item list_filters
  5874. List all available filters and generators along with all their respective
  5875. options as well as possible minimum and maximum values along with the default
  5876. values.
  5877. @example
  5878. list_filters=true
  5879. @end example
  5880. @item filter
  5881. Specify all filters by their respective name and options.
  5882. Use @var{list_filters} to determine all valid filter names and options.
  5883. Numerical options are specified by a float value and are automatically clamped
  5884. to their respective value range. Vector and color options have to be specified
  5885. by a list of space separated float values. Character escaping has to be done.
  5886. A special option name @code{default} is available to use default options for a
  5887. filter.
  5888. It is required to specify either @code{default} or at least one of the filter options.
  5889. All omitted options are used with their default values.
  5890. The syntax of the filter string is as follows:
  5891. @example
  5892. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5893. @end example
  5894. @item output_rect
  5895. Specify a rectangle where the output of the filter chain is copied into the
  5896. input image. It is given by a list of space separated float values:
  5897. @example
  5898. output_rect=x\ y\ width\ height
  5899. @end example
  5900. If not given, the output rectangle equals the dimensions of the input image.
  5901. The output rectangle is automatically cropped at the borders of the input
  5902. image. Negative values are valid for each component.
  5903. @example
  5904. output_rect=25\ 25\ 100\ 100
  5905. @end example
  5906. @end table
  5907. Several filters can be chained for successive processing without GPU-HOST
  5908. transfers allowing for fast processing of complex filter chains.
  5909. Currently, only filters with zero (generators) or exactly one (filters) input
  5910. image and one output image are supported. Also, transition filters are not yet
  5911. usable as intended.
  5912. Some filters generate output images with additional padding depending on the
  5913. respective filter kernel. The padding is automatically removed to ensure the
  5914. filter output has the same size as the input image.
  5915. For image generators, the size of the output image is determined by the
  5916. previous output image of the filter chain or the input image of the whole
  5917. filterchain, respectively. The generators do not use the pixel information of
  5918. this image to generate their output. However, the generated output is
  5919. blended onto this image, resulting in partial or complete coverage of the
  5920. output image.
  5921. The @ref{coreimagesrc} video source can be used for generating input images
  5922. which are directly fed into the filter chain. By using it, providing input
  5923. images by another video source or an input video is not required.
  5924. @subsection Examples
  5925. @itemize
  5926. @item
  5927. List all filters available:
  5928. @example
  5929. coreimage=list_filters=true
  5930. @end example
  5931. @item
  5932. Use the CIBoxBlur filter with default options to blur an image:
  5933. @example
  5934. coreimage=filter=CIBoxBlur@@default
  5935. @end example
  5936. @item
  5937. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5938. its center at 100x100 and a radius of 50 pixels:
  5939. @example
  5940. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5941. @end example
  5942. @item
  5943. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5944. given as complete and escaped command-line for Apple's standard bash shell:
  5945. @example
  5946. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5947. @end example
  5948. @end itemize
  5949. @section cover_rect
  5950. Cover a rectangular object
  5951. It accepts the following options:
  5952. @table @option
  5953. @item cover
  5954. Filepath of the optional cover image, needs to be in yuv420.
  5955. @item mode
  5956. Set covering mode.
  5957. It accepts the following values:
  5958. @table @samp
  5959. @item cover
  5960. cover it by the supplied image
  5961. @item blur
  5962. cover it by interpolating the surrounding pixels
  5963. @end table
  5964. Default value is @var{blur}.
  5965. @end table
  5966. @subsection Examples
  5967. @itemize
  5968. @item
  5969. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  5970. @example
  5971. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  5972. @end example
  5973. @end itemize
  5974. @section crop
  5975. Crop the input video to given dimensions.
  5976. It accepts the following parameters:
  5977. @table @option
  5978. @item w, out_w
  5979. The width of the output video. It defaults to @code{iw}.
  5980. This expression is evaluated only once during the filter
  5981. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5982. @item h, out_h
  5983. The height of the output video. It defaults to @code{ih}.
  5984. This expression is evaluated only once during the filter
  5985. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5986. @item x
  5987. The horizontal position, in the input video, of the left edge of the output
  5988. video. It defaults to @code{(in_w-out_w)/2}.
  5989. This expression is evaluated per-frame.
  5990. @item y
  5991. The vertical position, in the input video, of the top edge of the output video.
  5992. It defaults to @code{(in_h-out_h)/2}.
  5993. This expression is evaluated per-frame.
  5994. @item keep_aspect
  5995. If set to 1 will force the output display aspect ratio
  5996. to be the same of the input, by changing the output sample aspect
  5997. ratio. It defaults to 0.
  5998. @item exact
  5999. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  6000. width/height/x/y as specified and will not be rounded to nearest smaller value.
  6001. It defaults to 0.
  6002. @end table
  6003. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  6004. expressions containing the following constants:
  6005. @table @option
  6006. @item x
  6007. @item y
  6008. The computed values for @var{x} and @var{y}. They are evaluated for
  6009. each new frame.
  6010. @item in_w
  6011. @item in_h
  6012. The input width and height.
  6013. @item iw
  6014. @item ih
  6015. These are the same as @var{in_w} and @var{in_h}.
  6016. @item out_w
  6017. @item out_h
  6018. The output (cropped) width and height.
  6019. @item ow
  6020. @item oh
  6021. These are the same as @var{out_w} and @var{out_h}.
  6022. @item a
  6023. same as @var{iw} / @var{ih}
  6024. @item sar
  6025. input sample aspect ratio
  6026. @item dar
  6027. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6028. @item hsub
  6029. @item vsub
  6030. horizontal and vertical chroma subsample values. For example for the
  6031. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6032. @item n
  6033. The number of the input frame, starting from 0.
  6034. @item pos
  6035. the position in the file of the input frame, NAN if unknown
  6036. @item t
  6037. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6038. @end table
  6039. The expression for @var{out_w} may depend on the value of @var{out_h},
  6040. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6041. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6042. evaluated after @var{out_w} and @var{out_h}.
  6043. The @var{x} and @var{y} parameters specify the expressions for the
  6044. position of the top-left corner of the output (non-cropped) area. They
  6045. are evaluated for each frame. If the evaluated value is not valid, it
  6046. is approximated to the nearest valid value.
  6047. The expression for @var{x} may depend on @var{y}, and the expression
  6048. for @var{y} may depend on @var{x}.
  6049. @subsection Examples
  6050. @itemize
  6051. @item
  6052. Crop area with size 100x100 at position (12,34).
  6053. @example
  6054. crop=100:100:12:34
  6055. @end example
  6056. Using named options, the example above becomes:
  6057. @example
  6058. crop=w=100:h=100:x=12:y=34
  6059. @end example
  6060. @item
  6061. Crop the central input area with size 100x100:
  6062. @example
  6063. crop=100:100
  6064. @end example
  6065. @item
  6066. Crop the central input area with size 2/3 of the input video:
  6067. @example
  6068. crop=2/3*in_w:2/3*in_h
  6069. @end example
  6070. @item
  6071. Crop the input video central square:
  6072. @example
  6073. crop=out_w=in_h
  6074. crop=in_h
  6075. @end example
  6076. @item
  6077. Delimit the rectangle with the top-left corner placed at position
  6078. 100:100 and the right-bottom corner corresponding to the right-bottom
  6079. corner of the input image.
  6080. @example
  6081. crop=in_w-100:in_h-100:100:100
  6082. @end example
  6083. @item
  6084. Crop 10 pixels from the left and right borders, and 20 pixels from
  6085. the top and bottom borders
  6086. @example
  6087. crop=in_w-2*10:in_h-2*20
  6088. @end example
  6089. @item
  6090. Keep only the bottom right quarter of the input image:
  6091. @example
  6092. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6093. @end example
  6094. @item
  6095. Crop height for getting Greek harmony:
  6096. @example
  6097. crop=in_w:1/PHI*in_w
  6098. @end example
  6099. @item
  6100. Apply trembling effect:
  6101. @example
  6102. 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)
  6103. @end example
  6104. @item
  6105. Apply erratic camera effect depending on timestamp:
  6106. @example
  6107. 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)"
  6108. @end example
  6109. @item
  6110. Set x depending on the value of y:
  6111. @example
  6112. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6113. @end example
  6114. @end itemize
  6115. @subsection Commands
  6116. This filter supports the following commands:
  6117. @table @option
  6118. @item w, out_w
  6119. @item h, out_h
  6120. @item x
  6121. @item y
  6122. Set width/height of the output video and the horizontal/vertical position
  6123. in the input video.
  6124. The command accepts the same syntax of the corresponding option.
  6125. If the specified expression is not valid, it is kept at its current
  6126. value.
  6127. @end table
  6128. @section cropdetect
  6129. Auto-detect the crop size.
  6130. It calculates the necessary cropping parameters and prints the
  6131. recommended parameters via the logging system. The detected dimensions
  6132. correspond to the non-black area of the input video.
  6133. It accepts the following parameters:
  6134. @table @option
  6135. @item limit
  6136. Set higher black value threshold, which can be optionally specified
  6137. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6138. value greater to the set value is considered non-black. It defaults to 24.
  6139. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6140. on the bitdepth of the pixel format.
  6141. @item round
  6142. The value which the width/height should be divisible by. It defaults to
  6143. 16. The offset is automatically adjusted to center the video. Use 2 to
  6144. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6145. encoding to most video codecs.
  6146. @item reset_count, reset
  6147. Set the counter that determines after how many frames cropdetect will
  6148. reset the previously detected largest video area and start over to
  6149. detect the current optimal crop area. Default value is 0.
  6150. This can be useful when channel logos distort the video area. 0
  6151. indicates 'never reset', and returns the largest area encountered during
  6152. playback.
  6153. @end table
  6154. @anchor{cue}
  6155. @section cue
  6156. Delay video filtering until a given wallclock timestamp. The filter first
  6157. passes on @option{preroll} amount of frames, then it buffers at most
  6158. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6159. it forwards the buffered frames and also any subsequent frames coming in its
  6160. input.
  6161. The filter can be used synchronize the output of multiple ffmpeg processes for
  6162. realtime output devices like decklink. By putting the delay in the filtering
  6163. chain and pre-buffering frames the process can pass on data to output almost
  6164. immediately after the target wallclock timestamp is reached.
  6165. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6166. some use cases.
  6167. @table @option
  6168. @item cue
  6169. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6170. @item preroll
  6171. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6172. @item buffer
  6173. The maximum duration of content to buffer before waiting for the cue expressed
  6174. in seconds. Default is 0.
  6175. @end table
  6176. @anchor{curves}
  6177. @section curves
  6178. Apply color adjustments using curves.
  6179. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6180. component (red, green and blue) has its values defined by @var{N} key points
  6181. tied from each other using a smooth curve. The x-axis represents the pixel
  6182. values from the input frame, and the y-axis the new pixel values to be set for
  6183. the output frame.
  6184. By default, a component curve is defined by the two points @var{(0;0)} and
  6185. @var{(1;1)}. This creates a straight line where each original pixel value is
  6186. "adjusted" to its own value, which means no change to the image.
  6187. The filter allows you to redefine these two points and add some more. A new
  6188. curve (using a natural cubic spline interpolation) will be define to pass
  6189. smoothly through all these new coordinates. The new defined points needs to be
  6190. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6191. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6192. the vector spaces, the values will be clipped accordingly.
  6193. The filter accepts the following options:
  6194. @table @option
  6195. @item preset
  6196. Select one of the available color presets. This option can be used in addition
  6197. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6198. options takes priority on the preset values.
  6199. Available presets are:
  6200. @table @samp
  6201. @item none
  6202. @item color_negative
  6203. @item cross_process
  6204. @item darker
  6205. @item increase_contrast
  6206. @item lighter
  6207. @item linear_contrast
  6208. @item medium_contrast
  6209. @item negative
  6210. @item strong_contrast
  6211. @item vintage
  6212. @end table
  6213. Default is @code{none}.
  6214. @item master, m
  6215. Set the master key points. These points will define a second pass mapping. It
  6216. is sometimes called a "luminance" or "value" mapping. It can be used with
  6217. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6218. post-processing LUT.
  6219. @item red, r
  6220. Set the key points for the red component.
  6221. @item green, g
  6222. Set the key points for the green component.
  6223. @item blue, b
  6224. Set the key points for the blue component.
  6225. @item all
  6226. Set the key points for all components (not including master).
  6227. Can be used in addition to the other key points component
  6228. options. In this case, the unset component(s) will fallback on this
  6229. @option{all} setting.
  6230. @item psfile
  6231. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6232. @item plot
  6233. Save Gnuplot script of the curves in specified file.
  6234. @end table
  6235. To avoid some filtergraph syntax conflicts, each key points list need to be
  6236. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6237. @subsection Examples
  6238. @itemize
  6239. @item
  6240. Increase slightly the middle level of blue:
  6241. @example
  6242. curves=blue='0/0 0.5/0.58 1/1'
  6243. @end example
  6244. @item
  6245. Vintage effect:
  6246. @example
  6247. 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'
  6248. @end example
  6249. Here we obtain the following coordinates for each components:
  6250. @table @var
  6251. @item red
  6252. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6253. @item green
  6254. @code{(0;0) (0.50;0.48) (1;1)}
  6255. @item blue
  6256. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6257. @end table
  6258. @item
  6259. The previous example can also be achieved with the associated built-in preset:
  6260. @example
  6261. curves=preset=vintage
  6262. @end example
  6263. @item
  6264. Or simply:
  6265. @example
  6266. curves=vintage
  6267. @end example
  6268. @item
  6269. Use a Photoshop preset and redefine the points of the green component:
  6270. @example
  6271. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6272. @end example
  6273. @item
  6274. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6275. and @command{gnuplot}:
  6276. @example
  6277. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6278. gnuplot -p /tmp/curves.plt
  6279. @end example
  6280. @end itemize
  6281. @section datascope
  6282. Video data analysis filter.
  6283. This filter shows hexadecimal pixel values of part of video.
  6284. The filter accepts the following options:
  6285. @table @option
  6286. @item size, s
  6287. Set output video size.
  6288. @item x
  6289. Set x offset from where to pick pixels.
  6290. @item y
  6291. Set y offset from where to pick pixels.
  6292. @item mode
  6293. Set scope mode, can be one of the following:
  6294. @table @samp
  6295. @item mono
  6296. Draw hexadecimal pixel values with white color on black background.
  6297. @item color
  6298. Draw hexadecimal pixel values with input video pixel color on black
  6299. background.
  6300. @item color2
  6301. Draw hexadecimal pixel values on color background picked from input video,
  6302. the text color is picked in such way so its always visible.
  6303. @end table
  6304. @item axis
  6305. Draw rows and columns numbers on left and top of video.
  6306. @item opacity
  6307. Set background opacity.
  6308. @end table
  6309. @section dctdnoiz
  6310. Denoise frames using 2D DCT (frequency domain filtering).
  6311. This filter is not designed for real time.
  6312. The filter accepts the following options:
  6313. @table @option
  6314. @item sigma, s
  6315. Set the noise sigma constant.
  6316. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6317. coefficient (absolute value) below this threshold with be dropped.
  6318. If you need a more advanced filtering, see @option{expr}.
  6319. Default is @code{0}.
  6320. @item overlap
  6321. Set number overlapping pixels for each block. Since the filter can be slow, you
  6322. may want to reduce this value, at the cost of a less effective filter and the
  6323. risk of various artefacts.
  6324. If the overlapping value doesn't permit processing the whole input width or
  6325. height, a warning will be displayed and according borders won't be denoised.
  6326. Default value is @var{blocksize}-1, which is the best possible setting.
  6327. @item expr, e
  6328. Set the coefficient factor expression.
  6329. For each coefficient of a DCT block, this expression will be evaluated as a
  6330. multiplier value for the coefficient.
  6331. If this is option is set, the @option{sigma} option will be ignored.
  6332. The absolute value of the coefficient can be accessed through the @var{c}
  6333. variable.
  6334. @item n
  6335. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6336. @var{blocksize}, which is the width and height of the processed blocks.
  6337. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6338. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6339. on the speed processing. Also, a larger block size does not necessarily means a
  6340. better de-noising.
  6341. @end table
  6342. @subsection Examples
  6343. Apply a denoise with a @option{sigma} of @code{4.5}:
  6344. @example
  6345. dctdnoiz=4.5
  6346. @end example
  6347. The same operation can be achieved using the expression system:
  6348. @example
  6349. dctdnoiz=e='gte(c, 4.5*3)'
  6350. @end example
  6351. Violent denoise using a block size of @code{16x16}:
  6352. @example
  6353. dctdnoiz=15:n=4
  6354. @end example
  6355. @section deband
  6356. Remove banding artifacts from input video.
  6357. It works by replacing banded pixels with average value of referenced pixels.
  6358. The filter accepts the following options:
  6359. @table @option
  6360. @item 1thr
  6361. @item 2thr
  6362. @item 3thr
  6363. @item 4thr
  6364. Set banding detection threshold for each plane. Default is 0.02.
  6365. Valid range is 0.00003 to 0.5.
  6366. If difference between current pixel and reference pixel is less than threshold,
  6367. it will be considered as banded.
  6368. @item range, r
  6369. Banding detection range in pixels. Default is 16. If positive, random number
  6370. in range 0 to set value will be used. If negative, exact absolute value
  6371. will be used.
  6372. The range defines square of four pixels around current pixel.
  6373. @item direction, d
  6374. Set direction in radians from which four pixel will be compared. If positive,
  6375. random direction from 0 to set direction will be picked. If negative, exact of
  6376. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6377. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6378. column.
  6379. @item blur, b
  6380. If enabled, current pixel is compared with average value of all four
  6381. surrounding pixels. The default is enabled. If disabled current pixel is
  6382. compared with all four surrounding pixels. The pixel is considered banded
  6383. if only all four differences with surrounding pixels are less than threshold.
  6384. @item coupling, c
  6385. If enabled, current pixel is changed if and only if all pixel components are banded,
  6386. e.g. banding detection threshold is triggered for all color components.
  6387. The default is disabled.
  6388. @end table
  6389. @section deblock
  6390. Remove blocking artifacts from input video.
  6391. The filter accepts the following options:
  6392. @table @option
  6393. @item filter
  6394. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6395. This controls what kind of deblocking is applied.
  6396. @item block
  6397. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6398. @item alpha
  6399. @item beta
  6400. @item gamma
  6401. @item delta
  6402. Set blocking detection thresholds. Allowed range is 0 to 1.
  6403. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6404. Using higher threshold gives more deblocking strength.
  6405. Setting @var{alpha} controls threshold detection at exact edge of block.
  6406. Remaining options controls threshold detection near the edge. Each one for
  6407. below/above or left/right. Setting any of those to @var{0} disables
  6408. deblocking.
  6409. @item planes
  6410. Set planes to filter. Default is to filter all available planes.
  6411. @end table
  6412. @subsection Examples
  6413. @itemize
  6414. @item
  6415. Deblock using weak filter and block size of 4 pixels.
  6416. @example
  6417. deblock=filter=weak:block=4
  6418. @end example
  6419. @item
  6420. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6421. deblocking more edges.
  6422. @example
  6423. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6424. @end example
  6425. @item
  6426. Similar as above, but filter only first plane.
  6427. @example
  6428. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6429. @end example
  6430. @item
  6431. Similar as above, but filter only second and third plane.
  6432. @example
  6433. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6434. @end example
  6435. @end itemize
  6436. @anchor{decimate}
  6437. @section decimate
  6438. Drop duplicated frames at regular intervals.
  6439. The filter accepts the following options:
  6440. @table @option
  6441. @item cycle
  6442. Set the number of frames from which one will be dropped. Setting this to
  6443. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6444. Default is @code{5}.
  6445. @item dupthresh
  6446. Set the threshold for duplicate detection. If the difference metric for a frame
  6447. is less than or equal to this value, then it is declared as duplicate. Default
  6448. is @code{1.1}
  6449. @item scthresh
  6450. Set scene change threshold. Default is @code{15}.
  6451. @item blockx
  6452. @item blocky
  6453. Set the size of the x and y-axis blocks used during metric calculations.
  6454. Larger blocks give better noise suppression, but also give worse detection of
  6455. small movements. Must be a power of two. Default is @code{32}.
  6456. @item ppsrc
  6457. Mark main input as a pre-processed input and activate clean source input
  6458. stream. This allows the input to be pre-processed with various filters to help
  6459. the metrics calculation while keeping the frame selection lossless. When set to
  6460. @code{1}, the first stream is for the pre-processed input, and the second
  6461. stream is the clean source from where the kept frames are chosen. Default is
  6462. @code{0}.
  6463. @item chroma
  6464. Set whether or not chroma is considered in the metric calculations. Default is
  6465. @code{1}.
  6466. @end table
  6467. @section deconvolve
  6468. Apply 2D deconvolution of video stream in frequency domain using second stream
  6469. as impulse.
  6470. The filter accepts the following options:
  6471. @table @option
  6472. @item planes
  6473. Set which planes to process.
  6474. @item impulse
  6475. Set which impulse video frames will be processed, can be @var{first}
  6476. or @var{all}. Default is @var{all}.
  6477. @item noise
  6478. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6479. and height are not same and not power of 2 or if stream prior to convolving
  6480. had noise.
  6481. @end table
  6482. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6483. @section dedot
  6484. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6485. It accepts the following options:
  6486. @table @option
  6487. @item m
  6488. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6489. @var{rainbows} for cross-color reduction.
  6490. @item lt
  6491. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6492. @item tl
  6493. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6494. @item tc
  6495. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6496. @item ct
  6497. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6498. @end table
  6499. @section deflate
  6500. Apply deflate effect to the video.
  6501. This filter replaces the pixel by the local(3x3) average by taking into account
  6502. only values lower than the pixel.
  6503. It accepts the following options:
  6504. @table @option
  6505. @item threshold0
  6506. @item threshold1
  6507. @item threshold2
  6508. @item threshold3
  6509. Limit the maximum change for each plane, default is 65535.
  6510. If 0, plane will remain unchanged.
  6511. @end table
  6512. @section deflicker
  6513. Remove temporal frame luminance variations.
  6514. It accepts the following options:
  6515. @table @option
  6516. @item size, s
  6517. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6518. @item mode, m
  6519. Set averaging mode to smooth temporal luminance variations.
  6520. Available values are:
  6521. @table @samp
  6522. @item am
  6523. Arithmetic mean
  6524. @item gm
  6525. Geometric mean
  6526. @item hm
  6527. Harmonic mean
  6528. @item qm
  6529. Quadratic mean
  6530. @item cm
  6531. Cubic mean
  6532. @item pm
  6533. Power mean
  6534. @item median
  6535. Median
  6536. @end table
  6537. @item bypass
  6538. Do not actually modify frame. Useful when one only wants metadata.
  6539. @end table
  6540. @section dejudder
  6541. Remove judder produced by partially interlaced telecined content.
  6542. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6543. source was partially telecined content then the output of @code{pullup,dejudder}
  6544. will have a variable frame rate. May change the recorded frame rate of the
  6545. container. Aside from that change, this filter will not affect constant frame
  6546. rate video.
  6547. The option available in this filter is:
  6548. @table @option
  6549. @item cycle
  6550. Specify the length of the window over which the judder repeats.
  6551. Accepts any integer greater than 1. Useful values are:
  6552. @table @samp
  6553. @item 4
  6554. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6555. @item 5
  6556. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6557. @item 20
  6558. If a mixture of the two.
  6559. @end table
  6560. The default is @samp{4}.
  6561. @end table
  6562. @section delogo
  6563. Suppress a TV station logo by a simple interpolation of the surrounding
  6564. pixels. Just set a rectangle covering the logo and watch it disappear
  6565. (and sometimes something even uglier appear - your mileage may vary).
  6566. It accepts the following parameters:
  6567. @table @option
  6568. @item x
  6569. @item y
  6570. Specify the top left corner coordinates of the logo. They must be
  6571. specified.
  6572. @item w
  6573. @item h
  6574. Specify the width and height of the logo to clear. They must be
  6575. specified.
  6576. @item band, t
  6577. Specify the thickness of the fuzzy edge of the rectangle (added to
  6578. @var{w} and @var{h}). The default value is 1. This option is
  6579. deprecated, setting higher values should no longer be necessary and
  6580. is not recommended.
  6581. @item show
  6582. When set to 1, a green rectangle is drawn on the screen to simplify
  6583. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6584. The default value is 0.
  6585. The rectangle is drawn on the outermost pixels which will be (partly)
  6586. replaced with interpolated values. The values of the next pixels
  6587. immediately outside this rectangle in each direction will be used to
  6588. compute the interpolated pixel values inside the rectangle.
  6589. @end table
  6590. @subsection Examples
  6591. @itemize
  6592. @item
  6593. Set a rectangle covering the area with top left corner coordinates 0,0
  6594. and size 100x77, and a band of size 10:
  6595. @example
  6596. delogo=x=0:y=0:w=100:h=77:band=10
  6597. @end example
  6598. @end itemize
  6599. @section derain
  6600. Remove the rain in the input image/video by applying the derain methods based on
  6601. convolutional neural networks. Supported models:
  6602. @itemize
  6603. @item
  6604. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  6605. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  6606. @end itemize
  6607. Training as well as model generation scripts are provided in
  6608. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  6609. Native model files (.model) can be generated from TensorFlow model
  6610. files (.pb) by using tools/python/convert.py
  6611. The filter accepts the following options:
  6612. @table @option
  6613. @item filter_type
  6614. Specify which filter to use. This option accepts the following values:
  6615. @table @samp
  6616. @item derain
  6617. Derain filter. To conduct derain filter, you need to use a derain model.
  6618. @item dehaze
  6619. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  6620. @end table
  6621. Default value is @samp{derain}.
  6622. @item dnn_backend
  6623. Specify which DNN backend to use for model loading and execution. This option accepts
  6624. the following values:
  6625. @table @samp
  6626. @item native
  6627. Native implementation of DNN loading and execution.
  6628. @item tensorflow
  6629. TensorFlow backend. To enable this backend you
  6630. need to install the TensorFlow for C library (see
  6631. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  6632. @code{--enable-libtensorflow}
  6633. @end table
  6634. Default value is @samp{native}.
  6635. @item model
  6636. Set path to model file specifying network architecture and its parameters.
  6637. Note that different backends use different file formats. TensorFlow and native
  6638. backend can load files for only its format.
  6639. @end table
  6640. @section deshake
  6641. Attempt to fix small changes in horizontal and/or vertical shift. This
  6642. filter helps remove camera shake from hand-holding a camera, bumping a
  6643. tripod, moving on a vehicle, etc.
  6644. The filter accepts the following options:
  6645. @table @option
  6646. @item x
  6647. @item y
  6648. @item w
  6649. @item h
  6650. Specify a rectangular area where to limit the search for motion
  6651. vectors.
  6652. If desired the search for motion vectors can be limited to a
  6653. rectangular area of the frame defined by its top left corner, width
  6654. and height. These parameters have the same meaning as the drawbox
  6655. filter which can be used to visualise the position of the bounding
  6656. box.
  6657. This is useful when simultaneous movement of subjects within the frame
  6658. might be confused for camera motion by the motion vector search.
  6659. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6660. then the full frame is used. This allows later options to be set
  6661. without specifying the bounding box for the motion vector search.
  6662. Default - search the whole frame.
  6663. @item rx
  6664. @item ry
  6665. Specify the maximum extent of movement in x and y directions in the
  6666. range 0-64 pixels. Default 16.
  6667. @item edge
  6668. Specify how to generate pixels to fill blanks at the edge of the
  6669. frame. Available values are:
  6670. @table @samp
  6671. @item blank, 0
  6672. Fill zeroes at blank locations
  6673. @item original, 1
  6674. Original image at blank locations
  6675. @item clamp, 2
  6676. Extruded edge value at blank locations
  6677. @item mirror, 3
  6678. Mirrored edge at blank locations
  6679. @end table
  6680. Default value is @samp{mirror}.
  6681. @item blocksize
  6682. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6683. default 8.
  6684. @item contrast
  6685. Specify the contrast threshold for blocks. Only blocks with more than
  6686. the specified contrast (difference between darkest and lightest
  6687. pixels) will be considered. Range 1-255, default 125.
  6688. @item search
  6689. Specify the search strategy. Available values are:
  6690. @table @samp
  6691. @item exhaustive, 0
  6692. Set exhaustive search
  6693. @item less, 1
  6694. Set less exhaustive search.
  6695. @end table
  6696. Default value is @samp{exhaustive}.
  6697. @item filename
  6698. If set then a detailed log of the motion search is written to the
  6699. specified file.
  6700. @end table
  6701. @section despill
  6702. Remove unwanted contamination of foreground colors, caused by reflected color of
  6703. greenscreen or bluescreen.
  6704. This filter accepts the following options:
  6705. @table @option
  6706. @item type
  6707. Set what type of despill to use.
  6708. @item mix
  6709. Set how spillmap will be generated.
  6710. @item expand
  6711. Set how much to get rid of still remaining spill.
  6712. @item red
  6713. Controls amount of red in spill area.
  6714. @item green
  6715. Controls amount of green in spill area.
  6716. Should be -1 for greenscreen.
  6717. @item blue
  6718. Controls amount of blue in spill area.
  6719. Should be -1 for bluescreen.
  6720. @item brightness
  6721. Controls brightness of spill area, preserving colors.
  6722. @item alpha
  6723. Modify alpha from generated spillmap.
  6724. @end table
  6725. @section detelecine
  6726. Apply an exact inverse of the telecine operation. It requires a predefined
  6727. pattern specified using the pattern option which must be the same as that passed
  6728. to the telecine filter.
  6729. This filter accepts the following options:
  6730. @table @option
  6731. @item first_field
  6732. @table @samp
  6733. @item top, t
  6734. top field first
  6735. @item bottom, b
  6736. bottom field first
  6737. The default value is @code{top}.
  6738. @end table
  6739. @item pattern
  6740. A string of numbers representing the pulldown pattern you wish to apply.
  6741. The default value is @code{23}.
  6742. @item start_frame
  6743. A number representing position of the first frame with respect to the telecine
  6744. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6745. @end table
  6746. @section dilation
  6747. Apply dilation effect to the video.
  6748. This filter replaces the pixel by the local(3x3) maximum.
  6749. It accepts the following options:
  6750. @table @option
  6751. @item threshold0
  6752. @item threshold1
  6753. @item threshold2
  6754. @item threshold3
  6755. Limit the maximum change for each plane, default is 65535.
  6756. If 0, plane will remain unchanged.
  6757. @item coordinates
  6758. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6759. pixels are used.
  6760. Flags to local 3x3 coordinates maps like this:
  6761. 1 2 3
  6762. 4 5
  6763. 6 7 8
  6764. @end table
  6765. @section displace
  6766. Displace pixels as indicated by second and third input stream.
  6767. It takes three input streams and outputs one stream, the first input is the
  6768. source, and second and third input are displacement maps.
  6769. The second input specifies how much to displace pixels along the
  6770. x-axis, while the third input specifies how much to displace pixels
  6771. along the y-axis.
  6772. If one of displacement map streams terminates, last frame from that
  6773. displacement map will be used.
  6774. Note that once generated, displacements maps can be reused over and over again.
  6775. A description of the accepted options follows.
  6776. @table @option
  6777. @item edge
  6778. Set displace behavior for pixels that are out of range.
  6779. Available values are:
  6780. @table @samp
  6781. @item blank
  6782. Missing pixels are replaced by black pixels.
  6783. @item smear
  6784. Adjacent pixels will spread out to replace missing pixels.
  6785. @item wrap
  6786. Out of range pixels are wrapped so they point to pixels of other side.
  6787. @item mirror
  6788. Out of range pixels will be replaced with mirrored pixels.
  6789. @end table
  6790. Default is @samp{smear}.
  6791. @end table
  6792. @subsection Examples
  6793. @itemize
  6794. @item
  6795. Add ripple effect to rgb input of video size hd720:
  6796. @example
  6797. 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
  6798. @end example
  6799. @item
  6800. Add wave effect to rgb input of video size hd720:
  6801. @example
  6802. 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
  6803. @end example
  6804. @end itemize
  6805. @section drawbox
  6806. Draw a colored box on the input image.
  6807. It accepts the following parameters:
  6808. @table @option
  6809. @item x
  6810. @item y
  6811. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6812. @item width, w
  6813. @item height, h
  6814. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6815. the input width and height. It defaults to 0.
  6816. @item color, c
  6817. Specify the color of the box to write. For the general syntax of this option,
  6818. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6819. value @code{invert} is used, the box edge color is the same as the
  6820. video with inverted luma.
  6821. @item thickness, t
  6822. The expression which sets the thickness of the box edge.
  6823. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6824. See below for the list of accepted constants.
  6825. @item replace
  6826. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6827. will overwrite the video's color and alpha pixels.
  6828. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6829. @end table
  6830. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6831. following constants:
  6832. @table @option
  6833. @item dar
  6834. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6835. @item hsub
  6836. @item vsub
  6837. horizontal and vertical chroma subsample values. For example for the
  6838. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6839. @item in_h, ih
  6840. @item in_w, iw
  6841. The input width and height.
  6842. @item sar
  6843. The input sample aspect ratio.
  6844. @item x
  6845. @item y
  6846. The x and y offset coordinates where the box is drawn.
  6847. @item w
  6848. @item h
  6849. The width and height of the drawn box.
  6850. @item t
  6851. The thickness of the drawn box.
  6852. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6853. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6854. @end table
  6855. @subsection Examples
  6856. @itemize
  6857. @item
  6858. Draw a black box around the edge of the input image:
  6859. @example
  6860. drawbox
  6861. @end example
  6862. @item
  6863. Draw a box with color red and an opacity of 50%:
  6864. @example
  6865. drawbox=10:20:200:60:red@@0.5
  6866. @end example
  6867. The previous example can be specified as:
  6868. @example
  6869. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6870. @end example
  6871. @item
  6872. Fill the box with pink color:
  6873. @example
  6874. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6875. @end example
  6876. @item
  6877. Draw a 2-pixel red 2.40:1 mask:
  6878. @example
  6879. 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
  6880. @end example
  6881. @end itemize
  6882. @subsection Commands
  6883. This filter supports same commands as options.
  6884. The command accepts the same syntax of the corresponding option.
  6885. If the specified expression is not valid, it is kept at its current
  6886. value.
  6887. @section drawgrid
  6888. Draw a grid on the input image.
  6889. It accepts the following parameters:
  6890. @table @option
  6891. @item x
  6892. @item y
  6893. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6894. @item width, w
  6895. @item height, h
  6896. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6897. input width and height, respectively, minus @code{thickness}, so image gets
  6898. framed. Default to 0.
  6899. @item color, c
  6900. Specify the color of the grid. For the general syntax of this option,
  6901. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6902. value @code{invert} is used, the grid color is the same as the
  6903. video with inverted luma.
  6904. @item thickness, t
  6905. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6906. See below for the list of accepted constants.
  6907. @item replace
  6908. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6909. will overwrite the video's color and alpha pixels.
  6910. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6911. @end table
  6912. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6913. following constants:
  6914. @table @option
  6915. @item dar
  6916. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6917. @item hsub
  6918. @item vsub
  6919. horizontal and vertical chroma subsample values. For example for the
  6920. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6921. @item in_h, ih
  6922. @item in_w, iw
  6923. The input grid cell width and height.
  6924. @item sar
  6925. The input sample aspect ratio.
  6926. @item x
  6927. @item y
  6928. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6929. @item w
  6930. @item h
  6931. The width and height of the drawn cell.
  6932. @item t
  6933. The thickness of the drawn cell.
  6934. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6935. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6936. @end table
  6937. @subsection Examples
  6938. @itemize
  6939. @item
  6940. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6941. @example
  6942. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6943. @end example
  6944. @item
  6945. Draw a white 3x3 grid with an opacity of 50%:
  6946. @example
  6947. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6948. @end example
  6949. @end itemize
  6950. @subsection Commands
  6951. This filter supports same commands as options.
  6952. The command accepts the same syntax of the corresponding option.
  6953. If the specified expression is not valid, it is kept at its current
  6954. value.
  6955. @anchor{drawtext}
  6956. @section drawtext
  6957. Draw a text string or text from a specified file on top of a video, using the
  6958. libfreetype library.
  6959. To enable compilation of this filter, you need to configure FFmpeg with
  6960. @code{--enable-libfreetype}.
  6961. To enable default font fallback and the @var{font} option you need to
  6962. configure FFmpeg with @code{--enable-libfontconfig}.
  6963. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6964. @code{--enable-libfribidi}.
  6965. @subsection Syntax
  6966. It accepts the following parameters:
  6967. @table @option
  6968. @item box
  6969. Used to draw a box around text using the background color.
  6970. The value must be either 1 (enable) or 0 (disable).
  6971. The default value of @var{box} is 0.
  6972. @item boxborderw
  6973. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6974. The default value of @var{boxborderw} is 0.
  6975. @item boxcolor
  6976. The color to be used for drawing box around text. For the syntax of this
  6977. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6978. The default value of @var{boxcolor} is "white".
  6979. @item line_spacing
  6980. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6981. The default value of @var{line_spacing} is 0.
  6982. @item borderw
  6983. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6984. The default value of @var{borderw} is 0.
  6985. @item bordercolor
  6986. Set the color to be used for drawing border around text. For the syntax of this
  6987. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6988. The default value of @var{bordercolor} is "black".
  6989. @item expansion
  6990. Select how the @var{text} is expanded. Can be either @code{none},
  6991. @code{strftime} (deprecated) or
  6992. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6993. below for details.
  6994. @item basetime
  6995. Set a start time for the count. Value is in microseconds. Only applied
  6996. in the deprecated strftime expansion mode. To emulate in normal expansion
  6997. mode use the @code{pts} function, supplying the start time (in seconds)
  6998. as the second argument.
  6999. @item fix_bounds
  7000. If true, check and fix text coords to avoid clipping.
  7001. @item fontcolor
  7002. The color to be used for drawing fonts. For the syntax of this option, check
  7003. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7004. The default value of @var{fontcolor} is "black".
  7005. @item fontcolor_expr
  7006. String which is expanded the same way as @var{text} to obtain dynamic
  7007. @var{fontcolor} value. By default this option has empty value and is not
  7008. processed. When this option is set, it overrides @var{fontcolor} option.
  7009. @item font
  7010. The font family to be used for drawing text. By default Sans.
  7011. @item fontfile
  7012. The font file to be used for drawing text. The path must be included.
  7013. This parameter is mandatory if the fontconfig support is disabled.
  7014. @item alpha
  7015. Draw the text applying alpha blending. The value can
  7016. be a number between 0.0 and 1.0.
  7017. The expression accepts the same variables @var{x, y} as well.
  7018. The default value is 1.
  7019. Please see @var{fontcolor_expr}.
  7020. @item fontsize
  7021. The font size to be used for drawing text.
  7022. The default value of @var{fontsize} is 16.
  7023. @item text_shaping
  7024. If set to 1, attempt to shape the text (for example, reverse the order of
  7025. right-to-left text and join Arabic characters) before drawing it.
  7026. Otherwise, just draw the text exactly as given.
  7027. By default 1 (if supported).
  7028. @item ft_load_flags
  7029. The flags to be used for loading the fonts.
  7030. The flags map the corresponding flags supported by libfreetype, and are
  7031. a combination of the following values:
  7032. @table @var
  7033. @item default
  7034. @item no_scale
  7035. @item no_hinting
  7036. @item render
  7037. @item no_bitmap
  7038. @item vertical_layout
  7039. @item force_autohint
  7040. @item crop_bitmap
  7041. @item pedantic
  7042. @item ignore_global_advance_width
  7043. @item no_recurse
  7044. @item ignore_transform
  7045. @item monochrome
  7046. @item linear_design
  7047. @item no_autohint
  7048. @end table
  7049. Default value is "default".
  7050. For more information consult the documentation for the FT_LOAD_*
  7051. libfreetype flags.
  7052. @item shadowcolor
  7053. The color to be used for drawing a shadow behind the drawn text. For the
  7054. syntax of this option, check the @ref{color syntax,,"Color" section in the
  7055. ffmpeg-utils manual,ffmpeg-utils}.
  7056. The default value of @var{shadowcolor} is "black".
  7057. @item shadowx
  7058. @item shadowy
  7059. The x and y offsets for the text shadow position with respect to the
  7060. position of the text. They can be either positive or negative
  7061. values. The default value for both is "0".
  7062. @item start_number
  7063. The starting frame number for the n/frame_num variable. The default value
  7064. is "0".
  7065. @item tabsize
  7066. The size in number of spaces to use for rendering the tab.
  7067. Default value is 4.
  7068. @item timecode
  7069. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  7070. format. It can be used with or without text parameter. @var{timecode_rate}
  7071. option must be specified.
  7072. @item timecode_rate, rate, r
  7073. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  7074. integer. Minimum value is "1".
  7075. Drop-frame timecode is supported for frame rates 30 & 60.
  7076. @item tc24hmax
  7077. If set to 1, the output of the timecode option will wrap around at 24 hours.
  7078. Default is 0 (disabled).
  7079. @item text
  7080. The text string to be drawn. The text must be a sequence of UTF-8
  7081. encoded characters.
  7082. This parameter is mandatory if no file is specified with the parameter
  7083. @var{textfile}.
  7084. @item textfile
  7085. A text file containing text to be drawn. The text must be a sequence
  7086. of UTF-8 encoded characters.
  7087. This parameter is mandatory if no text string is specified with the
  7088. parameter @var{text}.
  7089. If both @var{text} and @var{textfile} are specified, an error is thrown.
  7090. @item reload
  7091. If set to 1, the @var{textfile} will be reloaded before each frame.
  7092. Be sure to update it atomically, or it may be read partially, or even fail.
  7093. @item x
  7094. @item y
  7095. The expressions which specify the offsets where text will be drawn
  7096. within the video frame. They are relative to the top/left border of the
  7097. output image.
  7098. The default value of @var{x} and @var{y} is "0".
  7099. See below for the list of accepted constants and functions.
  7100. @end table
  7101. The parameters for @var{x} and @var{y} are expressions containing the
  7102. following constants and functions:
  7103. @table @option
  7104. @item dar
  7105. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  7106. @item hsub
  7107. @item vsub
  7108. horizontal and vertical chroma subsample values. For example for the
  7109. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7110. @item line_h, lh
  7111. the height of each text line
  7112. @item main_h, h, H
  7113. the input height
  7114. @item main_w, w, W
  7115. the input width
  7116. @item max_glyph_a, ascent
  7117. the maximum distance from the baseline to the highest/upper grid
  7118. coordinate used to place a glyph outline point, for all the rendered
  7119. glyphs.
  7120. It is a positive value, due to the grid's orientation with the Y axis
  7121. upwards.
  7122. @item max_glyph_d, descent
  7123. the maximum distance from the baseline to the lowest grid coordinate
  7124. used to place a glyph outline point, for all the rendered glyphs.
  7125. This is a negative value, due to the grid's orientation, with the Y axis
  7126. upwards.
  7127. @item max_glyph_h
  7128. maximum glyph height, that is the maximum height for all the glyphs
  7129. contained in the rendered text, it is equivalent to @var{ascent} -
  7130. @var{descent}.
  7131. @item max_glyph_w
  7132. maximum glyph width, that is the maximum width for all the glyphs
  7133. contained in the rendered text
  7134. @item n
  7135. the number of input frame, starting from 0
  7136. @item rand(min, max)
  7137. return a random number included between @var{min} and @var{max}
  7138. @item sar
  7139. The input sample aspect ratio.
  7140. @item t
  7141. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7142. @item text_h, th
  7143. the height of the rendered text
  7144. @item text_w, tw
  7145. the width of the rendered text
  7146. @item x
  7147. @item y
  7148. the x and y offset coordinates where the text is drawn.
  7149. These parameters allow the @var{x} and @var{y} expressions to refer
  7150. to each other, so you can for example specify @code{y=x/dar}.
  7151. @item pict_type
  7152. A one character description of the current frame's picture type.
  7153. @item pkt_pos
  7154. The current packet's position in the input file or stream
  7155. (in bytes, from the start of the input). A value of -1 indicates
  7156. this info is not available.
  7157. @item pkt_duration
  7158. The current packet's duration, in seconds.
  7159. @item pkt_size
  7160. The current packet's size (in bytes).
  7161. @end table
  7162. @anchor{drawtext_expansion}
  7163. @subsection Text expansion
  7164. If @option{expansion} is set to @code{strftime},
  7165. the filter recognizes strftime() sequences in the provided text and
  7166. expands them accordingly. Check the documentation of strftime(). This
  7167. feature is deprecated.
  7168. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  7169. If @option{expansion} is set to @code{normal} (which is the default),
  7170. the following expansion mechanism is used.
  7171. The backslash character @samp{\}, followed by any character, always expands to
  7172. the second character.
  7173. Sequences of the form @code{%@{...@}} are expanded. The text between the
  7174. braces is a function name, possibly followed by arguments separated by ':'.
  7175. If the arguments contain special characters or delimiters (':' or '@}'),
  7176. they should be escaped.
  7177. Note that they probably must also be escaped as the value for the
  7178. @option{text} option in the filter argument string and as the filter
  7179. argument in the filtergraph description, and possibly also for the shell,
  7180. that makes up to four levels of escaping; using a text file avoids these
  7181. problems.
  7182. The following functions are available:
  7183. @table @command
  7184. @item expr, e
  7185. The expression evaluation result.
  7186. It must take one argument specifying the expression to be evaluated,
  7187. which accepts the same constants and functions as the @var{x} and
  7188. @var{y} values. Note that not all constants should be used, for
  7189. example the text size is not known when evaluating the expression, so
  7190. the constants @var{text_w} and @var{text_h} will have an undefined
  7191. value.
  7192. @item expr_int_format, eif
  7193. Evaluate the expression's value and output as formatted integer.
  7194. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  7195. The second argument specifies the output format. Allowed values are @samp{x},
  7196. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  7197. @code{printf} function.
  7198. The third parameter is optional and sets the number of positions taken by the output.
  7199. It can be used to add padding with zeros from the left.
  7200. @item gmtime
  7201. The time at which the filter is running, expressed in UTC.
  7202. It can accept an argument: a strftime() format string.
  7203. @item localtime
  7204. The time at which the filter is running, expressed in the local time zone.
  7205. It can accept an argument: a strftime() format string.
  7206. @item metadata
  7207. Frame metadata. Takes one or two arguments.
  7208. The first argument is mandatory and specifies the metadata key.
  7209. The second argument is optional and specifies a default value, used when the
  7210. metadata key is not found or empty.
  7211. Available metadata can be identified by inspecting entries
  7212. starting with TAG included within each frame section
  7213. printed by running @code{ffprobe -show_frames}.
  7214. String metadata generated in filters leading to
  7215. the drawtext filter are also available.
  7216. @item n, frame_num
  7217. The frame number, starting from 0.
  7218. @item pict_type
  7219. A one character description of the current picture type.
  7220. @item pts
  7221. The timestamp of the current frame.
  7222. It can take up to three arguments.
  7223. The first argument is the format of the timestamp; it defaults to @code{flt}
  7224. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  7225. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  7226. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  7227. @code{localtime} stands for the timestamp of the frame formatted as
  7228. local time zone time.
  7229. The second argument is an offset added to the timestamp.
  7230. If the format is set to @code{hms}, a third argument @code{24HH} may be
  7231. supplied to present the hour part of the formatted timestamp in 24h format
  7232. (00-23).
  7233. If the format is set to @code{localtime} or @code{gmtime},
  7234. a third argument may be supplied: a strftime() format string.
  7235. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  7236. @end table
  7237. @subsection Commands
  7238. This filter supports altering parameters via commands:
  7239. @table @option
  7240. @item reinit
  7241. Alter existing filter parameters.
  7242. Syntax for the argument is the same as for filter invocation, e.g.
  7243. @example
  7244. fontsize=56:fontcolor=green:text='Hello World'
  7245. @end example
  7246. Full filter invocation with sendcmd would look like this:
  7247. @example
  7248. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7249. @end example
  7250. @end table
  7251. If the entire argument can't be parsed or applied as valid values then the filter will
  7252. continue with its existing parameters.
  7253. @subsection Examples
  7254. @itemize
  7255. @item
  7256. Draw "Test Text" with font FreeSerif, using the default values for the
  7257. optional parameters.
  7258. @example
  7259. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7260. @end example
  7261. @item
  7262. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7263. and y=50 (counting from the top-left corner of the screen), text is
  7264. yellow with a red box around it. Both the text and the box have an
  7265. opacity of 20%.
  7266. @example
  7267. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7268. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7269. @end example
  7270. Note that the double quotes are not necessary if spaces are not used
  7271. within the parameter list.
  7272. @item
  7273. Show the text at the center of the video frame:
  7274. @example
  7275. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7276. @end example
  7277. @item
  7278. Show the text at a random position, switching to a new position every 30 seconds:
  7279. @example
  7280. 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)"
  7281. @end example
  7282. @item
  7283. Show a text line sliding from right to left in the last row of the video
  7284. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7285. with no newlines.
  7286. @example
  7287. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7288. @end example
  7289. @item
  7290. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7291. @example
  7292. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7293. @end example
  7294. @item
  7295. Draw a single green letter "g", at the center of the input video.
  7296. The glyph baseline is placed at half screen height.
  7297. @example
  7298. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7299. @end example
  7300. @item
  7301. Show text for 1 second every 3 seconds:
  7302. @example
  7303. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7304. @end example
  7305. @item
  7306. Use fontconfig to set the font. Note that the colons need to be escaped.
  7307. @example
  7308. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7309. @end example
  7310. @item
  7311. Print the date of a real-time encoding (see strftime(3)):
  7312. @example
  7313. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7314. @end example
  7315. @item
  7316. Show text fading in and out (appearing/disappearing):
  7317. @example
  7318. #!/bin/sh
  7319. DS=1.0 # display start
  7320. DE=10.0 # display end
  7321. FID=1.5 # fade in duration
  7322. FOD=5 # fade out duration
  7323. 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 @}"
  7324. @end example
  7325. @item
  7326. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7327. and the @option{fontsize} value are included in the @option{y} offset.
  7328. @example
  7329. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7330. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7331. @end example
  7332. @end itemize
  7333. For more information about libfreetype, check:
  7334. @url{http://www.freetype.org/}.
  7335. For more information about fontconfig, check:
  7336. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7337. For more information about libfribidi, check:
  7338. @url{http://fribidi.org/}.
  7339. @section edgedetect
  7340. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7341. The filter accepts the following options:
  7342. @table @option
  7343. @item low
  7344. @item high
  7345. Set low and high threshold values used by the Canny thresholding
  7346. algorithm.
  7347. The high threshold selects the "strong" edge pixels, which are then
  7348. connected through 8-connectivity with the "weak" edge pixels selected
  7349. by the low threshold.
  7350. @var{low} and @var{high} threshold values must be chosen in the range
  7351. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7352. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  7353. is @code{50/255}.
  7354. @item mode
  7355. Define the drawing mode.
  7356. @table @samp
  7357. @item wires
  7358. Draw white/gray wires on black background.
  7359. @item colormix
  7360. Mix the colors to create a paint/cartoon effect.
  7361. @item canny
  7362. Apply Canny edge detector on all selected planes.
  7363. @end table
  7364. Default value is @var{wires}.
  7365. @item planes
  7366. Select planes for filtering. By default all available planes are filtered.
  7367. @end table
  7368. @subsection Examples
  7369. @itemize
  7370. @item
  7371. Standard edge detection with custom values for the hysteresis thresholding:
  7372. @example
  7373. edgedetect=low=0.1:high=0.4
  7374. @end example
  7375. @item
  7376. Painting effect without thresholding:
  7377. @example
  7378. edgedetect=mode=colormix:high=0
  7379. @end example
  7380. @end itemize
  7381. @section elbg
  7382. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7383. For each input image, the filter will compute the optimal mapping from
  7384. the input to the output given the codebook length, that is the number
  7385. of distinct output colors.
  7386. This filter accepts the following options.
  7387. @table @option
  7388. @item codebook_length, l
  7389. Set codebook length. The value must be a positive integer, and
  7390. represents the number of distinct output colors. Default value is 256.
  7391. @item nb_steps, n
  7392. Set the maximum number of iterations to apply for computing the optimal
  7393. mapping. The higher the value the better the result and the higher the
  7394. computation time. Default value is 1.
  7395. @item seed, s
  7396. Set a random seed, must be an integer included between 0 and
  7397. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7398. will try to use a good random seed on a best effort basis.
  7399. @item pal8
  7400. Set pal8 output pixel format. This option does not work with codebook
  7401. length greater than 256.
  7402. @end table
  7403. @section entropy
  7404. Measure graylevel entropy in histogram of color channels of video frames.
  7405. It accepts the following parameters:
  7406. @table @option
  7407. @item mode
  7408. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7409. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7410. between neighbour histogram values.
  7411. @end table
  7412. @section eq
  7413. Set brightness, contrast, saturation and approximate gamma adjustment.
  7414. The filter accepts the following options:
  7415. @table @option
  7416. @item contrast
  7417. Set the contrast expression. The value must be a float value in range
  7418. @code{-1000.0} to @code{1000.0}. The default value is "1".
  7419. @item brightness
  7420. Set the brightness expression. The value must be a float value in
  7421. range @code{-1.0} to @code{1.0}. The default value is "0".
  7422. @item saturation
  7423. Set the saturation expression. The value must be a float in
  7424. range @code{0.0} to @code{3.0}. The default value is "1".
  7425. @item gamma
  7426. Set the gamma expression. The value must be a float in range
  7427. @code{0.1} to @code{10.0}. The default value is "1".
  7428. @item gamma_r
  7429. Set the gamma expression for red. The value must be a float in
  7430. range @code{0.1} to @code{10.0}. The default value is "1".
  7431. @item gamma_g
  7432. Set the gamma expression for green. The value must be a float in range
  7433. @code{0.1} to @code{10.0}. The default value is "1".
  7434. @item gamma_b
  7435. Set the gamma expression for blue. The value must be a float in range
  7436. @code{0.1} to @code{10.0}. The default value is "1".
  7437. @item gamma_weight
  7438. Set the gamma weight expression. It can be used to reduce the effect
  7439. of a high gamma value on bright image areas, e.g. keep them from
  7440. getting overamplified and just plain white. The value must be a float
  7441. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7442. gamma correction all the way down while @code{1.0} leaves it at its
  7443. full strength. Default is "1".
  7444. @item eval
  7445. Set when the expressions for brightness, contrast, saturation and
  7446. gamma expressions are evaluated.
  7447. It accepts the following values:
  7448. @table @samp
  7449. @item init
  7450. only evaluate expressions once during the filter initialization or
  7451. when a command is processed
  7452. @item frame
  7453. evaluate expressions for each incoming frame
  7454. @end table
  7455. Default value is @samp{init}.
  7456. @end table
  7457. The expressions accept the following parameters:
  7458. @table @option
  7459. @item n
  7460. frame count of the input frame starting from 0
  7461. @item pos
  7462. byte position of the corresponding packet in the input file, NAN if
  7463. unspecified
  7464. @item r
  7465. frame rate of the input video, NAN if the input frame rate is unknown
  7466. @item t
  7467. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7468. @end table
  7469. @subsection Commands
  7470. The filter supports the following commands:
  7471. @table @option
  7472. @item contrast
  7473. Set the contrast expression.
  7474. @item brightness
  7475. Set the brightness expression.
  7476. @item saturation
  7477. Set the saturation expression.
  7478. @item gamma
  7479. Set the gamma expression.
  7480. @item gamma_r
  7481. Set the gamma_r expression.
  7482. @item gamma_g
  7483. Set gamma_g expression.
  7484. @item gamma_b
  7485. Set gamma_b expression.
  7486. @item gamma_weight
  7487. Set gamma_weight expression.
  7488. The command accepts the same syntax of the corresponding option.
  7489. If the specified expression is not valid, it is kept at its current
  7490. value.
  7491. @end table
  7492. @section erosion
  7493. Apply erosion effect to the video.
  7494. This filter replaces the pixel by the local(3x3) minimum.
  7495. It accepts the following options:
  7496. @table @option
  7497. @item threshold0
  7498. @item threshold1
  7499. @item threshold2
  7500. @item threshold3
  7501. Limit the maximum change for each plane, default is 65535.
  7502. If 0, plane will remain unchanged.
  7503. @item coordinates
  7504. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7505. pixels are used.
  7506. Flags to local 3x3 coordinates maps like this:
  7507. 1 2 3
  7508. 4 5
  7509. 6 7 8
  7510. @end table
  7511. @section extractplanes
  7512. Extract color channel components from input video stream into
  7513. separate grayscale video streams.
  7514. The filter accepts the following option:
  7515. @table @option
  7516. @item planes
  7517. Set plane(s) to extract.
  7518. Available values for planes are:
  7519. @table @samp
  7520. @item y
  7521. @item u
  7522. @item v
  7523. @item a
  7524. @item r
  7525. @item g
  7526. @item b
  7527. @end table
  7528. Choosing planes not available in the input will result in an error.
  7529. That means you cannot select @code{r}, @code{g}, @code{b} planes
  7530. with @code{y}, @code{u}, @code{v} planes at same time.
  7531. @end table
  7532. @subsection Examples
  7533. @itemize
  7534. @item
  7535. Extract luma, u and v color channel component from input video frame
  7536. into 3 grayscale outputs:
  7537. @example
  7538. 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
  7539. @end example
  7540. @end itemize
  7541. @section fade
  7542. Apply a fade-in/out effect to the input video.
  7543. It accepts the following parameters:
  7544. @table @option
  7545. @item type, t
  7546. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7547. effect.
  7548. Default is @code{in}.
  7549. @item start_frame, s
  7550. Specify the number of the frame to start applying the fade
  7551. effect at. Default is 0.
  7552. @item nb_frames, n
  7553. The number of frames that the fade effect lasts. At the end of the
  7554. fade-in effect, the output video will have the same intensity as the input video.
  7555. At the end of the fade-out transition, the output video will be filled with the
  7556. selected @option{color}.
  7557. Default is 25.
  7558. @item alpha
  7559. If set to 1, fade only alpha channel, if one exists on the input.
  7560. Default value is 0.
  7561. @item start_time, st
  7562. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7563. effect. If both start_frame and start_time are specified, the fade will start at
  7564. whichever comes last. Default is 0.
  7565. @item duration, d
  7566. The number of seconds for which the fade effect has to last. At the end of the
  7567. fade-in effect the output video will have the same intensity as the input video,
  7568. at the end of the fade-out transition the output video will be filled with the
  7569. selected @option{color}.
  7570. If both duration and nb_frames are specified, duration is used. Default is 0
  7571. (nb_frames is used by default).
  7572. @item color, c
  7573. Specify the color of the fade. Default is "black".
  7574. @end table
  7575. @subsection Examples
  7576. @itemize
  7577. @item
  7578. Fade in the first 30 frames of video:
  7579. @example
  7580. fade=in:0:30
  7581. @end example
  7582. The command above is equivalent to:
  7583. @example
  7584. fade=t=in:s=0:n=30
  7585. @end example
  7586. @item
  7587. Fade out the last 45 frames of a 200-frame video:
  7588. @example
  7589. fade=out:155:45
  7590. fade=type=out:start_frame=155:nb_frames=45
  7591. @end example
  7592. @item
  7593. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7594. @example
  7595. fade=in:0:25, fade=out:975:25
  7596. @end example
  7597. @item
  7598. Make the first 5 frames yellow, then fade in from frame 5-24:
  7599. @example
  7600. fade=in:5:20:color=yellow
  7601. @end example
  7602. @item
  7603. Fade in alpha over first 25 frames of video:
  7604. @example
  7605. fade=in:0:25:alpha=1
  7606. @end example
  7607. @item
  7608. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7609. @example
  7610. fade=t=in:st=5.5:d=0.5
  7611. @end example
  7612. @end itemize
  7613. @section fftdnoiz
  7614. Denoise frames using 3D FFT (frequency domain filtering).
  7615. The filter accepts the following options:
  7616. @table @option
  7617. @item sigma
  7618. Set the noise sigma constant. This sets denoising strength.
  7619. Default value is 1. Allowed range is from 0 to 30.
  7620. Using very high sigma with low overlap may give blocking artifacts.
  7621. @item amount
  7622. Set amount of denoising. By default all detected noise is reduced.
  7623. Default value is 1. Allowed range is from 0 to 1.
  7624. @item block
  7625. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7626. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7627. block size in pixels is 2^4 which is 16.
  7628. @item overlap
  7629. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7630. @item prev
  7631. Set number of previous frames to use for denoising. By default is set to 0.
  7632. @item next
  7633. Set number of next frames to to use for denoising. By default is set to 0.
  7634. @item planes
  7635. Set planes which will be filtered, by default are all available filtered
  7636. except alpha.
  7637. @end table
  7638. @section fftfilt
  7639. Apply arbitrary expressions to samples in frequency domain
  7640. @table @option
  7641. @item dc_Y
  7642. Adjust the dc value (gain) of the luma plane of the image. The filter
  7643. accepts an integer value in range @code{0} to @code{1000}. The default
  7644. value is set to @code{0}.
  7645. @item dc_U
  7646. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7647. filter accepts an integer value in range @code{0} to @code{1000}. The
  7648. default value is set to @code{0}.
  7649. @item dc_V
  7650. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7651. filter accepts an integer value in range @code{0} to @code{1000}. The
  7652. default value is set to @code{0}.
  7653. @item weight_Y
  7654. Set the frequency domain weight expression for the luma plane.
  7655. @item weight_U
  7656. Set the frequency domain weight expression for the 1st chroma plane.
  7657. @item weight_V
  7658. Set the frequency domain weight expression for the 2nd chroma plane.
  7659. @item eval
  7660. Set when the expressions are evaluated.
  7661. It accepts the following values:
  7662. @table @samp
  7663. @item init
  7664. Only evaluate expressions once during the filter initialization.
  7665. @item frame
  7666. Evaluate expressions for each incoming frame.
  7667. @end table
  7668. Default value is @samp{init}.
  7669. The filter accepts the following variables:
  7670. @item X
  7671. @item Y
  7672. The coordinates of the current sample.
  7673. @item W
  7674. @item H
  7675. The width and height of the image.
  7676. @item N
  7677. The number of input frame, starting from 0.
  7678. @end table
  7679. @subsection Examples
  7680. @itemize
  7681. @item
  7682. High-pass:
  7683. @example
  7684. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7685. @end example
  7686. @item
  7687. Low-pass:
  7688. @example
  7689. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7690. @end example
  7691. @item
  7692. Sharpen:
  7693. @example
  7694. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7695. @end example
  7696. @item
  7697. Blur:
  7698. @example
  7699. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7700. @end example
  7701. @end itemize
  7702. @section field
  7703. Extract a single field from an interlaced image using stride
  7704. arithmetic to avoid wasting CPU time. The output frames are marked as
  7705. non-interlaced.
  7706. The filter accepts the following options:
  7707. @table @option
  7708. @item type
  7709. Specify whether to extract the top (if the value is @code{0} or
  7710. @code{top}) or the bottom field (if the value is @code{1} or
  7711. @code{bottom}).
  7712. @end table
  7713. @section fieldhint
  7714. Create new frames by copying the top and bottom fields from surrounding frames
  7715. supplied as numbers by the hint file.
  7716. @table @option
  7717. @item hint
  7718. Set file containing hints: absolute/relative frame numbers.
  7719. There must be one line for each frame in a clip. Each line must contain two
  7720. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7721. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7722. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7723. for @code{relative} mode. First number tells from which frame to pick up top
  7724. field and second number tells from which frame to pick up bottom field.
  7725. If optionally followed by @code{+} output frame will be marked as interlaced,
  7726. else if followed by @code{-} output frame will be marked as progressive, else
  7727. it will be marked same as input frame.
  7728. If line starts with @code{#} or @code{;} that line is skipped.
  7729. @item mode
  7730. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7731. @end table
  7732. Example of first several lines of @code{hint} file for @code{relative} mode:
  7733. @example
  7734. 0,0 - # first frame
  7735. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7736. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7737. 1,0 -
  7738. 0,0 -
  7739. 0,0 -
  7740. 1,0 -
  7741. 1,0 -
  7742. 1,0 -
  7743. 0,0 -
  7744. 0,0 -
  7745. 1,0 -
  7746. 1,0 -
  7747. 1,0 -
  7748. 0,0 -
  7749. @end example
  7750. @section fieldmatch
  7751. Field matching filter for inverse telecine. It is meant to reconstruct the
  7752. progressive frames from a telecined stream. The filter does not drop duplicated
  7753. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7754. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7755. The separation of the field matching and the decimation is notably motivated by
  7756. the possibility of inserting a de-interlacing filter fallback between the two.
  7757. If the source has mixed telecined and real interlaced content,
  7758. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7759. But these remaining combed frames will be marked as interlaced, and thus can be
  7760. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7761. In addition to the various configuration options, @code{fieldmatch} can take an
  7762. optional second stream, activated through the @option{ppsrc} option. If
  7763. enabled, the frames reconstruction will be based on the fields and frames from
  7764. this second stream. This allows the first input to be pre-processed in order to
  7765. help the various algorithms of the filter, while keeping the output lossless
  7766. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7767. or brightness/contrast adjustments can help.
  7768. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7769. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7770. which @code{fieldmatch} is based on. While the semantic and usage are very
  7771. close, some behaviour and options names can differ.
  7772. The @ref{decimate} filter currently only works for constant frame rate input.
  7773. If your input has mixed telecined (30fps) and progressive content with a lower
  7774. framerate like 24fps use the following filterchain to produce the necessary cfr
  7775. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7776. The filter accepts the following options:
  7777. @table @option
  7778. @item order
  7779. Specify the assumed field order of the input stream. Available values are:
  7780. @table @samp
  7781. @item auto
  7782. Auto detect parity (use FFmpeg's internal parity value).
  7783. @item bff
  7784. Assume bottom field first.
  7785. @item tff
  7786. Assume top field first.
  7787. @end table
  7788. Note that it is sometimes recommended not to trust the parity announced by the
  7789. stream.
  7790. Default value is @var{auto}.
  7791. @item mode
  7792. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7793. sense that it won't risk creating jerkiness due to duplicate frames when
  7794. possible, but if there are bad edits or blended fields it will end up
  7795. outputting combed frames when a good match might actually exist. On the other
  7796. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7797. but will almost always find a good frame if there is one. The other values are
  7798. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7799. jerkiness and creating duplicate frames versus finding good matches in sections
  7800. with bad edits, orphaned fields, blended fields, etc.
  7801. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7802. Available values are:
  7803. @table @samp
  7804. @item pc
  7805. 2-way matching (p/c)
  7806. @item pc_n
  7807. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7808. @item pc_u
  7809. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7810. @item pc_n_ub
  7811. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7812. still combed (p/c + n + u/b)
  7813. @item pcn
  7814. 3-way matching (p/c/n)
  7815. @item pcn_ub
  7816. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7817. detected as combed (p/c/n + u/b)
  7818. @end table
  7819. The parenthesis at the end indicate the matches that would be used for that
  7820. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7821. @var{top}).
  7822. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7823. the slowest.
  7824. Default value is @var{pc_n}.
  7825. @item ppsrc
  7826. Mark the main input stream as a pre-processed input, and enable the secondary
  7827. input stream as the clean source to pick the fields from. See the filter
  7828. introduction for more details. It is similar to the @option{clip2} feature from
  7829. VFM/TFM.
  7830. Default value is @code{0} (disabled).
  7831. @item field
  7832. Set the field to match from. It is recommended to set this to the same value as
  7833. @option{order} unless you experience matching failures with that setting. In
  7834. certain circumstances changing the field that is used to match from can have a
  7835. large impact on matching performance. Available values are:
  7836. @table @samp
  7837. @item auto
  7838. Automatic (same value as @option{order}).
  7839. @item bottom
  7840. Match from the bottom field.
  7841. @item top
  7842. Match from the top field.
  7843. @end table
  7844. Default value is @var{auto}.
  7845. @item mchroma
  7846. Set whether or not chroma is included during the match comparisons. In most
  7847. cases it is recommended to leave this enabled. You should set this to @code{0}
  7848. only if your clip has bad chroma problems such as heavy rainbowing or other
  7849. artifacts. Setting this to @code{0} could also be used to speed things up at
  7850. the cost of some accuracy.
  7851. Default value is @code{1}.
  7852. @item y0
  7853. @item y1
  7854. These define an exclusion band which excludes the lines between @option{y0} and
  7855. @option{y1} from being included in the field matching decision. An exclusion
  7856. band can be used to ignore subtitles, a logo, or other things that may
  7857. interfere with the matching. @option{y0} sets the starting scan line and
  7858. @option{y1} sets the ending line; all lines in between @option{y0} and
  7859. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7860. @option{y0} and @option{y1} to the same value will disable the feature.
  7861. @option{y0} and @option{y1} defaults to @code{0}.
  7862. @item scthresh
  7863. Set the scene change detection threshold as a percentage of maximum change on
  7864. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7865. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7866. @option{scthresh} is @code{[0.0, 100.0]}.
  7867. Default value is @code{12.0}.
  7868. @item combmatch
  7869. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7870. account the combed scores of matches when deciding what match to use as the
  7871. final match. Available values are:
  7872. @table @samp
  7873. @item none
  7874. No final matching based on combed scores.
  7875. @item sc
  7876. Combed scores are only used when a scene change is detected.
  7877. @item full
  7878. Use combed scores all the time.
  7879. @end table
  7880. Default is @var{sc}.
  7881. @item combdbg
  7882. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7883. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7884. Available values are:
  7885. @table @samp
  7886. @item none
  7887. No forced calculation.
  7888. @item pcn
  7889. Force p/c/n calculations.
  7890. @item pcnub
  7891. Force p/c/n/u/b calculations.
  7892. @end table
  7893. Default value is @var{none}.
  7894. @item cthresh
  7895. This is the area combing threshold used for combed frame detection. This
  7896. essentially controls how "strong" or "visible" combing must be to be detected.
  7897. Larger values mean combing must be more visible and smaller values mean combing
  7898. can be less visible or strong and still be detected. Valid settings are from
  7899. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7900. be detected as combed). This is basically a pixel difference value. A good
  7901. range is @code{[8, 12]}.
  7902. Default value is @code{9}.
  7903. @item chroma
  7904. Sets whether or not chroma is considered in the combed frame decision. Only
  7905. disable this if your source has chroma problems (rainbowing, etc.) that are
  7906. causing problems for the combed frame detection with chroma enabled. Actually,
  7907. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7908. where there is chroma only combing in the source.
  7909. Default value is @code{0}.
  7910. @item blockx
  7911. @item blocky
  7912. Respectively set the x-axis and y-axis size of the window used during combed
  7913. frame detection. This has to do with the size of the area in which
  7914. @option{combpel} pixels are required to be detected as combed for a frame to be
  7915. declared combed. See the @option{combpel} parameter description for more info.
  7916. Possible values are any number that is a power of 2 starting at 4 and going up
  7917. to 512.
  7918. Default value is @code{16}.
  7919. @item combpel
  7920. The number of combed pixels inside any of the @option{blocky} by
  7921. @option{blockx} size blocks on the frame for the frame to be detected as
  7922. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7923. setting controls "how much" combing there must be in any localized area (a
  7924. window defined by the @option{blockx} and @option{blocky} settings) on the
  7925. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7926. which point no frames will ever be detected as combed). This setting is known
  7927. as @option{MI} in TFM/VFM vocabulary.
  7928. Default value is @code{80}.
  7929. @end table
  7930. @anchor{p/c/n/u/b meaning}
  7931. @subsection p/c/n/u/b meaning
  7932. @subsubsection p/c/n
  7933. We assume the following telecined stream:
  7934. @example
  7935. Top fields: 1 2 2 3 4
  7936. Bottom fields: 1 2 3 4 4
  7937. @end example
  7938. The numbers correspond to the progressive frame the fields relate to. Here, the
  7939. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7940. When @code{fieldmatch} is configured to run a matching from bottom
  7941. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7942. @example
  7943. Input stream:
  7944. T 1 2 2 3 4
  7945. B 1 2 3 4 4 <-- matching reference
  7946. Matches: c c n n c
  7947. Output stream:
  7948. T 1 2 3 4 4
  7949. B 1 2 3 4 4
  7950. @end example
  7951. As a result of the field matching, we can see that some frames get duplicated.
  7952. To perform a complete inverse telecine, you need to rely on a decimation filter
  7953. after this operation. See for instance the @ref{decimate} filter.
  7954. The same operation now matching from top fields (@option{field}=@var{top})
  7955. looks like this:
  7956. @example
  7957. Input stream:
  7958. T 1 2 2 3 4 <-- matching reference
  7959. B 1 2 3 4 4
  7960. Matches: c c p p c
  7961. Output stream:
  7962. T 1 2 2 3 4
  7963. B 1 2 2 3 4
  7964. @end example
  7965. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7966. basically, they refer to the frame and field of the opposite parity:
  7967. @itemize
  7968. @item @var{p} matches the field of the opposite parity in the previous frame
  7969. @item @var{c} matches the field of the opposite parity in the current frame
  7970. @item @var{n} matches the field of the opposite parity in the next frame
  7971. @end itemize
  7972. @subsubsection u/b
  7973. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7974. from the opposite parity flag. In the following examples, we assume that we are
  7975. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7976. 'x' is placed above and below each matched fields.
  7977. With bottom matching (@option{field}=@var{bottom}):
  7978. @example
  7979. Match: c p n b u
  7980. x x x x x
  7981. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7982. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7983. x x x x x
  7984. Output frames:
  7985. 2 1 2 2 2
  7986. 2 2 2 1 3
  7987. @end example
  7988. With top matching (@option{field}=@var{top}):
  7989. @example
  7990. Match: c p n b u
  7991. x x x x x
  7992. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7993. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7994. x x x x x
  7995. Output frames:
  7996. 2 2 2 1 2
  7997. 2 1 3 2 2
  7998. @end example
  7999. @subsection Examples
  8000. Simple IVTC of a top field first telecined stream:
  8001. @example
  8002. fieldmatch=order=tff:combmatch=none, decimate
  8003. @end example
  8004. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  8005. @example
  8006. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  8007. @end example
  8008. @section fieldorder
  8009. Transform the field order of the input video.
  8010. It accepts the following parameters:
  8011. @table @option
  8012. @item order
  8013. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  8014. for bottom field first.
  8015. @end table
  8016. The default value is @samp{tff}.
  8017. The transformation is done by shifting the picture content up or down
  8018. by one line, and filling the remaining line with appropriate picture content.
  8019. This method is consistent with most broadcast field order converters.
  8020. If the input video is not flagged as being interlaced, or it is already
  8021. flagged as being of the required output field order, then this filter does
  8022. not alter the incoming video.
  8023. It is very useful when converting to or from PAL DV material,
  8024. which is bottom field first.
  8025. For example:
  8026. @example
  8027. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  8028. @end example
  8029. @section fifo, afifo
  8030. Buffer input images and send them when they are requested.
  8031. It is mainly useful when auto-inserted by the libavfilter
  8032. framework.
  8033. It does not take parameters.
  8034. @section fillborders
  8035. Fill borders of the input video, without changing video stream dimensions.
  8036. Sometimes video can have garbage at the four edges and you may not want to
  8037. crop video input to keep size multiple of some number.
  8038. This filter accepts the following options:
  8039. @table @option
  8040. @item left
  8041. Number of pixels to fill from left border.
  8042. @item right
  8043. Number of pixels to fill from right border.
  8044. @item top
  8045. Number of pixels to fill from top border.
  8046. @item bottom
  8047. Number of pixels to fill from bottom border.
  8048. @item mode
  8049. Set fill mode.
  8050. It accepts the following values:
  8051. @table @samp
  8052. @item smear
  8053. fill pixels using outermost pixels
  8054. @item mirror
  8055. fill pixels using mirroring
  8056. @item fixed
  8057. fill pixels with constant value
  8058. @end table
  8059. Default is @var{smear}.
  8060. @item color
  8061. Set color for pixels in fixed mode. Default is @var{black}.
  8062. @end table
  8063. @section find_rect
  8064. Find a rectangular object
  8065. It accepts the following options:
  8066. @table @option
  8067. @item object
  8068. Filepath of the object image, needs to be in gray8.
  8069. @item threshold
  8070. Detection threshold, default is 0.5.
  8071. @item mipmaps
  8072. Number of mipmaps, default is 3.
  8073. @item xmin, ymin, xmax, ymax
  8074. Specifies the rectangle in which to search.
  8075. @end table
  8076. @subsection Examples
  8077. @itemize
  8078. @item
  8079. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8080. @example
  8081. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8082. @end example
  8083. @end itemize
  8084. @section floodfill
  8085. Flood area with values of same pixel components with another values.
  8086. It accepts the following options:
  8087. @table @option
  8088. @item x
  8089. Set pixel x coordinate.
  8090. @item y
  8091. Set pixel y coordinate.
  8092. @item s0
  8093. Set source #0 component value.
  8094. @item s1
  8095. Set source #1 component value.
  8096. @item s2
  8097. Set source #2 component value.
  8098. @item s3
  8099. Set source #3 component value.
  8100. @item d0
  8101. Set destination #0 component value.
  8102. @item d1
  8103. Set destination #1 component value.
  8104. @item d2
  8105. Set destination #2 component value.
  8106. @item d3
  8107. Set destination #3 component value.
  8108. @end table
  8109. @anchor{format}
  8110. @section format
  8111. Convert the input video to one of the specified pixel formats.
  8112. Libavfilter will try to pick one that is suitable as input to
  8113. the next filter.
  8114. It accepts the following parameters:
  8115. @table @option
  8116. @item pix_fmts
  8117. A '|'-separated list of pixel format names, such as
  8118. "pix_fmts=yuv420p|monow|rgb24".
  8119. @end table
  8120. @subsection Examples
  8121. @itemize
  8122. @item
  8123. Convert the input video to the @var{yuv420p} format
  8124. @example
  8125. format=pix_fmts=yuv420p
  8126. @end example
  8127. Convert the input video to any of the formats in the list
  8128. @example
  8129. format=pix_fmts=yuv420p|yuv444p|yuv410p
  8130. @end example
  8131. @end itemize
  8132. @anchor{fps}
  8133. @section fps
  8134. Convert the video to specified constant frame rate by duplicating or dropping
  8135. frames as necessary.
  8136. It accepts the following parameters:
  8137. @table @option
  8138. @item fps
  8139. The desired output frame rate. The default is @code{25}.
  8140. @item start_time
  8141. Assume the first PTS should be the given value, in seconds. This allows for
  8142. padding/trimming at the start of stream. By default, no assumption is made
  8143. about the first frame's expected PTS, so no padding or trimming is done.
  8144. For example, this could be set to 0 to pad the beginning with duplicates of
  8145. the first frame if a video stream starts after the audio stream or to trim any
  8146. frames with a negative PTS.
  8147. @item round
  8148. Timestamp (PTS) rounding method.
  8149. Possible values are:
  8150. @table @option
  8151. @item zero
  8152. round towards 0
  8153. @item inf
  8154. round away from 0
  8155. @item down
  8156. round towards -infinity
  8157. @item up
  8158. round towards +infinity
  8159. @item near
  8160. round to nearest
  8161. @end table
  8162. The default is @code{near}.
  8163. @item eof_action
  8164. Action performed when reading the last frame.
  8165. Possible values are:
  8166. @table @option
  8167. @item round
  8168. Use same timestamp rounding method as used for other frames.
  8169. @item pass
  8170. Pass through last frame if input duration has not been reached yet.
  8171. @end table
  8172. The default is @code{round}.
  8173. @end table
  8174. Alternatively, the options can be specified as a flat string:
  8175. @var{fps}[:@var{start_time}[:@var{round}]].
  8176. See also the @ref{setpts} filter.
  8177. @subsection Examples
  8178. @itemize
  8179. @item
  8180. A typical usage in order to set the fps to 25:
  8181. @example
  8182. fps=fps=25
  8183. @end example
  8184. @item
  8185. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  8186. @example
  8187. fps=fps=film:round=near
  8188. @end example
  8189. @end itemize
  8190. @section framepack
  8191. Pack two different video streams into a stereoscopic video, setting proper
  8192. metadata on supported codecs. The two views should have the same size and
  8193. framerate and processing will stop when the shorter video ends. Please note
  8194. that you may conveniently adjust view properties with the @ref{scale} and
  8195. @ref{fps} filters.
  8196. It accepts the following parameters:
  8197. @table @option
  8198. @item format
  8199. The desired packing format. Supported values are:
  8200. @table @option
  8201. @item sbs
  8202. The views are next to each other (default).
  8203. @item tab
  8204. The views are on top of each other.
  8205. @item lines
  8206. The views are packed by line.
  8207. @item columns
  8208. The views are packed by column.
  8209. @item frameseq
  8210. The views are temporally interleaved.
  8211. @end table
  8212. @end table
  8213. Some examples:
  8214. @example
  8215. # Convert left and right views into a frame-sequential video
  8216. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8217. # Convert views into a side-by-side video with the same output resolution as the input
  8218. 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
  8219. @end example
  8220. @section framerate
  8221. Change the frame rate by interpolating new video output frames from the source
  8222. frames.
  8223. This filter is not designed to function correctly with interlaced media. If
  8224. you wish to change the frame rate of interlaced media then you are required
  8225. to deinterlace before this filter and re-interlace after this filter.
  8226. A description of the accepted options follows.
  8227. @table @option
  8228. @item fps
  8229. Specify the output frames per second. This option can also be specified
  8230. as a value alone. The default is @code{50}.
  8231. @item interp_start
  8232. Specify the start of a range where the output frame will be created as a
  8233. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8234. the default is @code{15}.
  8235. @item interp_end
  8236. Specify the end of a range where the output frame will be created as a
  8237. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8238. the default is @code{240}.
  8239. @item scene
  8240. Specify the level at which a scene change is detected as a value between
  8241. 0 and 100 to indicate a new scene; a low value reflects a low
  8242. probability for the current frame to introduce a new scene, while a higher
  8243. value means the current frame is more likely to be one.
  8244. The default is @code{8.2}.
  8245. @item flags
  8246. Specify flags influencing the filter process.
  8247. Available value for @var{flags} is:
  8248. @table @option
  8249. @item scene_change_detect, scd
  8250. Enable scene change detection using the value of the option @var{scene}.
  8251. This flag is enabled by default.
  8252. @end table
  8253. @end table
  8254. @section framestep
  8255. Select one frame every N-th frame.
  8256. This filter accepts the following option:
  8257. @table @option
  8258. @item step
  8259. Select frame after every @code{step} frames.
  8260. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8261. @end table
  8262. @section freezedetect
  8263. Detect frozen video.
  8264. This filter logs a message and sets frame metadata when it detects that the
  8265. input video has no significant change in content during a specified duration.
  8266. Video freeze detection calculates the mean average absolute difference of all
  8267. the components of video frames and compares it to a noise floor.
  8268. The printed times and duration are expressed in seconds. The
  8269. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8270. whose timestamp equals or exceeds the detection duration and it contains the
  8271. timestamp of the first frame of the freeze. The
  8272. @code{lavfi.freezedetect.freeze_duration} and
  8273. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8274. after the freeze.
  8275. The filter accepts the following options:
  8276. @table @option
  8277. @item noise, n
  8278. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8279. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8280. 0.001.
  8281. @item duration, d
  8282. Set freeze duration until notification (default is 2 seconds).
  8283. @end table
  8284. @anchor{frei0r}
  8285. @section frei0r
  8286. Apply a frei0r effect to the input video.
  8287. To enable the compilation of this filter, you need to install the frei0r
  8288. header and configure FFmpeg with @code{--enable-frei0r}.
  8289. It accepts the following parameters:
  8290. @table @option
  8291. @item filter_name
  8292. The name of the frei0r effect to load. If the environment variable
  8293. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8294. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8295. Otherwise, the standard frei0r paths are searched, in this order:
  8296. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8297. @file{/usr/lib/frei0r-1/}.
  8298. @item filter_params
  8299. A '|'-separated list of parameters to pass to the frei0r effect.
  8300. @end table
  8301. A frei0r effect parameter can be a boolean (its value is either
  8302. "y" or "n"), a double, a color (specified as
  8303. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8304. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8305. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8306. a position (specified as @var{X}/@var{Y}, where
  8307. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8308. The number and types of parameters depend on the loaded effect. If an
  8309. effect parameter is not specified, the default value is set.
  8310. @subsection Examples
  8311. @itemize
  8312. @item
  8313. Apply the distort0r effect, setting the first two double parameters:
  8314. @example
  8315. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8316. @end example
  8317. @item
  8318. Apply the colordistance effect, taking a color as the first parameter:
  8319. @example
  8320. frei0r=colordistance:0.2/0.3/0.4
  8321. frei0r=colordistance:violet
  8322. frei0r=colordistance:0x112233
  8323. @end example
  8324. @item
  8325. Apply the perspective effect, specifying the top left and top right image
  8326. positions:
  8327. @example
  8328. frei0r=perspective:0.2/0.2|0.8/0.2
  8329. @end example
  8330. @end itemize
  8331. For more information, see
  8332. @url{http://frei0r.dyne.org}
  8333. @section fspp
  8334. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8335. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8336. processing filter, one of them is performed once per block, not per pixel.
  8337. This allows for much higher speed.
  8338. The filter accepts the following options:
  8339. @table @option
  8340. @item quality
  8341. Set quality. This option defines the number of levels for averaging. It accepts
  8342. an integer in the range 4-5. Default value is @code{4}.
  8343. @item qp
  8344. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8345. If not set, the filter will use the QP from the video stream (if available).
  8346. @item strength
  8347. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8348. more details but also more artifacts, while higher values make the image smoother
  8349. but also blurrier. Default value is @code{0} − PSNR optimal.
  8350. @item use_bframe_qp
  8351. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8352. option may cause flicker since the B-Frames have often larger QP. Default is
  8353. @code{0} (not enabled).
  8354. @end table
  8355. @section gblur
  8356. Apply Gaussian blur filter.
  8357. The filter accepts the following options:
  8358. @table @option
  8359. @item sigma
  8360. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8361. @item steps
  8362. Set number of steps for Gaussian approximation. Default is @code{1}.
  8363. @item planes
  8364. Set which planes to filter. By default all planes are filtered.
  8365. @item sigmaV
  8366. Set vertical sigma, if negative it will be same as @code{sigma}.
  8367. Default is @code{-1}.
  8368. @end table
  8369. @subsection Commands
  8370. This filter supports same commands as options.
  8371. The command accepts the same syntax of the corresponding option.
  8372. If the specified expression is not valid, it is kept at its current
  8373. value.
  8374. @section geq
  8375. Apply generic equation to each pixel.
  8376. The filter accepts the following options:
  8377. @table @option
  8378. @item lum_expr, lum
  8379. Set the luminance expression.
  8380. @item cb_expr, cb
  8381. Set the chrominance blue expression.
  8382. @item cr_expr, cr
  8383. Set the chrominance red expression.
  8384. @item alpha_expr, a
  8385. Set the alpha expression.
  8386. @item red_expr, r
  8387. Set the red expression.
  8388. @item green_expr, g
  8389. Set the green expression.
  8390. @item blue_expr, b
  8391. Set the blue expression.
  8392. @end table
  8393. The colorspace is selected according to the specified options. If one
  8394. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8395. options is specified, the filter will automatically select a YCbCr
  8396. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8397. @option{blue_expr} options is specified, it will select an RGB
  8398. colorspace.
  8399. If one of the chrominance expression is not defined, it falls back on the other
  8400. one. If no alpha expression is specified it will evaluate to opaque value.
  8401. If none of chrominance expressions are specified, they will evaluate
  8402. to the luminance expression.
  8403. The expressions can use the following variables and functions:
  8404. @table @option
  8405. @item N
  8406. The sequential number of the filtered frame, starting from @code{0}.
  8407. @item X
  8408. @item Y
  8409. The coordinates of the current sample.
  8410. @item W
  8411. @item H
  8412. The width and height of the image.
  8413. @item SW
  8414. @item SH
  8415. Width and height scale depending on the currently filtered plane. It is the
  8416. ratio between the corresponding luma plane number of pixels and the current
  8417. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8418. @code{0.5,0.5} for chroma planes.
  8419. @item T
  8420. Time of the current frame, expressed in seconds.
  8421. @item p(x, y)
  8422. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8423. plane.
  8424. @item lum(x, y)
  8425. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8426. plane.
  8427. @item cb(x, y)
  8428. Return the value of the pixel at location (@var{x},@var{y}) of the
  8429. blue-difference chroma plane. Return 0 if there is no such plane.
  8430. @item cr(x, y)
  8431. Return the value of the pixel at location (@var{x},@var{y}) of the
  8432. red-difference chroma plane. Return 0 if there is no such plane.
  8433. @item r(x, y)
  8434. @item g(x, y)
  8435. @item b(x, y)
  8436. Return the value of the pixel at location (@var{x},@var{y}) of the
  8437. red/green/blue component. Return 0 if there is no such component.
  8438. @item alpha(x, y)
  8439. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8440. plane. Return 0 if there is no such plane.
  8441. @item interpolation
  8442. Set one of interpolation methods:
  8443. @table @option
  8444. @item nearest, n
  8445. @item bilinear, b
  8446. @end table
  8447. Default is bilinear.
  8448. @end table
  8449. For functions, if @var{x} and @var{y} are outside the area, the value will be
  8450. automatically clipped to the closer edge.
  8451. @subsection Examples
  8452. @itemize
  8453. @item
  8454. Flip the image horizontally:
  8455. @example
  8456. geq=p(W-X\,Y)
  8457. @end example
  8458. @item
  8459. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  8460. wavelength of 100 pixels:
  8461. @example
  8462. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  8463. @end example
  8464. @item
  8465. Generate a fancy enigmatic moving light:
  8466. @example
  8467. 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
  8468. @end example
  8469. @item
  8470. Generate a quick emboss effect:
  8471. @example
  8472. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  8473. @end example
  8474. @item
  8475. Modify RGB components depending on pixel position:
  8476. @example
  8477. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  8478. @end example
  8479. @item
  8480. Create a radial gradient that is the same size as the input (also see
  8481. the @ref{vignette} filter):
  8482. @example
  8483. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8484. @end example
  8485. @end itemize
  8486. @section gradfun
  8487. Fix the banding artifacts that are sometimes introduced into nearly flat
  8488. regions by truncation to 8-bit color depth.
  8489. Interpolate the gradients that should go where the bands are, and
  8490. dither them.
  8491. It is designed for playback only. Do not use it prior to
  8492. lossy compression, because compression tends to lose the dither and
  8493. bring back the bands.
  8494. It accepts the following parameters:
  8495. @table @option
  8496. @item strength
  8497. The maximum amount by which the filter will change any one pixel. This is also
  8498. the threshold for detecting nearly flat regions. Acceptable values range from
  8499. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8500. valid range.
  8501. @item radius
  8502. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8503. gradients, but also prevents the filter from modifying the pixels near detailed
  8504. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8505. values will be clipped to the valid range.
  8506. @end table
  8507. Alternatively, the options can be specified as a flat string:
  8508. @var{strength}[:@var{radius}]
  8509. @subsection Examples
  8510. @itemize
  8511. @item
  8512. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8513. @example
  8514. gradfun=3.5:8
  8515. @end example
  8516. @item
  8517. Specify radius, omitting the strength (which will fall-back to the default
  8518. value):
  8519. @example
  8520. gradfun=radius=8
  8521. @end example
  8522. @end itemize
  8523. @section graphmonitor, agraphmonitor
  8524. Show various filtergraph stats.
  8525. With this filter one can debug complete filtergraph.
  8526. Especially issues with links filling with queued frames.
  8527. The filter accepts the following options:
  8528. @table @option
  8529. @item size, s
  8530. Set video output size. Default is @var{hd720}.
  8531. @item opacity, o
  8532. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8533. @item mode, m
  8534. Set output mode, can be @var{fulll} or @var{compact}.
  8535. In @var{compact} mode only filters with some queued frames have displayed stats.
  8536. @item flags, f
  8537. Set flags which enable which stats are shown in video.
  8538. Available values for flags are:
  8539. @table @samp
  8540. @item queue
  8541. Display number of queued frames in each link.
  8542. @item frame_count_in
  8543. Display number of frames taken from filter.
  8544. @item frame_count_out
  8545. Display number of frames given out from filter.
  8546. @item pts
  8547. Display current filtered frame pts.
  8548. @item time
  8549. Display current filtered frame time.
  8550. @item timebase
  8551. Display time base for filter link.
  8552. @item format
  8553. Display used format for filter link.
  8554. @item size
  8555. Display video size or number of audio channels in case of audio used by filter link.
  8556. @item rate
  8557. Display video frame rate or sample rate in case of audio used by filter link.
  8558. @end table
  8559. @item rate, r
  8560. Set upper limit for video rate of output stream, Default value is @var{25}.
  8561. This guarantee that output video frame rate will not be higher than this value.
  8562. @end table
  8563. @section greyedge
  8564. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8565. and corrects the scene colors accordingly.
  8566. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8567. The filter accepts the following options:
  8568. @table @option
  8569. @item difford
  8570. The order of differentiation to be applied on the scene. Must be chosen in the range
  8571. [0,2] and default value is 1.
  8572. @item minknorm
  8573. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8574. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8575. max value instead of calculating Minkowski distance.
  8576. @item sigma
  8577. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8578. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8579. can't be equal to 0 if @var{difford} is greater than 0.
  8580. @end table
  8581. @subsection Examples
  8582. @itemize
  8583. @item
  8584. Grey Edge:
  8585. @example
  8586. greyedge=difford=1:minknorm=5:sigma=2
  8587. @end example
  8588. @item
  8589. Max Edge:
  8590. @example
  8591. greyedge=difford=1:minknorm=0:sigma=2
  8592. @end example
  8593. @end itemize
  8594. @anchor{haldclut}
  8595. @section haldclut
  8596. Apply a Hald CLUT to a video stream.
  8597. First input is the video stream to process, and second one is the Hald CLUT.
  8598. The Hald CLUT input can be a simple picture or a complete video stream.
  8599. The filter accepts the following options:
  8600. @table @option
  8601. @item shortest
  8602. Force termination when the shortest input terminates. Default is @code{0}.
  8603. @item repeatlast
  8604. Continue applying the last CLUT after the end of the stream. A value of
  8605. @code{0} disable the filter after the last frame of the CLUT is reached.
  8606. Default is @code{1}.
  8607. @end table
  8608. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8609. filters share the same internals).
  8610. This filter also supports the @ref{framesync} options.
  8611. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8612. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8613. @subsection Workflow examples
  8614. @subsubsection Hald CLUT video stream
  8615. Generate an identity Hald CLUT stream altered with various effects:
  8616. @example
  8617. 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
  8618. @end example
  8619. Note: make sure you use a lossless codec.
  8620. Then use it with @code{haldclut} to apply it on some random stream:
  8621. @example
  8622. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8623. @end example
  8624. The Hald CLUT will be applied to the 10 first seconds (duration of
  8625. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8626. to the remaining frames of the @code{mandelbrot} stream.
  8627. @subsubsection Hald CLUT with preview
  8628. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8629. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8630. biggest possible square starting at the top left of the picture. The remaining
  8631. padding pixels (bottom or right) will be ignored. This area can be used to add
  8632. a preview of the Hald CLUT.
  8633. Typically, the following generated Hald CLUT will be supported by the
  8634. @code{haldclut} filter:
  8635. @example
  8636. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8637. pad=iw+320 [padded_clut];
  8638. smptebars=s=320x256, split [a][b];
  8639. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8640. [main][b] overlay=W-320" -frames:v 1 clut.png
  8641. @end example
  8642. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8643. bars are displayed on the right-top, and below the same color bars processed by
  8644. the color changes.
  8645. Then, the effect of this Hald CLUT can be visualized with:
  8646. @example
  8647. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8648. @end example
  8649. @section hflip
  8650. Flip the input video horizontally.
  8651. For example, to horizontally flip the input video with @command{ffmpeg}:
  8652. @example
  8653. ffmpeg -i in.avi -vf "hflip" out.avi
  8654. @end example
  8655. @section histeq
  8656. This filter applies a global color histogram equalization on a
  8657. per-frame basis.
  8658. It can be used to correct video that has a compressed range of pixel
  8659. intensities. The filter redistributes the pixel intensities to
  8660. equalize their distribution across the intensity range. It may be
  8661. viewed as an "automatically adjusting contrast filter". This filter is
  8662. useful only for correcting degraded or poorly captured source
  8663. video.
  8664. The filter accepts the following options:
  8665. @table @option
  8666. @item strength
  8667. Determine the amount of equalization to be applied. As the strength
  8668. is reduced, the distribution of pixel intensities more-and-more
  8669. approaches that of the input frame. The value must be a float number
  8670. in the range [0,1] and defaults to 0.200.
  8671. @item intensity
  8672. Set the maximum intensity that can generated and scale the output
  8673. values appropriately. The strength should be set as desired and then
  8674. the intensity can be limited if needed to avoid washing-out. The value
  8675. must be a float number in the range [0,1] and defaults to 0.210.
  8676. @item antibanding
  8677. Set the antibanding level. If enabled the filter will randomly vary
  8678. the luminance of output pixels by a small amount to avoid banding of
  8679. the histogram. Possible values are @code{none}, @code{weak} or
  8680. @code{strong}. It defaults to @code{none}.
  8681. @end table
  8682. @section histogram
  8683. Compute and draw a color distribution histogram for the input video.
  8684. The computed histogram is a representation of the color component
  8685. distribution in an image.
  8686. Standard histogram displays the color components distribution in an image.
  8687. Displays color graph for each color component. Shows distribution of
  8688. the Y, U, V, A or R, G, B components, depending on input format, in the
  8689. current frame. Below each graph a color component scale meter is shown.
  8690. The filter accepts the following options:
  8691. @table @option
  8692. @item level_height
  8693. Set height of level. Default value is @code{200}.
  8694. Allowed range is [50, 2048].
  8695. @item scale_height
  8696. Set height of color scale. Default value is @code{12}.
  8697. Allowed range is [0, 40].
  8698. @item display_mode
  8699. Set display mode.
  8700. It accepts the following values:
  8701. @table @samp
  8702. @item stack
  8703. Per color component graphs are placed below each other.
  8704. @item parade
  8705. Per color component graphs are placed side by side.
  8706. @item overlay
  8707. Presents information identical to that in the @code{parade}, except
  8708. that the graphs representing color components are superimposed directly
  8709. over one another.
  8710. @end table
  8711. Default is @code{stack}.
  8712. @item levels_mode
  8713. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8714. Default is @code{linear}.
  8715. @item components
  8716. Set what color components to display.
  8717. Default is @code{7}.
  8718. @item fgopacity
  8719. Set foreground opacity. Default is @code{0.7}.
  8720. @item bgopacity
  8721. Set background opacity. Default is @code{0.5}.
  8722. @end table
  8723. @subsection Examples
  8724. @itemize
  8725. @item
  8726. Calculate and draw histogram:
  8727. @example
  8728. ffplay -i input -vf histogram
  8729. @end example
  8730. @end itemize
  8731. @anchor{hqdn3d}
  8732. @section hqdn3d
  8733. This is a high precision/quality 3d denoise filter. It aims to reduce
  8734. image noise, producing smooth images and making still images really
  8735. still. It should enhance compressibility.
  8736. It accepts the following optional parameters:
  8737. @table @option
  8738. @item luma_spatial
  8739. A non-negative floating point number which specifies spatial luma strength.
  8740. It defaults to 4.0.
  8741. @item chroma_spatial
  8742. A non-negative floating point number which specifies spatial chroma strength.
  8743. It defaults to 3.0*@var{luma_spatial}/4.0.
  8744. @item luma_tmp
  8745. A floating point number which specifies luma temporal strength. It defaults to
  8746. 6.0*@var{luma_spatial}/4.0.
  8747. @item chroma_tmp
  8748. A floating point number which specifies chroma temporal strength. It defaults to
  8749. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8750. @end table
  8751. @anchor{hwdownload}
  8752. @section hwdownload
  8753. Download hardware frames to system memory.
  8754. The input must be in hardware frames, and the output a non-hardware format.
  8755. Not all formats will be supported on the output - it may be necessary to insert
  8756. an additional @option{format} filter immediately following in the graph to get
  8757. the output in a supported format.
  8758. @section hwmap
  8759. Map hardware frames to system memory or to another device.
  8760. This filter has several different modes of operation; which one is used depends
  8761. on the input and output formats:
  8762. @itemize
  8763. @item
  8764. Hardware frame input, normal frame output
  8765. Map the input frames to system memory and pass them to the output. If the
  8766. original hardware frame is later required (for example, after overlaying
  8767. something else on part of it), the @option{hwmap} filter can be used again
  8768. in the next mode to retrieve it.
  8769. @item
  8770. Normal frame input, hardware frame output
  8771. If the input is actually a software-mapped hardware frame, then unmap it -
  8772. that is, return the original hardware frame.
  8773. Otherwise, a device must be provided. Create new hardware surfaces on that
  8774. device for the output, then map them back to the software format at the input
  8775. and give those frames to the preceding filter. This will then act like the
  8776. @option{hwupload} filter, but may be able to avoid an additional copy when
  8777. the input is already in a compatible format.
  8778. @item
  8779. Hardware frame input and output
  8780. A device must be supplied for the output, either directly or with the
  8781. @option{derive_device} option. The input and output devices must be of
  8782. different types and compatible - the exact meaning of this is
  8783. system-dependent, but typically it means that they must refer to the same
  8784. underlying hardware context (for example, refer to the same graphics card).
  8785. If the input frames were originally created on the output device, then unmap
  8786. to retrieve the original frames.
  8787. Otherwise, map the frames to the output device - create new hardware frames
  8788. on the output corresponding to the frames on the input.
  8789. @end itemize
  8790. The following additional parameters are accepted:
  8791. @table @option
  8792. @item mode
  8793. Set the frame mapping mode. Some combination of:
  8794. @table @var
  8795. @item read
  8796. The mapped frame should be readable.
  8797. @item write
  8798. The mapped frame should be writeable.
  8799. @item overwrite
  8800. The mapping will always overwrite the entire frame.
  8801. This may improve performance in some cases, as the original contents of the
  8802. frame need not be loaded.
  8803. @item direct
  8804. The mapping must not involve any copying.
  8805. Indirect mappings to copies of frames are created in some cases where either
  8806. direct mapping is not possible or it would have unexpected properties.
  8807. Setting this flag ensures that the mapping is direct and will fail if that is
  8808. not possible.
  8809. @end table
  8810. Defaults to @var{read+write} if not specified.
  8811. @item derive_device @var{type}
  8812. Rather than using the device supplied at initialisation, instead derive a new
  8813. device of type @var{type} from the device the input frames exist on.
  8814. @item reverse
  8815. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8816. and map them back to the source. This may be necessary in some cases where
  8817. a mapping in one direction is required but only the opposite direction is
  8818. supported by the devices being used.
  8819. This option is dangerous - it may break the preceding filter in undefined
  8820. ways if there are any additional constraints on that filter's output.
  8821. Do not use it without fully understanding the implications of its use.
  8822. @end table
  8823. @anchor{hwupload}
  8824. @section hwupload
  8825. Upload system memory frames to hardware surfaces.
  8826. The device to upload to must be supplied when the filter is initialised. If
  8827. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8828. option.
  8829. @anchor{hwupload_cuda}
  8830. @section hwupload_cuda
  8831. Upload system memory frames to a CUDA device.
  8832. It accepts the following optional parameters:
  8833. @table @option
  8834. @item device
  8835. The number of the CUDA device to use
  8836. @end table
  8837. @section hqx
  8838. Apply a high-quality magnification filter designed for pixel art. This filter
  8839. was originally created by Maxim Stepin.
  8840. It accepts the following option:
  8841. @table @option
  8842. @item n
  8843. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8844. @code{hq3x} and @code{4} for @code{hq4x}.
  8845. Default is @code{3}.
  8846. @end table
  8847. @section hstack
  8848. Stack input videos horizontally.
  8849. All streams must be of same pixel format and of same height.
  8850. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8851. to create same output.
  8852. The filter accepts the following option:
  8853. @table @option
  8854. @item inputs
  8855. Set number of input streams. Default is 2.
  8856. @item shortest
  8857. If set to 1, force the output to terminate when the shortest input
  8858. terminates. Default value is 0.
  8859. @end table
  8860. @section hue
  8861. Modify the hue and/or the saturation of the input.
  8862. It accepts the following parameters:
  8863. @table @option
  8864. @item h
  8865. Specify the hue angle as a number of degrees. It accepts an expression,
  8866. and defaults to "0".
  8867. @item s
  8868. Specify the saturation in the [-10,10] range. It accepts an expression and
  8869. defaults to "1".
  8870. @item H
  8871. Specify the hue angle as a number of radians. It accepts an
  8872. expression, and defaults to "0".
  8873. @item b
  8874. Specify the brightness in the [-10,10] range. It accepts an expression and
  8875. defaults to "0".
  8876. @end table
  8877. @option{h} and @option{H} are mutually exclusive, and can't be
  8878. specified at the same time.
  8879. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8880. expressions containing the following constants:
  8881. @table @option
  8882. @item n
  8883. frame count of the input frame starting from 0
  8884. @item pts
  8885. presentation timestamp of the input frame expressed in time base units
  8886. @item r
  8887. frame rate of the input video, NAN if the input frame rate is unknown
  8888. @item t
  8889. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8890. @item tb
  8891. time base of the input video
  8892. @end table
  8893. @subsection Examples
  8894. @itemize
  8895. @item
  8896. Set the hue to 90 degrees and the saturation to 1.0:
  8897. @example
  8898. hue=h=90:s=1
  8899. @end example
  8900. @item
  8901. Same command but expressing the hue in radians:
  8902. @example
  8903. hue=H=PI/2:s=1
  8904. @end example
  8905. @item
  8906. Rotate hue and make the saturation swing between 0
  8907. and 2 over a period of 1 second:
  8908. @example
  8909. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8910. @end example
  8911. @item
  8912. Apply a 3 seconds saturation fade-in effect starting at 0:
  8913. @example
  8914. hue="s=min(t/3\,1)"
  8915. @end example
  8916. The general fade-in expression can be written as:
  8917. @example
  8918. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8919. @end example
  8920. @item
  8921. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8922. @example
  8923. hue="s=max(0\, min(1\, (8-t)/3))"
  8924. @end example
  8925. The general fade-out expression can be written as:
  8926. @example
  8927. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8928. @end example
  8929. @end itemize
  8930. @subsection Commands
  8931. This filter supports the following commands:
  8932. @table @option
  8933. @item b
  8934. @item s
  8935. @item h
  8936. @item H
  8937. Modify the hue and/or the saturation and/or brightness of the input video.
  8938. The command accepts the same syntax of the corresponding option.
  8939. If the specified expression is not valid, it is kept at its current
  8940. value.
  8941. @end table
  8942. @section hysteresis
  8943. Grow first stream into second stream by connecting components.
  8944. This makes it possible to build more robust edge masks.
  8945. This filter accepts the following options:
  8946. @table @option
  8947. @item planes
  8948. Set which planes will be processed as bitmap, unprocessed planes will be
  8949. copied from first stream.
  8950. By default value 0xf, all planes will be processed.
  8951. @item threshold
  8952. Set threshold which is used in filtering. If pixel component value is higher than
  8953. this value filter algorithm for connecting components is activated.
  8954. By default value is 0.
  8955. @end table
  8956. @section idet
  8957. Detect video interlacing type.
  8958. This filter tries to detect if the input frames are interlaced, progressive,
  8959. top or bottom field first. It will also try to detect fields that are
  8960. repeated between adjacent frames (a sign of telecine).
  8961. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8962. Multiple frame detection incorporates the classification history of previous frames.
  8963. The filter will log these metadata values:
  8964. @table @option
  8965. @item single.current_frame
  8966. Detected type of current frame using single-frame detection. One of:
  8967. ``tff'' (top field first), ``bff'' (bottom field first),
  8968. ``progressive'', or ``undetermined''
  8969. @item single.tff
  8970. Cumulative number of frames detected as top field first using single-frame detection.
  8971. @item multiple.tff
  8972. Cumulative number of frames detected as top field first using multiple-frame detection.
  8973. @item single.bff
  8974. Cumulative number of frames detected as bottom field first using single-frame detection.
  8975. @item multiple.current_frame
  8976. Detected type of current frame using multiple-frame detection. One of:
  8977. ``tff'' (top field first), ``bff'' (bottom field first),
  8978. ``progressive'', or ``undetermined''
  8979. @item multiple.bff
  8980. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8981. @item single.progressive
  8982. Cumulative number of frames detected as progressive using single-frame detection.
  8983. @item multiple.progressive
  8984. Cumulative number of frames detected as progressive using multiple-frame detection.
  8985. @item single.undetermined
  8986. Cumulative number of frames that could not be classified using single-frame detection.
  8987. @item multiple.undetermined
  8988. Cumulative number of frames that could not be classified using multiple-frame detection.
  8989. @item repeated.current_frame
  8990. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8991. @item repeated.neither
  8992. Cumulative number of frames with no repeated field.
  8993. @item repeated.top
  8994. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8995. @item repeated.bottom
  8996. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8997. @end table
  8998. The filter accepts the following options:
  8999. @table @option
  9000. @item intl_thres
  9001. Set interlacing threshold.
  9002. @item prog_thres
  9003. Set progressive threshold.
  9004. @item rep_thres
  9005. Threshold for repeated field detection.
  9006. @item half_life
  9007. Number of frames after which a given frame's contribution to the
  9008. statistics is halved (i.e., it contributes only 0.5 to its
  9009. classification). The default of 0 means that all frames seen are given
  9010. full weight of 1.0 forever.
  9011. @item analyze_interlaced_flag
  9012. When this is not 0 then idet will use the specified number of frames to determine
  9013. if the interlaced flag is accurate, it will not count undetermined frames.
  9014. If the flag is found to be accurate it will be used without any further
  9015. computations, if it is found to be inaccurate it will be cleared without any
  9016. further computations. This allows inserting the idet filter as a low computational
  9017. method to clean up the interlaced flag
  9018. @end table
  9019. @section il
  9020. Deinterleave or interleave fields.
  9021. This filter allows one to process interlaced images fields without
  9022. deinterlacing them. Deinterleaving splits the input frame into 2
  9023. fields (so called half pictures). Odd lines are moved to the top
  9024. half of the output image, even lines to the bottom half.
  9025. You can process (filter) them independently and then re-interleave them.
  9026. The filter accepts the following options:
  9027. @table @option
  9028. @item luma_mode, l
  9029. @item chroma_mode, c
  9030. @item alpha_mode, a
  9031. Available values for @var{luma_mode}, @var{chroma_mode} and
  9032. @var{alpha_mode} are:
  9033. @table @samp
  9034. @item none
  9035. Do nothing.
  9036. @item deinterleave, d
  9037. Deinterleave fields, placing one above the other.
  9038. @item interleave, i
  9039. Interleave fields. Reverse the effect of deinterleaving.
  9040. @end table
  9041. Default value is @code{none}.
  9042. @item luma_swap, ls
  9043. @item chroma_swap, cs
  9044. @item alpha_swap, as
  9045. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  9046. @end table
  9047. @section inflate
  9048. Apply inflate effect to the video.
  9049. This filter replaces the pixel by the local(3x3) average by taking into account
  9050. only values higher than the pixel.
  9051. It accepts the following options:
  9052. @table @option
  9053. @item threshold0
  9054. @item threshold1
  9055. @item threshold2
  9056. @item threshold3
  9057. Limit the maximum change for each plane, default is 65535.
  9058. If 0, plane will remain unchanged.
  9059. @end table
  9060. @section interlace
  9061. Simple interlacing filter from progressive contents. This interleaves upper (or
  9062. lower) lines from odd frames with lower (or upper) lines from even frames,
  9063. halving the frame rate and preserving image height.
  9064. @example
  9065. Original Original New Frame
  9066. Frame 'j' Frame 'j+1' (tff)
  9067. ========== =========== ==================
  9068. Line 0 --------------------> Frame 'j' Line 0
  9069. Line 1 Line 1 ----> Frame 'j+1' Line 1
  9070. Line 2 ---------------------> Frame 'j' Line 2
  9071. Line 3 Line 3 ----> Frame 'j+1' Line 3
  9072. ... ... ...
  9073. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  9074. @end example
  9075. It accepts the following optional parameters:
  9076. @table @option
  9077. @item scan
  9078. This determines whether the interlaced frame is taken from the even
  9079. (tff - default) or odd (bff) lines of the progressive frame.
  9080. @item lowpass
  9081. Vertical lowpass filter to avoid twitter interlacing and
  9082. reduce moire patterns.
  9083. @table @samp
  9084. @item 0, off
  9085. Disable vertical lowpass filter
  9086. @item 1, linear
  9087. Enable linear filter (default)
  9088. @item 2, complex
  9089. Enable complex filter. This will slightly less reduce twitter and moire
  9090. but better retain detail and subjective sharpness impression.
  9091. @end table
  9092. @end table
  9093. @section kerndeint
  9094. Deinterlace input video by applying Donald Graft's adaptive kernel
  9095. deinterling. Work on interlaced parts of a video to produce
  9096. progressive frames.
  9097. The description of the accepted parameters follows.
  9098. @table @option
  9099. @item thresh
  9100. Set the threshold which affects the filter's tolerance when
  9101. determining if a pixel line must be processed. It must be an integer
  9102. in the range [0,255] and defaults to 10. A value of 0 will result in
  9103. applying the process on every pixels.
  9104. @item map
  9105. Paint pixels exceeding the threshold value to white if set to 1.
  9106. Default is 0.
  9107. @item order
  9108. Set the fields order. Swap fields if set to 1, leave fields alone if
  9109. 0. Default is 0.
  9110. @item sharp
  9111. Enable additional sharpening if set to 1. Default is 0.
  9112. @item twoway
  9113. Enable twoway sharpening if set to 1. Default is 0.
  9114. @end table
  9115. @subsection Examples
  9116. @itemize
  9117. @item
  9118. Apply default values:
  9119. @example
  9120. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  9121. @end example
  9122. @item
  9123. Enable additional sharpening:
  9124. @example
  9125. kerndeint=sharp=1
  9126. @end example
  9127. @item
  9128. Paint processed pixels in white:
  9129. @example
  9130. kerndeint=map=1
  9131. @end example
  9132. @end itemize
  9133. @section lagfun
  9134. Slowly update darker pixels.
  9135. This filter makes short flashes of light appear longer.
  9136. This filter accepts the following options:
  9137. @table @option
  9138. @item decay
  9139. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  9140. @item planes
  9141. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  9142. @end table
  9143. @section lenscorrection
  9144. Correct radial lens distortion
  9145. This filter can be used to correct for radial distortion as can result from the use
  9146. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  9147. one can use tools available for example as part of opencv or simply trial-and-error.
  9148. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  9149. and extract the k1 and k2 coefficients from the resulting matrix.
  9150. Note that effectively the same filter is available in the open-source tools Krita and
  9151. Digikam from the KDE project.
  9152. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  9153. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  9154. brightness distribution, so you may want to use both filters together in certain
  9155. cases, though you will have to take care of ordering, i.e. whether vignetting should
  9156. be applied before or after lens correction.
  9157. @subsection Options
  9158. The filter accepts the following options:
  9159. @table @option
  9160. @item cx
  9161. Relative x-coordinate of the focal point of the image, and thereby the center of the
  9162. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9163. width. Default is 0.5.
  9164. @item cy
  9165. Relative y-coordinate of the focal point of the image, and thereby the center of the
  9166. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9167. height. Default is 0.5.
  9168. @item k1
  9169. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  9170. no correction. Default is 0.
  9171. @item k2
  9172. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  9173. 0 means no correction. Default is 0.
  9174. @end table
  9175. The formula that generates the correction is:
  9176. @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)
  9177. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  9178. distances from the focal point in the source and target images, respectively.
  9179. @section lensfun
  9180. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  9181. The @code{lensfun} filter requires the camera make, camera model, and lens model
  9182. to apply the lens correction. The filter will load the lensfun database and
  9183. query it to find the corresponding camera and lens entries in the database. As
  9184. long as these entries can be found with the given options, the filter can
  9185. perform corrections on frames. Note that incomplete strings will result in the
  9186. filter choosing the best match with the given options, and the filter will
  9187. output the chosen camera and lens models (logged with level "info"). You must
  9188. provide the make, camera model, and lens model as they are required.
  9189. The filter accepts the following options:
  9190. @table @option
  9191. @item make
  9192. The make of the camera (for example, "Canon"). This option is required.
  9193. @item model
  9194. The model of the camera (for example, "Canon EOS 100D"). This option is
  9195. required.
  9196. @item lens_model
  9197. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  9198. option is required.
  9199. @item mode
  9200. The type of correction to apply. The following values are valid options:
  9201. @table @samp
  9202. @item vignetting
  9203. Enables fixing lens vignetting.
  9204. @item geometry
  9205. Enables fixing lens geometry. This is the default.
  9206. @item subpixel
  9207. Enables fixing chromatic aberrations.
  9208. @item vig_geo
  9209. Enables fixing lens vignetting and lens geometry.
  9210. @item vig_subpixel
  9211. Enables fixing lens vignetting and chromatic aberrations.
  9212. @item distortion
  9213. Enables fixing both lens geometry and chromatic aberrations.
  9214. @item all
  9215. Enables all possible corrections.
  9216. @end table
  9217. @item focal_length
  9218. The focal length of the image/video (zoom; expected constant for video). For
  9219. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  9220. range should be chosen when using that lens. Default 18.
  9221. @item aperture
  9222. The aperture of the image/video (expected constant for video). Note that
  9223. aperture is only used for vignetting correction. Default 3.5.
  9224. @item focus_distance
  9225. The focus distance of the image/video (expected constant for video). Note that
  9226. focus distance is only used for vignetting and only slightly affects the
  9227. vignetting correction process. If unknown, leave it at the default value (which
  9228. is 1000).
  9229. @item scale
  9230. The scale factor which is applied after transformation. After correction the
  9231. video is no longer necessarily rectangular. This parameter controls how much of
  9232. the resulting image is visible. The value 0 means that a value will be chosen
  9233. automatically such that there is little or no unmapped area in the output
  9234. image. 1.0 means that no additional scaling is done. Lower values may result
  9235. in more of the corrected image being visible, while higher values may avoid
  9236. unmapped areas in the output.
  9237. @item target_geometry
  9238. The target geometry of the output image/video. The following values are valid
  9239. options:
  9240. @table @samp
  9241. @item rectilinear (default)
  9242. @item fisheye
  9243. @item panoramic
  9244. @item equirectangular
  9245. @item fisheye_orthographic
  9246. @item fisheye_stereographic
  9247. @item fisheye_equisolid
  9248. @item fisheye_thoby
  9249. @end table
  9250. @item reverse
  9251. Apply the reverse of image correction (instead of correcting distortion, apply
  9252. it).
  9253. @item interpolation
  9254. The type of interpolation used when correcting distortion. The following values
  9255. are valid options:
  9256. @table @samp
  9257. @item nearest
  9258. @item linear (default)
  9259. @item lanczos
  9260. @end table
  9261. @end table
  9262. @subsection Examples
  9263. @itemize
  9264. @item
  9265. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9266. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9267. aperture of "8.0".
  9268. @example
  9269. 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
  9270. @end example
  9271. @item
  9272. Apply the same as before, but only for the first 5 seconds of video.
  9273. @example
  9274. 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
  9275. @end example
  9276. @end itemize
  9277. @section libvmaf
  9278. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9279. score between two input videos.
  9280. The obtained VMAF score is printed through the logging system.
  9281. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9282. After installing the library it can be enabled using:
  9283. @code{./configure --enable-libvmaf --enable-version3}.
  9284. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9285. The filter has following options:
  9286. @table @option
  9287. @item model_path
  9288. Set the model path which is to be used for SVM.
  9289. Default value: @code{"vmaf_v0.6.1.pkl"}
  9290. @item log_path
  9291. Set the file path to be used to store logs.
  9292. @item log_fmt
  9293. Set the format of the log file (xml or json).
  9294. @item enable_transform
  9295. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  9296. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  9297. Default value: @code{false}
  9298. @item phone_model
  9299. Invokes the phone model which will generate VMAF scores higher than in the
  9300. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  9301. @item psnr
  9302. Enables computing psnr along with vmaf.
  9303. @item ssim
  9304. Enables computing ssim along with vmaf.
  9305. @item ms_ssim
  9306. Enables computing ms_ssim along with vmaf.
  9307. @item pool
  9308. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  9309. @item n_threads
  9310. Set number of threads to be used when computing vmaf.
  9311. @item n_subsample
  9312. Set interval for frame subsampling used when computing vmaf.
  9313. @item enable_conf_interval
  9314. Enables confidence interval.
  9315. @end table
  9316. This filter also supports the @ref{framesync} options.
  9317. On the below examples the input file @file{main.mpg} being processed is
  9318. compared with the reference file @file{ref.mpg}.
  9319. @example
  9320. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  9321. @end example
  9322. Example with options:
  9323. @example
  9324. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  9325. @end example
  9326. @section limiter
  9327. Limits the pixel components values to the specified range [min, max].
  9328. The filter accepts the following options:
  9329. @table @option
  9330. @item min
  9331. Lower bound. Defaults to the lowest allowed value for the input.
  9332. @item max
  9333. Upper bound. Defaults to the highest allowed value for the input.
  9334. @item planes
  9335. Specify which planes will be processed. Defaults to all available.
  9336. @end table
  9337. @section loop
  9338. Loop video frames.
  9339. The filter accepts the following options:
  9340. @table @option
  9341. @item loop
  9342. Set the number of loops. Setting this value to -1 will result in infinite loops.
  9343. Default is 0.
  9344. @item size
  9345. Set maximal size in number of frames. Default is 0.
  9346. @item start
  9347. Set first frame of loop. Default is 0.
  9348. @end table
  9349. @subsection Examples
  9350. @itemize
  9351. @item
  9352. Loop single first frame infinitely:
  9353. @example
  9354. loop=loop=-1:size=1:start=0
  9355. @end example
  9356. @item
  9357. Loop single first frame 10 times:
  9358. @example
  9359. loop=loop=10:size=1:start=0
  9360. @end example
  9361. @item
  9362. Loop 10 first frames 5 times:
  9363. @example
  9364. loop=loop=5:size=10:start=0
  9365. @end example
  9366. @end itemize
  9367. @section lut1d
  9368. Apply a 1D LUT to an input video.
  9369. The filter accepts the following options:
  9370. @table @option
  9371. @item file
  9372. Set the 1D LUT file name.
  9373. Currently supported formats:
  9374. @table @samp
  9375. @item cube
  9376. Iridas
  9377. @item csp
  9378. cineSpace
  9379. @end table
  9380. @item interp
  9381. Select interpolation mode.
  9382. Available values are:
  9383. @table @samp
  9384. @item nearest
  9385. Use values from the nearest defined point.
  9386. @item linear
  9387. Interpolate values using the linear interpolation.
  9388. @item cosine
  9389. Interpolate values using the cosine interpolation.
  9390. @item cubic
  9391. Interpolate values using the cubic interpolation.
  9392. @item spline
  9393. Interpolate values using the spline interpolation.
  9394. @end table
  9395. @end table
  9396. @anchor{lut3d}
  9397. @section lut3d
  9398. Apply a 3D LUT to an input video.
  9399. The filter accepts the following options:
  9400. @table @option
  9401. @item file
  9402. Set the 3D LUT file name.
  9403. Currently supported formats:
  9404. @table @samp
  9405. @item 3dl
  9406. AfterEffects
  9407. @item cube
  9408. Iridas
  9409. @item dat
  9410. DaVinci
  9411. @item m3d
  9412. Pandora
  9413. @item csp
  9414. cineSpace
  9415. @end table
  9416. @item interp
  9417. Select interpolation mode.
  9418. Available values are:
  9419. @table @samp
  9420. @item nearest
  9421. Use values from the nearest defined point.
  9422. @item trilinear
  9423. Interpolate values using the 8 points defining a cube.
  9424. @item tetrahedral
  9425. Interpolate values using a tetrahedron.
  9426. @end table
  9427. @end table
  9428. @section lumakey
  9429. Turn certain luma values into transparency.
  9430. The filter accepts the following options:
  9431. @table @option
  9432. @item threshold
  9433. Set the luma which will be used as base for transparency.
  9434. Default value is @code{0}.
  9435. @item tolerance
  9436. Set the range of luma values to be keyed out.
  9437. Default value is @code{0}.
  9438. @item softness
  9439. Set the range of softness. Default value is @code{0}.
  9440. Use this to control gradual transition from zero to full transparency.
  9441. @end table
  9442. @section lut, lutrgb, lutyuv
  9443. Compute a look-up table for binding each pixel component input value
  9444. to an output value, and apply it to the input video.
  9445. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  9446. to an RGB input video.
  9447. These filters accept the following parameters:
  9448. @table @option
  9449. @item c0
  9450. set first pixel component expression
  9451. @item c1
  9452. set second pixel component expression
  9453. @item c2
  9454. set third pixel component expression
  9455. @item c3
  9456. set fourth pixel component expression, corresponds to the alpha component
  9457. @item r
  9458. set red component expression
  9459. @item g
  9460. set green component expression
  9461. @item b
  9462. set blue component expression
  9463. @item a
  9464. alpha component expression
  9465. @item y
  9466. set Y/luminance component expression
  9467. @item u
  9468. set U/Cb component expression
  9469. @item v
  9470. set V/Cr component expression
  9471. @end table
  9472. Each of them specifies the expression to use for computing the lookup table for
  9473. the corresponding pixel component values.
  9474. The exact component associated to each of the @var{c*} options depends on the
  9475. format in input.
  9476. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  9477. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  9478. The expressions can contain the following constants and functions:
  9479. @table @option
  9480. @item w
  9481. @item h
  9482. The input width and height.
  9483. @item val
  9484. The input value for the pixel component.
  9485. @item clipval
  9486. The input value, clipped to the @var{minval}-@var{maxval} range.
  9487. @item maxval
  9488. The maximum value for the pixel component.
  9489. @item minval
  9490. The minimum value for the pixel component.
  9491. @item negval
  9492. The negated value for the pixel component value, clipped to the
  9493. @var{minval}-@var{maxval} range; it corresponds to the expression
  9494. "maxval-clipval+minval".
  9495. @item clip(val)
  9496. The computed value in @var{val}, clipped to the
  9497. @var{minval}-@var{maxval} range.
  9498. @item gammaval(gamma)
  9499. The computed gamma correction value of the pixel component value,
  9500. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  9501. expression
  9502. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  9503. @end table
  9504. All expressions default to "val".
  9505. @subsection Examples
  9506. @itemize
  9507. @item
  9508. Negate input video:
  9509. @example
  9510. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  9511. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  9512. @end example
  9513. The above is the same as:
  9514. @example
  9515. lutrgb="r=negval:g=negval:b=negval"
  9516. lutyuv="y=negval:u=negval:v=negval"
  9517. @end example
  9518. @item
  9519. Negate luminance:
  9520. @example
  9521. lutyuv=y=negval
  9522. @end example
  9523. @item
  9524. Remove chroma components, turning the video into a graytone image:
  9525. @example
  9526. lutyuv="u=128:v=128"
  9527. @end example
  9528. @item
  9529. Apply a luma burning effect:
  9530. @example
  9531. lutyuv="y=2*val"
  9532. @end example
  9533. @item
  9534. Remove green and blue components:
  9535. @example
  9536. lutrgb="g=0:b=0"
  9537. @end example
  9538. @item
  9539. Set a constant alpha channel value on input:
  9540. @example
  9541. format=rgba,lutrgb=a="maxval-minval/2"
  9542. @end example
  9543. @item
  9544. Correct luminance gamma by a factor of 0.5:
  9545. @example
  9546. lutyuv=y=gammaval(0.5)
  9547. @end example
  9548. @item
  9549. Discard least significant bits of luma:
  9550. @example
  9551. lutyuv=y='bitand(val, 128+64+32)'
  9552. @end example
  9553. @item
  9554. Technicolor like effect:
  9555. @example
  9556. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9557. @end example
  9558. @end itemize
  9559. @section lut2, tlut2
  9560. The @code{lut2} filter takes two input streams and outputs one
  9561. stream.
  9562. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9563. from one single stream.
  9564. This filter accepts the following parameters:
  9565. @table @option
  9566. @item c0
  9567. set first pixel component expression
  9568. @item c1
  9569. set second pixel component expression
  9570. @item c2
  9571. set third pixel component expression
  9572. @item c3
  9573. set fourth pixel component expression, corresponds to the alpha component
  9574. @item d
  9575. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9576. which means bit depth is automatically picked from first input format.
  9577. @end table
  9578. Each of them specifies the expression to use for computing the lookup table for
  9579. the corresponding pixel component values.
  9580. The exact component associated to each of the @var{c*} options depends on the
  9581. format in inputs.
  9582. The expressions can contain the following constants:
  9583. @table @option
  9584. @item w
  9585. @item h
  9586. The input width and height.
  9587. @item x
  9588. The first input value for the pixel component.
  9589. @item y
  9590. The second input value for the pixel component.
  9591. @item bdx
  9592. The first input video bit depth.
  9593. @item bdy
  9594. The second input video bit depth.
  9595. @end table
  9596. All expressions default to "x".
  9597. @subsection Examples
  9598. @itemize
  9599. @item
  9600. Highlight differences between two RGB video streams:
  9601. @example
  9602. 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)'
  9603. @end example
  9604. @item
  9605. Highlight differences between two YUV video streams:
  9606. @example
  9607. 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)'
  9608. @end example
  9609. @item
  9610. Show max difference between two video streams:
  9611. @example
  9612. 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)))'
  9613. @end example
  9614. @end itemize
  9615. @section maskedclamp
  9616. Clamp the first input stream with the second input and third input stream.
  9617. Returns the value of first stream to be between second input
  9618. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9619. This filter accepts the following options:
  9620. @table @option
  9621. @item undershoot
  9622. Default value is @code{0}.
  9623. @item overshoot
  9624. Default value is @code{0}.
  9625. @item planes
  9626. Set which planes will be processed as bitmap, unprocessed planes will be
  9627. copied from first stream.
  9628. By default value 0xf, all planes will be processed.
  9629. @end table
  9630. @section maskedmerge
  9631. Merge the first input stream with the second input stream using per pixel
  9632. weights in the third input stream.
  9633. A value of 0 in the third stream pixel component means that pixel component
  9634. from first stream is returned unchanged, while maximum value (eg. 255 for
  9635. 8-bit videos) means that pixel component from second stream is returned
  9636. unchanged. Intermediate values define the amount of merging between both
  9637. input stream's pixel components.
  9638. This filter accepts the following options:
  9639. @table @option
  9640. @item planes
  9641. Set which planes will be processed as bitmap, unprocessed planes will be
  9642. copied from first stream.
  9643. By default value 0xf, all planes will be processed.
  9644. @end table
  9645. @section maskfun
  9646. Create mask from input video.
  9647. For example it is useful to create motion masks after @code{tblend} filter.
  9648. This filter accepts the following options:
  9649. @table @option
  9650. @item low
  9651. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  9652. @item high
  9653. Set high threshold. Any pixel component higher than this value will be set to max value
  9654. allowed for current pixel format.
  9655. @item planes
  9656. Set planes to filter, by default all available planes are filtered.
  9657. @item fill
  9658. Fill all frame pixels with this value.
  9659. @item sum
  9660. Set max average pixel value for frame. If sum of all pixel components is higher that this
  9661. average, output frame will be completely filled with value set by @var{fill} option.
  9662. Typically useful for scene changes when used in combination with @code{tblend} filter.
  9663. @end table
  9664. @section mcdeint
  9665. Apply motion-compensation deinterlacing.
  9666. It needs one field per frame as input and must thus be used together
  9667. with yadif=1/3 or equivalent.
  9668. This filter accepts the following options:
  9669. @table @option
  9670. @item mode
  9671. Set the deinterlacing mode.
  9672. It accepts one of the following values:
  9673. @table @samp
  9674. @item fast
  9675. @item medium
  9676. @item slow
  9677. use iterative motion estimation
  9678. @item extra_slow
  9679. like @samp{slow}, but use multiple reference frames.
  9680. @end table
  9681. Default value is @samp{fast}.
  9682. @item parity
  9683. Set the picture field parity assumed for the input video. It must be
  9684. one of the following values:
  9685. @table @samp
  9686. @item 0, tff
  9687. assume top field first
  9688. @item 1, bff
  9689. assume bottom field first
  9690. @end table
  9691. Default value is @samp{bff}.
  9692. @item qp
  9693. Set per-block quantization parameter (QP) used by the internal
  9694. encoder.
  9695. Higher values should result in a smoother motion vector field but less
  9696. optimal individual vectors. Default value is 1.
  9697. @end table
  9698. @section mergeplanes
  9699. Merge color channel components from several video streams.
  9700. The filter accepts up to 4 input streams, and merge selected input
  9701. planes to the output video.
  9702. This filter accepts the following options:
  9703. @table @option
  9704. @item mapping
  9705. Set input to output plane mapping. Default is @code{0}.
  9706. The mappings is specified as a bitmap. It should be specified as a
  9707. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  9708. mapping for the first plane of the output stream. 'A' sets the number of
  9709. the input stream to use (from 0 to 3), and 'a' the plane number of the
  9710. corresponding input to use (from 0 to 3). The rest of the mappings is
  9711. similar, 'Bb' describes the mapping for the output stream second
  9712. plane, 'Cc' describes the mapping for the output stream third plane and
  9713. 'Dd' describes the mapping for the output stream fourth plane.
  9714. @item format
  9715. Set output pixel format. Default is @code{yuva444p}.
  9716. @end table
  9717. @subsection Examples
  9718. @itemize
  9719. @item
  9720. Merge three gray video streams of same width and height into single video stream:
  9721. @example
  9722. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  9723. @end example
  9724. @item
  9725. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  9726. @example
  9727. [a0][a1]mergeplanes=0x00010210:yuva444p
  9728. @end example
  9729. @item
  9730. Swap Y and A plane in yuva444p stream:
  9731. @example
  9732. format=yuva444p,mergeplanes=0x03010200:yuva444p
  9733. @end example
  9734. @item
  9735. Swap U and V plane in yuv420p stream:
  9736. @example
  9737. format=yuv420p,mergeplanes=0x000201:yuv420p
  9738. @end example
  9739. @item
  9740. Cast a rgb24 clip to yuv444p:
  9741. @example
  9742. format=rgb24,mergeplanes=0x000102:yuv444p
  9743. @end example
  9744. @end itemize
  9745. @section mestimate
  9746. Estimate and export motion vectors using block matching algorithms.
  9747. Motion vectors are stored in frame side data to be used by other filters.
  9748. This filter accepts the following options:
  9749. @table @option
  9750. @item method
  9751. Specify the motion estimation method. Accepts one of the following values:
  9752. @table @samp
  9753. @item esa
  9754. Exhaustive search algorithm.
  9755. @item tss
  9756. Three step search algorithm.
  9757. @item tdls
  9758. Two dimensional logarithmic search algorithm.
  9759. @item ntss
  9760. New three step search algorithm.
  9761. @item fss
  9762. Four step search algorithm.
  9763. @item ds
  9764. Diamond search algorithm.
  9765. @item hexbs
  9766. Hexagon-based search algorithm.
  9767. @item epzs
  9768. Enhanced predictive zonal search algorithm.
  9769. @item umh
  9770. Uneven multi-hexagon search algorithm.
  9771. @end table
  9772. Default value is @samp{esa}.
  9773. @item mb_size
  9774. Macroblock size. Default @code{16}.
  9775. @item search_param
  9776. Search parameter. Default @code{7}.
  9777. @end table
  9778. @section midequalizer
  9779. Apply Midway Image Equalization effect using two video streams.
  9780. Midway Image Equalization adjusts a pair of images to have the same
  9781. histogram, while maintaining their dynamics as much as possible. It's
  9782. useful for e.g. matching exposures from a pair of stereo cameras.
  9783. This filter has two inputs and one output, which must be of same pixel format, but
  9784. may be of different sizes. The output of filter is first input adjusted with
  9785. midway histogram of both inputs.
  9786. This filter accepts the following option:
  9787. @table @option
  9788. @item planes
  9789. Set which planes to process. Default is @code{15}, which is all available planes.
  9790. @end table
  9791. @section minterpolate
  9792. Convert the video to specified frame rate using motion interpolation.
  9793. This filter accepts the following options:
  9794. @table @option
  9795. @item fps
  9796. 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}.
  9797. @item mi_mode
  9798. Motion interpolation mode. Following values are accepted:
  9799. @table @samp
  9800. @item dup
  9801. Duplicate previous or next frame for interpolating new ones.
  9802. @item blend
  9803. Blend source frames. Interpolated frame is mean of previous and next frames.
  9804. @item mci
  9805. Motion compensated interpolation. Following options are effective when this mode is selected:
  9806. @table @samp
  9807. @item mc_mode
  9808. Motion compensation mode. Following values are accepted:
  9809. @table @samp
  9810. @item obmc
  9811. Overlapped block motion compensation.
  9812. @item aobmc
  9813. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  9814. @end table
  9815. Default mode is @samp{obmc}.
  9816. @item me_mode
  9817. Motion estimation mode. Following values are accepted:
  9818. @table @samp
  9819. @item bidir
  9820. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  9821. @item bilat
  9822. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  9823. @end table
  9824. Default mode is @samp{bilat}.
  9825. @item me
  9826. The algorithm to be used for motion estimation. Following values are accepted:
  9827. @table @samp
  9828. @item esa
  9829. Exhaustive search algorithm.
  9830. @item tss
  9831. Three step search algorithm.
  9832. @item tdls
  9833. Two dimensional logarithmic search algorithm.
  9834. @item ntss
  9835. New three step search algorithm.
  9836. @item fss
  9837. Four step search algorithm.
  9838. @item ds
  9839. Diamond search algorithm.
  9840. @item hexbs
  9841. Hexagon-based search algorithm.
  9842. @item epzs
  9843. Enhanced predictive zonal search algorithm.
  9844. @item umh
  9845. Uneven multi-hexagon search algorithm.
  9846. @end table
  9847. Default algorithm is @samp{epzs}.
  9848. @item mb_size
  9849. Macroblock size. Default @code{16}.
  9850. @item search_param
  9851. Motion estimation search parameter. Default @code{32}.
  9852. @item vsbmc
  9853. 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).
  9854. @end table
  9855. @end table
  9856. @item scd
  9857. 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:
  9858. @table @samp
  9859. @item none
  9860. Disable scene change detection.
  9861. @item fdiff
  9862. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  9863. @end table
  9864. Default method is @samp{fdiff}.
  9865. @item scd_threshold
  9866. Scene change detection threshold. Default is @code{5.0}.
  9867. @end table
  9868. @section mix
  9869. Mix several video input streams into one video stream.
  9870. A description of the accepted options follows.
  9871. @table @option
  9872. @item nb_inputs
  9873. The number of inputs. If unspecified, it defaults to 2.
  9874. @item weights
  9875. Specify weight of each input video stream as sequence.
  9876. Each weight is separated by space. If number of weights
  9877. is smaller than number of @var{frames} last specified
  9878. weight will be used for all remaining unset weights.
  9879. @item scale
  9880. Specify scale, if it is set it will be multiplied with sum
  9881. of each weight multiplied with pixel values to give final destination
  9882. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9883. @item duration
  9884. Specify how end of stream is determined.
  9885. @table @samp
  9886. @item longest
  9887. The duration of the longest input. (default)
  9888. @item shortest
  9889. The duration of the shortest input.
  9890. @item first
  9891. The duration of the first input.
  9892. @end table
  9893. @end table
  9894. @section mpdecimate
  9895. Drop frames that do not differ greatly from the previous frame in
  9896. order to reduce frame rate.
  9897. The main use of this filter is for very-low-bitrate encoding
  9898. (e.g. streaming over dialup modem), but it could in theory be used for
  9899. fixing movies that were inverse-telecined incorrectly.
  9900. A description of the accepted options follows.
  9901. @table @option
  9902. @item max
  9903. Set the maximum number of consecutive frames which can be dropped (if
  9904. positive), or the minimum interval between dropped frames (if
  9905. negative). If the value is 0, the frame is dropped disregarding the
  9906. number of previous sequentially dropped frames.
  9907. Default value is 0.
  9908. @item hi
  9909. @item lo
  9910. @item frac
  9911. Set the dropping threshold values.
  9912. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9913. represent actual pixel value differences, so a threshold of 64
  9914. corresponds to 1 unit of difference for each pixel, or the same spread
  9915. out differently over the block.
  9916. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9917. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9918. meaning the whole image) differ by more than a threshold of @option{lo}.
  9919. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9920. 64*5, and default value for @option{frac} is 0.33.
  9921. @end table
  9922. @section negate
  9923. Negate (invert) the input video.
  9924. It accepts the following option:
  9925. @table @option
  9926. @item negate_alpha
  9927. With value 1, it negates the alpha component, if present. Default value is 0.
  9928. @end table
  9929. @anchor{nlmeans}
  9930. @section nlmeans
  9931. Denoise frames using Non-Local Means algorithm.
  9932. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9933. context similarity is defined by comparing their surrounding patches of size
  9934. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9935. around the pixel.
  9936. Note that the research area defines centers for patches, which means some
  9937. patches will be made of pixels outside that research area.
  9938. The filter accepts the following options.
  9939. @table @option
  9940. @item s
  9941. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  9942. @item p
  9943. Set patch size. Default is 7. Must be odd number in range [0, 99].
  9944. @item pc
  9945. Same as @option{p} but for chroma planes.
  9946. The default value is @var{0} and means automatic.
  9947. @item r
  9948. Set research size. Default is 15. Must be odd number in range [0, 99].
  9949. @item rc
  9950. Same as @option{r} but for chroma planes.
  9951. The default value is @var{0} and means automatic.
  9952. @end table
  9953. @section nnedi
  9954. Deinterlace video using neural network edge directed interpolation.
  9955. This filter accepts the following options:
  9956. @table @option
  9957. @item weights
  9958. Mandatory option, without binary file filter can not work.
  9959. Currently file can be found here:
  9960. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9961. @item deint
  9962. Set which frames to deinterlace, by default it is @code{all}.
  9963. Can be @code{all} or @code{interlaced}.
  9964. @item field
  9965. Set mode of operation.
  9966. Can be one of the following:
  9967. @table @samp
  9968. @item af
  9969. Use frame flags, both fields.
  9970. @item a
  9971. Use frame flags, single field.
  9972. @item t
  9973. Use top field only.
  9974. @item b
  9975. Use bottom field only.
  9976. @item tf
  9977. Use both fields, top first.
  9978. @item bf
  9979. Use both fields, bottom first.
  9980. @end table
  9981. @item planes
  9982. Set which planes to process, by default filter process all frames.
  9983. @item nsize
  9984. Set size of local neighborhood around each pixel, used by the predictor neural
  9985. network.
  9986. Can be one of the following:
  9987. @table @samp
  9988. @item s8x6
  9989. @item s16x6
  9990. @item s32x6
  9991. @item s48x6
  9992. @item s8x4
  9993. @item s16x4
  9994. @item s32x4
  9995. @end table
  9996. @item nns
  9997. Set the number of neurons in predictor neural network.
  9998. Can be one of the following:
  9999. @table @samp
  10000. @item n16
  10001. @item n32
  10002. @item n64
  10003. @item n128
  10004. @item n256
  10005. @end table
  10006. @item qual
  10007. Controls the number of different neural network predictions that are blended
  10008. together to compute the final output value. Can be @code{fast}, default or
  10009. @code{slow}.
  10010. @item etype
  10011. Set which set of weights to use in the predictor.
  10012. Can be one of the following:
  10013. @table @samp
  10014. @item a
  10015. weights trained to minimize absolute error
  10016. @item s
  10017. weights trained to minimize squared error
  10018. @end table
  10019. @item pscrn
  10020. Controls whether or not the prescreener neural network is used to decide
  10021. which pixels should be processed by the predictor neural network and which
  10022. can be handled by simple cubic interpolation.
  10023. The prescreener is trained to know whether cubic interpolation will be
  10024. sufficient for a pixel or whether it should be predicted by the predictor nn.
  10025. The computational complexity of the prescreener nn is much less than that of
  10026. the predictor nn. Since most pixels can be handled by cubic interpolation,
  10027. using the prescreener generally results in much faster processing.
  10028. The prescreener is pretty accurate, so the difference between using it and not
  10029. using it is almost always unnoticeable.
  10030. Can be one of the following:
  10031. @table @samp
  10032. @item none
  10033. @item original
  10034. @item new
  10035. @end table
  10036. Default is @code{new}.
  10037. @item fapprox
  10038. Set various debugging flags.
  10039. @end table
  10040. @section noformat
  10041. Force libavfilter not to use any of the specified pixel formats for the
  10042. input to the next filter.
  10043. It accepts the following parameters:
  10044. @table @option
  10045. @item pix_fmts
  10046. A '|'-separated list of pixel format names, such as
  10047. pix_fmts=yuv420p|monow|rgb24".
  10048. @end table
  10049. @subsection Examples
  10050. @itemize
  10051. @item
  10052. Force libavfilter to use a format different from @var{yuv420p} for the
  10053. input to the vflip filter:
  10054. @example
  10055. noformat=pix_fmts=yuv420p,vflip
  10056. @end example
  10057. @item
  10058. Convert the input video to any of the formats not contained in the list:
  10059. @example
  10060. noformat=yuv420p|yuv444p|yuv410p
  10061. @end example
  10062. @end itemize
  10063. @section noise
  10064. Add noise on video input frame.
  10065. The filter accepts the following options:
  10066. @table @option
  10067. @item all_seed
  10068. @item c0_seed
  10069. @item c1_seed
  10070. @item c2_seed
  10071. @item c3_seed
  10072. Set noise seed for specific pixel component or all pixel components in case
  10073. of @var{all_seed}. Default value is @code{123457}.
  10074. @item all_strength, alls
  10075. @item c0_strength, c0s
  10076. @item c1_strength, c1s
  10077. @item c2_strength, c2s
  10078. @item c3_strength, c3s
  10079. Set noise strength for specific pixel component or all pixel components in case
  10080. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  10081. @item all_flags, allf
  10082. @item c0_flags, c0f
  10083. @item c1_flags, c1f
  10084. @item c2_flags, c2f
  10085. @item c3_flags, c3f
  10086. Set pixel component flags or set flags for all components if @var{all_flags}.
  10087. Available values for component flags are:
  10088. @table @samp
  10089. @item a
  10090. averaged temporal noise (smoother)
  10091. @item p
  10092. mix random noise with a (semi)regular pattern
  10093. @item t
  10094. temporal noise (noise pattern changes between frames)
  10095. @item u
  10096. uniform noise (gaussian otherwise)
  10097. @end table
  10098. @end table
  10099. @subsection Examples
  10100. Add temporal and uniform noise to input video:
  10101. @example
  10102. noise=alls=20:allf=t+u
  10103. @end example
  10104. @section normalize
  10105. Normalize RGB video (aka histogram stretching, contrast stretching).
  10106. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  10107. For each channel of each frame, the filter computes the input range and maps
  10108. it linearly to the user-specified output range. The output range defaults
  10109. to the full dynamic range from pure black to pure white.
  10110. Temporal smoothing can be used on the input range to reduce flickering (rapid
  10111. changes in brightness) caused when small dark or bright objects enter or leave
  10112. the scene. This is similar to the auto-exposure (automatic gain control) on a
  10113. video camera, and, like a video camera, it may cause a period of over- or
  10114. under-exposure of the video.
  10115. The R,G,B channels can be normalized independently, which may cause some
  10116. color shifting, or linked together as a single channel, which prevents
  10117. color shifting. Linked normalization preserves hue. Independent normalization
  10118. does not, so it can be used to remove some color casts. Independent and linked
  10119. normalization can be combined in any ratio.
  10120. The normalize filter accepts the following options:
  10121. @table @option
  10122. @item blackpt
  10123. @item whitept
  10124. Colors which define the output range. The minimum input value is mapped to
  10125. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  10126. The defaults are black and white respectively. Specifying white for
  10127. @var{blackpt} and black for @var{whitept} will give color-inverted,
  10128. normalized video. Shades of grey can be used to reduce the dynamic range
  10129. (contrast). Specifying saturated colors here can create some interesting
  10130. effects.
  10131. @item smoothing
  10132. The number of previous frames to use for temporal smoothing. The input range
  10133. of each channel is smoothed using a rolling average over the current frame
  10134. and the @var{smoothing} previous frames. The default is 0 (no temporal
  10135. smoothing).
  10136. @item independence
  10137. Controls the ratio of independent (color shifting) channel normalization to
  10138. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  10139. independent. Defaults to 1.0 (fully independent).
  10140. @item strength
  10141. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  10142. expensive no-op. Defaults to 1.0 (full strength).
  10143. @end table
  10144. @subsection Examples
  10145. Stretch video contrast to use the full dynamic range, with no temporal
  10146. smoothing; may flicker depending on the source content:
  10147. @example
  10148. normalize=blackpt=black:whitept=white:smoothing=0
  10149. @end example
  10150. As above, but with 50 frames of temporal smoothing; flicker should be
  10151. reduced, depending on the source content:
  10152. @example
  10153. normalize=blackpt=black:whitept=white:smoothing=50
  10154. @end example
  10155. As above, but with hue-preserving linked channel normalization:
  10156. @example
  10157. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  10158. @end example
  10159. As above, but with half strength:
  10160. @example
  10161. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  10162. @end example
  10163. Map the darkest input color to red, the brightest input color to cyan:
  10164. @example
  10165. normalize=blackpt=red:whitept=cyan
  10166. @end example
  10167. @section null
  10168. Pass the video source unchanged to the output.
  10169. @section ocr
  10170. Optical Character Recognition
  10171. This filter uses Tesseract for optical character recognition. To enable
  10172. compilation of this filter, you need to configure FFmpeg with
  10173. @code{--enable-libtesseract}.
  10174. It accepts the following options:
  10175. @table @option
  10176. @item datapath
  10177. Set datapath to tesseract data. Default is to use whatever was
  10178. set at installation.
  10179. @item language
  10180. Set language, default is "eng".
  10181. @item whitelist
  10182. Set character whitelist.
  10183. @item blacklist
  10184. Set character blacklist.
  10185. @end table
  10186. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  10187. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  10188. @section ocv
  10189. Apply a video transform using libopencv.
  10190. To enable this filter, install the libopencv library and headers and
  10191. configure FFmpeg with @code{--enable-libopencv}.
  10192. It accepts the following parameters:
  10193. @table @option
  10194. @item filter_name
  10195. The name of the libopencv filter to apply.
  10196. @item filter_params
  10197. The parameters to pass to the libopencv filter. If not specified, the default
  10198. values are assumed.
  10199. @end table
  10200. Refer to the official libopencv documentation for more precise
  10201. information:
  10202. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  10203. Several libopencv filters are supported; see the following subsections.
  10204. @anchor{dilate}
  10205. @subsection dilate
  10206. Dilate an image by using a specific structuring element.
  10207. It corresponds to the libopencv function @code{cvDilate}.
  10208. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  10209. @var{struct_el} represents a structuring element, and has the syntax:
  10210. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  10211. @var{cols} and @var{rows} represent the number of columns and rows of
  10212. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  10213. point, and @var{shape} the shape for the structuring element. @var{shape}
  10214. must be "rect", "cross", "ellipse", or "custom".
  10215. If the value for @var{shape} is "custom", it must be followed by a
  10216. string of the form "=@var{filename}". The file with name
  10217. @var{filename} is assumed to represent a binary image, with each
  10218. printable character corresponding to a bright pixel. When a custom
  10219. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  10220. or columns and rows of the read file are assumed instead.
  10221. The default value for @var{struct_el} is "3x3+0x0/rect".
  10222. @var{nb_iterations} specifies the number of times the transform is
  10223. applied to the image, and defaults to 1.
  10224. Some examples:
  10225. @example
  10226. # Use the default values
  10227. ocv=dilate
  10228. # Dilate using a structuring element with a 5x5 cross, iterating two times
  10229. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  10230. # Read the shape from the file diamond.shape, iterating two times.
  10231. # The file diamond.shape may contain a pattern of characters like this
  10232. # *
  10233. # ***
  10234. # *****
  10235. # ***
  10236. # *
  10237. # The specified columns and rows are ignored
  10238. # but the anchor point coordinates are not
  10239. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  10240. @end example
  10241. @subsection erode
  10242. Erode an image by using a specific structuring element.
  10243. It corresponds to the libopencv function @code{cvErode}.
  10244. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  10245. with the same syntax and semantics as the @ref{dilate} filter.
  10246. @subsection smooth
  10247. Smooth the input video.
  10248. The filter takes the following parameters:
  10249. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  10250. @var{type} is the type of smooth filter to apply, and must be one of
  10251. the following values: "blur", "blur_no_scale", "median", "gaussian",
  10252. or "bilateral". The default value is "gaussian".
  10253. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  10254. depends on the smooth type. @var{param1} and
  10255. @var{param2} accept integer positive values or 0. @var{param3} and
  10256. @var{param4} accept floating point values.
  10257. The default value for @var{param1} is 3. The default value for the
  10258. other parameters is 0.
  10259. These parameters correspond to the parameters assigned to the
  10260. libopencv function @code{cvSmooth}.
  10261. @section oscilloscope
  10262. 2D Video Oscilloscope.
  10263. Useful to measure spatial impulse, step responses, chroma delays, etc.
  10264. It accepts the following parameters:
  10265. @table @option
  10266. @item x
  10267. Set scope center x position.
  10268. @item y
  10269. Set scope center y position.
  10270. @item s
  10271. Set scope size, relative to frame diagonal.
  10272. @item t
  10273. Set scope tilt/rotation.
  10274. @item o
  10275. Set trace opacity.
  10276. @item tx
  10277. Set trace center x position.
  10278. @item ty
  10279. Set trace center y position.
  10280. @item tw
  10281. Set trace width, relative to width of frame.
  10282. @item th
  10283. Set trace height, relative to height of frame.
  10284. @item c
  10285. Set which components to trace. By default it traces first three components.
  10286. @item g
  10287. Draw trace grid. By default is enabled.
  10288. @item st
  10289. Draw some statistics. By default is enabled.
  10290. @item sc
  10291. Draw scope. By default is enabled.
  10292. @end table
  10293. @subsection Examples
  10294. @itemize
  10295. @item
  10296. Inspect full first row of video frame.
  10297. @example
  10298. oscilloscope=x=0.5:y=0:s=1
  10299. @end example
  10300. @item
  10301. Inspect full last row of video frame.
  10302. @example
  10303. oscilloscope=x=0.5:y=1:s=1
  10304. @end example
  10305. @item
  10306. Inspect full 5th line of video frame of height 1080.
  10307. @example
  10308. oscilloscope=x=0.5:y=5/1080:s=1
  10309. @end example
  10310. @item
  10311. Inspect full last column of video frame.
  10312. @example
  10313. oscilloscope=x=1:y=0.5:s=1:t=1
  10314. @end example
  10315. @end itemize
  10316. @anchor{overlay}
  10317. @section overlay
  10318. Overlay one video on top of another.
  10319. It takes two inputs and has one output. The first input is the "main"
  10320. video on which the second input is overlaid.
  10321. It accepts the following parameters:
  10322. A description of the accepted options follows.
  10323. @table @option
  10324. @item x
  10325. @item y
  10326. Set the expression for the x and y coordinates of the overlaid video
  10327. on the main video. Default value is "0" for both expressions. In case
  10328. the expression is invalid, it is set to a huge value (meaning that the
  10329. overlay will not be displayed within the output visible area).
  10330. @item eof_action
  10331. See @ref{framesync}.
  10332. @item eval
  10333. Set when the expressions for @option{x}, and @option{y} are evaluated.
  10334. It accepts the following values:
  10335. @table @samp
  10336. @item init
  10337. only evaluate expressions once during the filter initialization or
  10338. when a command is processed
  10339. @item frame
  10340. evaluate expressions for each incoming frame
  10341. @end table
  10342. Default value is @samp{frame}.
  10343. @item shortest
  10344. See @ref{framesync}.
  10345. @item format
  10346. Set the format for the output video.
  10347. It accepts the following values:
  10348. @table @samp
  10349. @item yuv420
  10350. force YUV420 output
  10351. @item yuv422
  10352. force YUV422 output
  10353. @item yuv444
  10354. force YUV444 output
  10355. @item rgb
  10356. force packed RGB output
  10357. @item gbrp
  10358. force planar RGB output
  10359. @item auto
  10360. automatically pick format
  10361. @end table
  10362. Default value is @samp{yuv420}.
  10363. @item repeatlast
  10364. See @ref{framesync}.
  10365. @item alpha
  10366. Set format of alpha of the overlaid video, it can be @var{straight} or
  10367. @var{premultiplied}. Default is @var{straight}.
  10368. @end table
  10369. The @option{x}, and @option{y} expressions can contain the following
  10370. parameters.
  10371. @table @option
  10372. @item main_w, W
  10373. @item main_h, H
  10374. The main input width and height.
  10375. @item overlay_w, w
  10376. @item overlay_h, h
  10377. The overlay input width and height.
  10378. @item x
  10379. @item y
  10380. The computed values for @var{x} and @var{y}. They are evaluated for
  10381. each new frame.
  10382. @item hsub
  10383. @item vsub
  10384. horizontal and vertical chroma subsample values of the output
  10385. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  10386. @var{vsub} is 1.
  10387. @item n
  10388. the number of input frame, starting from 0
  10389. @item pos
  10390. the position in the file of the input frame, NAN if unknown
  10391. @item t
  10392. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  10393. @end table
  10394. This filter also supports the @ref{framesync} options.
  10395. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  10396. when evaluation is done @emph{per frame}, and will evaluate to NAN
  10397. when @option{eval} is set to @samp{init}.
  10398. Be aware that frames are taken from each input video in timestamp
  10399. order, hence, if their initial timestamps differ, it is a good idea
  10400. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  10401. have them begin in the same zero timestamp, as the example for
  10402. the @var{movie} filter does.
  10403. You can chain together more overlays but you should test the
  10404. efficiency of such approach.
  10405. @subsection Commands
  10406. This filter supports the following commands:
  10407. @table @option
  10408. @item x
  10409. @item y
  10410. Modify the x and y of the overlay input.
  10411. The command accepts the same syntax of the corresponding option.
  10412. If the specified expression is not valid, it is kept at its current
  10413. value.
  10414. @end table
  10415. @subsection Examples
  10416. @itemize
  10417. @item
  10418. Draw the overlay at 10 pixels from the bottom right corner of the main
  10419. video:
  10420. @example
  10421. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  10422. @end example
  10423. Using named options the example above becomes:
  10424. @example
  10425. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  10426. @end example
  10427. @item
  10428. Insert a transparent PNG logo in the bottom left corner of the input,
  10429. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  10430. @example
  10431. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  10432. @end example
  10433. @item
  10434. Insert 2 different transparent PNG logos (second logo on bottom
  10435. right corner) using the @command{ffmpeg} tool:
  10436. @example
  10437. 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
  10438. @end example
  10439. @item
  10440. Add a transparent color layer on top of the main video; @code{WxH}
  10441. must specify the size of the main input to the overlay filter:
  10442. @example
  10443. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  10444. @end example
  10445. @item
  10446. Play an original video and a filtered version (here with the deshake
  10447. filter) side by side using the @command{ffplay} tool:
  10448. @example
  10449. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  10450. @end example
  10451. The above command is the same as:
  10452. @example
  10453. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  10454. @end example
  10455. @item
  10456. Make a sliding overlay appearing from the left to the right top part of the
  10457. screen starting since time 2:
  10458. @example
  10459. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  10460. @end example
  10461. @item
  10462. Compose output by putting two input videos side to side:
  10463. @example
  10464. ffmpeg -i left.avi -i right.avi -filter_complex "
  10465. nullsrc=size=200x100 [background];
  10466. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  10467. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  10468. [background][left] overlay=shortest=1 [background+left];
  10469. [background+left][right] overlay=shortest=1:x=100 [left+right]
  10470. "
  10471. @end example
  10472. @item
  10473. Mask 10-20 seconds of a video by applying the delogo filter to a section
  10474. @example
  10475. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  10476. -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]'
  10477. masked.avi
  10478. @end example
  10479. @item
  10480. Chain several overlays in cascade:
  10481. @example
  10482. nullsrc=s=200x200 [bg];
  10483. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  10484. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  10485. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  10486. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  10487. [in3] null, [mid2] overlay=100:100 [out0]
  10488. @end example
  10489. @end itemize
  10490. @section owdenoise
  10491. Apply Overcomplete Wavelet denoiser.
  10492. The filter accepts the following options:
  10493. @table @option
  10494. @item depth
  10495. Set depth.
  10496. Larger depth values will denoise lower frequency components more, but
  10497. slow down filtering.
  10498. Must be an int in the range 8-16, default is @code{8}.
  10499. @item luma_strength, ls
  10500. Set luma strength.
  10501. Must be a double value in the range 0-1000, default is @code{1.0}.
  10502. @item chroma_strength, cs
  10503. Set chroma strength.
  10504. Must be a double value in the range 0-1000, default is @code{1.0}.
  10505. @end table
  10506. @anchor{pad}
  10507. @section pad
  10508. Add paddings to the input image, and place the original input at the
  10509. provided @var{x}, @var{y} coordinates.
  10510. It accepts the following parameters:
  10511. @table @option
  10512. @item width, w
  10513. @item height, h
  10514. Specify an expression for the size of the output image with the
  10515. paddings added. If the value for @var{width} or @var{height} is 0, the
  10516. corresponding input size is used for the output.
  10517. The @var{width} expression can reference the value set by the
  10518. @var{height} expression, and vice versa.
  10519. The default value of @var{width} and @var{height} is 0.
  10520. @item x
  10521. @item y
  10522. Specify the offsets to place the input image at within the padded area,
  10523. with respect to the top/left border of the output image.
  10524. The @var{x} expression can reference the value set by the @var{y}
  10525. expression, and vice versa.
  10526. The default value of @var{x} and @var{y} is 0.
  10527. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  10528. so the input image is centered on the padded area.
  10529. @item color
  10530. Specify the color of the padded area. For the syntax of this option,
  10531. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10532. manual,ffmpeg-utils}.
  10533. The default value of @var{color} is "black".
  10534. @item eval
  10535. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  10536. It accepts the following values:
  10537. @table @samp
  10538. @item init
  10539. Only evaluate expressions once during the filter initialization or when
  10540. a command is processed.
  10541. @item frame
  10542. Evaluate expressions for each incoming frame.
  10543. @end table
  10544. Default value is @samp{init}.
  10545. @item aspect
  10546. Pad to aspect instead to a resolution.
  10547. @end table
  10548. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  10549. options are expressions containing the following constants:
  10550. @table @option
  10551. @item in_w
  10552. @item in_h
  10553. The input video width and height.
  10554. @item iw
  10555. @item ih
  10556. These are the same as @var{in_w} and @var{in_h}.
  10557. @item out_w
  10558. @item out_h
  10559. The output width and height (the size of the padded area), as
  10560. specified by the @var{width} and @var{height} expressions.
  10561. @item ow
  10562. @item oh
  10563. These are the same as @var{out_w} and @var{out_h}.
  10564. @item x
  10565. @item y
  10566. The x and y offsets as specified by the @var{x} and @var{y}
  10567. expressions, or NAN if not yet specified.
  10568. @item a
  10569. same as @var{iw} / @var{ih}
  10570. @item sar
  10571. input sample aspect ratio
  10572. @item dar
  10573. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  10574. @item hsub
  10575. @item vsub
  10576. The horizontal and vertical chroma subsample values. For example for the
  10577. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10578. @end table
  10579. @subsection Examples
  10580. @itemize
  10581. @item
  10582. Add paddings with the color "violet" to the input video. The output video
  10583. size is 640x480, and the top-left corner of the input video is placed at
  10584. column 0, row 40
  10585. @example
  10586. pad=640:480:0:40:violet
  10587. @end example
  10588. The example above is equivalent to the following command:
  10589. @example
  10590. pad=width=640:height=480:x=0:y=40:color=violet
  10591. @end example
  10592. @item
  10593. Pad the input to get an output with dimensions increased by 3/2,
  10594. and put the input video at the center of the padded area:
  10595. @example
  10596. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10597. @end example
  10598. @item
  10599. Pad the input to get a squared output with size equal to the maximum
  10600. value between the input width and height, and put the input video at
  10601. the center of the padded area:
  10602. @example
  10603. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10604. @end example
  10605. @item
  10606. Pad the input to get a final w/h ratio of 16:9:
  10607. @example
  10608. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10609. @end example
  10610. @item
  10611. In case of anamorphic video, in order to set the output display aspect
  10612. correctly, it is necessary to use @var{sar} in the expression,
  10613. according to the relation:
  10614. @example
  10615. (ih * X / ih) * sar = output_dar
  10616. X = output_dar / sar
  10617. @end example
  10618. Thus the previous example needs to be modified to:
  10619. @example
  10620. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  10621. @end example
  10622. @item
  10623. Double the output size and put the input video in the bottom-right
  10624. corner of the output padded area:
  10625. @example
  10626. pad="2*iw:2*ih:ow-iw:oh-ih"
  10627. @end example
  10628. @end itemize
  10629. @anchor{palettegen}
  10630. @section palettegen
  10631. Generate one palette for a whole video stream.
  10632. It accepts the following options:
  10633. @table @option
  10634. @item max_colors
  10635. Set the maximum number of colors to quantize in the palette.
  10636. Note: the palette will still contain 256 colors; the unused palette entries
  10637. will be black.
  10638. @item reserve_transparent
  10639. Create a palette of 255 colors maximum and reserve the last one for
  10640. transparency. Reserving the transparency color is useful for GIF optimization.
  10641. If not set, the maximum of colors in the palette will be 256. You probably want
  10642. to disable this option for a standalone image.
  10643. Set by default.
  10644. @item transparency_color
  10645. Set the color that will be used as background for transparency.
  10646. @item stats_mode
  10647. Set statistics mode.
  10648. It accepts the following values:
  10649. @table @samp
  10650. @item full
  10651. Compute full frame histograms.
  10652. @item diff
  10653. Compute histograms only for the part that differs from previous frame. This
  10654. might be relevant to give more importance to the moving part of your input if
  10655. the background is static.
  10656. @item single
  10657. Compute new histogram for each frame.
  10658. @end table
  10659. Default value is @var{full}.
  10660. @end table
  10661. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  10662. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  10663. color quantization of the palette. This information is also visible at
  10664. @var{info} logging level.
  10665. @subsection Examples
  10666. @itemize
  10667. @item
  10668. Generate a representative palette of a given video using @command{ffmpeg}:
  10669. @example
  10670. ffmpeg -i input.mkv -vf palettegen palette.png
  10671. @end example
  10672. @end itemize
  10673. @section paletteuse
  10674. Use a palette to downsample an input video stream.
  10675. The filter takes two inputs: one video stream and a palette. The palette must
  10676. be a 256 pixels image.
  10677. It accepts the following options:
  10678. @table @option
  10679. @item dither
  10680. Select dithering mode. Available algorithms are:
  10681. @table @samp
  10682. @item bayer
  10683. Ordered 8x8 bayer dithering (deterministic)
  10684. @item heckbert
  10685. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  10686. Note: this dithering is sometimes considered "wrong" and is included as a
  10687. reference.
  10688. @item floyd_steinberg
  10689. Floyd and Steingberg dithering (error diffusion)
  10690. @item sierra2
  10691. Frankie Sierra dithering v2 (error diffusion)
  10692. @item sierra2_4a
  10693. Frankie Sierra dithering v2 "Lite" (error diffusion)
  10694. @end table
  10695. Default is @var{sierra2_4a}.
  10696. @item bayer_scale
  10697. When @var{bayer} dithering is selected, this option defines the scale of the
  10698. pattern (how much the crosshatch pattern is visible). A low value means more
  10699. visible pattern for less banding, and higher value means less visible pattern
  10700. at the cost of more banding.
  10701. The option must be an integer value in the range [0,5]. Default is @var{2}.
  10702. @item diff_mode
  10703. If set, define the zone to process
  10704. @table @samp
  10705. @item rectangle
  10706. Only the changing rectangle will be reprocessed. This is similar to GIF
  10707. cropping/offsetting compression mechanism. This option can be useful for speed
  10708. if only a part of the image is changing, and has use cases such as limiting the
  10709. scope of the error diffusal @option{dither} to the rectangle that bounds the
  10710. moving scene (it leads to more deterministic output if the scene doesn't change
  10711. much, and as a result less moving noise and better GIF compression).
  10712. @end table
  10713. Default is @var{none}.
  10714. @item new
  10715. Take new palette for each output frame.
  10716. @item alpha_threshold
  10717. Sets the alpha threshold for transparency. Alpha values above this threshold
  10718. will be treated as completely opaque, and values below this threshold will be
  10719. treated as completely transparent.
  10720. The option must be an integer value in the range [0,255]. Default is @var{128}.
  10721. @end table
  10722. @subsection Examples
  10723. @itemize
  10724. @item
  10725. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  10726. using @command{ffmpeg}:
  10727. @example
  10728. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  10729. @end example
  10730. @end itemize
  10731. @section perspective
  10732. Correct perspective of video not recorded perpendicular to the screen.
  10733. A description of the accepted parameters follows.
  10734. @table @option
  10735. @item x0
  10736. @item y0
  10737. @item x1
  10738. @item y1
  10739. @item x2
  10740. @item y2
  10741. @item x3
  10742. @item y3
  10743. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  10744. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  10745. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  10746. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  10747. then the corners of the source will be sent to the specified coordinates.
  10748. The expressions can use the following variables:
  10749. @table @option
  10750. @item W
  10751. @item H
  10752. the width and height of video frame.
  10753. @item in
  10754. Input frame count.
  10755. @item on
  10756. Output frame count.
  10757. @end table
  10758. @item interpolation
  10759. Set interpolation for perspective correction.
  10760. It accepts the following values:
  10761. @table @samp
  10762. @item linear
  10763. @item cubic
  10764. @end table
  10765. Default value is @samp{linear}.
  10766. @item sense
  10767. Set interpretation of coordinate options.
  10768. It accepts the following values:
  10769. @table @samp
  10770. @item 0, source
  10771. Send point in the source specified by the given coordinates to
  10772. the corners of the destination.
  10773. @item 1, destination
  10774. Send the corners of the source to the point in the destination specified
  10775. by the given coordinates.
  10776. Default value is @samp{source}.
  10777. @end table
  10778. @item eval
  10779. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  10780. It accepts the following values:
  10781. @table @samp
  10782. @item init
  10783. only evaluate expressions once during the filter initialization or
  10784. when a command is processed
  10785. @item frame
  10786. evaluate expressions for each incoming frame
  10787. @end table
  10788. Default value is @samp{init}.
  10789. @end table
  10790. @section phase
  10791. Delay interlaced video by one field time so that the field order changes.
  10792. The intended use is to fix PAL movies that have been captured with the
  10793. opposite field order to the film-to-video transfer.
  10794. A description of the accepted parameters follows.
  10795. @table @option
  10796. @item mode
  10797. Set phase mode.
  10798. It accepts the following values:
  10799. @table @samp
  10800. @item t
  10801. Capture field order top-first, transfer bottom-first.
  10802. Filter will delay the bottom field.
  10803. @item b
  10804. Capture field order bottom-first, transfer top-first.
  10805. Filter will delay the top field.
  10806. @item p
  10807. Capture and transfer with the same field order. This mode only exists
  10808. for the documentation of the other options to refer to, but if you
  10809. actually select it, the filter will faithfully do nothing.
  10810. @item a
  10811. Capture field order determined automatically by field flags, transfer
  10812. opposite.
  10813. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  10814. basis using field flags. If no field information is available,
  10815. then this works just like @samp{u}.
  10816. @item u
  10817. Capture unknown or varying, transfer opposite.
  10818. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  10819. analyzing the images and selecting the alternative that produces best
  10820. match between the fields.
  10821. @item T
  10822. Capture top-first, transfer unknown or varying.
  10823. Filter selects among @samp{t} and @samp{p} using image analysis.
  10824. @item B
  10825. Capture bottom-first, transfer unknown or varying.
  10826. Filter selects among @samp{b} and @samp{p} using image analysis.
  10827. @item A
  10828. Capture determined by field flags, transfer unknown or varying.
  10829. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  10830. image analysis. If no field information is available, then this works just
  10831. like @samp{U}. This is the default mode.
  10832. @item U
  10833. Both capture and transfer unknown or varying.
  10834. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  10835. @end table
  10836. @end table
  10837. @section photosensitivity
  10838. Reduce various flashes in video, so to help users with epilepsy.
  10839. It accepts the following options:
  10840. @table @option
  10841. @item frames, f
  10842. Set how many frames to use when filtering. Default is 30.
  10843. @item threshold, t
  10844. Set detection threshold factor. Default is 1.
  10845. Lower is stricter.
  10846. @item skip
  10847. Set how many pixels to skip when sampling frames. Defalt is 1.
  10848. Allowed range is from 1 to 1024.
  10849. @item bypass
  10850. Leave frames unchanged. Default is disabled.
  10851. @end table
  10852. @section pixdesctest
  10853. Pixel format descriptor test filter, mainly useful for internal
  10854. testing. The output video should be equal to the input video.
  10855. For example:
  10856. @example
  10857. format=monow, pixdesctest
  10858. @end example
  10859. can be used to test the monowhite pixel format descriptor definition.
  10860. @section pixscope
  10861. Display sample values of color channels. Mainly useful for checking color
  10862. and levels. Minimum supported resolution is 640x480.
  10863. The filters accept the following options:
  10864. @table @option
  10865. @item x
  10866. Set scope X position, relative offset on X axis.
  10867. @item y
  10868. Set scope Y position, relative offset on Y axis.
  10869. @item w
  10870. Set scope width.
  10871. @item h
  10872. Set scope height.
  10873. @item o
  10874. Set window opacity. This window also holds statistics about pixel area.
  10875. @item wx
  10876. Set window X position, relative offset on X axis.
  10877. @item wy
  10878. Set window Y position, relative offset on Y axis.
  10879. @end table
  10880. @section pp
  10881. Enable the specified chain of postprocessing subfilters using libpostproc. This
  10882. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  10883. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  10884. Each subfilter and some options have a short and a long name that can be used
  10885. interchangeably, i.e. dr/dering are the same.
  10886. The filters accept the following options:
  10887. @table @option
  10888. @item subfilters
  10889. Set postprocessing subfilters string.
  10890. @end table
  10891. All subfilters share common options to determine their scope:
  10892. @table @option
  10893. @item a/autoq
  10894. Honor the quality commands for this subfilter.
  10895. @item c/chrom
  10896. Do chrominance filtering, too (default).
  10897. @item y/nochrom
  10898. Do luminance filtering only (no chrominance).
  10899. @item n/noluma
  10900. Do chrominance filtering only (no luminance).
  10901. @end table
  10902. These options can be appended after the subfilter name, separated by a '|'.
  10903. Available subfilters are:
  10904. @table @option
  10905. @item hb/hdeblock[|difference[|flatness]]
  10906. Horizontal deblocking filter
  10907. @table @option
  10908. @item difference
  10909. Difference factor where higher values mean more deblocking (default: @code{32}).
  10910. @item flatness
  10911. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10912. @end table
  10913. @item vb/vdeblock[|difference[|flatness]]
  10914. Vertical deblocking filter
  10915. @table @option
  10916. @item difference
  10917. Difference factor where higher values mean more deblocking (default: @code{32}).
  10918. @item flatness
  10919. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10920. @end table
  10921. @item ha/hadeblock[|difference[|flatness]]
  10922. Accurate horizontal deblocking filter
  10923. @table @option
  10924. @item difference
  10925. Difference factor where higher values mean more deblocking (default: @code{32}).
  10926. @item flatness
  10927. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10928. @end table
  10929. @item va/vadeblock[|difference[|flatness]]
  10930. Accurate vertical deblocking filter
  10931. @table @option
  10932. @item difference
  10933. Difference factor where higher values mean more deblocking (default: @code{32}).
  10934. @item flatness
  10935. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10936. @end table
  10937. @end table
  10938. The horizontal and vertical deblocking filters share the difference and
  10939. flatness values so you cannot set different horizontal and vertical
  10940. thresholds.
  10941. @table @option
  10942. @item h1/x1hdeblock
  10943. Experimental horizontal deblocking filter
  10944. @item v1/x1vdeblock
  10945. Experimental vertical deblocking filter
  10946. @item dr/dering
  10947. Deringing filter
  10948. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10949. @table @option
  10950. @item threshold1
  10951. larger -> stronger filtering
  10952. @item threshold2
  10953. larger -> stronger filtering
  10954. @item threshold3
  10955. larger -> stronger filtering
  10956. @end table
  10957. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10958. @table @option
  10959. @item f/fullyrange
  10960. Stretch luminance to @code{0-255}.
  10961. @end table
  10962. @item lb/linblenddeint
  10963. Linear blend deinterlacing filter that deinterlaces the given block by
  10964. filtering all lines with a @code{(1 2 1)} filter.
  10965. @item li/linipoldeint
  10966. Linear interpolating deinterlacing filter that deinterlaces the given block by
  10967. linearly interpolating every second line.
  10968. @item ci/cubicipoldeint
  10969. Cubic interpolating deinterlacing filter deinterlaces the given block by
  10970. cubically interpolating every second line.
  10971. @item md/mediandeint
  10972. Median deinterlacing filter that deinterlaces the given block by applying a
  10973. median filter to every second line.
  10974. @item fd/ffmpegdeint
  10975. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  10976. second line with a @code{(-1 4 2 4 -1)} filter.
  10977. @item l5/lowpass5
  10978. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  10979. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  10980. @item fq/forceQuant[|quantizer]
  10981. Overrides the quantizer table from the input with the constant quantizer you
  10982. specify.
  10983. @table @option
  10984. @item quantizer
  10985. Quantizer to use
  10986. @end table
  10987. @item de/default
  10988. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  10989. @item fa/fast
  10990. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  10991. @item ac
  10992. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  10993. @end table
  10994. @subsection Examples
  10995. @itemize
  10996. @item
  10997. Apply horizontal and vertical deblocking, deringing and automatic
  10998. brightness/contrast:
  10999. @example
  11000. pp=hb/vb/dr/al
  11001. @end example
  11002. @item
  11003. Apply default filters without brightness/contrast correction:
  11004. @example
  11005. pp=de/-al
  11006. @end example
  11007. @item
  11008. Apply default filters and temporal denoiser:
  11009. @example
  11010. pp=default/tmpnoise|1|2|3
  11011. @end example
  11012. @item
  11013. Apply deblocking on luminance only, and switch vertical deblocking on or off
  11014. automatically depending on available CPU time:
  11015. @example
  11016. pp=hb|y/vb|a
  11017. @end example
  11018. @end itemize
  11019. @section pp7
  11020. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  11021. similar to spp = 6 with 7 point DCT, where only the center sample is
  11022. used after IDCT.
  11023. The filter accepts the following options:
  11024. @table @option
  11025. @item qp
  11026. Force a constant quantization parameter. It accepts an integer in range
  11027. 0 to 63. If not set, the filter will use the QP from the video stream
  11028. (if available).
  11029. @item mode
  11030. Set thresholding mode. Available modes are:
  11031. @table @samp
  11032. @item hard
  11033. Set hard thresholding.
  11034. @item soft
  11035. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11036. @item medium
  11037. Set medium thresholding (good results, default).
  11038. @end table
  11039. @end table
  11040. @section premultiply
  11041. Apply alpha premultiply effect to input video stream using first plane
  11042. of second stream as alpha.
  11043. Both streams must have same dimensions and same pixel format.
  11044. The filter accepts the following option:
  11045. @table @option
  11046. @item planes
  11047. Set which planes will be processed, unprocessed planes will be copied.
  11048. By default value 0xf, all planes will be processed.
  11049. @item inplace
  11050. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11051. @end table
  11052. @section prewitt
  11053. Apply prewitt operator to input video stream.
  11054. The filter accepts the following option:
  11055. @table @option
  11056. @item planes
  11057. Set which planes will be processed, unprocessed planes will be copied.
  11058. By default value 0xf, all planes will be processed.
  11059. @item scale
  11060. Set value which will be multiplied with filtered result.
  11061. @item delta
  11062. Set value which will be added to filtered result.
  11063. @end table
  11064. @anchor{program_opencl}
  11065. @section program_opencl
  11066. Filter video using an OpenCL program.
  11067. @table @option
  11068. @item source
  11069. OpenCL program source file.
  11070. @item kernel
  11071. Kernel name in program.
  11072. @item inputs
  11073. Number of inputs to the filter. Defaults to 1.
  11074. @item size, s
  11075. Size of output frames. Defaults to the same as the first input.
  11076. @end table
  11077. The program source file must contain a kernel function with the given name,
  11078. which will be run once for each plane of the output. Each run on a plane
  11079. gets enqueued as a separate 2D global NDRange with one work-item for each
  11080. pixel to be generated. The global ID offset for each work-item is therefore
  11081. the coordinates of a pixel in the destination image.
  11082. The kernel function needs to take the following arguments:
  11083. @itemize
  11084. @item
  11085. Destination image, @var{__write_only image2d_t}.
  11086. This image will become the output; the kernel should write all of it.
  11087. @item
  11088. Frame index, @var{unsigned int}.
  11089. This is a counter starting from zero and increasing by one for each frame.
  11090. @item
  11091. Source images, @var{__read_only image2d_t}.
  11092. These are the most recent images on each input. The kernel may read from
  11093. them to generate the output, but they can't be written to.
  11094. @end itemize
  11095. Example programs:
  11096. @itemize
  11097. @item
  11098. Copy the input to the output (output must be the same size as the input).
  11099. @verbatim
  11100. __kernel void copy(__write_only image2d_t destination,
  11101. unsigned int index,
  11102. __read_only image2d_t source)
  11103. {
  11104. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  11105. int2 location = (int2)(get_global_id(0), get_global_id(1));
  11106. float4 value = read_imagef(source, sampler, location);
  11107. write_imagef(destination, location, value);
  11108. }
  11109. @end verbatim
  11110. @item
  11111. Apply a simple transformation, rotating the input by an amount increasing
  11112. with the index counter. Pixel values are linearly interpolated by the
  11113. sampler, and the output need not have the same dimensions as the input.
  11114. @verbatim
  11115. __kernel void rotate_image(__write_only image2d_t dst,
  11116. unsigned int index,
  11117. __read_only image2d_t src)
  11118. {
  11119. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  11120. CLK_FILTER_LINEAR);
  11121. float angle = (float)index / 100.0f;
  11122. float2 dst_dim = convert_float2(get_image_dim(dst));
  11123. float2 src_dim = convert_float2(get_image_dim(src));
  11124. float2 dst_cen = dst_dim / 2.0f;
  11125. float2 src_cen = src_dim / 2.0f;
  11126. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  11127. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  11128. float2 src_pos = {
  11129. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  11130. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  11131. };
  11132. src_pos = src_pos * src_dim / dst_dim;
  11133. float2 src_loc = src_pos + src_cen;
  11134. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  11135. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  11136. write_imagef(dst, dst_loc, 0.5f);
  11137. else
  11138. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  11139. }
  11140. @end verbatim
  11141. @item
  11142. Blend two inputs together, with the amount of each input used varying
  11143. with the index counter.
  11144. @verbatim
  11145. __kernel void blend_images(__write_only image2d_t dst,
  11146. unsigned int index,
  11147. __read_only image2d_t src1,
  11148. __read_only image2d_t src2)
  11149. {
  11150. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  11151. CLK_FILTER_LINEAR);
  11152. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  11153. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  11154. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  11155. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  11156. float4 val1 = read_imagef(src1, sampler, src1_loc);
  11157. float4 val2 = read_imagef(src2, sampler, src2_loc);
  11158. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  11159. }
  11160. @end verbatim
  11161. @end itemize
  11162. @section pseudocolor
  11163. Alter frame colors in video with pseudocolors.
  11164. This filter accepts the following options:
  11165. @table @option
  11166. @item c0
  11167. set pixel first component expression
  11168. @item c1
  11169. set pixel second component expression
  11170. @item c2
  11171. set pixel third component expression
  11172. @item c3
  11173. set pixel fourth component expression, corresponds to the alpha component
  11174. @item i
  11175. set component to use as base for altering colors
  11176. @end table
  11177. Each of them specifies the expression to use for computing the lookup table for
  11178. the corresponding pixel component values.
  11179. The expressions can contain the following constants and functions:
  11180. @table @option
  11181. @item w
  11182. @item h
  11183. The input width and height.
  11184. @item val
  11185. The input value for the pixel component.
  11186. @item ymin, umin, vmin, amin
  11187. The minimum allowed component value.
  11188. @item ymax, umax, vmax, amax
  11189. The maximum allowed component value.
  11190. @end table
  11191. All expressions default to "val".
  11192. @subsection Examples
  11193. @itemize
  11194. @item
  11195. Change too high luma values to gradient:
  11196. @example
  11197. 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'"
  11198. @end example
  11199. @end itemize
  11200. @section psnr
  11201. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  11202. Ratio) between two input videos.
  11203. This filter takes in input two input videos, the first input is
  11204. considered the "main" source and is passed unchanged to the
  11205. output. The second input is used as a "reference" video for computing
  11206. the PSNR.
  11207. Both video inputs must have the same resolution and pixel format for
  11208. this filter to work correctly. Also it assumes that both inputs
  11209. have the same number of frames, which are compared one by one.
  11210. The obtained average PSNR is printed through the logging system.
  11211. The filter stores the accumulated MSE (mean squared error) of each
  11212. frame, and at the end of the processing it is averaged across all frames
  11213. equally, and the following formula is applied to obtain the PSNR:
  11214. @example
  11215. PSNR = 10*log10(MAX^2/MSE)
  11216. @end example
  11217. Where MAX is the average of the maximum values of each component of the
  11218. image.
  11219. The description of the accepted parameters follows.
  11220. @table @option
  11221. @item stats_file, f
  11222. If specified the filter will use the named file to save the PSNR of
  11223. each individual frame. When filename equals "-" the data is sent to
  11224. standard output.
  11225. @item stats_version
  11226. Specifies which version of the stats file format to use. Details of
  11227. each format are written below.
  11228. Default value is 1.
  11229. @item stats_add_max
  11230. Determines whether the max value is output to the stats log.
  11231. Default value is 0.
  11232. Requires stats_version >= 2. If this is set and stats_version < 2,
  11233. the filter will return an error.
  11234. @end table
  11235. This filter also supports the @ref{framesync} options.
  11236. The file printed if @var{stats_file} is selected, contains a sequence of
  11237. key/value pairs of the form @var{key}:@var{value} for each compared
  11238. couple of frames.
  11239. If a @var{stats_version} greater than 1 is specified, a header line precedes
  11240. the list of per-frame-pair stats, with key value pairs following the frame
  11241. format with the following parameters:
  11242. @table @option
  11243. @item psnr_log_version
  11244. The version of the log file format. Will match @var{stats_version}.
  11245. @item fields
  11246. A comma separated list of the per-frame-pair parameters included in
  11247. the log.
  11248. @end table
  11249. A description of each shown per-frame-pair parameter follows:
  11250. @table @option
  11251. @item n
  11252. sequential number of the input frame, starting from 1
  11253. @item mse_avg
  11254. Mean Square Error pixel-by-pixel average difference of the compared
  11255. frames, averaged over all the image components.
  11256. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  11257. Mean Square Error pixel-by-pixel average difference of the compared
  11258. frames for the component specified by the suffix.
  11259. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  11260. Peak Signal to Noise ratio of the compared frames for the component
  11261. specified by the suffix.
  11262. @item max_avg, max_y, max_u, max_v
  11263. Maximum allowed value for each channel, and average over all
  11264. channels.
  11265. @end table
  11266. For example:
  11267. @example
  11268. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11269. [main][ref] psnr="stats_file=stats.log" [out]
  11270. @end example
  11271. On this example the input file being processed is compared with the
  11272. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  11273. is stored in @file{stats.log}.
  11274. @anchor{pullup}
  11275. @section pullup
  11276. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  11277. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  11278. content.
  11279. The pullup filter is designed to take advantage of future context in making
  11280. its decisions. This filter is stateless in the sense that it does not lock
  11281. onto a pattern to follow, but it instead looks forward to the following
  11282. fields in order to identify matches and rebuild progressive frames.
  11283. To produce content with an even framerate, insert the fps filter after
  11284. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  11285. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  11286. The filter accepts the following options:
  11287. @table @option
  11288. @item jl
  11289. @item jr
  11290. @item jt
  11291. @item jb
  11292. These options set the amount of "junk" to ignore at the left, right, top, and
  11293. bottom of the image, respectively. Left and right are in units of 8 pixels,
  11294. while top and bottom are in units of 2 lines.
  11295. The default is 8 pixels on each side.
  11296. @item sb
  11297. Set the strict breaks. Setting this option to 1 will reduce the chances of
  11298. filter generating an occasional mismatched frame, but it may also cause an
  11299. excessive number of frames to be dropped during high motion sequences.
  11300. Conversely, setting it to -1 will make filter match fields more easily.
  11301. This may help processing of video where there is slight blurring between
  11302. the fields, but may also cause there to be interlaced frames in the output.
  11303. Default value is @code{0}.
  11304. @item mp
  11305. Set the metric plane to use. It accepts the following values:
  11306. @table @samp
  11307. @item l
  11308. Use luma plane.
  11309. @item u
  11310. Use chroma blue plane.
  11311. @item v
  11312. Use chroma red plane.
  11313. @end table
  11314. This option may be set to use chroma plane instead of the default luma plane
  11315. for doing filter's computations. This may improve accuracy on very clean
  11316. source material, but more likely will decrease accuracy, especially if there
  11317. is chroma noise (rainbow effect) or any grayscale video.
  11318. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  11319. load and make pullup usable in realtime on slow machines.
  11320. @end table
  11321. For best results (without duplicated frames in the output file) it is
  11322. necessary to change the output frame rate. For example, to inverse
  11323. telecine NTSC input:
  11324. @example
  11325. ffmpeg -i input -vf pullup -r 24000/1001 ...
  11326. @end example
  11327. @section qp
  11328. Change video quantization parameters (QP).
  11329. The filter accepts the following option:
  11330. @table @option
  11331. @item qp
  11332. Set expression for quantization parameter.
  11333. @end table
  11334. The expression is evaluated through the eval API and can contain, among others,
  11335. the following constants:
  11336. @table @var
  11337. @item known
  11338. 1 if index is not 129, 0 otherwise.
  11339. @item qp
  11340. Sequential index starting from -129 to 128.
  11341. @end table
  11342. @subsection Examples
  11343. @itemize
  11344. @item
  11345. Some equation like:
  11346. @example
  11347. qp=2+2*sin(PI*qp)
  11348. @end example
  11349. @end itemize
  11350. @section random
  11351. Flush video frames from internal cache of frames into a random order.
  11352. No frame is discarded.
  11353. Inspired by @ref{frei0r} nervous filter.
  11354. @table @option
  11355. @item frames
  11356. Set size in number of frames of internal cache, in range from @code{2} to
  11357. @code{512}. Default is @code{30}.
  11358. @item seed
  11359. Set seed for random number generator, must be an integer included between
  11360. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11361. less than @code{0}, the filter will try to use a good random seed on a
  11362. best effort basis.
  11363. @end table
  11364. @section readeia608
  11365. Read closed captioning (EIA-608) information from the top lines of a video frame.
  11366. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  11367. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  11368. with EIA-608 data (starting from 0). A description of each metadata value follows:
  11369. @table @option
  11370. @item lavfi.readeia608.X.cc
  11371. The two bytes stored as EIA-608 data (printed in hexadecimal).
  11372. @item lavfi.readeia608.X.line
  11373. The number of the line on which the EIA-608 data was identified and read.
  11374. @end table
  11375. This filter accepts the following options:
  11376. @table @option
  11377. @item scan_min
  11378. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  11379. @item scan_max
  11380. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  11381. @item mac
  11382. Set minimal acceptable amplitude change for sync codes detection.
  11383. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  11384. @item spw
  11385. Set the ratio of width reserved for sync code detection.
  11386. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  11387. @item mhd
  11388. Set the max peaks height difference for sync code detection.
  11389. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11390. @item mpd
  11391. Set max peaks period difference for sync code detection.
  11392. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11393. @item msd
  11394. Set the first two max start code bits differences.
  11395. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  11396. @item bhd
  11397. Set the minimum ratio of bits height compared to 3rd start code bit.
  11398. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  11399. @item th_w
  11400. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  11401. @item th_b
  11402. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  11403. @item chp
  11404. Enable checking the parity bit. In the event of a parity error, the filter will output
  11405. @code{0x00} for that character. Default is false.
  11406. @item lp
  11407. Lowpass lines prior to further processing. Default is disabled.
  11408. @end table
  11409. @subsection Examples
  11410. @itemize
  11411. @item
  11412. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  11413. @example
  11414. 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
  11415. @end example
  11416. @end itemize
  11417. @section readvitc
  11418. Read vertical interval timecode (VITC) information from the top lines of a
  11419. video frame.
  11420. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  11421. timecode value, if a valid timecode has been detected. Further metadata key
  11422. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  11423. timecode data has been found or not.
  11424. This filter accepts the following options:
  11425. @table @option
  11426. @item scan_max
  11427. Set the maximum number of lines to scan for VITC data. If the value is set to
  11428. @code{-1} the full video frame is scanned. Default is @code{45}.
  11429. @item thr_b
  11430. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  11431. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  11432. @item thr_w
  11433. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  11434. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  11435. @end table
  11436. @subsection Examples
  11437. @itemize
  11438. @item
  11439. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  11440. draw @code{--:--:--:--} as a placeholder:
  11441. @example
  11442. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  11443. @end example
  11444. @end itemize
  11445. @section remap
  11446. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  11447. Destination pixel at position (X, Y) will be picked from source (x, y) position
  11448. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  11449. value for pixel will be used for destination pixel.
  11450. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  11451. will have Xmap/Ymap video stream dimensions.
  11452. Xmap and Ymap input video streams are 16bit depth, single channel.
  11453. @table @option
  11454. @item format
  11455. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  11456. Default is @code{color}.
  11457. @end table
  11458. @section removegrain
  11459. The removegrain filter is a spatial denoiser for progressive video.
  11460. @table @option
  11461. @item m0
  11462. Set mode for the first plane.
  11463. @item m1
  11464. Set mode for the second plane.
  11465. @item m2
  11466. Set mode for the third plane.
  11467. @item m3
  11468. Set mode for the fourth plane.
  11469. @end table
  11470. Range of mode is from 0 to 24. Description of each mode follows:
  11471. @table @var
  11472. @item 0
  11473. Leave input plane unchanged. Default.
  11474. @item 1
  11475. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  11476. @item 2
  11477. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  11478. @item 3
  11479. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  11480. @item 4
  11481. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  11482. This is equivalent to a median filter.
  11483. @item 5
  11484. Line-sensitive clipping giving the minimal change.
  11485. @item 6
  11486. Line-sensitive clipping, intermediate.
  11487. @item 7
  11488. Line-sensitive clipping, intermediate.
  11489. @item 8
  11490. Line-sensitive clipping, intermediate.
  11491. @item 9
  11492. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  11493. @item 10
  11494. Replaces the target pixel with the closest neighbour.
  11495. @item 11
  11496. [1 2 1] horizontal and vertical kernel blur.
  11497. @item 12
  11498. Same as mode 11.
  11499. @item 13
  11500. Bob mode, interpolates top field from the line where the neighbours
  11501. pixels are the closest.
  11502. @item 14
  11503. Bob mode, interpolates bottom field from the line where the neighbours
  11504. pixels are the closest.
  11505. @item 15
  11506. Bob mode, interpolates top field. Same as 13 but with a more complicated
  11507. interpolation formula.
  11508. @item 16
  11509. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  11510. interpolation formula.
  11511. @item 17
  11512. Clips the pixel with the minimum and maximum of respectively the maximum and
  11513. minimum of each pair of opposite neighbour pixels.
  11514. @item 18
  11515. Line-sensitive clipping using opposite neighbours whose greatest distance from
  11516. the current pixel is minimal.
  11517. @item 19
  11518. Replaces the pixel with the average of its 8 neighbours.
  11519. @item 20
  11520. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  11521. @item 21
  11522. Clips pixels using the averages of opposite neighbour.
  11523. @item 22
  11524. Same as mode 21 but simpler and faster.
  11525. @item 23
  11526. Small edge and halo removal, but reputed useless.
  11527. @item 24
  11528. Similar as 23.
  11529. @end table
  11530. @section removelogo
  11531. Suppress a TV station logo, using an image file to determine which
  11532. pixels comprise the logo. It works by filling in the pixels that
  11533. comprise the logo with neighboring pixels.
  11534. The filter accepts the following options:
  11535. @table @option
  11536. @item filename, f
  11537. Set the filter bitmap file, which can be any image format supported by
  11538. libavformat. The width and height of the image file must match those of the
  11539. video stream being processed.
  11540. @end table
  11541. Pixels in the provided bitmap image with a value of zero are not
  11542. considered part of the logo, non-zero pixels are considered part of
  11543. the logo. If you use white (255) for the logo and black (0) for the
  11544. rest, you will be safe. For making the filter bitmap, it is
  11545. recommended to take a screen capture of a black frame with the logo
  11546. visible, and then using a threshold filter followed by the erode
  11547. filter once or twice.
  11548. If needed, little splotches can be fixed manually. Remember that if
  11549. logo pixels are not covered, the filter quality will be much
  11550. reduced. Marking too many pixels as part of the logo does not hurt as
  11551. much, but it will increase the amount of blurring needed to cover over
  11552. the image and will destroy more information than necessary, and extra
  11553. pixels will slow things down on a large logo.
  11554. @section repeatfields
  11555. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  11556. fields based on its value.
  11557. @section reverse
  11558. Reverse a video clip.
  11559. Warning: This filter requires memory to buffer the entire clip, so trimming
  11560. is suggested.
  11561. @subsection Examples
  11562. @itemize
  11563. @item
  11564. Take the first 5 seconds of a clip, and reverse it.
  11565. @example
  11566. trim=end=5,reverse
  11567. @end example
  11568. @end itemize
  11569. @section rgbashift
  11570. Shift R/G/B/A pixels horizontally and/or vertically.
  11571. The filter accepts the following options:
  11572. @table @option
  11573. @item rh
  11574. Set amount to shift red horizontally.
  11575. @item rv
  11576. Set amount to shift red vertically.
  11577. @item gh
  11578. Set amount to shift green horizontally.
  11579. @item gv
  11580. Set amount to shift green vertically.
  11581. @item bh
  11582. Set amount to shift blue horizontally.
  11583. @item bv
  11584. Set amount to shift blue vertically.
  11585. @item ah
  11586. Set amount to shift alpha horizontally.
  11587. @item av
  11588. Set amount to shift alpha vertically.
  11589. @item edge
  11590. Set edge mode, can be @var{smear}, default, or @var{warp}.
  11591. @end table
  11592. @section roberts
  11593. Apply roberts cross operator to input video stream.
  11594. The filter accepts the following option:
  11595. @table @option
  11596. @item planes
  11597. Set which planes will be processed, unprocessed planes will be copied.
  11598. By default value 0xf, all planes will be processed.
  11599. @item scale
  11600. Set value which will be multiplied with filtered result.
  11601. @item delta
  11602. Set value which will be added to filtered result.
  11603. @end table
  11604. @section rotate
  11605. Rotate video by an arbitrary angle expressed in radians.
  11606. The filter accepts the following options:
  11607. A description of the optional parameters follows.
  11608. @table @option
  11609. @item angle, a
  11610. Set an expression for the angle by which to rotate the input video
  11611. clockwise, expressed as a number of radians. A negative value will
  11612. result in a counter-clockwise rotation. By default it is set to "0".
  11613. This expression is evaluated for each frame.
  11614. @item out_w, ow
  11615. Set the output width expression, default value is "iw".
  11616. This expression is evaluated just once during configuration.
  11617. @item out_h, oh
  11618. Set the output height expression, default value is "ih".
  11619. This expression is evaluated just once during configuration.
  11620. @item bilinear
  11621. Enable bilinear interpolation if set to 1, a value of 0 disables
  11622. it. Default value is 1.
  11623. @item fillcolor, c
  11624. Set the color used to fill the output area not covered by the rotated
  11625. image. For the general syntax of this option, check the
  11626. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11627. If the special value "none" is selected then no
  11628. background is printed (useful for example if the background is never shown).
  11629. Default value is "black".
  11630. @end table
  11631. The expressions for the angle and the output size can contain the
  11632. following constants and functions:
  11633. @table @option
  11634. @item n
  11635. sequential number of the input frame, starting from 0. It is always NAN
  11636. before the first frame is filtered.
  11637. @item t
  11638. time in seconds of the input frame, it is set to 0 when the filter is
  11639. configured. It is always NAN before the first frame is filtered.
  11640. @item hsub
  11641. @item vsub
  11642. horizontal and vertical chroma subsample values. For example for the
  11643. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11644. @item in_w, iw
  11645. @item in_h, ih
  11646. the input video width and height
  11647. @item out_w, ow
  11648. @item out_h, oh
  11649. the output width and height, that is the size of the padded area as
  11650. specified by the @var{width} and @var{height} expressions
  11651. @item rotw(a)
  11652. @item roth(a)
  11653. the minimal width/height required for completely containing the input
  11654. video rotated by @var{a} radians.
  11655. These are only available when computing the @option{out_w} and
  11656. @option{out_h} expressions.
  11657. @end table
  11658. @subsection Examples
  11659. @itemize
  11660. @item
  11661. Rotate the input by PI/6 radians clockwise:
  11662. @example
  11663. rotate=PI/6
  11664. @end example
  11665. @item
  11666. Rotate the input by PI/6 radians counter-clockwise:
  11667. @example
  11668. rotate=-PI/6
  11669. @end example
  11670. @item
  11671. Rotate the input by 45 degrees clockwise:
  11672. @example
  11673. rotate=45*PI/180
  11674. @end example
  11675. @item
  11676. Apply a constant rotation with period T, starting from an angle of PI/3:
  11677. @example
  11678. rotate=PI/3+2*PI*t/T
  11679. @end example
  11680. @item
  11681. Make the input video rotation oscillating with a period of T
  11682. seconds and an amplitude of A radians:
  11683. @example
  11684. rotate=A*sin(2*PI/T*t)
  11685. @end example
  11686. @item
  11687. Rotate the video, output size is chosen so that the whole rotating
  11688. input video is always completely contained in the output:
  11689. @example
  11690. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  11691. @end example
  11692. @item
  11693. Rotate the video, reduce the output size so that no background is ever
  11694. shown:
  11695. @example
  11696. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  11697. @end example
  11698. @end itemize
  11699. @subsection Commands
  11700. The filter supports the following commands:
  11701. @table @option
  11702. @item a, angle
  11703. Set the angle expression.
  11704. The command accepts the same syntax of the corresponding option.
  11705. If the specified expression is not valid, it is kept at its current
  11706. value.
  11707. @end table
  11708. @section sab
  11709. Apply Shape Adaptive Blur.
  11710. The filter accepts the following options:
  11711. @table @option
  11712. @item luma_radius, lr
  11713. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  11714. value is 1.0. A greater value will result in a more blurred image, and
  11715. in slower processing.
  11716. @item luma_pre_filter_radius, lpfr
  11717. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  11718. value is 1.0.
  11719. @item luma_strength, ls
  11720. Set luma maximum difference between pixels to still be considered, must
  11721. be a value in the 0.1-100.0 range, default value is 1.0.
  11722. @item chroma_radius, cr
  11723. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  11724. greater value will result in a more blurred image, and in slower
  11725. processing.
  11726. @item chroma_pre_filter_radius, cpfr
  11727. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  11728. @item chroma_strength, cs
  11729. Set chroma maximum difference between pixels to still be considered,
  11730. must be a value in the -0.9-100.0 range.
  11731. @end table
  11732. Each chroma option value, if not explicitly specified, is set to the
  11733. corresponding luma option value.
  11734. @anchor{scale}
  11735. @section scale
  11736. Scale (resize) the input video, using the libswscale library.
  11737. The scale filter forces the output display aspect ratio to be the same
  11738. of the input, by changing the output sample aspect ratio.
  11739. If the input image format is different from the format requested by
  11740. the next filter, the scale filter will convert the input to the
  11741. requested format.
  11742. @subsection Options
  11743. The filter accepts the following options, or any of the options
  11744. supported by the libswscale scaler.
  11745. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  11746. the complete list of scaler options.
  11747. @table @option
  11748. @item width, w
  11749. @item height, h
  11750. Set the output video dimension expression. Default value is the input
  11751. dimension.
  11752. If the @var{width} or @var{w} value is 0, the input width is used for
  11753. the output. If the @var{height} or @var{h} value is 0, the input height
  11754. is used for the output.
  11755. If one and only one of the values is -n with n >= 1, the scale filter
  11756. will use a value that maintains the aspect ratio of the input image,
  11757. calculated from the other specified dimension. After that it will,
  11758. however, make sure that the calculated dimension is divisible by n and
  11759. adjust the value if necessary.
  11760. If both values are -n with n >= 1, the behavior will be identical to
  11761. both values being set to 0 as previously detailed.
  11762. See below for the list of accepted constants for use in the dimension
  11763. expression.
  11764. @item eval
  11765. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  11766. @table @samp
  11767. @item init
  11768. Only evaluate expressions once during the filter initialization or when a command is processed.
  11769. @item frame
  11770. Evaluate expressions for each incoming frame.
  11771. @end table
  11772. Default value is @samp{init}.
  11773. @item interl
  11774. Set the interlacing mode. It accepts the following values:
  11775. @table @samp
  11776. @item 1
  11777. Force interlaced aware scaling.
  11778. @item 0
  11779. Do not apply interlaced scaling.
  11780. @item -1
  11781. Select interlaced aware scaling depending on whether the source frames
  11782. are flagged as interlaced or not.
  11783. @end table
  11784. Default value is @samp{0}.
  11785. @item flags
  11786. Set libswscale scaling flags. See
  11787. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11788. complete list of values. If not explicitly specified the filter applies
  11789. the default flags.
  11790. @item param0, param1
  11791. Set libswscale input parameters for scaling algorithms that need them. See
  11792. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11793. complete documentation. If not explicitly specified the filter applies
  11794. empty parameters.
  11795. @item size, s
  11796. Set the video size. For the syntax of this option, check the
  11797. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11798. @item in_color_matrix
  11799. @item out_color_matrix
  11800. Set in/output YCbCr color space type.
  11801. This allows the autodetected value to be overridden as well as allows forcing
  11802. a specific value used for the output and encoder.
  11803. If not specified, the color space type depends on the pixel format.
  11804. Possible values:
  11805. @table @samp
  11806. @item auto
  11807. Choose automatically.
  11808. @item bt709
  11809. Format conforming to International Telecommunication Union (ITU)
  11810. Recommendation BT.709.
  11811. @item fcc
  11812. Set color space conforming to the United States Federal Communications
  11813. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  11814. @item bt601
  11815. @item bt470
  11816. @item smpte170m
  11817. Set color space conforming to:
  11818. @itemize
  11819. @item
  11820. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  11821. @item
  11822. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  11823. @item
  11824. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  11825. @end itemize
  11826. @item smpte240m
  11827. Set color space conforming to SMPTE ST 240:1999.
  11828. @item bt2020
  11829. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  11830. @end table
  11831. @item in_range
  11832. @item out_range
  11833. Set in/output YCbCr sample range.
  11834. This allows the autodetected value to be overridden as well as allows forcing
  11835. a specific value used for the output and encoder. If not specified, the
  11836. range depends on the pixel format. Possible values:
  11837. @table @samp
  11838. @item auto/unknown
  11839. Choose automatically.
  11840. @item jpeg/full/pc
  11841. Set full range (0-255 in case of 8-bit luma).
  11842. @item mpeg/limited/tv
  11843. Set "MPEG" range (16-235 in case of 8-bit luma).
  11844. @end table
  11845. @item force_original_aspect_ratio
  11846. Enable decreasing or increasing output video width or height if necessary to
  11847. keep the original aspect ratio. Possible values:
  11848. @table @samp
  11849. @item disable
  11850. Scale the video as specified and disable this feature.
  11851. @item decrease
  11852. The output video dimensions will automatically be decreased if needed.
  11853. @item increase
  11854. The output video dimensions will automatically be increased if needed.
  11855. @end table
  11856. One useful instance of this option is that when you know a specific device's
  11857. maximum allowed resolution, you can use this to limit the output video to
  11858. that, while retaining the aspect ratio. For example, device A allows
  11859. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  11860. decrease) and specifying 1280x720 to the command line makes the output
  11861. 1280x533.
  11862. Please note that this is a different thing than specifying -1 for @option{w}
  11863. or @option{h}, you still need to specify the output resolution for this option
  11864. to work.
  11865. @item force_divisible_by Ensures that the output resolution is divisible by the
  11866. given integer when used together with @option{force_original_aspect_ratio}. This
  11867. works similar to using -n in the @option{w} and @option{h} options.
  11868. This option respects the value set for @option{force_original_aspect_ratio},
  11869. increasing or decreasing the resolution accordingly. This may slightly modify
  11870. the video's aspect ration.
  11871. This can be handy, for example, if you want to have a video fit within a defined
  11872. resolution using the @option{force_original_aspect_ratio} option but have
  11873. encoder restrictions when it comes to width or height.
  11874. @end table
  11875. The values of the @option{w} and @option{h} options are expressions
  11876. containing the following constants:
  11877. @table @var
  11878. @item in_w
  11879. @item in_h
  11880. The input width and height
  11881. @item iw
  11882. @item ih
  11883. These are the same as @var{in_w} and @var{in_h}.
  11884. @item out_w
  11885. @item out_h
  11886. The output (scaled) width and height
  11887. @item ow
  11888. @item oh
  11889. These are the same as @var{out_w} and @var{out_h}
  11890. @item a
  11891. The same as @var{iw} / @var{ih}
  11892. @item sar
  11893. input sample aspect ratio
  11894. @item dar
  11895. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11896. @item hsub
  11897. @item vsub
  11898. horizontal and vertical input chroma subsample values. For example for the
  11899. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11900. @item ohsub
  11901. @item ovsub
  11902. horizontal and vertical output chroma subsample values. For example for the
  11903. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11904. @end table
  11905. @subsection Examples
  11906. @itemize
  11907. @item
  11908. Scale the input video to a size of 200x100
  11909. @example
  11910. scale=w=200:h=100
  11911. @end example
  11912. This is equivalent to:
  11913. @example
  11914. scale=200:100
  11915. @end example
  11916. or:
  11917. @example
  11918. scale=200x100
  11919. @end example
  11920. @item
  11921. Specify a size abbreviation for the output size:
  11922. @example
  11923. scale=qcif
  11924. @end example
  11925. which can also be written as:
  11926. @example
  11927. scale=size=qcif
  11928. @end example
  11929. @item
  11930. Scale the input to 2x:
  11931. @example
  11932. scale=w=2*iw:h=2*ih
  11933. @end example
  11934. @item
  11935. The above is the same as:
  11936. @example
  11937. scale=2*in_w:2*in_h
  11938. @end example
  11939. @item
  11940. Scale the input to 2x with forced interlaced scaling:
  11941. @example
  11942. scale=2*iw:2*ih:interl=1
  11943. @end example
  11944. @item
  11945. Scale the input to half size:
  11946. @example
  11947. scale=w=iw/2:h=ih/2
  11948. @end example
  11949. @item
  11950. Increase the width, and set the height to the same size:
  11951. @example
  11952. scale=3/2*iw:ow
  11953. @end example
  11954. @item
  11955. Seek Greek harmony:
  11956. @example
  11957. scale=iw:1/PHI*iw
  11958. scale=ih*PHI:ih
  11959. @end example
  11960. @item
  11961. Increase the height, and set the width to 3/2 of the height:
  11962. @example
  11963. scale=w=3/2*oh:h=3/5*ih
  11964. @end example
  11965. @item
  11966. Increase the size, making the size a multiple of the chroma
  11967. subsample values:
  11968. @example
  11969. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  11970. @end example
  11971. @item
  11972. Increase the width to a maximum of 500 pixels,
  11973. keeping the same aspect ratio as the input:
  11974. @example
  11975. scale=w='min(500\, iw*3/2):h=-1'
  11976. @end example
  11977. @item
  11978. Make pixels square by combining scale and setsar:
  11979. @example
  11980. scale='trunc(ih*dar):ih',setsar=1/1
  11981. @end example
  11982. @item
  11983. Make pixels square by combining scale and setsar,
  11984. making sure the resulting resolution is even (required by some codecs):
  11985. @example
  11986. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  11987. @end example
  11988. @end itemize
  11989. @subsection Commands
  11990. This filter supports the following commands:
  11991. @table @option
  11992. @item width, w
  11993. @item height, h
  11994. Set the output video dimension expression.
  11995. The command accepts the same syntax of the corresponding option.
  11996. If the specified expression is not valid, it is kept at its current
  11997. value.
  11998. @end table
  11999. @section scale_npp
  12000. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  12001. format conversion on CUDA video frames. Setting the output width and height
  12002. works in the same way as for the @var{scale} filter.
  12003. The following additional options are accepted:
  12004. @table @option
  12005. @item format
  12006. The pixel format of the output CUDA frames. If set to the string "same" (the
  12007. default), the input format will be kept. Note that automatic format negotiation
  12008. and conversion is not yet supported for hardware frames
  12009. @item interp_algo
  12010. The interpolation algorithm used for resizing. One of the following:
  12011. @table @option
  12012. @item nn
  12013. Nearest neighbour.
  12014. @item linear
  12015. @item cubic
  12016. @item cubic2p_bspline
  12017. 2-parameter cubic (B=1, C=0)
  12018. @item cubic2p_catmullrom
  12019. 2-parameter cubic (B=0, C=1/2)
  12020. @item cubic2p_b05c03
  12021. 2-parameter cubic (B=1/2, C=3/10)
  12022. @item super
  12023. Supersampling
  12024. @item lanczos
  12025. @end table
  12026. @end table
  12027. @section scale2ref
  12028. Scale (resize) the input video, based on a reference video.
  12029. See the scale filter for available options, scale2ref supports the same but
  12030. uses the reference video instead of the main input as basis. scale2ref also
  12031. supports the following additional constants for the @option{w} and
  12032. @option{h} options:
  12033. @table @var
  12034. @item main_w
  12035. @item main_h
  12036. The main input video's width and height
  12037. @item main_a
  12038. The same as @var{main_w} / @var{main_h}
  12039. @item main_sar
  12040. The main input video's sample aspect ratio
  12041. @item main_dar, mdar
  12042. The main input video's display aspect ratio. Calculated from
  12043. @code{(main_w / main_h) * main_sar}.
  12044. @item main_hsub
  12045. @item main_vsub
  12046. The main input video's horizontal and vertical chroma subsample values.
  12047. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  12048. is 1.
  12049. @end table
  12050. @subsection Examples
  12051. @itemize
  12052. @item
  12053. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  12054. @example
  12055. 'scale2ref[b][a];[a][b]overlay'
  12056. @end example
  12057. @item
  12058. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  12059. @example
  12060. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  12061. @end example
  12062. @end itemize
  12063. @section scroll
  12064. Scroll input video horizontally and/or vertically by constant speed.
  12065. The filter accepts the following options:
  12066. @table @option
  12067. @item horizontal, h
  12068. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12069. Negative values changes scrolling direction.
  12070. @item vertical, v
  12071. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12072. Negative values changes scrolling direction.
  12073. @item hpos
  12074. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  12075. @item vpos
  12076. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  12077. @end table
  12078. @anchor{selectivecolor}
  12079. @section selectivecolor
  12080. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  12081. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  12082. by the "purity" of the color (that is, how saturated it already is).
  12083. This filter is similar to the Adobe Photoshop Selective Color tool.
  12084. The filter accepts the following options:
  12085. @table @option
  12086. @item correction_method
  12087. Select color correction method.
  12088. Available values are:
  12089. @table @samp
  12090. @item absolute
  12091. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  12092. component value).
  12093. @item relative
  12094. Specified adjustments are relative to the original component value.
  12095. @end table
  12096. Default is @code{absolute}.
  12097. @item reds
  12098. Adjustments for red pixels (pixels where the red component is the maximum)
  12099. @item yellows
  12100. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  12101. @item greens
  12102. Adjustments for green pixels (pixels where the green component is the maximum)
  12103. @item cyans
  12104. Adjustments for cyan pixels (pixels where the red component is the minimum)
  12105. @item blues
  12106. Adjustments for blue pixels (pixels where the blue component is the maximum)
  12107. @item magentas
  12108. Adjustments for magenta pixels (pixels where the green component is the minimum)
  12109. @item whites
  12110. Adjustments for white pixels (pixels where all components are greater than 128)
  12111. @item neutrals
  12112. Adjustments for all pixels except pure black and pure white
  12113. @item blacks
  12114. Adjustments for black pixels (pixels where all components are lesser than 128)
  12115. @item psfile
  12116. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  12117. @end table
  12118. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  12119. 4 space separated floating point adjustment values in the [-1,1] range,
  12120. respectively to adjust the amount of cyan, magenta, yellow and black for the
  12121. pixels of its range.
  12122. @subsection Examples
  12123. @itemize
  12124. @item
  12125. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  12126. increase magenta by 27% in blue areas:
  12127. @example
  12128. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  12129. @end example
  12130. @item
  12131. Use a Photoshop selective color preset:
  12132. @example
  12133. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  12134. @end example
  12135. @end itemize
  12136. @anchor{separatefields}
  12137. @section separatefields
  12138. The @code{separatefields} takes a frame-based video input and splits
  12139. each frame into its components fields, producing a new half height clip
  12140. with twice the frame rate and twice the frame count.
  12141. This filter use field-dominance information in frame to decide which
  12142. of each pair of fields to place first in the output.
  12143. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  12144. @section setdar, setsar
  12145. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  12146. output video.
  12147. This is done by changing the specified Sample (aka Pixel) Aspect
  12148. Ratio, according to the following equation:
  12149. @example
  12150. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  12151. @end example
  12152. Keep in mind that the @code{setdar} filter does not modify the pixel
  12153. dimensions of the video frame. Also, the display aspect ratio set by
  12154. this filter may be changed by later filters in the filterchain,
  12155. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  12156. applied.
  12157. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  12158. the filter output video.
  12159. Note that as a consequence of the application of this filter, the
  12160. output display aspect ratio will change according to the equation
  12161. above.
  12162. Keep in mind that the sample aspect ratio set by the @code{setsar}
  12163. filter may be changed by later filters in the filterchain, e.g. if
  12164. another "setsar" or a "setdar" filter is applied.
  12165. It accepts the following parameters:
  12166. @table @option
  12167. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  12168. Set the aspect ratio used by the filter.
  12169. The parameter can be a floating point number string, an expression, or
  12170. a string of the form @var{num}:@var{den}, where @var{num} and
  12171. @var{den} are the numerator and denominator of the aspect ratio. If
  12172. the parameter is not specified, it is assumed the value "0".
  12173. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  12174. should be escaped.
  12175. @item max
  12176. Set the maximum integer value to use for expressing numerator and
  12177. denominator when reducing the expressed aspect ratio to a rational.
  12178. Default value is @code{100}.
  12179. @end table
  12180. The parameter @var{sar} is an expression containing
  12181. the following constants:
  12182. @table @option
  12183. @item E, PI, PHI
  12184. These are approximated values for the mathematical constants e
  12185. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  12186. @item w, h
  12187. The input width and height.
  12188. @item a
  12189. These are the same as @var{w} / @var{h}.
  12190. @item sar
  12191. The input sample aspect ratio.
  12192. @item dar
  12193. The input display aspect ratio. It is the same as
  12194. (@var{w} / @var{h}) * @var{sar}.
  12195. @item hsub, vsub
  12196. Horizontal and vertical chroma subsample values. For example, for the
  12197. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12198. @end table
  12199. @subsection Examples
  12200. @itemize
  12201. @item
  12202. To change the display aspect ratio to 16:9, specify one of the following:
  12203. @example
  12204. setdar=dar=1.77777
  12205. setdar=dar=16/9
  12206. @end example
  12207. @item
  12208. To change the sample aspect ratio to 10:11, specify:
  12209. @example
  12210. setsar=sar=10/11
  12211. @end example
  12212. @item
  12213. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  12214. 1000 in the aspect ratio reduction, use the command:
  12215. @example
  12216. setdar=ratio=16/9:max=1000
  12217. @end example
  12218. @end itemize
  12219. @anchor{setfield}
  12220. @section setfield
  12221. Force field for the output video frame.
  12222. The @code{setfield} filter marks the interlace type field for the
  12223. output frames. It does not change the input frame, but only sets the
  12224. corresponding property, which affects how the frame is treated by
  12225. following filters (e.g. @code{fieldorder} or @code{yadif}).
  12226. The filter accepts the following options:
  12227. @table @option
  12228. @item mode
  12229. Available values are:
  12230. @table @samp
  12231. @item auto
  12232. Keep the same field property.
  12233. @item bff
  12234. Mark the frame as bottom-field-first.
  12235. @item tff
  12236. Mark the frame as top-field-first.
  12237. @item prog
  12238. Mark the frame as progressive.
  12239. @end table
  12240. @end table
  12241. @anchor{setparams}
  12242. @section setparams
  12243. Force frame parameter for the output video frame.
  12244. The @code{setparams} filter marks interlace and color range for the
  12245. output frames. It does not change the input frame, but only sets the
  12246. corresponding property, which affects how the frame is treated by
  12247. filters/encoders.
  12248. @table @option
  12249. @item field_mode
  12250. Available values are:
  12251. @table @samp
  12252. @item auto
  12253. Keep the same field property (default).
  12254. @item bff
  12255. Mark the frame as bottom-field-first.
  12256. @item tff
  12257. Mark the frame as top-field-first.
  12258. @item prog
  12259. Mark the frame as progressive.
  12260. @end table
  12261. @item range
  12262. Available values are:
  12263. @table @samp
  12264. @item auto
  12265. Keep the same color range property (default).
  12266. @item unspecified, unknown
  12267. Mark the frame as unspecified color range.
  12268. @item limited, tv, mpeg
  12269. Mark the frame as limited range.
  12270. @item full, pc, jpeg
  12271. Mark the frame as full range.
  12272. @end table
  12273. @item color_primaries
  12274. Set the color primaries.
  12275. Available values are:
  12276. @table @samp
  12277. @item auto
  12278. Keep the same color primaries property (default).
  12279. @item bt709
  12280. @item unknown
  12281. @item bt470m
  12282. @item bt470bg
  12283. @item smpte170m
  12284. @item smpte240m
  12285. @item film
  12286. @item bt2020
  12287. @item smpte428
  12288. @item smpte431
  12289. @item smpte432
  12290. @item jedec-p22
  12291. @end table
  12292. @item color_trc
  12293. Set the color transfer.
  12294. Available values are:
  12295. @table @samp
  12296. @item auto
  12297. Keep the same color trc property (default).
  12298. @item bt709
  12299. @item unknown
  12300. @item bt470m
  12301. @item bt470bg
  12302. @item smpte170m
  12303. @item smpte240m
  12304. @item linear
  12305. @item log100
  12306. @item log316
  12307. @item iec61966-2-4
  12308. @item bt1361e
  12309. @item iec61966-2-1
  12310. @item bt2020-10
  12311. @item bt2020-12
  12312. @item smpte2084
  12313. @item smpte428
  12314. @item arib-std-b67
  12315. @end table
  12316. @item colorspace
  12317. Set the colorspace.
  12318. Available values are:
  12319. @table @samp
  12320. @item auto
  12321. Keep the same colorspace property (default).
  12322. @item gbr
  12323. @item bt709
  12324. @item unknown
  12325. @item fcc
  12326. @item bt470bg
  12327. @item smpte170m
  12328. @item smpte240m
  12329. @item ycgco
  12330. @item bt2020nc
  12331. @item bt2020c
  12332. @item smpte2085
  12333. @item chroma-derived-nc
  12334. @item chroma-derived-c
  12335. @item ictcp
  12336. @end table
  12337. @end table
  12338. @section showinfo
  12339. Show a line containing various information for each input video frame.
  12340. The input video is not modified.
  12341. This filter supports the following options:
  12342. @table @option
  12343. @item checksum
  12344. Calculate checksums of each plane. By default enabled.
  12345. @end table
  12346. The shown line contains a sequence of key/value pairs of the form
  12347. @var{key}:@var{value}.
  12348. The following values are shown in the output:
  12349. @table @option
  12350. @item n
  12351. The (sequential) number of the input frame, starting from 0.
  12352. @item pts
  12353. The Presentation TimeStamp of the input frame, expressed as a number of
  12354. time base units. The time base unit depends on the filter input pad.
  12355. @item pts_time
  12356. The Presentation TimeStamp of the input frame, expressed as a number of
  12357. seconds.
  12358. @item pos
  12359. The position of the frame in the input stream, or -1 if this information is
  12360. unavailable and/or meaningless (for example in case of synthetic video).
  12361. @item fmt
  12362. The pixel format name.
  12363. @item sar
  12364. The sample aspect ratio of the input frame, expressed in the form
  12365. @var{num}/@var{den}.
  12366. @item s
  12367. The size of the input frame. For the syntax of this option, check the
  12368. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12369. @item i
  12370. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  12371. for bottom field first).
  12372. @item iskey
  12373. This is 1 if the frame is a key frame, 0 otherwise.
  12374. @item type
  12375. The picture type of the input frame ("I" for an I-frame, "P" for a
  12376. P-frame, "B" for a B-frame, or "?" for an unknown type).
  12377. Also refer to the documentation of the @code{AVPictureType} enum and of
  12378. the @code{av_get_picture_type_char} function defined in
  12379. @file{libavutil/avutil.h}.
  12380. @item checksum
  12381. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  12382. @item plane_checksum
  12383. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  12384. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  12385. @end table
  12386. @section showpalette
  12387. Displays the 256 colors palette of each frame. This filter is only relevant for
  12388. @var{pal8} pixel format frames.
  12389. It accepts the following option:
  12390. @table @option
  12391. @item s
  12392. Set the size of the box used to represent one palette color entry. Default is
  12393. @code{30} (for a @code{30x30} pixel box).
  12394. @end table
  12395. @section shuffleframes
  12396. Reorder and/or duplicate and/or drop video frames.
  12397. It accepts the following parameters:
  12398. @table @option
  12399. @item mapping
  12400. Set the destination indexes of input frames.
  12401. This is space or '|' separated list of indexes that maps input frames to output
  12402. frames. Number of indexes also sets maximal value that each index may have.
  12403. '-1' index have special meaning and that is to drop frame.
  12404. @end table
  12405. The first frame has the index 0. The default is to keep the input unchanged.
  12406. @subsection Examples
  12407. @itemize
  12408. @item
  12409. Swap second and third frame of every three frames of the input:
  12410. @example
  12411. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  12412. @end example
  12413. @item
  12414. Swap 10th and 1st frame of every ten frames of the input:
  12415. @example
  12416. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  12417. @end example
  12418. @end itemize
  12419. @section shuffleplanes
  12420. Reorder and/or duplicate video planes.
  12421. It accepts the following parameters:
  12422. @table @option
  12423. @item map0
  12424. The index of the input plane to be used as the first output plane.
  12425. @item map1
  12426. The index of the input plane to be used as the second output plane.
  12427. @item map2
  12428. The index of the input plane to be used as the third output plane.
  12429. @item map3
  12430. The index of the input plane to be used as the fourth output plane.
  12431. @end table
  12432. The first plane has the index 0. The default is to keep the input unchanged.
  12433. @subsection Examples
  12434. @itemize
  12435. @item
  12436. Swap the second and third planes of the input:
  12437. @example
  12438. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  12439. @end example
  12440. @end itemize
  12441. @anchor{signalstats}
  12442. @section signalstats
  12443. Evaluate various visual metrics that assist in determining issues associated
  12444. with the digitization of analog video media.
  12445. By default the filter will log these metadata values:
  12446. @table @option
  12447. @item YMIN
  12448. Display the minimal Y value contained within the input frame. Expressed in
  12449. range of [0-255].
  12450. @item YLOW
  12451. Display the Y value at the 10% percentile within the input frame. Expressed in
  12452. range of [0-255].
  12453. @item YAVG
  12454. Display the average Y value within the input frame. Expressed in range of
  12455. [0-255].
  12456. @item YHIGH
  12457. Display the Y value at the 90% percentile within the input frame. Expressed in
  12458. range of [0-255].
  12459. @item YMAX
  12460. Display the maximum Y value contained within the input frame. Expressed in
  12461. range of [0-255].
  12462. @item UMIN
  12463. Display the minimal U value contained within the input frame. Expressed in
  12464. range of [0-255].
  12465. @item ULOW
  12466. Display the U value at the 10% percentile within the input frame. Expressed in
  12467. range of [0-255].
  12468. @item UAVG
  12469. Display the average U value within the input frame. Expressed in range of
  12470. [0-255].
  12471. @item UHIGH
  12472. Display the U value at the 90% percentile within the input frame. Expressed in
  12473. range of [0-255].
  12474. @item UMAX
  12475. Display the maximum U value contained within the input frame. Expressed in
  12476. range of [0-255].
  12477. @item VMIN
  12478. Display the minimal V value contained within the input frame. Expressed in
  12479. range of [0-255].
  12480. @item VLOW
  12481. Display the V value at the 10% percentile within the input frame. Expressed in
  12482. range of [0-255].
  12483. @item VAVG
  12484. Display the average V value within the input frame. Expressed in range of
  12485. [0-255].
  12486. @item VHIGH
  12487. Display the V value at the 90% percentile within the input frame. Expressed in
  12488. range of [0-255].
  12489. @item VMAX
  12490. Display the maximum V value contained within the input frame. Expressed in
  12491. range of [0-255].
  12492. @item SATMIN
  12493. Display the minimal saturation value contained within the input frame.
  12494. Expressed in range of [0-~181.02].
  12495. @item SATLOW
  12496. Display the saturation value at the 10% percentile within the input frame.
  12497. Expressed in range of [0-~181.02].
  12498. @item SATAVG
  12499. Display the average saturation value within the input frame. Expressed in range
  12500. of [0-~181.02].
  12501. @item SATHIGH
  12502. Display the saturation value at the 90% percentile within the input frame.
  12503. Expressed in range of [0-~181.02].
  12504. @item SATMAX
  12505. Display the maximum saturation value contained within the input frame.
  12506. Expressed in range of [0-~181.02].
  12507. @item HUEMED
  12508. Display the median value for hue within the input frame. Expressed in range of
  12509. [0-360].
  12510. @item HUEAVG
  12511. Display the average value for hue within the input frame. Expressed in range of
  12512. [0-360].
  12513. @item YDIF
  12514. Display the average of sample value difference between all values of the Y
  12515. plane in the current frame and corresponding values of the previous input frame.
  12516. Expressed in range of [0-255].
  12517. @item UDIF
  12518. Display the average of sample value difference between all values of the U
  12519. plane in the current frame and corresponding values of the previous input frame.
  12520. Expressed in range of [0-255].
  12521. @item VDIF
  12522. Display the average of sample value difference between all values of the V
  12523. plane in the current frame and corresponding values of the previous input frame.
  12524. Expressed in range of [0-255].
  12525. @item YBITDEPTH
  12526. Display bit depth of Y plane in current frame.
  12527. Expressed in range of [0-16].
  12528. @item UBITDEPTH
  12529. Display bit depth of U plane in current frame.
  12530. Expressed in range of [0-16].
  12531. @item VBITDEPTH
  12532. Display bit depth of V plane in current frame.
  12533. Expressed in range of [0-16].
  12534. @end table
  12535. The filter accepts the following options:
  12536. @table @option
  12537. @item stat
  12538. @item out
  12539. @option{stat} specify an additional form of image analysis.
  12540. @option{out} output video with the specified type of pixel highlighted.
  12541. Both options accept the following values:
  12542. @table @samp
  12543. @item tout
  12544. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  12545. unlike the neighboring pixels of the same field. Examples of temporal outliers
  12546. include the results of video dropouts, head clogs, or tape tracking issues.
  12547. @item vrep
  12548. Identify @var{vertical line repetition}. Vertical line repetition includes
  12549. similar rows of pixels within a frame. In born-digital video vertical line
  12550. repetition is common, but this pattern is uncommon in video digitized from an
  12551. analog source. When it occurs in video that results from the digitization of an
  12552. analog source it can indicate concealment from a dropout compensator.
  12553. @item brng
  12554. Identify pixels that fall outside of legal broadcast range.
  12555. @end table
  12556. @item color, c
  12557. Set the highlight color for the @option{out} option. The default color is
  12558. yellow.
  12559. @end table
  12560. @subsection Examples
  12561. @itemize
  12562. @item
  12563. Output data of various video metrics:
  12564. @example
  12565. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  12566. @end example
  12567. @item
  12568. Output specific data about the minimum and maximum values of the Y plane per frame:
  12569. @example
  12570. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  12571. @end example
  12572. @item
  12573. Playback video while highlighting pixels that are outside of broadcast range in red.
  12574. @example
  12575. ffplay example.mov -vf signalstats="out=brng:color=red"
  12576. @end example
  12577. @item
  12578. Playback video with signalstats metadata drawn over the frame.
  12579. @example
  12580. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  12581. @end example
  12582. The contents of signalstat_drawtext.txt used in the command are:
  12583. @example
  12584. time %@{pts:hms@}
  12585. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  12586. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  12587. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  12588. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  12589. @end example
  12590. @end itemize
  12591. @anchor{signature}
  12592. @section signature
  12593. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  12594. input. In this case the matching between the inputs can be calculated additionally.
  12595. The filter always passes through the first input. The signature of each stream can
  12596. be written into a file.
  12597. It accepts the following options:
  12598. @table @option
  12599. @item detectmode
  12600. Enable or disable the matching process.
  12601. Available values are:
  12602. @table @samp
  12603. @item off
  12604. Disable the calculation of a matching (default).
  12605. @item full
  12606. Calculate the matching for the whole video and output whether the whole video
  12607. matches or only parts.
  12608. @item fast
  12609. Calculate only until a matching is found or the video ends. Should be faster in
  12610. some cases.
  12611. @end table
  12612. @item nb_inputs
  12613. Set the number of inputs. The option value must be a non negative integer.
  12614. Default value is 1.
  12615. @item filename
  12616. Set the path to which the output is written. If there is more than one input,
  12617. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  12618. integer), that will be replaced with the input number. If no filename is
  12619. specified, no output will be written. This is the default.
  12620. @item format
  12621. Choose the output format.
  12622. Available values are:
  12623. @table @samp
  12624. @item binary
  12625. Use the specified binary representation (default).
  12626. @item xml
  12627. Use the specified xml representation.
  12628. @end table
  12629. @item th_d
  12630. Set threshold to detect one word as similar. The option value must be an integer
  12631. greater than zero. The default value is 9000.
  12632. @item th_dc
  12633. Set threshold to detect all words as similar. The option value must be an integer
  12634. greater than zero. The default value is 60000.
  12635. @item th_xh
  12636. Set threshold to detect frames as similar. The option value must be an integer
  12637. greater than zero. The default value is 116.
  12638. @item th_di
  12639. Set the minimum length of a sequence in frames to recognize it as matching
  12640. sequence. The option value must be a non negative integer value.
  12641. The default value is 0.
  12642. @item th_it
  12643. Set the minimum relation, that matching frames to all frames must have.
  12644. The option value must be a double value between 0 and 1. The default value is 0.5.
  12645. @end table
  12646. @subsection Examples
  12647. @itemize
  12648. @item
  12649. To calculate the signature of an input video and store it in signature.bin:
  12650. @example
  12651. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  12652. @end example
  12653. @item
  12654. To detect whether two videos match and store the signatures in XML format in
  12655. signature0.xml and signature1.xml:
  12656. @example
  12657. 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 -
  12658. @end example
  12659. @end itemize
  12660. @anchor{smartblur}
  12661. @section smartblur
  12662. Blur the input video without impacting the outlines.
  12663. It accepts the following options:
  12664. @table @option
  12665. @item luma_radius, lr
  12666. Set the luma radius. The option value must be a float number in
  12667. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12668. used to blur the image (slower if larger). Default value is 1.0.
  12669. @item luma_strength, ls
  12670. Set the luma strength. The option value must be a float number
  12671. in the range [-1.0,1.0] that configures the blurring. A value included
  12672. in [0.0,1.0] will blur the image whereas a value included in
  12673. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  12674. @item luma_threshold, lt
  12675. Set the luma threshold used as a coefficient to determine
  12676. whether a pixel should be blurred or not. The option value must be an
  12677. integer in the range [-30,30]. A value of 0 will filter all the image,
  12678. a value included in [0,30] will filter flat areas and a value included
  12679. in [-30,0] will filter edges. Default value is 0.
  12680. @item chroma_radius, cr
  12681. Set the chroma radius. The option value must be a float number in
  12682. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12683. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  12684. @item chroma_strength, cs
  12685. Set the chroma strength. The option value must be a float number
  12686. in the range [-1.0,1.0] that configures the blurring. A value included
  12687. in [0.0,1.0] will blur the image whereas a value included in
  12688. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  12689. @item chroma_threshold, ct
  12690. Set the chroma threshold used as a coefficient to determine
  12691. whether a pixel should be blurred or not. The option value must be an
  12692. integer in the range [-30,30]. A value of 0 will filter all the image,
  12693. a value included in [0,30] will filter flat areas and a value included
  12694. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  12695. @end table
  12696. If a chroma option is not explicitly set, the corresponding luma value
  12697. is set.
  12698. @section sobel
  12699. Apply sobel operator to input video stream.
  12700. The filter accepts the following option:
  12701. @table @option
  12702. @item planes
  12703. Set which planes will be processed, unprocessed planes will be copied.
  12704. By default value 0xf, all planes will be processed.
  12705. @item scale
  12706. Set value which will be multiplied with filtered result.
  12707. @item delta
  12708. Set value which will be added to filtered result.
  12709. @end table
  12710. @anchor{spp}
  12711. @section spp
  12712. Apply a simple postprocessing filter that compresses and decompresses the image
  12713. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  12714. and average the results.
  12715. The filter accepts the following options:
  12716. @table @option
  12717. @item quality
  12718. Set quality. This option defines the number of levels for averaging. It accepts
  12719. an integer in the range 0-6. If set to @code{0}, the filter will have no
  12720. effect. A value of @code{6} means the higher quality. For each increment of
  12721. that value the speed drops by a factor of approximately 2. Default value is
  12722. @code{3}.
  12723. @item qp
  12724. Force a constant quantization parameter. If not set, the filter will use the QP
  12725. from the video stream (if available).
  12726. @item mode
  12727. Set thresholding mode. Available modes are:
  12728. @table @samp
  12729. @item hard
  12730. Set hard thresholding (default).
  12731. @item soft
  12732. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12733. @end table
  12734. @item use_bframe_qp
  12735. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  12736. option may cause flicker since the B-Frames have often larger QP. Default is
  12737. @code{0} (not enabled).
  12738. @end table
  12739. @section sr
  12740. Scale the input by applying one of the super-resolution methods based on
  12741. convolutional neural networks. Supported models:
  12742. @itemize
  12743. @item
  12744. Super-Resolution Convolutional Neural Network model (SRCNN).
  12745. See @url{https://arxiv.org/abs/1501.00092}.
  12746. @item
  12747. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  12748. See @url{https://arxiv.org/abs/1609.05158}.
  12749. @end itemize
  12750. Training scripts as well as scripts for model file (.pb) saving can be found at
  12751. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  12752. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  12753. Native model files (.model) can be generated from TensorFlow model
  12754. files (.pb) by using tools/python/convert.py
  12755. The filter accepts the following options:
  12756. @table @option
  12757. @item dnn_backend
  12758. Specify which DNN backend to use for model loading and execution. This option accepts
  12759. the following values:
  12760. @table @samp
  12761. @item native
  12762. Native implementation of DNN loading and execution.
  12763. @item tensorflow
  12764. TensorFlow backend. To enable this backend you
  12765. need to install the TensorFlow for C library (see
  12766. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  12767. @code{--enable-libtensorflow}
  12768. @end table
  12769. Default value is @samp{native}.
  12770. @item model
  12771. Set path to model file specifying network architecture and its parameters.
  12772. Note that different backends use different file formats. TensorFlow backend
  12773. can load files for both formats, while native backend can load files for only
  12774. its format.
  12775. @item scale_factor
  12776. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  12777. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  12778. input upscaled using bicubic upscaling with proper scale factor.
  12779. @end table
  12780. @section ssim
  12781. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  12782. This filter takes in input two input videos, the first input is
  12783. considered the "main" source and is passed unchanged to the
  12784. output. The second input is used as a "reference" video for computing
  12785. the SSIM.
  12786. Both video inputs must have the same resolution and pixel format for
  12787. this filter to work correctly. Also it assumes that both inputs
  12788. have the same number of frames, which are compared one by one.
  12789. The filter stores the calculated SSIM of each frame.
  12790. The description of the accepted parameters follows.
  12791. @table @option
  12792. @item stats_file, f
  12793. If specified the filter will use the named file to save the SSIM of
  12794. each individual frame. When filename equals "-" the data is sent to
  12795. standard output.
  12796. @end table
  12797. The file printed if @var{stats_file} is selected, contains a sequence of
  12798. key/value pairs of the form @var{key}:@var{value} for each compared
  12799. couple of frames.
  12800. A description of each shown parameter follows:
  12801. @table @option
  12802. @item n
  12803. sequential number of the input frame, starting from 1
  12804. @item Y, U, V, R, G, B
  12805. SSIM of the compared frames for the component specified by the suffix.
  12806. @item All
  12807. SSIM of the compared frames for the whole frame.
  12808. @item dB
  12809. Same as above but in dB representation.
  12810. @end table
  12811. This filter also supports the @ref{framesync} options.
  12812. For example:
  12813. @example
  12814. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12815. [main][ref] ssim="stats_file=stats.log" [out]
  12816. @end example
  12817. On this example the input file being processed is compared with the
  12818. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  12819. is stored in @file{stats.log}.
  12820. Another example with both psnr and ssim at same time:
  12821. @example
  12822. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  12823. @end example
  12824. @section stereo3d
  12825. Convert between different stereoscopic image formats.
  12826. The filters accept the following options:
  12827. @table @option
  12828. @item in
  12829. Set stereoscopic image format of input.
  12830. Available values for input image formats are:
  12831. @table @samp
  12832. @item sbsl
  12833. side by side parallel (left eye left, right eye right)
  12834. @item sbsr
  12835. side by side crosseye (right eye left, left eye right)
  12836. @item sbs2l
  12837. side by side parallel with half width resolution
  12838. (left eye left, right eye right)
  12839. @item sbs2r
  12840. side by side crosseye with half width resolution
  12841. (right eye left, left eye right)
  12842. @item abl
  12843. @item tbl
  12844. above-below (left eye above, right eye below)
  12845. @item abr
  12846. @item tbr
  12847. above-below (right eye above, left eye below)
  12848. @item ab2l
  12849. @item tb2l
  12850. above-below with half height resolution
  12851. (left eye above, right eye below)
  12852. @item ab2r
  12853. @item tb2r
  12854. above-below with half height resolution
  12855. (right eye above, left eye below)
  12856. @item al
  12857. alternating frames (left eye first, right eye second)
  12858. @item ar
  12859. alternating frames (right eye first, left eye second)
  12860. @item irl
  12861. interleaved rows (left eye has top row, right eye starts on next row)
  12862. @item irr
  12863. interleaved rows (right eye has top row, left eye starts on next row)
  12864. @item icl
  12865. interleaved columns, left eye first
  12866. @item icr
  12867. interleaved columns, right eye first
  12868. Default value is @samp{sbsl}.
  12869. @end table
  12870. @item out
  12871. Set stereoscopic image format of output.
  12872. @table @samp
  12873. @item sbsl
  12874. side by side parallel (left eye left, right eye right)
  12875. @item sbsr
  12876. side by side crosseye (right eye left, left eye right)
  12877. @item sbs2l
  12878. side by side parallel with half width resolution
  12879. (left eye left, right eye right)
  12880. @item sbs2r
  12881. side by side crosseye with half width resolution
  12882. (right eye left, left eye right)
  12883. @item abl
  12884. @item tbl
  12885. above-below (left eye above, right eye below)
  12886. @item abr
  12887. @item tbr
  12888. above-below (right eye above, left eye below)
  12889. @item ab2l
  12890. @item tb2l
  12891. above-below with half height resolution
  12892. (left eye above, right eye below)
  12893. @item ab2r
  12894. @item tb2r
  12895. above-below with half height resolution
  12896. (right eye above, left eye below)
  12897. @item al
  12898. alternating frames (left eye first, right eye second)
  12899. @item ar
  12900. alternating frames (right eye first, left eye second)
  12901. @item irl
  12902. interleaved rows (left eye has top row, right eye starts on next row)
  12903. @item irr
  12904. interleaved rows (right eye has top row, left eye starts on next row)
  12905. @item arbg
  12906. anaglyph red/blue gray
  12907. (red filter on left eye, blue filter on right eye)
  12908. @item argg
  12909. anaglyph red/green gray
  12910. (red filter on left eye, green filter on right eye)
  12911. @item arcg
  12912. anaglyph red/cyan gray
  12913. (red filter on left eye, cyan filter on right eye)
  12914. @item arch
  12915. anaglyph red/cyan half colored
  12916. (red filter on left eye, cyan filter on right eye)
  12917. @item arcc
  12918. anaglyph red/cyan color
  12919. (red filter on left eye, cyan filter on right eye)
  12920. @item arcd
  12921. anaglyph red/cyan color optimized with the least squares projection of dubois
  12922. (red filter on left eye, cyan filter on right eye)
  12923. @item agmg
  12924. anaglyph green/magenta gray
  12925. (green filter on left eye, magenta filter on right eye)
  12926. @item agmh
  12927. anaglyph green/magenta half colored
  12928. (green filter on left eye, magenta filter on right eye)
  12929. @item agmc
  12930. anaglyph green/magenta colored
  12931. (green filter on left eye, magenta filter on right eye)
  12932. @item agmd
  12933. anaglyph green/magenta color optimized with the least squares projection of dubois
  12934. (green filter on left eye, magenta filter on right eye)
  12935. @item aybg
  12936. anaglyph yellow/blue gray
  12937. (yellow filter on left eye, blue filter on right eye)
  12938. @item aybh
  12939. anaglyph yellow/blue half colored
  12940. (yellow filter on left eye, blue filter on right eye)
  12941. @item aybc
  12942. anaglyph yellow/blue colored
  12943. (yellow filter on left eye, blue filter on right eye)
  12944. @item aybd
  12945. anaglyph yellow/blue color optimized with the least squares projection of dubois
  12946. (yellow filter on left eye, blue filter on right eye)
  12947. @item ml
  12948. mono output (left eye only)
  12949. @item mr
  12950. mono output (right eye only)
  12951. @item chl
  12952. checkerboard, left eye first
  12953. @item chr
  12954. checkerboard, right eye first
  12955. @item icl
  12956. interleaved columns, left eye first
  12957. @item icr
  12958. interleaved columns, right eye first
  12959. @item hdmi
  12960. HDMI frame pack
  12961. @end table
  12962. Default value is @samp{arcd}.
  12963. @end table
  12964. @subsection Examples
  12965. @itemize
  12966. @item
  12967. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  12968. @example
  12969. stereo3d=sbsl:aybd
  12970. @end example
  12971. @item
  12972. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  12973. @example
  12974. stereo3d=abl:sbsr
  12975. @end example
  12976. @end itemize
  12977. @section streamselect, astreamselect
  12978. Select video or audio streams.
  12979. The filter accepts the following options:
  12980. @table @option
  12981. @item inputs
  12982. Set number of inputs. Default is 2.
  12983. @item map
  12984. Set input indexes to remap to outputs.
  12985. @end table
  12986. @subsection Commands
  12987. The @code{streamselect} and @code{astreamselect} filter supports the following
  12988. commands:
  12989. @table @option
  12990. @item map
  12991. Set input indexes to remap to outputs.
  12992. @end table
  12993. @subsection Examples
  12994. @itemize
  12995. @item
  12996. Select first 5 seconds 1st stream and rest of time 2nd stream:
  12997. @example
  12998. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  12999. @end example
  13000. @item
  13001. Same as above, but for audio:
  13002. @example
  13003. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  13004. @end example
  13005. @end itemize
  13006. @anchor{subtitles}
  13007. @section subtitles
  13008. Draw subtitles on top of input video using the libass library.
  13009. To enable compilation of this filter you need to configure FFmpeg with
  13010. @code{--enable-libass}. This filter also requires a build with libavcodec and
  13011. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  13012. Alpha) subtitles format.
  13013. The filter accepts the following options:
  13014. @table @option
  13015. @item filename, f
  13016. Set the filename of the subtitle file to read. It must be specified.
  13017. @item original_size
  13018. Specify the size of the original video, the video for which the ASS file
  13019. was composed. For the syntax of this option, check the
  13020. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13021. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  13022. correctly scale the fonts if the aspect ratio has been changed.
  13023. @item fontsdir
  13024. Set a directory path containing fonts that can be used by the filter.
  13025. These fonts will be used in addition to whatever the font provider uses.
  13026. @item alpha
  13027. Process alpha channel, by default alpha channel is untouched.
  13028. @item charenc
  13029. Set subtitles input character encoding. @code{subtitles} filter only. Only
  13030. useful if not UTF-8.
  13031. @item stream_index, si
  13032. Set subtitles stream index. @code{subtitles} filter only.
  13033. @item force_style
  13034. Override default style or script info parameters of the subtitles. It accepts a
  13035. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  13036. @end table
  13037. If the first key is not specified, it is assumed that the first value
  13038. specifies the @option{filename}.
  13039. For example, to render the file @file{sub.srt} on top of the input
  13040. video, use the command:
  13041. @example
  13042. subtitles=sub.srt
  13043. @end example
  13044. which is equivalent to:
  13045. @example
  13046. subtitles=filename=sub.srt
  13047. @end example
  13048. To render the default subtitles stream from file @file{video.mkv}, use:
  13049. @example
  13050. subtitles=video.mkv
  13051. @end example
  13052. To render the second subtitles stream from that file, use:
  13053. @example
  13054. subtitles=video.mkv:si=1
  13055. @end example
  13056. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  13057. @code{DejaVu Serif}, use:
  13058. @example
  13059. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  13060. @end example
  13061. @section super2xsai
  13062. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  13063. Interpolate) pixel art scaling algorithm.
  13064. Useful for enlarging pixel art images without reducing sharpness.
  13065. @section swaprect
  13066. Swap two rectangular objects in video.
  13067. This filter accepts the following options:
  13068. @table @option
  13069. @item w
  13070. Set object width.
  13071. @item h
  13072. Set object height.
  13073. @item x1
  13074. Set 1st rect x coordinate.
  13075. @item y1
  13076. Set 1st rect y coordinate.
  13077. @item x2
  13078. Set 2nd rect x coordinate.
  13079. @item y2
  13080. Set 2nd rect y coordinate.
  13081. All expressions are evaluated once for each frame.
  13082. @end table
  13083. The all options are expressions containing the following constants:
  13084. @table @option
  13085. @item w
  13086. @item h
  13087. The input width and height.
  13088. @item a
  13089. same as @var{w} / @var{h}
  13090. @item sar
  13091. input sample aspect ratio
  13092. @item dar
  13093. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  13094. @item n
  13095. The number of the input frame, starting from 0.
  13096. @item t
  13097. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  13098. @item pos
  13099. the position in the file of the input frame, NAN if unknown
  13100. @end table
  13101. @section swapuv
  13102. Swap U & V plane.
  13103. @section telecine
  13104. Apply telecine process to the video.
  13105. This filter accepts the following options:
  13106. @table @option
  13107. @item first_field
  13108. @table @samp
  13109. @item top, t
  13110. top field first
  13111. @item bottom, b
  13112. bottom field first
  13113. The default value is @code{top}.
  13114. @end table
  13115. @item pattern
  13116. A string of numbers representing the pulldown pattern you wish to apply.
  13117. The default value is @code{23}.
  13118. @end table
  13119. @example
  13120. Some typical patterns:
  13121. NTSC output (30i):
  13122. 27.5p: 32222
  13123. 24p: 23 (classic)
  13124. 24p: 2332 (preferred)
  13125. 20p: 33
  13126. 18p: 334
  13127. 16p: 3444
  13128. PAL output (25i):
  13129. 27.5p: 12222
  13130. 24p: 222222222223 ("Euro pulldown")
  13131. 16.67p: 33
  13132. 16p: 33333334
  13133. @end example
  13134. @section threshold
  13135. Apply threshold effect to video stream.
  13136. This filter needs four video streams to perform thresholding.
  13137. First stream is stream we are filtering.
  13138. Second stream is holding threshold values, third stream is holding min values,
  13139. and last, fourth stream is holding max values.
  13140. The filter accepts the following option:
  13141. @table @option
  13142. @item planes
  13143. Set which planes will be processed, unprocessed planes will be copied.
  13144. By default value 0xf, all planes will be processed.
  13145. @end table
  13146. For example if first stream pixel's component value is less then threshold value
  13147. of pixel component from 2nd threshold stream, third stream value will picked,
  13148. otherwise fourth stream pixel component value will be picked.
  13149. Using color source filter one can perform various types of thresholding:
  13150. @subsection Examples
  13151. @itemize
  13152. @item
  13153. Binary threshold, using gray color as threshold:
  13154. @example
  13155. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  13156. @end example
  13157. @item
  13158. Inverted binary threshold, using gray color as threshold:
  13159. @example
  13160. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  13161. @end example
  13162. @item
  13163. Truncate binary threshold, using gray color as threshold:
  13164. @example
  13165. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  13166. @end example
  13167. @item
  13168. Threshold to zero, using gray color as threshold:
  13169. @example
  13170. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  13171. @end example
  13172. @item
  13173. Inverted threshold to zero, using gray color as threshold:
  13174. @example
  13175. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  13176. @end example
  13177. @end itemize
  13178. @section thumbnail
  13179. Select the most representative frame in a given sequence of consecutive frames.
  13180. The filter accepts the following options:
  13181. @table @option
  13182. @item n
  13183. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  13184. will pick one of them, and then handle the next batch of @var{n} frames until
  13185. the end. Default is @code{100}.
  13186. @end table
  13187. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  13188. value will result in a higher memory usage, so a high value is not recommended.
  13189. @subsection Examples
  13190. @itemize
  13191. @item
  13192. Extract one picture each 50 frames:
  13193. @example
  13194. thumbnail=50
  13195. @end example
  13196. @item
  13197. Complete example of a thumbnail creation with @command{ffmpeg}:
  13198. @example
  13199. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  13200. @end example
  13201. @end itemize
  13202. @section tile
  13203. Tile several successive frames together.
  13204. The filter accepts the following options:
  13205. @table @option
  13206. @item layout
  13207. Set the grid size (i.e. the number of lines and columns). For the syntax of
  13208. this option, check the
  13209. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13210. @item nb_frames
  13211. Set the maximum number of frames to render in the given area. It must be less
  13212. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  13213. the area will be used.
  13214. @item margin
  13215. Set the outer border margin in pixels.
  13216. @item padding
  13217. Set the inner border thickness (i.e. the number of pixels between frames). For
  13218. more advanced padding options (such as having different values for the edges),
  13219. refer to the pad video filter.
  13220. @item color
  13221. Specify the color of the unused area. For the syntax of this option, check the
  13222. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13223. The default value of @var{color} is "black".
  13224. @item overlap
  13225. Set the number of frames to overlap when tiling several successive frames together.
  13226. The value must be between @code{0} and @var{nb_frames - 1}.
  13227. @item init_padding
  13228. Set the number of frames to initially be empty before displaying first output frame.
  13229. This controls how soon will one get first output frame.
  13230. The value must be between @code{0} and @var{nb_frames - 1}.
  13231. @end table
  13232. @subsection Examples
  13233. @itemize
  13234. @item
  13235. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  13236. @example
  13237. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  13238. @end example
  13239. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  13240. duplicating each output frame to accommodate the originally detected frame
  13241. rate.
  13242. @item
  13243. Display @code{5} pictures in an area of @code{3x2} frames,
  13244. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  13245. mixed flat and named options:
  13246. @example
  13247. tile=3x2:nb_frames=5:padding=7:margin=2
  13248. @end example
  13249. @end itemize
  13250. @section tinterlace
  13251. Perform various types of temporal field interlacing.
  13252. Frames are counted starting from 1, so the first input frame is
  13253. considered odd.
  13254. The filter accepts the following options:
  13255. @table @option
  13256. @item mode
  13257. Specify the mode of the interlacing. This option can also be specified
  13258. as a value alone. See below for a list of values for this option.
  13259. Available values are:
  13260. @table @samp
  13261. @item merge, 0
  13262. Move odd frames into the upper field, even into the lower field,
  13263. generating a double height frame at half frame rate.
  13264. @example
  13265. ------> time
  13266. Input:
  13267. Frame 1 Frame 2 Frame 3 Frame 4
  13268. 11111 22222 33333 44444
  13269. 11111 22222 33333 44444
  13270. 11111 22222 33333 44444
  13271. 11111 22222 33333 44444
  13272. Output:
  13273. 11111 33333
  13274. 22222 44444
  13275. 11111 33333
  13276. 22222 44444
  13277. 11111 33333
  13278. 22222 44444
  13279. 11111 33333
  13280. 22222 44444
  13281. @end example
  13282. @item drop_even, 1
  13283. Only output odd frames, even frames are dropped, generating a frame with
  13284. unchanged height at half frame rate.
  13285. @example
  13286. ------> time
  13287. Input:
  13288. Frame 1 Frame 2 Frame 3 Frame 4
  13289. 11111 22222 33333 44444
  13290. 11111 22222 33333 44444
  13291. 11111 22222 33333 44444
  13292. 11111 22222 33333 44444
  13293. Output:
  13294. 11111 33333
  13295. 11111 33333
  13296. 11111 33333
  13297. 11111 33333
  13298. @end example
  13299. @item drop_odd, 2
  13300. Only output even frames, odd frames are dropped, generating a frame with
  13301. unchanged height at half frame rate.
  13302. @example
  13303. ------> time
  13304. Input:
  13305. Frame 1 Frame 2 Frame 3 Frame 4
  13306. 11111 22222 33333 44444
  13307. 11111 22222 33333 44444
  13308. 11111 22222 33333 44444
  13309. 11111 22222 33333 44444
  13310. Output:
  13311. 22222 44444
  13312. 22222 44444
  13313. 22222 44444
  13314. 22222 44444
  13315. @end example
  13316. @item pad, 3
  13317. Expand each frame to full height, but pad alternate lines with black,
  13318. generating a frame with double height at the same input frame rate.
  13319. @example
  13320. ------> time
  13321. Input:
  13322. Frame 1 Frame 2 Frame 3 Frame 4
  13323. 11111 22222 33333 44444
  13324. 11111 22222 33333 44444
  13325. 11111 22222 33333 44444
  13326. 11111 22222 33333 44444
  13327. Output:
  13328. 11111 ..... 33333 .....
  13329. ..... 22222 ..... 44444
  13330. 11111 ..... 33333 .....
  13331. ..... 22222 ..... 44444
  13332. 11111 ..... 33333 .....
  13333. ..... 22222 ..... 44444
  13334. 11111 ..... 33333 .....
  13335. ..... 22222 ..... 44444
  13336. @end example
  13337. @item interleave_top, 4
  13338. Interleave the upper field from odd frames with the lower field from
  13339. even frames, generating a frame with unchanged height at half frame rate.
  13340. @example
  13341. ------> time
  13342. Input:
  13343. Frame 1 Frame 2 Frame 3 Frame 4
  13344. 11111<- 22222 33333<- 44444
  13345. 11111 22222<- 33333 44444<-
  13346. 11111<- 22222 33333<- 44444
  13347. 11111 22222<- 33333 44444<-
  13348. Output:
  13349. 11111 33333
  13350. 22222 44444
  13351. 11111 33333
  13352. 22222 44444
  13353. @end example
  13354. @item interleave_bottom, 5
  13355. Interleave the lower field from odd frames with the upper field from
  13356. even frames, generating a frame with unchanged height at half frame rate.
  13357. @example
  13358. ------> time
  13359. Input:
  13360. Frame 1 Frame 2 Frame 3 Frame 4
  13361. 11111 22222<- 33333 44444<-
  13362. 11111<- 22222 33333<- 44444
  13363. 11111 22222<- 33333 44444<-
  13364. 11111<- 22222 33333<- 44444
  13365. Output:
  13366. 22222 44444
  13367. 11111 33333
  13368. 22222 44444
  13369. 11111 33333
  13370. @end example
  13371. @item interlacex2, 6
  13372. Double frame rate with unchanged height. Frames are inserted each
  13373. containing the second temporal field from the previous input frame and
  13374. the first temporal field from the next input frame. This mode relies on
  13375. the top_field_first flag. Useful for interlaced video displays with no
  13376. field synchronisation.
  13377. @example
  13378. ------> time
  13379. Input:
  13380. Frame 1 Frame 2 Frame 3 Frame 4
  13381. 11111 22222 33333 44444
  13382. 11111 22222 33333 44444
  13383. 11111 22222 33333 44444
  13384. 11111 22222 33333 44444
  13385. Output:
  13386. 11111 22222 22222 33333 33333 44444 44444
  13387. 11111 11111 22222 22222 33333 33333 44444
  13388. 11111 22222 22222 33333 33333 44444 44444
  13389. 11111 11111 22222 22222 33333 33333 44444
  13390. @end example
  13391. @item mergex2, 7
  13392. Move odd frames into the upper field, even into the lower field,
  13393. generating a double height frame at same frame rate.
  13394. @example
  13395. ------> time
  13396. Input:
  13397. Frame 1 Frame 2 Frame 3 Frame 4
  13398. 11111 22222 33333 44444
  13399. 11111 22222 33333 44444
  13400. 11111 22222 33333 44444
  13401. 11111 22222 33333 44444
  13402. Output:
  13403. 11111 33333 33333 55555
  13404. 22222 22222 44444 44444
  13405. 11111 33333 33333 55555
  13406. 22222 22222 44444 44444
  13407. 11111 33333 33333 55555
  13408. 22222 22222 44444 44444
  13409. 11111 33333 33333 55555
  13410. 22222 22222 44444 44444
  13411. @end example
  13412. @end table
  13413. Numeric values are deprecated but are accepted for backward
  13414. compatibility reasons.
  13415. Default mode is @code{merge}.
  13416. @item flags
  13417. Specify flags influencing the filter process.
  13418. Available value for @var{flags} is:
  13419. @table @option
  13420. @item low_pass_filter, vlpf
  13421. Enable linear vertical low-pass filtering in the filter.
  13422. Vertical low-pass filtering is required when creating an interlaced
  13423. destination from a progressive source which contains high-frequency
  13424. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  13425. patterning.
  13426. @item complex_filter, cvlpf
  13427. Enable complex vertical low-pass filtering.
  13428. This will slightly less reduce interlace 'twitter' and Moire
  13429. patterning but better retain detail and subjective sharpness impression.
  13430. @end table
  13431. Vertical low-pass filtering can only be enabled for @option{mode}
  13432. @var{interleave_top} and @var{interleave_bottom}.
  13433. @end table
  13434. @section tmix
  13435. Mix successive video frames.
  13436. A description of the accepted options follows.
  13437. @table @option
  13438. @item frames
  13439. The number of successive frames to mix. If unspecified, it defaults to 3.
  13440. @item weights
  13441. Specify weight of each input video frame.
  13442. Each weight is separated by space. If number of weights is smaller than
  13443. number of @var{frames} last specified weight will be used for all remaining
  13444. unset weights.
  13445. @item scale
  13446. Specify scale, if it is set it will be multiplied with sum
  13447. of each weight multiplied with pixel values to give final destination
  13448. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13449. @end table
  13450. @subsection Examples
  13451. @itemize
  13452. @item
  13453. Average 7 successive frames:
  13454. @example
  13455. tmix=frames=7:weights="1 1 1 1 1 1 1"
  13456. @end example
  13457. @item
  13458. Apply simple temporal convolution:
  13459. @example
  13460. tmix=frames=3:weights="-1 3 -1"
  13461. @end example
  13462. @item
  13463. Similar as above but only showing temporal differences:
  13464. @example
  13465. tmix=frames=3:weights="-1 2 -1":scale=1
  13466. @end example
  13467. @end itemize
  13468. @anchor{tonemap}
  13469. @section tonemap
  13470. Tone map colors from different dynamic ranges.
  13471. This filter expects data in single precision floating point, as it needs to
  13472. operate on (and can output) out-of-range values. Another filter, such as
  13473. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  13474. The tonemapping algorithms implemented only work on linear light, so input
  13475. data should be linearized beforehand (and possibly correctly tagged).
  13476. @example
  13477. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  13478. @end example
  13479. @subsection Options
  13480. The filter accepts the following options.
  13481. @table @option
  13482. @item tonemap
  13483. Set the tone map algorithm to use.
  13484. Possible values are:
  13485. @table @var
  13486. @item none
  13487. Do not apply any tone map, only desaturate overbright pixels.
  13488. @item clip
  13489. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  13490. in-range values, while distorting out-of-range values.
  13491. @item linear
  13492. Stretch the entire reference gamut to a linear multiple of the display.
  13493. @item gamma
  13494. Fit a logarithmic transfer between the tone curves.
  13495. @item reinhard
  13496. Preserve overall image brightness with a simple curve, using nonlinear
  13497. contrast, which results in flattening details and degrading color accuracy.
  13498. @item hable
  13499. Preserve both dark and bright details better than @var{reinhard}, at the cost
  13500. of slightly darkening everything. Use it when detail preservation is more
  13501. important than color and brightness accuracy.
  13502. @item mobius
  13503. Smoothly map out-of-range values, while retaining contrast and colors for
  13504. in-range material as much as possible. Use it when color accuracy is more
  13505. important than detail preservation.
  13506. @end table
  13507. Default is none.
  13508. @item param
  13509. Tune the tone mapping algorithm.
  13510. This affects the following algorithms:
  13511. @table @var
  13512. @item none
  13513. Ignored.
  13514. @item linear
  13515. Specifies the scale factor to use while stretching.
  13516. Default to 1.0.
  13517. @item gamma
  13518. Specifies the exponent of the function.
  13519. Default to 1.8.
  13520. @item clip
  13521. Specify an extra linear coefficient to multiply into the signal before clipping.
  13522. Default to 1.0.
  13523. @item reinhard
  13524. Specify the local contrast coefficient at the display peak.
  13525. Default to 0.5, which means that in-gamut values will be about half as bright
  13526. as when clipping.
  13527. @item hable
  13528. Ignored.
  13529. @item mobius
  13530. Specify the transition point from linear to mobius transform. Every value
  13531. below this point is guaranteed to be mapped 1:1. The higher the value, the
  13532. more accurate the result will be, at the cost of losing bright details.
  13533. Default to 0.3, which due to the steep initial slope still preserves in-range
  13534. colors fairly accurately.
  13535. @end table
  13536. @item desat
  13537. Apply desaturation for highlights that exceed this level of brightness. The
  13538. higher the parameter, the more color information will be preserved. This
  13539. setting helps prevent unnaturally blown-out colors for super-highlights, by
  13540. (smoothly) turning into white instead. This makes images feel more natural,
  13541. at the cost of reducing information about out-of-range colors.
  13542. The default of 2.0 is somewhat conservative and will mostly just apply to
  13543. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  13544. This option works only if the input frame has a supported color tag.
  13545. @item peak
  13546. Override signal/nominal/reference peak with this value. Useful when the
  13547. embedded peak information in display metadata is not reliable or when tone
  13548. mapping from a lower range to a higher range.
  13549. @end table
  13550. @section tpad
  13551. Temporarily pad video frames.
  13552. The filter accepts the following options:
  13553. @table @option
  13554. @item start
  13555. Specify number of delay frames before input video stream.
  13556. @item stop
  13557. Specify number of padding frames after input video stream.
  13558. Set to -1 to pad indefinitely.
  13559. @item start_mode
  13560. Set kind of frames added to beginning of stream.
  13561. Can be either @var{add} or @var{clone}.
  13562. With @var{add} frames of solid-color are added.
  13563. With @var{clone} frames are clones of first frame.
  13564. @item stop_mode
  13565. Set kind of frames added to end of stream.
  13566. Can be either @var{add} or @var{clone}.
  13567. With @var{add} frames of solid-color are added.
  13568. With @var{clone} frames are clones of last frame.
  13569. @item start_duration, stop_duration
  13570. Specify the duration of the start/stop delay. See
  13571. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13572. for the accepted syntax.
  13573. These options override @var{start} and @var{stop}.
  13574. @item color
  13575. Specify the color of the padded area. For the syntax of this option,
  13576. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  13577. manual,ffmpeg-utils}.
  13578. The default value of @var{color} is "black".
  13579. @end table
  13580. @anchor{transpose}
  13581. @section transpose
  13582. Transpose rows with columns in the input video and optionally flip it.
  13583. It accepts the following parameters:
  13584. @table @option
  13585. @item dir
  13586. Specify the transposition direction.
  13587. Can assume the following values:
  13588. @table @samp
  13589. @item 0, 4, cclock_flip
  13590. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  13591. @example
  13592. L.R L.l
  13593. . . -> . .
  13594. l.r R.r
  13595. @end example
  13596. @item 1, 5, clock
  13597. Rotate by 90 degrees clockwise, that is:
  13598. @example
  13599. L.R l.L
  13600. . . -> . .
  13601. l.r r.R
  13602. @end example
  13603. @item 2, 6, cclock
  13604. Rotate by 90 degrees counterclockwise, that is:
  13605. @example
  13606. L.R R.r
  13607. . . -> . .
  13608. l.r L.l
  13609. @end example
  13610. @item 3, 7, clock_flip
  13611. Rotate by 90 degrees clockwise and vertically flip, that is:
  13612. @example
  13613. L.R r.R
  13614. . . -> . .
  13615. l.r l.L
  13616. @end example
  13617. @end table
  13618. For values between 4-7, the transposition is only done if the input
  13619. video geometry is portrait and not landscape. These values are
  13620. deprecated, the @code{passthrough} option should be used instead.
  13621. Numerical values are deprecated, and should be dropped in favor of
  13622. symbolic constants.
  13623. @item passthrough
  13624. Do not apply the transposition if the input geometry matches the one
  13625. specified by the specified value. It accepts the following values:
  13626. @table @samp
  13627. @item none
  13628. Always apply transposition.
  13629. @item portrait
  13630. Preserve portrait geometry (when @var{height} >= @var{width}).
  13631. @item landscape
  13632. Preserve landscape geometry (when @var{width} >= @var{height}).
  13633. @end table
  13634. Default value is @code{none}.
  13635. @end table
  13636. For example to rotate by 90 degrees clockwise and preserve portrait
  13637. layout:
  13638. @example
  13639. transpose=dir=1:passthrough=portrait
  13640. @end example
  13641. The command above can also be specified as:
  13642. @example
  13643. transpose=1:portrait
  13644. @end example
  13645. @section transpose_npp
  13646. Transpose rows with columns in the input video and optionally flip it.
  13647. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  13648. It accepts the following parameters:
  13649. @table @option
  13650. @item dir
  13651. Specify the transposition direction.
  13652. Can assume the following values:
  13653. @table @samp
  13654. @item cclock_flip
  13655. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  13656. @item clock
  13657. Rotate by 90 degrees clockwise.
  13658. @item cclock
  13659. Rotate by 90 degrees counterclockwise.
  13660. @item clock_flip
  13661. Rotate by 90 degrees clockwise and vertically flip.
  13662. @end table
  13663. @item passthrough
  13664. Do not apply the transposition if the input geometry matches the one
  13665. specified by the specified value. It accepts the following values:
  13666. @table @samp
  13667. @item none
  13668. Always apply transposition. (default)
  13669. @item portrait
  13670. Preserve portrait geometry (when @var{height} >= @var{width}).
  13671. @item landscape
  13672. Preserve landscape geometry (when @var{width} >= @var{height}).
  13673. @end table
  13674. @end table
  13675. @section trim
  13676. Trim the input so that the output contains one continuous subpart of the input.
  13677. It accepts the following parameters:
  13678. @table @option
  13679. @item start
  13680. Specify the time of the start of the kept section, i.e. the frame with the
  13681. timestamp @var{start} will be the first frame in the output.
  13682. @item end
  13683. Specify the time of the first frame that will be dropped, i.e. the frame
  13684. immediately preceding the one with the timestamp @var{end} will be the last
  13685. frame in the output.
  13686. @item start_pts
  13687. This is the same as @var{start}, except this option sets the start timestamp
  13688. in timebase units instead of seconds.
  13689. @item end_pts
  13690. This is the same as @var{end}, except this option sets the end timestamp
  13691. in timebase units instead of seconds.
  13692. @item duration
  13693. The maximum duration of the output in seconds.
  13694. @item start_frame
  13695. The number of the first frame that should be passed to the output.
  13696. @item end_frame
  13697. The number of the first frame that should be dropped.
  13698. @end table
  13699. @option{start}, @option{end}, and @option{duration} are expressed as time
  13700. duration specifications; see
  13701. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13702. for the accepted syntax.
  13703. Note that the first two sets of the start/end options and the @option{duration}
  13704. option look at the frame timestamp, while the _frame variants simply count the
  13705. frames that pass through the filter. Also note that this filter does not modify
  13706. the timestamps. If you wish for the output timestamps to start at zero, insert a
  13707. setpts filter after the trim filter.
  13708. If multiple start or end options are set, this filter tries to be greedy and
  13709. keep all the frames that match at least one of the specified constraints. To keep
  13710. only the part that matches all the constraints at once, chain multiple trim
  13711. filters.
  13712. The defaults are such that all the input is kept. So it is possible to set e.g.
  13713. just the end values to keep everything before the specified time.
  13714. Examples:
  13715. @itemize
  13716. @item
  13717. Drop everything except the second minute of input:
  13718. @example
  13719. ffmpeg -i INPUT -vf trim=60:120
  13720. @end example
  13721. @item
  13722. Keep only the first second:
  13723. @example
  13724. ffmpeg -i INPUT -vf trim=duration=1
  13725. @end example
  13726. @end itemize
  13727. @section unpremultiply
  13728. Apply alpha unpremultiply effect to input video stream using first plane
  13729. of second stream as alpha.
  13730. Both streams must have same dimensions and same pixel format.
  13731. The filter accepts the following option:
  13732. @table @option
  13733. @item planes
  13734. Set which planes will be processed, unprocessed planes will be copied.
  13735. By default value 0xf, all planes will be processed.
  13736. If the format has 1 or 2 components, then luma is bit 0.
  13737. If the format has 3 or 4 components:
  13738. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  13739. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  13740. If present, the alpha channel is always the last bit.
  13741. @item inplace
  13742. Do not require 2nd input for processing, instead use alpha plane from input stream.
  13743. @end table
  13744. @anchor{unsharp}
  13745. @section unsharp
  13746. Sharpen or blur the input video.
  13747. It accepts the following parameters:
  13748. @table @option
  13749. @item luma_msize_x, lx
  13750. Set the luma matrix horizontal size. It must be an odd integer between
  13751. 3 and 23. The default value is 5.
  13752. @item luma_msize_y, ly
  13753. Set the luma matrix vertical size. It must be an odd integer between 3
  13754. and 23. The default value is 5.
  13755. @item luma_amount, la
  13756. Set the luma effect strength. It must be a floating point number, reasonable
  13757. values lay between -1.5 and 1.5.
  13758. Negative values will blur the input video, while positive values will
  13759. sharpen it, a value of zero will disable the effect.
  13760. Default value is 1.0.
  13761. @item chroma_msize_x, cx
  13762. Set the chroma matrix horizontal size. It must be an odd integer
  13763. between 3 and 23. The default value is 5.
  13764. @item chroma_msize_y, cy
  13765. Set the chroma matrix vertical size. It must be an odd integer
  13766. between 3 and 23. The default value is 5.
  13767. @item chroma_amount, ca
  13768. Set the chroma effect strength. It must be a floating point number, reasonable
  13769. values lay between -1.5 and 1.5.
  13770. Negative values will blur the input video, while positive values will
  13771. sharpen it, a value of zero will disable the effect.
  13772. Default value is 0.0.
  13773. @end table
  13774. All parameters are optional and default to the equivalent of the
  13775. string '5:5:1.0:5:5:0.0'.
  13776. @subsection Examples
  13777. @itemize
  13778. @item
  13779. Apply strong luma sharpen effect:
  13780. @example
  13781. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  13782. @end example
  13783. @item
  13784. Apply a strong blur of both luma and chroma parameters:
  13785. @example
  13786. unsharp=7:7:-2:7:7:-2
  13787. @end example
  13788. @end itemize
  13789. @section uspp
  13790. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  13791. the image at several (or - in the case of @option{quality} level @code{8} - all)
  13792. shifts and average the results.
  13793. The way this differs from the behavior of spp is that uspp actually encodes &
  13794. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  13795. DCT similar to MJPEG.
  13796. The filter accepts the following options:
  13797. @table @option
  13798. @item quality
  13799. Set quality. This option defines the number of levels for averaging. It accepts
  13800. an integer in the range 0-8. If set to @code{0}, the filter will have no
  13801. effect. A value of @code{8} means the higher quality. For each increment of
  13802. that value the speed drops by a factor of approximately 2. Default value is
  13803. @code{3}.
  13804. @item qp
  13805. Force a constant quantization parameter. If not set, the filter will use the QP
  13806. from the video stream (if available).
  13807. @end table
  13808. @section v360
  13809. Convert 360 videos between various formats.
  13810. The filter accepts the following options:
  13811. @table @option
  13812. @item input
  13813. @item output
  13814. Set format of the input/output video.
  13815. Available formats:
  13816. @table @samp
  13817. @item e
  13818. @item equirect
  13819. Equirectangular projection.
  13820. @item c3x2
  13821. @item c6x1
  13822. @item c1x6
  13823. Cubemap with 3x2/6x1/1x6 layout.
  13824. Format specific options:
  13825. @table @option
  13826. @item in_pad
  13827. @item out_pad
  13828. Set padding proportion for the input/output cubemap. Values in decimals.
  13829. Example values:
  13830. @table @samp
  13831. @item 0
  13832. No padding.
  13833. @item 0.01
  13834. 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)
  13835. @end table
  13836. Default value is @b{@samp{0}}.
  13837. @item fin_pad
  13838. @item fout_pad
  13839. Set fixed padding for the input/output cubemap. Values in pixels.
  13840. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  13841. @item in_forder
  13842. @item out_forder
  13843. Set order of faces for the input/output cubemap. Choose one direction for each position.
  13844. Designation of directions:
  13845. @table @samp
  13846. @item r
  13847. right
  13848. @item l
  13849. left
  13850. @item u
  13851. up
  13852. @item d
  13853. down
  13854. @item f
  13855. forward
  13856. @item b
  13857. back
  13858. @end table
  13859. Default value is @b{@samp{rludfb}}.
  13860. @item in_frot
  13861. @item out_frot
  13862. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  13863. Designation of angles:
  13864. @table @samp
  13865. @item 0
  13866. 0 degrees clockwise
  13867. @item 1
  13868. 90 degrees clockwise
  13869. @item 2
  13870. 180 degrees clockwise
  13871. @item 3
  13872. 270 degrees clockwise
  13873. @end table
  13874. Default value is @b{@samp{000000}}.
  13875. @end table
  13876. @item eac
  13877. Equi-Angular Cubemap.
  13878. @item flat
  13879. @item gnomonic
  13880. @item rectilinear
  13881. Regular video. @i{(output only)}
  13882. Format specific options:
  13883. @table @option
  13884. @item h_fov
  13885. @item v_fov
  13886. @item d_fov
  13887. Set horizontal/vertical/diagonal field of view. Values in degrees.
  13888. If diagonal field of view is set it overrides horizontal and vertical field of view.
  13889. @end table
  13890. @item dfisheye
  13891. Dual fisheye.
  13892. Format specific options:
  13893. @table @option
  13894. @item in_pad
  13895. @item out_pad
  13896. Set padding proportion. Values in decimals.
  13897. Example values:
  13898. @table @samp
  13899. @item 0
  13900. No padding.
  13901. @item 0.01
  13902. 1% padding.
  13903. @end table
  13904. Default value is @b{@samp{0}}.
  13905. @end table
  13906. @item barrel
  13907. @item fb
  13908. Facebook's 360 format.
  13909. @item sg
  13910. Stereographic format.
  13911. Format specific options:
  13912. @table @option
  13913. @item h_fov
  13914. @item v_fov
  13915. @item d_fov
  13916. Set horizontal/vertical/diagonal field of view. Values in degrees.
  13917. If diagonal field of view is set it overrides horizontal and vertical field of view.
  13918. @end table
  13919. @item mercator
  13920. Mercator format.
  13921. @item ball
  13922. Ball format, gives significant distortion toward the back.
  13923. @item hammer
  13924. Hammer-Aitoff map projection format.
  13925. @item sinusoidal
  13926. Sinusoidal map projection format.
  13927. @end table
  13928. @item interp
  13929. Set interpolation method.@*
  13930. @i{Note: more complex interpolation methods require much more memory to run.}
  13931. Available methods:
  13932. @table @samp
  13933. @item near
  13934. @item nearest
  13935. Nearest neighbour.
  13936. @item line
  13937. @item linear
  13938. Bilinear interpolation.
  13939. @item cube
  13940. @item cubic
  13941. Bicubic interpolation.
  13942. @item lanc
  13943. @item lanczos
  13944. Lanczos interpolation.
  13945. @end table
  13946. Default value is @b{@samp{line}}.
  13947. @item w
  13948. @item h
  13949. Set the output video resolution.
  13950. Default resolution depends on formats.
  13951. @item in_stereo
  13952. @item out_stereo
  13953. Set the input/output stereo format.
  13954. @table @samp
  13955. @item 2d
  13956. 2D mono
  13957. @item sbs
  13958. Side by side
  13959. @item tb
  13960. Top bottom
  13961. @end table
  13962. Default value is @b{@samp{2d}} for input and output format.
  13963. @item yaw
  13964. @item pitch
  13965. @item roll
  13966. Set rotation for the output video. Values in degrees.
  13967. @item rorder
  13968. Set rotation order for the output video. Choose one item for each position.
  13969. @table @samp
  13970. @item y, Y
  13971. yaw
  13972. @item p, P
  13973. pitch
  13974. @item r, R
  13975. roll
  13976. @end table
  13977. Default value is @b{@samp{ypr}}.
  13978. @item h_flip
  13979. @item v_flip
  13980. @item d_flip
  13981. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  13982. @item ih_flip
  13983. @item iv_flip
  13984. Set if input video is flipped horizontally/vertically. Boolean values.
  13985. @item in_trans
  13986. Set if input video is transposed. Boolean value, by default disabled.
  13987. @item out_trans
  13988. Set if output video needs to be transposed. Boolean value, by default disabled.
  13989. @end table
  13990. @subsection Examples
  13991. @itemize
  13992. @item
  13993. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  13994. @example
  13995. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  13996. @end example
  13997. @item
  13998. Extract back view of Equi-Angular Cubemap:
  13999. @example
  14000. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  14001. @end example
  14002. @item
  14003. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  14004. @example
  14005. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  14006. @end example
  14007. @end itemize
  14008. @section vaguedenoiser
  14009. Apply a wavelet based denoiser.
  14010. It transforms each frame from the video input into the wavelet domain,
  14011. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  14012. the obtained coefficients. It does an inverse wavelet transform after.
  14013. Due to wavelet properties, it should give a nice smoothed result, and
  14014. reduced noise, without blurring picture features.
  14015. This filter accepts the following options:
  14016. @table @option
  14017. @item threshold
  14018. The filtering strength. The higher, the more filtered the video will be.
  14019. Hard thresholding can use a higher threshold than soft thresholding
  14020. before the video looks overfiltered. Default value is 2.
  14021. @item method
  14022. The filtering method the filter will use.
  14023. It accepts the following values:
  14024. @table @samp
  14025. @item hard
  14026. All values under the threshold will be zeroed.
  14027. @item soft
  14028. All values under the threshold will be zeroed. All values above will be
  14029. reduced by the threshold.
  14030. @item garrote
  14031. Scales or nullifies coefficients - intermediary between (more) soft and
  14032. (less) hard thresholding.
  14033. @end table
  14034. Default is garrote.
  14035. @item nsteps
  14036. Number of times, the wavelet will decompose the picture. Picture can't
  14037. be decomposed beyond a particular point (typically, 8 for a 640x480
  14038. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  14039. @item percent
  14040. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  14041. @item planes
  14042. A list of the planes to process. By default all planes are processed.
  14043. @end table
  14044. @section vectorscope
  14045. Display 2 color component values in the two dimensional graph (which is called
  14046. a vectorscope).
  14047. This filter accepts the following options:
  14048. @table @option
  14049. @item mode, m
  14050. Set vectorscope mode.
  14051. It accepts the following values:
  14052. @table @samp
  14053. @item gray
  14054. Gray values are displayed on graph, higher brightness means more pixels have
  14055. same component color value on location in graph. This is the default mode.
  14056. @item color
  14057. Gray values are displayed on graph. Surrounding pixels values which are not
  14058. present in video frame are drawn in gradient of 2 color components which are
  14059. set by option @code{x} and @code{y}. The 3rd color component is static.
  14060. @item color2
  14061. Actual color components values present in video frame are displayed on graph.
  14062. @item color3
  14063. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  14064. on graph increases value of another color component, which is luminance by
  14065. default values of @code{x} and @code{y}.
  14066. @item color4
  14067. Actual colors present in video frame are displayed on graph. If two different
  14068. colors map to same position on graph then color with higher value of component
  14069. not present in graph is picked.
  14070. @item color5
  14071. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  14072. component picked from radial gradient.
  14073. @end table
  14074. @item x
  14075. Set which color component will be represented on X-axis. Default is @code{1}.
  14076. @item y
  14077. Set which color component will be represented on Y-axis. Default is @code{2}.
  14078. @item intensity, i
  14079. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  14080. of color component which represents frequency of (X, Y) location in graph.
  14081. @item envelope, e
  14082. @table @samp
  14083. @item none
  14084. No envelope, this is default.
  14085. @item instant
  14086. Instant envelope, even darkest single pixel will be clearly highlighted.
  14087. @item peak
  14088. Hold maximum and minimum values presented in graph over time. This way you
  14089. can still spot out of range values without constantly looking at vectorscope.
  14090. @item peak+instant
  14091. Peak and instant envelope combined together.
  14092. @end table
  14093. @item graticule, g
  14094. Set what kind of graticule to draw.
  14095. @table @samp
  14096. @item none
  14097. @item green
  14098. @item color
  14099. @end table
  14100. @item opacity, o
  14101. Set graticule opacity.
  14102. @item flags, f
  14103. Set graticule flags.
  14104. @table @samp
  14105. @item white
  14106. Draw graticule for white point.
  14107. @item black
  14108. Draw graticule for black point.
  14109. @item name
  14110. Draw color points short names.
  14111. @end table
  14112. @item bgopacity, b
  14113. Set background opacity.
  14114. @item lthreshold, l
  14115. Set low threshold for color component not represented on X or Y axis.
  14116. Values lower than this value will be ignored. Default is 0.
  14117. Note this value is multiplied with actual max possible value one pixel component
  14118. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  14119. is 0.1 * 255 = 25.
  14120. @item hthreshold, h
  14121. Set high threshold for color component not represented on X or Y axis.
  14122. Values higher than this value will be ignored. Default is 1.
  14123. Note this value is multiplied with actual max possible value one pixel component
  14124. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  14125. is 0.9 * 255 = 230.
  14126. @item colorspace, c
  14127. Set what kind of colorspace to use when drawing graticule.
  14128. @table @samp
  14129. @item auto
  14130. @item 601
  14131. @item 709
  14132. @end table
  14133. Default is auto.
  14134. @end table
  14135. @anchor{vidstabdetect}
  14136. @section vidstabdetect
  14137. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  14138. @ref{vidstabtransform} for pass 2.
  14139. This filter generates a file with relative translation and rotation
  14140. transform information about subsequent frames, which is then used by
  14141. the @ref{vidstabtransform} filter.
  14142. To enable compilation of this filter you need to configure FFmpeg with
  14143. @code{--enable-libvidstab}.
  14144. This filter accepts the following options:
  14145. @table @option
  14146. @item result
  14147. Set the path to the file used to write the transforms information.
  14148. Default value is @file{transforms.trf}.
  14149. @item shakiness
  14150. Set how shaky the video is and how quick the camera is. It accepts an
  14151. integer in the range 1-10, a value of 1 means little shakiness, a
  14152. value of 10 means strong shakiness. Default value is 5.
  14153. @item accuracy
  14154. Set the accuracy of the detection process. It must be a value in the
  14155. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  14156. accuracy. Default value is 15.
  14157. @item stepsize
  14158. Set stepsize of the search process. The region around minimum is
  14159. scanned with 1 pixel resolution. Default value is 6.
  14160. @item mincontrast
  14161. Set minimum contrast. Below this value a local measurement field is
  14162. discarded. Must be a floating point value in the range 0-1. Default
  14163. value is 0.3.
  14164. @item tripod
  14165. Set reference frame number for tripod mode.
  14166. If enabled, the motion of the frames is compared to a reference frame
  14167. in the filtered stream, identified by the specified number. The idea
  14168. is to compensate all movements in a more-or-less static scene and keep
  14169. the camera view absolutely still.
  14170. If set to 0, it is disabled. The frames are counted starting from 1.
  14171. @item show
  14172. Show fields and transforms in the resulting frames. It accepts an
  14173. integer in the range 0-2. Default value is 0, which disables any
  14174. visualization.
  14175. @end table
  14176. @subsection Examples
  14177. @itemize
  14178. @item
  14179. Use default values:
  14180. @example
  14181. vidstabdetect
  14182. @end example
  14183. @item
  14184. Analyze strongly shaky movie and put the results in file
  14185. @file{mytransforms.trf}:
  14186. @example
  14187. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  14188. @end example
  14189. @item
  14190. Visualize the result of internal transformations in the resulting
  14191. video:
  14192. @example
  14193. vidstabdetect=show=1
  14194. @end example
  14195. @item
  14196. Analyze a video with medium shakiness using @command{ffmpeg}:
  14197. @example
  14198. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  14199. @end example
  14200. @end itemize
  14201. @anchor{vidstabtransform}
  14202. @section vidstabtransform
  14203. Video stabilization/deshaking: pass 2 of 2,
  14204. see @ref{vidstabdetect} for pass 1.
  14205. Read a file with transform information for each frame and
  14206. apply/compensate them. Together with the @ref{vidstabdetect}
  14207. filter this can be used to deshake videos. See also
  14208. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  14209. the @ref{unsharp} filter, see below.
  14210. To enable compilation of this filter you need to configure FFmpeg with
  14211. @code{--enable-libvidstab}.
  14212. @subsection Options
  14213. @table @option
  14214. @item input
  14215. Set path to the file used to read the transforms. Default value is
  14216. @file{transforms.trf}.
  14217. @item smoothing
  14218. Set the number of frames (value*2 + 1) used for lowpass filtering the
  14219. camera movements. Default value is 10.
  14220. For example a number of 10 means that 21 frames are used (10 in the
  14221. past and 10 in the future) to smoothen the motion in the video. A
  14222. larger value leads to a smoother video, but limits the acceleration of
  14223. the camera (pan/tilt movements). 0 is a special case where a static
  14224. camera is simulated.
  14225. @item optalgo
  14226. Set the camera path optimization algorithm.
  14227. Accepted values are:
  14228. @table @samp
  14229. @item gauss
  14230. gaussian kernel low-pass filter on camera motion (default)
  14231. @item avg
  14232. averaging on transformations
  14233. @end table
  14234. @item maxshift
  14235. Set maximal number of pixels to translate frames. Default value is -1,
  14236. meaning no limit.
  14237. @item maxangle
  14238. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  14239. value is -1, meaning no limit.
  14240. @item crop
  14241. Specify how to deal with borders that may be visible due to movement
  14242. compensation.
  14243. Available values are:
  14244. @table @samp
  14245. @item keep
  14246. keep image information from previous frame (default)
  14247. @item black
  14248. fill the border black
  14249. @end table
  14250. @item invert
  14251. Invert transforms if set to 1. Default value is 0.
  14252. @item relative
  14253. Consider transforms as relative to previous frame if set to 1,
  14254. absolute if set to 0. Default value is 0.
  14255. @item zoom
  14256. Set percentage to zoom. A positive value will result in a zoom-in
  14257. effect, a negative value in a zoom-out effect. Default value is 0 (no
  14258. zoom).
  14259. @item optzoom
  14260. Set optimal zooming to avoid borders.
  14261. Accepted values are:
  14262. @table @samp
  14263. @item 0
  14264. disabled
  14265. @item 1
  14266. optimal static zoom value is determined (only very strong movements
  14267. will lead to visible borders) (default)
  14268. @item 2
  14269. optimal adaptive zoom value is determined (no borders will be
  14270. visible), see @option{zoomspeed}
  14271. @end table
  14272. Note that the value given at zoom is added to the one calculated here.
  14273. @item zoomspeed
  14274. Set percent to zoom maximally each frame (enabled when
  14275. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  14276. 0.25.
  14277. @item interpol
  14278. Specify type of interpolation.
  14279. Available values are:
  14280. @table @samp
  14281. @item no
  14282. no interpolation
  14283. @item linear
  14284. linear only horizontal
  14285. @item bilinear
  14286. linear in both directions (default)
  14287. @item bicubic
  14288. cubic in both directions (slow)
  14289. @end table
  14290. @item tripod
  14291. Enable virtual tripod mode if set to 1, which is equivalent to
  14292. @code{relative=0:smoothing=0}. Default value is 0.
  14293. Use also @code{tripod} option of @ref{vidstabdetect}.
  14294. @item debug
  14295. Increase log verbosity if set to 1. Also the detected global motions
  14296. are written to the temporary file @file{global_motions.trf}. Default
  14297. value is 0.
  14298. @end table
  14299. @subsection Examples
  14300. @itemize
  14301. @item
  14302. Use @command{ffmpeg} for a typical stabilization with default values:
  14303. @example
  14304. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  14305. @end example
  14306. Note the use of the @ref{unsharp} filter which is always recommended.
  14307. @item
  14308. Zoom in a bit more and load transform data from a given file:
  14309. @example
  14310. vidstabtransform=zoom=5:input="mytransforms.trf"
  14311. @end example
  14312. @item
  14313. Smoothen the video even more:
  14314. @example
  14315. vidstabtransform=smoothing=30
  14316. @end example
  14317. @end itemize
  14318. @section vflip
  14319. Flip the input video vertically.
  14320. For example, to vertically flip a video with @command{ffmpeg}:
  14321. @example
  14322. ffmpeg -i in.avi -vf "vflip" out.avi
  14323. @end example
  14324. @section vfrdet
  14325. Detect variable frame rate video.
  14326. This filter tries to detect if the input is variable or constant frame rate.
  14327. At end it will output number of frames detected as having variable delta pts,
  14328. and ones with constant delta pts.
  14329. If there was frames with variable delta, than it will also show min and max delta
  14330. encountered.
  14331. @section vibrance
  14332. Boost or alter saturation.
  14333. The filter accepts the following options:
  14334. @table @option
  14335. @item intensity
  14336. Set strength of boost if positive value or strength of alter if negative value.
  14337. Default is 0. Allowed range is from -2 to 2.
  14338. @item rbal
  14339. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  14340. @item gbal
  14341. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  14342. @item bbal
  14343. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  14344. @item rlum
  14345. Set the red luma coefficient.
  14346. @item glum
  14347. Set the green luma coefficient.
  14348. @item blum
  14349. Set the blue luma coefficient.
  14350. @item alternate
  14351. If @code{intensity} is negative and this is set to 1, colors will change,
  14352. otherwise colors will be less saturated, more towards gray.
  14353. @end table
  14354. @anchor{vignette}
  14355. @section vignette
  14356. Make or reverse a natural vignetting effect.
  14357. The filter accepts the following options:
  14358. @table @option
  14359. @item angle, a
  14360. Set lens angle expression as a number of radians.
  14361. The value is clipped in the @code{[0,PI/2]} range.
  14362. Default value: @code{"PI/5"}
  14363. @item x0
  14364. @item y0
  14365. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  14366. by default.
  14367. @item mode
  14368. Set forward/backward mode.
  14369. Available modes are:
  14370. @table @samp
  14371. @item forward
  14372. The larger the distance from the central point, the darker the image becomes.
  14373. @item backward
  14374. The larger the distance from the central point, the brighter the image becomes.
  14375. This can be used to reverse a vignette effect, though there is no automatic
  14376. detection to extract the lens @option{angle} and other settings (yet). It can
  14377. also be used to create a burning effect.
  14378. @end table
  14379. Default value is @samp{forward}.
  14380. @item eval
  14381. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  14382. It accepts the following values:
  14383. @table @samp
  14384. @item init
  14385. Evaluate expressions only once during the filter initialization.
  14386. @item frame
  14387. Evaluate expressions for each incoming frame. This is way slower than the
  14388. @samp{init} mode since it requires all the scalers to be re-computed, but it
  14389. allows advanced dynamic expressions.
  14390. @end table
  14391. Default value is @samp{init}.
  14392. @item dither
  14393. Set dithering to reduce the circular banding effects. Default is @code{1}
  14394. (enabled).
  14395. @item aspect
  14396. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  14397. Setting this value to the SAR of the input will make a rectangular vignetting
  14398. following the dimensions of the video.
  14399. Default is @code{1/1}.
  14400. @end table
  14401. @subsection Expressions
  14402. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  14403. following parameters.
  14404. @table @option
  14405. @item w
  14406. @item h
  14407. input width and height
  14408. @item n
  14409. the number of input frame, starting from 0
  14410. @item pts
  14411. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  14412. @var{TB} units, NAN if undefined
  14413. @item r
  14414. frame rate of the input video, NAN if the input frame rate is unknown
  14415. @item t
  14416. the PTS (Presentation TimeStamp) of the filtered video frame,
  14417. expressed in seconds, NAN if undefined
  14418. @item tb
  14419. time base of the input video
  14420. @end table
  14421. @subsection Examples
  14422. @itemize
  14423. @item
  14424. Apply simple strong vignetting effect:
  14425. @example
  14426. vignette=PI/4
  14427. @end example
  14428. @item
  14429. Make a flickering vignetting:
  14430. @example
  14431. vignette='PI/4+random(1)*PI/50':eval=frame
  14432. @end example
  14433. @end itemize
  14434. @section vmafmotion
  14435. Obtain the average vmaf motion score of a video.
  14436. It is one of the component filters of VMAF.
  14437. The obtained average motion score is printed through the logging system.
  14438. In the below example the input file @file{ref.mpg} is being processed and score
  14439. is computed.
  14440. @example
  14441. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  14442. @end example
  14443. @section vstack
  14444. Stack input videos vertically.
  14445. All streams must be of same pixel format and of same width.
  14446. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  14447. to create same output.
  14448. The filter accepts the following options:
  14449. @table @option
  14450. @item inputs
  14451. Set number of input streams. Default is 2.
  14452. @item shortest
  14453. If set to 1, force the output to terminate when the shortest input
  14454. terminates. Default value is 0.
  14455. @end table
  14456. @section w3fdif
  14457. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  14458. Deinterlacing Filter").
  14459. Based on the process described by Martin Weston for BBC R&D, and
  14460. implemented based on the de-interlace algorithm written by Jim
  14461. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  14462. uses filter coefficients calculated by BBC R&D.
  14463. This filter uses field-dominance information in frame to decide which
  14464. of each pair of fields to place first in the output.
  14465. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  14466. There are two sets of filter coefficients, so called "simple"
  14467. and "complex". Which set of filter coefficients is used can
  14468. be set by passing an optional parameter:
  14469. @table @option
  14470. @item filter
  14471. Set the interlacing filter coefficients. Accepts one of the following values:
  14472. @table @samp
  14473. @item simple
  14474. Simple filter coefficient set.
  14475. @item complex
  14476. More-complex filter coefficient set.
  14477. @end table
  14478. Default value is @samp{complex}.
  14479. @item deint
  14480. Specify which frames to deinterlace. Accepts one of the following values:
  14481. @table @samp
  14482. @item all
  14483. Deinterlace all frames,
  14484. @item interlaced
  14485. Only deinterlace frames marked as interlaced.
  14486. @end table
  14487. Default value is @samp{all}.
  14488. @end table
  14489. @section waveform
  14490. Video waveform monitor.
  14491. The waveform monitor plots color component intensity. By default luminance
  14492. only. Each column of the waveform corresponds to a column of pixels in the
  14493. source video.
  14494. It accepts the following options:
  14495. @table @option
  14496. @item mode, m
  14497. Can be either @code{row}, or @code{column}. Default is @code{column}.
  14498. In row mode, the graph on the left side represents color component value 0 and
  14499. the right side represents value = 255. In column mode, the top side represents
  14500. color component value = 0 and bottom side represents value = 255.
  14501. @item intensity, i
  14502. Set intensity. Smaller values are useful to find out how many values of the same
  14503. luminance are distributed across input rows/columns.
  14504. Default value is @code{0.04}. Allowed range is [0, 1].
  14505. @item mirror, r
  14506. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  14507. In mirrored mode, higher values will be represented on the left
  14508. side for @code{row} mode and at the top for @code{column} mode. Default is
  14509. @code{1} (mirrored).
  14510. @item display, d
  14511. Set display mode.
  14512. It accepts the following values:
  14513. @table @samp
  14514. @item overlay
  14515. Presents information identical to that in the @code{parade}, except
  14516. that the graphs representing color components are superimposed directly
  14517. over one another.
  14518. This display mode makes it easier to spot relative differences or similarities
  14519. in overlapping areas of the color components that are supposed to be identical,
  14520. such as neutral whites, grays, or blacks.
  14521. @item stack
  14522. Display separate graph for the color components side by side in
  14523. @code{row} mode or one below the other in @code{column} mode.
  14524. @item parade
  14525. Display separate graph for the color components side by side in
  14526. @code{column} mode or one below the other in @code{row} mode.
  14527. Using this display mode makes it easy to spot color casts in the highlights
  14528. and shadows of an image, by comparing the contours of the top and the bottom
  14529. graphs of each waveform. Since whites, grays, and blacks are characterized
  14530. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  14531. should display three waveforms of roughly equal width/height. If not, the
  14532. correction is easy to perform by making level adjustments the three waveforms.
  14533. @end table
  14534. Default is @code{stack}.
  14535. @item components, c
  14536. Set which color components to display. Default is 1, which means only luminance
  14537. or red color component if input is in RGB colorspace. If is set for example to
  14538. 7 it will display all 3 (if) available color components.
  14539. @item envelope, e
  14540. @table @samp
  14541. @item none
  14542. No envelope, this is default.
  14543. @item instant
  14544. Instant envelope, minimum and maximum values presented in graph will be easily
  14545. visible even with small @code{step} value.
  14546. @item peak
  14547. Hold minimum and maximum values presented in graph across time. This way you
  14548. can still spot out of range values without constantly looking at waveforms.
  14549. @item peak+instant
  14550. Peak and instant envelope combined together.
  14551. @end table
  14552. @item filter, f
  14553. @table @samp
  14554. @item lowpass
  14555. No filtering, this is default.
  14556. @item flat
  14557. Luma and chroma combined together.
  14558. @item aflat
  14559. Similar as above, but shows difference between blue and red chroma.
  14560. @item xflat
  14561. Similar as above, but use different colors.
  14562. @item yflat
  14563. Similar as above, but again with different colors.
  14564. @item chroma
  14565. Displays only chroma.
  14566. @item color
  14567. Displays actual color value on waveform.
  14568. @item acolor
  14569. Similar as above, but with luma showing frequency of chroma values.
  14570. @end table
  14571. @item graticule, g
  14572. Set which graticule to display.
  14573. @table @samp
  14574. @item none
  14575. Do not display graticule.
  14576. @item green
  14577. Display green graticule showing legal broadcast ranges.
  14578. @item orange
  14579. Display orange graticule showing legal broadcast ranges.
  14580. @item invert
  14581. Display invert graticule showing legal broadcast ranges.
  14582. @end table
  14583. @item opacity, o
  14584. Set graticule opacity.
  14585. @item flags, fl
  14586. Set graticule flags.
  14587. @table @samp
  14588. @item numbers
  14589. Draw numbers above lines. By default enabled.
  14590. @item dots
  14591. Draw dots instead of lines.
  14592. @end table
  14593. @item scale, s
  14594. Set scale used for displaying graticule.
  14595. @table @samp
  14596. @item digital
  14597. @item millivolts
  14598. @item ire
  14599. @end table
  14600. Default is digital.
  14601. @item bgopacity, b
  14602. Set background opacity.
  14603. @end table
  14604. @section weave, doubleweave
  14605. The @code{weave} takes a field-based video input and join
  14606. each two sequential fields into single frame, producing a new double
  14607. height clip with half the frame rate and half the frame count.
  14608. The @code{doubleweave} works same as @code{weave} but without
  14609. halving frame rate and frame count.
  14610. It accepts the following option:
  14611. @table @option
  14612. @item first_field
  14613. Set first field. Available values are:
  14614. @table @samp
  14615. @item top, t
  14616. Set the frame as top-field-first.
  14617. @item bottom, b
  14618. Set the frame as bottom-field-first.
  14619. @end table
  14620. @end table
  14621. @subsection Examples
  14622. @itemize
  14623. @item
  14624. Interlace video using @ref{select} and @ref{separatefields} filter:
  14625. @example
  14626. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  14627. @end example
  14628. @end itemize
  14629. @section xbr
  14630. Apply the xBR high-quality magnification filter which is designed for pixel
  14631. art. It follows a set of edge-detection rules, see
  14632. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  14633. It accepts the following option:
  14634. @table @option
  14635. @item n
  14636. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  14637. @code{3xBR} and @code{4} for @code{4xBR}.
  14638. Default is @code{3}.
  14639. @end table
  14640. @section xmedian
  14641. Pick median pixels from several input videos.
  14642. The filter accepts the following options:
  14643. @table @option
  14644. @item inputs
  14645. Set number of inputs.
  14646. Default is 3. Allowed range is from 3 to 255.
  14647. If number of inputs is even number, than result will be mean value between two median values.
  14648. @item planes
  14649. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14650. @end table
  14651. @section xstack
  14652. Stack video inputs into custom layout.
  14653. All streams must be of same pixel format.
  14654. The filter accepts the following options:
  14655. @table @option
  14656. @item inputs
  14657. Set number of input streams. Default is 2.
  14658. @item layout
  14659. Specify layout of inputs.
  14660. This option requires the desired layout configuration to be explicitly set by the user.
  14661. This sets position of each video input in output. Each input
  14662. is separated by '|'.
  14663. The first number represents the column, and the second number represents the row.
  14664. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  14665. where X is video input from which to take width or height.
  14666. Multiple values can be used when separated by '+'. In such
  14667. case values are summed together.
  14668. Note that if inputs are of different sizes gaps may appear, as not all of
  14669. the output video frame will be filled. Similarly, videos can overlap each
  14670. other if their position doesn't leave enough space for the full frame of
  14671. adjoining videos.
  14672. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  14673. a layout must be set by the user.
  14674. @item shortest
  14675. If set to 1, force the output to terminate when the shortest input
  14676. terminates. Default value is 0.
  14677. @end table
  14678. @subsection Examples
  14679. @itemize
  14680. @item
  14681. Display 4 inputs into 2x2 grid.
  14682. Layout:
  14683. @example
  14684. input1(0, 0) | input3(w0, 0)
  14685. input2(0, h0) | input4(w0, h0)
  14686. @end example
  14687. @example
  14688. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  14689. @end example
  14690. Note that if inputs are of different sizes, gaps or overlaps may occur.
  14691. @item
  14692. Display 4 inputs into 1x4 grid.
  14693. Layout:
  14694. @example
  14695. input1(0, 0)
  14696. input2(0, h0)
  14697. input3(0, h0+h1)
  14698. input4(0, h0+h1+h2)
  14699. @end example
  14700. @example
  14701. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  14702. @end example
  14703. Note that if inputs are of different widths, unused space will appear.
  14704. @item
  14705. Display 9 inputs into 3x3 grid.
  14706. Layout:
  14707. @example
  14708. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  14709. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  14710. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  14711. @end example
  14712. @example
  14713. 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
  14714. @end example
  14715. Note that if inputs are of different sizes, gaps or overlaps may occur.
  14716. @item
  14717. Display 16 inputs into 4x4 grid.
  14718. Layout:
  14719. @example
  14720. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  14721. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  14722. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  14723. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  14724. @end example
  14725. @example
  14726. 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|
  14727. 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
  14728. @end example
  14729. Note that if inputs are of different sizes, gaps or overlaps may occur.
  14730. @end itemize
  14731. @anchor{yadif}
  14732. @section yadif
  14733. Deinterlace the input video ("yadif" means "yet another deinterlacing
  14734. filter").
  14735. It accepts the following parameters:
  14736. @table @option
  14737. @item mode
  14738. The interlacing mode to adopt. It accepts one of the following values:
  14739. @table @option
  14740. @item 0, send_frame
  14741. Output one frame for each frame.
  14742. @item 1, send_field
  14743. Output one frame for each field.
  14744. @item 2, send_frame_nospatial
  14745. Like @code{send_frame}, but it skips the spatial interlacing check.
  14746. @item 3, send_field_nospatial
  14747. Like @code{send_field}, but it skips the spatial interlacing check.
  14748. @end table
  14749. The default value is @code{send_frame}.
  14750. @item parity
  14751. The picture field parity assumed for the input interlaced video. It accepts one
  14752. of the following values:
  14753. @table @option
  14754. @item 0, tff
  14755. Assume the top field is first.
  14756. @item 1, bff
  14757. Assume the bottom field is first.
  14758. @item -1, auto
  14759. Enable automatic detection of field parity.
  14760. @end table
  14761. The default value is @code{auto}.
  14762. If the interlacing is unknown or the decoder does not export this information,
  14763. top field first will be assumed.
  14764. @item deint
  14765. Specify which frames to deinterlace. Accepts one of the following
  14766. values:
  14767. @table @option
  14768. @item 0, all
  14769. Deinterlace all frames.
  14770. @item 1, interlaced
  14771. Only deinterlace frames marked as interlaced.
  14772. @end table
  14773. The default value is @code{all}.
  14774. @end table
  14775. @section yadif_cuda
  14776. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  14777. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  14778. and/or nvenc.
  14779. It accepts the following parameters:
  14780. @table @option
  14781. @item mode
  14782. The interlacing mode to adopt. It accepts one of the following values:
  14783. @table @option
  14784. @item 0, send_frame
  14785. Output one frame for each frame.
  14786. @item 1, send_field
  14787. Output one frame for each field.
  14788. @item 2, send_frame_nospatial
  14789. Like @code{send_frame}, but it skips the spatial interlacing check.
  14790. @item 3, send_field_nospatial
  14791. Like @code{send_field}, but it skips the spatial interlacing check.
  14792. @end table
  14793. The default value is @code{send_frame}.
  14794. @item parity
  14795. The picture field parity assumed for the input interlaced video. It accepts one
  14796. of the following values:
  14797. @table @option
  14798. @item 0, tff
  14799. Assume the top field is first.
  14800. @item 1, bff
  14801. Assume the bottom field is first.
  14802. @item -1, auto
  14803. Enable automatic detection of field parity.
  14804. @end table
  14805. The default value is @code{auto}.
  14806. If the interlacing is unknown or the decoder does not export this information,
  14807. top field first will be assumed.
  14808. @item deint
  14809. Specify which frames to deinterlace. Accepts one of the following
  14810. values:
  14811. @table @option
  14812. @item 0, all
  14813. Deinterlace all frames.
  14814. @item 1, interlaced
  14815. Only deinterlace frames marked as interlaced.
  14816. @end table
  14817. The default value is @code{all}.
  14818. @end table
  14819. @section zoompan
  14820. Apply Zoom & Pan effect.
  14821. This filter accepts the following options:
  14822. @table @option
  14823. @item zoom, z
  14824. Set the zoom expression. Range is 1-10. Default is 1.
  14825. @item x
  14826. @item y
  14827. Set the x and y expression. Default is 0.
  14828. @item d
  14829. Set the duration expression in number of frames.
  14830. This sets for how many number of frames effect will last for
  14831. single input image.
  14832. @item s
  14833. Set the output image size, default is 'hd720'.
  14834. @item fps
  14835. Set the output frame rate, default is '25'.
  14836. @end table
  14837. Each expression can contain the following constants:
  14838. @table @option
  14839. @item in_w, iw
  14840. Input width.
  14841. @item in_h, ih
  14842. Input height.
  14843. @item out_w, ow
  14844. Output width.
  14845. @item out_h, oh
  14846. Output height.
  14847. @item in
  14848. Input frame count.
  14849. @item on
  14850. Output frame count.
  14851. @item x
  14852. @item y
  14853. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  14854. for current input frame.
  14855. @item px
  14856. @item py
  14857. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  14858. not yet such frame (first input frame).
  14859. @item zoom
  14860. Last calculated zoom from 'z' expression for current input frame.
  14861. @item pzoom
  14862. Last calculated zoom of last output frame of previous input frame.
  14863. @item duration
  14864. Number of output frames for current input frame. Calculated from 'd' expression
  14865. for each input frame.
  14866. @item pduration
  14867. number of output frames created for previous input frame
  14868. @item a
  14869. Rational number: input width / input height
  14870. @item sar
  14871. sample aspect ratio
  14872. @item dar
  14873. display aspect ratio
  14874. @end table
  14875. @subsection Examples
  14876. @itemize
  14877. @item
  14878. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  14879. @example
  14880. 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
  14881. @end example
  14882. @item
  14883. Zoom-in up to 1.5 and pan always at center of picture:
  14884. @example
  14885. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14886. @end example
  14887. @item
  14888. Same as above but without pausing:
  14889. @example
  14890. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14891. @end example
  14892. @end itemize
  14893. @anchor{zscale}
  14894. @section zscale
  14895. Scale (resize) the input video, using the z.lib library:
  14896. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  14897. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  14898. The zscale filter forces the output display aspect ratio to be the same
  14899. as the input, by changing the output sample aspect ratio.
  14900. If the input image format is different from the format requested by
  14901. the next filter, the zscale filter will convert the input to the
  14902. requested format.
  14903. @subsection Options
  14904. The filter accepts the following options.
  14905. @table @option
  14906. @item width, w
  14907. @item height, h
  14908. Set the output video dimension expression. Default value is the input
  14909. dimension.
  14910. If the @var{width} or @var{w} value is 0, the input width is used for
  14911. the output. If the @var{height} or @var{h} value is 0, the input height
  14912. is used for the output.
  14913. If one and only one of the values is -n with n >= 1, the zscale filter
  14914. will use a value that maintains the aspect ratio of the input image,
  14915. calculated from the other specified dimension. After that it will,
  14916. however, make sure that the calculated dimension is divisible by n and
  14917. adjust the value if necessary.
  14918. If both values are -n with n >= 1, the behavior will be identical to
  14919. both values being set to 0 as previously detailed.
  14920. See below for the list of accepted constants for use in the dimension
  14921. expression.
  14922. @item size, s
  14923. Set the video size. For the syntax of this option, check the
  14924. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14925. @item dither, d
  14926. Set the dither type.
  14927. Possible values are:
  14928. @table @var
  14929. @item none
  14930. @item ordered
  14931. @item random
  14932. @item error_diffusion
  14933. @end table
  14934. Default is none.
  14935. @item filter, f
  14936. Set the resize filter type.
  14937. Possible values are:
  14938. @table @var
  14939. @item point
  14940. @item bilinear
  14941. @item bicubic
  14942. @item spline16
  14943. @item spline36
  14944. @item lanczos
  14945. @end table
  14946. Default is bilinear.
  14947. @item range, r
  14948. Set the color range.
  14949. Possible values are:
  14950. @table @var
  14951. @item input
  14952. @item limited
  14953. @item full
  14954. @end table
  14955. Default is same as input.
  14956. @item primaries, p
  14957. Set the color primaries.
  14958. Possible values are:
  14959. @table @var
  14960. @item input
  14961. @item 709
  14962. @item unspecified
  14963. @item 170m
  14964. @item 240m
  14965. @item 2020
  14966. @end table
  14967. Default is same as input.
  14968. @item transfer, t
  14969. Set the transfer characteristics.
  14970. Possible values are:
  14971. @table @var
  14972. @item input
  14973. @item 709
  14974. @item unspecified
  14975. @item 601
  14976. @item linear
  14977. @item 2020_10
  14978. @item 2020_12
  14979. @item smpte2084
  14980. @item iec61966-2-1
  14981. @item arib-std-b67
  14982. @end table
  14983. Default is same as input.
  14984. @item matrix, m
  14985. Set the colorspace matrix.
  14986. Possible value are:
  14987. @table @var
  14988. @item input
  14989. @item 709
  14990. @item unspecified
  14991. @item 470bg
  14992. @item 170m
  14993. @item 2020_ncl
  14994. @item 2020_cl
  14995. @end table
  14996. Default is same as input.
  14997. @item rangein, rin
  14998. Set the input color range.
  14999. Possible values are:
  15000. @table @var
  15001. @item input
  15002. @item limited
  15003. @item full
  15004. @end table
  15005. Default is same as input.
  15006. @item primariesin, pin
  15007. Set the input color primaries.
  15008. Possible values are:
  15009. @table @var
  15010. @item input
  15011. @item 709
  15012. @item unspecified
  15013. @item 170m
  15014. @item 240m
  15015. @item 2020
  15016. @end table
  15017. Default is same as input.
  15018. @item transferin, tin
  15019. Set the input transfer characteristics.
  15020. Possible values are:
  15021. @table @var
  15022. @item input
  15023. @item 709
  15024. @item unspecified
  15025. @item 601
  15026. @item linear
  15027. @item 2020_10
  15028. @item 2020_12
  15029. @end table
  15030. Default is same as input.
  15031. @item matrixin, min
  15032. Set the input colorspace matrix.
  15033. Possible value are:
  15034. @table @var
  15035. @item input
  15036. @item 709
  15037. @item unspecified
  15038. @item 470bg
  15039. @item 170m
  15040. @item 2020_ncl
  15041. @item 2020_cl
  15042. @end table
  15043. @item chromal, c
  15044. Set the output chroma location.
  15045. Possible values are:
  15046. @table @var
  15047. @item input
  15048. @item left
  15049. @item center
  15050. @item topleft
  15051. @item top
  15052. @item bottomleft
  15053. @item bottom
  15054. @end table
  15055. @item chromalin, cin
  15056. Set the input chroma location.
  15057. Possible values are:
  15058. @table @var
  15059. @item input
  15060. @item left
  15061. @item center
  15062. @item topleft
  15063. @item top
  15064. @item bottomleft
  15065. @item bottom
  15066. @end table
  15067. @item npl
  15068. Set the nominal peak luminance.
  15069. @end table
  15070. The values of the @option{w} and @option{h} options are expressions
  15071. containing the following constants:
  15072. @table @var
  15073. @item in_w
  15074. @item in_h
  15075. The input width and height
  15076. @item iw
  15077. @item ih
  15078. These are the same as @var{in_w} and @var{in_h}.
  15079. @item out_w
  15080. @item out_h
  15081. The output (scaled) width and height
  15082. @item ow
  15083. @item oh
  15084. These are the same as @var{out_w} and @var{out_h}
  15085. @item a
  15086. The same as @var{iw} / @var{ih}
  15087. @item sar
  15088. input sample aspect ratio
  15089. @item dar
  15090. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  15091. @item hsub
  15092. @item vsub
  15093. horizontal and vertical input chroma subsample values. For example for the
  15094. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15095. @item ohsub
  15096. @item ovsub
  15097. horizontal and vertical output chroma subsample values. For example for the
  15098. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15099. @end table
  15100. @table @option
  15101. @end table
  15102. @c man end VIDEO FILTERS
  15103. @chapter OpenCL Video Filters
  15104. @c man begin OPENCL VIDEO FILTERS
  15105. Below is a description of the currently available OpenCL video filters.
  15106. To enable compilation of these filters you need to configure FFmpeg with
  15107. @code{--enable-opencl}.
  15108. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  15109. @table @option
  15110. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  15111. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  15112. given device parameters.
  15113. @item -filter_hw_device @var{name}
  15114. Pass the hardware device called @var{name} to all filters in any filter graph.
  15115. @end table
  15116. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  15117. @itemize
  15118. @item
  15119. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  15120. @example
  15121. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  15122. @end example
  15123. @end itemize
  15124. 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.
  15125. @section avgblur_opencl
  15126. Apply average blur filter.
  15127. The filter accepts the following options:
  15128. @table @option
  15129. @item sizeX
  15130. Set horizontal radius size.
  15131. Range is @code{[1, 1024]} and default value is @code{1}.
  15132. @item planes
  15133. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15134. @item sizeY
  15135. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  15136. @end table
  15137. @subsection Example
  15138. @itemize
  15139. @item
  15140. 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.
  15141. @example
  15142. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  15143. @end example
  15144. @end itemize
  15145. @section boxblur_opencl
  15146. Apply a boxblur algorithm to the input video.
  15147. It accepts the following parameters:
  15148. @table @option
  15149. @item luma_radius, lr
  15150. @item luma_power, lp
  15151. @item chroma_radius, cr
  15152. @item chroma_power, cp
  15153. @item alpha_radius, ar
  15154. @item alpha_power, ap
  15155. @end table
  15156. A description of the accepted options follows.
  15157. @table @option
  15158. @item luma_radius, lr
  15159. @item chroma_radius, cr
  15160. @item alpha_radius, ar
  15161. Set an expression for the box radius in pixels used for blurring the
  15162. corresponding input plane.
  15163. The radius value must be a non-negative number, and must not be
  15164. greater than the value of the expression @code{min(w,h)/2} for the
  15165. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  15166. planes.
  15167. Default value for @option{luma_radius} is "2". If not specified,
  15168. @option{chroma_radius} and @option{alpha_radius} default to the
  15169. corresponding value set for @option{luma_radius}.
  15170. The expressions can contain the following constants:
  15171. @table @option
  15172. @item w
  15173. @item h
  15174. The input width and height in pixels.
  15175. @item cw
  15176. @item ch
  15177. The input chroma image width and height in pixels.
  15178. @item hsub
  15179. @item vsub
  15180. The horizontal and vertical chroma subsample values. For example, for the
  15181. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  15182. @end table
  15183. @item luma_power, lp
  15184. @item chroma_power, cp
  15185. @item alpha_power, ap
  15186. Specify how many times the boxblur filter is applied to the
  15187. corresponding plane.
  15188. Default value for @option{luma_power} is 2. If not specified,
  15189. @option{chroma_power} and @option{alpha_power} default to the
  15190. corresponding value set for @option{luma_power}.
  15191. A value of 0 will disable the effect.
  15192. @end table
  15193. @subsection Examples
  15194. 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.
  15195. @itemize
  15196. @item
  15197. Apply a boxblur filter with the luma, chroma, and alpha radius
  15198. 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.
  15199. @example
  15200. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  15201. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  15202. @end example
  15203. @item
  15204. 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.
  15205. For the luma plane, a 2x2 box radius will be run once.
  15206. For the chroma plane, a 4x4 box radius will be run 5 times.
  15207. For the alpha plane, a 3x3 box radius will be run 7 times.
  15208. @example
  15209. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  15210. @end example
  15211. @end itemize
  15212. @section convolution_opencl
  15213. Apply convolution of 3x3, 5x5, 7x7 matrix.
  15214. The filter accepts the following options:
  15215. @table @option
  15216. @item 0m
  15217. @item 1m
  15218. @item 2m
  15219. @item 3m
  15220. Set matrix for each plane.
  15221. Matrix is sequence of 9, 25 or 49 signed numbers.
  15222. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  15223. @item 0rdiv
  15224. @item 1rdiv
  15225. @item 2rdiv
  15226. @item 3rdiv
  15227. Set multiplier for calculated value for each plane.
  15228. If unset or 0, it will be sum of all matrix elements.
  15229. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  15230. @item 0bias
  15231. @item 1bias
  15232. @item 2bias
  15233. @item 3bias
  15234. Set bias for each plane. This value is added to the result of the multiplication.
  15235. Useful for making the overall image brighter or darker.
  15236. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  15237. @end table
  15238. @subsection Examples
  15239. @itemize
  15240. @item
  15241. Apply sharpen:
  15242. @example
  15243. -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
  15244. @end example
  15245. @item
  15246. Apply blur:
  15247. @example
  15248. -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
  15249. @end example
  15250. @item
  15251. Apply edge enhance:
  15252. @example
  15253. -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
  15254. @end example
  15255. @item
  15256. Apply edge detect:
  15257. @example
  15258. -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
  15259. @end example
  15260. @item
  15261. Apply laplacian edge detector which includes diagonals:
  15262. @example
  15263. -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
  15264. @end example
  15265. @item
  15266. Apply emboss:
  15267. @example
  15268. -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
  15269. @end example
  15270. @end itemize
  15271. @section dilation_opencl
  15272. Apply dilation effect to the video.
  15273. This filter replaces the pixel by the local(3x3) maximum.
  15274. It accepts the following options:
  15275. @table @option
  15276. @item threshold0
  15277. @item threshold1
  15278. @item threshold2
  15279. @item threshold3
  15280. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  15281. If @code{0}, plane will remain unchanged.
  15282. @item coordinates
  15283. Flag which specifies the pixel to refer to.
  15284. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  15285. Flags to local 3x3 coordinates region centered on @code{x}:
  15286. 1 2 3
  15287. 4 x 5
  15288. 6 7 8
  15289. @end table
  15290. @subsection Example
  15291. @itemize
  15292. @item
  15293. 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.
  15294. @example
  15295. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  15296. @end example
  15297. @end itemize
  15298. @section erosion_opencl
  15299. Apply erosion effect to the video.
  15300. This filter replaces the pixel by the local(3x3) minimum.
  15301. It accepts the following options:
  15302. @table @option
  15303. @item threshold0
  15304. @item threshold1
  15305. @item threshold2
  15306. @item threshold3
  15307. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  15308. If @code{0}, plane will remain unchanged.
  15309. @item coordinates
  15310. Flag which specifies the pixel to refer to.
  15311. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  15312. Flags to local 3x3 coordinates region centered on @code{x}:
  15313. 1 2 3
  15314. 4 x 5
  15315. 6 7 8
  15316. @end table
  15317. @subsection Example
  15318. @itemize
  15319. @item
  15320. 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.
  15321. @example
  15322. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  15323. @end example
  15324. @end itemize
  15325. @section colorkey_opencl
  15326. RGB colorspace color keying.
  15327. The filter accepts the following options:
  15328. @table @option
  15329. @item color
  15330. The color which will be replaced with transparency.
  15331. @item similarity
  15332. Similarity percentage with the key color.
  15333. 0.01 matches only the exact key color, while 1.0 matches everything.
  15334. @item blend
  15335. Blend percentage.
  15336. 0.0 makes pixels either fully transparent, or not transparent at all.
  15337. Higher values result in semi-transparent pixels, with a higher transparency
  15338. the more similar the pixels color is to the key color.
  15339. @end table
  15340. @subsection Examples
  15341. @itemize
  15342. @item
  15343. Make every semi-green pixel in the input transparent with some slight blending:
  15344. @example
  15345. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  15346. @end example
  15347. @end itemize
  15348. @section deshake_opencl
  15349. Feature-point based video stabilization filter.
  15350. The filter accepts the following options:
  15351. @table @option
  15352. @item tripod
  15353. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  15354. @item debug
  15355. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  15356. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  15357. Viewing point matches in the output video is only supported for RGB input.
  15358. Defaults to @code{0}.
  15359. @item adaptive_crop
  15360. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  15361. Defaults to @code{1}.
  15362. @item refine_features
  15363. Whether or not feature points should be refined at a sub-pixel level.
  15364. This can be turned off for a slight performance gain at the cost of precision.
  15365. Defaults to @code{1}.
  15366. @item smooth_strength
  15367. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  15368. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  15369. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  15370. Defaults to @code{0.0}.
  15371. @item smooth_window_multiplier
  15372. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  15373. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  15374. Acceptable values range from @code{0.1} to @code{10.0}.
  15375. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  15376. potentially improving smoothness, but also increase latency and memory usage.
  15377. Defaults to @code{2.0}.
  15378. @end table
  15379. @subsection Examples
  15380. @itemize
  15381. @item
  15382. Stabilize a video with a fixed, medium smoothing strength:
  15383. @example
  15384. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  15385. @end example
  15386. @item
  15387. Stabilize a video with debugging (both in console and in rendered video):
  15388. @example
  15389. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  15390. @end example
  15391. @end itemize
  15392. @section nlmeans_opencl
  15393. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  15394. @section overlay_opencl
  15395. Overlay one video on top of another.
  15396. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  15397. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  15398. The filter accepts the following options:
  15399. @table @option
  15400. @item x
  15401. Set the x coordinate of the overlaid video on the main video.
  15402. Default value is @code{0}.
  15403. @item y
  15404. Set the x coordinate of the overlaid video on the main video.
  15405. Default value is @code{0}.
  15406. @end table
  15407. @subsection Examples
  15408. @itemize
  15409. @item
  15410. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  15411. @example
  15412. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  15413. @end example
  15414. @item
  15415. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  15416. @example
  15417. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  15418. @end example
  15419. @end itemize
  15420. @section prewitt_opencl
  15421. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  15422. The filter accepts the following option:
  15423. @table @option
  15424. @item planes
  15425. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15426. @item scale
  15427. Set value which will be multiplied with filtered result.
  15428. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15429. @item delta
  15430. Set value which will be added to filtered result.
  15431. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15432. @end table
  15433. @subsection Example
  15434. @itemize
  15435. @item
  15436. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  15437. @example
  15438. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15439. @end example
  15440. @end itemize
  15441. @section roberts_opencl
  15442. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  15443. The filter accepts the following option:
  15444. @table @option
  15445. @item planes
  15446. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15447. @item scale
  15448. Set value which will be multiplied with filtered result.
  15449. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15450. @item delta
  15451. Set value which will be added to filtered result.
  15452. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15453. @end table
  15454. @subsection Example
  15455. @itemize
  15456. @item
  15457. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  15458. @example
  15459. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15460. @end example
  15461. @end itemize
  15462. @section sobel_opencl
  15463. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  15464. The filter accepts the following option:
  15465. @table @option
  15466. @item planes
  15467. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15468. @item scale
  15469. Set value which will be multiplied with filtered result.
  15470. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15471. @item delta
  15472. Set value which will be added to filtered result.
  15473. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15474. @end table
  15475. @subsection Example
  15476. @itemize
  15477. @item
  15478. Apply sobel operator with scale set to 2 and delta set to 10
  15479. @example
  15480. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15481. @end example
  15482. @end itemize
  15483. @section tonemap_opencl
  15484. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  15485. It accepts the following parameters:
  15486. @table @option
  15487. @item tonemap
  15488. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  15489. @item param
  15490. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  15491. @item desat
  15492. Apply desaturation for highlights that exceed this level of brightness. The
  15493. higher the parameter, the more color information will be preserved. This
  15494. setting helps prevent unnaturally blown-out colors for super-highlights, by
  15495. (smoothly) turning into white instead. This makes images feel more natural,
  15496. at the cost of reducing information about out-of-range colors.
  15497. The default value is 0.5, and the algorithm here is a little different from
  15498. the cpu version tonemap currently. A setting of 0.0 disables this option.
  15499. @item threshold
  15500. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  15501. is used to detect whether the scene has changed or not. If the distance between
  15502. the current frame average brightness and the current running average exceeds
  15503. a threshold value, we would re-calculate scene average and peak brightness.
  15504. The default value is 0.2.
  15505. @item format
  15506. Specify the output pixel format.
  15507. Currently supported formats are:
  15508. @table @var
  15509. @item p010
  15510. @item nv12
  15511. @end table
  15512. @item range, r
  15513. Set the output color range.
  15514. Possible values are:
  15515. @table @var
  15516. @item tv/mpeg
  15517. @item pc/jpeg
  15518. @end table
  15519. Default is same as input.
  15520. @item primaries, p
  15521. Set the output color primaries.
  15522. Possible values are:
  15523. @table @var
  15524. @item bt709
  15525. @item bt2020
  15526. @end table
  15527. Default is same as input.
  15528. @item transfer, t
  15529. Set the output transfer characteristics.
  15530. Possible values are:
  15531. @table @var
  15532. @item bt709
  15533. @item bt2020
  15534. @end table
  15535. Default is bt709.
  15536. @item matrix, m
  15537. Set the output colorspace matrix.
  15538. Possible value are:
  15539. @table @var
  15540. @item bt709
  15541. @item bt2020
  15542. @end table
  15543. Default is same as input.
  15544. @end table
  15545. @subsection Example
  15546. @itemize
  15547. @item
  15548. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  15549. @example
  15550. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  15551. @end example
  15552. @end itemize
  15553. @section unsharp_opencl
  15554. Sharpen or blur the input video.
  15555. It accepts the following parameters:
  15556. @table @option
  15557. @item luma_msize_x, lx
  15558. Set the luma matrix horizontal size.
  15559. Range is @code{[1, 23]} and default value is @code{5}.
  15560. @item luma_msize_y, ly
  15561. Set the luma matrix vertical size.
  15562. Range is @code{[1, 23]} and default value is @code{5}.
  15563. @item luma_amount, la
  15564. Set the luma effect strength.
  15565. Range is @code{[-10, 10]} and default value is @code{1.0}.
  15566. Negative values will blur the input video, while positive values will
  15567. sharpen it, a value of zero will disable the effect.
  15568. @item chroma_msize_x, cx
  15569. Set the chroma matrix horizontal size.
  15570. Range is @code{[1, 23]} and default value is @code{5}.
  15571. @item chroma_msize_y, cy
  15572. Set the chroma matrix vertical size.
  15573. Range is @code{[1, 23]} and default value is @code{5}.
  15574. @item chroma_amount, ca
  15575. Set the chroma effect strength.
  15576. Range is @code{[-10, 10]} and default value is @code{0.0}.
  15577. Negative values will blur the input video, while positive values will
  15578. sharpen it, a value of zero will disable the effect.
  15579. @end table
  15580. All parameters are optional and default to the equivalent of the
  15581. string '5:5:1.0:5:5:0.0'.
  15582. @subsection Examples
  15583. @itemize
  15584. @item
  15585. Apply strong luma sharpen effect:
  15586. @example
  15587. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  15588. @end example
  15589. @item
  15590. Apply a strong blur of both luma and chroma parameters:
  15591. @example
  15592. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  15593. @end example
  15594. @end itemize
  15595. @c man end OPENCL VIDEO FILTERS
  15596. @chapter Video Sources
  15597. @c man begin VIDEO SOURCES
  15598. Below is a description of the currently available video sources.
  15599. @section buffer
  15600. Buffer video frames, and make them available to the filter chain.
  15601. This source is mainly intended for a programmatic use, in particular
  15602. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  15603. It accepts the following parameters:
  15604. @table @option
  15605. @item video_size
  15606. Specify the size (width and height) of the buffered video frames. For the
  15607. syntax of this option, check the
  15608. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15609. @item width
  15610. The input video width.
  15611. @item height
  15612. The input video height.
  15613. @item pix_fmt
  15614. A string representing the pixel format of the buffered video frames.
  15615. It may be a number corresponding to a pixel format, or a pixel format
  15616. name.
  15617. @item time_base
  15618. Specify the timebase assumed by the timestamps of the buffered frames.
  15619. @item frame_rate
  15620. Specify the frame rate expected for the video stream.
  15621. @item pixel_aspect, sar
  15622. The sample (pixel) aspect ratio of the input video.
  15623. @item sws_param
  15624. Specify the optional parameters to be used for the scale filter which
  15625. is automatically inserted when an input change is detected in the
  15626. input size or format.
  15627. @item hw_frames_ctx
  15628. When using a hardware pixel format, this should be a reference to an
  15629. AVHWFramesContext describing input frames.
  15630. @end table
  15631. For example:
  15632. @example
  15633. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  15634. @end example
  15635. will instruct the source to accept video frames with size 320x240 and
  15636. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  15637. square pixels (1:1 sample aspect ratio).
  15638. Since the pixel format with name "yuv410p" corresponds to the number 6
  15639. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  15640. this example corresponds to:
  15641. @example
  15642. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  15643. @end example
  15644. Alternatively, the options can be specified as a flat string, but this
  15645. syntax is deprecated:
  15646. @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}]
  15647. @section cellauto
  15648. Create a pattern generated by an elementary cellular automaton.
  15649. The initial state of the cellular automaton can be defined through the
  15650. @option{filename} and @option{pattern} options. If such options are
  15651. not specified an initial state is created randomly.
  15652. At each new frame a new row in the video is filled with the result of
  15653. the cellular automaton next generation. The behavior when the whole
  15654. frame is filled is defined by the @option{scroll} option.
  15655. This source accepts the following options:
  15656. @table @option
  15657. @item filename, f
  15658. Read the initial cellular automaton state, i.e. the starting row, from
  15659. the specified file.
  15660. In the file, each non-whitespace character is considered an alive
  15661. cell, a newline will terminate the row, and further characters in the
  15662. file will be ignored.
  15663. @item pattern, p
  15664. Read the initial cellular automaton state, i.e. the starting row, from
  15665. the specified string.
  15666. Each non-whitespace character in the string is considered an alive
  15667. cell, a newline will terminate the row, and further characters in the
  15668. string will be ignored.
  15669. @item rate, r
  15670. Set the video rate, that is the number of frames generated per second.
  15671. Default is 25.
  15672. @item random_fill_ratio, ratio
  15673. Set the random fill ratio for the initial cellular automaton row. It
  15674. is a floating point number value ranging from 0 to 1, defaults to
  15675. 1/PHI.
  15676. This option is ignored when a file or a pattern is specified.
  15677. @item random_seed, seed
  15678. Set the seed for filling randomly the initial row, must be an integer
  15679. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15680. set to -1, the filter will try to use a good random seed on a best
  15681. effort basis.
  15682. @item rule
  15683. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  15684. Default value is 110.
  15685. @item size, s
  15686. Set the size of the output video. For the syntax of this option, check the
  15687. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15688. If @option{filename} or @option{pattern} is specified, the size is set
  15689. by default to the width of the specified initial state row, and the
  15690. height is set to @var{width} * PHI.
  15691. If @option{size} is set, it must contain the width of the specified
  15692. pattern string, and the specified pattern will be centered in the
  15693. larger row.
  15694. If a filename or a pattern string is not specified, the size value
  15695. defaults to "320x518" (used for a randomly generated initial state).
  15696. @item scroll
  15697. If set to 1, scroll the output upward when all the rows in the output
  15698. have been already filled. If set to 0, the new generated row will be
  15699. written over the top row just after the bottom row is filled.
  15700. Defaults to 1.
  15701. @item start_full, full
  15702. If set to 1, completely fill the output with generated rows before
  15703. outputting the first frame.
  15704. This is the default behavior, for disabling set the value to 0.
  15705. @item stitch
  15706. If set to 1, stitch the left and right row edges together.
  15707. This is the default behavior, for disabling set the value to 0.
  15708. @end table
  15709. @subsection Examples
  15710. @itemize
  15711. @item
  15712. Read the initial state from @file{pattern}, and specify an output of
  15713. size 200x400.
  15714. @example
  15715. cellauto=f=pattern:s=200x400
  15716. @end example
  15717. @item
  15718. Generate a random initial row with a width of 200 cells, with a fill
  15719. ratio of 2/3:
  15720. @example
  15721. cellauto=ratio=2/3:s=200x200
  15722. @end example
  15723. @item
  15724. Create a pattern generated by rule 18 starting by a single alive cell
  15725. centered on an initial row with width 100:
  15726. @example
  15727. cellauto=p=@@:s=100x400:full=0:rule=18
  15728. @end example
  15729. @item
  15730. Specify a more elaborated initial pattern:
  15731. @example
  15732. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  15733. @end example
  15734. @end itemize
  15735. @anchor{coreimagesrc}
  15736. @section coreimagesrc
  15737. Video source generated on GPU using Apple's CoreImage API on OSX.
  15738. This video source is a specialized version of the @ref{coreimage} video filter.
  15739. Use a core image generator at the beginning of the applied filterchain to
  15740. generate the content.
  15741. The coreimagesrc video source accepts the following options:
  15742. @table @option
  15743. @item list_generators
  15744. List all available generators along with all their respective options as well as
  15745. possible minimum and maximum values along with the default values.
  15746. @example
  15747. list_generators=true
  15748. @end example
  15749. @item size, s
  15750. Specify the size of the sourced video. For the syntax of this option, check the
  15751. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15752. The default value is @code{320x240}.
  15753. @item rate, r
  15754. Specify the frame rate of the sourced video, as the number of frames
  15755. generated per second. It has to be a string in the format
  15756. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15757. number or a valid video frame rate abbreviation. The default value is
  15758. "25".
  15759. @item sar
  15760. Set the sample aspect ratio of the sourced video.
  15761. @item duration, d
  15762. Set the duration of the sourced video. See
  15763. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15764. for the accepted syntax.
  15765. If not specified, or the expressed duration is negative, the video is
  15766. supposed to be generated forever.
  15767. @end table
  15768. Additionally, all options of the @ref{coreimage} video filter are accepted.
  15769. A complete filterchain can be used for further processing of the
  15770. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  15771. and examples for details.
  15772. @subsection Examples
  15773. @itemize
  15774. @item
  15775. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  15776. given as complete and escaped command-line for Apple's standard bash shell:
  15777. @example
  15778. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  15779. @end example
  15780. This example is equivalent to the QRCode example of @ref{coreimage} without the
  15781. need for a nullsrc video source.
  15782. @end itemize
  15783. @section mandelbrot
  15784. Generate a Mandelbrot set fractal, and progressively zoom towards the
  15785. point specified with @var{start_x} and @var{start_y}.
  15786. This source accepts the following options:
  15787. @table @option
  15788. @item end_pts
  15789. Set the terminal pts value. Default value is 400.
  15790. @item end_scale
  15791. Set the terminal scale value.
  15792. Must be a floating point value. Default value is 0.3.
  15793. @item inner
  15794. Set the inner coloring mode, that is the algorithm used to draw the
  15795. Mandelbrot fractal internal region.
  15796. It shall assume one of the following values:
  15797. @table @option
  15798. @item black
  15799. Set black mode.
  15800. @item convergence
  15801. Show time until convergence.
  15802. @item mincol
  15803. Set color based on point closest to the origin of the iterations.
  15804. @item period
  15805. Set period mode.
  15806. @end table
  15807. Default value is @var{mincol}.
  15808. @item bailout
  15809. Set the bailout value. Default value is 10.0.
  15810. @item maxiter
  15811. Set the maximum of iterations performed by the rendering
  15812. algorithm. Default value is 7189.
  15813. @item outer
  15814. Set outer coloring mode.
  15815. It shall assume one of following values:
  15816. @table @option
  15817. @item iteration_count
  15818. Set iteration count mode.
  15819. @item normalized_iteration_count
  15820. set normalized iteration count mode.
  15821. @end table
  15822. Default value is @var{normalized_iteration_count}.
  15823. @item rate, r
  15824. Set frame rate, expressed as number of frames per second. Default
  15825. value is "25".
  15826. @item size, s
  15827. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  15828. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  15829. @item start_scale
  15830. Set the initial scale value. Default value is 3.0.
  15831. @item start_x
  15832. Set the initial x position. Must be a floating point value between
  15833. -100 and 100. Default value is -0.743643887037158704752191506114774.
  15834. @item start_y
  15835. Set the initial y position. Must be a floating point value between
  15836. -100 and 100. Default value is -0.131825904205311970493132056385139.
  15837. @end table
  15838. @section mptestsrc
  15839. Generate various test patterns, as generated by the MPlayer test filter.
  15840. The size of the generated video is fixed, and is 256x256.
  15841. This source is useful in particular for testing encoding features.
  15842. This source accepts the following options:
  15843. @table @option
  15844. @item rate, r
  15845. Specify the frame rate of the sourced video, as the number of frames
  15846. generated per second. It has to be a string in the format
  15847. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15848. number or a valid video frame rate abbreviation. The default value is
  15849. "25".
  15850. @item duration, d
  15851. Set the duration of the sourced video. See
  15852. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15853. for the accepted syntax.
  15854. If not specified, or the expressed duration is negative, the video is
  15855. supposed to be generated forever.
  15856. @item test, t
  15857. Set the number or the name of the test to perform. Supported tests are:
  15858. @table @option
  15859. @item dc_luma
  15860. @item dc_chroma
  15861. @item freq_luma
  15862. @item freq_chroma
  15863. @item amp_luma
  15864. @item amp_chroma
  15865. @item cbp
  15866. @item mv
  15867. @item ring1
  15868. @item ring2
  15869. @item all
  15870. @end table
  15871. Default value is "all", which will cycle through the list of all tests.
  15872. @end table
  15873. Some examples:
  15874. @example
  15875. mptestsrc=t=dc_luma
  15876. @end example
  15877. will generate a "dc_luma" test pattern.
  15878. @section frei0r_src
  15879. Provide a frei0r source.
  15880. To enable compilation of this filter you need to install the frei0r
  15881. header and configure FFmpeg with @code{--enable-frei0r}.
  15882. This source accepts the following parameters:
  15883. @table @option
  15884. @item size
  15885. The size of the video to generate. For the syntax of this option, check the
  15886. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15887. @item framerate
  15888. The framerate of the generated video. It may be a string of the form
  15889. @var{num}/@var{den} or a frame rate abbreviation.
  15890. @item filter_name
  15891. The name to the frei0r source to load. For more information regarding frei0r and
  15892. how to set the parameters, read the @ref{frei0r} section in the video filters
  15893. documentation.
  15894. @item filter_params
  15895. A '|'-separated list of parameters to pass to the frei0r source.
  15896. @end table
  15897. For example, to generate a frei0r partik0l source with size 200x200
  15898. and frame rate 10 which is overlaid on the overlay filter main input:
  15899. @example
  15900. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  15901. @end example
  15902. @section life
  15903. Generate a life pattern.
  15904. This source is based on a generalization of John Conway's life game.
  15905. The sourced input represents a life grid, each pixel represents a cell
  15906. which can be in one of two possible states, alive or dead. Every cell
  15907. interacts with its eight neighbours, which are the cells that are
  15908. horizontally, vertically, or diagonally adjacent.
  15909. At each interaction the grid evolves according to the adopted rule,
  15910. which specifies the number of neighbor alive cells which will make a
  15911. cell stay alive or born. The @option{rule} option allows one to specify
  15912. the rule to adopt.
  15913. This source accepts the following options:
  15914. @table @option
  15915. @item filename, f
  15916. Set the file from which to read the initial grid state. In the file,
  15917. each non-whitespace character is considered an alive cell, and newline
  15918. is used to delimit the end of each row.
  15919. If this option is not specified, the initial grid is generated
  15920. randomly.
  15921. @item rate, r
  15922. Set the video rate, that is the number of frames generated per second.
  15923. Default is 25.
  15924. @item random_fill_ratio, ratio
  15925. Set the random fill ratio for the initial random grid. It is a
  15926. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  15927. It is ignored when a file is specified.
  15928. @item random_seed, seed
  15929. Set the seed for filling the initial random grid, must be an integer
  15930. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15931. set to -1, the filter will try to use a good random seed on a best
  15932. effort basis.
  15933. @item rule
  15934. Set the life rule.
  15935. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  15936. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  15937. @var{NS} specifies the number of alive neighbor cells which make a
  15938. live cell stay alive, and @var{NB} the number of alive neighbor cells
  15939. which make a dead cell to become alive (i.e. to "born").
  15940. "s" and "b" can be used in place of "S" and "B", respectively.
  15941. Alternatively a rule can be specified by an 18-bits integer. The 9
  15942. high order bits are used to encode the next cell state if it is alive
  15943. for each number of neighbor alive cells, the low order bits specify
  15944. the rule for "borning" new cells. Higher order bits encode for an
  15945. higher number of neighbor cells.
  15946. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  15947. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  15948. Default value is "S23/B3", which is the original Conway's game of life
  15949. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  15950. cells, and will born a new cell if there are three alive cells around
  15951. a dead cell.
  15952. @item size, s
  15953. Set the size of the output video. For the syntax of this option, check the
  15954. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15955. If @option{filename} is specified, the size is set by default to the
  15956. same size of the input file. If @option{size} is set, it must contain
  15957. the size specified in the input file, and the initial grid defined in
  15958. that file is centered in the larger resulting area.
  15959. If a filename is not specified, the size value defaults to "320x240"
  15960. (used for a randomly generated initial grid).
  15961. @item stitch
  15962. If set to 1, stitch the left and right grid edges together, and the
  15963. top and bottom edges also. Defaults to 1.
  15964. @item mold
  15965. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  15966. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  15967. value from 0 to 255.
  15968. @item life_color
  15969. Set the color of living (or new born) cells.
  15970. @item death_color
  15971. Set the color of dead cells. If @option{mold} is set, this is the first color
  15972. used to represent a dead cell.
  15973. @item mold_color
  15974. Set mold color, for definitely dead and moldy cells.
  15975. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  15976. ffmpeg-utils manual,ffmpeg-utils}.
  15977. @end table
  15978. @subsection Examples
  15979. @itemize
  15980. @item
  15981. Read a grid from @file{pattern}, and center it on a grid of size
  15982. 300x300 pixels:
  15983. @example
  15984. life=f=pattern:s=300x300
  15985. @end example
  15986. @item
  15987. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  15988. @example
  15989. life=ratio=2/3:s=200x200
  15990. @end example
  15991. @item
  15992. Specify a custom rule for evolving a randomly generated grid:
  15993. @example
  15994. life=rule=S14/B34
  15995. @end example
  15996. @item
  15997. Full example with slow death effect (mold) using @command{ffplay}:
  15998. @example
  15999. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  16000. @end example
  16001. @end itemize
  16002. @anchor{allrgb}
  16003. @anchor{allyuv}
  16004. @anchor{color}
  16005. @anchor{haldclutsrc}
  16006. @anchor{nullsrc}
  16007. @anchor{pal75bars}
  16008. @anchor{pal100bars}
  16009. @anchor{rgbtestsrc}
  16010. @anchor{smptebars}
  16011. @anchor{smptehdbars}
  16012. @anchor{testsrc}
  16013. @anchor{testsrc2}
  16014. @anchor{yuvtestsrc}
  16015. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  16016. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  16017. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  16018. The @code{color} source provides an uniformly colored input.
  16019. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  16020. @ref{haldclut} filter.
  16021. The @code{nullsrc} source returns unprocessed video frames. It is
  16022. mainly useful to be employed in analysis / debugging tools, or as the
  16023. source for filters which ignore the input data.
  16024. The @code{pal75bars} source generates a color bars pattern, based on
  16025. EBU PAL recommendations with 75% color levels.
  16026. The @code{pal100bars} source generates a color bars pattern, based on
  16027. EBU PAL recommendations with 100% color levels.
  16028. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  16029. detecting RGB vs BGR issues. You should see a red, green and blue
  16030. stripe from top to bottom.
  16031. The @code{smptebars} source generates a color bars pattern, based on
  16032. the SMPTE Engineering Guideline EG 1-1990.
  16033. The @code{smptehdbars} source generates a color bars pattern, based on
  16034. the SMPTE RP 219-2002.
  16035. The @code{testsrc} source generates a test video pattern, showing a
  16036. color pattern, a scrolling gradient and a timestamp. This is mainly
  16037. intended for testing purposes.
  16038. The @code{testsrc2} source is similar to testsrc, but supports more
  16039. pixel formats instead of just @code{rgb24}. This allows using it as an
  16040. input for other tests without requiring a format conversion.
  16041. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  16042. see a y, cb and cr stripe from top to bottom.
  16043. The sources accept the following parameters:
  16044. @table @option
  16045. @item level
  16046. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  16047. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  16048. pixels to be used as identity matrix for 3D lookup tables. Each component is
  16049. coded on a @code{1/(N*N)} scale.
  16050. @item color, c
  16051. Specify the color of the source, only available in the @code{color}
  16052. source. For the syntax of this option, check the
  16053. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16054. @item size, s
  16055. Specify the size of the sourced video. For the syntax of this option, check the
  16056. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16057. The default value is @code{320x240}.
  16058. This option is not available with the @code{allrgb}, @code{allyuv}, and
  16059. @code{haldclutsrc} filters.
  16060. @item rate, r
  16061. Specify the frame rate of the sourced video, as the number of frames
  16062. generated per second. It has to be a string in the format
  16063. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  16064. number or a valid video frame rate abbreviation. The default value is
  16065. "25".
  16066. @item duration, d
  16067. Set the duration of the sourced video. See
  16068. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16069. for the accepted syntax.
  16070. If not specified, or the expressed duration is negative, the video is
  16071. supposed to be generated forever.
  16072. @item sar
  16073. Set the sample aspect ratio of the sourced video.
  16074. @item alpha
  16075. Specify the alpha (opacity) of the background, only available in the
  16076. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  16077. 255 (fully opaque, the default).
  16078. @item decimals, n
  16079. Set the number of decimals to show in the timestamp, only available in the
  16080. @code{testsrc} source.
  16081. The displayed timestamp value will correspond to the original
  16082. timestamp value multiplied by the power of 10 of the specified
  16083. value. Default value is 0.
  16084. @end table
  16085. @subsection Examples
  16086. @itemize
  16087. @item
  16088. Generate a video with a duration of 5.3 seconds, with size
  16089. 176x144 and a frame rate of 10 frames per second:
  16090. @example
  16091. testsrc=duration=5.3:size=qcif:rate=10
  16092. @end example
  16093. @item
  16094. The following graph description will generate a red source
  16095. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  16096. frames per second:
  16097. @example
  16098. color=c=red@@0.2:s=qcif:r=10
  16099. @end example
  16100. @item
  16101. If the input content is to be ignored, @code{nullsrc} can be used. The
  16102. following command generates noise in the luminance plane by employing
  16103. the @code{geq} filter:
  16104. @example
  16105. nullsrc=s=256x256, geq=random(1)*255:128:128
  16106. @end example
  16107. @end itemize
  16108. @subsection Commands
  16109. The @code{color} source supports the following commands:
  16110. @table @option
  16111. @item c, color
  16112. Set the color of the created image. Accepts the same syntax of the
  16113. corresponding @option{color} option.
  16114. @end table
  16115. @section openclsrc
  16116. Generate video using an OpenCL program.
  16117. @table @option
  16118. @item source
  16119. OpenCL program source file.
  16120. @item kernel
  16121. Kernel name in program.
  16122. @item size, s
  16123. Size of frames to generate. This must be set.
  16124. @item format
  16125. Pixel format to use for the generated frames. This must be set.
  16126. @item rate, r
  16127. Number of frames generated every second. Default value is '25'.
  16128. @end table
  16129. For details of how the program loading works, see the @ref{program_opencl}
  16130. filter.
  16131. Example programs:
  16132. @itemize
  16133. @item
  16134. Generate a colour ramp by setting pixel values from the position of the pixel
  16135. in the output image. (Note that this will work with all pixel formats, but
  16136. the generated output will not be the same.)
  16137. @verbatim
  16138. __kernel void ramp(__write_only image2d_t dst,
  16139. unsigned int index)
  16140. {
  16141. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  16142. float4 val;
  16143. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  16144. write_imagef(dst, loc, val);
  16145. }
  16146. @end verbatim
  16147. @item
  16148. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  16149. @verbatim
  16150. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  16151. unsigned int index)
  16152. {
  16153. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  16154. float4 value = 0.0f;
  16155. int x = loc.x + index;
  16156. int y = loc.y + index;
  16157. while (x > 0 || y > 0) {
  16158. if (x % 3 == 1 && y % 3 == 1) {
  16159. value = 1.0f;
  16160. break;
  16161. }
  16162. x /= 3;
  16163. y /= 3;
  16164. }
  16165. write_imagef(dst, loc, value);
  16166. }
  16167. @end verbatim
  16168. @end itemize
  16169. @section sierpinski
  16170. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  16171. This source accepts the following options:
  16172. @table @option
  16173. @item size, s
  16174. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  16175. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  16176. @item rate, r
  16177. Set frame rate, expressed as number of frames per second. Default
  16178. value is "25".
  16179. @item seed
  16180. Set seed which is used for random panning.
  16181. @item jump
  16182. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  16183. @item type
  16184. Set fractal type, can be default @code{carpet} or @code{triangle}.
  16185. @end table
  16186. @c man end VIDEO SOURCES
  16187. @chapter Video Sinks
  16188. @c man begin VIDEO SINKS
  16189. Below is a description of the currently available video sinks.
  16190. @section buffersink
  16191. Buffer video frames, and make them available to the end of the filter
  16192. graph.
  16193. This sink is mainly intended for programmatic use, in particular
  16194. through the interface defined in @file{libavfilter/buffersink.h}
  16195. or the options system.
  16196. It accepts a pointer to an AVBufferSinkContext structure, which
  16197. defines the incoming buffers' formats, to be passed as the opaque
  16198. parameter to @code{avfilter_init_filter} for initialization.
  16199. @section nullsink
  16200. Null video sink: do absolutely nothing with the input video. It is
  16201. mainly useful as a template and for use in analysis / debugging
  16202. tools.
  16203. @c man end VIDEO SINKS
  16204. @chapter Multimedia Filters
  16205. @c man begin MULTIMEDIA FILTERS
  16206. Below is a description of the currently available multimedia filters.
  16207. @section abitscope
  16208. Convert input audio to a video output, displaying the audio bit scope.
  16209. The filter accepts the following options:
  16210. @table @option
  16211. @item rate, r
  16212. Set frame rate, expressed as number of frames per second. Default
  16213. value is "25".
  16214. @item size, s
  16215. Specify the video size for the output. For the syntax of this option, check the
  16216. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16217. Default value is @code{1024x256}.
  16218. @item colors
  16219. Specify list of colors separated by space or by '|' which will be used to
  16220. draw channels. Unrecognized or missing colors will be replaced
  16221. by white color.
  16222. @end table
  16223. @section ahistogram
  16224. Convert input audio to a video output, displaying the volume histogram.
  16225. The filter accepts the following options:
  16226. @table @option
  16227. @item dmode
  16228. Specify how histogram is calculated.
  16229. It accepts the following values:
  16230. @table @samp
  16231. @item single
  16232. Use single histogram for all channels.
  16233. @item separate
  16234. Use separate histogram for each channel.
  16235. @end table
  16236. Default is @code{single}.
  16237. @item rate, r
  16238. Set frame rate, expressed as number of frames per second. Default
  16239. value is "25".
  16240. @item size, s
  16241. Specify the video size for the output. For the syntax of this option, check the
  16242. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16243. Default value is @code{hd720}.
  16244. @item scale
  16245. Set display scale.
  16246. It accepts the following values:
  16247. @table @samp
  16248. @item log
  16249. logarithmic
  16250. @item sqrt
  16251. square root
  16252. @item cbrt
  16253. cubic root
  16254. @item lin
  16255. linear
  16256. @item rlog
  16257. reverse logarithmic
  16258. @end table
  16259. Default is @code{log}.
  16260. @item ascale
  16261. Set amplitude scale.
  16262. It accepts the following values:
  16263. @table @samp
  16264. @item log
  16265. logarithmic
  16266. @item lin
  16267. linear
  16268. @end table
  16269. Default is @code{log}.
  16270. @item acount
  16271. Set how much frames to accumulate in histogram.
  16272. Default is 1. Setting this to -1 accumulates all frames.
  16273. @item rheight
  16274. Set histogram ratio of window height.
  16275. @item slide
  16276. Set sonogram sliding.
  16277. It accepts the following values:
  16278. @table @samp
  16279. @item replace
  16280. replace old rows with new ones.
  16281. @item scroll
  16282. scroll from top to bottom.
  16283. @end table
  16284. Default is @code{replace}.
  16285. @end table
  16286. @section aphasemeter
  16287. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  16288. representing mean phase of current audio frame. A video output can also be produced and is
  16289. enabled by default. The audio is passed through as first output.
  16290. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  16291. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  16292. and @code{1} means channels are in phase.
  16293. The filter accepts the following options, all related to its video output:
  16294. @table @option
  16295. @item rate, r
  16296. Set the output frame rate. Default value is @code{25}.
  16297. @item size, s
  16298. Set the video size for the output. For the syntax of this option, check the
  16299. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16300. Default value is @code{800x400}.
  16301. @item rc
  16302. @item gc
  16303. @item bc
  16304. Specify the red, green, blue contrast. Default values are @code{2},
  16305. @code{7} and @code{1}.
  16306. Allowed range is @code{[0, 255]}.
  16307. @item mpc
  16308. Set color which will be used for drawing median phase. If color is
  16309. @code{none} which is default, no median phase value will be drawn.
  16310. @item video
  16311. Enable video output. Default is enabled.
  16312. @end table
  16313. @section avectorscope
  16314. Convert input audio to a video output, representing the audio vector
  16315. scope.
  16316. The filter is used to measure the difference between channels of stereo
  16317. audio stream. A monaural signal, consisting of identical left and right
  16318. signal, results in straight vertical line. Any stereo separation is visible
  16319. as a deviation from this line, creating a Lissajous figure.
  16320. If the straight (or deviation from it) but horizontal line appears this
  16321. indicates that the left and right channels are out of phase.
  16322. The filter accepts the following options:
  16323. @table @option
  16324. @item mode, m
  16325. Set the vectorscope mode.
  16326. Available values are:
  16327. @table @samp
  16328. @item lissajous
  16329. Lissajous rotated by 45 degrees.
  16330. @item lissajous_xy
  16331. Same as above but not rotated.
  16332. @item polar
  16333. Shape resembling half of circle.
  16334. @end table
  16335. Default value is @samp{lissajous}.
  16336. @item size, s
  16337. Set the video size for the output. For the syntax of this option, check the
  16338. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16339. Default value is @code{400x400}.
  16340. @item rate, r
  16341. Set the output frame rate. Default value is @code{25}.
  16342. @item rc
  16343. @item gc
  16344. @item bc
  16345. @item ac
  16346. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  16347. @code{160}, @code{80} and @code{255}.
  16348. Allowed range is @code{[0, 255]}.
  16349. @item rf
  16350. @item gf
  16351. @item bf
  16352. @item af
  16353. Specify the red, green, blue and alpha fade. Default values are @code{15},
  16354. @code{10}, @code{5} and @code{5}.
  16355. Allowed range is @code{[0, 255]}.
  16356. @item zoom
  16357. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  16358. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  16359. @item draw
  16360. Set the vectorscope drawing mode.
  16361. Available values are:
  16362. @table @samp
  16363. @item dot
  16364. Draw dot for each sample.
  16365. @item line
  16366. Draw line between previous and current sample.
  16367. @end table
  16368. Default value is @samp{dot}.
  16369. @item scale
  16370. Specify amplitude scale of audio samples.
  16371. Available values are:
  16372. @table @samp
  16373. @item lin
  16374. Linear.
  16375. @item sqrt
  16376. Square root.
  16377. @item cbrt
  16378. Cubic root.
  16379. @item log
  16380. Logarithmic.
  16381. @end table
  16382. @item swap
  16383. Swap left channel axis with right channel axis.
  16384. @item mirror
  16385. Mirror axis.
  16386. @table @samp
  16387. @item none
  16388. No mirror.
  16389. @item x
  16390. Mirror only x axis.
  16391. @item y
  16392. Mirror only y axis.
  16393. @item xy
  16394. Mirror both axis.
  16395. @end table
  16396. @end table
  16397. @subsection Examples
  16398. @itemize
  16399. @item
  16400. Complete example using @command{ffplay}:
  16401. @example
  16402. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  16403. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  16404. @end example
  16405. @end itemize
  16406. @section bench, abench
  16407. Benchmark part of a filtergraph.
  16408. The filter accepts the following options:
  16409. @table @option
  16410. @item action
  16411. Start or stop a timer.
  16412. Available values are:
  16413. @table @samp
  16414. @item start
  16415. Get the current time, set it as frame metadata (using the key
  16416. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  16417. @item stop
  16418. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  16419. the input frame metadata to get the time difference. Time difference, average,
  16420. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  16421. @code{min}) are then printed. The timestamps are expressed in seconds.
  16422. @end table
  16423. @end table
  16424. @subsection Examples
  16425. @itemize
  16426. @item
  16427. Benchmark @ref{selectivecolor} filter:
  16428. @example
  16429. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  16430. @end example
  16431. @end itemize
  16432. @section concat
  16433. Concatenate audio and video streams, joining them together one after the
  16434. other.
  16435. The filter works on segments of synchronized video and audio streams. All
  16436. segments must have the same number of streams of each type, and that will
  16437. also be the number of streams at output.
  16438. The filter accepts the following options:
  16439. @table @option
  16440. @item n
  16441. Set the number of segments. Default is 2.
  16442. @item v
  16443. Set the number of output video streams, that is also the number of video
  16444. streams in each segment. Default is 1.
  16445. @item a
  16446. Set the number of output audio streams, that is also the number of audio
  16447. streams in each segment. Default is 0.
  16448. @item unsafe
  16449. Activate unsafe mode: do not fail if segments have a different format.
  16450. @end table
  16451. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  16452. @var{a} audio outputs.
  16453. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  16454. segment, in the same order as the outputs, then the inputs for the second
  16455. segment, etc.
  16456. Related streams do not always have exactly the same duration, for various
  16457. reasons including codec frame size or sloppy authoring. For that reason,
  16458. related synchronized streams (e.g. a video and its audio track) should be
  16459. concatenated at once. The concat filter will use the duration of the longest
  16460. stream in each segment (except the last one), and if necessary pad shorter
  16461. audio streams with silence.
  16462. For this filter to work correctly, all segments must start at timestamp 0.
  16463. All corresponding streams must have the same parameters in all segments; the
  16464. filtering system will automatically select a common pixel format for video
  16465. streams, and a common sample format, sample rate and channel layout for
  16466. audio streams, but other settings, such as resolution, must be converted
  16467. explicitly by the user.
  16468. Different frame rates are acceptable but will result in variable frame rate
  16469. at output; be sure to configure the output file to handle it.
  16470. @subsection Examples
  16471. @itemize
  16472. @item
  16473. Concatenate an opening, an episode and an ending, all in bilingual version
  16474. (video in stream 0, audio in streams 1 and 2):
  16475. @example
  16476. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  16477. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  16478. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  16479. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  16480. @end example
  16481. @item
  16482. Concatenate two parts, handling audio and video separately, using the
  16483. (a)movie sources, and adjusting the resolution:
  16484. @example
  16485. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  16486. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  16487. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  16488. @end example
  16489. Note that a desync will happen at the stitch if the audio and video streams
  16490. do not have exactly the same duration in the first file.
  16491. @end itemize
  16492. @subsection Commands
  16493. This filter supports the following commands:
  16494. @table @option
  16495. @item next
  16496. Close the current segment and step to the next one
  16497. @end table
  16498. @section drawgraph, adrawgraph
  16499. Draw a graph using input video or audio metadata.
  16500. It accepts the following parameters:
  16501. @table @option
  16502. @item m1
  16503. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  16504. @item fg1
  16505. Set 1st foreground color expression.
  16506. @item m2
  16507. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  16508. @item fg2
  16509. Set 2nd foreground color expression.
  16510. @item m3
  16511. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  16512. @item fg3
  16513. Set 3rd foreground color expression.
  16514. @item m4
  16515. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  16516. @item fg4
  16517. Set 4th foreground color expression.
  16518. @item min
  16519. Set minimal value of metadata value.
  16520. @item max
  16521. Set maximal value of metadata value.
  16522. @item bg
  16523. Set graph background color. Default is white.
  16524. @item mode
  16525. Set graph mode.
  16526. Available values for mode is:
  16527. @table @samp
  16528. @item bar
  16529. @item dot
  16530. @item line
  16531. @end table
  16532. Default is @code{line}.
  16533. @item slide
  16534. Set slide mode.
  16535. Available values for slide is:
  16536. @table @samp
  16537. @item frame
  16538. Draw new frame when right border is reached.
  16539. @item replace
  16540. Replace old columns with new ones.
  16541. @item scroll
  16542. Scroll from right to left.
  16543. @item rscroll
  16544. Scroll from left to right.
  16545. @item picture
  16546. Draw single picture.
  16547. @end table
  16548. Default is @code{frame}.
  16549. @item size
  16550. Set size of graph video. For the syntax of this option, check the
  16551. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16552. The default value is @code{900x256}.
  16553. The foreground color expressions can use the following variables:
  16554. @table @option
  16555. @item MIN
  16556. Minimal value of metadata value.
  16557. @item MAX
  16558. Maximal value of metadata value.
  16559. @item VAL
  16560. Current metadata key value.
  16561. @end table
  16562. The color is defined as 0xAABBGGRR.
  16563. @end table
  16564. Example using metadata from @ref{signalstats} filter:
  16565. @example
  16566. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  16567. @end example
  16568. Example using metadata from @ref{ebur128} filter:
  16569. @example
  16570. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  16571. @end example
  16572. @anchor{ebur128}
  16573. @section ebur128
  16574. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  16575. level. By default, it logs a message at a frequency of 10Hz with the
  16576. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  16577. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  16578. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  16579. sample format is double-precision floating point. The input stream will be converted to
  16580. this specification, if needed. Users may need to insert aformat and/or aresample filters
  16581. after this filter to obtain the original parameters.
  16582. The filter also has a video output (see the @var{video} option) with a real
  16583. time graph to observe the loudness evolution. The graphic contains the logged
  16584. message mentioned above, so it is not printed anymore when this option is set,
  16585. unless the verbose logging is set. The main graphing area contains the
  16586. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  16587. the momentary loudness (400 milliseconds), but can optionally be configured
  16588. to instead display short-term loudness (see @var{gauge}).
  16589. The green area marks a +/- 1LU target range around the target loudness
  16590. (-23LUFS by default, unless modified through @var{target}).
  16591. More information about the Loudness Recommendation EBU R128 on
  16592. @url{http://tech.ebu.ch/loudness}.
  16593. The filter accepts the following options:
  16594. @table @option
  16595. @item video
  16596. Activate the video output. The audio stream is passed unchanged whether this
  16597. option is set or no. The video stream will be the first output stream if
  16598. activated. Default is @code{0}.
  16599. @item size
  16600. Set the video size. This option is for video only. For the syntax of this
  16601. option, check the
  16602. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16603. Default and minimum resolution is @code{640x480}.
  16604. @item meter
  16605. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  16606. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  16607. other integer value between this range is allowed.
  16608. @item metadata
  16609. Set metadata injection. If set to @code{1}, the audio input will be segmented
  16610. into 100ms output frames, each of them containing various loudness information
  16611. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  16612. Default is @code{0}.
  16613. @item framelog
  16614. Force the frame logging level.
  16615. Available values are:
  16616. @table @samp
  16617. @item info
  16618. information logging level
  16619. @item verbose
  16620. verbose logging level
  16621. @end table
  16622. By default, the logging level is set to @var{info}. If the @option{video} or
  16623. the @option{metadata} options are set, it switches to @var{verbose}.
  16624. @item peak
  16625. Set peak mode(s).
  16626. Available modes can be cumulated (the option is a @code{flag} type). Possible
  16627. values are:
  16628. @table @samp
  16629. @item none
  16630. Disable any peak mode (default).
  16631. @item sample
  16632. Enable sample-peak mode.
  16633. Simple peak mode looking for the higher sample value. It logs a message
  16634. for sample-peak (identified by @code{SPK}).
  16635. @item true
  16636. Enable true-peak mode.
  16637. If enabled, the peak lookup is done on an over-sampled version of the input
  16638. stream for better peak accuracy. It logs a message for true-peak.
  16639. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  16640. This mode requires a build with @code{libswresample}.
  16641. @end table
  16642. @item dualmono
  16643. Treat mono input files as "dual mono". If a mono file is intended for playback
  16644. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  16645. If set to @code{true}, this option will compensate for this effect.
  16646. Multi-channel input files are not affected by this option.
  16647. @item panlaw
  16648. Set a specific pan law to be used for the measurement of dual mono files.
  16649. This parameter is optional, and has a default value of -3.01dB.
  16650. @item target
  16651. Set a specific target level (in LUFS) used as relative zero in the visualization.
  16652. This parameter is optional and has a default value of -23LUFS as specified
  16653. by EBU R128. However, material published online may prefer a level of -16LUFS
  16654. (e.g. for use with podcasts or video platforms).
  16655. @item gauge
  16656. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  16657. @code{shortterm}. By default the momentary value will be used, but in certain
  16658. scenarios it may be more useful to observe the short term value instead (e.g.
  16659. live mixing).
  16660. @item scale
  16661. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  16662. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  16663. video output, not the summary or continuous log output.
  16664. @end table
  16665. @subsection Examples
  16666. @itemize
  16667. @item
  16668. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  16669. @example
  16670. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  16671. @end example
  16672. @item
  16673. Run an analysis with @command{ffmpeg}:
  16674. @example
  16675. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  16676. @end example
  16677. @end itemize
  16678. @section interleave, ainterleave
  16679. Temporally interleave frames from several inputs.
  16680. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  16681. These filters read frames from several inputs and send the oldest
  16682. queued frame to the output.
  16683. Input streams must have well defined, monotonically increasing frame
  16684. timestamp values.
  16685. In order to submit one frame to output, these filters need to enqueue
  16686. at least one frame for each input, so they cannot work in case one
  16687. input is not yet terminated and will not receive incoming frames.
  16688. For example consider the case when one input is a @code{select} filter
  16689. which always drops input frames. The @code{interleave} filter will keep
  16690. reading from that input, but it will never be able to send new frames
  16691. to output until the input sends an end-of-stream signal.
  16692. Also, depending on inputs synchronization, the filters will drop
  16693. frames in case one input receives more frames than the other ones, and
  16694. the queue is already filled.
  16695. These filters accept the following options:
  16696. @table @option
  16697. @item nb_inputs, n
  16698. Set the number of different inputs, it is 2 by default.
  16699. @end table
  16700. @subsection Examples
  16701. @itemize
  16702. @item
  16703. Interleave frames belonging to different streams using @command{ffmpeg}:
  16704. @example
  16705. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  16706. @end example
  16707. @item
  16708. Add flickering blur effect:
  16709. @example
  16710. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  16711. @end example
  16712. @end itemize
  16713. @section metadata, ametadata
  16714. Manipulate frame metadata.
  16715. This filter accepts the following options:
  16716. @table @option
  16717. @item mode
  16718. Set mode of operation of the filter.
  16719. Can be one of the following:
  16720. @table @samp
  16721. @item select
  16722. If both @code{value} and @code{key} is set, select frames
  16723. which have such metadata. If only @code{key} is set, select
  16724. every frame that has such key in metadata.
  16725. @item add
  16726. Add new metadata @code{key} and @code{value}. If key is already available
  16727. do nothing.
  16728. @item modify
  16729. Modify value of already present key.
  16730. @item delete
  16731. If @code{value} is set, delete only keys that have such value.
  16732. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  16733. the frame.
  16734. @item print
  16735. Print key and its value if metadata was found. If @code{key} is not set print all
  16736. metadata values available in frame.
  16737. @end table
  16738. @item key
  16739. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  16740. @item value
  16741. Set metadata value which will be used. This option is mandatory for
  16742. @code{modify} and @code{add} mode.
  16743. @item function
  16744. Which function to use when comparing metadata value and @code{value}.
  16745. Can be one of following:
  16746. @table @samp
  16747. @item same_str
  16748. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  16749. @item starts_with
  16750. Values are interpreted as strings, returns true if metadata value starts with
  16751. the @code{value} option string.
  16752. @item less
  16753. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  16754. @item equal
  16755. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  16756. @item greater
  16757. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  16758. @item expr
  16759. Values are interpreted as floats, returns true if expression from option @code{expr}
  16760. evaluates to true.
  16761. @item ends_with
  16762. Values are interpreted as strings, returns true if metadata value ends with
  16763. the @code{value} option string.
  16764. @end table
  16765. @item expr
  16766. Set expression which is used when @code{function} is set to @code{expr}.
  16767. The expression is evaluated through the eval API and can contain the following
  16768. constants:
  16769. @table @option
  16770. @item VALUE1
  16771. Float representation of @code{value} from metadata key.
  16772. @item VALUE2
  16773. Float representation of @code{value} as supplied by user in @code{value} option.
  16774. @end table
  16775. @item file
  16776. If specified in @code{print} mode, output is written to the named file. Instead of
  16777. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  16778. for standard output. If @code{file} option is not set, output is written to the log
  16779. with AV_LOG_INFO loglevel.
  16780. @end table
  16781. @subsection Examples
  16782. @itemize
  16783. @item
  16784. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  16785. between 0 and 1.
  16786. @example
  16787. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  16788. @end example
  16789. @item
  16790. Print silencedetect output to file @file{metadata.txt}.
  16791. @example
  16792. silencedetect,ametadata=mode=print:file=metadata.txt
  16793. @end example
  16794. @item
  16795. Direct all metadata to a pipe with file descriptor 4.
  16796. @example
  16797. metadata=mode=print:file='pipe\:4'
  16798. @end example
  16799. @end itemize
  16800. @section perms, aperms
  16801. Set read/write permissions for the output frames.
  16802. These filters are mainly aimed at developers to test direct path in the
  16803. following filter in the filtergraph.
  16804. The filters accept the following options:
  16805. @table @option
  16806. @item mode
  16807. Select the permissions mode.
  16808. It accepts the following values:
  16809. @table @samp
  16810. @item none
  16811. Do nothing. This is the default.
  16812. @item ro
  16813. Set all the output frames read-only.
  16814. @item rw
  16815. Set all the output frames directly writable.
  16816. @item toggle
  16817. Make the frame read-only if writable, and writable if read-only.
  16818. @item random
  16819. Set each output frame read-only or writable randomly.
  16820. @end table
  16821. @item seed
  16822. Set the seed for the @var{random} mode, must be an integer included between
  16823. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  16824. @code{-1}, the filter will try to use a good random seed on a best effort
  16825. basis.
  16826. @end table
  16827. Note: in case of auto-inserted filter between the permission filter and the
  16828. following one, the permission might not be received as expected in that
  16829. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  16830. perms/aperms filter can avoid this problem.
  16831. @section realtime, arealtime
  16832. Slow down filtering to match real time approximately.
  16833. These filters will pause the filtering for a variable amount of time to
  16834. match the output rate with the input timestamps.
  16835. They are similar to the @option{re} option to @code{ffmpeg}.
  16836. They accept the following options:
  16837. @table @option
  16838. @item limit
  16839. Time limit for the pauses. Any pause longer than that will be considered
  16840. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  16841. @item speed
  16842. Speed factor for processing. The value must be a float larger than zero.
  16843. Values larger than 1.0 will result in faster than realtime processing,
  16844. smaller will slow processing down. The @var{limit} is automatically adapted
  16845. accordingly. Default is 1.0.
  16846. A processing speed faster than what is possible without these filters cannot
  16847. be achieved.
  16848. @end table
  16849. @anchor{select}
  16850. @section select, aselect
  16851. Select frames to pass in output.
  16852. This filter accepts the following options:
  16853. @table @option
  16854. @item expr, e
  16855. Set expression, which is evaluated for each input frame.
  16856. If the expression is evaluated to zero, the frame is discarded.
  16857. If the evaluation result is negative or NaN, the frame is sent to the
  16858. first output; otherwise it is sent to the output with index
  16859. @code{ceil(val)-1}, assuming that the input index starts from 0.
  16860. For example a value of @code{1.2} corresponds to the output with index
  16861. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  16862. @item outputs, n
  16863. Set the number of outputs. The output to which to send the selected
  16864. frame is based on the result of the evaluation. Default value is 1.
  16865. @end table
  16866. The expression can contain the following constants:
  16867. @table @option
  16868. @item n
  16869. The (sequential) number of the filtered frame, starting from 0.
  16870. @item selected_n
  16871. The (sequential) number of the selected frame, starting from 0.
  16872. @item prev_selected_n
  16873. The sequential number of the last selected frame. It's NAN if undefined.
  16874. @item TB
  16875. The timebase of the input timestamps.
  16876. @item pts
  16877. The PTS (Presentation TimeStamp) of the filtered video frame,
  16878. expressed in @var{TB} units. It's NAN if undefined.
  16879. @item t
  16880. The PTS of the filtered video frame,
  16881. expressed in seconds. It's NAN if undefined.
  16882. @item prev_pts
  16883. The PTS of the previously filtered video frame. It's NAN if undefined.
  16884. @item prev_selected_pts
  16885. The PTS of the last previously filtered video frame. It's NAN if undefined.
  16886. @item prev_selected_t
  16887. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  16888. @item start_pts
  16889. The PTS of the first video frame in the video. It's NAN if undefined.
  16890. @item start_t
  16891. The time of the first video frame in the video. It's NAN if undefined.
  16892. @item pict_type @emph{(video only)}
  16893. The type of the filtered frame. It can assume one of the following
  16894. values:
  16895. @table @option
  16896. @item I
  16897. @item P
  16898. @item B
  16899. @item S
  16900. @item SI
  16901. @item SP
  16902. @item BI
  16903. @end table
  16904. @item interlace_type @emph{(video only)}
  16905. The frame interlace type. It can assume one of the following values:
  16906. @table @option
  16907. @item PROGRESSIVE
  16908. The frame is progressive (not interlaced).
  16909. @item TOPFIRST
  16910. The frame is top-field-first.
  16911. @item BOTTOMFIRST
  16912. The frame is bottom-field-first.
  16913. @end table
  16914. @item consumed_sample_n @emph{(audio only)}
  16915. the number of selected samples before the current frame
  16916. @item samples_n @emph{(audio only)}
  16917. the number of samples in the current frame
  16918. @item sample_rate @emph{(audio only)}
  16919. the input sample rate
  16920. @item key
  16921. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  16922. @item pos
  16923. the position in the file of the filtered frame, -1 if the information
  16924. is not available (e.g. for synthetic video)
  16925. @item scene @emph{(video only)}
  16926. value between 0 and 1 to indicate a new scene; a low value reflects a low
  16927. probability for the current frame to introduce a new scene, while a higher
  16928. value means the current frame is more likely to be one (see the example below)
  16929. @item concatdec_select
  16930. The concat demuxer can select only part of a concat input file by setting an
  16931. inpoint and an outpoint, but the output packets may not be entirely contained
  16932. in the selected interval. By using this variable, it is possible to skip frames
  16933. generated by the concat demuxer which are not exactly contained in the selected
  16934. interval.
  16935. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  16936. and the @var{lavf.concat.duration} packet metadata values which are also
  16937. present in the decoded frames.
  16938. The @var{concatdec_select} variable is -1 if the frame pts is at least
  16939. start_time and either the duration metadata is missing or the frame pts is less
  16940. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  16941. missing.
  16942. That basically means that an input frame is selected if its pts is within the
  16943. interval set by the concat demuxer.
  16944. @end table
  16945. The default value of the select expression is "1".
  16946. @subsection Examples
  16947. @itemize
  16948. @item
  16949. Select all frames in input:
  16950. @example
  16951. select
  16952. @end example
  16953. The example above is the same as:
  16954. @example
  16955. select=1
  16956. @end example
  16957. @item
  16958. Skip all frames:
  16959. @example
  16960. select=0
  16961. @end example
  16962. @item
  16963. Select only I-frames:
  16964. @example
  16965. select='eq(pict_type\,I)'
  16966. @end example
  16967. @item
  16968. Select one frame every 100:
  16969. @example
  16970. select='not(mod(n\,100))'
  16971. @end example
  16972. @item
  16973. Select only frames contained in the 10-20 time interval:
  16974. @example
  16975. select=between(t\,10\,20)
  16976. @end example
  16977. @item
  16978. Select only I-frames contained in the 10-20 time interval:
  16979. @example
  16980. select=between(t\,10\,20)*eq(pict_type\,I)
  16981. @end example
  16982. @item
  16983. Select frames with a minimum distance of 10 seconds:
  16984. @example
  16985. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  16986. @end example
  16987. @item
  16988. Use aselect to select only audio frames with samples number > 100:
  16989. @example
  16990. aselect='gt(samples_n\,100)'
  16991. @end example
  16992. @item
  16993. Create a mosaic of the first scenes:
  16994. @example
  16995. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  16996. @end example
  16997. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  16998. choice.
  16999. @item
  17000. Send even and odd frames to separate outputs, and compose them:
  17001. @example
  17002. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  17003. @end example
  17004. @item
  17005. Select useful frames from an ffconcat file which is using inpoints and
  17006. outpoints but where the source files are not intra frame only.
  17007. @example
  17008. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  17009. @end example
  17010. @end itemize
  17011. @section sendcmd, asendcmd
  17012. Send commands to filters in the filtergraph.
  17013. These filters read commands to be sent to other filters in the
  17014. filtergraph.
  17015. @code{sendcmd} must be inserted between two video filters,
  17016. @code{asendcmd} must be inserted between two audio filters, but apart
  17017. from that they act the same way.
  17018. The specification of commands can be provided in the filter arguments
  17019. with the @var{commands} option, or in a file specified by the
  17020. @var{filename} option.
  17021. These filters accept the following options:
  17022. @table @option
  17023. @item commands, c
  17024. Set the commands to be read and sent to the other filters.
  17025. @item filename, f
  17026. Set the filename of the commands to be read and sent to the other
  17027. filters.
  17028. @end table
  17029. @subsection Commands syntax
  17030. A commands description consists of a sequence of interval
  17031. specifications, comprising a list of commands to be executed when a
  17032. particular event related to that interval occurs. The occurring event
  17033. is typically the current frame time entering or leaving a given time
  17034. interval.
  17035. An interval is specified by the following syntax:
  17036. @example
  17037. @var{START}[-@var{END}] @var{COMMANDS};
  17038. @end example
  17039. The time interval is specified by the @var{START} and @var{END} times.
  17040. @var{END} is optional and defaults to the maximum time.
  17041. The current frame time is considered within the specified interval if
  17042. it is included in the interval [@var{START}, @var{END}), that is when
  17043. the time is greater or equal to @var{START} and is lesser than
  17044. @var{END}.
  17045. @var{COMMANDS} consists of a sequence of one or more command
  17046. specifications, separated by ",", relating to that interval. The
  17047. syntax of a command specification is given by:
  17048. @example
  17049. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  17050. @end example
  17051. @var{FLAGS} is optional and specifies the type of events relating to
  17052. the time interval which enable sending the specified command, and must
  17053. be a non-null sequence of identifier flags separated by "+" or "|" and
  17054. enclosed between "[" and "]".
  17055. The following flags are recognized:
  17056. @table @option
  17057. @item enter
  17058. The command is sent when the current frame timestamp enters the
  17059. specified interval. In other words, the command is sent when the
  17060. previous frame timestamp was not in the given interval, and the
  17061. current is.
  17062. @item leave
  17063. The command is sent when the current frame timestamp leaves the
  17064. specified interval. In other words, the command is sent when the
  17065. previous frame timestamp was in the given interval, and the
  17066. current is not.
  17067. @end table
  17068. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  17069. assumed.
  17070. @var{TARGET} specifies the target of the command, usually the name of
  17071. the filter class or a specific filter instance name.
  17072. @var{COMMAND} specifies the name of the command for the target filter.
  17073. @var{ARG} is optional and specifies the optional list of argument for
  17074. the given @var{COMMAND}.
  17075. Between one interval specification and another, whitespaces, or
  17076. sequences of characters starting with @code{#} until the end of line,
  17077. are ignored and can be used to annotate comments.
  17078. A simplified BNF description of the commands specification syntax
  17079. follows:
  17080. @example
  17081. @var{COMMAND_FLAG} ::= "enter" | "leave"
  17082. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  17083. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  17084. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  17085. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  17086. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  17087. @end example
  17088. @subsection Examples
  17089. @itemize
  17090. @item
  17091. Specify audio tempo change at second 4:
  17092. @example
  17093. asendcmd=c='4.0 atempo tempo 1.5',atempo
  17094. @end example
  17095. @item
  17096. Target a specific filter instance:
  17097. @example
  17098. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  17099. @end example
  17100. @item
  17101. Specify a list of drawtext and hue commands in a file.
  17102. @example
  17103. # show text in the interval 5-10
  17104. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  17105. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  17106. # desaturate the image in the interval 15-20
  17107. 15.0-20.0 [enter] hue s 0,
  17108. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  17109. [leave] hue s 1,
  17110. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  17111. # apply an exponential saturation fade-out effect, starting from time 25
  17112. 25 [enter] hue s exp(25-t)
  17113. @end example
  17114. A filtergraph allowing to read and process the above command list
  17115. stored in a file @file{test.cmd}, can be specified with:
  17116. @example
  17117. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  17118. @end example
  17119. @end itemize
  17120. @anchor{setpts}
  17121. @section setpts, asetpts
  17122. Change the PTS (presentation timestamp) of the input frames.
  17123. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  17124. This filter accepts the following options:
  17125. @table @option
  17126. @item expr
  17127. The expression which is evaluated for each frame to construct its timestamp.
  17128. @end table
  17129. The expression is evaluated through the eval API and can contain the following
  17130. constants:
  17131. @table @option
  17132. @item FRAME_RATE, FR
  17133. frame rate, only defined for constant frame-rate video
  17134. @item PTS
  17135. The presentation timestamp in input
  17136. @item N
  17137. The count of the input frame for video or the number of consumed samples,
  17138. not including the current frame for audio, starting from 0.
  17139. @item NB_CONSUMED_SAMPLES
  17140. The number of consumed samples, not including the current frame (only
  17141. audio)
  17142. @item NB_SAMPLES, S
  17143. The number of samples in the current frame (only audio)
  17144. @item SAMPLE_RATE, SR
  17145. The audio sample rate.
  17146. @item STARTPTS
  17147. The PTS of the first frame.
  17148. @item STARTT
  17149. the time in seconds of the first frame
  17150. @item INTERLACED
  17151. State whether the current frame is interlaced.
  17152. @item T
  17153. the time in seconds of the current frame
  17154. @item POS
  17155. original position in the file of the frame, or undefined if undefined
  17156. for the current frame
  17157. @item PREV_INPTS
  17158. The previous input PTS.
  17159. @item PREV_INT
  17160. previous input time in seconds
  17161. @item PREV_OUTPTS
  17162. The previous output PTS.
  17163. @item PREV_OUTT
  17164. previous output time in seconds
  17165. @item RTCTIME
  17166. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  17167. instead.
  17168. @item RTCSTART
  17169. The wallclock (RTC) time at the start of the movie in microseconds.
  17170. @item TB
  17171. The timebase of the input timestamps.
  17172. @end table
  17173. @subsection Examples
  17174. @itemize
  17175. @item
  17176. Start counting PTS from zero
  17177. @example
  17178. setpts=PTS-STARTPTS
  17179. @end example
  17180. @item
  17181. Apply fast motion effect:
  17182. @example
  17183. setpts=0.5*PTS
  17184. @end example
  17185. @item
  17186. Apply slow motion effect:
  17187. @example
  17188. setpts=2.0*PTS
  17189. @end example
  17190. @item
  17191. Set fixed rate of 25 frames per second:
  17192. @example
  17193. setpts=N/(25*TB)
  17194. @end example
  17195. @item
  17196. Set fixed rate 25 fps with some jitter:
  17197. @example
  17198. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  17199. @end example
  17200. @item
  17201. Apply an offset of 10 seconds to the input PTS:
  17202. @example
  17203. setpts=PTS+10/TB
  17204. @end example
  17205. @item
  17206. Generate timestamps from a "live source" and rebase onto the current timebase:
  17207. @example
  17208. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  17209. @end example
  17210. @item
  17211. Generate timestamps by counting samples:
  17212. @example
  17213. asetpts=N/SR/TB
  17214. @end example
  17215. @end itemize
  17216. @section setrange
  17217. Force color range for the output video frame.
  17218. The @code{setrange} filter marks the color range property for the
  17219. output frames. It does not change the input frame, but only sets the
  17220. corresponding property, which affects how the frame is treated by
  17221. following filters.
  17222. The filter accepts the following options:
  17223. @table @option
  17224. @item range
  17225. Available values are:
  17226. @table @samp
  17227. @item auto
  17228. Keep the same color range property.
  17229. @item unspecified, unknown
  17230. Set the color range as unspecified.
  17231. @item limited, tv, mpeg
  17232. Set the color range as limited.
  17233. @item full, pc, jpeg
  17234. Set the color range as full.
  17235. @end table
  17236. @end table
  17237. @section settb, asettb
  17238. Set the timebase to use for the output frames timestamps.
  17239. It is mainly useful for testing timebase configuration.
  17240. It accepts the following parameters:
  17241. @table @option
  17242. @item expr, tb
  17243. The expression which is evaluated into the output timebase.
  17244. @end table
  17245. The value for @option{tb} is an arithmetic expression representing a
  17246. rational. The expression can contain the constants "AVTB" (the default
  17247. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  17248. audio only). Default value is "intb".
  17249. @subsection Examples
  17250. @itemize
  17251. @item
  17252. Set the timebase to 1/25:
  17253. @example
  17254. settb=expr=1/25
  17255. @end example
  17256. @item
  17257. Set the timebase to 1/10:
  17258. @example
  17259. settb=expr=0.1
  17260. @end example
  17261. @item
  17262. Set the timebase to 1001/1000:
  17263. @example
  17264. settb=1+0.001
  17265. @end example
  17266. @item
  17267. Set the timebase to 2*intb:
  17268. @example
  17269. settb=2*intb
  17270. @end example
  17271. @item
  17272. Set the default timebase value:
  17273. @example
  17274. settb=AVTB
  17275. @end example
  17276. @end itemize
  17277. @section showcqt
  17278. Convert input audio to a video output representing frequency spectrum
  17279. logarithmically using Brown-Puckette constant Q transform algorithm with
  17280. direct frequency domain coefficient calculation (but the transform itself
  17281. is not really constant Q, instead the Q factor is actually variable/clamped),
  17282. with musical tone scale, from E0 to D#10.
  17283. The filter accepts the following options:
  17284. @table @option
  17285. @item size, s
  17286. Specify the video size for the output. It must be even. For the syntax of this option,
  17287. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17288. Default value is @code{1920x1080}.
  17289. @item fps, rate, r
  17290. Set the output frame rate. Default value is @code{25}.
  17291. @item bar_h
  17292. Set the bargraph height. It must be even. Default value is @code{-1} which
  17293. computes the bargraph height automatically.
  17294. @item axis_h
  17295. Set the axis height. It must be even. Default value is @code{-1} which computes
  17296. the axis height automatically.
  17297. @item sono_h
  17298. Set the sonogram height. It must be even. Default value is @code{-1} which
  17299. computes the sonogram height automatically.
  17300. @item fullhd
  17301. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  17302. instead. Default value is @code{1}.
  17303. @item sono_v, volume
  17304. Specify the sonogram volume expression. It can contain variables:
  17305. @table @option
  17306. @item bar_v
  17307. the @var{bar_v} evaluated expression
  17308. @item frequency, freq, f
  17309. the frequency where it is evaluated
  17310. @item timeclamp, tc
  17311. the value of @var{timeclamp} option
  17312. @end table
  17313. and functions:
  17314. @table @option
  17315. @item a_weighting(f)
  17316. A-weighting of equal loudness
  17317. @item b_weighting(f)
  17318. B-weighting of equal loudness
  17319. @item c_weighting(f)
  17320. C-weighting of equal loudness.
  17321. @end table
  17322. Default value is @code{16}.
  17323. @item bar_v, volume2
  17324. Specify the bargraph volume expression. It can contain variables:
  17325. @table @option
  17326. @item sono_v
  17327. the @var{sono_v} evaluated expression
  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. and functions:
  17334. @table @option
  17335. @item a_weighting(f)
  17336. A-weighting of equal loudness
  17337. @item b_weighting(f)
  17338. B-weighting of equal loudness
  17339. @item c_weighting(f)
  17340. C-weighting of equal loudness.
  17341. @end table
  17342. Default value is @code{sono_v}.
  17343. @item sono_g, gamma
  17344. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  17345. higher gamma makes the spectrum having more range. Default value is @code{3}.
  17346. Acceptable range is @code{[1, 7]}.
  17347. @item bar_g, gamma2
  17348. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  17349. @code{[1, 7]}.
  17350. @item bar_t
  17351. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  17352. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  17353. @item timeclamp, tc
  17354. Specify the transform timeclamp. At low frequency, there is trade-off between
  17355. accuracy in time domain and frequency domain. If timeclamp is lower,
  17356. event in time domain is represented more accurately (such as fast bass drum),
  17357. otherwise event in frequency domain is represented more accurately
  17358. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  17359. @item attack
  17360. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  17361. limits future samples by applying asymmetric windowing in time domain, useful
  17362. when low latency is required. Accepted range is @code{[0, 1]}.
  17363. @item basefreq
  17364. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  17365. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  17366. @item endfreq
  17367. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  17368. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  17369. @item coeffclamp
  17370. This option is deprecated and ignored.
  17371. @item tlength
  17372. Specify the transform length in time domain. Use this option to control accuracy
  17373. trade-off between time domain and frequency domain at every frequency sample.
  17374. It can contain variables:
  17375. @table @option
  17376. @item frequency, freq, f
  17377. the frequency where it is evaluated
  17378. @item timeclamp, tc
  17379. the value of @var{timeclamp} option.
  17380. @end table
  17381. Default value is @code{384*tc/(384+tc*f)}.
  17382. @item count
  17383. Specify the transform count for every video frame. Default value is @code{6}.
  17384. Acceptable range is @code{[1, 30]}.
  17385. @item fcount
  17386. Specify the transform count for every single pixel. Default value is @code{0},
  17387. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  17388. @item fontfile
  17389. Specify font file for use with freetype to draw the axis. If not specified,
  17390. use embedded font. Note that drawing with font file or embedded font is not
  17391. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  17392. option instead.
  17393. @item font
  17394. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  17395. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  17396. escaping.
  17397. @item fontcolor
  17398. Specify font color expression. This is arithmetic expression that should return
  17399. integer value 0xRRGGBB. It can contain variables:
  17400. @table @option
  17401. @item frequency, freq, f
  17402. the frequency where it is evaluated
  17403. @item timeclamp, tc
  17404. the value of @var{timeclamp} option
  17405. @end table
  17406. and functions:
  17407. @table @option
  17408. @item midi(f)
  17409. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  17410. @item r(x), g(x), b(x)
  17411. red, green, and blue value of intensity x.
  17412. @end table
  17413. Default value is @code{st(0, (midi(f)-59.5)/12);
  17414. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  17415. r(1-ld(1)) + b(ld(1))}.
  17416. @item axisfile
  17417. Specify image file to draw the axis. This option override @var{fontfile} and
  17418. @var{fontcolor} option.
  17419. @item axis, text
  17420. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  17421. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  17422. Default value is @code{1}.
  17423. @item csp
  17424. Set colorspace. The accepted values are:
  17425. @table @samp
  17426. @item unspecified
  17427. Unspecified (default)
  17428. @item bt709
  17429. BT.709
  17430. @item fcc
  17431. FCC
  17432. @item bt470bg
  17433. BT.470BG or BT.601-6 625
  17434. @item smpte170m
  17435. SMPTE-170M or BT.601-6 525
  17436. @item smpte240m
  17437. SMPTE-240M
  17438. @item bt2020ncl
  17439. BT.2020 with non-constant luminance
  17440. @end table
  17441. @item cscheme
  17442. Set spectrogram color scheme. This is list of floating point values with format
  17443. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  17444. The default is @code{1|0.5|0|0|0.5|1}.
  17445. @end table
  17446. @subsection Examples
  17447. @itemize
  17448. @item
  17449. Playing audio while showing the spectrum:
  17450. @example
  17451. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  17452. @end example
  17453. @item
  17454. Same as above, but with frame rate 30 fps:
  17455. @example
  17456. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  17457. @end example
  17458. @item
  17459. Playing at 1280x720:
  17460. @example
  17461. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  17462. @end example
  17463. @item
  17464. Disable sonogram display:
  17465. @example
  17466. sono_h=0
  17467. @end example
  17468. @item
  17469. A1 and its harmonics: A1, A2, (near)E3, A3:
  17470. @example
  17471. 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),
  17472. asplit[a][out1]; [a] showcqt [out0]'
  17473. @end example
  17474. @item
  17475. Same as above, but with more accuracy in frequency domain:
  17476. @example
  17477. 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),
  17478. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  17479. @end example
  17480. @item
  17481. Custom volume:
  17482. @example
  17483. bar_v=10:sono_v=bar_v*a_weighting(f)
  17484. @end example
  17485. @item
  17486. Custom gamma, now spectrum is linear to the amplitude.
  17487. @example
  17488. bar_g=2:sono_g=2
  17489. @end example
  17490. @item
  17491. Custom tlength equation:
  17492. @example
  17493. 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)))'
  17494. @end example
  17495. @item
  17496. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  17497. @example
  17498. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  17499. @end example
  17500. @item
  17501. Custom font using fontconfig:
  17502. @example
  17503. font='Courier New,Monospace,mono|bold'
  17504. @end example
  17505. @item
  17506. Custom frequency range with custom axis using image file:
  17507. @example
  17508. axisfile=myaxis.png:basefreq=40:endfreq=10000
  17509. @end example
  17510. @end itemize
  17511. @section showfreqs
  17512. Convert input audio to video output representing the audio power spectrum.
  17513. Audio amplitude is on Y-axis while frequency is on X-axis.
  17514. The filter accepts the following options:
  17515. @table @option
  17516. @item size, s
  17517. Specify size of video. For the syntax of this option, check the
  17518. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17519. Default is @code{1024x512}.
  17520. @item mode
  17521. Set display mode.
  17522. This set how each frequency bin will be represented.
  17523. It accepts the following values:
  17524. @table @samp
  17525. @item line
  17526. @item bar
  17527. @item dot
  17528. @end table
  17529. Default is @code{bar}.
  17530. @item ascale
  17531. Set amplitude scale.
  17532. It accepts the following values:
  17533. @table @samp
  17534. @item lin
  17535. Linear scale.
  17536. @item sqrt
  17537. Square root scale.
  17538. @item cbrt
  17539. Cubic root scale.
  17540. @item log
  17541. Logarithmic scale.
  17542. @end table
  17543. Default is @code{log}.
  17544. @item fscale
  17545. Set frequency scale.
  17546. It accepts the following values:
  17547. @table @samp
  17548. @item lin
  17549. Linear scale.
  17550. @item log
  17551. Logarithmic scale.
  17552. @item rlog
  17553. Reverse logarithmic scale.
  17554. @end table
  17555. Default is @code{lin}.
  17556. @item win_size
  17557. Set window size. Allowed range is from 16 to 65536.
  17558. Default is @code{2048}
  17559. @item win_func
  17560. Set windowing function.
  17561. It accepts the following values:
  17562. @table @samp
  17563. @item rect
  17564. @item bartlett
  17565. @item hanning
  17566. @item hamming
  17567. @item blackman
  17568. @item welch
  17569. @item flattop
  17570. @item bharris
  17571. @item bnuttall
  17572. @item bhann
  17573. @item sine
  17574. @item nuttall
  17575. @item lanczos
  17576. @item gauss
  17577. @item tukey
  17578. @item dolph
  17579. @item cauchy
  17580. @item parzen
  17581. @item poisson
  17582. @item bohman
  17583. @end table
  17584. Default is @code{hanning}.
  17585. @item overlap
  17586. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17587. which means optimal overlap for selected window function will be picked.
  17588. @item averaging
  17589. Set time averaging. Setting this to 0 will display current maximal peaks.
  17590. Default is @code{1}, which means time averaging is disabled.
  17591. @item colors
  17592. Specify list of colors separated by space or by '|' which will be used to
  17593. draw channel frequencies. Unrecognized or missing colors will be replaced
  17594. by white color.
  17595. @item cmode
  17596. Set channel display mode.
  17597. It accepts the following values:
  17598. @table @samp
  17599. @item combined
  17600. @item separate
  17601. @end table
  17602. Default is @code{combined}.
  17603. @item minamp
  17604. Set minimum amplitude used in @code{log} amplitude scaler.
  17605. @end table
  17606. @section showspatial
  17607. Convert stereo input audio to a video output, representing the spatial relationship
  17608. between two channels.
  17609. The filter accepts the following options:
  17610. @table @option
  17611. @item size, s
  17612. Specify the video size for the output. For the syntax of this option, check the
  17613. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17614. Default value is @code{512x512}.
  17615. @item win_size
  17616. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  17617. @item win_func
  17618. Set window function.
  17619. It accepts the following values:
  17620. @table @samp
  17621. @item rect
  17622. @item bartlett
  17623. @item hann
  17624. @item hanning
  17625. @item hamming
  17626. @item blackman
  17627. @item welch
  17628. @item flattop
  17629. @item bharris
  17630. @item bnuttall
  17631. @item bhann
  17632. @item sine
  17633. @item nuttall
  17634. @item lanczos
  17635. @item gauss
  17636. @item tukey
  17637. @item dolph
  17638. @item cauchy
  17639. @item parzen
  17640. @item poisson
  17641. @item bohman
  17642. @end table
  17643. Default value is @code{hann}.
  17644. @item overlap
  17645. Set ratio of overlap window. Default value is @code{0.5}.
  17646. When value is @code{1} overlap is set to recommended size for specific
  17647. window function currently used.
  17648. @end table
  17649. @anchor{showspectrum}
  17650. @section showspectrum
  17651. Convert input audio to a video output, representing the audio frequency
  17652. spectrum.
  17653. The filter accepts the following options:
  17654. @table @option
  17655. @item size, s
  17656. Specify the video size for the output. For the syntax of this option, check the
  17657. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17658. Default value is @code{640x512}.
  17659. @item slide
  17660. Specify how the spectrum should slide along the window.
  17661. It accepts the following values:
  17662. @table @samp
  17663. @item replace
  17664. the samples start again on the left when they reach the right
  17665. @item scroll
  17666. the samples scroll from right to left
  17667. @item fullframe
  17668. frames are only produced when the samples reach the right
  17669. @item rscroll
  17670. the samples scroll from left to right
  17671. @end table
  17672. Default value is @code{replace}.
  17673. @item mode
  17674. Specify display mode.
  17675. It accepts the following values:
  17676. @table @samp
  17677. @item combined
  17678. all channels are displayed in the same row
  17679. @item separate
  17680. all channels are displayed in separate rows
  17681. @end table
  17682. Default value is @samp{combined}.
  17683. @item color
  17684. Specify display color mode.
  17685. It accepts the following values:
  17686. @table @samp
  17687. @item channel
  17688. each channel is displayed in a separate color
  17689. @item intensity
  17690. each channel is displayed using the same color scheme
  17691. @item rainbow
  17692. each channel is displayed using the rainbow color scheme
  17693. @item moreland
  17694. each channel is displayed using the moreland color scheme
  17695. @item nebulae
  17696. each channel is displayed using the nebulae color scheme
  17697. @item fire
  17698. each channel is displayed using the fire color scheme
  17699. @item fiery
  17700. each channel is displayed using the fiery color scheme
  17701. @item fruit
  17702. each channel is displayed using the fruit color scheme
  17703. @item cool
  17704. each channel is displayed using the cool color scheme
  17705. @item magma
  17706. each channel is displayed using the magma color scheme
  17707. @item green
  17708. each channel is displayed using the green color scheme
  17709. @item viridis
  17710. each channel is displayed using the viridis color scheme
  17711. @item plasma
  17712. each channel is displayed using the plasma color scheme
  17713. @item cividis
  17714. each channel is displayed using the cividis color scheme
  17715. @item terrain
  17716. each channel is displayed using the terrain color scheme
  17717. @end table
  17718. Default value is @samp{channel}.
  17719. @item scale
  17720. Specify scale used for calculating intensity color values.
  17721. It accepts the following values:
  17722. @table @samp
  17723. @item lin
  17724. linear
  17725. @item sqrt
  17726. square root, default
  17727. @item cbrt
  17728. cubic root
  17729. @item log
  17730. logarithmic
  17731. @item 4thrt
  17732. 4th root
  17733. @item 5thrt
  17734. 5th root
  17735. @end table
  17736. Default value is @samp{sqrt}.
  17737. @item fscale
  17738. Specify frequency scale.
  17739. It accepts the following values:
  17740. @table @samp
  17741. @item lin
  17742. linear
  17743. @item log
  17744. logarithmic
  17745. @end table
  17746. Default value is @samp{lin}.
  17747. @item saturation
  17748. Set saturation modifier for displayed colors. Negative values provide
  17749. alternative color scheme. @code{0} is no saturation at all.
  17750. Saturation must be in [-10.0, 10.0] range.
  17751. Default value is @code{1}.
  17752. @item win_func
  17753. Set window function.
  17754. It accepts the following values:
  17755. @table @samp
  17756. @item rect
  17757. @item bartlett
  17758. @item hann
  17759. @item hanning
  17760. @item hamming
  17761. @item blackman
  17762. @item welch
  17763. @item flattop
  17764. @item bharris
  17765. @item bnuttall
  17766. @item bhann
  17767. @item sine
  17768. @item nuttall
  17769. @item lanczos
  17770. @item gauss
  17771. @item tukey
  17772. @item dolph
  17773. @item cauchy
  17774. @item parzen
  17775. @item poisson
  17776. @item bohman
  17777. @end table
  17778. Default value is @code{hann}.
  17779. @item orientation
  17780. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17781. @code{horizontal}. Default is @code{vertical}.
  17782. @item overlap
  17783. Set ratio of overlap window. Default value is @code{0}.
  17784. When value is @code{1} overlap is set to recommended size for specific
  17785. window function currently used.
  17786. @item gain
  17787. Set scale gain for calculating intensity color values.
  17788. Default value is @code{1}.
  17789. @item data
  17790. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  17791. @item rotation
  17792. Set color rotation, must be in [-1.0, 1.0] range.
  17793. Default value is @code{0}.
  17794. @item start
  17795. Set start frequency from which to display spectrogram. Default is @code{0}.
  17796. @item stop
  17797. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17798. @item fps
  17799. Set upper frame rate limit. Default is @code{auto}, unlimited.
  17800. @item legend
  17801. Draw time and frequency axes and legends. Default is disabled.
  17802. @end table
  17803. The usage is very similar to the showwaves filter; see the examples in that
  17804. section.
  17805. @subsection Examples
  17806. @itemize
  17807. @item
  17808. Large window with logarithmic color scaling:
  17809. @example
  17810. showspectrum=s=1280x480:scale=log
  17811. @end example
  17812. @item
  17813. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  17814. @example
  17815. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  17816. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  17817. @end example
  17818. @end itemize
  17819. @section showspectrumpic
  17820. Convert input audio to a single video frame, representing the audio frequency
  17821. spectrum.
  17822. The filter accepts the following options:
  17823. @table @option
  17824. @item size, s
  17825. Specify the video size for the output. For the syntax of this option, check the
  17826. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17827. Default value is @code{4096x2048}.
  17828. @item mode
  17829. Specify display mode.
  17830. It accepts the following values:
  17831. @table @samp
  17832. @item combined
  17833. all channels are displayed in the same row
  17834. @item separate
  17835. all channels are displayed in separate rows
  17836. @end table
  17837. Default value is @samp{combined}.
  17838. @item color
  17839. Specify display color mode.
  17840. It accepts the following values:
  17841. @table @samp
  17842. @item channel
  17843. each channel is displayed in a separate color
  17844. @item intensity
  17845. each channel is displayed using the same color scheme
  17846. @item rainbow
  17847. each channel is displayed using the rainbow color scheme
  17848. @item moreland
  17849. each channel is displayed using the moreland color scheme
  17850. @item nebulae
  17851. each channel is displayed using the nebulae color scheme
  17852. @item fire
  17853. each channel is displayed using the fire color scheme
  17854. @item fiery
  17855. each channel is displayed using the fiery color scheme
  17856. @item fruit
  17857. each channel is displayed using the fruit color scheme
  17858. @item cool
  17859. each channel is displayed using the cool color scheme
  17860. @item magma
  17861. each channel is displayed using the magma color scheme
  17862. @item green
  17863. each channel is displayed using the green color scheme
  17864. @item viridis
  17865. each channel is displayed using the viridis color scheme
  17866. @item plasma
  17867. each channel is displayed using the plasma color scheme
  17868. @item cividis
  17869. each channel is displayed using the cividis color scheme
  17870. @item terrain
  17871. each channel is displayed using the terrain color scheme
  17872. @end table
  17873. Default value is @samp{intensity}.
  17874. @item scale
  17875. Specify scale used for calculating intensity color values.
  17876. It accepts the following values:
  17877. @table @samp
  17878. @item lin
  17879. linear
  17880. @item sqrt
  17881. square root, default
  17882. @item cbrt
  17883. cubic root
  17884. @item log
  17885. logarithmic
  17886. @item 4thrt
  17887. 4th root
  17888. @item 5thrt
  17889. 5th root
  17890. @end table
  17891. Default value is @samp{log}.
  17892. @item fscale
  17893. Specify frequency scale.
  17894. It accepts the following values:
  17895. @table @samp
  17896. @item lin
  17897. linear
  17898. @item log
  17899. logarithmic
  17900. @end table
  17901. Default value is @samp{lin}.
  17902. @item saturation
  17903. Set saturation modifier for displayed colors. Negative values provide
  17904. alternative color scheme. @code{0} is no saturation at all.
  17905. Saturation must be in [-10.0, 10.0] range.
  17906. Default value is @code{1}.
  17907. @item win_func
  17908. Set window function.
  17909. It accepts the following values:
  17910. @table @samp
  17911. @item rect
  17912. @item bartlett
  17913. @item hann
  17914. @item hanning
  17915. @item hamming
  17916. @item blackman
  17917. @item welch
  17918. @item flattop
  17919. @item bharris
  17920. @item bnuttall
  17921. @item bhann
  17922. @item sine
  17923. @item nuttall
  17924. @item lanczos
  17925. @item gauss
  17926. @item tukey
  17927. @item dolph
  17928. @item cauchy
  17929. @item parzen
  17930. @item poisson
  17931. @item bohman
  17932. @end table
  17933. Default value is @code{hann}.
  17934. @item orientation
  17935. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17936. @code{horizontal}. Default is @code{vertical}.
  17937. @item gain
  17938. Set scale gain for calculating intensity color values.
  17939. Default value is @code{1}.
  17940. @item legend
  17941. Draw time and frequency axes and legends. Default is enabled.
  17942. @item rotation
  17943. Set color rotation, must be in [-1.0, 1.0] range.
  17944. Default value is @code{0}.
  17945. @item start
  17946. Set start frequency from which to display spectrogram. Default is @code{0}.
  17947. @item stop
  17948. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17949. @end table
  17950. @subsection Examples
  17951. @itemize
  17952. @item
  17953. Extract an audio spectrogram of a whole audio track
  17954. in a 1024x1024 picture using @command{ffmpeg}:
  17955. @example
  17956. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  17957. @end example
  17958. @end itemize
  17959. @section showvolume
  17960. Convert input audio volume to a video output.
  17961. The filter accepts the following options:
  17962. @table @option
  17963. @item rate, r
  17964. Set video rate.
  17965. @item b
  17966. Set border width, allowed range is [0, 5]. Default is 1.
  17967. @item w
  17968. Set channel width, allowed range is [80, 8192]. Default is 400.
  17969. @item h
  17970. Set channel height, allowed range is [1, 900]. Default is 20.
  17971. @item f
  17972. Set fade, allowed range is [0, 1]. Default is 0.95.
  17973. @item c
  17974. Set volume color expression.
  17975. The expression can use the following variables:
  17976. @table @option
  17977. @item VOLUME
  17978. Current max volume of channel in dB.
  17979. @item PEAK
  17980. Current peak.
  17981. @item CHANNEL
  17982. Current channel number, starting from 0.
  17983. @end table
  17984. @item t
  17985. If set, displays channel names. Default is enabled.
  17986. @item v
  17987. If set, displays volume values. Default is enabled.
  17988. @item o
  17989. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  17990. default is @code{h}.
  17991. @item s
  17992. Set step size, allowed range is [0, 5]. Default is 0, which means
  17993. step is disabled.
  17994. @item p
  17995. Set background opacity, allowed range is [0, 1]. Default is 0.
  17996. @item m
  17997. Set metering mode, can be peak: @code{p} or rms: @code{r},
  17998. default is @code{p}.
  17999. @item ds
  18000. Set display scale, can be linear: @code{lin} or log: @code{log},
  18001. default is @code{lin}.
  18002. @item dm
  18003. In second.
  18004. If set to > 0., display a line for the max level
  18005. in the previous seconds.
  18006. default is disabled: @code{0.}
  18007. @item dmc
  18008. The color of the max line. Use when @code{dm} option is set to > 0.
  18009. default is: @code{orange}
  18010. @end table
  18011. @section showwaves
  18012. Convert input audio to a video output, representing the samples waves.
  18013. The filter accepts the following options:
  18014. @table @option
  18015. @item size, s
  18016. Specify the video size for the output. For the syntax of this option, check the
  18017. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18018. Default value is @code{600x240}.
  18019. @item mode
  18020. Set display mode.
  18021. Available values are:
  18022. @table @samp
  18023. @item point
  18024. Draw a point for each sample.
  18025. @item line
  18026. Draw a vertical line for each sample.
  18027. @item p2p
  18028. Draw a point for each sample and a line between them.
  18029. @item cline
  18030. Draw a centered vertical line for each sample.
  18031. @end table
  18032. Default value is @code{point}.
  18033. @item n
  18034. Set the number of samples which are printed on the same column. A
  18035. larger value will decrease the frame rate. Must be a positive
  18036. integer. This option can be set only if the value for @var{rate}
  18037. is not explicitly specified.
  18038. @item rate, r
  18039. Set the (approximate) output frame rate. This is done by setting the
  18040. option @var{n}. Default value is "25".
  18041. @item split_channels
  18042. Set if channels should be drawn separately or overlap. Default value is 0.
  18043. @item colors
  18044. Set colors separated by '|' which are going to be used for drawing of each channel.
  18045. @item scale
  18046. Set amplitude scale.
  18047. Available values are:
  18048. @table @samp
  18049. @item lin
  18050. Linear.
  18051. @item log
  18052. Logarithmic.
  18053. @item sqrt
  18054. Square root.
  18055. @item cbrt
  18056. Cubic root.
  18057. @end table
  18058. Default is linear.
  18059. @item draw
  18060. Set the draw mode. This is mostly useful to set for high @var{n}.
  18061. Available values are:
  18062. @table @samp
  18063. @item scale
  18064. Scale pixel values for each drawn sample.
  18065. @item full
  18066. Draw every sample directly.
  18067. @end table
  18068. Default value is @code{scale}.
  18069. @end table
  18070. @subsection Examples
  18071. @itemize
  18072. @item
  18073. Output the input file audio and the corresponding video representation
  18074. at the same time:
  18075. @example
  18076. amovie=a.mp3,asplit[out0],showwaves[out1]
  18077. @end example
  18078. @item
  18079. Create a synthetic signal and show it with showwaves, forcing a
  18080. frame rate of 30 frames per second:
  18081. @example
  18082. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  18083. @end example
  18084. @end itemize
  18085. @section showwavespic
  18086. Convert input audio to a single video frame, representing the samples waves.
  18087. The filter accepts the following options:
  18088. @table @option
  18089. @item size, s
  18090. Specify the video size for the output. For the syntax of this option, check the
  18091. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18092. Default value is @code{600x240}.
  18093. @item split_channels
  18094. Set if channels should be drawn separately or overlap. Default value is 0.
  18095. @item colors
  18096. Set colors separated by '|' which are going to be used for drawing of each channel.
  18097. @item scale
  18098. Set amplitude scale.
  18099. Available values are:
  18100. @table @samp
  18101. @item lin
  18102. Linear.
  18103. @item log
  18104. Logarithmic.
  18105. @item sqrt
  18106. Square root.
  18107. @item cbrt
  18108. Cubic root.
  18109. @end table
  18110. Default is linear.
  18111. @item draw
  18112. Set the draw mode.
  18113. Available values are:
  18114. @table @samp
  18115. @item scale
  18116. Scale pixel values for each drawn sample.
  18117. @item full
  18118. Draw every sample directly.
  18119. @end table
  18120. Default value is @code{scale}.
  18121. @end table
  18122. @subsection Examples
  18123. @itemize
  18124. @item
  18125. Extract a channel split representation of the wave form of a whole audio track
  18126. in a 1024x800 picture using @command{ffmpeg}:
  18127. @example
  18128. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  18129. @end example
  18130. @end itemize
  18131. @section sidedata, asidedata
  18132. Delete frame side data, or select frames based on it.
  18133. This filter accepts the following options:
  18134. @table @option
  18135. @item mode
  18136. Set mode of operation of the filter.
  18137. Can be one of the following:
  18138. @table @samp
  18139. @item select
  18140. Select every frame with side data of @code{type}.
  18141. @item delete
  18142. Delete side data of @code{type}. If @code{type} is not set, delete all side
  18143. data in the frame.
  18144. @end table
  18145. @item type
  18146. Set side data type used with all modes. Must be set for @code{select} mode. For
  18147. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  18148. in @file{libavutil/frame.h}. For example, to choose
  18149. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  18150. @end table
  18151. @section spectrumsynth
  18152. Synthesize audio from 2 input video spectrums, first input stream represents
  18153. magnitude across time and second represents phase across time.
  18154. The filter will transform from frequency domain as displayed in videos back
  18155. to time domain as presented in audio output.
  18156. This filter is primarily created for reversing processed @ref{showspectrum}
  18157. filter outputs, but can synthesize sound from other spectrograms too.
  18158. But in such case results are going to be poor if the phase data is not
  18159. available, because in such cases phase data need to be recreated, usually
  18160. it's just recreated from random noise.
  18161. For best results use gray only output (@code{channel} color mode in
  18162. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  18163. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  18164. @code{data} option. Inputs videos should generally use @code{fullframe}
  18165. slide mode as that saves resources needed for decoding video.
  18166. The filter accepts the following options:
  18167. @table @option
  18168. @item sample_rate
  18169. Specify sample rate of output audio, the sample rate of audio from which
  18170. spectrum was generated may differ.
  18171. @item channels
  18172. Set number of channels represented in input video spectrums.
  18173. @item scale
  18174. Set scale which was used when generating magnitude input spectrum.
  18175. Can be @code{lin} or @code{log}. Default is @code{log}.
  18176. @item slide
  18177. Set slide which was used when generating inputs spectrums.
  18178. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  18179. Default is @code{fullframe}.
  18180. @item win_func
  18181. Set window function used for resynthesis.
  18182. @item overlap
  18183. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  18184. which means optimal overlap for selected window function will be picked.
  18185. @item orientation
  18186. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  18187. Default is @code{vertical}.
  18188. @end table
  18189. @subsection Examples
  18190. @itemize
  18191. @item
  18192. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  18193. then resynthesize videos back to audio with spectrumsynth:
  18194. @example
  18195. 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
  18196. 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
  18197. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  18198. @end example
  18199. @end itemize
  18200. @section split, asplit
  18201. Split input into several identical outputs.
  18202. @code{asplit} works with audio input, @code{split} with video.
  18203. The filter accepts a single parameter which specifies the number of outputs. If
  18204. unspecified, it defaults to 2.
  18205. @subsection Examples
  18206. @itemize
  18207. @item
  18208. Create two separate outputs from the same input:
  18209. @example
  18210. [in] split [out0][out1]
  18211. @end example
  18212. @item
  18213. To create 3 or more outputs, you need to specify the number of
  18214. outputs, like in:
  18215. @example
  18216. [in] asplit=3 [out0][out1][out2]
  18217. @end example
  18218. @item
  18219. Create two separate outputs from the same input, one cropped and
  18220. one padded:
  18221. @example
  18222. [in] split [splitout1][splitout2];
  18223. [splitout1] crop=100:100:0:0 [cropout];
  18224. [splitout2] pad=200:200:100:100 [padout];
  18225. @end example
  18226. @item
  18227. Create 5 copies of the input audio with @command{ffmpeg}:
  18228. @example
  18229. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  18230. @end example
  18231. @end itemize
  18232. @section zmq, azmq
  18233. Receive commands sent through a libzmq client, and forward them to
  18234. filters in the filtergraph.
  18235. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  18236. must be inserted between two video filters, @code{azmq} between two
  18237. audio filters. Both are capable to send messages to any filter type.
  18238. To enable these filters you need to install the libzmq library and
  18239. headers and configure FFmpeg with @code{--enable-libzmq}.
  18240. For more information about libzmq see:
  18241. @url{http://www.zeromq.org/}
  18242. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  18243. receives messages sent through a network interface defined by the
  18244. @option{bind_address} (or the abbreviation "@option{b}") option.
  18245. Default value of this option is @file{tcp://localhost:5555}. You may
  18246. want to alter this value to your needs, but do not forget to escape any
  18247. ':' signs (see @ref{filtergraph escaping}).
  18248. The received message must be in the form:
  18249. @example
  18250. @var{TARGET} @var{COMMAND} [@var{ARG}]
  18251. @end example
  18252. @var{TARGET} specifies the target of the command, usually the name of
  18253. the filter class or a specific filter instance name. The default
  18254. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  18255. but you can override this by using the @samp{filter_name@@id} syntax
  18256. (see @ref{Filtergraph syntax}).
  18257. @var{COMMAND} specifies the name of the command for the target filter.
  18258. @var{ARG} is optional and specifies the optional argument list for the
  18259. given @var{COMMAND}.
  18260. Upon reception, the message is processed and the corresponding command
  18261. is injected into the filtergraph. Depending on the result, the filter
  18262. will send a reply to the client, adopting the format:
  18263. @example
  18264. @var{ERROR_CODE} @var{ERROR_REASON}
  18265. @var{MESSAGE}
  18266. @end example
  18267. @var{MESSAGE} is optional.
  18268. @subsection Examples
  18269. Look at @file{tools/zmqsend} for an example of a zmq client which can
  18270. be used to send commands processed by these filters.
  18271. Consider the following filtergraph generated by @command{ffplay}.
  18272. In this example the last overlay filter has an instance name. All other
  18273. filters will have default instance names.
  18274. @example
  18275. ffplay -dumpgraph 1 -f lavfi "
  18276. color=s=100x100:c=red [l];
  18277. color=s=100x100:c=blue [r];
  18278. nullsrc=s=200x100, zmq [bg];
  18279. [bg][l] overlay [bg+l];
  18280. [bg+l][r] overlay@@my=x=100 "
  18281. @end example
  18282. To change the color of the left side of the video, the following
  18283. command can be used:
  18284. @example
  18285. echo Parsed_color_0 c yellow | tools/zmqsend
  18286. @end example
  18287. To change the right side:
  18288. @example
  18289. echo Parsed_color_1 c pink | tools/zmqsend
  18290. @end example
  18291. To change the position of the right side:
  18292. @example
  18293. echo overlay@@my x 150 | tools/zmqsend
  18294. @end example
  18295. @c man end MULTIMEDIA FILTERS
  18296. @chapter Multimedia Sources
  18297. @c man begin MULTIMEDIA SOURCES
  18298. Below is a description of the currently available multimedia sources.
  18299. @section amovie
  18300. This is the same as @ref{movie} source, except it selects an audio
  18301. stream by default.
  18302. @anchor{movie}
  18303. @section movie
  18304. Read audio and/or video stream(s) from a movie container.
  18305. It accepts the following parameters:
  18306. @table @option
  18307. @item filename
  18308. The name of the resource to read (not necessarily a file; it can also be a
  18309. device or a stream accessed through some protocol).
  18310. @item format_name, f
  18311. Specifies the format assumed for the movie to read, and can be either
  18312. the name of a container or an input device. If not specified, the
  18313. format is guessed from @var{movie_name} or by probing.
  18314. @item seek_point, sp
  18315. Specifies the seek point in seconds. The frames will be output
  18316. starting from this seek point. The parameter is evaluated with
  18317. @code{av_strtod}, so the numerical value may be suffixed by an IS
  18318. postfix. The default value is "0".
  18319. @item streams, s
  18320. Specifies the streams to read. Several streams can be specified,
  18321. separated by "+". The source will then have as many outputs, in the
  18322. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  18323. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  18324. respectively the default (best suited) video and audio stream. Default
  18325. is "dv", or "da" if the filter is called as "amovie".
  18326. @item stream_index, si
  18327. Specifies the index of the video stream to read. If the value is -1,
  18328. the most suitable video stream will be automatically selected. The default
  18329. value is "-1". Deprecated. If the filter is called "amovie", it will select
  18330. audio instead of video.
  18331. @item loop
  18332. Specifies how many times to read the stream in sequence.
  18333. If the value is 0, the stream will be looped infinitely.
  18334. Default value is "1".
  18335. Note that when the movie is looped the source timestamps are not
  18336. changed, so it will generate non monotonically increasing timestamps.
  18337. @item discontinuity
  18338. Specifies the time difference between frames above which the point is
  18339. considered a timestamp discontinuity which is removed by adjusting the later
  18340. timestamps.
  18341. @end table
  18342. It allows overlaying a second video on top of the main input of
  18343. a filtergraph, as shown in this graph:
  18344. @example
  18345. input -----------> deltapts0 --> overlay --> output
  18346. ^
  18347. |
  18348. movie --> scale--> deltapts1 -------+
  18349. @end example
  18350. @subsection Examples
  18351. @itemize
  18352. @item
  18353. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  18354. on top of the input labelled "in":
  18355. @example
  18356. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  18357. [in] setpts=PTS-STARTPTS [main];
  18358. [main][over] overlay=16:16 [out]
  18359. @end example
  18360. @item
  18361. Read from a video4linux2 device, and overlay it on top of the input
  18362. labelled "in":
  18363. @example
  18364. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  18365. [in] setpts=PTS-STARTPTS [main];
  18366. [main][over] overlay=16:16 [out]
  18367. @end example
  18368. @item
  18369. Read the first video stream and the audio stream with id 0x81 from
  18370. dvd.vob; the video is connected to the pad named "video" and the audio is
  18371. connected to the pad named "audio":
  18372. @example
  18373. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  18374. @end example
  18375. @end itemize
  18376. @subsection Commands
  18377. Both movie and amovie support the following commands:
  18378. @table @option
  18379. @item seek
  18380. Perform seek using "av_seek_frame".
  18381. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  18382. @itemize
  18383. @item
  18384. @var{stream_index}: If stream_index is -1, a default
  18385. stream is selected, and @var{timestamp} is automatically converted
  18386. from AV_TIME_BASE units to the stream specific time_base.
  18387. @item
  18388. @var{timestamp}: Timestamp in AVStream.time_base units
  18389. or, if no stream is specified, in AV_TIME_BASE units.
  18390. @item
  18391. @var{flags}: Flags which select direction and seeking mode.
  18392. @end itemize
  18393. @item get_duration
  18394. Get movie duration in AV_TIME_BASE units.
  18395. @end table
  18396. @c man end MULTIMEDIA SOURCES