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.

24079 lines
639KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{framesync}
  252. @chapter Options for filters with several inputs (framesync)
  253. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  254. Some filters with several inputs support a common set of options.
  255. These options can only be set by name, not with the short notation.
  256. @table @option
  257. @item eof_action
  258. The action to take when EOF is encountered on the secondary input; it accepts
  259. one of the following values:
  260. @table @option
  261. @item repeat
  262. Repeat the last frame (the default).
  263. @item endall
  264. End both streams.
  265. @item pass
  266. Pass the main input through.
  267. @end table
  268. @item shortest
  269. If set to 1, force the output to terminate when the shortest input
  270. terminates. Default value is 0.
  271. @item repeatlast
  272. If set to 1, force the filter to extend the last frame of secondary streams
  273. until the end of the primary stream. A value of 0 disables this behavior.
  274. Default value is 1.
  275. @end table
  276. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  277. @chapter Audio Filters
  278. @c man begin AUDIO FILTERS
  279. When you configure your FFmpeg build, you can disable any of the
  280. existing filters using @code{--disable-filters}.
  281. The configure output will show the audio filters included in your
  282. build.
  283. Below is a description of the currently available audio filters.
  284. @section acompressor
  285. A compressor is mainly used to reduce the dynamic range of a signal.
  286. Especially modern music is mostly compressed at a high ratio to
  287. improve the overall loudness. It's done to get the highest attention
  288. of a listener, "fatten" the sound and bring more "power" to the track.
  289. If a signal is compressed too much it may sound dull or "dead"
  290. afterwards or it may start to "pump" (which could be a powerful effect
  291. but can also destroy a track completely).
  292. The right compression is the key to reach a professional sound and is
  293. the high art of mixing and mastering. Because of its complex settings
  294. it may take a long time to get the right feeling for this kind of effect.
  295. Compression is done by detecting the volume above a chosen level
  296. @code{threshold} and dividing it by the factor set with @code{ratio}.
  297. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  298. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  299. the signal would cause distortion of the waveform the reduction can be
  300. levelled over the time. This is done by setting "Attack" and "Release".
  301. @code{attack} determines how long the signal has to rise above the threshold
  302. before any reduction will occur and @code{release} sets the time the signal
  303. has to fall below the threshold to reduce the reduction again. Shorter signals
  304. than the chosen attack time will be left untouched.
  305. The overall reduction of the signal can be made up afterwards with the
  306. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  307. raising the makeup to this level results in a signal twice as loud than the
  308. source. To gain a softer entry in the compression the @code{knee} flattens the
  309. hard edge at the threshold in the range of the chosen decibels.
  310. The filter accepts the following options:
  311. @table @option
  312. @item level_in
  313. Set input gain. Default is 1. Range is between 0.015625 and 64.
  314. @item mode
  315. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  316. Default is @code{downward}.
  317. @item threshold
  318. If a signal of stream rises above this level it will affect the gain
  319. reduction.
  320. By default it is 0.125. Range is between 0.00097563 and 1.
  321. @item ratio
  322. Set a ratio by which the signal is reduced. 1:2 means that if the level
  323. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  324. Default is 2. Range is between 1 and 20.
  325. @item attack
  326. Amount of milliseconds the signal has to rise above the threshold before gain
  327. reduction starts. Default is 20. Range is between 0.01 and 2000.
  328. @item release
  329. Amount of milliseconds the signal has to fall below the threshold before
  330. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  331. @item makeup
  332. Set the amount by how much signal will be amplified after processing.
  333. Default is 1. Range is from 1 to 64.
  334. @item knee
  335. Curve the sharp knee around the threshold to enter gain reduction more softly.
  336. Default is 2.82843. Range is between 1 and 8.
  337. @item link
  338. Choose if the @code{average} level between all channels of input stream
  339. or the louder(@code{maximum}) channel of input stream affects the
  340. reduction. Default is @code{average}.
  341. @item detection
  342. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  343. of @code{rms}. Default is @code{rms} which is mostly smoother.
  344. @item mix
  345. How much to use compressed signal in output. Default is 1.
  346. Range is between 0 and 1.
  347. @end table
  348. @section acontrast
  349. Simple audio dynamic range compression/expansion filter.
  350. The filter accepts the following options:
  351. @table @option
  352. @item contrast
  353. Set contrast. Default is 33. Allowed range is between 0 and 100.
  354. @end table
  355. @section acopy
  356. Copy the input audio source unchanged to the output. This is mainly useful for
  357. testing purposes.
  358. @section acrossfade
  359. Apply cross fade from one input audio stream to another input audio stream.
  360. The cross fade is applied for specified duration near the end of first stream.
  361. The filter accepts the following options:
  362. @table @option
  363. @item nb_samples, ns
  364. Specify the number of samples for which the cross fade effect has to last.
  365. At the end of the cross fade effect the first input audio will be completely
  366. silent. Default is 44100.
  367. @item duration, d
  368. Specify the duration of the cross fade effect. See
  369. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  370. for the accepted syntax.
  371. By default the duration is determined by @var{nb_samples}.
  372. If set this option is used instead of @var{nb_samples}.
  373. @item overlap, o
  374. Should first stream end overlap with second stream start. Default is enabled.
  375. @item curve1
  376. Set curve for cross fade transition for first stream.
  377. @item curve2
  378. Set curve for cross fade transition for second stream.
  379. For description of available curve types see @ref{afade} filter description.
  380. @end table
  381. @subsection Examples
  382. @itemize
  383. @item
  384. Cross fade from one input to another:
  385. @example
  386. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  387. @end example
  388. @item
  389. Cross fade from one input to another but without overlapping:
  390. @example
  391. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  392. @end example
  393. @end itemize
  394. @section acrossover
  395. Split audio stream into several bands.
  396. This filter splits audio stream into two or more frequency ranges.
  397. Summing all streams back will give flat output.
  398. The filter accepts the following options:
  399. @table @option
  400. @item split
  401. Set split frequencies. Those must be positive and increasing.
  402. @item order
  403. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  404. Default is @var{4th}.
  405. @end table
  406. @section acrusher
  407. Reduce audio bit resolution.
  408. This filter is bit crusher with enhanced functionality. A bit crusher
  409. is used to audibly reduce number of bits an audio signal is sampled
  410. with. This doesn't change the bit depth at all, it just produces the
  411. effect. Material reduced in bit depth sounds more harsh and "digital".
  412. This filter is able to even round to continuous values instead of discrete
  413. bit depths.
  414. Additionally it has a D/C offset which results in different crushing of
  415. the lower and the upper half of the signal.
  416. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  417. Another feature of this filter is the logarithmic mode.
  418. This setting switches from linear distances between bits to logarithmic ones.
  419. The result is a much more "natural" sounding crusher which doesn't gate low
  420. signals for example. The human ear has a logarithmic perception,
  421. so this kind of crushing is much more pleasant.
  422. Logarithmic crushing is also able to get anti-aliased.
  423. The filter accepts the following options:
  424. @table @option
  425. @item level_in
  426. Set level in.
  427. @item level_out
  428. Set level out.
  429. @item bits
  430. Set bit reduction.
  431. @item mix
  432. Set mixing amount.
  433. @item mode
  434. Can be linear: @code{lin} or logarithmic: @code{log}.
  435. @item dc
  436. Set DC.
  437. @item aa
  438. Set anti-aliasing.
  439. @item samples
  440. Set sample reduction.
  441. @item lfo
  442. Enable LFO. By default disabled.
  443. @item lforange
  444. Set LFO range.
  445. @item lforate
  446. Set LFO rate.
  447. @end table
  448. @section acue
  449. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  450. filter.
  451. @section adeclick
  452. Remove impulsive noise from input audio.
  453. Samples detected as impulsive noise are replaced by interpolated samples using
  454. autoregressive modelling.
  455. @table @option
  456. @item w
  457. Set window size, in milliseconds. Allowed range is from @code{10} to
  458. @code{100}. Default value is @code{55} milliseconds.
  459. This sets size of window which will be processed at once.
  460. @item o
  461. Set window overlap, in percentage of window size. Allowed range is from
  462. @code{50} to @code{95}. Default value is @code{75} percent.
  463. Setting this to a very high value increases impulsive noise removal but makes
  464. whole process much slower.
  465. @item a
  466. Set autoregression order, in percentage of window size. Allowed range is from
  467. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  468. controls quality of interpolated samples using neighbour good samples.
  469. @item t
  470. Set threshold value. Allowed range is from @code{1} to @code{100}.
  471. Default value is @code{2}.
  472. This controls the strength of impulsive noise which is going to be removed.
  473. The lower value, the more samples will be detected as impulsive noise.
  474. @item b
  475. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  476. @code{10}. Default value is @code{2}.
  477. If any two samples detected as noise are spaced less than this value then any
  478. sample between those two samples will be also detected as noise.
  479. @item m
  480. Set overlap method.
  481. It accepts the following values:
  482. @table @option
  483. @item a
  484. Select overlap-add method. Even not interpolated samples are slightly
  485. changed with this method.
  486. @item s
  487. Select overlap-save method. Not interpolated samples remain unchanged.
  488. @end table
  489. Default value is @code{a}.
  490. @end table
  491. @section adeclip
  492. Remove clipped samples from input audio.
  493. Samples detected as clipped are replaced by interpolated samples using
  494. autoregressive modelling.
  495. @table @option
  496. @item w
  497. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  498. Default value is @code{55} milliseconds.
  499. This sets size of window which will be processed at once.
  500. @item o
  501. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  502. to @code{95}. Default value is @code{75} percent.
  503. @item a
  504. Set autoregression order, in percentage of window size. Allowed range is from
  505. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  506. quality of interpolated samples using neighbour good samples.
  507. @item t
  508. Set threshold value. Allowed range is from @code{1} to @code{100}.
  509. Default value is @code{10}. Higher values make clip detection less aggressive.
  510. @item n
  511. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  512. Default value is @code{1000}. Higher values make clip detection less aggressive.
  513. @item m
  514. Set overlap method.
  515. It accepts the following values:
  516. @table @option
  517. @item a
  518. Select overlap-add method. Even not interpolated samples are slightly changed
  519. with this method.
  520. @item s
  521. Select overlap-save method. Not interpolated samples remain unchanged.
  522. @end table
  523. Default value is @code{a}.
  524. @end table
  525. @section adelay
  526. Delay one or more audio channels.
  527. Samples in delayed channel are filled with silence.
  528. The filter accepts the following option:
  529. @table @option
  530. @item delays
  531. Set list of delays in milliseconds for each channel separated by '|'.
  532. Unused delays will be silently ignored. If number of given delays is
  533. smaller than number of channels all remaining channels will not be delayed.
  534. If you want to delay exact number of samples, append 'S' to number.
  535. If you want instead to delay in seconds, append 's' to number.
  536. @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. @end itemize
  901. @anchor{afir}
  902. @section afir
  903. Apply an arbitrary Frequency Impulse Response filter.
  904. This filter is designed for applying long FIR filters,
  905. up to 60 seconds long.
  906. It can be used as component for digital crossover filters,
  907. room equalization, cross talk cancellation, wavefield synthesis,
  908. auralization, ambiophonics, ambisonics and spatialization.
  909. This filter uses the second stream as FIR coefficients.
  910. If the second stream holds a single channel, it will be used
  911. for all input channels in the first stream, otherwise
  912. the number of channels in the second stream must be same as
  913. the number of channels in the first stream.
  914. It accepts the following parameters:
  915. @table @option
  916. @item dry
  917. Set dry gain. This sets input gain.
  918. @item wet
  919. Set wet gain. This sets final output gain.
  920. @item length
  921. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  922. @item gtype
  923. Enable applying gain measured from power of IR.
  924. Set which approach to use for auto gain measurement.
  925. @table @option
  926. @item none
  927. Do not apply any gain.
  928. @item peak
  929. select peak gain, very conservative approach. This is default value.
  930. @item dc
  931. select DC gain, limited application.
  932. @item gn
  933. select gain to noise approach, this is most popular one.
  934. @end table
  935. @item irgain
  936. Set gain to be applied to IR coefficients before filtering.
  937. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  938. @item irfmt
  939. Set format of IR stream. Can be @code{mono} or @code{input}.
  940. Default is @code{input}.
  941. @item maxir
  942. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  943. Allowed range is 0.1 to 60 seconds.
  944. @item response
  945. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  946. By default it is disabled.
  947. @item channel
  948. Set for which IR channel to display frequency response. By default is first channel
  949. displayed. This option is used only when @var{response} is enabled.
  950. @item size
  951. Set video stream size. This option is used only when @var{response} is enabled.
  952. @item rate
  953. Set video stream frame rate. This option is used only when @var{response} is enabled.
  954. @item minp
  955. Set minimal partition size used for convolution. Default is @var{8192}.
  956. Allowed range is from @var{8} to @var{32768}.
  957. Lower values decreases latency at cost of higher CPU usage.
  958. @item maxp
  959. Set maximal partition size used for convolution. Default is @var{8192}.
  960. Allowed range is from @var{8} to @var{32768}.
  961. Lower values may increase CPU usage.
  962. @end table
  963. @subsection Examples
  964. @itemize
  965. @item
  966. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  967. @example
  968. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  969. @end example
  970. @end itemize
  971. @anchor{aformat}
  972. @section aformat
  973. Set output format constraints for the input audio. The framework will
  974. negotiate the most appropriate format to minimize conversions.
  975. It accepts the following parameters:
  976. @table @option
  977. @item sample_fmts
  978. A '|'-separated list of requested sample formats.
  979. @item sample_rates
  980. A '|'-separated list of requested sample rates.
  981. @item channel_layouts
  982. A '|'-separated list of requested channel layouts.
  983. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  984. for the required syntax.
  985. @end table
  986. If a parameter is omitted, all values are allowed.
  987. Force the output to either unsigned 8-bit or signed 16-bit stereo
  988. @example
  989. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  990. @end example
  991. @section agate
  992. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  993. processing reduces disturbing noise between useful signals.
  994. Gating is done by detecting the volume below a chosen level @var{threshold}
  995. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  996. floor is set via @var{range}. Because an exact manipulation of the signal
  997. would cause distortion of the waveform the reduction can be levelled over
  998. time. This is done by setting @var{attack} and @var{release}.
  999. @var{attack} determines how long the signal has to fall below the threshold
  1000. before any reduction will occur and @var{release} sets the time the signal
  1001. has to rise above the threshold to reduce the reduction again.
  1002. Shorter signals than the chosen attack time will be left untouched.
  1003. @table @option
  1004. @item level_in
  1005. Set input level before filtering.
  1006. Default is 1. Allowed range is from 0.015625 to 64.
  1007. @item mode
  1008. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1009. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1010. will be amplified, expanding dynamic range in upward direction.
  1011. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1012. @item range
  1013. Set the level of gain reduction when the signal is below the threshold.
  1014. Default is 0.06125. Allowed range is from 0 to 1.
  1015. Setting this to 0 disables reduction and then filter behaves like expander.
  1016. @item threshold
  1017. If a signal rises above this level the gain reduction is released.
  1018. Default is 0.125. Allowed range is from 0 to 1.
  1019. @item ratio
  1020. Set a ratio by which the signal is reduced.
  1021. Default is 2. Allowed range is from 1 to 9000.
  1022. @item attack
  1023. Amount of milliseconds the signal has to rise above the threshold before gain
  1024. reduction stops.
  1025. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1026. @item release
  1027. Amount of milliseconds the signal has to fall below the threshold before the
  1028. reduction is increased again. Default is 250 milliseconds.
  1029. Allowed range is from 0.01 to 9000.
  1030. @item makeup
  1031. Set amount of amplification of signal after processing.
  1032. Default is 1. Allowed range is from 1 to 64.
  1033. @item knee
  1034. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1035. Default is 2.828427125. Allowed range is from 1 to 8.
  1036. @item detection
  1037. Choose if exact signal should be taken for detection or an RMS like one.
  1038. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1039. @item link
  1040. Choose if the average level between all channels or the louder channel affects
  1041. the reduction.
  1042. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1043. @end table
  1044. @section aiir
  1045. Apply an arbitrary Infinite Impulse Response filter.
  1046. It accepts the following parameters:
  1047. @table @option
  1048. @item z
  1049. Set numerator/zeros coefficients.
  1050. @item p
  1051. Set denominator/poles coefficients.
  1052. @item k
  1053. Set channels gains.
  1054. @item dry_gain
  1055. Set input gain.
  1056. @item wet_gain
  1057. Set output gain.
  1058. @item f
  1059. Set coefficients format.
  1060. @table @samp
  1061. @item tf
  1062. transfer function
  1063. @item zp
  1064. Z-plane zeros/poles, cartesian (default)
  1065. @item pr
  1066. Z-plane zeros/poles, polar radians
  1067. @item pd
  1068. Z-plane zeros/poles, polar degrees
  1069. @end table
  1070. @item r
  1071. Set kind of processing.
  1072. Can be @code{d} - direct or @code{s} - serial cascading. Default is @code{s}.
  1073. @item e
  1074. Set filtering precision.
  1075. @table @samp
  1076. @item dbl
  1077. double-precision floating-point (default)
  1078. @item flt
  1079. single-precision floating-point
  1080. @item i32
  1081. 32-bit integers
  1082. @item i16
  1083. 16-bit integers
  1084. @end table
  1085. @item mix
  1086. How much to use filtered signal in output. Default is 1.
  1087. Range is between 0 and 1.
  1088. @item response
  1089. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1090. By default it is disabled.
  1091. @item channel
  1092. Set for which IR channel to display frequency response. By default is first channel
  1093. displayed. This option is used only when @var{response} is enabled.
  1094. @item size
  1095. Set video stream size. This option is used only when @var{response} is enabled.
  1096. @end table
  1097. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1098. order.
  1099. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1100. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1101. imaginary unit.
  1102. Different coefficients and gains can be provided for every channel, in such case
  1103. use '|' to separate coefficients or gains. Last provided coefficients will be
  1104. used for all remaining channels.
  1105. @subsection Examples
  1106. @itemize
  1107. @item
  1108. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1109. @example
  1110. 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
  1111. @end example
  1112. @item
  1113. Same as above but in @code{zp} format:
  1114. @example
  1115. 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
  1116. @end example
  1117. @end itemize
  1118. @section alimiter
  1119. The limiter prevents an input signal from rising over a desired threshold.
  1120. This limiter uses lookahead technology to prevent your signal from distorting.
  1121. It means that there is a small delay after the signal is processed. Keep in mind
  1122. that the delay it produces is the attack time you set.
  1123. The filter accepts the following options:
  1124. @table @option
  1125. @item level_in
  1126. Set input gain. Default is 1.
  1127. @item level_out
  1128. Set output gain. Default is 1.
  1129. @item limit
  1130. Don't let signals above this level pass the limiter. Default is 1.
  1131. @item attack
  1132. The limiter will reach its attenuation level in this amount of time in
  1133. milliseconds. Default is 5 milliseconds.
  1134. @item release
  1135. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1136. Default is 50 milliseconds.
  1137. @item asc
  1138. When gain reduction is always needed ASC takes care of releasing to an
  1139. average reduction level rather than reaching a reduction of 0 in the release
  1140. time.
  1141. @item asc_level
  1142. Select how much the release time is affected by ASC, 0 means nearly no changes
  1143. in release time while 1 produces higher release times.
  1144. @item level
  1145. Auto level output signal. Default is enabled.
  1146. This normalizes audio back to 0dB if enabled.
  1147. @end table
  1148. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1149. with @ref{aresample} before applying this filter.
  1150. @section allpass
  1151. Apply a two-pole all-pass filter with central frequency (in Hz)
  1152. @var{frequency}, and filter-width @var{width}.
  1153. An all-pass filter changes the audio's frequency to phase relationship
  1154. without changing its frequency to amplitude relationship.
  1155. The filter accepts the following options:
  1156. @table @option
  1157. @item frequency, f
  1158. Set frequency in Hz.
  1159. @item width_type, t
  1160. Set method to specify band-width of filter.
  1161. @table @option
  1162. @item h
  1163. Hz
  1164. @item q
  1165. Q-Factor
  1166. @item o
  1167. octave
  1168. @item s
  1169. slope
  1170. @item k
  1171. kHz
  1172. @end table
  1173. @item width, w
  1174. Specify the band-width of a filter in width_type units.
  1175. @item mix, m
  1176. How much to use filtered signal in output. Default is 1.
  1177. Range is between 0 and 1.
  1178. @item channels, c
  1179. Specify which channels to filter, by default all available are filtered.
  1180. @end table
  1181. @subsection Commands
  1182. This filter supports the following commands:
  1183. @table @option
  1184. @item frequency, f
  1185. Change allpass frequency.
  1186. Syntax for the command is : "@var{frequency}"
  1187. @item width_type, t
  1188. Change allpass width_type.
  1189. Syntax for the command is : "@var{width_type}"
  1190. @item width, w
  1191. Change allpass width.
  1192. Syntax for the command is : "@var{width}"
  1193. @item mix, m
  1194. Change allpass mix.
  1195. Syntax for the command is : "@var{mix}"
  1196. @end table
  1197. @section aloop
  1198. Loop audio samples.
  1199. The filter accepts the following options:
  1200. @table @option
  1201. @item loop
  1202. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1203. Default is 0.
  1204. @item size
  1205. Set maximal number of samples. Default is 0.
  1206. @item start
  1207. Set first sample of loop. Default is 0.
  1208. @end table
  1209. @anchor{amerge}
  1210. @section amerge
  1211. Merge two or more audio streams into a single multi-channel stream.
  1212. The filter accepts the following options:
  1213. @table @option
  1214. @item inputs
  1215. Set the number of inputs. Default is 2.
  1216. @end table
  1217. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1218. the channel layout of the output will be set accordingly and the channels
  1219. will be reordered as necessary. If the channel layouts of the inputs are not
  1220. disjoint, the output will have all the channels of the first input then all
  1221. the channels of the second input, in that order, and the channel layout of
  1222. the output will be the default value corresponding to the total number of
  1223. channels.
  1224. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1225. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1226. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1227. first input, b1 is the first channel of the second input).
  1228. On the other hand, if both input are in stereo, the output channels will be
  1229. in the default order: a1, a2, b1, b2, and the channel layout will be
  1230. arbitrarily set to 4.0, which may or may not be the expected value.
  1231. All inputs must have the same sample rate, and format.
  1232. If inputs do not have the same duration, the output will stop with the
  1233. shortest.
  1234. @subsection Examples
  1235. @itemize
  1236. @item
  1237. Merge two mono files into a stereo stream:
  1238. @example
  1239. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1240. @end example
  1241. @item
  1242. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1243. @example
  1244. 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
  1245. @end example
  1246. @end itemize
  1247. @section amix
  1248. Mixes multiple audio inputs into a single output.
  1249. Note that this filter only supports float samples (the @var{amerge}
  1250. and @var{pan} audio filters support many formats). If the @var{amix}
  1251. input has integer samples then @ref{aresample} will be automatically
  1252. inserted to perform the conversion to float samples.
  1253. For example
  1254. @example
  1255. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1256. @end example
  1257. will mix 3 input audio streams to a single output with the same duration as the
  1258. first input and a dropout transition time of 3 seconds.
  1259. It accepts the following parameters:
  1260. @table @option
  1261. @item inputs
  1262. The number of inputs. If unspecified, it defaults to 2.
  1263. @item duration
  1264. How to determine the end-of-stream.
  1265. @table @option
  1266. @item longest
  1267. The duration of the longest input. (default)
  1268. @item shortest
  1269. The duration of the shortest input.
  1270. @item first
  1271. The duration of the first input.
  1272. @end table
  1273. @item dropout_transition
  1274. The transition time, in seconds, for volume renormalization when an input
  1275. stream ends. The default value is 2 seconds.
  1276. @item weights
  1277. Specify weight of each input audio stream as sequence.
  1278. Each weight is separated by space. By default all inputs have same weight.
  1279. @end table
  1280. @section amultiply
  1281. Multiply first audio stream with second audio stream and store result
  1282. in output audio stream. Multiplication is done by multiplying each
  1283. sample from first stream with sample at same position from second stream.
  1284. With this element-wise multiplication one can create amplitude fades and
  1285. amplitude modulations.
  1286. @section anequalizer
  1287. High-order parametric multiband equalizer for each channel.
  1288. It accepts the following parameters:
  1289. @table @option
  1290. @item params
  1291. This option string is in format:
  1292. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1293. Each equalizer band is separated by '|'.
  1294. @table @option
  1295. @item chn
  1296. Set channel number to which equalization will be applied.
  1297. If input doesn't have that channel the entry is ignored.
  1298. @item f
  1299. Set central frequency for band.
  1300. If input doesn't have that frequency the entry is ignored.
  1301. @item w
  1302. Set band width in hertz.
  1303. @item g
  1304. Set band gain in dB.
  1305. @item t
  1306. Set filter type for band, optional, can be:
  1307. @table @samp
  1308. @item 0
  1309. Butterworth, this is default.
  1310. @item 1
  1311. Chebyshev type 1.
  1312. @item 2
  1313. Chebyshev type 2.
  1314. @end table
  1315. @end table
  1316. @item curves
  1317. With this option activated frequency response of anequalizer is displayed
  1318. in video stream.
  1319. @item size
  1320. Set video stream size. Only useful if curves option is activated.
  1321. @item mgain
  1322. Set max gain that will be displayed. Only useful if curves option is activated.
  1323. Setting this to a reasonable value makes it possible to display gain which is derived from
  1324. neighbour bands which are too close to each other and thus produce higher gain
  1325. when both are activated.
  1326. @item fscale
  1327. Set frequency scale used to draw frequency response in video output.
  1328. Can be linear or logarithmic. Default is logarithmic.
  1329. @item colors
  1330. Set color for each channel curve which is going to be displayed in video stream.
  1331. This is list of color names separated by space or by '|'.
  1332. Unrecognised or missing colors will be replaced by white color.
  1333. @end table
  1334. @subsection Examples
  1335. @itemize
  1336. @item
  1337. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1338. for first 2 channels using Chebyshev type 1 filter:
  1339. @example
  1340. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1341. @end example
  1342. @end itemize
  1343. @subsection Commands
  1344. This filter supports the following commands:
  1345. @table @option
  1346. @item change
  1347. Alter existing filter parameters.
  1348. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1349. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1350. error is returned.
  1351. @var{freq} set new frequency parameter.
  1352. @var{width} set new width parameter in herz.
  1353. @var{gain} set new gain parameter in dB.
  1354. Full filter invocation with asendcmd may look like this:
  1355. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1356. @end table
  1357. @section anlmdn
  1358. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1359. Each sample is adjusted by looking for other samples with similar contexts. This
  1360. context similarity is defined by comparing their surrounding patches of size
  1361. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1362. The filter accepts the following options:
  1363. @table @option
  1364. @item s
  1365. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1366. @item p
  1367. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1368. Default value is 2 milliseconds.
  1369. @item r
  1370. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1371. Default value is 6 milliseconds.
  1372. @item o
  1373. Set the output mode.
  1374. It accepts the following values:
  1375. @table @option
  1376. @item i
  1377. Pass input unchanged.
  1378. @item o
  1379. Pass noise filtered out.
  1380. @item n
  1381. Pass only noise.
  1382. Default value is @var{o}.
  1383. @end table
  1384. @item m
  1385. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1386. @end table
  1387. @subsection Commands
  1388. This filter supports the following commands:
  1389. @table @option
  1390. @item s
  1391. Change denoise strength. Argument is single float number.
  1392. Syntax for the command is : "@var{s}"
  1393. @item o
  1394. Change output mode.
  1395. Syntax for the command is : "i", "o" or "n" string.
  1396. @end table
  1397. @section anlms
  1398. Apply Normalized Least-Mean-Squares algorithm to the first audio stream using the second audio stream.
  1399. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1400. relate to producing the least mean square of the error signal (difference between the desired,
  1401. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1402. A description of the accepted options follows.
  1403. @table @option
  1404. @item order
  1405. Set filter order.
  1406. @item mu
  1407. Set filter mu.
  1408. @item eps
  1409. Set the filter eps.
  1410. @item leakage
  1411. Set the filter leakage.
  1412. @item out_mode
  1413. It accepts the following values:
  1414. @table @option
  1415. @item i
  1416. Pass the 1st input.
  1417. @item d
  1418. Pass the 2nd input.
  1419. @item o
  1420. Pass filtered samples.
  1421. @item n
  1422. Pass difference between desired and filtered samples.
  1423. Default value is @var{o}.
  1424. @end table
  1425. @end table
  1426. @subsection Examples
  1427. @itemize
  1428. @item
  1429. One of many usages of this filter is noise reduction, input audio is filtered
  1430. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1431. @example
  1432. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1433. @end example
  1434. @end itemize
  1435. @subsection Commands
  1436. This filter supports the same commands as options, excluding option @code{order}.
  1437. @section anull
  1438. Pass the audio source unchanged to the output.
  1439. @section apad
  1440. Pad the end of an audio stream with silence.
  1441. This can be used together with @command{ffmpeg} @option{-shortest} to
  1442. extend audio streams to the same length as the video stream.
  1443. A description of the accepted options follows.
  1444. @table @option
  1445. @item packet_size
  1446. Set silence packet size. Default value is 4096.
  1447. @item pad_len
  1448. Set the number of samples of silence to add to the end. After the
  1449. value is reached, the stream is terminated. This option is mutually
  1450. exclusive with @option{whole_len}.
  1451. @item whole_len
  1452. Set the minimum total number of samples in the output audio stream. If
  1453. the value is longer than the input audio length, silence is added to
  1454. the end, until the value is reached. This option is mutually exclusive
  1455. with @option{pad_len}.
  1456. @item pad_dur
  1457. Specify the duration of samples of silence to add. See
  1458. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1459. for the accepted syntax. Used only if set to non-zero value.
  1460. @item whole_dur
  1461. Specify the minimum total duration in the output audio stream. See
  1462. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1463. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1464. the input audio length, silence is added to the end, until the value is reached.
  1465. This option is mutually exclusive with @option{pad_dur}
  1466. @end table
  1467. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1468. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1469. the input stream indefinitely.
  1470. @subsection Examples
  1471. @itemize
  1472. @item
  1473. Add 1024 samples of silence to the end of the input:
  1474. @example
  1475. apad=pad_len=1024
  1476. @end example
  1477. @item
  1478. Make sure the audio output will contain at least 10000 samples, pad
  1479. the input with silence if required:
  1480. @example
  1481. apad=whole_len=10000
  1482. @end example
  1483. @item
  1484. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1485. video stream will always result the shortest and will be converted
  1486. until the end in the output file when using the @option{shortest}
  1487. option:
  1488. @example
  1489. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1490. @end example
  1491. @end itemize
  1492. @section aphaser
  1493. Add a phasing effect to the input audio.
  1494. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1495. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1496. A description of the accepted parameters follows.
  1497. @table @option
  1498. @item in_gain
  1499. Set input gain. Default is 0.4.
  1500. @item out_gain
  1501. Set output gain. Default is 0.74
  1502. @item delay
  1503. Set delay in milliseconds. Default is 3.0.
  1504. @item decay
  1505. Set decay. Default is 0.4.
  1506. @item speed
  1507. Set modulation speed in Hz. Default is 0.5.
  1508. @item type
  1509. Set modulation type. Default is triangular.
  1510. It accepts the following values:
  1511. @table @samp
  1512. @item triangular, t
  1513. @item sinusoidal, s
  1514. @end table
  1515. @end table
  1516. @section apulsator
  1517. Audio pulsator is something between an autopanner and a tremolo.
  1518. But it can produce funny stereo effects as well. Pulsator changes the volume
  1519. of the left and right channel based on a LFO (low frequency oscillator) with
  1520. different waveforms and shifted phases.
  1521. This filter have the ability to define an offset between left and right
  1522. channel. An offset of 0 means that both LFO shapes match each other.
  1523. The left and right channel are altered equally - a conventional tremolo.
  1524. An offset of 50% means that the shape of the right channel is exactly shifted
  1525. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1526. an autopanner. At 1 both curves match again. Every setting in between moves the
  1527. phase shift gapless between all stages and produces some "bypassing" sounds with
  1528. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1529. the 0.5) the faster the signal passes from the left to the right speaker.
  1530. The filter accepts the following options:
  1531. @table @option
  1532. @item level_in
  1533. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1534. @item level_out
  1535. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1536. @item mode
  1537. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1538. sawup or sawdown. Default is sine.
  1539. @item amount
  1540. Set modulation. Define how much of original signal is affected by the LFO.
  1541. @item offset_l
  1542. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1543. @item offset_r
  1544. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1545. @item width
  1546. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1547. @item timing
  1548. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1549. @item bpm
  1550. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1551. is set to bpm.
  1552. @item ms
  1553. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1554. is set to ms.
  1555. @item hz
  1556. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1557. if timing is set to hz.
  1558. @end table
  1559. @anchor{aresample}
  1560. @section aresample
  1561. Resample the input audio to the specified parameters, using the
  1562. libswresample library. If none are specified then the filter will
  1563. automatically convert between its input and output.
  1564. This filter is also able to stretch/squeeze the audio data to make it match
  1565. the timestamps or to inject silence / cut out audio to make it match the
  1566. timestamps, do a combination of both or do neither.
  1567. The filter accepts the syntax
  1568. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1569. expresses a sample rate and @var{resampler_options} is a list of
  1570. @var{key}=@var{value} pairs, separated by ":". See the
  1571. @ref{Resampler Options,,"Resampler Options" section in the
  1572. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1573. for the complete list of supported options.
  1574. @subsection Examples
  1575. @itemize
  1576. @item
  1577. Resample the input audio to 44100Hz:
  1578. @example
  1579. aresample=44100
  1580. @end example
  1581. @item
  1582. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1583. samples per second compensation:
  1584. @example
  1585. aresample=async=1000
  1586. @end example
  1587. @end itemize
  1588. @section areverse
  1589. Reverse an audio clip.
  1590. Warning: This filter requires memory to buffer the entire clip, so trimming
  1591. is suggested.
  1592. @subsection Examples
  1593. @itemize
  1594. @item
  1595. Take the first 5 seconds of a clip, and reverse it.
  1596. @example
  1597. atrim=end=5,areverse
  1598. @end example
  1599. @end itemize
  1600. @section asetnsamples
  1601. Set the number of samples per each output audio frame.
  1602. The last output packet may contain a different number of samples, as
  1603. the filter will flush all the remaining samples when the input audio
  1604. signals its end.
  1605. The filter accepts the following options:
  1606. @table @option
  1607. @item nb_out_samples, n
  1608. Set the number of frames per each output audio frame. The number is
  1609. intended as the number of samples @emph{per each channel}.
  1610. Default value is 1024.
  1611. @item pad, p
  1612. If set to 1, the filter will pad the last audio frame with zeroes, so
  1613. that the last frame will contain the same number of samples as the
  1614. previous ones. Default value is 1.
  1615. @end table
  1616. For example, to set the number of per-frame samples to 1234 and
  1617. disable padding for the last frame, use:
  1618. @example
  1619. asetnsamples=n=1234:p=0
  1620. @end example
  1621. @section asetrate
  1622. Set the sample rate without altering the PCM data.
  1623. This will result in a change of speed and pitch.
  1624. The filter accepts the following options:
  1625. @table @option
  1626. @item sample_rate, r
  1627. Set the output sample rate. Default is 44100 Hz.
  1628. @end table
  1629. @section ashowinfo
  1630. Show a line containing various information for each input audio frame.
  1631. The input audio is not modified.
  1632. The shown line contains a sequence of key/value pairs of the form
  1633. @var{key}:@var{value}.
  1634. The following values are shown in the output:
  1635. @table @option
  1636. @item n
  1637. The (sequential) number of the input frame, starting from 0.
  1638. @item pts
  1639. The presentation timestamp of the input frame, in time base units; the time base
  1640. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1641. @item pts_time
  1642. The presentation timestamp of the input frame in seconds.
  1643. @item pos
  1644. position of the frame in the input stream, -1 if this information in
  1645. unavailable and/or meaningless (for example in case of synthetic audio)
  1646. @item fmt
  1647. The sample format.
  1648. @item chlayout
  1649. The channel layout.
  1650. @item rate
  1651. The sample rate for the audio frame.
  1652. @item nb_samples
  1653. The number of samples (per channel) in the frame.
  1654. @item checksum
  1655. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1656. audio, the data is treated as if all the planes were concatenated.
  1657. @item plane_checksums
  1658. A list of Adler-32 checksums for each data plane.
  1659. @end table
  1660. @section asoftclip
  1661. Apply audio soft clipping.
  1662. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1663. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1664. This filter accepts the following options:
  1665. @table @option
  1666. @item type
  1667. Set type of soft-clipping.
  1668. It accepts the following values:
  1669. @table @option
  1670. @item tanh
  1671. @item atan
  1672. @item cubic
  1673. @item exp
  1674. @item alg
  1675. @item quintic
  1676. @item sin
  1677. @end table
  1678. @item param
  1679. Set additional parameter which controls sigmoid function.
  1680. @end table
  1681. @section asr
  1682. Automatic Speech Recognition
  1683. This filter uses PocketSphinx for speech recognition. To enable
  1684. compilation of this filter, you need to configure FFmpeg with
  1685. @code{--enable-pocketsphinx}.
  1686. It accepts the following options:
  1687. @table @option
  1688. @item rate
  1689. Set sampling rate of input audio. Defaults is @code{16000}.
  1690. This need to match speech models, otherwise one will get poor results.
  1691. @item hmm
  1692. Set dictionary containing acoustic model files.
  1693. @item dict
  1694. Set pronunciation dictionary.
  1695. @item lm
  1696. Set language model file.
  1697. @item lmctl
  1698. Set language model set.
  1699. @item lmname
  1700. Set which language model to use.
  1701. @item logfn
  1702. Set output for log messages.
  1703. @end table
  1704. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1705. @anchor{astats}
  1706. @section astats
  1707. Display time domain statistical information about the audio channels.
  1708. Statistics are calculated and displayed for each audio channel and,
  1709. where applicable, an overall figure is also given.
  1710. It accepts the following option:
  1711. @table @option
  1712. @item length
  1713. Short window length in seconds, used for peak and trough RMS measurement.
  1714. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1715. @item metadata
  1716. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1717. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1718. disabled.
  1719. Available keys for each channel are:
  1720. DC_offset
  1721. Min_level
  1722. Max_level
  1723. Min_difference
  1724. Max_difference
  1725. Mean_difference
  1726. RMS_difference
  1727. Peak_level
  1728. RMS_peak
  1729. RMS_trough
  1730. Crest_factor
  1731. Flat_factor
  1732. Peak_count
  1733. Bit_depth
  1734. Dynamic_range
  1735. Zero_crossings
  1736. Zero_crossings_rate
  1737. Number_of_NaNs
  1738. Number_of_Infs
  1739. Number_of_denormals
  1740. and for Overall:
  1741. DC_offset
  1742. Min_level
  1743. Max_level
  1744. Min_difference
  1745. Max_difference
  1746. Mean_difference
  1747. RMS_difference
  1748. Peak_level
  1749. RMS_level
  1750. RMS_peak
  1751. RMS_trough
  1752. Flat_factor
  1753. Peak_count
  1754. Bit_depth
  1755. Number_of_samples
  1756. Number_of_NaNs
  1757. Number_of_Infs
  1758. Number_of_denormals
  1759. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1760. this @code{lavfi.astats.Overall.Peak_count}.
  1761. For description what each key means read below.
  1762. @item reset
  1763. Set number of frame after which stats are going to be recalculated.
  1764. Default is disabled.
  1765. @item measure_perchannel
  1766. Select the entries which need to be measured per channel. The metadata keys can
  1767. be used as flags, default is @option{all} which measures everything.
  1768. @option{none} disables all per channel measurement.
  1769. @item measure_overall
  1770. Select the entries which need to be measured overall. The metadata keys can
  1771. be used as flags, default is @option{all} which measures everything.
  1772. @option{none} disables all overall measurement.
  1773. @end table
  1774. A description of each shown parameter follows:
  1775. @table @option
  1776. @item DC offset
  1777. Mean amplitude displacement from zero.
  1778. @item Min level
  1779. Minimal sample level.
  1780. @item Max level
  1781. Maximal sample level.
  1782. @item Min difference
  1783. Minimal difference between two consecutive samples.
  1784. @item Max difference
  1785. Maximal difference between two consecutive samples.
  1786. @item Mean difference
  1787. Mean difference between two consecutive samples.
  1788. The average of each difference between two consecutive samples.
  1789. @item RMS difference
  1790. Root Mean Square difference between two consecutive samples.
  1791. @item Peak level dB
  1792. @item RMS level dB
  1793. Standard peak and RMS level measured in dBFS.
  1794. @item RMS peak dB
  1795. @item RMS trough dB
  1796. Peak and trough values for RMS level measured over a short window.
  1797. @item Crest factor
  1798. Standard ratio of peak to RMS level (note: not in dB).
  1799. @item Flat factor
  1800. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1801. (i.e. either @var{Min level} or @var{Max level}).
  1802. @item Peak count
  1803. Number of occasions (not the number of samples) that the signal attained either
  1804. @var{Min level} or @var{Max level}.
  1805. @item Bit depth
  1806. Overall bit depth of audio. Number of bits used for each sample.
  1807. @item Dynamic range
  1808. Measured dynamic range of audio in dB.
  1809. @item Zero crossings
  1810. Number of points where the waveform crosses the zero level axis.
  1811. @item Zero crossings rate
  1812. Rate of Zero crossings and number of audio samples.
  1813. @end table
  1814. @section atempo
  1815. Adjust audio tempo.
  1816. The filter accepts exactly one parameter, the audio tempo. If not
  1817. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1818. be in the [0.5, 100.0] range.
  1819. Note that tempo greater than 2 will skip some samples rather than
  1820. blend them in. If for any reason this is a concern it is always
  1821. possible to daisy-chain several instances of atempo to achieve the
  1822. desired product tempo.
  1823. @subsection Examples
  1824. @itemize
  1825. @item
  1826. Slow down audio to 80% tempo:
  1827. @example
  1828. atempo=0.8
  1829. @end example
  1830. @item
  1831. To speed up audio to 300% tempo:
  1832. @example
  1833. atempo=3
  1834. @end example
  1835. @item
  1836. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1837. @example
  1838. atempo=sqrt(3),atempo=sqrt(3)
  1839. @end example
  1840. @end itemize
  1841. @section atrim
  1842. Trim the input so that the output contains one continuous subpart of the input.
  1843. It accepts the following parameters:
  1844. @table @option
  1845. @item start
  1846. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1847. sample with the timestamp @var{start} will be the first sample in the output.
  1848. @item end
  1849. Specify time of the first audio sample that will be dropped, i.e. the
  1850. audio sample immediately preceding the one with the timestamp @var{end} will be
  1851. the last sample in the output.
  1852. @item start_pts
  1853. Same as @var{start}, except this option sets the start timestamp in samples
  1854. instead of seconds.
  1855. @item end_pts
  1856. Same as @var{end}, except this option sets the end timestamp in samples instead
  1857. of seconds.
  1858. @item duration
  1859. The maximum duration of the output in seconds.
  1860. @item start_sample
  1861. The number of the first sample that should be output.
  1862. @item end_sample
  1863. The number of the first sample that should be dropped.
  1864. @end table
  1865. @option{start}, @option{end}, and @option{duration} are expressed as time
  1866. duration specifications; see
  1867. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1868. Note that the first two sets of the start/end options and the @option{duration}
  1869. option look at the frame timestamp, while the _sample options simply count the
  1870. samples that pass through the filter. So start/end_pts and start/end_sample will
  1871. give different results when the timestamps are wrong, inexact or do not start at
  1872. zero. Also note that this filter does not modify the timestamps. If you wish
  1873. to have the output timestamps start at zero, insert the asetpts filter after the
  1874. atrim filter.
  1875. If multiple start or end options are set, this filter tries to be greedy and
  1876. keep all samples that match at least one of the specified constraints. To keep
  1877. only the part that matches all the constraints at once, chain multiple atrim
  1878. filters.
  1879. The defaults are such that all the input is kept. So it is possible to set e.g.
  1880. just the end values to keep everything before the specified time.
  1881. Examples:
  1882. @itemize
  1883. @item
  1884. Drop everything except the second minute of input:
  1885. @example
  1886. ffmpeg -i INPUT -af atrim=60:120
  1887. @end example
  1888. @item
  1889. Keep only the first 1000 samples:
  1890. @example
  1891. ffmpeg -i INPUT -af atrim=end_sample=1000
  1892. @end example
  1893. @end itemize
  1894. @section bandpass
  1895. Apply a two-pole Butterworth band-pass filter with central
  1896. frequency @var{frequency}, and (3dB-point) band-width width.
  1897. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1898. instead of the default: constant 0dB peak gain.
  1899. The filter roll off at 6dB per octave (20dB per decade).
  1900. The filter accepts the following options:
  1901. @table @option
  1902. @item frequency, f
  1903. Set the filter's central frequency. Default is @code{3000}.
  1904. @item csg
  1905. Constant skirt gain if set to 1. Defaults to 0.
  1906. @item width_type, t
  1907. Set method to specify band-width of filter.
  1908. @table @option
  1909. @item h
  1910. Hz
  1911. @item q
  1912. Q-Factor
  1913. @item o
  1914. octave
  1915. @item s
  1916. slope
  1917. @item k
  1918. kHz
  1919. @end table
  1920. @item width, w
  1921. Specify the band-width of a filter in width_type units.
  1922. @item mix, m
  1923. How much to use filtered signal in output. Default is 1.
  1924. Range is between 0 and 1.
  1925. @item channels, c
  1926. Specify which channels to filter, by default all available are filtered.
  1927. @end table
  1928. @subsection Commands
  1929. This filter supports the following commands:
  1930. @table @option
  1931. @item frequency, f
  1932. Change bandpass frequency.
  1933. Syntax for the command is : "@var{frequency}"
  1934. @item width_type, t
  1935. Change bandpass width_type.
  1936. Syntax for the command is : "@var{width_type}"
  1937. @item width, w
  1938. Change bandpass width.
  1939. Syntax for the command is : "@var{width}"
  1940. @item mix, m
  1941. Change bandpass mix.
  1942. Syntax for the command is : "@var{mix}"
  1943. @end table
  1944. @section bandreject
  1945. Apply a two-pole Butterworth band-reject filter with central
  1946. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1947. The filter roll off at 6dB per octave (20dB per decade).
  1948. The filter accepts the following options:
  1949. @table @option
  1950. @item frequency, f
  1951. Set the filter's central frequency. Default is @code{3000}.
  1952. @item width_type, t
  1953. Set method to specify band-width of filter.
  1954. @table @option
  1955. @item h
  1956. Hz
  1957. @item q
  1958. Q-Factor
  1959. @item o
  1960. octave
  1961. @item s
  1962. slope
  1963. @item k
  1964. kHz
  1965. @end table
  1966. @item width, w
  1967. Specify the band-width of a filter in width_type units.
  1968. @item mix, m
  1969. How much to use filtered signal in output. Default is 1.
  1970. Range is between 0 and 1.
  1971. @item channels, c
  1972. Specify which channels to filter, by default all available are filtered.
  1973. @end table
  1974. @subsection Commands
  1975. This filter supports the following commands:
  1976. @table @option
  1977. @item frequency, f
  1978. Change bandreject frequency.
  1979. Syntax for the command is : "@var{frequency}"
  1980. @item width_type, t
  1981. Change bandreject width_type.
  1982. Syntax for the command is : "@var{width_type}"
  1983. @item width, w
  1984. Change bandreject width.
  1985. Syntax for the command is : "@var{width}"
  1986. @item mix, m
  1987. Change bandreject mix.
  1988. Syntax for the command is : "@var{mix}"
  1989. @end table
  1990. @section bass, lowshelf
  1991. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1992. shelving filter with a response similar to that of a standard
  1993. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1994. The filter accepts the following options:
  1995. @table @option
  1996. @item gain, g
  1997. Give the gain at 0 Hz. Its useful range is about -20
  1998. (for a large cut) to +20 (for a large boost).
  1999. Beware of clipping when using a positive gain.
  2000. @item frequency, f
  2001. Set the filter's central frequency and so can be used
  2002. to extend or reduce the frequency range to be boosted or cut.
  2003. The default value is @code{100} Hz.
  2004. @item width_type, t
  2005. Set method to specify band-width of filter.
  2006. @table @option
  2007. @item h
  2008. Hz
  2009. @item q
  2010. Q-Factor
  2011. @item o
  2012. octave
  2013. @item s
  2014. slope
  2015. @item k
  2016. kHz
  2017. @end table
  2018. @item width, w
  2019. Determine how steep is the filter's shelf transition.
  2020. @item mix, m
  2021. How much to use filtered signal in output. Default is 1.
  2022. Range is between 0 and 1.
  2023. @item channels, c
  2024. Specify which channels to filter, by default all available are filtered.
  2025. @end table
  2026. @subsection Commands
  2027. This filter supports the following commands:
  2028. @table @option
  2029. @item frequency, f
  2030. Change bass frequency.
  2031. Syntax for the command is : "@var{frequency}"
  2032. @item width_type, t
  2033. Change bass width_type.
  2034. Syntax for the command is : "@var{width_type}"
  2035. @item width, w
  2036. Change bass width.
  2037. Syntax for the command is : "@var{width}"
  2038. @item gain, g
  2039. Change bass gain.
  2040. Syntax for the command is : "@var{gain}"
  2041. @item mix, m
  2042. Change bass mix.
  2043. Syntax for the command is : "@var{mix}"
  2044. @end table
  2045. @section biquad
  2046. Apply a biquad IIR filter with the given coefficients.
  2047. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2048. are the numerator and denominator coefficients respectively.
  2049. and @var{channels}, @var{c} specify which channels to filter, by default all
  2050. available are filtered.
  2051. @subsection Commands
  2052. This filter supports the following commands:
  2053. @table @option
  2054. @item a0
  2055. @item a1
  2056. @item a2
  2057. @item b0
  2058. @item b1
  2059. @item b2
  2060. Change biquad parameter.
  2061. Syntax for the command is : "@var{value}"
  2062. @item mix, m
  2063. How much to use filtered signal in output. Default is 1.
  2064. Range is between 0 and 1.
  2065. @end table
  2066. @section bs2b
  2067. Bauer stereo to binaural transformation, which improves headphone listening of
  2068. stereo audio records.
  2069. To enable compilation of this filter you need to configure FFmpeg with
  2070. @code{--enable-libbs2b}.
  2071. It accepts the following parameters:
  2072. @table @option
  2073. @item profile
  2074. Pre-defined crossfeed level.
  2075. @table @option
  2076. @item default
  2077. Default level (fcut=700, feed=50).
  2078. @item cmoy
  2079. Chu Moy circuit (fcut=700, feed=60).
  2080. @item jmeier
  2081. Jan Meier circuit (fcut=650, feed=95).
  2082. @end table
  2083. @item fcut
  2084. Cut frequency (in Hz).
  2085. @item feed
  2086. Feed level (in Hz).
  2087. @end table
  2088. @section channelmap
  2089. Remap input channels to new locations.
  2090. It accepts the following parameters:
  2091. @table @option
  2092. @item map
  2093. Map channels from input to output. The argument is a '|'-separated list of
  2094. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2095. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2096. channel (e.g. FL for front left) or its index in the input channel layout.
  2097. @var{out_channel} is the name of the output channel or its index in the output
  2098. channel layout. If @var{out_channel} is not given then it is implicitly an
  2099. index, starting with zero and increasing by one for each mapping.
  2100. @item channel_layout
  2101. The channel layout of the output stream.
  2102. @end table
  2103. If no mapping is present, the filter will implicitly map input channels to
  2104. output channels, preserving indices.
  2105. @subsection Examples
  2106. @itemize
  2107. @item
  2108. For example, assuming a 5.1+downmix input MOV file,
  2109. @example
  2110. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2111. @end example
  2112. will create an output WAV file tagged as stereo from the downmix channels of
  2113. the input.
  2114. @item
  2115. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2116. @example
  2117. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2118. @end example
  2119. @end itemize
  2120. @section channelsplit
  2121. Split each channel from an input audio stream into a separate output stream.
  2122. It accepts the following parameters:
  2123. @table @option
  2124. @item channel_layout
  2125. The channel layout of the input stream. The default is "stereo".
  2126. @item channels
  2127. A channel layout describing the channels to be extracted as separate output streams
  2128. or "all" to extract each input channel as a separate stream. The default is "all".
  2129. Choosing channels not present in channel layout in the input will result in an error.
  2130. @end table
  2131. @subsection Examples
  2132. @itemize
  2133. @item
  2134. For example, assuming a stereo input MP3 file,
  2135. @example
  2136. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2137. @end example
  2138. will create an output Matroska file with two audio streams, one containing only
  2139. the left channel and the other the right channel.
  2140. @item
  2141. Split a 5.1 WAV file into per-channel files:
  2142. @example
  2143. ffmpeg -i in.wav -filter_complex
  2144. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2145. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2146. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2147. side_right.wav
  2148. @end example
  2149. @item
  2150. Extract only LFE from a 5.1 WAV file:
  2151. @example
  2152. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2153. -map '[LFE]' lfe.wav
  2154. @end example
  2155. @end itemize
  2156. @section chorus
  2157. Add a chorus effect to the audio.
  2158. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2159. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2160. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2161. The modulation depth defines the range the modulated delay is played before or after
  2162. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2163. sound tuned around the original one, like in a chorus where some vocals are slightly
  2164. off key.
  2165. It accepts the following parameters:
  2166. @table @option
  2167. @item in_gain
  2168. Set input gain. Default is 0.4.
  2169. @item out_gain
  2170. Set output gain. Default is 0.4.
  2171. @item delays
  2172. Set delays. A typical delay is around 40ms to 60ms.
  2173. @item decays
  2174. Set decays.
  2175. @item speeds
  2176. Set speeds.
  2177. @item depths
  2178. Set depths.
  2179. @end table
  2180. @subsection Examples
  2181. @itemize
  2182. @item
  2183. A single delay:
  2184. @example
  2185. chorus=0.7:0.9:55:0.4:0.25:2
  2186. @end example
  2187. @item
  2188. Two delays:
  2189. @example
  2190. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2191. @end example
  2192. @item
  2193. Fuller sounding chorus with three delays:
  2194. @example
  2195. 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
  2196. @end example
  2197. @end itemize
  2198. @section compand
  2199. Compress or expand the audio's dynamic range.
  2200. It accepts the following parameters:
  2201. @table @option
  2202. @item attacks
  2203. @item decays
  2204. A list of times in seconds for each channel over which the instantaneous level
  2205. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2206. increase of volume and @var{decays} refers to decrease of volume. For most
  2207. situations, the attack time (response to the audio getting louder) should be
  2208. shorter than the decay time, because the human ear is more sensitive to sudden
  2209. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2210. a typical value for decay is 0.8 seconds.
  2211. If specified number of attacks & decays is lower than number of channels, the last
  2212. set attack/decay will be used for all remaining channels.
  2213. @item points
  2214. A list of points for the transfer function, specified in dB relative to the
  2215. maximum possible signal amplitude. Each key points list must be defined using
  2216. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2217. @code{x0/y0 x1/y1 x2/y2 ....}
  2218. The input values must be in strictly increasing order but the transfer function
  2219. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2220. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2221. function are @code{-70/-70|-60/-20|1/0}.
  2222. @item soft-knee
  2223. Set the curve radius in dB for all joints. It defaults to 0.01.
  2224. @item gain
  2225. Set the additional gain in dB to be applied at all points on the transfer
  2226. function. This allows for easy adjustment of the overall gain.
  2227. It defaults to 0.
  2228. @item volume
  2229. Set an initial volume, in dB, to be assumed for each channel when filtering
  2230. starts. This permits the user to supply a nominal level initially, so that, for
  2231. example, a very large gain is not applied to initial signal levels before the
  2232. companding has begun to operate. A typical value for audio which is initially
  2233. quiet is -90 dB. It defaults to 0.
  2234. @item delay
  2235. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2236. delayed before being fed to the volume adjuster. Specifying a delay
  2237. approximately equal to the attack/decay times allows the filter to effectively
  2238. operate in predictive rather than reactive mode. It defaults to 0.
  2239. @end table
  2240. @subsection Examples
  2241. @itemize
  2242. @item
  2243. Make music with both quiet and loud passages suitable for listening to in a
  2244. noisy environment:
  2245. @example
  2246. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2247. @end example
  2248. Another example for audio with whisper and explosion parts:
  2249. @example
  2250. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2251. @end example
  2252. @item
  2253. A noise gate for when the noise is at a lower level than the signal:
  2254. @example
  2255. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2256. @end example
  2257. @item
  2258. Here is another noise gate, this time for when the noise is at a higher level
  2259. than the signal (making it, in some ways, similar to squelch):
  2260. @example
  2261. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2262. @end example
  2263. @item
  2264. 2:1 compression starting at -6dB:
  2265. @example
  2266. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2267. @end example
  2268. @item
  2269. 2:1 compression starting at -9dB:
  2270. @example
  2271. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2272. @end example
  2273. @item
  2274. 2:1 compression starting at -12dB:
  2275. @example
  2276. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2277. @end example
  2278. @item
  2279. 2:1 compression starting at -18dB:
  2280. @example
  2281. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2282. @end example
  2283. @item
  2284. 3:1 compression starting at -15dB:
  2285. @example
  2286. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2287. @end example
  2288. @item
  2289. Compressor/Gate:
  2290. @example
  2291. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2292. @end example
  2293. @item
  2294. Expander:
  2295. @example
  2296. 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
  2297. @end example
  2298. @item
  2299. Hard limiter at -6dB:
  2300. @example
  2301. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2302. @end example
  2303. @item
  2304. Hard limiter at -12dB:
  2305. @example
  2306. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2307. @end example
  2308. @item
  2309. Hard noise gate at -35 dB:
  2310. @example
  2311. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2312. @end example
  2313. @item
  2314. Soft limiter:
  2315. @example
  2316. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2317. @end example
  2318. @end itemize
  2319. @section compensationdelay
  2320. Compensation Delay Line is a metric based delay to compensate differing
  2321. positions of microphones or speakers.
  2322. For example, you have recorded guitar with two microphones placed in
  2323. different locations. Because the front of sound wave has fixed speed in
  2324. normal conditions, the phasing of microphones can vary and depends on
  2325. their location and interposition. The best sound mix can be achieved when
  2326. these microphones are in phase (synchronized). Note that a distance of
  2327. ~30 cm between microphones makes one microphone capture the signal in
  2328. antiphase to the other microphone. That makes the final mix sound moody.
  2329. This filter helps to solve phasing problems by adding different delays
  2330. to each microphone track and make them synchronized.
  2331. The best result can be reached when you take one track as base and
  2332. synchronize other tracks one by one with it.
  2333. Remember that synchronization/delay tolerance depends on sample rate, too.
  2334. Higher sample rates will give more tolerance.
  2335. The filter accepts the following parameters:
  2336. @table @option
  2337. @item mm
  2338. Set millimeters distance. This is compensation distance for fine tuning.
  2339. Default is 0.
  2340. @item cm
  2341. Set cm distance. This is compensation distance for tightening distance setup.
  2342. Default is 0.
  2343. @item m
  2344. Set meters distance. This is compensation distance for hard distance setup.
  2345. Default is 0.
  2346. @item dry
  2347. Set dry amount. Amount of unprocessed (dry) signal.
  2348. Default is 0.
  2349. @item wet
  2350. Set wet amount. Amount of processed (wet) signal.
  2351. Default is 1.
  2352. @item temp
  2353. Set temperature in degrees Celsius. This is the temperature of the environment.
  2354. Default is 20.
  2355. @end table
  2356. @section crossfeed
  2357. Apply headphone crossfeed filter.
  2358. Crossfeed is the process of blending the left and right channels of stereo
  2359. audio recording.
  2360. It is mainly used to reduce extreme stereo separation of low frequencies.
  2361. The intent is to produce more speaker like sound to the listener.
  2362. The filter accepts the following options:
  2363. @table @option
  2364. @item strength
  2365. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2366. This sets gain of low shelf filter for side part of stereo image.
  2367. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2368. @item range
  2369. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2370. This sets cut off frequency of low shelf filter. Default is cut off near
  2371. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2372. @item level_in
  2373. Set input gain. Default is 0.9.
  2374. @item level_out
  2375. Set output gain. Default is 1.
  2376. @end table
  2377. @section crystalizer
  2378. Simple algorithm to expand audio dynamic range.
  2379. The filter accepts the following options:
  2380. @table @option
  2381. @item i
  2382. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2383. (unchanged sound) to 10.0 (maximum effect).
  2384. @item c
  2385. Enable clipping. By default is enabled.
  2386. @end table
  2387. @section dcshift
  2388. Apply a DC shift to the audio.
  2389. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2390. in the recording chain) from the audio. The effect of a DC offset is reduced
  2391. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2392. a signal has a DC offset.
  2393. @table @option
  2394. @item shift
  2395. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2396. the audio.
  2397. @item limitergain
  2398. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2399. used to prevent clipping.
  2400. @end table
  2401. @section deesser
  2402. Apply de-essing to the audio samples.
  2403. @table @option
  2404. @item i
  2405. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2406. Default is 0.
  2407. @item m
  2408. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2409. Default is 0.5.
  2410. @item f
  2411. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2412. Default is 0.5.
  2413. @item s
  2414. Set the output mode.
  2415. It accepts the following values:
  2416. @table @option
  2417. @item i
  2418. Pass input unchanged.
  2419. @item o
  2420. Pass ess filtered out.
  2421. @item e
  2422. Pass only ess.
  2423. Default value is @var{o}.
  2424. @end table
  2425. @end table
  2426. @section drmeter
  2427. Measure audio dynamic range.
  2428. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2429. is found in transition material. And anything less that 8 have very poor dynamics
  2430. and is very compressed.
  2431. The filter accepts the following options:
  2432. @table @option
  2433. @item length
  2434. Set window length in seconds used to split audio into segments of equal length.
  2435. Default is 3 seconds.
  2436. @end table
  2437. @section dynaudnorm
  2438. Dynamic Audio Normalizer.
  2439. This filter applies a certain amount of gain to the input audio in order
  2440. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2441. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2442. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2443. This allows for applying extra gain to the "quiet" sections of the audio
  2444. while avoiding distortions or clipping the "loud" sections. In other words:
  2445. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2446. sections, in the sense that the volume of each section is brought to the
  2447. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2448. this goal *without* applying "dynamic range compressing". It will retain 100%
  2449. of the dynamic range *within* each section of the audio file.
  2450. @table @option
  2451. @item framelen, f
  2452. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2453. Default is 500 milliseconds.
  2454. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2455. referred to as frames. This is required, because a peak magnitude has no
  2456. meaning for just a single sample value. Instead, we need to determine the
  2457. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2458. normalizer would simply use the peak magnitude of the complete file, the
  2459. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2460. frame. The length of a frame is specified in milliseconds. By default, the
  2461. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2462. been found to give good results with most files.
  2463. Note that the exact frame length, in number of samples, will be determined
  2464. automatically, based on the sampling rate of the individual input audio file.
  2465. @item gausssize, g
  2466. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2467. number. Default is 31.
  2468. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2469. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2470. is specified in frames, centered around the current frame. For the sake of
  2471. simplicity, this must be an odd number. Consequently, the default value of 31
  2472. takes into account the current frame, as well as the 15 preceding frames and
  2473. the 15 subsequent frames. Using a larger window results in a stronger
  2474. smoothing effect and thus in less gain variation, i.e. slower gain
  2475. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2476. effect and thus in more gain variation, i.e. faster gain adaptation.
  2477. In other words, the more you increase this value, the more the Dynamic Audio
  2478. Normalizer will behave like a "traditional" normalization filter. On the
  2479. contrary, the more you decrease this value, the more the Dynamic Audio
  2480. Normalizer will behave like a dynamic range compressor.
  2481. @item peak, p
  2482. Set the target peak value. This specifies the highest permissible magnitude
  2483. level for the normalized audio input. This filter will try to approach the
  2484. target peak magnitude as closely as possible, but at the same time it also
  2485. makes sure that the normalized signal will never exceed the peak magnitude.
  2486. A frame's maximum local gain factor is imposed directly by the target peak
  2487. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2488. It is not recommended to go above this value.
  2489. @item maxgain, m
  2490. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2491. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2492. factor for each input frame, i.e. the maximum gain factor that does not
  2493. result in clipping or distortion. The maximum gain factor is determined by
  2494. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2495. additionally bounds the frame's maximum gain factor by a predetermined
  2496. (global) maximum gain factor. This is done in order to avoid excessive gain
  2497. factors in "silent" or almost silent frames. By default, the maximum gain
  2498. factor is 10.0, For most inputs the default value should be sufficient and
  2499. it usually is not recommended to increase this value. Though, for input
  2500. with an extremely low overall volume level, it may be necessary to allow even
  2501. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2502. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2503. Instead, a "sigmoid" threshold function will be applied. This way, the
  2504. gain factors will smoothly approach the threshold value, but never exceed that
  2505. value.
  2506. @item targetrms, r
  2507. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2508. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2509. This means that the maximum local gain factor for each frame is defined
  2510. (only) by the frame's highest magnitude sample. This way, the samples can
  2511. be amplified as much as possible without exceeding the maximum signal
  2512. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2513. Normalizer can also take into account the frame's root mean square,
  2514. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2515. determine the power of a time-varying signal. It is therefore considered
  2516. that the RMS is a better approximation of the "perceived loudness" than
  2517. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2518. frames to a constant RMS value, a uniform "perceived loudness" can be
  2519. established. If a target RMS value has been specified, a frame's local gain
  2520. factor is defined as the factor that would result in exactly that RMS value.
  2521. Note, however, that the maximum local gain factor is still restricted by the
  2522. frame's highest magnitude sample, in order to prevent clipping.
  2523. @item coupling, n
  2524. Enable channels coupling. By default is enabled.
  2525. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2526. amount. This means the same gain factor will be applied to all channels, i.e.
  2527. the maximum possible gain factor is determined by the "loudest" channel.
  2528. However, in some recordings, it may happen that the volume of the different
  2529. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2530. In this case, this option can be used to disable the channel coupling. This way,
  2531. the gain factor will be determined independently for each channel, depending
  2532. only on the individual channel's highest magnitude sample. This allows for
  2533. harmonizing the volume of the different channels.
  2534. @item correctdc, c
  2535. Enable DC bias correction. By default is disabled.
  2536. An audio signal (in the time domain) is a sequence of sample values.
  2537. In the Dynamic Audio Normalizer these sample values are represented in the
  2538. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2539. audio signal, or "waveform", should be centered around the zero point.
  2540. That means if we calculate the mean value of all samples in a file, or in a
  2541. single frame, then the result should be 0.0 or at least very close to that
  2542. value. If, however, there is a significant deviation of the mean value from
  2543. 0.0, in either positive or negative direction, this is referred to as a
  2544. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2545. Audio Normalizer provides optional DC bias correction.
  2546. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2547. the mean value, or "DC correction" offset, of each input frame and subtract
  2548. that value from all of the frame's sample values which ensures those samples
  2549. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2550. boundaries, the DC correction offset values will be interpolated smoothly
  2551. between neighbouring frames.
  2552. @item altboundary, b
  2553. Enable alternative boundary mode. By default is disabled.
  2554. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2555. around each frame. This includes the preceding frames as well as the
  2556. subsequent frames. However, for the "boundary" frames, located at the very
  2557. beginning and at the very end of the audio file, not all neighbouring
  2558. frames are available. In particular, for the first few frames in the audio
  2559. file, the preceding frames are not known. And, similarly, for the last few
  2560. frames in the audio file, the subsequent frames are not known. Thus, the
  2561. question arises which gain factors should be assumed for the missing frames
  2562. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2563. to deal with this situation. The default boundary mode assumes a gain factor
  2564. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2565. "fade out" at the beginning and at the end of the input, respectively.
  2566. @item compress, s
  2567. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2568. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2569. compression. This means that signal peaks will not be pruned and thus the
  2570. full dynamic range will be retained within each local neighbourhood. However,
  2571. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2572. normalization algorithm with a more "traditional" compression.
  2573. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2574. (thresholding) function. If (and only if) the compression feature is enabled,
  2575. all input frames will be processed by a soft knee thresholding function prior
  2576. to the actual normalization process. Put simply, the thresholding function is
  2577. going to prune all samples whose magnitude exceeds a certain threshold value.
  2578. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2579. value. Instead, the threshold value will be adjusted for each individual
  2580. frame.
  2581. In general, smaller parameters result in stronger compression, and vice versa.
  2582. Values below 3.0 are not recommended, because audible distortion may appear.
  2583. @end table
  2584. @section earwax
  2585. Make audio easier to listen to on headphones.
  2586. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2587. so that when listened to on headphones the stereo image is moved from
  2588. inside your head (standard for headphones) to outside and in front of
  2589. the listener (standard for speakers).
  2590. Ported from SoX.
  2591. @section equalizer
  2592. Apply a two-pole peaking equalisation (EQ) filter. With this
  2593. filter, the signal-level at and around a selected frequency can
  2594. be increased or decreased, whilst (unlike bandpass and bandreject
  2595. filters) that at all other frequencies is unchanged.
  2596. In order to produce complex equalisation curves, this filter can
  2597. be given several times, each with a different central frequency.
  2598. The filter accepts the following options:
  2599. @table @option
  2600. @item frequency, f
  2601. Set the filter's central frequency in Hz.
  2602. @item width_type, t
  2603. Set method to specify band-width of filter.
  2604. @table @option
  2605. @item h
  2606. Hz
  2607. @item q
  2608. Q-Factor
  2609. @item o
  2610. octave
  2611. @item s
  2612. slope
  2613. @item k
  2614. kHz
  2615. @end table
  2616. @item width, w
  2617. Specify the band-width of a filter in width_type units.
  2618. @item gain, g
  2619. Set the required gain or attenuation in dB.
  2620. Beware of clipping when using a positive gain.
  2621. @item mix, m
  2622. How much to use filtered signal in output. Default is 1.
  2623. Range is between 0 and 1.
  2624. @item channels, c
  2625. Specify which channels to filter, by default all available are filtered.
  2626. @end table
  2627. @subsection Examples
  2628. @itemize
  2629. @item
  2630. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2631. @example
  2632. equalizer=f=1000:t=h:width=200:g=-10
  2633. @end example
  2634. @item
  2635. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2636. @example
  2637. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2638. @end example
  2639. @end itemize
  2640. @subsection Commands
  2641. This filter supports the following commands:
  2642. @table @option
  2643. @item frequency, f
  2644. Change equalizer frequency.
  2645. Syntax for the command is : "@var{frequency}"
  2646. @item width_type, t
  2647. Change equalizer width_type.
  2648. Syntax for the command is : "@var{width_type}"
  2649. @item width, w
  2650. Change equalizer width.
  2651. Syntax for the command is : "@var{width}"
  2652. @item gain, g
  2653. Change equalizer gain.
  2654. Syntax for the command is : "@var{gain}"
  2655. @item mix, m
  2656. Change equalizer mix.
  2657. Syntax for the command is : "@var{mix}"
  2658. @end table
  2659. @section extrastereo
  2660. Linearly increases the difference between left and right channels which
  2661. adds some sort of "live" effect to playback.
  2662. The filter accepts the following options:
  2663. @table @option
  2664. @item m
  2665. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2666. (average of both channels), with 1.0 sound will be unchanged, with
  2667. -1.0 left and right channels will be swapped.
  2668. @item c
  2669. Enable clipping. By default is enabled.
  2670. @end table
  2671. @section firequalizer
  2672. Apply FIR Equalization using arbitrary frequency response.
  2673. The filter accepts the following option:
  2674. @table @option
  2675. @item gain
  2676. Set gain curve equation (in dB). The expression can contain variables:
  2677. @table @option
  2678. @item f
  2679. the evaluated frequency
  2680. @item sr
  2681. sample rate
  2682. @item ch
  2683. channel number, set to 0 when multichannels evaluation is disabled
  2684. @item chid
  2685. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2686. multichannels evaluation is disabled
  2687. @item chs
  2688. number of channels
  2689. @item chlayout
  2690. channel_layout, see libavutil/channel_layout.h
  2691. @end table
  2692. and functions:
  2693. @table @option
  2694. @item gain_interpolate(f)
  2695. interpolate gain on frequency f based on gain_entry
  2696. @item cubic_interpolate(f)
  2697. same as gain_interpolate, but smoother
  2698. @end table
  2699. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2700. @item gain_entry
  2701. Set gain entry for gain_interpolate function. The expression can
  2702. contain functions:
  2703. @table @option
  2704. @item entry(f, g)
  2705. store gain entry at frequency f with value g
  2706. @end table
  2707. This option is also available as command.
  2708. @item delay
  2709. Set filter delay in seconds. Higher value means more accurate.
  2710. Default is @code{0.01}.
  2711. @item accuracy
  2712. Set filter accuracy in Hz. Lower value means more accurate.
  2713. Default is @code{5}.
  2714. @item wfunc
  2715. Set window function. Acceptable values are:
  2716. @table @option
  2717. @item rectangular
  2718. rectangular window, useful when gain curve is already smooth
  2719. @item hann
  2720. hann window (default)
  2721. @item hamming
  2722. hamming window
  2723. @item blackman
  2724. blackman window
  2725. @item nuttall3
  2726. 3-terms continuous 1st derivative nuttall window
  2727. @item mnuttall3
  2728. minimum 3-terms discontinuous nuttall window
  2729. @item nuttall
  2730. 4-terms continuous 1st derivative nuttall window
  2731. @item bnuttall
  2732. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2733. @item bharris
  2734. blackman-harris window
  2735. @item tukey
  2736. tukey window
  2737. @end table
  2738. @item fixed
  2739. If enabled, use fixed number of audio samples. This improves speed when
  2740. filtering with large delay. Default is disabled.
  2741. @item multi
  2742. Enable multichannels evaluation on gain. Default is disabled.
  2743. @item zero_phase
  2744. Enable zero phase mode by subtracting timestamp to compensate delay.
  2745. Default is disabled.
  2746. @item scale
  2747. Set scale used by gain. Acceptable values are:
  2748. @table @option
  2749. @item linlin
  2750. linear frequency, linear gain
  2751. @item linlog
  2752. linear frequency, logarithmic (in dB) gain (default)
  2753. @item loglin
  2754. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2755. @item loglog
  2756. logarithmic frequency, logarithmic gain
  2757. @end table
  2758. @item dumpfile
  2759. Set file for dumping, suitable for gnuplot.
  2760. @item dumpscale
  2761. Set scale for dumpfile. Acceptable values are same with scale option.
  2762. Default is linlog.
  2763. @item fft2
  2764. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2765. Default is disabled.
  2766. @item min_phase
  2767. Enable minimum phase impulse response. Default is disabled.
  2768. @end table
  2769. @subsection Examples
  2770. @itemize
  2771. @item
  2772. lowpass at 1000 Hz:
  2773. @example
  2774. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2775. @end example
  2776. @item
  2777. lowpass at 1000 Hz with gain_entry:
  2778. @example
  2779. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2780. @end example
  2781. @item
  2782. custom equalization:
  2783. @example
  2784. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2785. @end example
  2786. @item
  2787. higher delay with zero phase to compensate delay:
  2788. @example
  2789. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2790. @end example
  2791. @item
  2792. lowpass on left channel, highpass on right channel:
  2793. @example
  2794. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2795. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2796. @end example
  2797. @end itemize
  2798. @section flanger
  2799. Apply a flanging effect to the audio.
  2800. The filter accepts the following options:
  2801. @table @option
  2802. @item delay
  2803. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2804. @item depth
  2805. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2806. @item regen
  2807. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2808. Default value is 0.
  2809. @item width
  2810. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2811. Default value is 71.
  2812. @item speed
  2813. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2814. @item shape
  2815. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2816. Default value is @var{sinusoidal}.
  2817. @item phase
  2818. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2819. Default value is 25.
  2820. @item interp
  2821. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2822. Default is @var{linear}.
  2823. @end table
  2824. @section haas
  2825. Apply Haas effect to audio.
  2826. Note that this makes most sense to apply on mono signals.
  2827. With this filter applied to mono signals it give some directionality and
  2828. stretches its stereo image.
  2829. The filter accepts the following options:
  2830. @table @option
  2831. @item level_in
  2832. Set input level. By default is @var{1}, or 0dB
  2833. @item level_out
  2834. Set output level. By default is @var{1}, or 0dB.
  2835. @item side_gain
  2836. Set gain applied to side part of signal. By default is @var{1}.
  2837. @item middle_source
  2838. Set kind of middle source. Can be one of the following:
  2839. @table @samp
  2840. @item left
  2841. Pick left channel.
  2842. @item right
  2843. Pick right channel.
  2844. @item mid
  2845. Pick middle part signal of stereo image.
  2846. @item side
  2847. Pick side part signal of stereo image.
  2848. @end table
  2849. @item middle_phase
  2850. Change middle phase. By default is disabled.
  2851. @item left_delay
  2852. Set left channel delay. By default is @var{2.05} milliseconds.
  2853. @item left_balance
  2854. Set left channel balance. By default is @var{-1}.
  2855. @item left_gain
  2856. Set left channel gain. By default is @var{1}.
  2857. @item left_phase
  2858. Change left phase. By default is disabled.
  2859. @item right_delay
  2860. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2861. @item right_balance
  2862. Set right channel balance. By default is @var{1}.
  2863. @item right_gain
  2864. Set right channel gain. By default is @var{1}.
  2865. @item right_phase
  2866. Change right phase. By default is enabled.
  2867. @end table
  2868. @section hdcd
  2869. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2870. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2871. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2872. of HDCD, and detects the Transient Filter flag.
  2873. @example
  2874. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2875. @end example
  2876. When using the filter with wav, note the default encoding for wav is 16-bit,
  2877. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2878. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2879. @example
  2880. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2881. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2882. @end example
  2883. The filter accepts the following options:
  2884. @table @option
  2885. @item disable_autoconvert
  2886. Disable any automatic format conversion or resampling in the filter graph.
  2887. @item process_stereo
  2888. Process the stereo channels together. If target_gain does not match between
  2889. channels, consider it invalid and use the last valid target_gain.
  2890. @item cdt_ms
  2891. Set the code detect timer period in ms.
  2892. @item force_pe
  2893. Always extend peaks above -3dBFS even if PE isn't signaled.
  2894. @item analyze_mode
  2895. Replace audio with a solid tone and adjust the amplitude to signal some
  2896. specific aspect of the decoding process. The output file can be loaded in
  2897. an audio editor alongside the original to aid analysis.
  2898. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2899. Modes are:
  2900. @table @samp
  2901. @item 0, off
  2902. Disabled
  2903. @item 1, lle
  2904. Gain adjustment level at each sample
  2905. @item 2, pe
  2906. Samples where peak extend occurs
  2907. @item 3, cdt
  2908. Samples where the code detect timer is active
  2909. @item 4, tgm
  2910. Samples where the target gain does not match between channels
  2911. @end table
  2912. @end table
  2913. @section headphone
  2914. Apply head-related transfer functions (HRTFs) to create virtual
  2915. loudspeakers around the user for binaural listening via headphones.
  2916. The HRIRs are provided via additional streams, for each channel
  2917. one stereo input stream is needed.
  2918. The filter accepts the following options:
  2919. @table @option
  2920. @item map
  2921. Set mapping of input streams for convolution.
  2922. The argument is a '|'-separated list of channel names in order as they
  2923. are given as additional stream inputs for filter.
  2924. This also specify number of input streams. Number of input streams
  2925. must be not less than number of channels in first stream plus one.
  2926. @item gain
  2927. Set gain applied to audio. Value is in dB. Default is 0.
  2928. @item type
  2929. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2930. processing audio in time domain which is slow.
  2931. @var{freq} is processing audio in frequency domain which is fast.
  2932. Default is @var{freq}.
  2933. @item lfe
  2934. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2935. @item size
  2936. Set size of frame in number of samples which will be processed at once.
  2937. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2938. @item hrir
  2939. Set format of hrir stream.
  2940. Default value is @var{stereo}. Alternative value is @var{multich}.
  2941. If value is set to @var{stereo}, number of additional streams should
  2942. be greater or equal to number of input channels in first input stream.
  2943. Also each additional stream should have stereo number of channels.
  2944. If value is set to @var{multich}, number of additional streams should
  2945. be exactly one. Also number of input channels of additional stream
  2946. should be equal or greater than twice number of channels of first input
  2947. stream.
  2948. @end table
  2949. @subsection Examples
  2950. @itemize
  2951. @item
  2952. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2953. each amovie filter use stereo file with IR coefficients as input.
  2954. The files give coefficients for each position of virtual loudspeaker:
  2955. @example
  2956. ffmpeg -i input.wav
  2957. -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"
  2958. output.wav
  2959. @end example
  2960. @item
  2961. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2962. but now in @var{multich} @var{hrir} format.
  2963. @example
  2964. 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"
  2965. output.wav
  2966. @end example
  2967. @end itemize
  2968. @section highpass
  2969. Apply a high-pass filter with 3dB point frequency.
  2970. The filter can be either single-pole, or double-pole (the default).
  2971. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2972. The filter accepts the following options:
  2973. @table @option
  2974. @item frequency, f
  2975. Set frequency in Hz. Default is 3000.
  2976. @item poles, p
  2977. Set number of poles. Default is 2.
  2978. @item width_type, t
  2979. Set method to specify band-width of filter.
  2980. @table @option
  2981. @item h
  2982. Hz
  2983. @item q
  2984. Q-Factor
  2985. @item o
  2986. octave
  2987. @item s
  2988. slope
  2989. @item k
  2990. kHz
  2991. @end table
  2992. @item width, w
  2993. Specify the band-width of a filter in width_type units.
  2994. Applies only to double-pole filter.
  2995. The default is 0.707q and gives a Butterworth response.
  2996. @item mix, m
  2997. How much to use filtered signal in output. Default is 1.
  2998. Range is between 0 and 1.
  2999. @item channels, c
  3000. Specify which channels to filter, by default all available are filtered.
  3001. @end table
  3002. @subsection Commands
  3003. This filter supports the following commands:
  3004. @table @option
  3005. @item frequency, f
  3006. Change highpass frequency.
  3007. Syntax for the command is : "@var{frequency}"
  3008. @item width_type, t
  3009. Change highpass width_type.
  3010. Syntax for the command is : "@var{width_type}"
  3011. @item width, w
  3012. Change highpass width.
  3013. Syntax for the command is : "@var{width}"
  3014. @item mix, m
  3015. Change highpass mix.
  3016. Syntax for the command is : "@var{mix}"
  3017. @end table
  3018. @section join
  3019. Join multiple input streams into one multi-channel stream.
  3020. It accepts the following parameters:
  3021. @table @option
  3022. @item inputs
  3023. The number of input streams. It defaults to 2.
  3024. @item channel_layout
  3025. The desired output channel layout. It defaults to stereo.
  3026. @item map
  3027. Map channels from inputs to output. The argument is a '|'-separated list of
  3028. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3029. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3030. can be either the name of the input channel (e.g. FL for front left) or its
  3031. index in the specified input stream. @var{out_channel} is the name of the output
  3032. channel.
  3033. @end table
  3034. The filter will attempt to guess the mappings when they are not specified
  3035. explicitly. It does so by first trying to find an unused matching input channel
  3036. and if that fails it picks the first unused input channel.
  3037. Join 3 inputs (with properly set channel layouts):
  3038. @example
  3039. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3040. @end example
  3041. Build a 5.1 output from 6 single-channel streams:
  3042. @example
  3043. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3044. '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'
  3045. out
  3046. @end example
  3047. @section ladspa
  3048. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3049. To enable compilation of this filter you need to configure FFmpeg with
  3050. @code{--enable-ladspa}.
  3051. @table @option
  3052. @item file, f
  3053. Specifies the name of LADSPA plugin library to load. If the environment
  3054. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3055. each one of the directories specified by the colon separated list in
  3056. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3057. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3058. @file{/usr/lib/ladspa/}.
  3059. @item plugin, p
  3060. Specifies the plugin within the library. Some libraries contain only
  3061. one plugin, but others contain many of them. If this is not set filter
  3062. will list all available plugins within the specified library.
  3063. @item controls, c
  3064. Set the '|' separated list of controls which are zero or more floating point
  3065. values that determine the behavior of the loaded plugin (for example delay,
  3066. threshold or gain).
  3067. Controls need to be defined using the following syntax:
  3068. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3069. @var{valuei} is the value set on the @var{i}-th control.
  3070. Alternatively they can be also defined using the following syntax:
  3071. @var{value0}|@var{value1}|@var{value2}|..., where
  3072. @var{valuei} is the value set on the @var{i}-th control.
  3073. If @option{controls} is set to @code{help}, all available controls and
  3074. their valid ranges are printed.
  3075. @item sample_rate, s
  3076. Specify the sample rate, default to 44100. Only used if plugin have
  3077. zero inputs.
  3078. @item nb_samples, n
  3079. Set the number of samples per channel per each output frame, default
  3080. is 1024. Only used if plugin have zero inputs.
  3081. @item duration, d
  3082. Set the minimum duration of the sourced audio. See
  3083. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3084. for the accepted syntax.
  3085. Note that the resulting duration may be greater than the specified duration,
  3086. as the generated audio is always cut at the end of a complete frame.
  3087. If not specified, or the expressed duration is negative, the audio is
  3088. supposed to be generated forever.
  3089. Only used if plugin have zero inputs.
  3090. @end table
  3091. @subsection Examples
  3092. @itemize
  3093. @item
  3094. List all available plugins within amp (LADSPA example plugin) library:
  3095. @example
  3096. ladspa=file=amp
  3097. @end example
  3098. @item
  3099. List all available controls and their valid ranges for @code{vcf_notch}
  3100. plugin from @code{VCF} library:
  3101. @example
  3102. ladspa=f=vcf:p=vcf_notch:c=help
  3103. @end example
  3104. @item
  3105. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3106. plugin library:
  3107. @example
  3108. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3109. @end example
  3110. @item
  3111. Add reverberation to the audio using TAP-plugins
  3112. (Tom's Audio Processing plugins):
  3113. @example
  3114. ladspa=file=tap_reverb:tap_reverb
  3115. @end example
  3116. @item
  3117. Generate white noise, with 0.2 amplitude:
  3118. @example
  3119. ladspa=file=cmt:noise_source_white:c=c0=.2
  3120. @end example
  3121. @item
  3122. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3123. @code{C* Audio Plugin Suite} (CAPS) library:
  3124. @example
  3125. ladspa=file=caps:Click:c=c1=20'
  3126. @end example
  3127. @item
  3128. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3129. @example
  3130. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3131. @end example
  3132. @item
  3133. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3134. @code{SWH Plugins} collection:
  3135. @example
  3136. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3137. @end example
  3138. @item
  3139. Attenuate low frequencies using Multiband EQ from Steve Harris
  3140. @code{SWH Plugins} collection:
  3141. @example
  3142. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3143. @end example
  3144. @item
  3145. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3146. (CAPS) library:
  3147. @example
  3148. ladspa=caps:Narrower
  3149. @end example
  3150. @item
  3151. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3152. @example
  3153. ladspa=caps:White:.2
  3154. @end example
  3155. @item
  3156. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3157. @example
  3158. ladspa=caps:Fractal:c=c1=1
  3159. @end example
  3160. @item
  3161. Dynamic volume normalization using @code{VLevel} plugin:
  3162. @example
  3163. ladspa=vlevel-ladspa:vlevel_mono
  3164. @end example
  3165. @end itemize
  3166. @subsection Commands
  3167. This filter supports the following commands:
  3168. @table @option
  3169. @item cN
  3170. Modify the @var{N}-th control value.
  3171. If the specified value is not valid, it is ignored and prior one is kept.
  3172. @end table
  3173. @section loudnorm
  3174. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3175. Support for both single pass (livestreams, files) and double pass (files) modes.
  3176. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  3177. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  3178. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3179. The filter accepts the following options:
  3180. @table @option
  3181. @item I, i
  3182. Set integrated loudness target.
  3183. Range is -70.0 - -5.0. Default value is -24.0.
  3184. @item LRA, lra
  3185. Set loudness range target.
  3186. Range is 1.0 - 20.0. Default value is 7.0.
  3187. @item TP, tp
  3188. Set maximum true peak.
  3189. Range is -9.0 - +0.0. Default value is -2.0.
  3190. @item measured_I, measured_i
  3191. Measured IL of input file.
  3192. Range is -99.0 - +0.0.
  3193. @item measured_LRA, measured_lra
  3194. Measured LRA of input file.
  3195. Range is 0.0 - 99.0.
  3196. @item measured_TP, measured_tp
  3197. Measured true peak of input file.
  3198. Range is -99.0 - +99.0.
  3199. @item measured_thresh
  3200. Measured threshold of input file.
  3201. Range is -99.0 - +0.0.
  3202. @item offset
  3203. Set offset gain. Gain is applied before the true-peak limiter.
  3204. Range is -99.0 - +99.0. Default is +0.0.
  3205. @item linear
  3206. Normalize linearly if possible.
  3207. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  3208. to be specified in order to use this mode.
  3209. Options are true or false. Default is true.
  3210. @item dual_mono
  3211. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3212. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3213. If set to @code{true}, this option will compensate for this effect.
  3214. Multi-channel input files are not affected by this option.
  3215. Options are true or false. Default is false.
  3216. @item print_format
  3217. Set print format for stats. Options are summary, json, or none.
  3218. Default value is none.
  3219. @end table
  3220. @section lowpass
  3221. Apply a low-pass filter with 3dB point frequency.
  3222. The filter can be either single-pole or double-pole (the default).
  3223. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3224. The filter accepts the following options:
  3225. @table @option
  3226. @item frequency, f
  3227. Set frequency in Hz. Default is 500.
  3228. @item poles, p
  3229. Set number of poles. Default is 2.
  3230. @item width_type, t
  3231. Set method to specify band-width of filter.
  3232. @table @option
  3233. @item h
  3234. Hz
  3235. @item q
  3236. Q-Factor
  3237. @item o
  3238. octave
  3239. @item s
  3240. slope
  3241. @item k
  3242. kHz
  3243. @end table
  3244. @item width, w
  3245. Specify the band-width of a filter in width_type units.
  3246. Applies only to double-pole filter.
  3247. The default is 0.707q and gives a Butterworth response.
  3248. @item mix, m
  3249. How much to use filtered signal in output. Default is 1.
  3250. Range is between 0 and 1.
  3251. @item channels, c
  3252. Specify which channels to filter, by default all available are filtered.
  3253. @end table
  3254. @subsection Examples
  3255. @itemize
  3256. @item
  3257. Lowpass only LFE channel, it LFE is not present it does nothing:
  3258. @example
  3259. lowpass=c=LFE
  3260. @end example
  3261. @end itemize
  3262. @subsection Commands
  3263. This filter supports the following commands:
  3264. @table @option
  3265. @item frequency, f
  3266. Change lowpass frequency.
  3267. Syntax for the command is : "@var{frequency}"
  3268. @item width_type, t
  3269. Change lowpass width_type.
  3270. Syntax for the command is : "@var{width_type}"
  3271. @item width, w
  3272. Change lowpass width.
  3273. Syntax for the command is : "@var{width}"
  3274. @item mix, m
  3275. Change lowpass mix.
  3276. Syntax for the command is : "@var{mix}"
  3277. @end table
  3278. @section lv2
  3279. Load a LV2 (LADSPA Version 2) plugin.
  3280. To enable compilation of this filter you need to configure FFmpeg with
  3281. @code{--enable-lv2}.
  3282. @table @option
  3283. @item plugin, p
  3284. Specifies the plugin URI. You may need to escape ':'.
  3285. @item controls, c
  3286. Set the '|' separated list of controls which are zero or more floating point
  3287. values that determine the behavior of the loaded plugin (for example delay,
  3288. threshold or gain).
  3289. If @option{controls} is set to @code{help}, all available controls and
  3290. their valid ranges are printed.
  3291. @item sample_rate, s
  3292. Specify the sample rate, default to 44100. Only used if plugin have
  3293. zero inputs.
  3294. @item nb_samples, n
  3295. Set the number of samples per channel per each output frame, default
  3296. is 1024. Only used if plugin have zero inputs.
  3297. @item duration, d
  3298. Set the minimum duration of the sourced audio. See
  3299. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3300. for the accepted syntax.
  3301. Note that the resulting duration may be greater than the specified duration,
  3302. as the generated audio is always cut at the end of a complete frame.
  3303. If not specified, or the expressed duration is negative, the audio is
  3304. supposed to be generated forever.
  3305. Only used if plugin have zero inputs.
  3306. @end table
  3307. @subsection Examples
  3308. @itemize
  3309. @item
  3310. Apply bass enhancer plugin from Calf:
  3311. @example
  3312. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3313. @end example
  3314. @item
  3315. Apply vinyl plugin from Calf:
  3316. @example
  3317. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3318. @end example
  3319. @item
  3320. Apply bit crusher plugin from ArtyFX:
  3321. @example
  3322. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3323. @end example
  3324. @end itemize
  3325. @section mcompand
  3326. Multiband Compress or expand the audio's dynamic range.
  3327. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3328. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3329. response when absent compander action.
  3330. It accepts the following parameters:
  3331. @table @option
  3332. @item args
  3333. This option syntax is:
  3334. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3335. For explanation of each item refer to compand filter documentation.
  3336. @end table
  3337. @anchor{pan}
  3338. @section pan
  3339. Mix channels with specific gain levels. The filter accepts the output
  3340. channel layout followed by a set of channels definitions.
  3341. This filter is also designed to efficiently remap the channels of an audio
  3342. stream.
  3343. The filter accepts parameters of the form:
  3344. "@var{l}|@var{outdef}|@var{outdef}|..."
  3345. @table @option
  3346. @item l
  3347. output channel layout or number of channels
  3348. @item outdef
  3349. output channel specification, of the form:
  3350. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3351. @item out_name
  3352. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3353. number (c0, c1, etc.)
  3354. @item gain
  3355. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3356. @item in_name
  3357. input channel to use, see out_name for details; it is not possible to mix
  3358. named and numbered input channels
  3359. @end table
  3360. If the `=' in a channel specification is replaced by `<', then the gains for
  3361. that specification will be renormalized so that the total is 1, thus
  3362. avoiding clipping noise.
  3363. @subsection Mixing examples
  3364. For example, if you want to down-mix from stereo to mono, but with a bigger
  3365. factor for the left channel:
  3366. @example
  3367. pan=1c|c0=0.9*c0+0.1*c1
  3368. @end example
  3369. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3370. 7-channels surround:
  3371. @example
  3372. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3373. @end example
  3374. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3375. that should be preferred (see "-ac" option) unless you have very specific
  3376. needs.
  3377. @subsection Remapping examples
  3378. The channel remapping will be effective if, and only if:
  3379. @itemize
  3380. @item gain coefficients are zeroes or ones,
  3381. @item only one input per channel output,
  3382. @end itemize
  3383. If all these conditions are satisfied, the filter will notify the user ("Pure
  3384. channel mapping detected"), and use an optimized and lossless method to do the
  3385. remapping.
  3386. For example, if you have a 5.1 source and want a stereo audio stream by
  3387. dropping the extra channels:
  3388. @example
  3389. pan="stereo| c0=FL | c1=FR"
  3390. @end example
  3391. Given the same source, you can also switch front left and front right channels
  3392. and keep the input channel layout:
  3393. @example
  3394. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3395. @end example
  3396. If the input is a stereo audio stream, you can mute the front left channel (and
  3397. still keep the stereo channel layout) with:
  3398. @example
  3399. pan="stereo|c1=c1"
  3400. @end example
  3401. Still with a stereo audio stream input, you can copy the right channel in both
  3402. front left and right:
  3403. @example
  3404. pan="stereo| c0=FR | c1=FR"
  3405. @end example
  3406. @section replaygain
  3407. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3408. outputs it unchanged.
  3409. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3410. @section resample
  3411. Convert the audio sample format, sample rate and channel layout. It is
  3412. not meant to be used directly.
  3413. @section rubberband
  3414. Apply time-stretching and pitch-shifting with librubberband.
  3415. To enable compilation of this filter, you need to configure FFmpeg with
  3416. @code{--enable-librubberband}.
  3417. The filter accepts the following options:
  3418. @table @option
  3419. @item tempo
  3420. Set tempo scale factor.
  3421. @item pitch
  3422. Set pitch scale factor.
  3423. @item transients
  3424. Set transients detector.
  3425. Possible values are:
  3426. @table @var
  3427. @item crisp
  3428. @item mixed
  3429. @item smooth
  3430. @end table
  3431. @item detector
  3432. Set detector.
  3433. Possible values are:
  3434. @table @var
  3435. @item compound
  3436. @item percussive
  3437. @item soft
  3438. @end table
  3439. @item phase
  3440. Set phase.
  3441. Possible values are:
  3442. @table @var
  3443. @item laminar
  3444. @item independent
  3445. @end table
  3446. @item window
  3447. Set processing window size.
  3448. Possible values are:
  3449. @table @var
  3450. @item standard
  3451. @item short
  3452. @item long
  3453. @end table
  3454. @item smoothing
  3455. Set smoothing.
  3456. Possible values are:
  3457. @table @var
  3458. @item off
  3459. @item on
  3460. @end table
  3461. @item formant
  3462. Enable formant preservation when shift pitching.
  3463. Possible values are:
  3464. @table @var
  3465. @item shifted
  3466. @item preserved
  3467. @end table
  3468. @item pitchq
  3469. Set pitch quality.
  3470. Possible values are:
  3471. @table @var
  3472. @item quality
  3473. @item speed
  3474. @item consistency
  3475. @end table
  3476. @item channels
  3477. Set channels.
  3478. Possible values are:
  3479. @table @var
  3480. @item apart
  3481. @item together
  3482. @end table
  3483. @end table
  3484. @section sidechaincompress
  3485. This filter acts like normal compressor but has the ability to compress
  3486. detected signal using second input signal.
  3487. It needs two input streams and returns one output stream.
  3488. First input stream will be processed depending on second stream signal.
  3489. The filtered signal then can be filtered with other filters in later stages of
  3490. processing. See @ref{pan} and @ref{amerge} filter.
  3491. The filter accepts the following options:
  3492. @table @option
  3493. @item level_in
  3494. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3495. @item mode
  3496. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3497. Default is @code{downward}.
  3498. @item threshold
  3499. If a signal of second stream raises above this level it will affect the gain
  3500. reduction of first stream.
  3501. By default is 0.125. Range is between 0.00097563 and 1.
  3502. @item ratio
  3503. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3504. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3505. Default is 2. Range is between 1 and 20.
  3506. @item attack
  3507. Amount of milliseconds the signal has to rise above the threshold before gain
  3508. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3509. @item release
  3510. Amount of milliseconds the signal has to fall below the threshold before
  3511. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3512. @item makeup
  3513. Set the amount by how much signal will be amplified after processing.
  3514. Default is 1. Range is from 1 to 64.
  3515. @item knee
  3516. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3517. Default is 2.82843. Range is between 1 and 8.
  3518. @item link
  3519. Choose if the @code{average} level between all channels of side-chain stream
  3520. or the louder(@code{maximum}) channel of side-chain stream affects the
  3521. reduction. Default is @code{average}.
  3522. @item detection
  3523. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3524. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3525. @item level_sc
  3526. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3527. @item mix
  3528. How much to use compressed signal in output. Default is 1.
  3529. Range is between 0 and 1.
  3530. @end table
  3531. @subsection Examples
  3532. @itemize
  3533. @item
  3534. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3535. depending on the signal of 2nd input and later compressed signal to be
  3536. merged with 2nd input:
  3537. @example
  3538. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3539. @end example
  3540. @end itemize
  3541. @section sidechaingate
  3542. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3543. filter the detected signal before sending it to the gain reduction stage.
  3544. Normally a gate uses the full range signal to detect a level above the
  3545. threshold.
  3546. For example: If you cut all lower frequencies from your sidechain signal
  3547. the gate will decrease the volume of your track only if not enough highs
  3548. appear. With this technique you are able to reduce the resonation of a
  3549. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3550. guitar.
  3551. It needs two input streams and returns one output stream.
  3552. First input stream will be processed depending on second stream signal.
  3553. The filter accepts the following options:
  3554. @table @option
  3555. @item level_in
  3556. Set input level before filtering.
  3557. Default is 1. Allowed range is from 0.015625 to 64.
  3558. @item mode
  3559. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3560. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3561. will be amplified, expanding dynamic range in upward direction.
  3562. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3563. @item range
  3564. Set the level of gain reduction when the signal is below the threshold.
  3565. Default is 0.06125. Allowed range is from 0 to 1.
  3566. Setting this to 0 disables reduction and then filter behaves like expander.
  3567. @item threshold
  3568. If a signal rises above this level the gain reduction is released.
  3569. Default is 0.125. Allowed range is from 0 to 1.
  3570. @item ratio
  3571. Set a ratio about which the signal is reduced.
  3572. Default is 2. Allowed range is from 1 to 9000.
  3573. @item attack
  3574. Amount of milliseconds the signal has to rise above the threshold before gain
  3575. reduction stops.
  3576. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3577. @item release
  3578. Amount of milliseconds the signal has to fall below the threshold before the
  3579. reduction is increased again. Default is 250 milliseconds.
  3580. Allowed range is from 0.01 to 9000.
  3581. @item makeup
  3582. Set amount of amplification of signal after processing.
  3583. Default is 1. Allowed range is from 1 to 64.
  3584. @item knee
  3585. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3586. Default is 2.828427125. Allowed range is from 1 to 8.
  3587. @item detection
  3588. Choose if exact signal should be taken for detection or an RMS like one.
  3589. Default is rms. Can be peak or rms.
  3590. @item link
  3591. Choose if the average level between all channels or the louder channel affects
  3592. the reduction.
  3593. Default is average. Can be average or maximum.
  3594. @item level_sc
  3595. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3596. @end table
  3597. @section silencedetect
  3598. Detect silence in an audio stream.
  3599. This filter logs a message when it detects that the input audio volume is less
  3600. or equal to a noise tolerance value for a duration greater or equal to the
  3601. minimum detected noise duration.
  3602. The printed times and duration are expressed in seconds.
  3603. The filter accepts the following options:
  3604. @table @option
  3605. @item noise, n
  3606. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3607. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3608. @item duration, d
  3609. Set silence duration until notification (default is 2 seconds).
  3610. @item mono, m
  3611. Process each channel separately, instead of combined. By default is disabled.
  3612. @end table
  3613. @subsection Examples
  3614. @itemize
  3615. @item
  3616. Detect 5 seconds of silence with -50dB noise tolerance:
  3617. @example
  3618. silencedetect=n=-50dB:d=5
  3619. @end example
  3620. @item
  3621. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3622. tolerance in @file{silence.mp3}:
  3623. @example
  3624. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3625. @end example
  3626. @end itemize
  3627. @section silenceremove
  3628. Remove silence from the beginning, middle or end of the audio.
  3629. The filter accepts the following options:
  3630. @table @option
  3631. @item start_periods
  3632. This value is used to indicate if audio should be trimmed at beginning of
  3633. the audio. A value of zero indicates no silence should be trimmed from the
  3634. beginning. When specifying a non-zero value, it trims audio up until it
  3635. finds non-silence. Normally, when trimming silence from beginning of audio
  3636. the @var{start_periods} will be @code{1} but it can be increased to higher
  3637. values to trim all audio up to specific count of non-silence periods.
  3638. Default value is @code{0}.
  3639. @item start_duration
  3640. Specify the amount of time that non-silence must be detected before it stops
  3641. trimming audio. By increasing the duration, bursts of noises can be treated
  3642. as silence and trimmed off. Default value is @code{0}.
  3643. @item start_threshold
  3644. This indicates what sample value should be treated as silence. For digital
  3645. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3646. you may wish to increase the value to account for background noise.
  3647. Can be specified in dB (in case "dB" is appended to the specified value)
  3648. or amplitude ratio. Default value is @code{0}.
  3649. @item start_silence
  3650. Specify max duration of silence at beginning that will be kept after
  3651. trimming. Default is 0, which is equal to trimming all samples detected
  3652. as silence.
  3653. @item start_mode
  3654. Specify mode of detection of silence end in start of multi-channel audio.
  3655. Can be @var{any} or @var{all}. Default is @var{any}.
  3656. With @var{any}, any sample that is detected as non-silence will cause
  3657. stopped trimming of silence.
  3658. With @var{all}, only if all channels are detected as non-silence will cause
  3659. stopped trimming of silence.
  3660. @item stop_periods
  3661. Set the count for trimming silence from the end of audio.
  3662. To remove silence from the middle of a file, specify a @var{stop_periods}
  3663. that is negative. This value is then treated as a positive value and is
  3664. used to indicate the effect should restart processing as specified by
  3665. @var{start_periods}, making it suitable for removing periods of silence
  3666. in the middle of the audio.
  3667. Default value is @code{0}.
  3668. @item stop_duration
  3669. Specify a duration of silence that must exist before audio is not copied any
  3670. more. By specifying a higher duration, silence that is wanted can be left in
  3671. the audio.
  3672. Default value is @code{0}.
  3673. @item stop_threshold
  3674. This is the same as @option{start_threshold} but for trimming silence from
  3675. the end of audio.
  3676. Can be specified in dB (in case "dB" is appended to the specified value)
  3677. or amplitude ratio. Default value is @code{0}.
  3678. @item stop_silence
  3679. Specify max duration of silence at end that will be kept after
  3680. trimming. Default is 0, which is equal to trimming all samples detected
  3681. as silence.
  3682. @item stop_mode
  3683. Specify mode of detection of silence start in end of multi-channel audio.
  3684. Can be @var{any} or @var{all}. Default is @var{any}.
  3685. With @var{any}, any sample that is detected as non-silence will cause
  3686. stopped trimming of silence.
  3687. With @var{all}, only if all channels are detected as non-silence will cause
  3688. stopped trimming of silence.
  3689. @item detection
  3690. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3691. and works better with digital silence which is exactly 0.
  3692. Default value is @code{rms}.
  3693. @item window
  3694. Set duration in number of seconds used to calculate size of window in number
  3695. of samples for detecting silence.
  3696. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3697. @end table
  3698. @subsection Examples
  3699. @itemize
  3700. @item
  3701. The following example shows how this filter can be used to start a recording
  3702. that does not contain the delay at the start which usually occurs between
  3703. pressing the record button and the start of the performance:
  3704. @example
  3705. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3706. @end example
  3707. @item
  3708. Trim all silence encountered from beginning to end where there is more than 1
  3709. second of silence in audio:
  3710. @example
  3711. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3712. @end example
  3713. @item
  3714. Trim all digital silence samples, using peak detection, from beginning to end
  3715. where there is more than 0 samples of digital silence in audio and digital
  3716. silence is detected in all channels at same positions in stream:
  3717. @example
  3718. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  3719. @end example
  3720. @end itemize
  3721. @section sofalizer
  3722. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3723. loudspeakers around the user for binaural listening via headphones (audio
  3724. formats up to 9 channels supported).
  3725. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3726. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3727. Austrian Academy of Sciences.
  3728. To enable compilation of this filter you need to configure FFmpeg with
  3729. @code{--enable-libmysofa}.
  3730. The filter accepts the following options:
  3731. @table @option
  3732. @item sofa
  3733. Set the SOFA file used for rendering.
  3734. @item gain
  3735. Set gain applied to audio. Value is in dB. Default is 0.
  3736. @item rotation
  3737. Set rotation of virtual loudspeakers in deg. Default is 0.
  3738. @item elevation
  3739. Set elevation of virtual speakers in deg. Default is 0.
  3740. @item radius
  3741. Set distance in meters between loudspeakers and the listener with near-field
  3742. HRTFs. Default is 1.
  3743. @item type
  3744. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3745. processing audio in time domain which is slow.
  3746. @var{freq} is processing audio in frequency domain which is fast.
  3747. Default is @var{freq}.
  3748. @item speakers
  3749. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3750. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3751. Each virtual loudspeaker is described with short channel name following with
  3752. azimuth and elevation in degrees.
  3753. Each virtual loudspeaker description is separated by '|'.
  3754. For example to override front left and front right channel positions use:
  3755. 'speakers=FL 45 15|FR 345 15'.
  3756. Descriptions with unrecognised channel names are ignored.
  3757. @item lfegain
  3758. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3759. @item framesize
  3760. Set custom frame size in number of samples. Default is 1024.
  3761. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3762. is set to @var{freq}.
  3763. @item normalize
  3764. Should all IRs be normalized upon importing SOFA file.
  3765. By default is enabled.
  3766. @item interpolate
  3767. Should nearest IRs be interpolated with neighbor IRs if exact position
  3768. does not match. By default is disabled.
  3769. @item minphase
  3770. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3771. @item anglestep
  3772. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3773. @item radstep
  3774. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3775. @end table
  3776. @subsection Examples
  3777. @itemize
  3778. @item
  3779. Using ClubFritz6 sofa file:
  3780. @example
  3781. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3782. @end example
  3783. @item
  3784. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3785. @example
  3786. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3787. @end example
  3788. @item
  3789. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3790. and also with custom gain:
  3791. @example
  3792. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3793. @end example
  3794. @end itemize
  3795. @section stereotools
  3796. This filter has some handy utilities to manage stereo signals, for converting
  3797. M/S stereo recordings to L/R signal while having control over the parameters
  3798. or spreading the stereo image of master track.
  3799. The filter accepts the following options:
  3800. @table @option
  3801. @item level_in
  3802. Set input level before filtering for both channels. Defaults is 1.
  3803. Allowed range is from 0.015625 to 64.
  3804. @item level_out
  3805. Set output level after filtering for both channels. Defaults is 1.
  3806. Allowed range is from 0.015625 to 64.
  3807. @item balance_in
  3808. Set input balance between both channels. Default is 0.
  3809. Allowed range is from -1 to 1.
  3810. @item balance_out
  3811. Set output balance between both channels. Default is 0.
  3812. Allowed range is from -1 to 1.
  3813. @item softclip
  3814. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3815. clipping. Disabled by default.
  3816. @item mutel
  3817. Mute the left channel. Disabled by default.
  3818. @item muter
  3819. Mute the right channel. Disabled by default.
  3820. @item phasel
  3821. Change the phase of the left channel. Disabled by default.
  3822. @item phaser
  3823. Change the phase of the right channel. Disabled by default.
  3824. @item mode
  3825. Set stereo mode. Available values are:
  3826. @table @samp
  3827. @item lr>lr
  3828. Left/Right to Left/Right, this is default.
  3829. @item lr>ms
  3830. Left/Right to Mid/Side.
  3831. @item ms>lr
  3832. Mid/Side to Left/Right.
  3833. @item lr>ll
  3834. Left/Right to Left/Left.
  3835. @item lr>rr
  3836. Left/Right to Right/Right.
  3837. @item lr>l+r
  3838. Left/Right to Left + Right.
  3839. @item lr>rl
  3840. Left/Right to Right/Left.
  3841. @item ms>ll
  3842. Mid/Side to Left/Left.
  3843. @item ms>rr
  3844. Mid/Side to Right/Right.
  3845. @end table
  3846. @item slev
  3847. Set level of side signal. Default is 1.
  3848. Allowed range is from 0.015625 to 64.
  3849. @item sbal
  3850. Set balance of side signal. Default is 0.
  3851. Allowed range is from -1 to 1.
  3852. @item mlev
  3853. Set level of the middle signal. Default is 1.
  3854. Allowed range is from 0.015625 to 64.
  3855. @item mpan
  3856. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3857. @item base
  3858. Set stereo base between mono and inversed channels. Default is 0.
  3859. Allowed range is from -1 to 1.
  3860. @item delay
  3861. Set delay in milliseconds how much to delay left from right channel and
  3862. vice versa. Default is 0. Allowed range is from -20 to 20.
  3863. @item sclevel
  3864. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3865. @item phase
  3866. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3867. @item bmode_in, bmode_out
  3868. Set balance mode for balance_in/balance_out option.
  3869. Can be one of the following:
  3870. @table @samp
  3871. @item balance
  3872. Classic balance mode. Attenuate one channel at time.
  3873. Gain is raised up to 1.
  3874. @item amplitude
  3875. Similar as classic mode above but gain is raised up to 2.
  3876. @item power
  3877. Equal power distribution, from -6dB to +6dB range.
  3878. @end table
  3879. @end table
  3880. @subsection Examples
  3881. @itemize
  3882. @item
  3883. Apply karaoke like effect:
  3884. @example
  3885. stereotools=mlev=0.015625
  3886. @end example
  3887. @item
  3888. Convert M/S signal to L/R:
  3889. @example
  3890. "stereotools=mode=ms>lr"
  3891. @end example
  3892. @end itemize
  3893. @section stereowiden
  3894. This filter enhance the stereo effect by suppressing signal common to both
  3895. channels and by delaying the signal of left into right and vice versa,
  3896. thereby widening the stereo effect.
  3897. The filter accepts the following options:
  3898. @table @option
  3899. @item delay
  3900. Time in milliseconds of the delay of left signal into right and vice versa.
  3901. Default is 20 milliseconds.
  3902. @item feedback
  3903. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3904. effect of left signal in right output and vice versa which gives widening
  3905. effect. Default is 0.3.
  3906. @item crossfeed
  3907. Cross feed of left into right with inverted phase. This helps in suppressing
  3908. the mono. If the value is 1 it will cancel all the signal common to both
  3909. channels. Default is 0.3.
  3910. @item drymix
  3911. Set level of input signal of original channel. Default is 0.8.
  3912. @end table
  3913. @section superequalizer
  3914. Apply 18 band equalizer.
  3915. The filter accepts the following options:
  3916. @table @option
  3917. @item 1b
  3918. Set 65Hz band gain.
  3919. @item 2b
  3920. Set 92Hz band gain.
  3921. @item 3b
  3922. Set 131Hz band gain.
  3923. @item 4b
  3924. Set 185Hz band gain.
  3925. @item 5b
  3926. Set 262Hz band gain.
  3927. @item 6b
  3928. Set 370Hz band gain.
  3929. @item 7b
  3930. Set 523Hz band gain.
  3931. @item 8b
  3932. Set 740Hz band gain.
  3933. @item 9b
  3934. Set 1047Hz band gain.
  3935. @item 10b
  3936. Set 1480Hz band gain.
  3937. @item 11b
  3938. Set 2093Hz band gain.
  3939. @item 12b
  3940. Set 2960Hz band gain.
  3941. @item 13b
  3942. Set 4186Hz band gain.
  3943. @item 14b
  3944. Set 5920Hz band gain.
  3945. @item 15b
  3946. Set 8372Hz band gain.
  3947. @item 16b
  3948. Set 11840Hz band gain.
  3949. @item 17b
  3950. Set 16744Hz band gain.
  3951. @item 18b
  3952. Set 20000Hz band gain.
  3953. @end table
  3954. @section surround
  3955. Apply audio surround upmix filter.
  3956. This filter allows to produce multichannel output from audio stream.
  3957. The filter accepts the following options:
  3958. @table @option
  3959. @item chl_out
  3960. Set output channel layout. By default, this is @var{5.1}.
  3961. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3962. for the required syntax.
  3963. @item chl_in
  3964. Set input channel layout. By default, this is @var{stereo}.
  3965. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3966. for the required syntax.
  3967. @item level_in
  3968. Set input volume level. By default, this is @var{1}.
  3969. @item level_out
  3970. Set output volume level. By default, this is @var{1}.
  3971. @item lfe
  3972. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3973. @item lfe_low
  3974. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3975. @item lfe_high
  3976. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3977. @item lfe_mode
  3978. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  3979. In @var{add} mode, LFE channel is created from input audio and added to output.
  3980. In @var{sub} mode, LFE channel is created from input audio and added to output but
  3981. also all non-LFE output channels are subtracted with output LFE channel.
  3982. @item angle
  3983. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  3984. Default is @var{90}.
  3985. @item fc_in
  3986. Set front center input volume. By default, this is @var{1}.
  3987. @item fc_out
  3988. Set front center output volume. By default, this is @var{1}.
  3989. @item fl_in
  3990. Set front left input volume. By default, this is @var{1}.
  3991. @item fl_out
  3992. Set front left output volume. By default, this is @var{1}.
  3993. @item fr_in
  3994. Set front right input volume. By default, this is @var{1}.
  3995. @item fr_out
  3996. Set front right output volume. By default, this is @var{1}.
  3997. @item sl_in
  3998. Set side left input volume. By default, this is @var{1}.
  3999. @item sl_out
  4000. Set side left output volume. By default, this is @var{1}.
  4001. @item sr_in
  4002. Set side right input volume. By default, this is @var{1}.
  4003. @item sr_out
  4004. Set side right output volume. By default, this is @var{1}.
  4005. @item bl_in
  4006. Set back left input volume. By default, this is @var{1}.
  4007. @item bl_out
  4008. Set back left output volume. By default, this is @var{1}.
  4009. @item br_in
  4010. Set back right input volume. By default, this is @var{1}.
  4011. @item br_out
  4012. Set back right output volume. By default, this is @var{1}.
  4013. @item bc_in
  4014. Set back center input volume. By default, this is @var{1}.
  4015. @item bc_out
  4016. Set back center output volume. By default, this is @var{1}.
  4017. @item lfe_in
  4018. Set LFE input volume. By default, this is @var{1}.
  4019. @item lfe_out
  4020. Set LFE output volume. By default, this is @var{1}.
  4021. @item allx
  4022. Set spread usage of stereo image across X axis for all channels.
  4023. @item ally
  4024. Set spread usage of stereo image across Y axis for all channels.
  4025. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4026. Set spread usage of stereo image across X axis for each channel.
  4027. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4028. Set spread usage of stereo image across Y axis for each channel.
  4029. @item win_size
  4030. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4031. @item win_func
  4032. Set window function.
  4033. It accepts the following values:
  4034. @table @samp
  4035. @item rect
  4036. @item bartlett
  4037. @item hann, hanning
  4038. @item hamming
  4039. @item blackman
  4040. @item welch
  4041. @item flattop
  4042. @item bharris
  4043. @item bnuttall
  4044. @item bhann
  4045. @item sine
  4046. @item nuttall
  4047. @item lanczos
  4048. @item gauss
  4049. @item tukey
  4050. @item dolph
  4051. @item cauchy
  4052. @item parzen
  4053. @item poisson
  4054. @item bohman
  4055. @end table
  4056. Default is @code{hann}.
  4057. @item overlap
  4058. Set window overlap. If set to 1, the recommended overlap for selected
  4059. window function will be picked. Default is @code{0.5}.
  4060. @end table
  4061. @section treble, highshelf
  4062. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4063. shelving filter with a response similar to that of a standard
  4064. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4065. The filter accepts the following options:
  4066. @table @option
  4067. @item gain, g
  4068. Give the gain at whichever is the lower of ~22 kHz and the
  4069. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4070. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4071. @item frequency, f
  4072. Set the filter's central frequency and so can be used
  4073. to extend or reduce the frequency range to be boosted or cut.
  4074. The default value is @code{3000} Hz.
  4075. @item width_type, t
  4076. Set method to specify band-width of filter.
  4077. @table @option
  4078. @item h
  4079. Hz
  4080. @item q
  4081. Q-Factor
  4082. @item o
  4083. octave
  4084. @item s
  4085. slope
  4086. @item k
  4087. kHz
  4088. @end table
  4089. @item width, w
  4090. Determine how steep is the filter's shelf transition.
  4091. @item mix, m
  4092. How much to use filtered signal in output. Default is 1.
  4093. Range is between 0 and 1.
  4094. @item channels, c
  4095. Specify which channels to filter, by default all available are filtered.
  4096. @end table
  4097. @subsection Commands
  4098. This filter supports the following commands:
  4099. @table @option
  4100. @item frequency, f
  4101. Change treble frequency.
  4102. Syntax for the command is : "@var{frequency}"
  4103. @item width_type, t
  4104. Change treble width_type.
  4105. Syntax for the command is : "@var{width_type}"
  4106. @item width, w
  4107. Change treble width.
  4108. Syntax for the command is : "@var{width}"
  4109. @item gain, g
  4110. Change treble gain.
  4111. Syntax for the command is : "@var{gain}"
  4112. @item mix, m
  4113. Change treble mix.
  4114. Syntax for the command is : "@var{mix}"
  4115. @end table
  4116. @section tremolo
  4117. Sinusoidal amplitude modulation.
  4118. The filter accepts the following options:
  4119. @table @option
  4120. @item f
  4121. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4122. (20 Hz or lower) will result in a tremolo effect.
  4123. This filter may also be used as a ring modulator by specifying
  4124. a modulation frequency higher than 20 Hz.
  4125. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4126. @item d
  4127. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4128. Default value is 0.5.
  4129. @end table
  4130. @section vibrato
  4131. Sinusoidal phase modulation.
  4132. The filter accepts the following options:
  4133. @table @option
  4134. @item f
  4135. Modulation frequency in Hertz.
  4136. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4137. @item d
  4138. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4139. Default value is 0.5.
  4140. @end table
  4141. @section volume
  4142. Adjust the input audio volume.
  4143. It accepts the following parameters:
  4144. @table @option
  4145. @item volume
  4146. Set audio volume expression.
  4147. Output values are clipped to the maximum value.
  4148. The output audio volume is given by the relation:
  4149. @example
  4150. @var{output_volume} = @var{volume} * @var{input_volume}
  4151. @end example
  4152. The default value for @var{volume} is "1.0".
  4153. @item precision
  4154. This parameter represents the mathematical precision.
  4155. It determines which input sample formats will be allowed, which affects the
  4156. precision of the volume scaling.
  4157. @table @option
  4158. @item fixed
  4159. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4160. @item float
  4161. 32-bit floating-point; this limits input sample format to FLT. (default)
  4162. @item double
  4163. 64-bit floating-point; this limits input sample format to DBL.
  4164. @end table
  4165. @item replaygain
  4166. Choose the behaviour on encountering ReplayGain side data in input frames.
  4167. @table @option
  4168. @item drop
  4169. Remove ReplayGain side data, ignoring its contents (the default).
  4170. @item ignore
  4171. Ignore ReplayGain side data, but leave it in the frame.
  4172. @item track
  4173. Prefer the track gain, if present.
  4174. @item album
  4175. Prefer the album gain, if present.
  4176. @end table
  4177. @item replaygain_preamp
  4178. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4179. Default value for @var{replaygain_preamp} is 0.0.
  4180. @item eval
  4181. Set when the volume expression is evaluated.
  4182. It accepts the following values:
  4183. @table @samp
  4184. @item once
  4185. only evaluate expression once during the filter initialization, or
  4186. when the @samp{volume} command is sent
  4187. @item frame
  4188. evaluate expression for each incoming frame
  4189. @end table
  4190. Default value is @samp{once}.
  4191. @end table
  4192. The volume expression can contain the following parameters.
  4193. @table @option
  4194. @item n
  4195. frame number (starting at zero)
  4196. @item nb_channels
  4197. number of channels
  4198. @item nb_consumed_samples
  4199. number of samples consumed by the filter
  4200. @item nb_samples
  4201. number of samples in the current frame
  4202. @item pos
  4203. original frame position in the file
  4204. @item pts
  4205. frame PTS
  4206. @item sample_rate
  4207. sample rate
  4208. @item startpts
  4209. PTS at start of stream
  4210. @item startt
  4211. time at start of stream
  4212. @item t
  4213. frame time
  4214. @item tb
  4215. timestamp timebase
  4216. @item volume
  4217. last set volume value
  4218. @end table
  4219. Note that when @option{eval} is set to @samp{once} only the
  4220. @var{sample_rate} and @var{tb} variables are available, all other
  4221. variables will evaluate to NAN.
  4222. @subsection Commands
  4223. This filter supports the following commands:
  4224. @table @option
  4225. @item volume
  4226. Modify the volume expression.
  4227. The command accepts the same syntax of the corresponding option.
  4228. If the specified expression is not valid, it is kept at its current
  4229. value.
  4230. @item replaygain_noclip
  4231. Prevent clipping by limiting the gain applied.
  4232. Default value for @var{replaygain_noclip} is 1.
  4233. @end table
  4234. @subsection Examples
  4235. @itemize
  4236. @item
  4237. Halve the input audio volume:
  4238. @example
  4239. volume=volume=0.5
  4240. volume=volume=1/2
  4241. volume=volume=-6.0206dB
  4242. @end example
  4243. In all the above example the named key for @option{volume} can be
  4244. omitted, for example like in:
  4245. @example
  4246. volume=0.5
  4247. @end example
  4248. @item
  4249. Increase input audio power by 6 decibels using fixed-point precision:
  4250. @example
  4251. volume=volume=6dB:precision=fixed
  4252. @end example
  4253. @item
  4254. Fade volume after time 10 with an annihilation period of 5 seconds:
  4255. @example
  4256. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4257. @end example
  4258. @end itemize
  4259. @section volumedetect
  4260. Detect the volume of the input video.
  4261. The filter has no parameters. The input is not modified. Statistics about
  4262. the volume will be printed in the log when the input stream end is reached.
  4263. In particular it will show the mean volume (root mean square), maximum
  4264. volume (on a per-sample basis), and the beginning of a histogram of the
  4265. registered volume values (from the maximum value to a cumulated 1/1000 of
  4266. the samples).
  4267. All volumes are in decibels relative to the maximum PCM value.
  4268. @subsection Examples
  4269. Here is an excerpt of the output:
  4270. @example
  4271. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4272. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4273. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4274. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4275. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4276. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4277. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4278. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4279. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4280. @end example
  4281. It means that:
  4282. @itemize
  4283. @item
  4284. The mean square energy is approximately -27 dB, or 10^-2.7.
  4285. @item
  4286. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4287. @item
  4288. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4289. @end itemize
  4290. In other words, raising the volume by +4 dB does not cause any clipping,
  4291. raising it by +5 dB causes clipping for 6 samples, etc.
  4292. @c man end AUDIO FILTERS
  4293. @chapter Audio Sources
  4294. @c man begin AUDIO SOURCES
  4295. Below is a description of the currently available audio sources.
  4296. @section abuffer
  4297. Buffer audio frames, and make them available to the filter chain.
  4298. This source is mainly intended for a programmatic use, in particular
  4299. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4300. It accepts the following parameters:
  4301. @table @option
  4302. @item time_base
  4303. The timebase which will be used for timestamps of submitted frames. It must be
  4304. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4305. @item sample_rate
  4306. The sample rate of the incoming audio buffers.
  4307. @item sample_fmt
  4308. The sample format of the incoming audio buffers.
  4309. Either a sample format name or its corresponding integer representation from
  4310. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4311. @item channel_layout
  4312. The channel layout of the incoming audio buffers.
  4313. Either a channel layout name from channel_layout_map in
  4314. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4315. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4316. @item channels
  4317. The number of channels of the incoming audio buffers.
  4318. If both @var{channels} and @var{channel_layout} are specified, then they
  4319. must be consistent.
  4320. @end table
  4321. @subsection Examples
  4322. @example
  4323. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4324. @end example
  4325. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4326. Since the sample format with name "s16p" corresponds to the number
  4327. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4328. equivalent to:
  4329. @example
  4330. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4331. @end example
  4332. @section aevalsrc
  4333. Generate an audio signal specified by an expression.
  4334. This source accepts in input one or more expressions (one for each
  4335. channel), which are evaluated and used to generate a corresponding
  4336. audio signal.
  4337. This source accepts the following options:
  4338. @table @option
  4339. @item exprs
  4340. Set the '|'-separated expressions list for each separate channel. In case the
  4341. @option{channel_layout} option is not specified, the selected channel layout
  4342. depends on the number of provided expressions. Otherwise the last
  4343. specified expression is applied to the remaining output channels.
  4344. @item channel_layout, c
  4345. Set the channel layout. The number of channels in the specified layout
  4346. must be equal to the number of specified expressions.
  4347. @item duration, d
  4348. Set the minimum duration of the sourced audio. See
  4349. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4350. for the accepted syntax.
  4351. Note that the resulting duration may be greater than the specified
  4352. duration, as the generated audio is always cut at the end of a
  4353. complete frame.
  4354. If not specified, or the expressed duration is negative, the audio is
  4355. supposed to be generated forever.
  4356. @item nb_samples, n
  4357. Set the number of samples per channel per each output frame,
  4358. default to 1024.
  4359. @item sample_rate, s
  4360. Specify the sample rate, default to 44100.
  4361. @end table
  4362. Each expression in @var{exprs} can contain the following constants:
  4363. @table @option
  4364. @item n
  4365. number of the evaluated sample, starting from 0
  4366. @item t
  4367. time of the evaluated sample expressed in seconds, starting from 0
  4368. @item s
  4369. sample rate
  4370. @end table
  4371. @subsection Examples
  4372. @itemize
  4373. @item
  4374. Generate silence:
  4375. @example
  4376. aevalsrc=0
  4377. @end example
  4378. @item
  4379. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4380. 8000 Hz:
  4381. @example
  4382. aevalsrc="sin(440*2*PI*t):s=8000"
  4383. @end example
  4384. @item
  4385. Generate a two channels signal, specify the channel layout (Front
  4386. Center + Back Center) explicitly:
  4387. @example
  4388. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4389. @end example
  4390. @item
  4391. Generate white noise:
  4392. @example
  4393. aevalsrc="-2+random(0)"
  4394. @end example
  4395. @item
  4396. Generate an amplitude modulated signal:
  4397. @example
  4398. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4399. @end example
  4400. @item
  4401. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4402. @example
  4403. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4404. @end example
  4405. @end itemize
  4406. @section anullsrc
  4407. The null audio source, return unprocessed audio frames. It is mainly useful
  4408. as a template and to be employed in analysis / debugging tools, or as
  4409. the source for filters which ignore the input data (for example the sox
  4410. synth filter).
  4411. This source accepts the following options:
  4412. @table @option
  4413. @item channel_layout, cl
  4414. Specifies the channel layout, and can be either an integer or a string
  4415. representing a channel layout. The default value of @var{channel_layout}
  4416. is "stereo".
  4417. Check the channel_layout_map definition in
  4418. @file{libavutil/channel_layout.c} for the mapping between strings and
  4419. channel layout values.
  4420. @item sample_rate, r
  4421. Specifies the sample rate, and defaults to 44100.
  4422. @item nb_samples, n
  4423. Set the number of samples per requested frames.
  4424. @end table
  4425. @subsection Examples
  4426. @itemize
  4427. @item
  4428. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4429. @example
  4430. anullsrc=r=48000:cl=4
  4431. @end example
  4432. @item
  4433. Do the same operation with a more obvious syntax:
  4434. @example
  4435. anullsrc=r=48000:cl=mono
  4436. @end example
  4437. @end itemize
  4438. All the parameters need to be explicitly defined.
  4439. @section flite
  4440. Synthesize a voice utterance using the libflite library.
  4441. To enable compilation of this filter you need to configure FFmpeg with
  4442. @code{--enable-libflite}.
  4443. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4444. The filter accepts the following options:
  4445. @table @option
  4446. @item list_voices
  4447. If set to 1, list the names of the available voices and exit
  4448. immediately. Default value is 0.
  4449. @item nb_samples, n
  4450. Set the maximum number of samples per frame. Default value is 512.
  4451. @item textfile
  4452. Set the filename containing the text to speak.
  4453. @item text
  4454. Set the text to speak.
  4455. @item voice, v
  4456. Set the voice to use for the speech synthesis. Default value is
  4457. @code{kal}. See also the @var{list_voices} option.
  4458. @end table
  4459. @subsection Examples
  4460. @itemize
  4461. @item
  4462. Read from file @file{speech.txt}, and synthesize the text using the
  4463. standard flite voice:
  4464. @example
  4465. flite=textfile=speech.txt
  4466. @end example
  4467. @item
  4468. Read the specified text selecting the @code{slt} voice:
  4469. @example
  4470. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4471. @end example
  4472. @item
  4473. Input text to ffmpeg:
  4474. @example
  4475. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4476. @end example
  4477. @item
  4478. Make @file{ffplay} speak the specified text, using @code{flite} and
  4479. the @code{lavfi} device:
  4480. @example
  4481. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4482. @end example
  4483. @end itemize
  4484. For more information about libflite, check:
  4485. @url{http://www.festvox.org/flite/}
  4486. @section anoisesrc
  4487. Generate a noise audio signal.
  4488. The filter accepts the following options:
  4489. @table @option
  4490. @item sample_rate, r
  4491. Specify the sample rate. Default value is 48000 Hz.
  4492. @item amplitude, a
  4493. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4494. is 1.0.
  4495. @item duration, d
  4496. Specify the duration of the generated audio stream. Not specifying this option
  4497. results in noise with an infinite length.
  4498. @item color, colour, c
  4499. Specify the color of noise. Available noise colors are white, pink, brown,
  4500. blue and violet. Default color is white.
  4501. @item seed, s
  4502. Specify a value used to seed the PRNG.
  4503. @item nb_samples, n
  4504. Set the number of samples per each output frame, default is 1024.
  4505. @end table
  4506. @subsection Examples
  4507. @itemize
  4508. @item
  4509. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4510. @example
  4511. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4512. @end example
  4513. @end itemize
  4514. @section hilbert
  4515. Generate odd-tap Hilbert transform FIR coefficients.
  4516. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4517. the signal by 90 degrees.
  4518. This is used in many matrix coding schemes and for analytic signal generation.
  4519. The process is often written as a multiplication by i (or j), the imaginary unit.
  4520. The filter accepts the following options:
  4521. @table @option
  4522. @item sample_rate, s
  4523. Set sample rate, default is 44100.
  4524. @item taps, t
  4525. Set length of FIR filter, default is 22051.
  4526. @item nb_samples, n
  4527. Set number of samples per each frame.
  4528. @item win_func, w
  4529. Set window function to be used when generating FIR coefficients.
  4530. @end table
  4531. @section sinc
  4532. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4533. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4534. The filter accepts the following options:
  4535. @table @option
  4536. @item sample_rate, r
  4537. Set sample rate, default is 44100.
  4538. @item nb_samples, n
  4539. Set number of samples per each frame. Default is 1024.
  4540. @item hp
  4541. Set high-pass frequency. Default is 0.
  4542. @item lp
  4543. Set low-pass frequency. Default is 0.
  4544. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4545. is higher than 0 then filter will create band-pass filter coefficients,
  4546. otherwise band-reject filter coefficients.
  4547. @item phase
  4548. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4549. @item beta
  4550. Set Kaiser window beta.
  4551. @item att
  4552. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4553. @item round
  4554. Enable rounding, by default is disabled.
  4555. @item hptaps
  4556. Set number of taps for high-pass filter.
  4557. @item lptaps
  4558. Set number of taps for low-pass filter.
  4559. @end table
  4560. @section sine
  4561. Generate an audio signal made of a sine wave with amplitude 1/8.
  4562. The audio signal is bit-exact.
  4563. The filter accepts the following options:
  4564. @table @option
  4565. @item frequency, f
  4566. Set the carrier frequency. Default is 440 Hz.
  4567. @item beep_factor, b
  4568. Enable a periodic beep every second with frequency @var{beep_factor} times
  4569. the carrier frequency. Default is 0, meaning the beep is disabled.
  4570. @item sample_rate, r
  4571. Specify the sample rate, default is 44100.
  4572. @item duration, d
  4573. Specify the duration of the generated audio stream.
  4574. @item samples_per_frame
  4575. Set the number of samples per output frame.
  4576. The expression can contain the following constants:
  4577. @table @option
  4578. @item n
  4579. The (sequential) number of the output audio frame, starting from 0.
  4580. @item pts
  4581. The PTS (Presentation TimeStamp) of the output audio frame,
  4582. expressed in @var{TB} units.
  4583. @item t
  4584. The PTS of the output audio frame, expressed in seconds.
  4585. @item TB
  4586. The timebase of the output audio frames.
  4587. @end table
  4588. Default is @code{1024}.
  4589. @end table
  4590. @subsection Examples
  4591. @itemize
  4592. @item
  4593. Generate a simple 440 Hz sine wave:
  4594. @example
  4595. sine
  4596. @end example
  4597. @item
  4598. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4599. @example
  4600. sine=220:4:d=5
  4601. sine=f=220:b=4:d=5
  4602. sine=frequency=220:beep_factor=4:duration=5
  4603. @end example
  4604. @item
  4605. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4606. pattern:
  4607. @example
  4608. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4609. @end example
  4610. @end itemize
  4611. @c man end AUDIO SOURCES
  4612. @chapter Audio Sinks
  4613. @c man begin AUDIO SINKS
  4614. Below is a description of the currently available audio sinks.
  4615. @section abuffersink
  4616. Buffer audio frames, and make them available to the end of filter chain.
  4617. This sink is mainly intended for programmatic use, in particular
  4618. through the interface defined in @file{libavfilter/buffersink.h}
  4619. or the options system.
  4620. It accepts a pointer to an AVABufferSinkContext structure, which
  4621. defines the incoming buffers' formats, to be passed as the opaque
  4622. parameter to @code{avfilter_init_filter} for initialization.
  4623. @section anullsink
  4624. Null audio sink; do absolutely nothing with the input audio. It is
  4625. mainly useful as a template and for use in analysis / debugging
  4626. tools.
  4627. @c man end AUDIO SINKS
  4628. @chapter Video Filters
  4629. @c man begin VIDEO FILTERS
  4630. When you configure your FFmpeg build, you can disable any of the
  4631. existing filters using @code{--disable-filters}.
  4632. The configure output will show the video filters included in your
  4633. build.
  4634. Below is a description of the currently available video filters.
  4635. @section addroi
  4636. Mark a region of interest in a video frame.
  4637. The frame data is passed through unchanged, but metadata is attached
  4638. to the frame indicating regions of interest which can affect the
  4639. behaviour of later encoding. Multiple regions can be marked by
  4640. applying the filter multiple times.
  4641. @table @option
  4642. @item x
  4643. Region distance in pixels from the left edge of the frame.
  4644. @item y
  4645. Region distance in pixels from the top edge of the frame.
  4646. @item w
  4647. Region width in pixels.
  4648. @item h
  4649. Region height in pixels.
  4650. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  4651. and may contain the following variables:
  4652. @table @option
  4653. @item iw
  4654. Width of the input frame.
  4655. @item ih
  4656. Height of the input frame.
  4657. @end table
  4658. @item qoffset
  4659. Quantisation offset to apply within the region.
  4660. This must be a real value in the range -1 to +1. A value of zero
  4661. indicates no quality change. A negative value asks for better quality
  4662. (less quantisation), while a positive value asks for worse quality
  4663. (greater quantisation).
  4664. The range is calibrated so that the extreme values indicate the
  4665. largest possible offset - if the rest of the frame is encoded with the
  4666. worst possible quality, an offset of -1 indicates that this region
  4667. should be encoded with the best possible quality anyway. Intermediate
  4668. values are then interpolated in some codec-dependent way.
  4669. For example, in 10-bit H.264 the quantisation parameter varies between
  4670. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  4671. this region should be encoded with a QP around one-tenth of the full
  4672. range better than the rest of the frame. So, if most of the frame
  4673. were to be encoded with a QP of around 30, this region would get a QP
  4674. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  4675. An extreme value of -1 would indicate that this region should be
  4676. encoded with the best possible quality regardless of the treatment of
  4677. the rest of the frame - that is, should be encoded at a QP of -12.
  4678. @item clear
  4679. If set to true, remove any existing regions of interest marked on the
  4680. frame before adding the new one.
  4681. @end table
  4682. @subsection Examples
  4683. @itemize
  4684. @item
  4685. Mark the centre quarter of the frame as interesting.
  4686. @example
  4687. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  4688. @end example
  4689. @item
  4690. Mark the 100-pixel-wide region on the left edge of the frame as very
  4691. uninteresting (to be encoded at much lower quality than the rest of
  4692. the frame).
  4693. @example
  4694. addroi=0:0:100:ih:+1/5
  4695. @end example
  4696. @end itemize
  4697. @section alphaextract
  4698. Extract the alpha component from the input as a grayscale video. This
  4699. is especially useful with the @var{alphamerge} filter.
  4700. @section alphamerge
  4701. Add or replace the alpha component of the primary input with the
  4702. grayscale value of a second input. This is intended for use with
  4703. @var{alphaextract} to allow the transmission or storage of frame
  4704. sequences that have alpha in a format that doesn't support an alpha
  4705. channel.
  4706. For example, to reconstruct full frames from a normal YUV-encoded video
  4707. and a separate video created with @var{alphaextract}, you might use:
  4708. @example
  4709. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4710. @end example
  4711. Since this filter is designed for reconstruction, it operates on frame
  4712. sequences without considering timestamps, and terminates when either
  4713. input reaches end of stream. This will cause problems if your encoding
  4714. pipeline drops frames. If you're trying to apply an image as an
  4715. overlay to a video stream, consider the @var{overlay} filter instead.
  4716. @section amplify
  4717. Amplify differences between current pixel and pixels of adjacent frames in
  4718. same pixel location.
  4719. This filter accepts the following options:
  4720. @table @option
  4721. @item radius
  4722. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4723. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4724. @item factor
  4725. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4726. @item threshold
  4727. Set threshold for difference amplification. Any difference greater or equal to
  4728. this value will not alter source pixel. Default is 10.
  4729. Allowed range is from 0 to 65535.
  4730. @item tolerance
  4731. Set tolerance for difference amplification. Any difference lower to
  4732. this value will not alter source pixel. Default is 0.
  4733. Allowed range is from 0 to 65535.
  4734. @item low
  4735. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4736. This option controls maximum possible value that will decrease source pixel value.
  4737. @item high
  4738. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4739. This option controls maximum possible value that will increase source pixel value.
  4740. @item planes
  4741. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4742. @end table
  4743. @section ass
  4744. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4745. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4746. Substation Alpha) subtitles files.
  4747. This filter accepts the following option in addition to the common options from
  4748. the @ref{subtitles} filter:
  4749. @table @option
  4750. @item shaping
  4751. Set the shaping engine
  4752. Available values are:
  4753. @table @samp
  4754. @item auto
  4755. The default libass shaping engine, which is the best available.
  4756. @item simple
  4757. Fast, font-agnostic shaper that can do only substitutions
  4758. @item complex
  4759. Slower shaper using OpenType for substitutions and positioning
  4760. @end table
  4761. The default is @code{auto}.
  4762. @end table
  4763. @section atadenoise
  4764. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4765. The filter accepts the following options:
  4766. @table @option
  4767. @item 0a
  4768. Set threshold A for 1st plane. Default is 0.02.
  4769. Valid range is 0 to 0.3.
  4770. @item 0b
  4771. Set threshold B for 1st plane. Default is 0.04.
  4772. Valid range is 0 to 5.
  4773. @item 1a
  4774. Set threshold A for 2nd plane. Default is 0.02.
  4775. Valid range is 0 to 0.3.
  4776. @item 1b
  4777. Set threshold B for 2nd plane. Default is 0.04.
  4778. Valid range is 0 to 5.
  4779. @item 2a
  4780. Set threshold A for 3rd plane. Default is 0.02.
  4781. Valid range is 0 to 0.3.
  4782. @item 2b
  4783. Set threshold B for 3rd plane. Default is 0.04.
  4784. Valid range is 0 to 5.
  4785. Threshold A is designed to react on abrupt changes in the input signal and
  4786. threshold B is designed to react on continuous changes in the input signal.
  4787. @item s
  4788. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4789. number in range [5, 129].
  4790. @item p
  4791. Set what planes of frame filter will use for averaging. Default is all.
  4792. @end table
  4793. @section avgblur
  4794. Apply average blur filter.
  4795. The filter accepts the following options:
  4796. @table @option
  4797. @item sizeX
  4798. Set horizontal radius size.
  4799. @item planes
  4800. Set which planes to filter. By default all planes are filtered.
  4801. @item sizeY
  4802. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4803. Default is @code{0}.
  4804. @end table
  4805. @subsection Commands
  4806. This filter supports same commands as options.
  4807. The command accepts the same syntax of the corresponding option.
  4808. If the specified expression is not valid, it is kept at its current
  4809. value.
  4810. @section bbox
  4811. Compute the bounding box for the non-black pixels in the input frame
  4812. luminance plane.
  4813. This filter computes the bounding box containing all the pixels with a
  4814. luminance value greater than the minimum allowed value.
  4815. The parameters describing the bounding box are printed on the filter
  4816. log.
  4817. The filter accepts the following option:
  4818. @table @option
  4819. @item min_val
  4820. Set the minimal luminance value. Default is @code{16}.
  4821. @end table
  4822. @section bitplanenoise
  4823. Show and measure bit plane noise.
  4824. The filter accepts the following options:
  4825. @table @option
  4826. @item bitplane
  4827. Set which plane to analyze. Default is @code{1}.
  4828. @item filter
  4829. Filter out noisy pixels from @code{bitplane} set above.
  4830. Default is disabled.
  4831. @end table
  4832. @section blackdetect
  4833. Detect video intervals that are (almost) completely black. Can be
  4834. useful to detect chapter transitions, commercials, or invalid
  4835. recordings. Output lines contains the time for the start, end and
  4836. duration of the detected black interval expressed in seconds.
  4837. In order to display the output lines, you need to set the loglevel at
  4838. least to the AV_LOG_INFO value.
  4839. The filter accepts the following options:
  4840. @table @option
  4841. @item black_min_duration, d
  4842. Set the minimum detected black duration expressed in seconds. It must
  4843. be a non-negative floating point number.
  4844. Default value is 2.0.
  4845. @item picture_black_ratio_th, pic_th
  4846. Set the threshold for considering a picture "black".
  4847. Express the minimum value for the ratio:
  4848. @example
  4849. @var{nb_black_pixels} / @var{nb_pixels}
  4850. @end example
  4851. for which a picture is considered black.
  4852. Default value is 0.98.
  4853. @item pixel_black_th, pix_th
  4854. Set the threshold for considering a pixel "black".
  4855. The threshold expresses the maximum pixel luminance value for which a
  4856. pixel is considered "black". The provided value is scaled according to
  4857. the following equation:
  4858. @example
  4859. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4860. @end example
  4861. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4862. the input video format, the range is [0-255] for YUV full-range
  4863. formats and [16-235] for YUV non full-range formats.
  4864. Default value is 0.10.
  4865. @end table
  4866. The following example sets the maximum pixel threshold to the minimum
  4867. value, and detects only black intervals of 2 or more seconds:
  4868. @example
  4869. blackdetect=d=2:pix_th=0.00
  4870. @end example
  4871. @section blackframe
  4872. Detect frames that are (almost) completely black. Can be useful to
  4873. detect chapter transitions or commercials. Output lines consist of
  4874. the frame number of the detected frame, the percentage of blackness,
  4875. the position in the file if known or -1 and the timestamp in seconds.
  4876. In order to display the output lines, you need to set the loglevel at
  4877. least to the AV_LOG_INFO value.
  4878. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4879. The value represents the percentage of pixels in the picture that
  4880. are below the threshold value.
  4881. It accepts the following parameters:
  4882. @table @option
  4883. @item amount
  4884. The percentage of the pixels that have to be below the threshold; it defaults to
  4885. @code{98}.
  4886. @item threshold, thresh
  4887. The threshold below which a pixel value is considered black; it defaults to
  4888. @code{32}.
  4889. @end table
  4890. @section blend, tblend
  4891. Blend two video frames into each other.
  4892. The @code{blend} filter takes two input streams and outputs one
  4893. stream, the first input is the "top" layer and second input is
  4894. "bottom" layer. By default, the output terminates when the longest input terminates.
  4895. The @code{tblend} (time blend) filter takes two consecutive frames
  4896. from one single stream, and outputs the result obtained by blending
  4897. the new frame on top of the old frame.
  4898. A description of the accepted options follows.
  4899. @table @option
  4900. @item c0_mode
  4901. @item c1_mode
  4902. @item c2_mode
  4903. @item c3_mode
  4904. @item all_mode
  4905. Set blend mode for specific pixel component or all pixel components in case
  4906. of @var{all_mode}. Default value is @code{normal}.
  4907. Available values for component modes are:
  4908. @table @samp
  4909. @item addition
  4910. @item grainmerge
  4911. @item and
  4912. @item average
  4913. @item burn
  4914. @item darken
  4915. @item difference
  4916. @item grainextract
  4917. @item divide
  4918. @item dodge
  4919. @item freeze
  4920. @item exclusion
  4921. @item extremity
  4922. @item glow
  4923. @item hardlight
  4924. @item hardmix
  4925. @item heat
  4926. @item lighten
  4927. @item linearlight
  4928. @item multiply
  4929. @item multiply128
  4930. @item negation
  4931. @item normal
  4932. @item or
  4933. @item overlay
  4934. @item phoenix
  4935. @item pinlight
  4936. @item reflect
  4937. @item screen
  4938. @item softlight
  4939. @item subtract
  4940. @item vividlight
  4941. @item xor
  4942. @end table
  4943. @item c0_opacity
  4944. @item c1_opacity
  4945. @item c2_opacity
  4946. @item c3_opacity
  4947. @item all_opacity
  4948. Set blend opacity for specific pixel component or all pixel components in case
  4949. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4950. @item c0_expr
  4951. @item c1_expr
  4952. @item c2_expr
  4953. @item c3_expr
  4954. @item all_expr
  4955. Set blend expression for specific pixel component or all pixel components in case
  4956. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4957. The expressions can use the following variables:
  4958. @table @option
  4959. @item N
  4960. The sequential number of the filtered frame, starting from @code{0}.
  4961. @item X
  4962. @item Y
  4963. the coordinates of the current sample
  4964. @item W
  4965. @item H
  4966. the width and height of currently filtered plane
  4967. @item SW
  4968. @item SH
  4969. Width and height scale for the plane being filtered. It is the
  4970. ratio between the dimensions of the current plane to the luma plane,
  4971. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4972. the luma plane and @code{0.5,0.5} for the chroma planes.
  4973. @item T
  4974. Time of the current frame, expressed in seconds.
  4975. @item TOP, A
  4976. Value of pixel component at current location for first video frame (top layer).
  4977. @item BOTTOM, B
  4978. Value of pixel component at current location for second video frame (bottom layer).
  4979. @end table
  4980. @end table
  4981. The @code{blend} filter also supports the @ref{framesync} options.
  4982. @subsection Examples
  4983. @itemize
  4984. @item
  4985. Apply transition from bottom layer to top layer in first 10 seconds:
  4986. @example
  4987. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4988. @end example
  4989. @item
  4990. Apply linear horizontal transition from top layer to bottom layer:
  4991. @example
  4992. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4993. @end example
  4994. @item
  4995. Apply 1x1 checkerboard effect:
  4996. @example
  4997. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4998. @end example
  4999. @item
  5000. Apply uncover left effect:
  5001. @example
  5002. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  5003. @end example
  5004. @item
  5005. Apply uncover down effect:
  5006. @example
  5007. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  5008. @end example
  5009. @item
  5010. Apply uncover up-left effect:
  5011. @example
  5012. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5013. @end example
  5014. @item
  5015. Split diagonally video and shows top and bottom layer on each side:
  5016. @example
  5017. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5018. @end example
  5019. @item
  5020. Display differences between the current and the previous frame:
  5021. @example
  5022. tblend=all_mode=grainextract
  5023. @end example
  5024. @end itemize
  5025. @section bm3d
  5026. Denoise frames using Block-Matching 3D algorithm.
  5027. The filter accepts the following options.
  5028. @table @option
  5029. @item sigma
  5030. Set denoising strength. Default value is 1.
  5031. Allowed range is from 0 to 999.9.
  5032. The denoising algorithm is very sensitive to sigma, so adjust it
  5033. according to the source.
  5034. @item block
  5035. Set local patch size. This sets dimensions in 2D.
  5036. @item bstep
  5037. Set sliding step for processing blocks. Default value is 4.
  5038. Allowed range is from 1 to 64.
  5039. Smaller values allows processing more reference blocks and is slower.
  5040. @item group
  5041. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5042. When set to 1, no block matching is done. Larger values allows more blocks
  5043. in single group.
  5044. Allowed range is from 1 to 256.
  5045. @item range
  5046. Set radius for search block matching. Default is 9.
  5047. Allowed range is from 1 to INT32_MAX.
  5048. @item mstep
  5049. Set step between two search locations for block matching. Default is 1.
  5050. Allowed range is from 1 to 64. Smaller is slower.
  5051. @item thmse
  5052. Set threshold of mean square error for block matching. Valid range is 0 to
  5053. INT32_MAX.
  5054. @item hdthr
  5055. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5056. Larger values results in stronger hard-thresholding filtering in frequency
  5057. domain.
  5058. @item estim
  5059. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5060. Default is @code{basic}.
  5061. @item ref
  5062. If enabled, filter will use 2nd stream for block matching.
  5063. Default is disabled for @code{basic} value of @var{estim} option,
  5064. and always enabled if value of @var{estim} is @code{final}.
  5065. @item planes
  5066. Set planes to filter. Default is all available except alpha.
  5067. @end table
  5068. @subsection Examples
  5069. @itemize
  5070. @item
  5071. Basic filtering with bm3d:
  5072. @example
  5073. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5074. @end example
  5075. @item
  5076. Same as above, but filtering only luma:
  5077. @example
  5078. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5079. @end example
  5080. @item
  5081. Same as above, but with both estimation modes:
  5082. @example
  5083. 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
  5084. @end example
  5085. @item
  5086. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5087. @example
  5088. 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
  5089. @end example
  5090. @end itemize
  5091. @section boxblur
  5092. Apply a boxblur algorithm to the input video.
  5093. It accepts the following parameters:
  5094. @table @option
  5095. @item luma_radius, lr
  5096. @item luma_power, lp
  5097. @item chroma_radius, cr
  5098. @item chroma_power, cp
  5099. @item alpha_radius, ar
  5100. @item alpha_power, ap
  5101. @end table
  5102. A description of the accepted options follows.
  5103. @table @option
  5104. @item luma_radius, lr
  5105. @item chroma_radius, cr
  5106. @item alpha_radius, ar
  5107. Set an expression for the box radius in pixels used for blurring the
  5108. corresponding input plane.
  5109. The radius value must be a non-negative number, and must not be
  5110. greater than the value of the expression @code{min(w,h)/2} for the
  5111. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5112. planes.
  5113. Default value for @option{luma_radius} is "2". If not specified,
  5114. @option{chroma_radius} and @option{alpha_radius} default to the
  5115. corresponding value set for @option{luma_radius}.
  5116. The expressions can contain the following constants:
  5117. @table @option
  5118. @item w
  5119. @item h
  5120. The input width and height in pixels.
  5121. @item cw
  5122. @item ch
  5123. The input chroma image width and height in pixels.
  5124. @item hsub
  5125. @item vsub
  5126. The horizontal and vertical chroma subsample values. For example, for the
  5127. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5128. @end table
  5129. @item luma_power, lp
  5130. @item chroma_power, cp
  5131. @item alpha_power, ap
  5132. Specify how many times the boxblur filter is applied to the
  5133. corresponding plane.
  5134. Default value for @option{luma_power} is 2. If not specified,
  5135. @option{chroma_power} and @option{alpha_power} default to the
  5136. corresponding value set for @option{luma_power}.
  5137. A value of 0 will disable the effect.
  5138. @end table
  5139. @subsection Examples
  5140. @itemize
  5141. @item
  5142. Apply a boxblur filter with the luma, chroma, and alpha radii
  5143. set to 2:
  5144. @example
  5145. boxblur=luma_radius=2:luma_power=1
  5146. boxblur=2:1
  5147. @end example
  5148. @item
  5149. Set the luma radius to 2, and alpha and chroma radius to 0:
  5150. @example
  5151. boxblur=2:1:cr=0:ar=0
  5152. @end example
  5153. @item
  5154. Set the luma and chroma radii to a fraction of the video dimension:
  5155. @example
  5156. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5157. @end example
  5158. @end itemize
  5159. @section bwdif
  5160. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5161. Deinterlacing Filter").
  5162. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5163. interpolation algorithms.
  5164. It accepts the following parameters:
  5165. @table @option
  5166. @item mode
  5167. The interlacing mode to adopt. It accepts one of the following values:
  5168. @table @option
  5169. @item 0, send_frame
  5170. Output one frame for each frame.
  5171. @item 1, send_field
  5172. Output one frame for each field.
  5173. @end table
  5174. The default value is @code{send_field}.
  5175. @item parity
  5176. The picture field parity assumed for the input interlaced video. It accepts one
  5177. of the following values:
  5178. @table @option
  5179. @item 0, tff
  5180. Assume the top field is first.
  5181. @item 1, bff
  5182. Assume the bottom field is first.
  5183. @item -1, auto
  5184. Enable automatic detection of field parity.
  5185. @end table
  5186. The default value is @code{auto}.
  5187. If the interlacing is unknown or the decoder does not export this information,
  5188. top field first will be assumed.
  5189. @item deint
  5190. Specify which frames to deinterlace. Accepts one of the following
  5191. values:
  5192. @table @option
  5193. @item 0, all
  5194. Deinterlace all frames.
  5195. @item 1, interlaced
  5196. Only deinterlace frames marked as interlaced.
  5197. @end table
  5198. The default value is @code{all}.
  5199. @end table
  5200. @section chromahold
  5201. Remove all color information for all colors except for certain one.
  5202. The filter accepts the following options:
  5203. @table @option
  5204. @item color
  5205. The color which will not be replaced with neutral chroma.
  5206. @item similarity
  5207. Similarity percentage with the above color.
  5208. 0.01 matches only the exact key color, while 1.0 matches everything.
  5209. @item blend
  5210. Blend percentage.
  5211. 0.0 makes pixels either fully gray, or not gray at all.
  5212. Higher values result in more preserved color.
  5213. @item yuv
  5214. Signals that the color passed is already in YUV instead of RGB.
  5215. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5216. This can be used to pass exact YUV values as hexadecimal numbers.
  5217. @end table
  5218. @section chromakey
  5219. YUV colorspace color/chroma keying.
  5220. The filter accepts the following options:
  5221. @table @option
  5222. @item color
  5223. The color which will be replaced with transparency.
  5224. @item similarity
  5225. Similarity percentage with the key color.
  5226. 0.01 matches only the exact key color, while 1.0 matches everything.
  5227. @item blend
  5228. Blend percentage.
  5229. 0.0 makes pixels either fully transparent, or not transparent at all.
  5230. Higher values result in semi-transparent pixels, with a higher transparency
  5231. the more similar the pixels color is to the key color.
  5232. @item yuv
  5233. Signals that the color passed is already in YUV instead of RGB.
  5234. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5235. This can be used to pass exact YUV values as hexadecimal numbers.
  5236. @end table
  5237. @subsection Examples
  5238. @itemize
  5239. @item
  5240. Make every green pixel in the input image transparent:
  5241. @example
  5242. ffmpeg -i input.png -vf chromakey=green out.png
  5243. @end example
  5244. @item
  5245. Overlay a greenscreen-video on top of a static black background.
  5246. @example
  5247. 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
  5248. @end example
  5249. @end itemize
  5250. @section chromashift
  5251. Shift chroma pixels horizontally and/or vertically.
  5252. The filter accepts the following options:
  5253. @table @option
  5254. @item cbh
  5255. Set amount to shift chroma-blue horizontally.
  5256. @item cbv
  5257. Set amount to shift chroma-blue vertically.
  5258. @item crh
  5259. Set amount to shift chroma-red horizontally.
  5260. @item crv
  5261. Set amount to shift chroma-red vertically.
  5262. @item edge
  5263. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5264. @end table
  5265. @section ciescope
  5266. Display CIE color diagram with pixels overlaid onto it.
  5267. The filter accepts the following options:
  5268. @table @option
  5269. @item system
  5270. Set color system.
  5271. @table @samp
  5272. @item ntsc, 470m
  5273. @item ebu, 470bg
  5274. @item smpte
  5275. @item 240m
  5276. @item apple
  5277. @item widergb
  5278. @item cie1931
  5279. @item rec709, hdtv
  5280. @item uhdtv, rec2020
  5281. @item dcip3
  5282. @end table
  5283. @item cie
  5284. Set CIE system.
  5285. @table @samp
  5286. @item xyy
  5287. @item ucs
  5288. @item luv
  5289. @end table
  5290. @item gamuts
  5291. Set what gamuts to draw.
  5292. See @code{system} option for available values.
  5293. @item size, s
  5294. Set ciescope size, by default set to 512.
  5295. @item intensity, i
  5296. Set intensity used to map input pixel values to CIE diagram.
  5297. @item contrast
  5298. Set contrast used to draw tongue colors that are out of active color system gamut.
  5299. @item corrgamma
  5300. Correct gamma displayed on scope, by default enabled.
  5301. @item showwhite
  5302. Show white point on CIE diagram, by default disabled.
  5303. @item gamma
  5304. Set input gamma. Used only with XYZ input color space.
  5305. @end table
  5306. @section codecview
  5307. Visualize information exported by some codecs.
  5308. Some codecs can export information through frames using side-data or other
  5309. means. For example, some MPEG based codecs export motion vectors through the
  5310. @var{export_mvs} flag in the codec @option{flags2} option.
  5311. The filter accepts the following option:
  5312. @table @option
  5313. @item mv
  5314. Set motion vectors to visualize.
  5315. Available flags for @var{mv} are:
  5316. @table @samp
  5317. @item pf
  5318. forward predicted MVs of P-frames
  5319. @item bf
  5320. forward predicted MVs of B-frames
  5321. @item bb
  5322. backward predicted MVs of B-frames
  5323. @end table
  5324. @item qp
  5325. Display quantization parameters using the chroma planes.
  5326. @item mv_type, mvt
  5327. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5328. Available flags for @var{mv_type} are:
  5329. @table @samp
  5330. @item fp
  5331. forward predicted MVs
  5332. @item bp
  5333. backward predicted MVs
  5334. @end table
  5335. @item frame_type, ft
  5336. Set frame type to visualize motion vectors of.
  5337. Available flags for @var{frame_type} are:
  5338. @table @samp
  5339. @item if
  5340. intra-coded frames (I-frames)
  5341. @item pf
  5342. predicted frames (P-frames)
  5343. @item bf
  5344. bi-directionally predicted frames (B-frames)
  5345. @end table
  5346. @end table
  5347. @subsection Examples
  5348. @itemize
  5349. @item
  5350. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5351. @example
  5352. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5353. @end example
  5354. @item
  5355. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5356. @example
  5357. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5358. @end example
  5359. @end itemize
  5360. @section colorbalance
  5361. Modify intensity of primary colors (red, green and blue) of input frames.
  5362. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5363. regions for the red-cyan, green-magenta or blue-yellow balance.
  5364. A positive adjustment value shifts the balance towards the primary color, a negative
  5365. value towards the complementary color.
  5366. The filter accepts the following options:
  5367. @table @option
  5368. @item rs
  5369. @item gs
  5370. @item bs
  5371. Adjust red, green and blue shadows (darkest pixels).
  5372. @item rm
  5373. @item gm
  5374. @item bm
  5375. Adjust red, green and blue midtones (medium pixels).
  5376. @item rh
  5377. @item gh
  5378. @item bh
  5379. Adjust red, green and blue highlights (brightest pixels).
  5380. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5381. @end table
  5382. @subsection Examples
  5383. @itemize
  5384. @item
  5385. Add red color cast to shadows:
  5386. @example
  5387. colorbalance=rs=.3
  5388. @end example
  5389. @end itemize
  5390. @section colorchannelmixer
  5391. Adjust video input frames by re-mixing color channels.
  5392. This filter modifies a color channel by adding the values associated to
  5393. the other channels of the same pixels. For example if the value to
  5394. modify is red, the output value will be:
  5395. @example
  5396. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5397. @end example
  5398. The filter accepts the following options:
  5399. @table @option
  5400. @item rr
  5401. @item rg
  5402. @item rb
  5403. @item ra
  5404. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5405. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5406. @item gr
  5407. @item gg
  5408. @item gb
  5409. @item ga
  5410. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5411. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5412. @item br
  5413. @item bg
  5414. @item bb
  5415. @item ba
  5416. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5417. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5418. @item ar
  5419. @item ag
  5420. @item ab
  5421. @item aa
  5422. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5423. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5424. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5425. @end table
  5426. @subsection Examples
  5427. @itemize
  5428. @item
  5429. Convert source to grayscale:
  5430. @example
  5431. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5432. @end example
  5433. @item
  5434. Simulate sepia tones:
  5435. @example
  5436. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5437. @end example
  5438. @end itemize
  5439. @section colorkey
  5440. RGB colorspace color keying.
  5441. The filter accepts the following options:
  5442. @table @option
  5443. @item color
  5444. The color which will be replaced with transparency.
  5445. @item similarity
  5446. Similarity percentage with the key color.
  5447. 0.01 matches only the exact key color, while 1.0 matches everything.
  5448. @item blend
  5449. Blend percentage.
  5450. 0.0 makes pixels either fully transparent, or not transparent at all.
  5451. Higher values result in semi-transparent pixels, with a higher transparency
  5452. the more similar the pixels color is to the key color.
  5453. @end table
  5454. @subsection Examples
  5455. @itemize
  5456. @item
  5457. Make every green pixel in the input image transparent:
  5458. @example
  5459. ffmpeg -i input.png -vf colorkey=green out.png
  5460. @end example
  5461. @item
  5462. Overlay a greenscreen-video on top of a static background image.
  5463. @example
  5464. 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
  5465. @end example
  5466. @end itemize
  5467. @section colorhold
  5468. Remove all color information for all RGB colors except for certain one.
  5469. The filter accepts the following options:
  5470. @table @option
  5471. @item color
  5472. The color which will not be replaced with neutral gray.
  5473. @item similarity
  5474. Similarity percentage with the above color.
  5475. 0.01 matches only the exact key color, while 1.0 matches everything.
  5476. @item blend
  5477. Blend percentage. 0.0 makes pixels fully gray.
  5478. Higher values result in more preserved color.
  5479. @end table
  5480. @section colorlevels
  5481. Adjust video input frames using levels.
  5482. The filter accepts the following options:
  5483. @table @option
  5484. @item rimin
  5485. @item gimin
  5486. @item bimin
  5487. @item aimin
  5488. Adjust red, green, blue and alpha input black point.
  5489. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5490. @item rimax
  5491. @item gimax
  5492. @item bimax
  5493. @item aimax
  5494. Adjust red, green, blue and alpha input white point.
  5495. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5496. Input levels are used to lighten highlights (bright tones), darken shadows
  5497. (dark tones), change the balance of bright and dark tones.
  5498. @item romin
  5499. @item gomin
  5500. @item bomin
  5501. @item aomin
  5502. Adjust red, green, blue and alpha output black point.
  5503. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5504. @item romax
  5505. @item gomax
  5506. @item bomax
  5507. @item aomax
  5508. Adjust red, green, blue and alpha output white point.
  5509. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5510. Output levels allows manual selection of a constrained output level range.
  5511. @end table
  5512. @subsection Examples
  5513. @itemize
  5514. @item
  5515. Make video output darker:
  5516. @example
  5517. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5518. @end example
  5519. @item
  5520. Increase contrast:
  5521. @example
  5522. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5523. @end example
  5524. @item
  5525. Make video output lighter:
  5526. @example
  5527. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5528. @end example
  5529. @item
  5530. Increase brightness:
  5531. @example
  5532. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5533. @end example
  5534. @end itemize
  5535. @section colormatrix
  5536. Convert color matrix.
  5537. The filter accepts the following options:
  5538. @table @option
  5539. @item src
  5540. @item dst
  5541. Specify the source and destination color matrix. Both values must be
  5542. specified.
  5543. The accepted values are:
  5544. @table @samp
  5545. @item bt709
  5546. BT.709
  5547. @item fcc
  5548. FCC
  5549. @item bt601
  5550. BT.601
  5551. @item bt470
  5552. BT.470
  5553. @item bt470bg
  5554. BT.470BG
  5555. @item smpte170m
  5556. SMPTE-170M
  5557. @item smpte240m
  5558. SMPTE-240M
  5559. @item bt2020
  5560. BT.2020
  5561. @end table
  5562. @end table
  5563. For example to convert from BT.601 to SMPTE-240M, use the command:
  5564. @example
  5565. colormatrix=bt601:smpte240m
  5566. @end example
  5567. @section colorspace
  5568. Convert colorspace, transfer characteristics or color primaries.
  5569. Input video needs to have an even size.
  5570. The filter accepts the following options:
  5571. @table @option
  5572. @anchor{all}
  5573. @item all
  5574. Specify all color properties at once.
  5575. The accepted values are:
  5576. @table @samp
  5577. @item bt470m
  5578. BT.470M
  5579. @item bt470bg
  5580. BT.470BG
  5581. @item bt601-6-525
  5582. BT.601-6 525
  5583. @item bt601-6-625
  5584. BT.601-6 625
  5585. @item bt709
  5586. BT.709
  5587. @item smpte170m
  5588. SMPTE-170M
  5589. @item smpte240m
  5590. SMPTE-240M
  5591. @item bt2020
  5592. BT.2020
  5593. @end table
  5594. @anchor{space}
  5595. @item space
  5596. Specify output colorspace.
  5597. The accepted values are:
  5598. @table @samp
  5599. @item bt709
  5600. BT.709
  5601. @item fcc
  5602. FCC
  5603. @item bt470bg
  5604. BT.470BG or BT.601-6 625
  5605. @item smpte170m
  5606. SMPTE-170M or BT.601-6 525
  5607. @item smpte240m
  5608. SMPTE-240M
  5609. @item ycgco
  5610. YCgCo
  5611. @item bt2020ncl
  5612. BT.2020 with non-constant luminance
  5613. @end table
  5614. @anchor{trc}
  5615. @item trc
  5616. Specify output transfer characteristics.
  5617. The accepted values are:
  5618. @table @samp
  5619. @item bt709
  5620. BT.709
  5621. @item bt470m
  5622. BT.470M
  5623. @item bt470bg
  5624. BT.470BG
  5625. @item gamma22
  5626. Constant gamma of 2.2
  5627. @item gamma28
  5628. Constant gamma of 2.8
  5629. @item smpte170m
  5630. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5631. @item smpte240m
  5632. SMPTE-240M
  5633. @item srgb
  5634. SRGB
  5635. @item iec61966-2-1
  5636. iec61966-2-1
  5637. @item iec61966-2-4
  5638. iec61966-2-4
  5639. @item xvycc
  5640. xvycc
  5641. @item bt2020-10
  5642. BT.2020 for 10-bits content
  5643. @item bt2020-12
  5644. BT.2020 for 12-bits content
  5645. @end table
  5646. @anchor{primaries}
  5647. @item primaries
  5648. Specify output color primaries.
  5649. The accepted values are:
  5650. @table @samp
  5651. @item bt709
  5652. BT.709
  5653. @item bt470m
  5654. BT.470M
  5655. @item bt470bg
  5656. BT.470BG or BT.601-6 625
  5657. @item smpte170m
  5658. SMPTE-170M or BT.601-6 525
  5659. @item smpte240m
  5660. SMPTE-240M
  5661. @item film
  5662. film
  5663. @item smpte431
  5664. SMPTE-431
  5665. @item smpte432
  5666. SMPTE-432
  5667. @item bt2020
  5668. BT.2020
  5669. @item jedec-p22
  5670. JEDEC P22 phosphors
  5671. @end table
  5672. @anchor{range}
  5673. @item range
  5674. Specify output color range.
  5675. The accepted values are:
  5676. @table @samp
  5677. @item tv
  5678. TV (restricted) range
  5679. @item mpeg
  5680. MPEG (restricted) range
  5681. @item pc
  5682. PC (full) range
  5683. @item jpeg
  5684. JPEG (full) range
  5685. @end table
  5686. @item format
  5687. Specify output color format.
  5688. The accepted values are:
  5689. @table @samp
  5690. @item yuv420p
  5691. YUV 4:2:0 planar 8-bits
  5692. @item yuv420p10
  5693. YUV 4:2:0 planar 10-bits
  5694. @item yuv420p12
  5695. YUV 4:2:0 planar 12-bits
  5696. @item yuv422p
  5697. YUV 4:2:2 planar 8-bits
  5698. @item yuv422p10
  5699. YUV 4:2:2 planar 10-bits
  5700. @item yuv422p12
  5701. YUV 4:2:2 planar 12-bits
  5702. @item yuv444p
  5703. YUV 4:4:4 planar 8-bits
  5704. @item yuv444p10
  5705. YUV 4:4:4 planar 10-bits
  5706. @item yuv444p12
  5707. YUV 4:4:4 planar 12-bits
  5708. @end table
  5709. @item fast
  5710. Do a fast conversion, which skips gamma/primary correction. This will take
  5711. significantly less CPU, but will be mathematically incorrect. To get output
  5712. compatible with that produced by the colormatrix filter, use fast=1.
  5713. @item dither
  5714. Specify dithering mode.
  5715. The accepted values are:
  5716. @table @samp
  5717. @item none
  5718. No dithering
  5719. @item fsb
  5720. Floyd-Steinberg dithering
  5721. @end table
  5722. @item wpadapt
  5723. Whitepoint adaptation mode.
  5724. The accepted values are:
  5725. @table @samp
  5726. @item bradford
  5727. Bradford whitepoint adaptation
  5728. @item vonkries
  5729. von Kries whitepoint adaptation
  5730. @item identity
  5731. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5732. @end table
  5733. @item iall
  5734. Override all input properties at once. Same accepted values as @ref{all}.
  5735. @item ispace
  5736. Override input colorspace. Same accepted values as @ref{space}.
  5737. @item iprimaries
  5738. Override input color primaries. Same accepted values as @ref{primaries}.
  5739. @item itrc
  5740. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5741. @item irange
  5742. Override input color range. Same accepted values as @ref{range}.
  5743. @end table
  5744. The filter converts the transfer characteristics, color space and color
  5745. primaries to the specified user values. The output value, if not specified,
  5746. is set to a default value based on the "all" property. If that property is
  5747. also not specified, the filter will log an error. The output color range and
  5748. format default to the same value as the input color range and format. The
  5749. input transfer characteristics, color space, color primaries and color range
  5750. should be set on the input data. If any of these are missing, the filter will
  5751. log an error and no conversion will take place.
  5752. For example to convert the input to SMPTE-240M, use the command:
  5753. @example
  5754. colorspace=smpte240m
  5755. @end example
  5756. @section convolution
  5757. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5758. The filter accepts the following options:
  5759. @table @option
  5760. @item 0m
  5761. @item 1m
  5762. @item 2m
  5763. @item 3m
  5764. Set matrix for each plane.
  5765. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5766. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5767. @item 0rdiv
  5768. @item 1rdiv
  5769. @item 2rdiv
  5770. @item 3rdiv
  5771. Set multiplier for calculated value for each plane.
  5772. If unset or 0, it will be sum of all matrix elements.
  5773. @item 0bias
  5774. @item 1bias
  5775. @item 2bias
  5776. @item 3bias
  5777. Set bias for each plane. This value is added to the result of the multiplication.
  5778. Useful for making the overall image brighter or darker. Default is 0.0.
  5779. @item 0mode
  5780. @item 1mode
  5781. @item 2mode
  5782. @item 3mode
  5783. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5784. Default is @var{square}.
  5785. @end table
  5786. @subsection Examples
  5787. @itemize
  5788. @item
  5789. Apply sharpen:
  5790. @example
  5791. 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"
  5792. @end example
  5793. @item
  5794. Apply blur:
  5795. @example
  5796. 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"
  5797. @end example
  5798. @item
  5799. Apply edge enhance:
  5800. @example
  5801. 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"
  5802. @end example
  5803. @item
  5804. Apply edge detect:
  5805. @example
  5806. 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"
  5807. @end example
  5808. @item
  5809. Apply laplacian edge detector which includes diagonals:
  5810. @example
  5811. 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"
  5812. @end example
  5813. @item
  5814. Apply emboss:
  5815. @example
  5816. 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"
  5817. @end example
  5818. @end itemize
  5819. @section convolve
  5820. Apply 2D convolution of video stream in frequency domain using second stream
  5821. as impulse.
  5822. The filter accepts the following options:
  5823. @table @option
  5824. @item planes
  5825. Set which planes to process.
  5826. @item impulse
  5827. Set which impulse video frames will be processed, can be @var{first}
  5828. or @var{all}. Default is @var{all}.
  5829. @end table
  5830. The @code{convolve} filter also supports the @ref{framesync} options.
  5831. @section copy
  5832. Copy the input video source unchanged to the output. This is mainly useful for
  5833. testing purposes.
  5834. @anchor{coreimage}
  5835. @section coreimage
  5836. Video filtering on GPU using Apple's CoreImage API on OSX.
  5837. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5838. processed by video hardware. However, software-based OpenGL implementations
  5839. exist which means there is no guarantee for hardware processing. It depends on
  5840. the respective OSX.
  5841. There are many filters and image generators provided by Apple that come with a
  5842. large variety of options. The filter has to be referenced by its name along
  5843. with its options.
  5844. The coreimage filter accepts the following options:
  5845. @table @option
  5846. @item list_filters
  5847. List all available filters and generators along with all their respective
  5848. options as well as possible minimum and maximum values along with the default
  5849. values.
  5850. @example
  5851. list_filters=true
  5852. @end example
  5853. @item filter
  5854. Specify all filters by their respective name and options.
  5855. Use @var{list_filters} to determine all valid filter names and options.
  5856. Numerical options are specified by a float value and are automatically clamped
  5857. to their respective value range. Vector and color options have to be specified
  5858. by a list of space separated float values. Character escaping has to be done.
  5859. A special option name @code{default} is available to use default options for a
  5860. filter.
  5861. It is required to specify either @code{default} or at least one of the filter options.
  5862. All omitted options are used with their default values.
  5863. The syntax of the filter string is as follows:
  5864. @example
  5865. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5866. @end example
  5867. @item output_rect
  5868. Specify a rectangle where the output of the filter chain is copied into the
  5869. input image. It is given by a list of space separated float values:
  5870. @example
  5871. output_rect=x\ y\ width\ height
  5872. @end example
  5873. If not given, the output rectangle equals the dimensions of the input image.
  5874. The output rectangle is automatically cropped at the borders of the input
  5875. image. Negative values are valid for each component.
  5876. @example
  5877. output_rect=25\ 25\ 100\ 100
  5878. @end example
  5879. @end table
  5880. Several filters can be chained for successive processing without GPU-HOST
  5881. transfers allowing for fast processing of complex filter chains.
  5882. Currently, only filters with zero (generators) or exactly one (filters) input
  5883. image and one output image are supported. Also, transition filters are not yet
  5884. usable as intended.
  5885. Some filters generate output images with additional padding depending on the
  5886. respective filter kernel. The padding is automatically removed to ensure the
  5887. filter output has the same size as the input image.
  5888. For image generators, the size of the output image is determined by the
  5889. previous output image of the filter chain or the input image of the whole
  5890. filterchain, respectively. The generators do not use the pixel information of
  5891. this image to generate their output. However, the generated output is
  5892. blended onto this image, resulting in partial or complete coverage of the
  5893. output image.
  5894. The @ref{coreimagesrc} video source can be used for generating input images
  5895. which are directly fed into the filter chain. By using it, providing input
  5896. images by another video source or an input video is not required.
  5897. @subsection Examples
  5898. @itemize
  5899. @item
  5900. List all filters available:
  5901. @example
  5902. coreimage=list_filters=true
  5903. @end example
  5904. @item
  5905. Use the CIBoxBlur filter with default options to blur an image:
  5906. @example
  5907. coreimage=filter=CIBoxBlur@@default
  5908. @end example
  5909. @item
  5910. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5911. its center at 100x100 and a radius of 50 pixels:
  5912. @example
  5913. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5914. @end example
  5915. @item
  5916. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5917. given as complete and escaped command-line for Apple's standard bash shell:
  5918. @example
  5919. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5920. @end example
  5921. @end itemize
  5922. @section cover_rect
  5923. Cover a rectangular object
  5924. It accepts the following options:
  5925. @table @option
  5926. @item cover
  5927. Filepath of the optional cover image, needs to be in yuv420.
  5928. @item mode
  5929. Set covering mode.
  5930. It accepts the following values:
  5931. @table @samp
  5932. @item cover
  5933. cover it by the supplied image
  5934. @item blur
  5935. cover it by interpolating the surrounding pixels
  5936. @end table
  5937. Default value is @var{blur}.
  5938. @end table
  5939. @subsection Examples
  5940. @itemize
  5941. @item
  5942. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  5943. @example
  5944. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  5945. @end example
  5946. @end itemize
  5947. @section crop
  5948. Crop the input video to given dimensions.
  5949. It accepts the following parameters:
  5950. @table @option
  5951. @item w, out_w
  5952. The width of the output video. It defaults to @code{iw}.
  5953. This expression is evaluated only once during the filter
  5954. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5955. @item h, out_h
  5956. The height of the output video. It defaults to @code{ih}.
  5957. This expression is evaluated only once during the filter
  5958. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5959. @item x
  5960. The horizontal position, in the input video, of the left edge of the output
  5961. video. It defaults to @code{(in_w-out_w)/2}.
  5962. This expression is evaluated per-frame.
  5963. @item y
  5964. The vertical position, in the input video, of the top edge of the output video.
  5965. It defaults to @code{(in_h-out_h)/2}.
  5966. This expression is evaluated per-frame.
  5967. @item keep_aspect
  5968. If set to 1 will force the output display aspect ratio
  5969. to be the same of the input, by changing the output sample aspect
  5970. ratio. It defaults to 0.
  5971. @item exact
  5972. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5973. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5974. It defaults to 0.
  5975. @end table
  5976. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5977. expressions containing the following constants:
  5978. @table @option
  5979. @item x
  5980. @item y
  5981. The computed values for @var{x} and @var{y}. They are evaluated for
  5982. each new frame.
  5983. @item in_w
  5984. @item in_h
  5985. The input width and height.
  5986. @item iw
  5987. @item ih
  5988. These are the same as @var{in_w} and @var{in_h}.
  5989. @item out_w
  5990. @item out_h
  5991. The output (cropped) width and height.
  5992. @item ow
  5993. @item oh
  5994. These are the same as @var{out_w} and @var{out_h}.
  5995. @item a
  5996. same as @var{iw} / @var{ih}
  5997. @item sar
  5998. input sample aspect ratio
  5999. @item dar
  6000. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6001. @item hsub
  6002. @item vsub
  6003. horizontal and vertical chroma subsample values. For example for the
  6004. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6005. @item n
  6006. The number of the input frame, starting from 0.
  6007. @item pos
  6008. the position in the file of the input frame, NAN if unknown
  6009. @item t
  6010. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6011. @end table
  6012. The expression for @var{out_w} may depend on the value of @var{out_h},
  6013. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6014. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6015. evaluated after @var{out_w} and @var{out_h}.
  6016. The @var{x} and @var{y} parameters specify the expressions for the
  6017. position of the top-left corner of the output (non-cropped) area. They
  6018. are evaluated for each frame. If the evaluated value is not valid, it
  6019. is approximated to the nearest valid value.
  6020. The expression for @var{x} may depend on @var{y}, and the expression
  6021. for @var{y} may depend on @var{x}.
  6022. @subsection Examples
  6023. @itemize
  6024. @item
  6025. Crop area with size 100x100 at position (12,34).
  6026. @example
  6027. crop=100:100:12:34
  6028. @end example
  6029. Using named options, the example above becomes:
  6030. @example
  6031. crop=w=100:h=100:x=12:y=34
  6032. @end example
  6033. @item
  6034. Crop the central input area with size 100x100:
  6035. @example
  6036. crop=100:100
  6037. @end example
  6038. @item
  6039. Crop the central input area with size 2/3 of the input video:
  6040. @example
  6041. crop=2/3*in_w:2/3*in_h
  6042. @end example
  6043. @item
  6044. Crop the input video central square:
  6045. @example
  6046. crop=out_w=in_h
  6047. crop=in_h
  6048. @end example
  6049. @item
  6050. Delimit the rectangle with the top-left corner placed at position
  6051. 100:100 and the right-bottom corner corresponding to the right-bottom
  6052. corner of the input image.
  6053. @example
  6054. crop=in_w-100:in_h-100:100:100
  6055. @end example
  6056. @item
  6057. Crop 10 pixels from the left and right borders, and 20 pixels from
  6058. the top and bottom borders
  6059. @example
  6060. crop=in_w-2*10:in_h-2*20
  6061. @end example
  6062. @item
  6063. Keep only the bottom right quarter of the input image:
  6064. @example
  6065. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6066. @end example
  6067. @item
  6068. Crop height for getting Greek harmony:
  6069. @example
  6070. crop=in_w:1/PHI*in_w
  6071. @end example
  6072. @item
  6073. Apply trembling effect:
  6074. @example
  6075. 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)
  6076. @end example
  6077. @item
  6078. Apply erratic camera effect depending on timestamp:
  6079. @example
  6080. 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)"
  6081. @end example
  6082. @item
  6083. Set x depending on the value of y:
  6084. @example
  6085. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6086. @end example
  6087. @end itemize
  6088. @subsection Commands
  6089. This filter supports the following commands:
  6090. @table @option
  6091. @item w, out_w
  6092. @item h, out_h
  6093. @item x
  6094. @item y
  6095. Set width/height of the output video and the horizontal/vertical position
  6096. in the input video.
  6097. The command accepts the same syntax of the corresponding option.
  6098. If the specified expression is not valid, it is kept at its current
  6099. value.
  6100. @end table
  6101. @section cropdetect
  6102. Auto-detect the crop size.
  6103. It calculates the necessary cropping parameters and prints the
  6104. recommended parameters via the logging system. The detected dimensions
  6105. correspond to the non-black area of the input video.
  6106. It accepts the following parameters:
  6107. @table @option
  6108. @item limit
  6109. Set higher black value threshold, which can be optionally specified
  6110. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6111. value greater to the set value is considered non-black. It defaults to 24.
  6112. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6113. on the bitdepth of the pixel format.
  6114. @item round
  6115. The value which the width/height should be divisible by. It defaults to
  6116. 16. The offset is automatically adjusted to center the video. Use 2 to
  6117. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6118. encoding to most video codecs.
  6119. @item reset_count, reset
  6120. Set the counter that determines after how many frames cropdetect will
  6121. reset the previously detected largest video area and start over to
  6122. detect the current optimal crop area. Default value is 0.
  6123. This can be useful when channel logos distort the video area. 0
  6124. indicates 'never reset', and returns the largest area encountered during
  6125. playback.
  6126. @end table
  6127. @anchor{cue}
  6128. @section cue
  6129. Delay video filtering until a given wallclock timestamp. The filter first
  6130. passes on @option{preroll} amount of frames, then it buffers at most
  6131. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6132. it forwards the buffered frames and also any subsequent frames coming in its
  6133. input.
  6134. The filter can be used synchronize the output of multiple ffmpeg processes for
  6135. realtime output devices like decklink. By putting the delay in the filtering
  6136. chain and pre-buffering frames the process can pass on data to output almost
  6137. immediately after the target wallclock timestamp is reached.
  6138. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6139. some use cases.
  6140. @table @option
  6141. @item cue
  6142. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6143. @item preroll
  6144. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6145. @item buffer
  6146. The maximum duration of content to buffer before waiting for the cue expressed
  6147. in seconds. Default is 0.
  6148. @end table
  6149. @anchor{curves}
  6150. @section curves
  6151. Apply color adjustments using curves.
  6152. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6153. component (red, green and blue) has its values defined by @var{N} key points
  6154. tied from each other using a smooth curve. The x-axis represents the pixel
  6155. values from the input frame, and the y-axis the new pixel values to be set for
  6156. the output frame.
  6157. By default, a component curve is defined by the two points @var{(0;0)} and
  6158. @var{(1;1)}. This creates a straight line where each original pixel value is
  6159. "adjusted" to its own value, which means no change to the image.
  6160. The filter allows you to redefine these two points and add some more. A new
  6161. curve (using a natural cubic spline interpolation) will be define to pass
  6162. smoothly through all these new coordinates. The new defined points needs to be
  6163. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6164. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6165. the vector spaces, the values will be clipped accordingly.
  6166. The filter accepts the following options:
  6167. @table @option
  6168. @item preset
  6169. Select one of the available color presets. This option can be used in addition
  6170. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6171. options takes priority on the preset values.
  6172. Available presets are:
  6173. @table @samp
  6174. @item none
  6175. @item color_negative
  6176. @item cross_process
  6177. @item darker
  6178. @item increase_contrast
  6179. @item lighter
  6180. @item linear_contrast
  6181. @item medium_contrast
  6182. @item negative
  6183. @item strong_contrast
  6184. @item vintage
  6185. @end table
  6186. Default is @code{none}.
  6187. @item master, m
  6188. Set the master key points. These points will define a second pass mapping. It
  6189. is sometimes called a "luminance" or "value" mapping. It can be used with
  6190. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6191. post-processing LUT.
  6192. @item red, r
  6193. Set the key points for the red component.
  6194. @item green, g
  6195. Set the key points for the green component.
  6196. @item blue, b
  6197. Set the key points for the blue component.
  6198. @item all
  6199. Set the key points for all components (not including master).
  6200. Can be used in addition to the other key points component
  6201. options. In this case, the unset component(s) will fallback on this
  6202. @option{all} setting.
  6203. @item psfile
  6204. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6205. @item plot
  6206. Save Gnuplot script of the curves in specified file.
  6207. @end table
  6208. To avoid some filtergraph syntax conflicts, each key points list need to be
  6209. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6210. @subsection Examples
  6211. @itemize
  6212. @item
  6213. Increase slightly the middle level of blue:
  6214. @example
  6215. curves=blue='0/0 0.5/0.58 1/1'
  6216. @end example
  6217. @item
  6218. Vintage effect:
  6219. @example
  6220. 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'
  6221. @end example
  6222. Here we obtain the following coordinates for each components:
  6223. @table @var
  6224. @item red
  6225. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6226. @item green
  6227. @code{(0;0) (0.50;0.48) (1;1)}
  6228. @item blue
  6229. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6230. @end table
  6231. @item
  6232. The previous example can also be achieved with the associated built-in preset:
  6233. @example
  6234. curves=preset=vintage
  6235. @end example
  6236. @item
  6237. Or simply:
  6238. @example
  6239. curves=vintage
  6240. @end example
  6241. @item
  6242. Use a Photoshop preset and redefine the points of the green component:
  6243. @example
  6244. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6245. @end example
  6246. @item
  6247. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6248. and @command{gnuplot}:
  6249. @example
  6250. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6251. gnuplot -p /tmp/curves.plt
  6252. @end example
  6253. @end itemize
  6254. @section datascope
  6255. Video data analysis filter.
  6256. This filter shows hexadecimal pixel values of part of video.
  6257. The filter accepts the following options:
  6258. @table @option
  6259. @item size, s
  6260. Set output video size.
  6261. @item x
  6262. Set x offset from where to pick pixels.
  6263. @item y
  6264. Set y offset from where to pick pixels.
  6265. @item mode
  6266. Set scope mode, can be one of the following:
  6267. @table @samp
  6268. @item mono
  6269. Draw hexadecimal pixel values with white color on black background.
  6270. @item color
  6271. Draw hexadecimal pixel values with input video pixel color on black
  6272. background.
  6273. @item color2
  6274. Draw hexadecimal pixel values on color background picked from input video,
  6275. the text color is picked in such way so its always visible.
  6276. @end table
  6277. @item axis
  6278. Draw rows and columns numbers on left and top of video.
  6279. @item opacity
  6280. Set background opacity.
  6281. @end table
  6282. @section dctdnoiz
  6283. Denoise frames using 2D DCT (frequency domain filtering).
  6284. This filter is not designed for real time.
  6285. The filter accepts the following options:
  6286. @table @option
  6287. @item sigma, s
  6288. Set the noise sigma constant.
  6289. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6290. coefficient (absolute value) below this threshold with be dropped.
  6291. If you need a more advanced filtering, see @option{expr}.
  6292. Default is @code{0}.
  6293. @item overlap
  6294. Set number overlapping pixels for each block. Since the filter can be slow, you
  6295. may want to reduce this value, at the cost of a less effective filter and the
  6296. risk of various artefacts.
  6297. If the overlapping value doesn't permit processing the whole input width or
  6298. height, a warning will be displayed and according borders won't be denoised.
  6299. Default value is @var{blocksize}-1, which is the best possible setting.
  6300. @item expr, e
  6301. Set the coefficient factor expression.
  6302. For each coefficient of a DCT block, this expression will be evaluated as a
  6303. multiplier value for the coefficient.
  6304. If this is option is set, the @option{sigma} option will be ignored.
  6305. The absolute value of the coefficient can be accessed through the @var{c}
  6306. variable.
  6307. @item n
  6308. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6309. @var{blocksize}, which is the width and height of the processed blocks.
  6310. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6311. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6312. on the speed processing. Also, a larger block size does not necessarily means a
  6313. better de-noising.
  6314. @end table
  6315. @subsection Examples
  6316. Apply a denoise with a @option{sigma} of @code{4.5}:
  6317. @example
  6318. dctdnoiz=4.5
  6319. @end example
  6320. The same operation can be achieved using the expression system:
  6321. @example
  6322. dctdnoiz=e='gte(c, 4.5*3)'
  6323. @end example
  6324. Violent denoise using a block size of @code{16x16}:
  6325. @example
  6326. dctdnoiz=15:n=4
  6327. @end example
  6328. @section deband
  6329. Remove banding artifacts from input video.
  6330. It works by replacing banded pixels with average value of referenced pixels.
  6331. The filter accepts the following options:
  6332. @table @option
  6333. @item 1thr
  6334. @item 2thr
  6335. @item 3thr
  6336. @item 4thr
  6337. Set banding detection threshold for each plane. Default is 0.02.
  6338. Valid range is 0.00003 to 0.5.
  6339. If difference between current pixel and reference pixel is less than threshold,
  6340. it will be considered as banded.
  6341. @item range, r
  6342. Banding detection range in pixels. Default is 16. If positive, random number
  6343. in range 0 to set value will be used. If negative, exact absolute value
  6344. will be used.
  6345. The range defines square of four pixels around current pixel.
  6346. @item direction, d
  6347. Set direction in radians from which four pixel will be compared. If positive,
  6348. random direction from 0 to set direction will be picked. If negative, exact of
  6349. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6350. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6351. column.
  6352. @item blur, b
  6353. If enabled, current pixel is compared with average value of all four
  6354. surrounding pixels. The default is enabled. If disabled current pixel is
  6355. compared with all four surrounding pixels. The pixel is considered banded
  6356. if only all four differences with surrounding pixels are less than threshold.
  6357. @item coupling, c
  6358. If enabled, current pixel is changed if and only if all pixel components are banded,
  6359. e.g. banding detection threshold is triggered for all color components.
  6360. The default is disabled.
  6361. @end table
  6362. @section deblock
  6363. Remove blocking artifacts from input video.
  6364. The filter accepts the following options:
  6365. @table @option
  6366. @item filter
  6367. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6368. This controls what kind of deblocking is applied.
  6369. @item block
  6370. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6371. @item alpha
  6372. @item beta
  6373. @item gamma
  6374. @item delta
  6375. Set blocking detection thresholds. Allowed range is 0 to 1.
  6376. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6377. Using higher threshold gives more deblocking strength.
  6378. Setting @var{alpha} controls threshold detection at exact edge of block.
  6379. Remaining options controls threshold detection near the edge. Each one for
  6380. below/above or left/right. Setting any of those to @var{0} disables
  6381. deblocking.
  6382. @item planes
  6383. Set planes to filter. Default is to filter all available planes.
  6384. @end table
  6385. @subsection Examples
  6386. @itemize
  6387. @item
  6388. Deblock using weak filter and block size of 4 pixels.
  6389. @example
  6390. deblock=filter=weak:block=4
  6391. @end example
  6392. @item
  6393. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6394. deblocking more edges.
  6395. @example
  6396. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6397. @end example
  6398. @item
  6399. Similar as above, but filter only first plane.
  6400. @example
  6401. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6402. @end example
  6403. @item
  6404. Similar as above, but filter only second and third plane.
  6405. @example
  6406. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6407. @end example
  6408. @end itemize
  6409. @anchor{decimate}
  6410. @section decimate
  6411. Drop duplicated frames at regular intervals.
  6412. The filter accepts the following options:
  6413. @table @option
  6414. @item cycle
  6415. Set the number of frames from which one will be dropped. Setting this to
  6416. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6417. Default is @code{5}.
  6418. @item dupthresh
  6419. Set the threshold for duplicate detection. If the difference metric for a frame
  6420. is less than or equal to this value, then it is declared as duplicate. Default
  6421. is @code{1.1}
  6422. @item scthresh
  6423. Set scene change threshold. Default is @code{15}.
  6424. @item blockx
  6425. @item blocky
  6426. Set the size of the x and y-axis blocks used during metric calculations.
  6427. Larger blocks give better noise suppression, but also give worse detection of
  6428. small movements. Must be a power of two. Default is @code{32}.
  6429. @item ppsrc
  6430. Mark main input as a pre-processed input and activate clean source input
  6431. stream. This allows the input to be pre-processed with various filters to help
  6432. the metrics calculation while keeping the frame selection lossless. When set to
  6433. @code{1}, the first stream is for the pre-processed input, and the second
  6434. stream is the clean source from where the kept frames are chosen. Default is
  6435. @code{0}.
  6436. @item chroma
  6437. Set whether or not chroma is considered in the metric calculations. Default is
  6438. @code{1}.
  6439. @end table
  6440. @section deconvolve
  6441. Apply 2D deconvolution of video stream in frequency domain using second stream
  6442. as impulse.
  6443. The filter accepts the following options:
  6444. @table @option
  6445. @item planes
  6446. Set which planes to process.
  6447. @item impulse
  6448. Set which impulse video frames will be processed, can be @var{first}
  6449. or @var{all}. Default is @var{all}.
  6450. @item noise
  6451. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6452. and height are not same and not power of 2 or if stream prior to convolving
  6453. had noise.
  6454. @end table
  6455. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6456. @section dedot
  6457. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6458. It accepts the following options:
  6459. @table @option
  6460. @item m
  6461. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6462. @var{rainbows} for cross-color reduction.
  6463. @item lt
  6464. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6465. @item tl
  6466. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6467. @item tc
  6468. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6469. @item ct
  6470. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6471. @end table
  6472. @section deflate
  6473. Apply deflate effect to the video.
  6474. This filter replaces the pixel by the local(3x3) average by taking into account
  6475. only values lower than the pixel.
  6476. It accepts the following options:
  6477. @table @option
  6478. @item threshold0
  6479. @item threshold1
  6480. @item threshold2
  6481. @item threshold3
  6482. Limit the maximum change for each plane, default is 65535.
  6483. If 0, plane will remain unchanged.
  6484. @end table
  6485. @section deflicker
  6486. Remove temporal frame luminance variations.
  6487. It accepts the following options:
  6488. @table @option
  6489. @item size, s
  6490. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6491. @item mode, m
  6492. Set averaging mode to smooth temporal luminance variations.
  6493. Available values are:
  6494. @table @samp
  6495. @item am
  6496. Arithmetic mean
  6497. @item gm
  6498. Geometric mean
  6499. @item hm
  6500. Harmonic mean
  6501. @item qm
  6502. Quadratic mean
  6503. @item cm
  6504. Cubic mean
  6505. @item pm
  6506. Power mean
  6507. @item median
  6508. Median
  6509. @end table
  6510. @item bypass
  6511. Do not actually modify frame. Useful when one only wants metadata.
  6512. @end table
  6513. @section dejudder
  6514. Remove judder produced by partially interlaced telecined content.
  6515. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6516. source was partially telecined content then the output of @code{pullup,dejudder}
  6517. will have a variable frame rate. May change the recorded frame rate of the
  6518. container. Aside from that change, this filter will not affect constant frame
  6519. rate video.
  6520. The option available in this filter is:
  6521. @table @option
  6522. @item cycle
  6523. Specify the length of the window over which the judder repeats.
  6524. Accepts any integer greater than 1. Useful values are:
  6525. @table @samp
  6526. @item 4
  6527. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6528. @item 5
  6529. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6530. @item 20
  6531. If a mixture of the two.
  6532. @end table
  6533. The default is @samp{4}.
  6534. @end table
  6535. @section delogo
  6536. Suppress a TV station logo by a simple interpolation of the surrounding
  6537. pixels. Just set a rectangle covering the logo and watch it disappear
  6538. (and sometimes something even uglier appear - your mileage may vary).
  6539. It accepts the following parameters:
  6540. @table @option
  6541. @item x
  6542. @item y
  6543. Specify the top left corner coordinates of the logo. They must be
  6544. specified.
  6545. @item w
  6546. @item h
  6547. Specify the width and height of the logo to clear. They must be
  6548. specified.
  6549. @item band, t
  6550. Specify the thickness of the fuzzy edge of the rectangle (added to
  6551. @var{w} and @var{h}). The default value is 1. This option is
  6552. deprecated, setting higher values should no longer be necessary and
  6553. is not recommended.
  6554. @item show
  6555. When set to 1, a green rectangle is drawn on the screen to simplify
  6556. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6557. The default value is 0.
  6558. The rectangle is drawn on the outermost pixels which will be (partly)
  6559. replaced with interpolated values. The values of the next pixels
  6560. immediately outside this rectangle in each direction will be used to
  6561. compute the interpolated pixel values inside the rectangle.
  6562. @end table
  6563. @subsection Examples
  6564. @itemize
  6565. @item
  6566. Set a rectangle covering the area with top left corner coordinates 0,0
  6567. and size 100x77, and a band of size 10:
  6568. @example
  6569. delogo=x=0:y=0:w=100:h=77:band=10
  6570. @end example
  6571. @end itemize
  6572. @section derain
  6573. Remove the rain in the input image/video by applying the derain methods based on
  6574. convolutional neural networks. Supported models:
  6575. @itemize
  6576. @item
  6577. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  6578. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  6579. @end itemize
  6580. Training as well as model generation scripts are provided in
  6581. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  6582. Native model files (.model) can be generated from TensorFlow model
  6583. files (.pb) by using tools/python/convert.py
  6584. The filter accepts the following options:
  6585. @table @option
  6586. @item filter_type
  6587. Specify which filter to use. This option accepts the following values:
  6588. @table @samp
  6589. @item derain
  6590. Derain filter. To conduct derain filter, you need to use a derain model.
  6591. @item dehaze
  6592. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  6593. @end table
  6594. Default value is @samp{derain}.
  6595. @item dnn_backend
  6596. Specify which DNN backend to use for model loading and execution. This option accepts
  6597. the following values:
  6598. @table @samp
  6599. @item native
  6600. Native implementation of DNN loading and execution.
  6601. @item tensorflow
  6602. TensorFlow backend. To enable this backend you
  6603. need to install the TensorFlow for C library (see
  6604. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  6605. @code{--enable-libtensorflow}
  6606. @end table
  6607. Default value is @samp{native}.
  6608. @item model
  6609. Set path to model file specifying network architecture and its parameters.
  6610. Note that different backends use different file formats. TensorFlow and native
  6611. backend can load files for only its format.
  6612. @end table
  6613. @section deshake
  6614. Attempt to fix small changes in horizontal and/or vertical shift. This
  6615. filter helps remove camera shake from hand-holding a camera, bumping a
  6616. tripod, moving on a vehicle, etc.
  6617. The filter accepts the following options:
  6618. @table @option
  6619. @item x
  6620. @item y
  6621. @item w
  6622. @item h
  6623. Specify a rectangular area where to limit the search for motion
  6624. vectors.
  6625. If desired the search for motion vectors can be limited to a
  6626. rectangular area of the frame defined by its top left corner, width
  6627. and height. These parameters have the same meaning as the drawbox
  6628. filter which can be used to visualise the position of the bounding
  6629. box.
  6630. This is useful when simultaneous movement of subjects within the frame
  6631. might be confused for camera motion by the motion vector search.
  6632. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6633. then the full frame is used. This allows later options to be set
  6634. without specifying the bounding box for the motion vector search.
  6635. Default - search the whole frame.
  6636. @item rx
  6637. @item ry
  6638. Specify the maximum extent of movement in x and y directions in the
  6639. range 0-64 pixels. Default 16.
  6640. @item edge
  6641. Specify how to generate pixels to fill blanks at the edge of the
  6642. frame. Available values are:
  6643. @table @samp
  6644. @item blank, 0
  6645. Fill zeroes at blank locations
  6646. @item original, 1
  6647. Original image at blank locations
  6648. @item clamp, 2
  6649. Extruded edge value at blank locations
  6650. @item mirror, 3
  6651. Mirrored edge at blank locations
  6652. @end table
  6653. Default value is @samp{mirror}.
  6654. @item blocksize
  6655. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6656. default 8.
  6657. @item contrast
  6658. Specify the contrast threshold for blocks. Only blocks with more than
  6659. the specified contrast (difference between darkest and lightest
  6660. pixels) will be considered. Range 1-255, default 125.
  6661. @item search
  6662. Specify the search strategy. Available values are:
  6663. @table @samp
  6664. @item exhaustive, 0
  6665. Set exhaustive search
  6666. @item less, 1
  6667. Set less exhaustive search.
  6668. @end table
  6669. Default value is @samp{exhaustive}.
  6670. @item filename
  6671. If set then a detailed log of the motion search is written to the
  6672. specified file.
  6673. @end table
  6674. @section despill
  6675. Remove unwanted contamination of foreground colors, caused by reflected color of
  6676. greenscreen or bluescreen.
  6677. This filter accepts the following options:
  6678. @table @option
  6679. @item type
  6680. Set what type of despill to use.
  6681. @item mix
  6682. Set how spillmap will be generated.
  6683. @item expand
  6684. Set how much to get rid of still remaining spill.
  6685. @item red
  6686. Controls amount of red in spill area.
  6687. @item green
  6688. Controls amount of green in spill area.
  6689. Should be -1 for greenscreen.
  6690. @item blue
  6691. Controls amount of blue in spill area.
  6692. Should be -1 for bluescreen.
  6693. @item brightness
  6694. Controls brightness of spill area, preserving colors.
  6695. @item alpha
  6696. Modify alpha from generated spillmap.
  6697. @end table
  6698. @section detelecine
  6699. Apply an exact inverse of the telecine operation. It requires a predefined
  6700. pattern specified using the pattern option which must be the same as that passed
  6701. to the telecine filter.
  6702. This filter accepts the following options:
  6703. @table @option
  6704. @item first_field
  6705. @table @samp
  6706. @item top, t
  6707. top field first
  6708. @item bottom, b
  6709. bottom field first
  6710. The default value is @code{top}.
  6711. @end table
  6712. @item pattern
  6713. A string of numbers representing the pulldown pattern you wish to apply.
  6714. The default value is @code{23}.
  6715. @item start_frame
  6716. A number representing position of the first frame with respect to the telecine
  6717. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6718. @end table
  6719. @section dilation
  6720. Apply dilation effect to the video.
  6721. This filter replaces the pixel by the local(3x3) maximum.
  6722. It accepts the following options:
  6723. @table @option
  6724. @item threshold0
  6725. @item threshold1
  6726. @item threshold2
  6727. @item threshold3
  6728. Limit the maximum change for each plane, default is 65535.
  6729. If 0, plane will remain unchanged.
  6730. @item coordinates
  6731. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6732. pixels are used.
  6733. Flags to local 3x3 coordinates maps like this:
  6734. 1 2 3
  6735. 4 5
  6736. 6 7 8
  6737. @end table
  6738. @section displace
  6739. Displace pixels as indicated by second and third input stream.
  6740. It takes three input streams and outputs one stream, the first input is the
  6741. source, and second and third input are displacement maps.
  6742. The second input specifies how much to displace pixels along the
  6743. x-axis, while the third input specifies how much to displace pixels
  6744. along the y-axis.
  6745. If one of displacement map streams terminates, last frame from that
  6746. displacement map will be used.
  6747. Note that once generated, displacements maps can be reused over and over again.
  6748. A description of the accepted options follows.
  6749. @table @option
  6750. @item edge
  6751. Set displace behavior for pixels that are out of range.
  6752. Available values are:
  6753. @table @samp
  6754. @item blank
  6755. Missing pixels are replaced by black pixels.
  6756. @item smear
  6757. Adjacent pixels will spread out to replace missing pixels.
  6758. @item wrap
  6759. Out of range pixels are wrapped so they point to pixels of other side.
  6760. @item mirror
  6761. Out of range pixels will be replaced with mirrored pixels.
  6762. @end table
  6763. Default is @samp{smear}.
  6764. @end table
  6765. @subsection Examples
  6766. @itemize
  6767. @item
  6768. Add ripple effect to rgb input of video size hd720:
  6769. @example
  6770. 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
  6771. @end example
  6772. @item
  6773. Add wave effect to rgb input of video size hd720:
  6774. @example
  6775. 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
  6776. @end example
  6777. @end itemize
  6778. @section drawbox
  6779. Draw a colored box on the input image.
  6780. It accepts the following parameters:
  6781. @table @option
  6782. @item x
  6783. @item y
  6784. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6785. @item width, w
  6786. @item height, h
  6787. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6788. the input width and height. It defaults to 0.
  6789. @item color, c
  6790. Specify the color of the box to write. For the general syntax of this option,
  6791. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6792. value @code{invert} is used, the box edge color is the same as the
  6793. video with inverted luma.
  6794. @item thickness, t
  6795. The expression which sets the thickness of the box edge.
  6796. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6797. See below for the list of accepted constants.
  6798. @item replace
  6799. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6800. will overwrite the video's color and alpha pixels.
  6801. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6802. @end table
  6803. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6804. following constants:
  6805. @table @option
  6806. @item dar
  6807. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6808. @item hsub
  6809. @item vsub
  6810. horizontal and vertical chroma subsample values. For example for the
  6811. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6812. @item in_h, ih
  6813. @item in_w, iw
  6814. The input width and height.
  6815. @item sar
  6816. The input sample aspect ratio.
  6817. @item x
  6818. @item y
  6819. The x and y offset coordinates where the box is drawn.
  6820. @item w
  6821. @item h
  6822. The width and height of the drawn box.
  6823. @item t
  6824. The thickness of the drawn box.
  6825. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6826. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6827. @end table
  6828. @subsection Examples
  6829. @itemize
  6830. @item
  6831. Draw a black box around the edge of the input image:
  6832. @example
  6833. drawbox
  6834. @end example
  6835. @item
  6836. Draw a box with color red and an opacity of 50%:
  6837. @example
  6838. drawbox=10:20:200:60:red@@0.5
  6839. @end example
  6840. The previous example can be specified as:
  6841. @example
  6842. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6843. @end example
  6844. @item
  6845. Fill the box with pink color:
  6846. @example
  6847. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6848. @end example
  6849. @item
  6850. Draw a 2-pixel red 2.40:1 mask:
  6851. @example
  6852. 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
  6853. @end example
  6854. @end itemize
  6855. @subsection Commands
  6856. This filter supports same commands as options.
  6857. The command accepts the same syntax of the corresponding option.
  6858. If the specified expression is not valid, it is kept at its current
  6859. value.
  6860. @section drawgrid
  6861. Draw a grid on the input image.
  6862. It accepts the following parameters:
  6863. @table @option
  6864. @item x
  6865. @item y
  6866. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6867. @item width, w
  6868. @item height, h
  6869. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6870. input width and height, respectively, minus @code{thickness}, so image gets
  6871. framed. Default to 0.
  6872. @item color, c
  6873. Specify the color of the grid. For the general syntax of this option,
  6874. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6875. value @code{invert} is used, the grid color is the same as the
  6876. video with inverted luma.
  6877. @item thickness, t
  6878. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6879. See below for the list of accepted constants.
  6880. @item replace
  6881. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6882. will overwrite the video's color and alpha pixels.
  6883. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6884. @end table
  6885. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6886. following constants:
  6887. @table @option
  6888. @item dar
  6889. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6890. @item hsub
  6891. @item vsub
  6892. horizontal and vertical chroma subsample values. For example for the
  6893. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6894. @item in_h, ih
  6895. @item in_w, iw
  6896. The input grid cell width and height.
  6897. @item sar
  6898. The input sample aspect ratio.
  6899. @item x
  6900. @item y
  6901. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6902. @item w
  6903. @item h
  6904. The width and height of the drawn cell.
  6905. @item t
  6906. The thickness of the drawn cell.
  6907. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6908. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6909. @end table
  6910. @subsection Examples
  6911. @itemize
  6912. @item
  6913. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6914. @example
  6915. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6916. @end example
  6917. @item
  6918. Draw a white 3x3 grid with an opacity of 50%:
  6919. @example
  6920. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6921. @end example
  6922. @end itemize
  6923. @subsection Commands
  6924. This filter supports same commands as options.
  6925. The command accepts the same syntax of the corresponding option.
  6926. If the specified expression is not valid, it is kept at its current
  6927. value.
  6928. @anchor{drawtext}
  6929. @section drawtext
  6930. Draw a text string or text from a specified file on top of a video, using the
  6931. libfreetype library.
  6932. To enable compilation of this filter, you need to configure FFmpeg with
  6933. @code{--enable-libfreetype}.
  6934. To enable default font fallback and the @var{font} option you need to
  6935. configure FFmpeg with @code{--enable-libfontconfig}.
  6936. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6937. @code{--enable-libfribidi}.
  6938. @subsection Syntax
  6939. It accepts the following parameters:
  6940. @table @option
  6941. @item box
  6942. Used to draw a box around text using the background color.
  6943. The value must be either 1 (enable) or 0 (disable).
  6944. The default value of @var{box} is 0.
  6945. @item boxborderw
  6946. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6947. The default value of @var{boxborderw} is 0.
  6948. @item boxcolor
  6949. The color to be used for drawing box around text. For the syntax of this
  6950. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6951. The default value of @var{boxcolor} is "white".
  6952. @item line_spacing
  6953. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6954. The default value of @var{line_spacing} is 0.
  6955. @item borderw
  6956. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6957. The default value of @var{borderw} is 0.
  6958. @item bordercolor
  6959. Set the color to be used for drawing border around text. For the syntax of this
  6960. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6961. The default value of @var{bordercolor} is "black".
  6962. @item expansion
  6963. Select how the @var{text} is expanded. Can be either @code{none},
  6964. @code{strftime} (deprecated) or
  6965. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6966. below for details.
  6967. @item basetime
  6968. Set a start time for the count. Value is in microseconds. Only applied
  6969. in the deprecated strftime expansion mode. To emulate in normal expansion
  6970. mode use the @code{pts} function, supplying the start time (in seconds)
  6971. as the second argument.
  6972. @item fix_bounds
  6973. If true, check and fix text coords to avoid clipping.
  6974. @item fontcolor
  6975. The color to be used for drawing fonts. For the syntax of this option, check
  6976. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6977. The default value of @var{fontcolor} is "black".
  6978. @item fontcolor_expr
  6979. String which is expanded the same way as @var{text} to obtain dynamic
  6980. @var{fontcolor} value. By default this option has empty value and is not
  6981. processed. When this option is set, it overrides @var{fontcolor} option.
  6982. @item font
  6983. The font family to be used for drawing text. By default Sans.
  6984. @item fontfile
  6985. The font file to be used for drawing text. The path must be included.
  6986. This parameter is mandatory if the fontconfig support is disabled.
  6987. @item alpha
  6988. Draw the text applying alpha blending. The value can
  6989. be a number between 0.0 and 1.0.
  6990. The expression accepts the same variables @var{x, y} as well.
  6991. The default value is 1.
  6992. Please see @var{fontcolor_expr}.
  6993. @item fontsize
  6994. The font size to be used for drawing text.
  6995. The default value of @var{fontsize} is 16.
  6996. @item text_shaping
  6997. If set to 1, attempt to shape the text (for example, reverse the order of
  6998. right-to-left text and join Arabic characters) before drawing it.
  6999. Otherwise, just draw the text exactly as given.
  7000. By default 1 (if supported).
  7001. @item ft_load_flags
  7002. The flags to be used for loading the fonts.
  7003. The flags map the corresponding flags supported by libfreetype, and are
  7004. a combination of the following values:
  7005. @table @var
  7006. @item default
  7007. @item no_scale
  7008. @item no_hinting
  7009. @item render
  7010. @item no_bitmap
  7011. @item vertical_layout
  7012. @item force_autohint
  7013. @item crop_bitmap
  7014. @item pedantic
  7015. @item ignore_global_advance_width
  7016. @item no_recurse
  7017. @item ignore_transform
  7018. @item monochrome
  7019. @item linear_design
  7020. @item no_autohint
  7021. @end table
  7022. Default value is "default".
  7023. For more information consult the documentation for the FT_LOAD_*
  7024. libfreetype flags.
  7025. @item shadowcolor
  7026. The color to be used for drawing a shadow behind the drawn text. For the
  7027. syntax of this option, check the @ref{color syntax,,"Color" section in the
  7028. ffmpeg-utils manual,ffmpeg-utils}.
  7029. The default value of @var{shadowcolor} is "black".
  7030. @item shadowx
  7031. @item shadowy
  7032. The x and y offsets for the text shadow position with respect to the
  7033. position of the text. They can be either positive or negative
  7034. values. The default value for both is "0".
  7035. @item start_number
  7036. The starting frame number for the n/frame_num variable. The default value
  7037. is "0".
  7038. @item tabsize
  7039. The size in number of spaces to use for rendering the tab.
  7040. Default value is 4.
  7041. @item timecode
  7042. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  7043. format. It can be used with or without text parameter. @var{timecode_rate}
  7044. option must be specified.
  7045. @item timecode_rate, rate, r
  7046. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  7047. integer. Minimum value is "1".
  7048. Drop-frame timecode is supported for frame rates 30 & 60.
  7049. @item tc24hmax
  7050. If set to 1, the output of the timecode option will wrap around at 24 hours.
  7051. Default is 0 (disabled).
  7052. @item text
  7053. The text string to be drawn. The text must be a sequence of UTF-8
  7054. encoded characters.
  7055. This parameter is mandatory if no file is specified with the parameter
  7056. @var{textfile}.
  7057. @item textfile
  7058. A text file containing text to be drawn. The text must be a sequence
  7059. of UTF-8 encoded characters.
  7060. This parameter is mandatory if no text string is specified with the
  7061. parameter @var{text}.
  7062. If both @var{text} and @var{textfile} are specified, an error is thrown.
  7063. @item reload
  7064. If set to 1, the @var{textfile} will be reloaded before each frame.
  7065. Be sure to update it atomically, or it may be read partially, or even fail.
  7066. @item x
  7067. @item y
  7068. The expressions which specify the offsets where text will be drawn
  7069. within the video frame. They are relative to the top/left border of the
  7070. output image.
  7071. The default value of @var{x} and @var{y} is "0".
  7072. See below for the list of accepted constants and functions.
  7073. @end table
  7074. The parameters for @var{x} and @var{y} are expressions containing the
  7075. following constants and functions:
  7076. @table @option
  7077. @item dar
  7078. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  7079. @item hsub
  7080. @item vsub
  7081. horizontal and vertical chroma subsample values. For example for the
  7082. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7083. @item line_h, lh
  7084. the height of each text line
  7085. @item main_h, h, H
  7086. the input height
  7087. @item main_w, w, W
  7088. the input width
  7089. @item max_glyph_a, ascent
  7090. the maximum distance from the baseline to the highest/upper grid
  7091. coordinate used to place a glyph outline point, for all the rendered
  7092. glyphs.
  7093. It is a positive value, due to the grid's orientation with the Y axis
  7094. upwards.
  7095. @item max_glyph_d, descent
  7096. the maximum distance from the baseline to the lowest grid coordinate
  7097. used to place a glyph outline point, for all the rendered glyphs.
  7098. This is a negative value, due to the grid's orientation, with the Y axis
  7099. upwards.
  7100. @item max_glyph_h
  7101. maximum glyph height, that is the maximum height for all the glyphs
  7102. contained in the rendered text, it is equivalent to @var{ascent} -
  7103. @var{descent}.
  7104. @item max_glyph_w
  7105. maximum glyph width, that is the maximum width for all the glyphs
  7106. contained in the rendered text
  7107. @item n
  7108. the number of input frame, starting from 0
  7109. @item rand(min, max)
  7110. return a random number included between @var{min} and @var{max}
  7111. @item sar
  7112. The input sample aspect ratio.
  7113. @item t
  7114. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7115. @item text_h, th
  7116. the height of the rendered text
  7117. @item text_w, tw
  7118. the width of the rendered text
  7119. @item x
  7120. @item y
  7121. the x and y offset coordinates where the text is drawn.
  7122. These parameters allow the @var{x} and @var{y} expressions to refer
  7123. to each other, so you can for example specify @code{y=x/dar}.
  7124. @item pict_type
  7125. A one character description of the current frame's picture type.
  7126. @item pkt_pos
  7127. The current packet's position in the input file or stream
  7128. (in bytes, from the start of the input). A value of -1 indicates
  7129. this info is not available.
  7130. @item pkt_duration
  7131. The current packet's duration, in seconds.
  7132. @item pkt_size
  7133. The current packet's size (in bytes).
  7134. @end table
  7135. @anchor{drawtext_expansion}
  7136. @subsection Text expansion
  7137. If @option{expansion} is set to @code{strftime},
  7138. the filter recognizes strftime() sequences in the provided text and
  7139. expands them accordingly. Check the documentation of strftime(). This
  7140. feature is deprecated.
  7141. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  7142. If @option{expansion} is set to @code{normal} (which is the default),
  7143. the following expansion mechanism is used.
  7144. The backslash character @samp{\}, followed by any character, always expands to
  7145. the second character.
  7146. Sequences of the form @code{%@{...@}} are expanded. The text between the
  7147. braces is a function name, possibly followed by arguments separated by ':'.
  7148. If the arguments contain special characters or delimiters (':' or '@}'),
  7149. they should be escaped.
  7150. Note that they probably must also be escaped as the value for the
  7151. @option{text} option in the filter argument string and as the filter
  7152. argument in the filtergraph description, and possibly also for the shell,
  7153. that makes up to four levels of escaping; using a text file avoids these
  7154. problems.
  7155. The following functions are available:
  7156. @table @command
  7157. @item expr, e
  7158. The expression evaluation result.
  7159. It must take one argument specifying the expression to be evaluated,
  7160. which accepts the same constants and functions as the @var{x} and
  7161. @var{y} values. Note that not all constants should be used, for
  7162. example the text size is not known when evaluating the expression, so
  7163. the constants @var{text_w} and @var{text_h} will have an undefined
  7164. value.
  7165. @item expr_int_format, eif
  7166. Evaluate the expression's value and output as formatted integer.
  7167. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  7168. The second argument specifies the output format. Allowed values are @samp{x},
  7169. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  7170. @code{printf} function.
  7171. The third parameter is optional and sets the number of positions taken by the output.
  7172. It can be used to add padding with zeros from the left.
  7173. @item gmtime
  7174. The time at which the filter is running, expressed in UTC.
  7175. It can accept an argument: a strftime() format string.
  7176. @item localtime
  7177. The time at which the filter is running, expressed in the local time zone.
  7178. It can accept an argument: a strftime() format string.
  7179. @item metadata
  7180. Frame metadata. Takes one or two arguments.
  7181. The first argument is mandatory and specifies the metadata key.
  7182. The second argument is optional and specifies a default value, used when the
  7183. metadata key is not found or empty.
  7184. Available metadata can be identified by inspecting entries
  7185. starting with TAG included within each frame section
  7186. printed by running @code{ffprobe -show_frames}.
  7187. String metadata generated in filters leading to
  7188. the drawtext filter are also available.
  7189. @item n, frame_num
  7190. The frame number, starting from 0.
  7191. @item pict_type
  7192. A one character description of the current picture type.
  7193. @item pts
  7194. The timestamp of the current frame.
  7195. It can take up to three arguments.
  7196. The first argument is the format of the timestamp; it defaults to @code{flt}
  7197. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  7198. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  7199. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  7200. @code{localtime} stands for the timestamp of the frame formatted as
  7201. local time zone time.
  7202. The second argument is an offset added to the timestamp.
  7203. If the format is set to @code{hms}, a third argument @code{24HH} may be
  7204. supplied to present the hour part of the formatted timestamp in 24h format
  7205. (00-23).
  7206. If the format is set to @code{localtime} or @code{gmtime},
  7207. a third argument may be supplied: a strftime() format string.
  7208. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  7209. @end table
  7210. @subsection Commands
  7211. This filter supports altering parameters via commands:
  7212. @table @option
  7213. @item reinit
  7214. Alter existing filter parameters.
  7215. Syntax for the argument is the same as for filter invocation, e.g.
  7216. @example
  7217. fontsize=56:fontcolor=green:text='Hello World'
  7218. @end example
  7219. Full filter invocation with sendcmd would look like this:
  7220. @example
  7221. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7222. @end example
  7223. @end table
  7224. If the entire argument can't be parsed or applied as valid values then the filter will
  7225. continue with its existing parameters.
  7226. @subsection Examples
  7227. @itemize
  7228. @item
  7229. Draw "Test Text" with font FreeSerif, using the default values for the
  7230. optional parameters.
  7231. @example
  7232. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7233. @end example
  7234. @item
  7235. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7236. and y=50 (counting from the top-left corner of the screen), text is
  7237. yellow with a red box around it. Both the text and the box have an
  7238. opacity of 20%.
  7239. @example
  7240. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7241. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7242. @end example
  7243. Note that the double quotes are not necessary if spaces are not used
  7244. within the parameter list.
  7245. @item
  7246. Show the text at the center of the video frame:
  7247. @example
  7248. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7249. @end example
  7250. @item
  7251. Show the text at a random position, switching to a new position every 30 seconds:
  7252. @example
  7253. 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)"
  7254. @end example
  7255. @item
  7256. Show a text line sliding from right to left in the last row of the video
  7257. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7258. with no newlines.
  7259. @example
  7260. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7261. @end example
  7262. @item
  7263. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7264. @example
  7265. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7266. @end example
  7267. @item
  7268. Draw a single green letter "g", at the center of the input video.
  7269. The glyph baseline is placed at half screen height.
  7270. @example
  7271. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7272. @end example
  7273. @item
  7274. Show text for 1 second every 3 seconds:
  7275. @example
  7276. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7277. @end example
  7278. @item
  7279. Use fontconfig to set the font. Note that the colons need to be escaped.
  7280. @example
  7281. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7282. @end example
  7283. @item
  7284. Print the date of a real-time encoding (see strftime(3)):
  7285. @example
  7286. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7287. @end example
  7288. @item
  7289. Show text fading in and out (appearing/disappearing):
  7290. @example
  7291. #!/bin/sh
  7292. DS=1.0 # display start
  7293. DE=10.0 # display end
  7294. FID=1.5 # fade in duration
  7295. FOD=5 # fade out duration
  7296. 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 @}"
  7297. @end example
  7298. @item
  7299. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7300. and the @option{fontsize} value are included in the @option{y} offset.
  7301. @example
  7302. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7303. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7304. @end example
  7305. @end itemize
  7306. For more information about libfreetype, check:
  7307. @url{http://www.freetype.org/}.
  7308. For more information about fontconfig, check:
  7309. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7310. For more information about libfribidi, check:
  7311. @url{http://fribidi.org/}.
  7312. @section edgedetect
  7313. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7314. The filter accepts the following options:
  7315. @table @option
  7316. @item low
  7317. @item high
  7318. Set low and high threshold values used by the Canny thresholding
  7319. algorithm.
  7320. The high threshold selects the "strong" edge pixels, which are then
  7321. connected through 8-connectivity with the "weak" edge pixels selected
  7322. by the low threshold.
  7323. @var{low} and @var{high} threshold values must be chosen in the range
  7324. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7325. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  7326. is @code{50/255}.
  7327. @item mode
  7328. Define the drawing mode.
  7329. @table @samp
  7330. @item wires
  7331. Draw white/gray wires on black background.
  7332. @item colormix
  7333. Mix the colors to create a paint/cartoon effect.
  7334. @item canny
  7335. Apply Canny edge detector on all selected planes.
  7336. @end table
  7337. Default value is @var{wires}.
  7338. @item planes
  7339. Select planes for filtering. By default all available planes are filtered.
  7340. @end table
  7341. @subsection Examples
  7342. @itemize
  7343. @item
  7344. Standard edge detection with custom values for the hysteresis thresholding:
  7345. @example
  7346. edgedetect=low=0.1:high=0.4
  7347. @end example
  7348. @item
  7349. Painting effect without thresholding:
  7350. @example
  7351. edgedetect=mode=colormix:high=0
  7352. @end example
  7353. @end itemize
  7354. @section elbg
  7355. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7356. For each input image, the filter will compute the optimal mapping from
  7357. the input to the output given the codebook length, that is the number
  7358. of distinct output colors.
  7359. This filter accepts the following options.
  7360. @table @option
  7361. @item codebook_length, l
  7362. Set codebook length. The value must be a positive integer, and
  7363. represents the number of distinct output colors. Default value is 256.
  7364. @item nb_steps, n
  7365. Set the maximum number of iterations to apply for computing the optimal
  7366. mapping. The higher the value the better the result and the higher the
  7367. computation time. Default value is 1.
  7368. @item seed, s
  7369. Set a random seed, must be an integer included between 0 and
  7370. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7371. will try to use a good random seed on a best effort basis.
  7372. @item pal8
  7373. Set pal8 output pixel format. This option does not work with codebook
  7374. length greater than 256.
  7375. @end table
  7376. @section entropy
  7377. Measure graylevel entropy in histogram of color channels of video frames.
  7378. It accepts the following parameters:
  7379. @table @option
  7380. @item mode
  7381. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7382. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7383. between neighbour histogram values.
  7384. @end table
  7385. @section eq
  7386. Set brightness, contrast, saturation and approximate gamma adjustment.
  7387. The filter accepts the following options:
  7388. @table @option
  7389. @item contrast
  7390. Set the contrast expression. The value must be a float value in range
  7391. @code{-1000.0} to @code{1000.0}. The default value is "1".
  7392. @item brightness
  7393. Set the brightness expression. The value must be a float value in
  7394. range @code{-1.0} to @code{1.0}. The default value is "0".
  7395. @item saturation
  7396. Set the saturation expression. The value must be a float in
  7397. range @code{0.0} to @code{3.0}. The default value is "1".
  7398. @item gamma
  7399. Set the gamma expression. The value must be a float in range
  7400. @code{0.1} to @code{10.0}. The default value is "1".
  7401. @item gamma_r
  7402. Set the gamma expression for red. The value must be a float in
  7403. range @code{0.1} to @code{10.0}. The default value is "1".
  7404. @item gamma_g
  7405. Set the gamma expression for green. The value must be a float in range
  7406. @code{0.1} to @code{10.0}. The default value is "1".
  7407. @item gamma_b
  7408. Set the gamma expression for blue. The value must be a float in range
  7409. @code{0.1} to @code{10.0}. The default value is "1".
  7410. @item gamma_weight
  7411. Set the gamma weight expression. It can be used to reduce the effect
  7412. of a high gamma value on bright image areas, e.g. keep them from
  7413. getting overamplified and just plain white. The value must be a float
  7414. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7415. gamma correction all the way down while @code{1.0} leaves it at its
  7416. full strength. Default is "1".
  7417. @item eval
  7418. Set when the expressions for brightness, contrast, saturation and
  7419. gamma expressions are evaluated.
  7420. It accepts the following values:
  7421. @table @samp
  7422. @item init
  7423. only evaluate expressions once during the filter initialization or
  7424. when a command is processed
  7425. @item frame
  7426. evaluate expressions for each incoming frame
  7427. @end table
  7428. Default value is @samp{init}.
  7429. @end table
  7430. The expressions accept the following parameters:
  7431. @table @option
  7432. @item n
  7433. frame count of the input frame starting from 0
  7434. @item pos
  7435. byte position of the corresponding packet in the input file, NAN if
  7436. unspecified
  7437. @item r
  7438. frame rate of the input video, NAN if the input frame rate is unknown
  7439. @item t
  7440. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7441. @end table
  7442. @subsection Commands
  7443. The filter supports the following commands:
  7444. @table @option
  7445. @item contrast
  7446. Set the contrast expression.
  7447. @item brightness
  7448. Set the brightness expression.
  7449. @item saturation
  7450. Set the saturation expression.
  7451. @item gamma
  7452. Set the gamma expression.
  7453. @item gamma_r
  7454. Set the gamma_r expression.
  7455. @item gamma_g
  7456. Set gamma_g expression.
  7457. @item gamma_b
  7458. Set gamma_b expression.
  7459. @item gamma_weight
  7460. Set gamma_weight expression.
  7461. The command accepts the same syntax of the corresponding option.
  7462. If the specified expression is not valid, it is kept at its current
  7463. value.
  7464. @end table
  7465. @section erosion
  7466. Apply erosion effect to the video.
  7467. This filter replaces the pixel by the local(3x3) minimum.
  7468. It accepts the following options:
  7469. @table @option
  7470. @item threshold0
  7471. @item threshold1
  7472. @item threshold2
  7473. @item threshold3
  7474. Limit the maximum change for each plane, default is 65535.
  7475. If 0, plane will remain unchanged.
  7476. @item coordinates
  7477. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7478. pixels are used.
  7479. Flags to local 3x3 coordinates maps like this:
  7480. 1 2 3
  7481. 4 5
  7482. 6 7 8
  7483. @end table
  7484. @section extractplanes
  7485. Extract color channel components from input video stream into
  7486. separate grayscale video streams.
  7487. The filter accepts the following option:
  7488. @table @option
  7489. @item planes
  7490. Set plane(s) to extract.
  7491. Available values for planes are:
  7492. @table @samp
  7493. @item y
  7494. @item u
  7495. @item v
  7496. @item a
  7497. @item r
  7498. @item g
  7499. @item b
  7500. @end table
  7501. Choosing planes not available in the input will result in an error.
  7502. That means you cannot select @code{r}, @code{g}, @code{b} planes
  7503. with @code{y}, @code{u}, @code{v} planes at same time.
  7504. @end table
  7505. @subsection Examples
  7506. @itemize
  7507. @item
  7508. Extract luma, u and v color channel component from input video frame
  7509. into 3 grayscale outputs:
  7510. @example
  7511. 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
  7512. @end example
  7513. @end itemize
  7514. @section fade
  7515. Apply a fade-in/out effect to the input video.
  7516. It accepts the following parameters:
  7517. @table @option
  7518. @item type, t
  7519. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7520. effect.
  7521. Default is @code{in}.
  7522. @item start_frame, s
  7523. Specify the number of the frame to start applying the fade
  7524. effect at. Default is 0.
  7525. @item nb_frames, n
  7526. The number of frames that the fade effect lasts. At the end of the
  7527. fade-in effect, the output video will have the same intensity as the input video.
  7528. At the end of the fade-out transition, the output video will be filled with the
  7529. selected @option{color}.
  7530. Default is 25.
  7531. @item alpha
  7532. If set to 1, fade only alpha channel, if one exists on the input.
  7533. Default value is 0.
  7534. @item start_time, st
  7535. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7536. effect. If both start_frame and start_time are specified, the fade will start at
  7537. whichever comes last. Default is 0.
  7538. @item duration, d
  7539. The number of seconds for which the fade effect has to last. At the end of the
  7540. fade-in effect the output video will have the same intensity as the input video,
  7541. at the end of the fade-out transition the output video will be filled with the
  7542. selected @option{color}.
  7543. If both duration and nb_frames are specified, duration is used. Default is 0
  7544. (nb_frames is used by default).
  7545. @item color, c
  7546. Specify the color of the fade. Default is "black".
  7547. @end table
  7548. @subsection Examples
  7549. @itemize
  7550. @item
  7551. Fade in the first 30 frames of video:
  7552. @example
  7553. fade=in:0:30
  7554. @end example
  7555. The command above is equivalent to:
  7556. @example
  7557. fade=t=in:s=0:n=30
  7558. @end example
  7559. @item
  7560. Fade out the last 45 frames of a 200-frame video:
  7561. @example
  7562. fade=out:155:45
  7563. fade=type=out:start_frame=155:nb_frames=45
  7564. @end example
  7565. @item
  7566. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7567. @example
  7568. fade=in:0:25, fade=out:975:25
  7569. @end example
  7570. @item
  7571. Make the first 5 frames yellow, then fade in from frame 5-24:
  7572. @example
  7573. fade=in:5:20:color=yellow
  7574. @end example
  7575. @item
  7576. Fade in alpha over first 25 frames of video:
  7577. @example
  7578. fade=in:0:25:alpha=1
  7579. @end example
  7580. @item
  7581. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7582. @example
  7583. fade=t=in:st=5.5:d=0.5
  7584. @end example
  7585. @end itemize
  7586. @section fftdnoiz
  7587. Denoise frames using 3D FFT (frequency domain filtering).
  7588. The filter accepts the following options:
  7589. @table @option
  7590. @item sigma
  7591. Set the noise sigma constant. This sets denoising strength.
  7592. Default value is 1. Allowed range is from 0 to 30.
  7593. Using very high sigma with low overlap may give blocking artifacts.
  7594. @item amount
  7595. Set amount of denoising. By default all detected noise is reduced.
  7596. Default value is 1. Allowed range is from 0 to 1.
  7597. @item block
  7598. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7599. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7600. block size in pixels is 2^4 which is 16.
  7601. @item overlap
  7602. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7603. @item prev
  7604. Set number of previous frames to use for denoising. By default is set to 0.
  7605. @item next
  7606. Set number of next frames to to use for denoising. By default is set to 0.
  7607. @item planes
  7608. Set planes which will be filtered, by default are all available filtered
  7609. except alpha.
  7610. @end table
  7611. @section fftfilt
  7612. Apply arbitrary expressions to samples in frequency domain
  7613. @table @option
  7614. @item dc_Y
  7615. Adjust the dc value (gain) of the luma plane of the image. The filter
  7616. accepts an integer value in range @code{0} to @code{1000}. The default
  7617. value is set to @code{0}.
  7618. @item dc_U
  7619. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7620. filter accepts an integer value in range @code{0} to @code{1000}. The
  7621. default value is set to @code{0}.
  7622. @item dc_V
  7623. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7624. filter accepts an integer value in range @code{0} to @code{1000}. The
  7625. default value is set to @code{0}.
  7626. @item weight_Y
  7627. Set the frequency domain weight expression for the luma plane.
  7628. @item weight_U
  7629. Set the frequency domain weight expression for the 1st chroma plane.
  7630. @item weight_V
  7631. Set the frequency domain weight expression for the 2nd chroma plane.
  7632. @item eval
  7633. Set when the expressions are evaluated.
  7634. It accepts the following values:
  7635. @table @samp
  7636. @item init
  7637. Only evaluate expressions once during the filter initialization.
  7638. @item frame
  7639. Evaluate expressions for each incoming frame.
  7640. @end table
  7641. Default value is @samp{init}.
  7642. The filter accepts the following variables:
  7643. @item X
  7644. @item Y
  7645. The coordinates of the current sample.
  7646. @item W
  7647. @item H
  7648. The width and height of the image.
  7649. @item N
  7650. The number of input frame, starting from 0.
  7651. @end table
  7652. @subsection Examples
  7653. @itemize
  7654. @item
  7655. High-pass:
  7656. @example
  7657. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7658. @end example
  7659. @item
  7660. Low-pass:
  7661. @example
  7662. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7663. @end example
  7664. @item
  7665. Sharpen:
  7666. @example
  7667. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7668. @end example
  7669. @item
  7670. Blur:
  7671. @example
  7672. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7673. @end example
  7674. @end itemize
  7675. @section field
  7676. Extract a single field from an interlaced image using stride
  7677. arithmetic to avoid wasting CPU time. The output frames are marked as
  7678. non-interlaced.
  7679. The filter accepts the following options:
  7680. @table @option
  7681. @item type
  7682. Specify whether to extract the top (if the value is @code{0} or
  7683. @code{top}) or the bottom field (if the value is @code{1} or
  7684. @code{bottom}).
  7685. @end table
  7686. @section fieldhint
  7687. Create new frames by copying the top and bottom fields from surrounding frames
  7688. supplied as numbers by the hint file.
  7689. @table @option
  7690. @item hint
  7691. Set file containing hints: absolute/relative frame numbers.
  7692. There must be one line for each frame in a clip. Each line must contain two
  7693. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7694. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7695. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7696. for @code{relative} mode. First number tells from which frame to pick up top
  7697. field and second number tells from which frame to pick up bottom field.
  7698. If optionally followed by @code{+} output frame will be marked as interlaced,
  7699. else if followed by @code{-} output frame will be marked as progressive, else
  7700. it will be marked same as input frame.
  7701. If line starts with @code{#} or @code{;} that line is skipped.
  7702. @item mode
  7703. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7704. @end table
  7705. Example of first several lines of @code{hint} file for @code{relative} mode:
  7706. @example
  7707. 0,0 - # first frame
  7708. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7709. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7710. 1,0 -
  7711. 0,0 -
  7712. 0,0 -
  7713. 1,0 -
  7714. 1,0 -
  7715. 1,0 -
  7716. 0,0 -
  7717. 0,0 -
  7718. 1,0 -
  7719. 1,0 -
  7720. 1,0 -
  7721. 0,0 -
  7722. @end example
  7723. @section fieldmatch
  7724. Field matching filter for inverse telecine. It is meant to reconstruct the
  7725. progressive frames from a telecined stream. The filter does not drop duplicated
  7726. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7727. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7728. The separation of the field matching and the decimation is notably motivated by
  7729. the possibility of inserting a de-interlacing filter fallback between the two.
  7730. If the source has mixed telecined and real interlaced content,
  7731. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7732. But these remaining combed frames will be marked as interlaced, and thus can be
  7733. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7734. In addition to the various configuration options, @code{fieldmatch} can take an
  7735. optional second stream, activated through the @option{ppsrc} option. If
  7736. enabled, the frames reconstruction will be based on the fields and frames from
  7737. this second stream. This allows the first input to be pre-processed in order to
  7738. help the various algorithms of the filter, while keeping the output lossless
  7739. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7740. or brightness/contrast adjustments can help.
  7741. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7742. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7743. which @code{fieldmatch} is based on. While the semantic and usage are very
  7744. close, some behaviour and options names can differ.
  7745. The @ref{decimate} filter currently only works for constant frame rate input.
  7746. If your input has mixed telecined (30fps) and progressive content with a lower
  7747. framerate like 24fps use the following filterchain to produce the necessary cfr
  7748. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7749. The filter accepts the following options:
  7750. @table @option
  7751. @item order
  7752. Specify the assumed field order of the input stream. Available values are:
  7753. @table @samp
  7754. @item auto
  7755. Auto detect parity (use FFmpeg's internal parity value).
  7756. @item bff
  7757. Assume bottom field first.
  7758. @item tff
  7759. Assume top field first.
  7760. @end table
  7761. Note that it is sometimes recommended not to trust the parity announced by the
  7762. stream.
  7763. Default value is @var{auto}.
  7764. @item mode
  7765. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7766. sense that it won't risk creating jerkiness due to duplicate frames when
  7767. possible, but if there are bad edits or blended fields it will end up
  7768. outputting combed frames when a good match might actually exist. On the other
  7769. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7770. but will almost always find a good frame if there is one. The other values are
  7771. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7772. jerkiness and creating duplicate frames versus finding good matches in sections
  7773. with bad edits, orphaned fields, blended fields, etc.
  7774. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7775. Available values are:
  7776. @table @samp
  7777. @item pc
  7778. 2-way matching (p/c)
  7779. @item pc_n
  7780. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7781. @item pc_u
  7782. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7783. @item pc_n_ub
  7784. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7785. still combed (p/c + n + u/b)
  7786. @item pcn
  7787. 3-way matching (p/c/n)
  7788. @item pcn_ub
  7789. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7790. detected as combed (p/c/n + u/b)
  7791. @end table
  7792. The parenthesis at the end indicate the matches that would be used for that
  7793. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7794. @var{top}).
  7795. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7796. the slowest.
  7797. Default value is @var{pc_n}.
  7798. @item ppsrc
  7799. Mark the main input stream as a pre-processed input, and enable the secondary
  7800. input stream as the clean source to pick the fields from. See the filter
  7801. introduction for more details. It is similar to the @option{clip2} feature from
  7802. VFM/TFM.
  7803. Default value is @code{0} (disabled).
  7804. @item field
  7805. Set the field to match from. It is recommended to set this to the same value as
  7806. @option{order} unless you experience matching failures with that setting. In
  7807. certain circumstances changing the field that is used to match from can have a
  7808. large impact on matching performance. Available values are:
  7809. @table @samp
  7810. @item auto
  7811. Automatic (same value as @option{order}).
  7812. @item bottom
  7813. Match from the bottom field.
  7814. @item top
  7815. Match from the top field.
  7816. @end table
  7817. Default value is @var{auto}.
  7818. @item mchroma
  7819. Set whether or not chroma is included during the match comparisons. In most
  7820. cases it is recommended to leave this enabled. You should set this to @code{0}
  7821. only if your clip has bad chroma problems such as heavy rainbowing or other
  7822. artifacts. Setting this to @code{0} could also be used to speed things up at
  7823. the cost of some accuracy.
  7824. Default value is @code{1}.
  7825. @item y0
  7826. @item y1
  7827. These define an exclusion band which excludes the lines between @option{y0} and
  7828. @option{y1} from being included in the field matching decision. An exclusion
  7829. band can be used to ignore subtitles, a logo, or other things that may
  7830. interfere with the matching. @option{y0} sets the starting scan line and
  7831. @option{y1} sets the ending line; all lines in between @option{y0} and
  7832. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7833. @option{y0} and @option{y1} to the same value will disable the feature.
  7834. @option{y0} and @option{y1} defaults to @code{0}.
  7835. @item scthresh
  7836. Set the scene change detection threshold as a percentage of maximum change on
  7837. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7838. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7839. @option{scthresh} is @code{[0.0, 100.0]}.
  7840. Default value is @code{12.0}.
  7841. @item combmatch
  7842. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7843. account the combed scores of matches when deciding what match to use as the
  7844. final match. Available values are:
  7845. @table @samp
  7846. @item none
  7847. No final matching based on combed scores.
  7848. @item sc
  7849. Combed scores are only used when a scene change is detected.
  7850. @item full
  7851. Use combed scores all the time.
  7852. @end table
  7853. Default is @var{sc}.
  7854. @item combdbg
  7855. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7856. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7857. Available values are:
  7858. @table @samp
  7859. @item none
  7860. No forced calculation.
  7861. @item pcn
  7862. Force p/c/n calculations.
  7863. @item pcnub
  7864. Force p/c/n/u/b calculations.
  7865. @end table
  7866. Default value is @var{none}.
  7867. @item cthresh
  7868. This is the area combing threshold used for combed frame detection. This
  7869. essentially controls how "strong" or "visible" combing must be to be detected.
  7870. Larger values mean combing must be more visible and smaller values mean combing
  7871. can be less visible or strong and still be detected. Valid settings are from
  7872. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7873. be detected as combed). This is basically a pixel difference value. A good
  7874. range is @code{[8, 12]}.
  7875. Default value is @code{9}.
  7876. @item chroma
  7877. Sets whether or not chroma is considered in the combed frame decision. Only
  7878. disable this if your source has chroma problems (rainbowing, etc.) that are
  7879. causing problems for the combed frame detection with chroma enabled. Actually,
  7880. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7881. where there is chroma only combing in the source.
  7882. Default value is @code{0}.
  7883. @item blockx
  7884. @item blocky
  7885. Respectively set the x-axis and y-axis size of the window used during combed
  7886. frame detection. This has to do with the size of the area in which
  7887. @option{combpel} pixels are required to be detected as combed for a frame to be
  7888. declared combed. See the @option{combpel} parameter description for more info.
  7889. Possible values are any number that is a power of 2 starting at 4 and going up
  7890. to 512.
  7891. Default value is @code{16}.
  7892. @item combpel
  7893. The number of combed pixels inside any of the @option{blocky} by
  7894. @option{blockx} size blocks on the frame for the frame to be detected as
  7895. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7896. setting controls "how much" combing there must be in any localized area (a
  7897. window defined by the @option{blockx} and @option{blocky} settings) on the
  7898. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7899. which point no frames will ever be detected as combed). This setting is known
  7900. as @option{MI} in TFM/VFM vocabulary.
  7901. Default value is @code{80}.
  7902. @end table
  7903. @anchor{p/c/n/u/b meaning}
  7904. @subsection p/c/n/u/b meaning
  7905. @subsubsection p/c/n
  7906. We assume the following telecined stream:
  7907. @example
  7908. Top fields: 1 2 2 3 4
  7909. Bottom fields: 1 2 3 4 4
  7910. @end example
  7911. The numbers correspond to the progressive frame the fields relate to. Here, the
  7912. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7913. When @code{fieldmatch} is configured to run a matching from bottom
  7914. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7915. @example
  7916. Input stream:
  7917. T 1 2 2 3 4
  7918. B 1 2 3 4 4 <-- matching reference
  7919. Matches: c c n n c
  7920. Output stream:
  7921. T 1 2 3 4 4
  7922. B 1 2 3 4 4
  7923. @end example
  7924. As a result of the field matching, we can see that some frames get duplicated.
  7925. To perform a complete inverse telecine, you need to rely on a decimation filter
  7926. after this operation. See for instance the @ref{decimate} filter.
  7927. The same operation now matching from top fields (@option{field}=@var{top})
  7928. looks like this:
  7929. @example
  7930. Input stream:
  7931. T 1 2 2 3 4 <-- matching reference
  7932. B 1 2 3 4 4
  7933. Matches: c c p p c
  7934. Output stream:
  7935. T 1 2 2 3 4
  7936. B 1 2 2 3 4
  7937. @end example
  7938. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7939. basically, they refer to the frame and field of the opposite parity:
  7940. @itemize
  7941. @item @var{p} matches the field of the opposite parity in the previous frame
  7942. @item @var{c} matches the field of the opposite parity in the current frame
  7943. @item @var{n} matches the field of the opposite parity in the next frame
  7944. @end itemize
  7945. @subsubsection u/b
  7946. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7947. from the opposite parity flag. In the following examples, we assume that we are
  7948. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7949. 'x' is placed above and below each matched fields.
  7950. With bottom matching (@option{field}=@var{bottom}):
  7951. @example
  7952. Match: c p n b u
  7953. x x x x x
  7954. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7955. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7956. x x x x x
  7957. Output frames:
  7958. 2 1 2 2 2
  7959. 2 2 2 1 3
  7960. @end example
  7961. With top matching (@option{field}=@var{top}):
  7962. @example
  7963. Match: c p n b u
  7964. x x x x x
  7965. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7966. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7967. x x x x x
  7968. Output frames:
  7969. 2 2 2 1 2
  7970. 2 1 3 2 2
  7971. @end example
  7972. @subsection Examples
  7973. Simple IVTC of a top field first telecined stream:
  7974. @example
  7975. fieldmatch=order=tff:combmatch=none, decimate
  7976. @end example
  7977. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7978. @example
  7979. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7980. @end example
  7981. @section fieldorder
  7982. Transform the field order of the input video.
  7983. It accepts the following parameters:
  7984. @table @option
  7985. @item order
  7986. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7987. for bottom field first.
  7988. @end table
  7989. The default value is @samp{tff}.
  7990. The transformation is done by shifting the picture content up or down
  7991. by one line, and filling the remaining line with appropriate picture content.
  7992. This method is consistent with most broadcast field order converters.
  7993. If the input video is not flagged as being interlaced, or it is already
  7994. flagged as being of the required output field order, then this filter does
  7995. not alter the incoming video.
  7996. It is very useful when converting to or from PAL DV material,
  7997. which is bottom field first.
  7998. For example:
  7999. @example
  8000. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  8001. @end example
  8002. @section fifo, afifo
  8003. Buffer input images and send them when they are requested.
  8004. It is mainly useful when auto-inserted by the libavfilter
  8005. framework.
  8006. It does not take parameters.
  8007. @section fillborders
  8008. Fill borders of the input video, without changing video stream dimensions.
  8009. Sometimes video can have garbage at the four edges and you may not want to
  8010. crop video input to keep size multiple of some number.
  8011. This filter accepts the following options:
  8012. @table @option
  8013. @item left
  8014. Number of pixels to fill from left border.
  8015. @item right
  8016. Number of pixels to fill from right border.
  8017. @item top
  8018. Number of pixels to fill from top border.
  8019. @item bottom
  8020. Number of pixels to fill from bottom border.
  8021. @item mode
  8022. Set fill mode.
  8023. It accepts the following values:
  8024. @table @samp
  8025. @item smear
  8026. fill pixels using outermost pixels
  8027. @item mirror
  8028. fill pixels using mirroring
  8029. @item fixed
  8030. fill pixels with constant value
  8031. @end table
  8032. Default is @var{smear}.
  8033. @item color
  8034. Set color for pixels in fixed mode. Default is @var{black}.
  8035. @end table
  8036. @section find_rect
  8037. Find a rectangular object
  8038. It accepts the following options:
  8039. @table @option
  8040. @item object
  8041. Filepath of the object image, needs to be in gray8.
  8042. @item threshold
  8043. Detection threshold, default is 0.5.
  8044. @item mipmaps
  8045. Number of mipmaps, default is 3.
  8046. @item xmin, ymin, xmax, ymax
  8047. Specifies the rectangle in which to search.
  8048. @end table
  8049. @subsection Examples
  8050. @itemize
  8051. @item
  8052. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8053. @example
  8054. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8055. @end example
  8056. @end itemize
  8057. @section floodfill
  8058. Flood area with values of same pixel components with another values.
  8059. It accepts the following options:
  8060. @table @option
  8061. @item x
  8062. Set pixel x coordinate.
  8063. @item y
  8064. Set pixel y coordinate.
  8065. @item s0
  8066. Set source #0 component value.
  8067. @item s1
  8068. Set source #1 component value.
  8069. @item s2
  8070. Set source #2 component value.
  8071. @item s3
  8072. Set source #3 component value.
  8073. @item d0
  8074. Set destination #0 component value.
  8075. @item d1
  8076. Set destination #1 component value.
  8077. @item d2
  8078. Set destination #2 component value.
  8079. @item d3
  8080. Set destination #3 component value.
  8081. @end table
  8082. @anchor{format}
  8083. @section format
  8084. Convert the input video to one of the specified pixel formats.
  8085. Libavfilter will try to pick one that is suitable as input to
  8086. the next filter.
  8087. It accepts the following parameters:
  8088. @table @option
  8089. @item pix_fmts
  8090. A '|'-separated list of pixel format names, such as
  8091. "pix_fmts=yuv420p|monow|rgb24".
  8092. @end table
  8093. @subsection Examples
  8094. @itemize
  8095. @item
  8096. Convert the input video to the @var{yuv420p} format
  8097. @example
  8098. format=pix_fmts=yuv420p
  8099. @end example
  8100. Convert the input video to any of the formats in the list
  8101. @example
  8102. format=pix_fmts=yuv420p|yuv444p|yuv410p
  8103. @end example
  8104. @end itemize
  8105. @anchor{fps}
  8106. @section fps
  8107. Convert the video to specified constant frame rate by duplicating or dropping
  8108. frames as necessary.
  8109. It accepts the following parameters:
  8110. @table @option
  8111. @item fps
  8112. The desired output frame rate. The default is @code{25}.
  8113. @item start_time
  8114. Assume the first PTS should be the given value, in seconds. This allows for
  8115. padding/trimming at the start of stream. By default, no assumption is made
  8116. about the first frame's expected PTS, so no padding or trimming is done.
  8117. For example, this could be set to 0 to pad the beginning with duplicates of
  8118. the first frame if a video stream starts after the audio stream or to trim any
  8119. frames with a negative PTS.
  8120. @item round
  8121. Timestamp (PTS) rounding method.
  8122. Possible values are:
  8123. @table @option
  8124. @item zero
  8125. round towards 0
  8126. @item inf
  8127. round away from 0
  8128. @item down
  8129. round towards -infinity
  8130. @item up
  8131. round towards +infinity
  8132. @item near
  8133. round to nearest
  8134. @end table
  8135. The default is @code{near}.
  8136. @item eof_action
  8137. Action performed when reading the last frame.
  8138. Possible values are:
  8139. @table @option
  8140. @item round
  8141. Use same timestamp rounding method as used for other frames.
  8142. @item pass
  8143. Pass through last frame if input duration has not been reached yet.
  8144. @end table
  8145. The default is @code{round}.
  8146. @end table
  8147. Alternatively, the options can be specified as a flat string:
  8148. @var{fps}[:@var{start_time}[:@var{round}]].
  8149. See also the @ref{setpts} filter.
  8150. @subsection Examples
  8151. @itemize
  8152. @item
  8153. A typical usage in order to set the fps to 25:
  8154. @example
  8155. fps=fps=25
  8156. @end example
  8157. @item
  8158. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  8159. @example
  8160. fps=fps=film:round=near
  8161. @end example
  8162. @end itemize
  8163. @section framepack
  8164. Pack two different video streams into a stereoscopic video, setting proper
  8165. metadata on supported codecs. The two views should have the same size and
  8166. framerate and processing will stop when the shorter video ends. Please note
  8167. that you may conveniently adjust view properties with the @ref{scale} and
  8168. @ref{fps} filters.
  8169. It accepts the following parameters:
  8170. @table @option
  8171. @item format
  8172. The desired packing format. Supported values are:
  8173. @table @option
  8174. @item sbs
  8175. The views are next to each other (default).
  8176. @item tab
  8177. The views are on top of each other.
  8178. @item lines
  8179. The views are packed by line.
  8180. @item columns
  8181. The views are packed by column.
  8182. @item frameseq
  8183. The views are temporally interleaved.
  8184. @end table
  8185. @end table
  8186. Some examples:
  8187. @example
  8188. # Convert left and right views into a frame-sequential video
  8189. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8190. # Convert views into a side-by-side video with the same output resolution as the input
  8191. 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
  8192. @end example
  8193. @section framerate
  8194. Change the frame rate by interpolating new video output frames from the source
  8195. frames.
  8196. This filter is not designed to function correctly with interlaced media. If
  8197. you wish to change the frame rate of interlaced media then you are required
  8198. to deinterlace before this filter and re-interlace after this filter.
  8199. A description of the accepted options follows.
  8200. @table @option
  8201. @item fps
  8202. Specify the output frames per second. This option can also be specified
  8203. as a value alone. The default is @code{50}.
  8204. @item interp_start
  8205. Specify the start of a range where the output frame will be created as a
  8206. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8207. the default is @code{15}.
  8208. @item interp_end
  8209. Specify the end of a range where the output frame will be created as a
  8210. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8211. the default is @code{240}.
  8212. @item scene
  8213. Specify the level at which a scene change is detected as a value between
  8214. 0 and 100 to indicate a new scene; a low value reflects a low
  8215. probability for the current frame to introduce a new scene, while a higher
  8216. value means the current frame is more likely to be one.
  8217. The default is @code{8.2}.
  8218. @item flags
  8219. Specify flags influencing the filter process.
  8220. Available value for @var{flags} is:
  8221. @table @option
  8222. @item scene_change_detect, scd
  8223. Enable scene change detection using the value of the option @var{scene}.
  8224. This flag is enabled by default.
  8225. @end table
  8226. @end table
  8227. @section framestep
  8228. Select one frame every N-th frame.
  8229. This filter accepts the following option:
  8230. @table @option
  8231. @item step
  8232. Select frame after every @code{step} frames.
  8233. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8234. @end table
  8235. @section freezedetect
  8236. Detect frozen video.
  8237. This filter logs a message and sets frame metadata when it detects that the
  8238. input video has no significant change in content during a specified duration.
  8239. Video freeze detection calculates the mean average absolute difference of all
  8240. the components of video frames and compares it to a noise floor.
  8241. The printed times and duration are expressed in seconds. The
  8242. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8243. whose timestamp equals or exceeds the detection duration and it contains the
  8244. timestamp of the first frame of the freeze. The
  8245. @code{lavfi.freezedetect.freeze_duration} and
  8246. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8247. after the freeze.
  8248. The filter accepts the following options:
  8249. @table @option
  8250. @item noise, n
  8251. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8252. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8253. 0.001.
  8254. @item duration, d
  8255. Set freeze duration until notification (default is 2 seconds).
  8256. @end table
  8257. @anchor{frei0r}
  8258. @section frei0r
  8259. Apply a frei0r effect to the input video.
  8260. To enable the compilation of this filter, you need to install the frei0r
  8261. header and configure FFmpeg with @code{--enable-frei0r}.
  8262. It accepts the following parameters:
  8263. @table @option
  8264. @item filter_name
  8265. The name of the frei0r effect to load. If the environment variable
  8266. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8267. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8268. Otherwise, the standard frei0r paths are searched, in this order:
  8269. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8270. @file{/usr/lib/frei0r-1/}.
  8271. @item filter_params
  8272. A '|'-separated list of parameters to pass to the frei0r effect.
  8273. @end table
  8274. A frei0r effect parameter can be a boolean (its value is either
  8275. "y" or "n"), a double, a color (specified as
  8276. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8277. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8278. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8279. a position (specified as @var{X}/@var{Y}, where
  8280. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8281. The number and types of parameters depend on the loaded effect. If an
  8282. effect parameter is not specified, the default value is set.
  8283. @subsection Examples
  8284. @itemize
  8285. @item
  8286. Apply the distort0r effect, setting the first two double parameters:
  8287. @example
  8288. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8289. @end example
  8290. @item
  8291. Apply the colordistance effect, taking a color as the first parameter:
  8292. @example
  8293. frei0r=colordistance:0.2/0.3/0.4
  8294. frei0r=colordistance:violet
  8295. frei0r=colordistance:0x112233
  8296. @end example
  8297. @item
  8298. Apply the perspective effect, specifying the top left and top right image
  8299. positions:
  8300. @example
  8301. frei0r=perspective:0.2/0.2|0.8/0.2
  8302. @end example
  8303. @end itemize
  8304. For more information, see
  8305. @url{http://frei0r.dyne.org}
  8306. @section fspp
  8307. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8308. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8309. processing filter, one of them is performed once per block, not per pixel.
  8310. This allows for much higher speed.
  8311. The filter accepts the following options:
  8312. @table @option
  8313. @item quality
  8314. Set quality. This option defines the number of levels for averaging. It accepts
  8315. an integer in the range 4-5. Default value is @code{4}.
  8316. @item qp
  8317. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8318. If not set, the filter will use the QP from the video stream (if available).
  8319. @item strength
  8320. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8321. more details but also more artifacts, while higher values make the image smoother
  8322. but also blurrier. Default value is @code{0} − PSNR optimal.
  8323. @item use_bframe_qp
  8324. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8325. option may cause flicker since the B-Frames have often larger QP. Default is
  8326. @code{0} (not enabled).
  8327. @end table
  8328. @section gblur
  8329. Apply Gaussian blur filter.
  8330. The filter accepts the following options:
  8331. @table @option
  8332. @item sigma
  8333. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8334. @item steps
  8335. Set number of steps for Gaussian approximation. Default is @code{1}.
  8336. @item planes
  8337. Set which planes to filter. By default all planes are filtered.
  8338. @item sigmaV
  8339. Set vertical sigma, if negative it will be same as @code{sigma}.
  8340. Default is @code{-1}.
  8341. @end table
  8342. @subsection Commands
  8343. This filter supports same commands as options.
  8344. The command accepts the same syntax of the corresponding option.
  8345. If the specified expression is not valid, it is kept at its current
  8346. value.
  8347. @section geq
  8348. Apply generic equation to each pixel.
  8349. The filter accepts the following options:
  8350. @table @option
  8351. @item lum_expr, lum
  8352. Set the luminance expression.
  8353. @item cb_expr, cb
  8354. Set the chrominance blue expression.
  8355. @item cr_expr, cr
  8356. Set the chrominance red expression.
  8357. @item alpha_expr, a
  8358. Set the alpha expression.
  8359. @item red_expr, r
  8360. Set the red expression.
  8361. @item green_expr, g
  8362. Set the green expression.
  8363. @item blue_expr, b
  8364. Set the blue expression.
  8365. @end table
  8366. The colorspace is selected according to the specified options. If one
  8367. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8368. options is specified, the filter will automatically select a YCbCr
  8369. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8370. @option{blue_expr} options is specified, it will select an RGB
  8371. colorspace.
  8372. If one of the chrominance expression is not defined, it falls back on the other
  8373. one. If no alpha expression is specified it will evaluate to opaque value.
  8374. If none of chrominance expressions are specified, they will evaluate
  8375. to the luminance expression.
  8376. The expressions can use the following variables and functions:
  8377. @table @option
  8378. @item N
  8379. The sequential number of the filtered frame, starting from @code{0}.
  8380. @item X
  8381. @item Y
  8382. The coordinates of the current sample.
  8383. @item W
  8384. @item H
  8385. The width and height of the image.
  8386. @item SW
  8387. @item SH
  8388. Width and height scale depending on the currently filtered plane. It is the
  8389. ratio between the corresponding luma plane number of pixels and the current
  8390. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8391. @code{0.5,0.5} for chroma planes.
  8392. @item T
  8393. Time of the current frame, expressed in seconds.
  8394. @item p(x, y)
  8395. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8396. plane.
  8397. @item lum(x, y)
  8398. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8399. plane.
  8400. @item cb(x, y)
  8401. Return the value of the pixel at location (@var{x},@var{y}) of the
  8402. blue-difference chroma plane. Return 0 if there is no such plane.
  8403. @item cr(x, y)
  8404. Return the value of the pixel at location (@var{x},@var{y}) of the
  8405. red-difference chroma plane. Return 0 if there is no such plane.
  8406. @item r(x, y)
  8407. @item g(x, y)
  8408. @item b(x, y)
  8409. Return the value of the pixel at location (@var{x},@var{y}) of the
  8410. red/green/blue component. Return 0 if there is no such component.
  8411. @item alpha(x, y)
  8412. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8413. plane. Return 0 if there is no such plane.
  8414. @end table
  8415. For functions, if @var{x} and @var{y} are outside the area, the value will be
  8416. automatically clipped to the closer edge.
  8417. @subsection Examples
  8418. @itemize
  8419. @item
  8420. Flip the image horizontally:
  8421. @example
  8422. geq=p(W-X\,Y)
  8423. @end example
  8424. @item
  8425. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  8426. wavelength of 100 pixels:
  8427. @example
  8428. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  8429. @end example
  8430. @item
  8431. Generate a fancy enigmatic moving light:
  8432. @example
  8433. 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
  8434. @end example
  8435. @item
  8436. Generate a quick emboss effect:
  8437. @example
  8438. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  8439. @end example
  8440. @item
  8441. Modify RGB components depending on pixel position:
  8442. @example
  8443. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  8444. @end example
  8445. @item
  8446. Create a radial gradient that is the same size as the input (also see
  8447. the @ref{vignette} filter):
  8448. @example
  8449. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8450. @end example
  8451. @end itemize
  8452. @section gradfun
  8453. Fix the banding artifacts that are sometimes introduced into nearly flat
  8454. regions by truncation to 8-bit color depth.
  8455. Interpolate the gradients that should go where the bands are, and
  8456. dither them.
  8457. It is designed for playback only. Do not use it prior to
  8458. lossy compression, because compression tends to lose the dither and
  8459. bring back the bands.
  8460. It accepts the following parameters:
  8461. @table @option
  8462. @item strength
  8463. The maximum amount by which the filter will change any one pixel. This is also
  8464. the threshold for detecting nearly flat regions. Acceptable values range from
  8465. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8466. valid range.
  8467. @item radius
  8468. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8469. gradients, but also prevents the filter from modifying the pixels near detailed
  8470. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8471. values will be clipped to the valid range.
  8472. @end table
  8473. Alternatively, the options can be specified as a flat string:
  8474. @var{strength}[:@var{radius}]
  8475. @subsection Examples
  8476. @itemize
  8477. @item
  8478. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8479. @example
  8480. gradfun=3.5:8
  8481. @end example
  8482. @item
  8483. Specify radius, omitting the strength (which will fall-back to the default
  8484. value):
  8485. @example
  8486. gradfun=radius=8
  8487. @end example
  8488. @end itemize
  8489. @section graphmonitor, agraphmonitor
  8490. Show various filtergraph stats.
  8491. With this filter one can debug complete filtergraph.
  8492. Especially issues with links filling with queued frames.
  8493. The filter accepts the following options:
  8494. @table @option
  8495. @item size, s
  8496. Set video output size. Default is @var{hd720}.
  8497. @item opacity, o
  8498. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8499. @item mode, m
  8500. Set output mode, can be @var{fulll} or @var{compact}.
  8501. In @var{compact} mode only filters with some queued frames have displayed stats.
  8502. @item flags, f
  8503. Set flags which enable which stats are shown in video.
  8504. Available values for flags are:
  8505. @table @samp
  8506. @item queue
  8507. Display number of queued frames in each link.
  8508. @item frame_count_in
  8509. Display number of frames taken from filter.
  8510. @item frame_count_out
  8511. Display number of frames given out from filter.
  8512. @item pts
  8513. Display current filtered frame pts.
  8514. @item time
  8515. Display current filtered frame time.
  8516. @item timebase
  8517. Display time base for filter link.
  8518. @item format
  8519. Display used format for filter link.
  8520. @item size
  8521. Display video size or number of audio channels in case of audio used by filter link.
  8522. @item rate
  8523. Display video frame rate or sample rate in case of audio used by filter link.
  8524. @end table
  8525. @item rate, r
  8526. Set upper limit for video rate of output stream, Default value is @var{25}.
  8527. This guarantee that output video frame rate will not be higher than this value.
  8528. @end table
  8529. @section greyedge
  8530. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8531. and corrects the scene colors accordingly.
  8532. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8533. The filter accepts the following options:
  8534. @table @option
  8535. @item difford
  8536. The order of differentiation to be applied on the scene. Must be chosen in the range
  8537. [0,2] and default value is 1.
  8538. @item minknorm
  8539. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8540. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8541. max value instead of calculating Minkowski distance.
  8542. @item sigma
  8543. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8544. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8545. can't be equal to 0 if @var{difford} is greater than 0.
  8546. @end table
  8547. @subsection Examples
  8548. @itemize
  8549. @item
  8550. Grey Edge:
  8551. @example
  8552. greyedge=difford=1:minknorm=5:sigma=2
  8553. @end example
  8554. @item
  8555. Max Edge:
  8556. @example
  8557. greyedge=difford=1:minknorm=0:sigma=2
  8558. @end example
  8559. @end itemize
  8560. @anchor{haldclut}
  8561. @section haldclut
  8562. Apply a Hald CLUT to a video stream.
  8563. First input is the video stream to process, and second one is the Hald CLUT.
  8564. The Hald CLUT input can be a simple picture or a complete video stream.
  8565. The filter accepts the following options:
  8566. @table @option
  8567. @item shortest
  8568. Force termination when the shortest input terminates. Default is @code{0}.
  8569. @item repeatlast
  8570. Continue applying the last CLUT after the end of the stream. A value of
  8571. @code{0} disable the filter after the last frame of the CLUT is reached.
  8572. Default is @code{1}.
  8573. @end table
  8574. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8575. filters share the same internals).
  8576. This filter also supports the @ref{framesync} options.
  8577. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8578. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8579. @subsection Workflow examples
  8580. @subsubsection Hald CLUT video stream
  8581. Generate an identity Hald CLUT stream altered with various effects:
  8582. @example
  8583. 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
  8584. @end example
  8585. Note: make sure you use a lossless codec.
  8586. Then use it with @code{haldclut} to apply it on some random stream:
  8587. @example
  8588. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8589. @end example
  8590. The Hald CLUT will be applied to the 10 first seconds (duration of
  8591. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8592. to the remaining frames of the @code{mandelbrot} stream.
  8593. @subsubsection Hald CLUT with preview
  8594. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8595. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8596. biggest possible square starting at the top left of the picture. The remaining
  8597. padding pixels (bottom or right) will be ignored. This area can be used to add
  8598. a preview of the Hald CLUT.
  8599. Typically, the following generated Hald CLUT will be supported by the
  8600. @code{haldclut} filter:
  8601. @example
  8602. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8603. pad=iw+320 [padded_clut];
  8604. smptebars=s=320x256, split [a][b];
  8605. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8606. [main][b] overlay=W-320" -frames:v 1 clut.png
  8607. @end example
  8608. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8609. bars are displayed on the right-top, and below the same color bars processed by
  8610. the color changes.
  8611. Then, the effect of this Hald CLUT can be visualized with:
  8612. @example
  8613. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8614. @end example
  8615. @section hflip
  8616. Flip the input video horizontally.
  8617. For example, to horizontally flip the input video with @command{ffmpeg}:
  8618. @example
  8619. ffmpeg -i in.avi -vf "hflip" out.avi
  8620. @end example
  8621. @section histeq
  8622. This filter applies a global color histogram equalization on a
  8623. per-frame basis.
  8624. It can be used to correct video that has a compressed range of pixel
  8625. intensities. The filter redistributes the pixel intensities to
  8626. equalize their distribution across the intensity range. It may be
  8627. viewed as an "automatically adjusting contrast filter". This filter is
  8628. useful only for correcting degraded or poorly captured source
  8629. video.
  8630. The filter accepts the following options:
  8631. @table @option
  8632. @item strength
  8633. Determine the amount of equalization to be applied. As the strength
  8634. is reduced, the distribution of pixel intensities more-and-more
  8635. approaches that of the input frame. The value must be a float number
  8636. in the range [0,1] and defaults to 0.200.
  8637. @item intensity
  8638. Set the maximum intensity that can generated and scale the output
  8639. values appropriately. The strength should be set as desired and then
  8640. the intensity can be limited if needed to avoid washing-out. The value
  8641. must be a float number in the range [0,1] and defaults to 0.210.
  8642. @item antibanding
  8643. Set the antibanding level. If enabled the filter will randomly vary
  8644. the luminance of output pixels by a small amount to avoid banding of
  8645. the histogram. Possible values are @code{none}, @code{weak} or
  8646. @code{strong}. It defaults to @code{none}.
  8647. @end table
  8648. @section histogram
  8649. Compute and draw a color distribution histogram for the input video.
  8650. The computed histogram is a representation of the color component
  8651. distribution in an image.
  8652. Standard histogram displays the color components distribution in an image.
  8653. Displays color graph for each color component. Shows distribution of
  8654. the Y, U, V, A or R, G, B components, depending on input format, in the
  8655. current frame. Below each graph a color component scale meter is shown.
  8656. The filter accepts the following options:
  8657. @table @option
  8658. @item level_height
  8659. Set height of level. Default value is @code{200}.
  8660. Allowed range is [50, 2048].
  8661. @item scale_height
  8662. Set height of color scale. Default value is @code{12}.
  8663. Allowed range is [0, 40].
  8664. @item display_mode
  8665. Set display mode.
  8666. It accepts the following values:
  8667. @table @samp
  8668. @item stack
  8669. Per color component graphs are placed below each other.
  8670. @item parade
  8671. Per color component graphs are placed side by side.
  8672. @item overlay
  8673. Presents information identical to that in the @code{parade}, except
  8674. that the graphs representing color components are superimposed directly
  8675. over one another.
  8676. @end table
  8677. Default is @code{stack}.
  8678. @item levels_mode
  8679. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8680. Default is @code{linear}.
  8681. @item components
  8682. Set what color components to display.
  8683. Default is @code{7}.
  8684. @item fgopacity
  8685. Set foreground opacity. Default is @code{0.7}.
  8686. @item bgopacity
  8687. Set background opacity. Default is @code{0.5}.
  8688. @end table
  8689. @subsection Examples
  8690. @itemize
  8691. @item
  8692. Calculate and draw histogram:
  8693. @example
  8694. ffplay -i input -vf histogram
  8695. @end example
  8696. @end itemize
  8697. @anchor{hqdn3d}
  8698. @section hqdn3d
  8699. This is a high precision/quality 3d denoise filter. It aims to reduce
  8700. image noise, producing smooth images and making still images really
  8701. still. It should enhance compressibility.
  8702. It accepts the following optional parameters:
  8703. @table @option
  8704. @item luma_spatial
  8705. A non-negative floating point number which specifies spatial luma strength.
  8706. It defaults to 4.0.
  8707. @item chroma_spatial
  8708. A non-negative floating point number which specifies spatial chroma strength.
  8709. It defaults to 3.0*@var{luma_spatial}/4.0.
  8710. @item luma_tmp
  8711. A floating point number which specifies luma temporal strength. It defaults to
  8712. 6.0*@var{luma_spatial}/4.0.
  8713. @item chroma_tmp
  8714. A floating point number which specifies chroma temporal strength. It defaults to
  8715. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8716. @end table
  8717. @anchor{hwdownload}
  8718. @section hwdownload
  8719. Download hardware frames to system memory.
  8720. The input must be in hardware frames, and the output a non-hardware format.
  8721. Not all formats will be supported on the output - it may be necessary to insert
  8722. an additional @option{format} filter immediately following in the graph to get
  8723. the output in a supported format.
  8724. @section hwmap
  8725. Map hardware frames to system memory or to another device.
  8726. This filter has several different modes of operation; which one is used depends
  8727. on the input and output formats:
  8728. @itemize
  8729. @item
  8730. Hardware frame input, normal frame output
  8731. Map the input frames to system memory and pass them to the output. If the
  8732. original hardware frame is later required (for example, after overlaying
  8733. something else on part of it), the @option{hwmap} filter can be used again
  8734. in the next mode to retrieve it.
  8735. @item
  8736. Normal frame input, hardware frame output
  8737. If the input is actually a software-mapped hardware frame, then unmap it -
  8738. that is, return the original hardware frame.
  8739. Otherwise, a device must be provided. Create new hardware surfaces on that
  8740. device for the output, then map them back to the software format at the input
  8741. and give those frames to the preceding filter. This will then act like the
  8742. @option{hwupload} filter, but may be able to avoid an additional copy when
  8743. the input is already in a compatible format.
  8744. @item
  8745. Hardware frame input and output
  8746. A device must be supplied for the output, either directly or with the
  8747. @option{derive_device} option. The input and output devices must be of
  8748. different types and compatible - the exact meaning of this is
  8749. system-dependent, but typically it means that they must refer to the same
  8750. underlying hardware context (for example, refer to the same graphics card).
  8751. If the input frames were originally created on the output device, then unmap
  8752. to retrieve the original frames.
  8753. Otherwise, map the frames to the output device - create new hardware frames
  8754. on the output corresponding to the frames on the input.
  8755. @end itemize
  8756. The following additional parameters are accepted:
  8757. @table @option
  8758. @item mode
  8759. Set the frame mapping mode. Some combination of:
  8760. @table @var
  8761. @item read
  8762. The mapped frame should be readable.
  8763. @item write
  8764. The mapped frame should be writeable.
  8765. @item overwrite
  8766. The mapping will always overwrite the entire frame.
  8767. This may improve performance in some cases, as the original contents of the
  8768. frame need not be loaded.
  8769. @item direct
  8770. The mapping must not involve any copying.
  8771. Indirect mappings to copies of frames are created in some cases where either
  8772. direct mapping is not possible or it would have unexpected properties.
  8773. Setting this flag ensures that the mapping is direct and will fail if that is
  8774. not possible.
  8775. @end table
  8776. Defaults to @var{read+write} if not specified.
  8777. @item derive_device @var{type}
  8778. Rather than using the device supplied at initialisation, instead derive a new
  8779. device of type @var{type} from the device the input frames exist on.
  8780. @item reverse
  8781. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8782. and map them back to the source. This may be necessary in some cases where
  8783. a mapping in one direction is required but only the opposite direction is
  8784. supported by the devices being used.
  8785. This option is dangerous - it may break the preceding filter in undefined
  8786. ways if there are any additional constraints on that filter's output.
  8787. Do not use it without fully understanding the implications of its use.
  8788. @end table
  8789. @anchor{hwupload}
  8790. @section hwupload
  8791. Upload system memory frames to hardware surfaces.
  8792. The device to upload to must be supplied when the filter is initialised. If
  8793. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8794. option.
  8795. @anchor{hwupload_cuda}
  8796. @section hwupload_cuda
  8797. Upload system memory frames to a CUDA device.
  8798. It accepts the following optional parameters:
  8799. @table @option
  8800. @item device
  8801. The number of the CUDA device to use
  8802. @end table
  8803. @section hqx
  8804. Apply a high-quality magnification filter designed for pixel art. This filter
  8805. was originally created by Maxim Stepin.
  8806. It accepts the following option:
  8807. @table @option
  8808. @item n
  8809. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8810. @code{hq3x} and @code{4} for @code{hq4x}.
  8811. Default is @code{3}.
  8812. @end table
  8813. @section hstack
  8814. Stack input videos horizontally.
  8815. All streams must be of same pixel format and of same height.
  8816. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8817. to create same output.
  8818. The filter accepts the following option:
  8819. @table @option
  8820. @item inputs
  8821. Set number of input streams. Default is 2.
  8822. @item shortest
  8823. If set to 1, force the output to terminate when the shortest input
  8824. terminates. Default value is 0.
  8825. @end table
  8826. @section hue
  8827. Modify the hue and/or the saturation of the input.
  8828. It accepts the following parameters:
  8829. @table @option
  8830. @item h
  8831. Specify the hue angle as a number of degrees. It accepts an expression,
  8832. and defaults to "0".
  8833. @item s
  8834. Specify the saturation in the [-10,10] range. It accepts an expression and
  8835. defaults to "1".
  8836. @item H
  8837. Specify the hue angle as a number of radians. It accepts an
  8838. expression, and defaults to "0".
  8839. @item b
  8840. Specify the brightness in the [-10,10] range. It accepts an expression and
  8841. defaults to "0".
  8842. @end table
  8843. @option{h} and @option{H} are mutually exclusive, and can't be
  8844. specified at the same time.
  8845. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8846. expressions containing the following constants:
  8847. @table @option
  8848. @item n
  8849. frame count of the input frame starting from 0
  8850. @item pts
  8851. presentation timestamp of the input frame expressed in time base units
  8852. @item r
  8853. frame rate of the input video, NAN if the input frame rate is unknown
  8854. @item t
  8855. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8856. @item tb
  8857. time base of the input video
  8858. @end table
  8859. @subsection Examples
  8860. @itemize
  8861. @item
  8862. Set the hue to 90 degrees and the saturation to 1.0:
  8863. @example
  8864. hue=h=90:s=1
  8865. @end example
  8866. @item
  8867. Same command but expressing the hue in radians:
  8868. @example
  8869. hue=H=PI/2:s=1
  8870. @end example
  8871. @item
  8872. Rotate hue and make the saturation swing between 0
  8873. and 2 over a period of 1 second:
  8874. @example
  8875. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8876. @end example
  8877. @item
  8878. Apply a 3 seconds saturation fade-in effect starting at 0:
  8879. @example
  8880. hue="s=min(t/3\,1)"
  8881. @end example
  8882. The general fade-in expression can be written as:
  8883. @example
  8884. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8885. @end example
  8886. @item
  8887. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8888. @example
  8889. hue="s=max(0\, min(1\, (8-t)/3))"
  8890. @end example
  8891. The general fade-out expression can be written as:
  8892. @example
  8893. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8894. @end example
  8895. @end itemize
  8896. @subsection Commands
  8897. This filter supports the following commands:
  8898. @table @option
  8899. @item b
  8900. @item s
  8901. @item h
  8902. @item H
  8903. Modify the hue and/or the saturation and/or brightness of the input video.
  8904. The command accepts the same syntax of the corresponding option.
  8905. If the specified expression is not valid, it is kept at its current
  8906. value.
  8907. @end table
  8908. @section hysteresis
  8909. Grow first stream into second stream by connecting components.
  8910. This makes it possible to build more robust edge masks.
  8911. This filter accepts the following options:
  8912. @table @option
  8913. @item planes
  8914. Set which planes will be processed as bitmap, unprocessed planes will be
  8915. copied from first stream.
  8916. By default value 0xf, all planes will be processed.
  8917. @item threshold
  8918. Set threshold which is used in filtering. If pixel component value is higher than
  8919. this value filter algorithm for connecting components is activated.
  8920. By default value is 0.
  8921. @end table
  8922. @section idet
  8923. Detect video interlacing type.
  8924. This filter tries to detect if the input frames are interlaced, progressive,
  8925. top or bottom field first. It will also try to detect fields that are
  8926. repeated between adjacent frames (a sign of telecine).
  8927. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8928. Multiple frame detection incorporates the classification history of previous frames.
  8929. The filter will log these metadata values:
  8930. @table @option
  8931. @item single.current_frame
  8932. Detected type of current frame using single-frame detection. One of:
  8933. ``tff'' (top field first), ``bff'' (bottom field first),
  8934. ``progressive'', or ``undetermined''
  8935. @item single.tff
  8936. Cumulative number of frames detected as top field first using single-frame detection.
  8937. @item multiple.tff
  8938. Cumulative number of frames detected as top field first using multiple-frame detection.
  8939. @item single.bff
  8940. Cumulative number of frames detected as bottom field first using single-frame detection.
  8941. @item multiple.current_frame
  8942. Detected type of current frame using multiple-frame detection. One of:
  8943. ``tff'' (top field first), ``bff'' (bottom field first),
  8944. ``progressive'', or ``undetermined''
  8945. @item multiple.bff
  8946. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8947. @item single.progressive
  8948. Cumulative number of frames detected as progressive using single-frame detection.
  8949. @item multiple.progressive
  8950. Cumulative number of frames detected as progressive using multiple-frame detection.
  8951. @item single.undetermined
  8952. Cumulative number of frames that could not be classified using single-frame detection.
  8953. @item multiple.undetermined
  8954. Cumulative number of frames that could not be classified using multiple-frame detection.
  8955. @item repeated.current_frame
  8956. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8957. @item repeated.neither
  8958. Cumulative number of frames with no repeated field.
  8959. @item repeated.top
  8960. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8961. @item repeated.bottom
  8962. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8963. @end table
  8964. The filter accepts the following options:
  8965. @table @option
  8966. @item intl_thres
  8967. Set interlacing threshold.
  8968. @item prog_thres
  8969. Set progressive threshold.
  8970. @item rep_thres
  8971. Threshold for repeated field detection.
  8972. @item half_life
  8973. Number of frames after which a given frame's contribution to the
  8974. statistics is halved (i.e., it contributes only 0.5 to its
  8975. classification). The default of 0 means that all frames seen are given
  8976. full weight of 1.0 forever.
  8977. @item analyze_interlaced_flag
  8978. When this is not 0 then idet will use the specified number of frames to determine
  8979. if the interlaced flag is accurate, it will not count undetermined frames.
  8980. If the flag is found to be accurate it will be used without any further
  8981. computations, if it is found to be inaccurate it will be cleared without any
  8982. further computations. This allows inserting the idet filter as a low computational
  8983. method to clean up the interlaced flag
  8984. @end table
  8985. @section il
  8986. Deinterleave or interleave fields.
  8987. This filter allows one to process interlaced images fields without
  8988. deinterlacing them. Deinterleaving splits the input frame into 2
  8989. fields (so called half pictures). Odd lines are moved to the top
  8990. half of the output image, even lines to the bottom half.
  8991. You can process (filter) them independently and then re-interleave them.
  8992. The filter accepts the following options:
  8993. @table @option
  8994. @item luma_mode, l
  8995. @item chroma_mode, c
  8996. @item alpha_mode, a
  8997. Available values for @var{luma_mode}, @var{chroma_mode} and
  8998. @var{alpha_mode} are:
  8999. @table @samp
  9000. @item none
  9001. Do nothing.
  9002. @item deinterleave, d
  9003. Deinterleave fields, placing one above the other.
  9004. @item interleave, i
  9005. Interleave fields. Reverse the effect of deinterleaving.
  9006. @end table
  9007. Default value is @code{none}.
  9008. @item luma_swap, ls
  9009. @item chroma_swap, cs
  9010. @item alpha_swap, as
  9011. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  9012. @end table
  9013. @section inflate
  9014. Apply inflate effect to the video.
  9015. This filter replaces the pixel by the local(3x3) average by taking into account
  9016. only values higher than the pixel.
  9017. It accepts the following options:
  9018. @table @option
  9019. @item threshold0
  9020. @item threshold1
  9021. @item threshold2
  9022. @item threshold3
  9023. Limit the maximum change for each plane, default is 65535.
  9024. If 0, plane will remain unchanged.
  9025. @end table
  9026. @section interlace
  9027. Simple interlacing filter from progressive contents. This interleaves upper (or
  9028. lower) lines from odd frames with lower (or upper) lines from even frames,
  9029. halving the frame rate and preserving image height.
  9030. @example
  9031. Original Original New Frame
  9032. Frame 'j' Frame 'j+1' (tff)
  9033. ========== =========== ==================
  9034. Line 0 --------------------> Frame 'j' Line 0
  9035. Line 1 Line 1 ----> Frame 'j+1' Line 1
  9036. Line 2 ---------------------> Frame 'j' Line 2
  9037. Line 3 Line 3 ----> Frame 'j+1' Line 3
  9038. ... ... ...
  9039. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  9040. @end example
  9041. It accepts the following optional parameters:
  9042. @table @option
  9043. @item scan
  9044. This determines whether the interlaced frame is taken from the even
  9045. (tff - default) or odd (bff) lines of the progressive frame.
  9046. @item lowpass
  9047. Vertical lowpass filter to avoid twitter interlacing and
  9048. reduce moire patterns.
  9049. @table @samp
  9050. @item 0, off
  9051. Disable vertical lowpass filter
  9052. @item 1, linear
  9053. Enable linear filter (default)
  9054. @item 2, complex
  9055. Enable complex filter. This will slightly less reduce twitter and moire
  9056. but better retain detail and subjective sharpness impression.
  9057. @end table
  9058. @end table
  9059. @section kerndeint
  9060. Deinterlace input video by applying Donald Graft's adaptive kernel
  9061. deinterling. Work on interlaced parts of a video to produce
  9062. progressive frames.
  9063. The description of the accepted parameters follows.
  9064. @table @option
  9065. @item thresh
  9066. Set the threshold which affects the filter's tolerance when
  9067. determining if a pixel line must be processed. It must be an integer
  9068. in the range [0,255] and defaults to 10. A value of 0 will result in
  9069. applying the process on every pixels.
  9070. @item map
  9071. Paint pixels exceeding the threshold value to white if set to 1.
  9072. Default is 0.
  9073. @item order
  9074. Set the fields order. Swap fields if set to 1, leave fields alone if
  9075. 0. Default is 0.
  9076. @item sharp
  9077. Enable additional sharpening if set to 1. Default is 0.
  9078. @item twoway
  9079. Enable twoway sharpening if set to 1. Default is 0.
  9080. @end table
  9081. @subsection Examples
  9082. @itemize
  9083. @item
  9084. Apply default values:
  9085. @example
  9086. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  9087. @end example
  9088. @item
  9089. Enable additional sharpening:
  9090. @example
  9091. kerndeint=sharp=1
  9092. @end example
  9093. @item
  9094. Paint processed pixels in white:
  9095. @example
  9096. kerndeint=map=1
  9097. @end example
  9098. @end itemize
  9099. @section lagfun
  9100. Slowly update darker pixels.
  9101. This filter makes short flashes of light appear longer.
  9102. This filter accepts the following options:
  9103. @table @option
  9104. @item decay
  9105. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  9106. @item planes
  9107. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  9108. @end table
  9109. @section lenscorrection
  9110. Correct radial lens distortion
  9111. This filter can be used to correct for radial distortion as can result from the use
  9112. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  9113. one can use tools available for example as part of opencv or simply trial-and-error.
  9114. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  9115. and extract the k1 and k2 coefficients from the resulting matrix.
  9116. Note that effectively the same filter is available in the open-source tools Krita and
  9117. Digikam from the KDE project.
  9118. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  9119. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  9120. brightness distribution, so you may want to use both filters together in certain
  9121. cases, though you will have to take care of ordering, i.e. whether vignetting should
  9122. be applied before or after lens correction.
  9123. @subsection Options
  9124. The filter accepts the following options:
  9125. @table @option
  9126. @item cx
  9127. Relative x-coordinate of the focal point of the image, and thereby the center of the
  9128. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9129. width. Default is 0.5.
  9130. @item cy
  9131. Relative y-coordinate of the focal point of the image, and thereby the center of the
  9132. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9133. height. Default is 0.5.
  9134. @item k1
  9135. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  9136. no correction. Default is 0.
  9137. @item k2
  9138. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  9139. 0 means no correction. Default is 0.
  9140. @end table
  9141. The formula that generates the correction is:
  9142. @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)
  9143. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  9144. distances from the focal point in the source and target images, respectively.
  9145. @section lensfun
  9146. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  9147. The @code{lensfun} filter requires the camera make, camera model, and lens model
  9148. to apply the lens correction. The filter will load the lensfun database and
  9149. query it to find the corresponding camera and lens entries in the database. As
  9150. long as these entries can be found with the given options, the filter can
  9151. perform corrections on frames. Note that incomplete strings will result in the
  9152. filter choosing the best match with the given options, and the filter will
  9153. output the chosen camera and lens models (logged with level "info"). You must
  9154. provide the make, camera model, and lens model as they are required.
  9155. The filter accepts the following options:
  9156. @table @option
  9157. @item make
  9158. The make of the camera (for example, "Canon"). This option is required.
  9159. @item model
  9160. The model of the camera (for example, "Canon EOS 100D"). This option is
  9161. required.
  9162. @item lens_model
  9163. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  9164. option is required.
  9165. @item mode
  9166. The type of correction to apply. The following values are valid options:
  9167. @table @samp
  9168. @item vignetting
  9169. Enables fixing lens vignetting.
  9170. @item geometry
  9171. Enables fixing lens geometry. This is the default.
  9172. @item subpixel
  9173. Enables fixing chromatic aberrations.
  9174. @item vig_geo
  9175. Enables fixing lens vignetting and lens geometry.
  9176. @item vig_subpixel
  9177. Enables fixing lens vignetting and chromatic aberrations.
  9178. @item distortion
  9179. Enables fixing both lens geometry and chromatic aberrations.
  9180. @item all
  9181. Enables all possible corrections.
  9182. @end table
  9183. @item focal_length
  9184. The focal length of the image/video (zoom; expected constant for video). For
  9185. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  9186. range should be chosen when using that lens. Default 18.
  9187. @item aperture
  9188. The aperture of the image/video (expected constant for video). Note that
  9189. aperture is only used for vignetting correction. Default 3.5.
  9190. @item focus_distance
  9191. The focus distance of the image/video (expected constant for video). Note that
  9192. focus distance is only used for vignetting and only slightly affects the
  9193. vignetting correction process. If unknown, leave it at the default value (which
  9194. is 1000).
  9195. @item scale
  9196. The scale factor which is applied after transformation. After correction the
  9197. video is no longer necessarily rectangular. This parameter controls how much of
  9198. the resulting image is visible. The value 0 means that a value will be chosen
  9199. automatically such that there is little or no unmapped area in the output
  9200. image. 1.0 means that no additional scaling is done. Lower values may result
  9201. in more of the corrected image being visible, while higher values may avoid
  9202. unmapped areas in the output.
  9203. @item target_geometry
  9204. The target geometry of the output image/video. The following values are valid
  9205. options:
  9206. @table @samp
  9207. @item rectilinear (default)
  9208. @item fisheye
  9209. @item panoramic
  9210. @item equirectangular
  9211. @item fisheye_orthographic
  9212. @item fisheye_stereographic
  9213. @item fisheye_equisolid
  9214. @item fisheye_thoby
  9215. @end table
  9216. @item reverse
  9217. Apply the reverse of image correction (instead of correcting distortion, apply
  9218. it).
  9219. @item interpolation
  9220. The type of interpolation used when correcting distortion. The following values
  9221. are valid options:
  9222. @table @samp
  9223. @item nearest
  9224. @item linear (default)
  9225. @item lanczos
  9226. @end table
  9227. @end table
  9228. @subsection Examples
  9229. @itemize
  9230. @item
  9231. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9232. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9233. aperture of "8.0".
  9234. @example
  9235. 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
  9236. @end example
  9237. @item
  9238. Apply the same as before, but only for the first 5 seconds of video.
  9239. @example
  9240. 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
  9241. @end example
  9242. @end itemize
  9243. @section libvmaf
  9244. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9245. score between two input videos.
  9246. The obtained VMAF score is printed through the logging system.
  9247. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9248. After installing the library it can be enabled using:
  9249. @code{./configure --enable-libvmaf --enable-version3}.
  9250. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9251. The filter has following options:
  9252. @table @option
  9253. @item model_path
  9254. Set the model path which is to be used for SVM.
  9255. Default value: @code{"vmaf_v0.6.1.pkl"}
  9256. @item log_path
  9257. Set the file path to be used to store logs.
  9258. @item log_fmt
  9259. Set the format of the log file (xml or json).
  9260. @item enable_transform
  9261. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  9262. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  9263. Default value: @code{false}
  9264. @item phone_model
  9265. Invokes the phone model which will generate VMAF scores higher than in the
  9266. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  9267. @item psnr
  9268. Enables computing psnr along with vmaf.
  9269. @item ssim
  9270. Enables computing ssim along with vmaf.
  9271. @item ms_ssim
  9272. Enables computing ms_ssim along with vmaf.
  9273. @item pool
  9274. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  9275. @item n_threads
  9276. Set number of threads to be used when computing vmaf.
  9277. @item n_subsample
  9278. Set interval for frame subsampling used when computing vmaf.
  9279. @item enable_conf_interval
  9280. Enables confidence interval.
  9281. @end table
  9282. This filter also supports the @ref{framesync} options.
  9283. On the below examples the input file @file{main.mpg} being processed is
  9284. compared with the reference file @file{ref.mpg}.
  9285. @example
  9286. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  9287. @end example
  9288. Example with options:
  9289. @example
  9290. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  9291. @end example
  9292. @section limiter
  9293. Limits the pixel components values to the specified range [min, max].
  9294. The filter accepts the following options:
  9295. @table @option
  9296. @item min
  9297. Lower bound. Defaults to the lowest allowed value for the input.
  9298. @item max
  9299. Upper bound. Defaults to the highest allowed value for the input.
  9300. @item planes
  9301. Specify which planes will be processed. Defaults to all available.
  9302. @end table
  9303. @section loop
  9304. Loop video frames.
  9305. The filter accepts the following options:
  9306. @table @option
  9307. @item loop
  9308. Set the number of loops. Setting this value to -1 will result in infinite loops.
  9309. Default is 0.
  9310. @item size
  9311. Set maximal size in number of frames. Default is 0.
  9312. @item start
  9313. Set first frame of loop. Default is 0.
  9314. @end table
  9315. @subsection Examples
  9316. @itemize
  9317. @item
  9318. Loop single first frame infinitely:
  9319. @example
  9320. loop=loop=-1:size=1:start=0
  9321. @end example
  9322. @item
  9323. Loop single first frame 10 times:
  9324. @example
  9325. loop=loop=10:size=1:start=0
  9326. @end example
  9327. @item
  9328. Loop 10 first frames 5 times:
  9329. @example
  9330. loop=loop=5:size=10:start=0
  9331. @end example
  9332. @end itemize
  9333. @section lut1d
  9334. Apply a 1D LUT to an input video.
  9335. The filter accepts the following options:
  9336. @table @option
  9337. @item file
  9338. Set the 1D LUT file name.
  9339. Currently supported formats:
  9340. @table @samp
  9341. @item cube
  9342. Iridas
  9343. @item csp
  9344. cineSpace
  9345. @end table
  9346. @item interp
  9347. Select interpolation mode.
  9348. Available values are:
  9349. @table @samp
  9350. @item nearest
  9351. Use values from the nearest defined point.
  9352. @item linear
  9353. Interpolate values using the linear interpolation.
  9354. @item cosine
  9355. Interpolate values using the cosine interpolation.
  9356. @item cubic
  9357. Interpolate values using the cubic interpolation.
  9358. @item spline
  9359. Interpolate values using the spline interpolation.
  9360. @end table
  9361. @end table
  9362. @anchor{lut3d}
  9363. @section lut3d
  9364. Apply a 3D LUT to an input video.
  9365. The filter accepts the following options:
  9366. @table @option
  9367. @item file
  9368. Set the 3D LUT file name.
  9369. Currently supported formats:
  9370. @table @samp
  9371. @item 3dl
  9372. AfterEffects
  9373. @item cube
  9374. Iridas
  9375. @item dat
  9376. DaVinci
  9377. @item m3d
  9378. Pandora
  9379. @item csp
  9380. cineSpace
  9381. @end table
  9382. @item interp
  9383. Select interpolation mode.
  9384. Available values are:
  9385. @table @samp
  9386. @item nearest
  9387. Use values from the nearest defined point.
  9388. @item trilinear
  9389. Interpolate values using the 8 points defining a cube.
  9390. @item tetrahedral
  9391. Interpolate values using a tetrahedron.
  9392. @end table
  9393. @end table
  9394. @section lumakey
  9395. Turn certain luma values into transparency.
  9396. The filter accepts the following options:
  9397. @table @option
  9398. @item threshold
  9399. Set the luma which will be used as base for transparency.
  9400. Default value is @code{0}.
  9401. @item tolerance
  9402. Set the range of luma values to be keyed out.
  9403. Default value is @code{0}.
  9404. @item softness
  9405. Set the range of softness. Default value is @code{0}.
  9406. Use this to control gradual transition from zero to full transparency.
  9407. @end table
  9408. @section lut, lutrgb, lutyuv
  9409. Compute a look-up table for binding each pixel component input value
  9410. to an output value, and apply it to the input video.
  9411. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  9412. to an RGB input video.
  9413. These filters accept the following parameters:
  9414. @table @option
  9415. @item c0
  9416. set first pixel component expression
  9417. @item c1
  9418. set second pixel component expression
  9419. @item c2
  9420. set third pixel component expression
  9421. @item c3
  9422. set fourth pixel component expression, corresponds to the alpha component
  9423. @item r
  9424. set red component expression
  9425. @item g
  9426. set green component expression
  9427. @item b
  9428. set blue component expression
  9429. @item a
  9430. alpha component expression
  9431. @item y
  9432. set Y/luminance component expression
  9433. @item u
  9434. set U/Cb component expression
  9435. @item v
  9436. set V/Cr component expression
  9437. @end table
  9438. Each of them specifies the expression to use for computing the lookup table for
  9439. the corresponding pixel component values.
  9440. The exact component associated to each of the @var{c*} options depends on the
  9441. format in input.
  9442. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  9443. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  9444. The expressions can contain the following constants and functions:
  9445. @table @option
  9446. @item w
  9447. @item h
  9448. The input width and height.
  9449. @item val
  9450. The input value for the pixel component.
  9451. @item clipval
  9452. The input value, clipped to the @var{minval}-@var{maxval} range.
  9453. @item maxval
  9454. The maximum value for the pixel component.
  9455. @item minval
  9456. The minimum value for the pixel component.
  9457. @item negval
  9458. The negated value for the pixel component value, clipped to the
  9459. @var{minval}-@var{maxval} range; it corresponds to the expression
  9460. "maxval-clipval+minval".
  9461. @item clip(val)
  9462. The computed value in @var{val}, clipped to the
  9463. @var{minval}-@var{maxval} range.
  9464. @item gammaval(gamma)
  9465. The computed gamma correction value of the pixel component value,
  9466. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  9467. expression
  9468. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  9469. @end table
  9470. All expressions default to "val".
  9471. @subsection Examples
  9472. @itemize
  9473. @item
  9474. Negate input video:
  9475. @example
  9476. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  9477. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  9478. @end example
  9479. The above is the same as:
  9480. @example
  9481. lutrgb="r=negval:g=negval:b=negval"
  9482. lutyuv="y=negval:u=negval:v=negval"
  9483. @end example
  9484. @item
  9485. Negate luminance:
  9486. @example
  9487. lutyuv=y=negval
  9488. @end example
  9489. @item
  9490. Remove chroma components, turning the video into a graytone image:
  9491. @example
  9492. lutyuv="u=128:v=128"
  9493. @end example
  9494. @item
  9495. Apply a luma burning effect:
  9496. @example
  9497. lutyuv="y=2*val"
  9498. @end example
  9499. @item
  9500. Remove green and blue components:
  9501. @example
  9502. lutrgb="g=0:b=0"
  9503. @end example
  9504. @item
  9505. Set a constant alpha channel value on input:
  9506. @example
  9507. format=rgba,lutrgb=a="maxval-minval/2"
  9508. @end example
  9509. @item
  9510. Correct luminance gamma by a factor of 0.5:
  9511. @example
  9512. lutyuv=y=gammaval(0.5)
  9513. @end example
  9514. @item
  9515. Discard least significant bits of luma:
  9516. @example
  9517. lutyuv=y='bitand(val, 128+64+32)'
  9518. @end example
  9519. @item
  9520. Technicolor like effect:
  9521. @example
  9522. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9523. @end example
  9524. @end itemize
  9525. @section lut2, tlut2
  9526. The @code{lut2} filter takes two input streams and outputs one
  9527. stream.
  9528. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9529. from one single stream.
  9530. This filter accepts the following parameters:
  9531. @table @option
  9532. @item c0
  9533. set first pixel component expression
  9534. @item c1
  9535. set second pixel component expression
  9536. @item c2
  9537. set third pixel component expression
  9538. @item c3
  9539. set fourth pixel component expression, corresponds to the alpha component
  9540. @item d
  9541. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9542. which means bit depth is automatically picked from first input format.
  9543. @end table
  9544. Each of them specifies the expression to use for computing the lookup table for
  9545. the corresponding pixel component values.
  9546. The exact component associated to each of the @var{c*} options depends on the
  9547. format in inputs.
  9548. The expressions can contain the following constants:
  9549. @table @option
  9550. @item w
  9551. @item h
  9552. The input width and height.
  9553. @item x
  9554. The first input value for the pixel component.
  9555. @item y
  9556. The second input value for the pixel component.
  9557. @item bdx
  9558. The first input video bit depth.
  9559. @item bdy
  9560. The second input video bit depth.
  9561. @end table
  9562. All expressions default to "x".
  9563. @subsection Examples
  9564. @itemize
  9565. @item
  9566. Highlight differences between two RGB video streams:
  9567. @example
  9568. 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)'
  9569. @end example
  9570. @item
  9571. Highlight differences between two YUV video streams:
  9572. @example
  9573. 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)'
  9574. @end example
  9575. @item
  9576. Show max difference between two video streams:
  9577. @example
  9578. 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)))'
  9579. @end example
  9580. @end itemize
  9581. @section maskedclamp
  9582. Clamp the first input stream with the second input and third input stream.
  9583. Returns the value of first stream to be between second input
  9584. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9585. This filter accepts the following options:
  9586. @table @option
  9587. @item undershoot
  9588. Default value is @code{0}.
  9589. @item overshoot
  9590. Default value is @code{0}.
  9591. @item planes
  9592. Set which planes will be processed as bitmap, unprocessed planes will be
  9593. copied from first stream.
  9594. By default value 0xf, all planes will be processed.
  9595. @end table
  9596. @section maskedmerge
  9597. Merge the first input stream with the second input stream using per pixel
  9598. weights in the third input stream.
  9599. A value of 0 in the third stream pixel component means that pixel component
  9600. from first stream is returned unchanged, while maximum value (eg. 255 for
  9601. 8-bit videos) means that pixel component from second stream is returned
  9602. unchanged. Intermediate values define the amount of merging between both
  9603. input stream's pixel components.
  9604. This filter accepts the following options:
  9605. @table @option
  9606. @item planes
  9607. Set which planes will be processed as bitmap, unprocessed planes will be
  9608. copied from first stream.
  9609. By default value 0xf, all planes will be processed.
  9610. @end table
  9611. @section maskfun
  9612. Create mask from input video.
  9613. For example it is useful to create motion masks after @code{tblend} filter.
  9614. This filter accepts the following options:
  9615. @table @option
  9616. @item low
  9617. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  9618. @item high
  9619. Set high threshold. Any pixel component higher than this value will be set to max value
  9620. allowed for current pixel format.
  9621. @item planes
  9622. Set planes to filter, by default all available planes are filtered.
  9623. @item fill
  9624. Fill all frame pixels with this value.
  9625. @item sum
  9626. Set max average pixel value for frame. If sum of all pixel components is higher that this
  9627. average, output frame will be completely filled with value set by @var{fill} option.
  9628. Typically useful for scene changes when used in combination with @code{tblend} filter.
  9629. @end table
  9630. @section mcdeint
  9631. Apply motion-compensation deinterlacing.
  9632. It needs one field per frame as input and must thus be used together
  9633. with yadif=1/3 or equivalent.
  9634. This filter accepts the following options:
  9635. @table @option
  9636. @item mode
  9637. Set the deinterlacing mode.
  9638. It accepts one of the following values:
  9639. @table @samp
  9640. @item fast
  9641. @item medium
  9642. @item slow
  9643. use iterative motion estimation
  9644. @item extra_slow
  9645. like @samp{slow}, but use multiple reference frames.
  9646. @end table
  9647. Default value is @samp{fast}.
  9648. @item parity
  9649. Set the picture field parity assumed for the input video. It must be
  9650. one of the following values:
  9651. @table @samp
  9652. @item 0, tff
  9653. assume top field first
  9654. @item 1, bff
  9655. assume bottom field first
  9656. @end table
  9657. Default value is @samp{bff}.
  9658. @item qp
  9659. Set per-block quantization parameter (QP) used by the internal
  9660. encoder.
  9661. Higher values should result in a smoother motion vector field but less
  9662. optimal individual vectors. Default value is 1.
  9663. @end table
  9664. @section mergeplanes
  9665. Merge color channel components from several video streams.
  9666. The filter accepts up to 4 input streams, and merge selected input
  9667. planes to the output video.
  9668. This filter accepts the following options:
  9669. @table @option
  9670. @item mapping
  9671. Set input to output plane mapping. Default is @code{0}.
  9672. The mappings is specified as a bitmap. It should be specified as a
  9673. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  9674. mapping for the first plane of the output stream. 'A' sets the number of
  9675. the input stream to use (from 0 to 3), and 'a' the plane number of the
  9676. corresponding input to use (from 0 to 3). The rest of the mappings is
  9677. similar, 'Bb' describes the mapping for the output stream second
  9678. plane, 'Cc' describes the mapping for the output stream third plane and
  9679. 'Dd' describes the mapping for the output stream fourth plane.
  9680. @item format
  9681. Set output pixel format. Default is @code{yuva444p}.
  9682. @end table
  9683. @subsection Examples
  9684. @itemize
  9685. @item
  9686. Merge three gray video streams of same width and height into single video stream:
  9687. @example
  9688. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  9689. @end example
  9690. @item
  9691. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  9692. @example
  9693. [a0][a1]mergeplanes=0x00010210:yuva444p
  9694. @end example
  9695. @item
  9696. Swap Y and A plane in yuva444p stream:
  9697. @example
  9698. format=yuva444p,mergeplanes=0x03010200:yuva444p
  9699. @end example
  9700. @item
  9701. Swap U and V plane in yuv420p stream:
  9702. @example
  9703. format=yuv420p,mergeplanes=0x000201:yuv420p
  9704. @end example
  9705. @item
  9706. Cast a rgb24 clip to yuv444p:
  9707. @example
  9708. format=rgb24,mergeplanes=0x000102:yuv444p
  9709. @end example
  9710. @end itemize
  9711. @section mestimate
  9712. Estimate and export motion vectors using block matching algorithms.
  9713. Motion vectors are stored in frame side data to be used by other filters.
  9714. This filter accepts the following options:
  9715. @table @option
  9716. @item method
  9717. Specify the motion estimation method. Accepts one of the following values:
  9718. @table @samp
  9719. @item esa
  9720. Exhaustive search algorithm.
  9721. @item tss
  9722. Three step search algorithm.
  9723. @item tdls
  9724. Two dimensional logarithmic search algorithm.
  9725. @item ntss
  9726. New three step search algorithm.
  9727. @item fss
  9728. Four step search algorithm.
  9729. @item ds
  9730. Diamond search algorithm.
  9731. @item hexbs
  9732. Hexagon-based search algorithm.
  9733. @item epzs
  9734. Enhanced predictive zonal search algorithm.
  9735. @item umh
  9736. Uneven multi-hexagon search algorithm.
  9737. @end table
  9738. Default value is @samp{esa}.
  9739. @item mb_size
  9740. Macroblock size. Default @code{16}.
  9741. @item search_param
  9742. Search parameter. Default @code{7}.
  9743. @end table
  9744. @section midequalizer
  9745. Apply Midway Image Equalization effect using two video streams.
  9746. Midway Image Equalization adjusts a pair of images to have the same
  9747. histogram, while maintaining their dynamics as much as possible. It's
  9748. useful for e.g. matching exposures from a pair of stereo cameras.
  9749. This filter has two inputs and one output, which must be of same pixel format, but
  9750. may be of different sizes. The output of filter is first input adjusted with
  9751. midway histogram of both inputs.
  9752. This filter accepts the following option:
  9753. @table @option
  9754. @item planes
  9755. Set which planes to process. Default is @code{15}, which is all available planes.
  9756. @end table
  9757. @section minterpolate
  9758. Convert the video to specified frame rate using motion interpolation.
  9759. This filter accepts the following options:
  9760. @table @option
  9761. @item fps
  9762. 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}.
  9763. @item mi_mode
  9764. Motion interpolation mode. Following values are accepted:
  9765. @table @samp
  9766. @item dup
  9767. Duplicate previous or next frame for interpolating new ones.
  9768. @item blend
  9769. Blend source frames. Interpolated frame is mean of previous and next frames.
  9770. @item mci
  9771. Motion compensated interpolation. Following options are effective when this mode is selected:
  9772. @table @samp
  9773. @item mc_mode
  9774. Motion compensation mode. Following values are accepted:
  9775. @table @samp
  9776. @item obmc
  9777. Overlapped block motion compensation.
  9778. @item aobmc
  9779. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  9780. @end table
  9781. Default mode is @samp{obmc}.
  9782. @item me_mode
  9783. Motion estimation mode. Following values are accepted:
  9784. @table @samp
  9785. @item bidir
  9786. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  9787. @item bilat
  9788. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  9789. @end table
  9790. Default mode is @samp{bilat}.
  9791. @item me
  9792. The algorithm to be used for motion estimation. Following values are accepted:
  9793. @table @samp
  9794. @item esa
  9795. Exhaustive search algorithm.
  9796. @item tss
  9797. Three step search algorithm.
  9798. @item tdls
  9799. Two dimensional logarithmic search algorithm.
  9800. @item ntss
  9801. New three step search algorithm.
  9802. @item fss
  9803. Four step search algorithm.
  9804. @item ds
  9805. Diamond search algorithm.
  9806. @item hexbs
  9807. Hexagon-based search algorithm.
  9808. @item epzs
  9809. Enhanced predictive zonal search algorithm.
  9810. @item umh
  9811. Uneven multi-hexagon search algorithm.
  9812. @end table
  9813. Default algorithm is @samp{epzs}.
  9814. @item mb_size
  9815. Macroblock size. Default @code{16}.
  9816. @item search_param
  9817. Motion estimation search parameter. Default @code{32}.
  9818. @item vsbmc
  9819. 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).
  9820. @end table
  9821. @end table
  9822. @item scd
  9823. 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:
  9824. @table @samp
  9825. @item none
  9826. Disable scene change detection.
  9827. @item fdiff
  9828. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  9829. @end table
  9830. Default method is @samp{fdiff}.
  9831. @item scd_threshold
  9832. Scene change detection threshold. Default is @code{5.0}.
  9833. @end table
  9834. @section mix
  9835. Mix several video input streams into one video stream.
  9836. A description of the accepted options follows.
  9837. @table @option
  9838. @item nb_inputs
  9839. The number of inputs. If unspecified, it defaults to 2.
  9840. @item weights
  9841. Specify weight of each input video stream as sequence.
  9842. Each weight is separated by space. If number of weights
  9843. is smaller than number of @var{frames} last specified
  9844. weight will be used for all remaining unset weights.
  9845. @item scale
  9846. Specify scale, if it is set it will be multiplied with sum
  9847. of each weight multiplied with pixel values to give final destination
  9848. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9849. @item duration
  9850. Specify how end of stream is determined.
  9851. @table @samp
  9852. @item longest
  9853. The duration of the longest input. (default)
  9854. @item shortest
  9855. The duration of the shortest input.
  9856. @item first
  9857. The duration of the first input.
  9858. @end table
  9859. @end table
  9860. @section mpdecimate
  9861. Drop frames that do not differ greatly from the previous frame in
  9862. order to reduce frame rate.
  9863. The main use of this filter is for very-low-bitrate encoding
  9864. (e.g. streaming over dialup modem), but it could in theory be used for
  9865. fixing movies that were inverse-telecined incorrectly.
  9866. A description of the accepted options follows.
  9867. @table @option
  9868. @item max
  9869. Set the maximum number of consecutive frames which can be dropped (if
  9870. positive), or the minimum interval between dropped frames (if
  9871. negative). If the value is 0, the frame is dropped disregarding the
  9872. number of previous sequentially dropped frames.
  9873. Default value is 0.
  9874. @item hi
  9875. @item lo
  9876. @item frac
  9877. Set the dropping threshold values.
  9878. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9879. represent actual pixel value differences, so a threshold of 64
  9880. corresponds to 1 unit of difference for each pixel, or the same spread
  9881. out differently over the block.
  9882. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9883. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9884. meaning the whole image) differ by more than a threshold of @option{lo}.
  9885. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9886. 64*5, and default value for @option{frac} is 0.33.
  9887. @end table
  9888. @section negate
  9889. Negate (invert) the input video.
  9890. It accepts the following option:
  9891. @table @option
  9892. @item negate_alpha
  9893. With value 1, it negates the alpha component, if present. Default value is 0.
  9894. @end table
  9895. @anchor{nlmeans}
  9896. @section nlmeans
  9897. Denoise frames using Non-Local Means algorithm.
  9898. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9899. context similarity is defined by comparing their surrounding patches of size
  9900. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9901. around the pixel.
  9902. Note that the research area defines centers for patches, which means some
  9903. patches will be made of pixels outside that research area.
  9904. The filter accepts the following options.
  9905. @table @option
  9906. @item s
  9907. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  9908. @item p
  9909. Set patch size. Default is 7. Must be odd number in range [0, 99].
  9910. @item pc
  9911. Same as @option{p} but for chroma planes.
  9912. The default value is @var{0} and means automatic.
  9913. @item r
  9914. Set research size. Default is 15. Must be odd number in range [0, 99].
  9915. @item rc
  9916. Same as @option{r} but for chroma planes.
  9917. The default value is @var{0} and means automatic.
  9918. @end table
  9919. @section nnedi
  9920. Deinterlace video using neural network edge directed interpolation.
  9921. This filter accepts the following options:
  9922. @table @option
  9923. @item weights
  9924. Mandatory option, without binary file filter can not work.
  9925. Currently file can be found here:
  9926. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9927. @item deint
  9928. Set which frames to deinterlace, by default it is @code{all}.
  9929. Can be @code{all} or @code{interlaced}.
  9930. @item field
  9931. Set mode of operation.
  9932. Can be one of the following:
  9933. @table @samp
  9934. @item af
  9935. Use frame flags, both fields.
  9936. @item a
  9937. Use frame flags, single field.
  9938. @item t
  9939. Use top field only.
  9940. @item b
  9941. Use bottom field only.
  9942. @item tf
  9943. Use both fields, top first.
  9944. @item bf
  9945. Use both fields, bottom first.
  9946. @end table
  9947. @item planes
  9948. Set which planes to process, by default filter process all frames.
  9949. @item nsize
  9950. Set size of local neighborhood around each pixel, used by the predictor neural
  9951. network.
  9952. Can be one of the following:
  9953. @table @samp
  9954. @item s8x6
  9955. @item s16x6
  9956. @item s32x6
  9957. @item s48x6
  9958. @item s8x4
  9959. @item s16x4
  9960. @item s32x4
  9961. @end table
  9962. @item nns
  9963. Set the number of neurons in predictor neural network.
  9964. Can be one of the following:
  9965. @table @samp
  9966. @item n16
  9967. @item n32
  9968. @item n64
  9969. @item n128
  9970. @item n256
  9971. @end table
  9972. @item qual
  9973. Controls the number of different neural network predictions that are blended
  9974. together to compute the final output value. Can be @code{fast}, default or
  9975. @code{slow}.
  9976. @item etype
  9977. Set which set of weights to use in the predictor.
  9978. Can be one of the following:
  9979. @table @samp
  9980. @item a
  9981. weights trained to minimize absolute error
  9982. @item s
  9983. weights trained to minimize squared error
  9984. @end table
  9985. @item pscrn
  9986. Controls whether or not the prescreener neural network is used to decide
  9987. which pixels should be processed by the predictor neural network and which
  9988. can be handled by simple cubic interpolation.
  9989. The prescreener is trained to know whether cubic interpolation will be
  9990. sufficient for a pixel or whether it should be predicted by the predictor nn.
  9991. The computational complexity of the prescreener nn is much less than that of
  9992. the predictor nn. Since most pixels can be handled by cubic interpolation,
  9993. using the prescreener generally results in much faster processing.
  9994. The prescreener is pretty accurate, so the difference between using it and not
  9995. using it is almost always unnoticeable.
  9996. Can be one of the following:
  9997. @table @samp
  9998. @item none
  9999. @item original
  10000. @item new
  10001. @end table
  10002. Default is @code{new}.
  10003. @item fapprox
  10004. Set various debugging flags.
  10005. @end table
  10006. @section noformat
  10007. Force libavfilter not to use any of the specified pixel formats for the
  10008. input to the next filter.
  10009. It accepts the following parameters:
  10010. @table @option
  10011. @item pix_fmts
  10012. A '|'-separated list of pixel format names, such as
  10013. pix_fmts=yuv420p|monow|rgb24".
  10014. @end table
  10015. @subsection Examples
  10016. @itemize
  10017. @item
  10018. Force libavfilter to use a format different from @var{yuv420p} for the
  10019. input to the vflip filter:
  10020. @example
  10021. noformat=pix_fmts=yuv420p,vflip
  10022. @end example
  10023. @item
  10024. Convert the input video to any of the formats not contained in the list:
  10025. @example
  10026. noformat=yuv420p|yuv444p|yuv410p
  10027. @end example
  10028. @end itemize
  10029. @section noise
  10030. Add noise on video input frame.
  10031. The filter accepts the following options:
  10032. @table @option
  10033. @item all_seed
  10034. @item c0_seed
  10035. @item c1_seed
  10036. @item c2_seed
  10037. @item c3_seed
  10038. Set noise seed for specific pixel component or all pixel components in case
  10039. of @var{all_seed}. Default value is @code{123457}.
  10040. @item all_strength, alls
  10041. @item c0_strength, c0s
  10042. @item c1_strength, c1s
  10043. @item c2_strength, c2s
  10044. @item c3_strength, c3s
  10045. Set noise strength for specific pixel component or all pixel components in case
  10046. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  10047. @item all_flags, allf
  10048. @item c0_flags, c0f
  10049. @item c1_flags, c1f
  10050. @item c2_flags, c2f
  10051. @item c3_flags, c3f
  10052. Set pixel component flags or set flags for all components if @var{all_flags}.
  10053. Available values for component flags are:
  10054. @table @samp
  10055. @item a
  10056. averaged temporal noise (smoother)
  10057. @item p
  10058. mix random noise with a (semi)regular pattern
  10059. @item t
  10060. temporal noise (noise pattern changes between frames)
  10061. @item u
  10062. uniform noise (gaussian otherwise)
  10063. @end table
  10064. @end table
  10065. @subsection Examples
  10066. Add temporal and uniform noise to input video:
  10067. @example
  10068. noise=alls=20:allf=t+u
  10069. @end example
  10070. @section normalize
  10071. Normalize RGB video (aka histogram stretching, contrast stretching).
  10072. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  10073. For each channel of each frame, the filter computes the input range and maps
  10074. it linearly to the user-specified output range. The output range defaults
  10075. to the full dynamic range from pure black to pure white.
  10076. Temporal smoothing can be used on the input range to reduce flickering (rapid
  10077. changes in brightness) caused when small dark or bright objects enter or leave
  10078. the scene. This is similar to the auto-exposure (automatic gain control) on a
  10079. video camera, and, like a video camera, it may cause a period of over- or
  10080. under-exposure of the video.
  10081. The R,G,B channels can be normalized independently, which may cause some
  10082. color shifting, or linked together as a single channel, which prevents
  10083. color shifting. Linked normalization preserves hue. Independent normalization
  10084. does not, so it can be used to remove some color casts. Independent and linked
  10085. normalization can be combined in any ratio.
  10086. The normalize filter accepts the following options:
  10087. @table @option
  10088. @item blackpt
  10089. @item whitept
  10090. Colors which define the output range. The minimum input value is mapped to
  10091. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  10092. The defaults are black and white respectively. Specifying white for
  10093. @var{blackpt} and black for @var{whitept} will give color-inverted,
  10094. normalized video. Shades of grey can be used to reduce the dynamic range
  10095. (contrast). Specifying saturated colors here can create some interesting
  10096. effects.
  10097. @item smoothing
  10098. The number of previous frames to use for temporal smoothing. The input range
  10099. of each channel is smoothed using a rolling average over the current frame
  10100. and the @var{smoothing} previous frames. The default is 0 (no temporal
  10101. smoothing).
  10102. @item independence
  10103. Controls the ratio of independent (color shifting) channel normalization to
  10104. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  10105. independent. Defaults to 1.0 (fully independent).
  10106. @item strength
  10107. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  10108. expensive no-op. Defaults to 1.0 (full strength).
  10109. @end table
  10110. @subsection Examples
  10111. Stretch video contrast to use the full dynamic range, with no temporal
  10112. smoothing; may flicker depending on the source content:
  10113. @example
  10114. normalize=blackpt=black:whitept=white:smoothing=0
  10115. @end example
  10116. As above, but with 50 frames of temporal smoothing; flicker should be
  10117. reduced, depending on the source content:
  10118. @example
  10119. normalize=blackpt=black:whitept=white:smoothing=50
  10120. @end example
  10121. As above, but with hue-preserving linked channel normalization:
  10122. @example
  10123. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  10124. @end example
  10125. As above, but with half strength:
  10126. @example
  10127. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  10128. @end example
  10129. Map the darkest input color to red, the brightest input color to cyan:
  10130. @example
  10131. normalize=blackpt=red:whitept=cyan
  10132. @end example
  10133. @section null
  10134. Pass the video source unchanged to the output.
  10135. @section ocr
  10136. Optical Character Recognition
  10137. This filter uses Tesseract for optical character recognition. To enable
  10138. compilation of this filter, you need to configure FFmpeg with
  10139. @code{--enable-libtesseract}.
  10140. It accepts the following options:
  10141. @table @option
  10142. @item datapath
  10143. Set datapath to tesseract data. Default is to use whatever was
  10144. set at installation.
  10145. @item language
  10146. Set language, default is "eng".
  10147. @item whitelist
  10148. Set character whitelist.
  10149. @item blacklist
  10150. Set character blacklist.
  10151. @end table
  10152. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  10153. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  10154. @section ocv
  10155. Apply a video transform using libopencv.
  10156. To enable this filter, install the libopencv library and headers and
  10157. configure FFmpeg with @code{--enable-libopencv}.
  10158. It accepts the following parameters:
  10159. @table @option
  10160. @item filter_name
  10161. The name of the libopencv filter to apply.
  10162. @item filter_params
  10163. The parameters to pass to the libopencv filter. If not specified, the default
  10164. values are assumed.
  10165. @end table
  10166. Refer to the official libopencv documentation for more precise
  10167. information:
  10168. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  10169. Several libopencv filters are supported; see the following subsections.
  10170. @anchor{dilate}
  10171. @subsection dilate
  10172. Dilate an image by using a specific structuring element.
  10173. It corresponds to the libopencv function @code{cvDilate}.
  10174. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  10175. @var{struct_el} represents a structuring element, and has the syntax:
  10176. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  10177. @var{cols} and @var{rows} represent the number of columns and rows of
  10178. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  10179. point, and @var{shape} the shape for the structuring element. @var{shape}
  10180. must be "rect", "cross", "ellipse", or "custom".
  10181. If the value for @var{shape} is "custom", it must be followed by a
  10182. string of the form "=@var{filename}". The file with name
  10183. @var{filename} is assumed to represent a binary image, with each
  10184. printable character corresponding to a bright pixel. When a custom
  10185. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  10186. or columns and rows of the read file are assumed instead.
  10187. The default value for @var{struct_el} is "3x3+0x0/rect".
  10188. @var{nb_iterations} specifies the number of times the transform is
  10189. applied to the image, and defaults to 1.
  10190. Some examples:
  10191. @example
  10192. # Use the default values
  10193. ocv=dilate
  10194. # Dilate using a structuring element with a 5x5 cross, iterating two times
  10195. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  10196. # Read the shape from the file diamond.shape, iterating two times.
  10197. # The file diamond.shape may contain a pattern of characters like this
  10198. # *
  10199. # ***
  10200. # *****
  10201. # ***
  10202. # *
  10203. # The specified columns and rows are ignored
  10204. # but the anchor point coordinates are not
  10205. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  10206. @end example
  10207. @subsection erode
  10208. Erode an image by using a specific structuring element.
  10209. It corresponds to the libopencv function @code{cvErode}.
  10210. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  10211. with the same syntax and semantics as the @ref{dilate} filter.
  10212. @subsection smooth
  10213. Smooth the input video.
  10214. The filter takes the following parameters:
  10215. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  10216. @var{type} is the type of smooth filter to apply, and must be one of
  10217. the following values: "blur", "blur_no_scale", "median", "gaussian",
  10218. or "bilateral". The default value is "gaussian".
  10219. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  10220. depends on the smooth type. @var{param1} and
  10221. @var{param2} accept integer positive values or 0. @var{param3} and
  10222. @var{param4} accept floating point values.
  10223. The default value for @var{param1} is 3. The default value for the
  10224. other parameters is 0.
  10225. These parameters correspond to the parameters assigned to the
  10226. libopencv function @code{cvSmooth}.
  10227. @section oscilloscope
  10228. 2D Video Oscilloscope.
  10229. Useful to measure spatial impulse, step responses, chroma delays, etc.
  10230. It accepts the following parameters:
  10231. @table @option
  10232. @item x
  10233. Set scope center x position.
  10234. @item y
  10235. Set scope center y position.
  10236. @item s
  10237. Set scope size, relative to frame diagonal.
  10238. @item t
  10239. Set scope tilt/rotation.
  10240. @item o
  10241. Set trace opacity.
  10242. @item tx
  10243. Set trace center x position.
  10244. @item ty
  10245. Set trace center y position.
  10246. @item tw
  10247. Set trace width, relative to width of frame.
  10248. @item th
  10249. Set trace height, relative to height of frame.
  10250. @item c
  10251. Set which components to trace. By default it traces first three components.
  10252. @item g
  10253. Draw trace grid. By default is enabled.
  10254. @item st
  10255. Draw some statistics. By default is enabled.
  10256. @item sc
  10257. Draw scope. By default is enabled.
  10258. @end table
  10259. @subsection Examples
  10260. @itemize
  10261. @item
  10262. Inspect full first row of video frame.
  10263. @example
  10264. oscilloscope=x=0.5:y=0:s=1
  10265. @end example
  10266. @item
  10267. Inspect full last row of video frame.
  10268. @example
  10269. oscilloscope=x=0.5:y=1:s=1
  10270. @end example
  10271. @item
  10272. Inspect full 5th line of video frame of height 1080.
  10273. @example
  10274. oscilloscope=x=0.5:y=5/1080:s=1
  10275. @end example
  10276. @item
  10277. Inspect full last column of video frame.
  10278. @example
  10279. oscilloscope=x=1:y=0.5:s=1:t=1
  10280. @end example
  10281. @end itemize
  10282. @anchor{overlay}
  10283. @section overlay
  10284. Overlay one video on top of another.
  10285. It takes two inputs and has one output. The first input is the "main"
  10286. video on which the second input is overlaid.
  10287. It accepts the following parameters:
  10288. A description of the accepted options follows.
  10289. @table @option
  10290. @item x
  10291. @item y
  10292. Set the expression for the x and y coordinates of the overlaid video
  10293. on the main video. Default value is "0" for both expressions. In case
  10294. the expression is invalid, it is set to a huge value (meaning that the
  10295. overlay will not be displayed within the output visible area).
  10296. @item eof_action
  10297. See @ref{framesync}.
  10298. @item eval
  10299. Set when the expressions for @option{x}, and @option{y} are evaluated.
  10300. It accepts the following values:
  10301. @table @samp
  10302. @item init
  10303. only evaluate expressions once during the filter initialization or
  10304. when a command is processed
  10305. @item frame
  10306. evaluate expressions for each incoming frame
  10307. @end table
  10308. Default value is @samp{frame}.
  10309. @item shortest
  10310. See @ref{framesync}.
  10311. @item format
  10312. Set the format for the output video.
  10313. It accepts the following values:
  10314. @table @samp
  10315. @item yuv420
  10316. force YUV420 output
  10317. @item yuv422
  10318. force YUV422 output
  10319. @item yuv444
  10320. force YUV444 output
  10321. @item rgb
  10322. force packed RGB output
  10323. @item gbrp
  10324. force planar RGB output
  10325. @item auto
  10326. automatically pick format
  10327. @end table
  10328. Default value is @samp{yuv420}.
  10329. @item repeatlast
  10330. See @ref{framesync}.
  10331. @item alpha
  10332. Set format of alpha of the overlaid video, it can be @var{straight} or
  10333. @var{premultiplied}. Default is @var{straight}.
  10334. @end table
  10335. The @option{x}, and @option{y} expressions can contain the following
  10336. parameters.
  10337. @table @option
  10338. @item main_w, W
  10339. @item main_h, H
  10340. The main input width and height.
  10341. @item overlay_w, w
  10342. @item overlay_h, h
  10343. The overlay input width and height.
  10344. @item x
  10345. @item y
  10346. The computed values for @var{x} and @var{y}. They are evaluated for
  10347. each new frame.
  10348. @item hsub
  10349. @item vsub
  10350. horizontal and vertical chroma subsample values of the output
  10351. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  10352. @var{vsub} is 1.
  10353. @item n
  10354. the number of input frame, starting from 0
  10355. @item pos
  10356. the position in the file of the input frame, NAN if unknown
  10357. @item t
  10358. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  10359. @end table
  10360. This filter also supports the @ref{framesync} options.
  10361. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  10362. when evaluation is done @emph{per frame}, and will evaluate to NAN
  10363. when @option{eval} is set to @samp{init}.
  10364. Be aware that frames are taken from each input video in timestamp
  10365. order, hence, if their initial timestamps differ, it is a good idea
  10366. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  10367. have them begin in the same zero timestamp, as the example for
  10368. the @var{movie} filter does.
  10369. You can chain together more overlays but you should test the
  10370. efficiency of such approach.
  10371. @subsection Commands
  10372. This filter supports the following commands:
  10373. @table @option
  10374. @item x
  10375. @item y
  10376. Modify the x and y of the overlay input.
  10377. The command accepts the same syntax of the corresponding option.
  10378. If the specified expression is not valid, it is kept at its current
  10379. value.
  10380. @end table
  10381. @subsection Examples
  10382. @itemize
  10383. @item
  10384. Draw the overlay at 10 pixels from the bottom right corner of the main
  10385. video:
  10386. @example
  10387. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  10388. @end example
  10389. Using named options the example above becomes:
  10390. @example
  10391. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  10392. @end example
  10393. @item
  10394. Insert a transparent PNG logo in the bottom left corner of the input,
  10395. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  10396. @example
  10397. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  10398. @end example
  10399. @item
  10400. Insert 2 different transparent PNG logos (second logo on bottom
  10401. right corner) using the @command{ffmpeg} tool:
  10402. @example
  10403. 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
  10404. @end example
  10405. @item
  10406. Add a transparent color layer on top of the main video; @code{WxH}
  10407. must specify the size of the main input to the overlay filter:
  10408. @example
  10409. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  10410. @end example
  10411. @item
  10412. Play an original video and a filtered version (here with the deshake
  10413. filter) side by side using the @command{ffplay} tool:
  10414. @example
  10415. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  10416. @end example
  10417. The above command is the same as:
  10418. @example
  10419. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  10420. @end example
  10421. @item
  10422. Make a sliding overlay appearing from the left to the right top part of the
  10423. screen starting since time 2:
  10424. @example
  10425. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  10426. @end example
  10427. @item
  10428. Compose output by putting two input videos side to side:
  10429. @example
  10430. ffmpeg -i left.avi -i right.avi -filter_complex "
  10431. nullsrc=size=200x100 [background];
  10432. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  10433. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  10434. [background][left] overlay=shortest=1 [background+left];
  10435. [background+left][right] overlay=shortest=1:x=100 [left+right]
  10436. "
  10437. @end example
  10438. @item
  10439. Mask 10-20 seconds of a video by applying the delogo filter to a section
  10440. @example
  10441. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  10442. -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]'
  10443. masked.avi
  10444. @end example
  10445. @item
  10446. Chain several overlays in cascade:
  10447. @example
  10448. nullsrc=s=200x200 [bg];
  10449. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  10450. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  10451. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  10452. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  10453. [in3] null, [mid2] overlay=100:100 [out0]
  10454. @end example
  10455. @end itemize
  10456. @section owdenoise
  10457. Apply Overcomplete Wavelet denoiser.
  10458. The filter accepts the following options:
  10459. @table @option
  10460. @item depth
  10461. Set depth.
  10462. Larger depth values will denoise lower frequency components more, but
  10463. slow down filtering.
  10464. Must be an int in the range 8-16, default is @code{8}.
  10465. @item luma_strength, ls
  10466. Set luma strength.
  10467. Must be a double value in the range 0-1000, default is @code{1.0}.
  10468. @item chroma_strength, cs
  10469. Set chroma strength.
  10470. Must be a double value in the range 0-1000, default is @code{1.0}.
  10471. @end table
  10472. @anchor{pad}
  10473. @section pad
  10474. Add paddings to the input image, and place the original input at the
  10475. provided @var{x}, @var{y} coordinates.
  10476. It accepts the following parameters:
  10477. @table @option
  10478. @item width, w
  10479. @item height, h
  10480. Specify an expression for the size of the output image with the
  10481. paddings added. If the value for @var{width} or @var{height} is 0, the
  10482. corresponding input size is used for the output.
  10483. The @var{width} expression can reference the value set by the
  10484. @var{height} expression, and vice versa.
  10485. The default value of @var{width} and @var{height} is 0.
  10486. @item x
  10487. @item y
  10488. Specify the offsets to place the input image at within the padded area,
  10489. with respect to the top/left border of the output image.
  10490. The @var{x} expression can reference the value set by the @var{y}
  10491. expression, and vice versa.
  10492. The default value of @var{x} and @var{y} is 0.
  10493. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  10494. so the input image is centered on the padded area.
  10495. @item color
  10496. Specify the color of the padded area. For the syntax of this option,
  10497. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10498. manual,ffmpeg-utils}.
  10499. The default value of @var{color} is "black".
  10500. @item eval
  10501. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  10502. It accepts the following values:
  10503. @table @samp
  10504. @item init
  10505. Only evaluate expressions once during the filter initialization or when
  10506. a command is processed.
  10507. @item frame
  10508. Evaluate expressions for each incoming frame.
  10509. @end table
  10510. Default value is @samp{init}.
  10511. @item aspect
  10512. Pad to aspect instead to a resolution.
  10513. @end table
  10514. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  10515. options are expressions containing the following constants:
  10516. @table @option
  10517. @item in_w
  10518. @item in_h
  10519. The input video width and height.
  10520. @item iw
  10521. @item ih
  10522. These are the same as @var{in_w} and @var{in_h}.
  10523. @item out_w
  10524. @item out_h
  10525. The output width and height (the size of the padded area), as
  10526. specified by the @var{width} and @var{height} expressions.
  10527. @item ow
  10528. @item oh
  10529. These are the same as @var{out_w} and @var{out_h}.
  10530. @item x
  10531. @item y
  10532. The x and y offsets as specified by the @var{x} and @var{y}
  10533. expressions, or NAN if not yet specified.
  10534. @item a
  10535. same as @var{iw} / @var{ih}
  10536. @item sar
  10537. input sample aspect ratio
  10538. @item dar
  10539. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  10540. @item hsub
  10541. @item vsub
  10542. The horizontal and vertical chroma subsample values. For example for the
  10543. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10544. @end table
  10545. @subsection Examples
  10546. @itemize
  10547. @item
  10548. Add paddings with the color "violet" to the input video. The output video
  10549. size is 640x480, and the top-left corner of the input video is placed at
  10550. column 0, row 40
  10551. @example
  10552. pad=640:480:0:40:violet
  10553. @end example
  10554. The example above is equivalent to the following command:
  10555. @example
  10556. pad=width=640:height=480:x=0:y=40:color=violet
  10557. @end example
  10558. @item
  10559. Pad the input to get an output with dimensions increased by 3/2,
  10560. and put the input video at the center of the padded area:
  10561. @example
  10562. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10563. @end example
  10564. @item
  10565. Pad the input to get a squared output with size equal to the maximum
  10566. value between the input width and height, and put the input video at
  10567. the center of the padded area:
  10568. @example
  10569. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10570. @end example
  10571. @item
  10572. Pad the input to get a final w/h ratio of 16:9:
  10573. @example
  10574. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10575. @end example
  10576. @item
  10577. In case of anamorphic video, in order to set the output display aspect
  10578. correctly, it is necessary to use @var{sar} in the expression,
  10579. according to the relation:
  10580. @example
  10581. (ih * X / ih) * sar = output_dar
  10582. X = output_dar / sar
  10583. @end example
  10584. Thus the previous example needs to be modified to:
  10585. @example
  10586. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  10587. @end example
  10588. @item
  10589. Double the output size and put the input video in the bottom-right
  10590. corner of the output padded area:
  10591. @example
  10592. pad="2*iw:2*ih:ow-iw:oh-ih"
  10593. @end example
  10594. @end itemize
  10595. @anchor{palettegen}
  10596. @section palettegen
  10597. Generate one palette for a whole video stream.
  10598. It accepts the following options:
  10599. @table @option
  10600. @item max_colors
  10601. Set the maximum number of colors to quantize in the palette.
  10602. Note: the palette will still contain 256 colors; the unused palette entries
  10603. will be black.
  10604. @item reserve_transparent
  10605. Create a palette of 255 colors maximum and reserve the last one for
  10606. transparency. Reserving the transparency color is useful for GIF optimization.
  10607. If not set, the maximum of colors in the palette will be 256. You probably want
  10608. to disable this option for a standalone image.
  10609. Set by default.
  10610. @item transparency_color
  10611. Set the color that will be used as background for transparency.
  10612. @item stats_mode
  10613. Set statistics mode.
  10614. It accepts the following values:
  10615. @table @samp
  10616. @item full
  10617. Compute full frame histograms.
  10618. @item diff
  10619. Compute histograms only for the part that differs from previous frame. This
  10620. might be relevant to give more importance to the moving part of your input if
  10621. the background is static.
  10622. @item single
  10623. Compute new histogram for each frame.
  10624. @end table
  10625. Default value is @var{full}.
  10626. @end table
  10627. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  10628. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  10629. color quantization of the palette. This information is also visible at
  10630. @var{info} logging level.
  10631. @subsection Examples
  10632. @itemize
  10633. @item
  10634. Generate a representative palette of a given video using @command{ffmpeg}:
  10635. @example
  10636. ffmpeg -i input.mkv -vf palettegen palette.png
  10637. @end example
  10638. @end itemize
  10639. @section paletteuse
  10640. Use a palette to downsample an input video stream.
  10641. The filter takes two inputs: one video stream and a palette. The palette must
  10642. be a 256 pixels image.
  10643. It accepts the following options:
  10644. @table @option
  10645. @item dither
  10646. Select dithering mode. Available algorithms are:
  10647. @table @samp
  10648. @item bayer
  10649. Ordered 8x8 bayer dithering (deterministic)
  10650. @item heckbert
  10651. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  10652. Note: this dithering is sometimes considered "wrong" and is included as a
  10653. reference.
  10654. @item floyd_steinberg
  10655. Floyd and Steingberg dithering (error diffusion)
  10656. @item sierra2
  10657. Frankie Sierra dithering v2 (error diffusion)
  10658. @item sierra2_4a
  10659. Frankie Sierra dithering v2 "Lite" (error diffusion)
  10660. @end table
  10661. Default is @var{sierra2_4a}.
  10662. @item bayer_scale
  10663. When @var{bayer} dithering is selected, this option defines the scale of the
  10664. pattern (how much the crosshatch pattern is visible). A low value means more
  10665. visible pattern for less banding, and higher value means less visible pattern
  10666. at the cost of more banding.
  10667. The option must be an integer value in the range [0,5]. Default is @var{2}.
  10668. @item diff_mode
  10669. If set, define the zone to process
  10670. @table @samp
  10671. @item rectangle
  10672. Only the changing rectangle will be reprocessed. This is similar to GIF
  10673. cropping/offsetting compression mechanism. This option can be useful for speed
  10674. if only a part of the image is changing, and has use cases such as limiting the
  10675. scope of the error diffusal @option{dither} to the rectangle that bounds the
  10676. moving scene (it leads to more deterministic output if the scene doesn't change
  10677. much, and as a result less moving noise and better GIF compression).
  10678. @end table
  10679. Default is @var{none}.
  10680. @item new
  10681. Take new palette for each output frame.
  10682. @item alpha_threshold
  10683. Sets the alpha threshold for transparency. Alpha values above this threshold
  10684. will be treated as completely opaque, and values below this threshold will be
  10685. treated as completely transparent.
  10686. The option must be an integer value in the range [0,255]. Default is @var{128}.
  10687. @end table
  10688. @subsection Examples
  10689. @itemize
  10690. @item
  10691. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  10692. using @command{ffmpeg}:
  10693. @example
  10694. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  10695. @end example
  10696. @end itemize
  10697. @section perspective
  10698. Correct perspective of video not recorded perpendicular to the screen.
  10699. A description of the accepted parameters follows.
  10700. @table @option
  10701. @item x0
  10702. @item y0
  10703. @item x1
  10704. @item y1
  10705. @item x2
  10706. @item y2
  10707. @item x3
  10708. @item y3
  10709. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  10710. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  10711. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  10712. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  10713. then the corners of the source will be sent to the specified coordinates.
  10714. The expressions can use the following variables:
  10715. @table @option
  10716. @item W
  10717. @item H
  10718. the width and height of video frame.
  10719. @item in
  10720. Input frame count.
  10721. @item on
  10722. Output frame count.
  10723. @end table
  10724. @item interpolation
  10725. Set interpolation for perspective correction.
  10726. It accepts the following values:
  10727. @table @samp
  10728. @item linear
  10729. @item cubic
  10730. @end table
  10731. Default value is @samp{linear}.
  10732. @item sense
  10733. Set interpretation of coordinate options.
  10734. It accepts the following values:
  10735. @table @samp
  10736. @item 0, source
  10737. Send point in the source specified by the given coordinates to
  10738. the corners of the destination.
  10739. @item 1, destination
  10740. Send the corners of the source to the point in the destination specified
  10741. by the given coordinates.
  10742. Default value is @samp{source}.
  10743. @end table
  10744. @item eval
  10745. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  10746. It accepts the following values:
  10747. @table @samp
  10748. @item init
  10749. only evaluate expressions once during the filter initialization or
  10750. when a command is processed
  10751. @item frame
  10752. evaluate expressions for each incoming frame
  10753. @end table
  10754. Default value is @samp{init}.
  10755. @end table
  10756. @section phase
  10757. Delay interlaced video by one field time so that the field order changes.
  10758. The intended use is to fix PAL movies that have been captured with the
  10759. opposite field order to the film-to-video transfer.
  10760. A description of the accepted parameters follows.
  10761. @table @option
  10762. @item mode
  10763. Set phase mode.
  10764. It accepts the following values:
  10765. @table @samp
  10766. @item t
  10767. Capture field order top-first, transfer bottom-first.
  10768. Filter will delay the bottom field.
  10769. @item b
  10770. Capture field order bottom-first, transfer top-first.
  10771. Filter will delay the top field.
  10772. @item p
  10773. Capture and transfer with the same field order. This mode only exists
  10774. for the documentation of the other options to refer to, but if you
  10775. actually select it, the filter will faithfully do nothing.
  10776. @item a
  10777. Capture field order determined automatically by field flags, transfer
  10778. opposite.
  10779. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  10780. basis using field flags. If no field information is available,
  10781. then this works just like @samp{u}.
  10782. @item u
  10783. Capture unknown or varying, transfer opposite.
  10784. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  10785. analyzing the images and selecting the alternative that produces best
  10786. match between the fields.
  10787. @item T
  10788. Capture top-first, transfer unknown or varying.
  10789. Filter selects among @samp{t} and @samp{p} using image analysis.
  10790. @item B
  10791. Capture bottom-first, transfer unknown or varying.
  10792. Filter selects among @samp{b} and @samp{p} using image analysis.
  10793. @item A
  10794. Capture determined by field flags, transfer unknown or varying.
  10795. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  10796. image analysis. If no field information is available, then this works just
  10797. like @samp{U}. This is the default mode.
  10798. @item U
  10799. Both capture and transfer unknown or varying.
  10800. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  10801. @end table
  10802. @end table
  10803. @section photosensitivity
  10804. Reduce various flashes in video, so to help users with epilepsy.
  10805. It accepts the following options:
  10806. @table @option
  10807. @item frames, f
  10808. Set how many frames to use when filtering. Default is 30.
  10809. @item threshold, t
  10810. Set detection threshold factor. Default is 1.
  10811. Lower is stricter.
  10812. @item skip
  10813. Set how many pixels to skip when sampling frames. Defalt is 1.
  10814. Allowed range is from 1 to 1024.
  10815. @item bypass
  10816. Leave frames unchanged. Default is disabled.
  10817. @end table
  10818. @section pixdesctest
  10819. Pixel format descriptor test filter, mainly useful for internal
  10820. testing. The output video should be equal to the input video.
  10821. For example:
  10822. @example
  10823. format=monow, pixdesctest
  10824. @end example
  10825. can be used to test the monowhite pixel format descriptor definition.
  10826. @section pixscope
  10827. Display sample values of color channels. Mainly useful for checking color
  10828. and levels. Minimum supported resolution is 640x480.
  10829. The filters accept the following options:
  10830. @table @option
  10831. @item x
  10832. Set scope X position, relative offset on X axis.
  10833. @item y
  10834. Set scope Y position, relative offset on Y axis.
  10835. @item w
  10836. Set scope width.
  10837. @item h
  10838. Set scope height.
  10839. @item o
  10840. Set window opacity. This window also holds statistics about pixel area.
  10841. @item wx
  10842. Set window X position, relative offset on X axis.
  10843. @item wy
  10844. Set window Y position, relative offset on Y axis.
  10845. @end table
  10846. @section pp
  10847. Enable the specified chain of postprocessing subfilters using libpostproc. This
  10848. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  10849. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  10850. Each subfilter and some options have a short and a long name that can be used
  10851. interchangeably, i.e. dr/dering are the same.
  10852. The filters accept the following options:
  10853. @table @option
  10854. @item subfilters
  10855. Set postprocessing subfilters string.
  10856. @end table
  10857. All subfilters share common options to determine their scope:
  10858. @table @option
  10859. @item a/autoq
  10860. Honor the quality commands for this subfilter.
  10861. @item c/chrom
  10862. Do chrominance filtering, too (default).
  10863. @item y/nochrom
  10864. Do luminance filtering only (no chrominance).
  10865. @item n/noluma
  10866. Do chrominance filtering only (no luminance).
  10867. @end table
  10868. These options can be appended after the subfilter name, separated by a '|'.
  10869. Available subfilters are:
  10870. @table @option
  10871. @item hb/hdeblock[|difference[|flatness]]
  10872. Horizontal deblocking filter
  10873. @table @option
  10874. @item difference
  10875. Difference factor where higher values mean more deblocking (default: @code{32}).
  10876. @item flatness
  10877. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10878. @end table
  10879. @item vb/vdeblock[|difference[|flatness]]
  10880. Vertical deblocking filter
  10881. @table @option
  10882. @item difference
  10883. Difference factor where higher values mean more deblocking (default: @code{32}).
  10884. @item flatness
  10885. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10886. @end table
  10887. @item ha/hadeblock[|difference[|flatness]]
  10888. Accurate horizontal deblocking filter
  10889. @table @option
  10890. @item difference
  10891. Difference factor where higher values mean more deblocking (default: @code{32}).
  10892. @item flatness
  10893. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10894. @end table
  10895. @item va/vadeblock[|difference[|flatness]]
  10896. Accurate vertical deblocking filter
  10897. @table @option
  10898. @item difference
  10899. Difference factor where higher values mean more deblocking (default: @code{32}).
  10900. @item flatness
  10901. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10902. @end table
  10903. @end table
  10904. The horizontal and vertical deblocking filters share the difference and
  10905. flatness values so you cannot set different horizontal and vertical
  10906. thresholds.
  10907. @table @option
  10908. @item h1/x1hdeblock
  10909. Experimental horizontal deblocking filter
  10910. @item v1/x1vdeblock
  10911. Experimental vertical deblocking filter
  10912. @item dr/dering
  10913. Deringing filter
  10914. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10915. @table @option
  10916. @item threshold1
  10917. larger -> stronger filtering
  10918. @item threshold2
  10919. larger -> stronger filtering
  10920. @item threshold3
  10921. larger -> stronger filtering
  10922. @end table
  10923. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10924. @table @option
  10925. @item f/fullyrange
  10926. Stretch luminance to @code{0-255}.
  10927. @end table
  10928. @item lb/linblenddeint
  10929. Linear blend deinterlacing filter that deinterlaces the given block by
  10930. filtering all lines with a @code{(1 2 1)} filter.
  10931. @item li/linipoldeint
  10932. Linear interpolating deinterlacing filter that deinterlaces the given block by
  10933. linearly interpolating every second line.
  10934. @item ci/cubicipoldeint
  10935. Cubic interpolating deinterlacing filter deinterlaces the given block by
  10936. cubically interpolating every second line.
  10937. @item md/mediandeint
  10938. Median deinterlacing filter that deinterlaces the given block by applying a
  10939. median filter to every second line.
  10940. @item fd/ffmpegdeint
  10941. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  10942. second line with a @code{(-1 4 2 4 -1)} filter.
  10943. @item l5/lowpass5
  10944. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  10945. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  10946. @item fq/forceQuant[|quantizer]
  10947. Overrides the quantizer table from the input with the constant quantizer you
  10948. specify.
  10949. @table @option
  10950. @item quantizer
  10951. Quantizer to use
  10952. @end table
  10953. @item de/default
  10954. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  10955. @item fa/fast
  10956. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  10957. @item ac
  10958. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  10959. @end table
  10960. @subsection Examples
  10961. @itemize
  10962. @item
  10963. Apply horizontal and vertical deblocking, deringing and automatic
  10964. brightness/contrast:
  10965. @example
  10966. pp=hb/vb/dr/al
  10967. @end example
  10968. @item
  10969. Apply default filters without brightness/contrast correction:
  10970. @example
  10971. pp=de/-al
  10972. @end example
  10973. @item
  10974. Apply default filters and temporal denoiser:
  10975. @example
  10976. pp=default/tmpnoise|1|2|3
  10977. @end example
  10978. @item
  10979. Apply deblocking on luminance only, and switch vertical deblocking on or off
  10980. automatically depending on available CPU time:
  10981. @example
  10982. pp=hb|y/vb|a
  10983. @end example
  10984. @end itemize
  10985. @section pp7
  10986. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  10987. similar to spp = 6 with 7 point DCT, where only the center sample is
  10988. used after IDCT.
  10989. The filter accepts the following options:
  10990. @table @option
  10991. @item qp
  10992. Force a constant quantization parameter. It accepts an integer in range
  10993. 0 to 63. If not set, the filter will use the QP from the video stream
  10994. (if available).
  10995. @item mode
  10996. Set thresholding mode. Available modes are:
  10997. @table @samp
  10998. @item hard
  10999. Set hard thresholding.
  11000. @item soft
  11001. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11002. @item medium
  11003. Set medium thresholding (good results, default).
  11004. @end table
  11005. @end table
  11006. @section premultiply
  11007. Apply alpha premultiply effect to input video stream using first plane
  11008. of second stream as alpha.
  11009. Both streams must have same dimensions and same pixel format.
  11010. The filter accepts the following option:
  11011. @table @option
  11012. @item planes
  11013. Set which planes will be processed, unprocessed planes will be copied.
  11014. By default value 0xf, all planes will be processed.
  11015. @item inplace
  11016. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11017. @end table
  11018. @section prewitt
  11019. Apply prewitt operator to input video stream.
  11020. The filter accepts the following option:
  11021. @table @option
  11022. @item planes
  11023. Set which planes will be processed, unprocessed planes will be copied.
  11024. By default value 0xf, all planes will be processed.
  11025. @item scale
  11026. Set value which will be multiplied with filtered result.
  11027. @item delta
  11028. Set value which will be added to filtered result.
  11029. @end table
  11030. @anchor{program_opencl}
  11031. @section program_opencl
  11032. Filter video using an OpenCL program.
  11033. @table @option
  11034. @item source
  11035. OpenCL program source file.
  11036. @item kernel
  11037. Kernel name in program.
  11038. @item inputs
  11039. Number of inputs to the filter. Defaults to 1.
  11040. @item size, s
  11041. Size of output frames. Defaults to the same as the first input.
  11042. @end table
  11043. The program source file must contain a kernel function with the given name,
  11044. which will be run once for each plane of the output. Each run on a plane
  11045. gets enqueued as a separate 2D global NDRange with one work-item for each
  11046. pixel to be generated. The global ID offset for each work-item is therefore
  11047. the coordinates of a pixel in the destination image.
  11048. The kernel function needs to take the following arguments:
  11049. @itemize
  11050. @item
  11051. Destination image, @var{__write_only image2d_t}.
  11052. This image will become the output; the kernel should write all of it.
  11053. @item
  11054. Frame index, @var{unsigned int}.
  11055. This is a counter starting from zero and increasing by one for each frame.
  11056. @item
  11057. Source images, @var{__read_only image2d_t}.
  11058. These are the most recent images on each input. The kernel may read from
  11059. them to generate the output, but they can't be written to.
  11060. @end itemize
  11061. Example programs:
  11062. @itemize
  11063. @item
  11064. Copy the input to the output (output must be the same size as the input).
  11065. @verbatim
  11066. __kernel void copy(__write_only image2d_t destination,
  11067. unsigned int index,
  11068. __read_only image2d_t source)
  11069. {
  11070. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  11071. int2 location = (int2)(get_global_id(0), get_global_id(1));
  11072. float4 value = read_imagef(source, sampler, location);
  11073. write_imagef(destination, location, value);
  11074. }
  11075. @end verbatim
  11076. @item
  11077. Apply a simple transformation, rotating the input by an amount increasing
  11078. with the index counter. Pixel values are linearly interpolated by the
  11079. sampler, and the output need not have the same dimensions as the input.
  11080. @verbatim
  11081. __kernel void rotate_image(__write_only image2d_t dst,
  11082. unsigned int index,
  11083. __read_only image2d_t src)
  11084. {
  11085. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  11086. CLK_FILTER_LINEAR);
  11087. float angle = (float)index / 100.0f;
  11088. float2 dst_dim = convert_float2(get_image_dim(dst));
  11089. float2 src_dim = convert_float2(get_image_dim(src));
  11090. float2 dst_cen = dst_dim / 2.0f;
  11091. float2 src_cen = src_dim / 2.0f;
  11092. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  11093. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  11094. float2 src_pos = {
  11095. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  11096. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  11097. };
  11098. src_pos = src_pos * src_dim / dst_dim;
  11099. float2 src_loc = src_pos + src_cen;
  11100. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  11101. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  11102. write_imagef(dst, dst_loc, 0.5f);
  11103. else
  11104. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  11105. }
  11106. @end verbatim
  11107. @item
  11108. Blend two inputs together, with the amount of each input used varying
  11109. with the index counter.
  11110. @verbatim
  11111. __kernel void blend_images(__write_only image2d_t dst,
  11112. unsigned int index,
  11113. __read_only image2d_t src1,
  11114. __read_only image2d_t src2)
  11115. {
  11116. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  11117. CLK_FILTER_LINEAR);
  11118. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  11119. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  11120. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  11121. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  11122. float4 val1 = read_imagef(src1, sampler, src1_loc);
  11123. float4 val2 = read_imagef(src2, sampler, src2_loc);
  11124. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  11125. }
  11126. @end verbatim
  11127. @end itemize
  11128. @section pseudocolor
  11129. Alter frame colors in video with pseudocolors.
  11130. This filter accepts the following options:
  11131. @table @option
  11132. @item c0
  11133. set pixel first component expression
  11134. @item c1
  11135. set pixel second component expression
  11136. @item c2
  11137. set pixel third component expression
  11138. @item c3
  11139. set pixel fourth component expression, corresponds to the alpha component
  11140. @item i
  11141. set component to use as base for altering colors
  11142. @end table
  11143. Each of them specifies the expression to use for computing the lookup table for
  11144. the corresponding pixel component values.
  11145. The expressions can contain the following constants and functions:
  11146. @table @option
  11147. @item w
  11148. @item h
  11149. The input width and height.
  11150. @item val
  11151. The input value for the pixel component.
  11152. @item ymin, umin, vmin, amin
  11153. The minimum allowed component value.
  11154. @item ymax, umax, vmax, amax
  11155. The maximum allowed component value.
  11156. @end table
  11157. All expressions default to "val".
  11158. @subsection Examples
  11159. @itemize
  11160. @item
  11161. Change too high luma values to gradient:
  11162. @example
  11163. 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'"
  11164. @end example
  11165. @end itemize
  11166. @section psnr
  11167. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  11168. Ratio) between two input videos.
  11169. This filter takes in input two input videos, the first input is
  11170. considered the "main" source and is passed unchanged to the
  11171. output. The second input is used as a "reference" video for computing
  11172. the PSNR.
  11173. Both video inputs must have the same resolution and pixel format for
  11174. this filter to work correctly. Also it assumes that both inputs
  11175. have the same number of frames, which are compared one by one.
  11176. The obtained average PSNR is printed through the logging system.
  11177. The filter stores the accumulated MSE (mean squared error) of each
  11178. frame, and at the end of the processing it is averaged across all frames
  11179. equally, and the following formula is applied to obtain the PSNR:
  11180. @example
  11181. PSNR = 10*log10(MAX^2/MSE)
  11182. @end example
  11183. Where MAX is the average of the maximum values of each component of the
  11184. image.
  11185. The description of the accepted parameters follows.
  11186. @table @option
  11187. @item stats_file, f
  11188. If specified the filter will use the named file to save the PSNR of
  11189. each individual frame. When filename equals "-" the data is sent to
  11190. standard output.
  11191. @item stats_version
  11192. Specifies which version of the stats file format to use. Details of
  11193. each format are written below.
  11194. Default value is 1.
  11195. @item stats_add_max
  11196. Determines whether the max value is output to the stats log.
  11197. Default value is 0.
  11198. Requires stats_version >= 2. If this is set and stats_version < 2,
  11199. the filter will return an error.
  11200. @end table
  11201. This filter also supports the @ref{framesync} options.
  11202. The file printed if @var{stats_file} is selected, contains a sequence of
  11203. key/value pairs of the form @var{key}:@var{value} for each compared
  11204. couple of frames.
  11205. If a @var{stats_version} greater than 1 is specified, a header line precedes
  11206. the list of per-frame-pair stats, with key value pairs following the frame
  11207. format with the following parameters:
  11208. @table @option
  11209. @item psnr_log_version
  11210. The version of the log file format. Will match @var{stats_version}.
  11211. @item fields
  11212. A comma separated list of the per-frame-pair parameters included in
  11213. the log.
  11214. @end table
  11215. A description of each shown per-frame-pair parameter follows:
  11216. @table @option
  11217. @item n
  11218. sequential number of the input frame, starting from 1
  11219. @item mse_avg
  11220. Mean Square Error pixel-by-pixel average difference of the compared
  11221. frames, averaged over all the image components.
  11222. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  11223. Mean Square Error pixel-by-pixel average difference of the compared
  11224. frames for the component specified by the suffix.
  11225. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  11226. Peak Signal to Noise ratio of the compared frames for the component
  11227. specified by the suffix.
  11228. @item max_avg, max_y, max_u, max_v
  11229. Maximum allowed value for each channel, and average over all
  11230. channels.
  11231. @end table
  11232. For example:
  11233. @example
  11234. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11235. [main][ref] psnr="stats_file=stats.log" [out]
  11236. @end example
  11237. On this example the input file being processed is compared with the
  11238. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  11239. is stored in @file{stats.log}.
  11240. @anchor{pullup}
  11241. @section pullup
  11242. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  11243. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  11244. content.
  11245. The pullup filter is designed to take advantage of future context in making
  11246. its decisions. This filter is stateless in the sense that it does not lock
  11247. onto a pattern to follow, but it instead looks forward to the following
  11248. fields in order to identify matches and rebuild progressive frames.
  11249. To produce content with an even framerate, insert the fps filter after
  11250. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  11251. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  11252. The filter accepts the following options:
  11253. @table @option
  11254. @item jl
  11255. @item jr
  11256. @item jt
  11257. @item jb
  11258. These options set the amount of "junk" to ignore at the left, right, top, and
  11259. bottom of the image, respectively. Left and right are in units of 8 pixels,
  11260. while top and bottom are in units of 2 lines.
  11261. The default is 8 pixels on each side.
  11262. @item sb
  11263. Set the strict breaks. Setting this option to 1 will reduce the chances of
  11264. filter generating an occasional mismatched frame, but it may also cause an
  11265. excessive number of frames to be dropped during high motion sequences.
  11266. Conversely, setting it to -1 will make filter match fields more easily.
  11267. This may help processing of video where there is slight blurring between
  11268. the fields, but may also cause there to be interlaced frames in the output.
  11269. Default value is @code{0}.
  11270. @item mp
  11271. Set the metric plane to use. It accepts the following values:
  11272. @table @samp
  11273. @item l
  11274. Use luma plane.
  11275. @item u
  11276. Use chroma blue plane.
  11277. @item v
  11278. Use chroma red plane.
  11279. @end table
  11280. This option may be set to use chroma plane instead of the default luma plane
  11281. for doing filter's computations. This may improve accuracy on very clean
  11282. source material, but more likely will decrease accuracy, especially if there
  11283. is chroma noise (rainbow effect) or any grayscale video.
  11284. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  11285. load and make pullup usable in realtime on slow machines.
  11286. @end table
  11287. For best results (without duplicated frames in the output file) it is
  11288. necessary to change the output frame rate. For example, to inverse
  11289. telecine NTSC input:
  11290. @example
  11291. ffmpeg -i input -vf pullup -r 24000/1001 ...
  11292. @end example
  11293. @section qp
  11294. Change video quantization parameters (QP).
  11295. The filter accepts the following option:
  11296. @table @option
  11297. @item qp
  11298. Set expression for quantization parameter.
  11299. @end table
  11300. The expression is evaluated through the eval API and can contain, among others,
  11301. the following constants:
  11302. @table @var
  11303. @item known
  11304. 1 if index is not 129, 0 otherwise.
  11305. @item qp
  11306. Sequential index starting from -129 to 128.
  11307. @end table
  11308. @subsection Examples
  11309. @itemize
  11310. @item
  11311. Some equation like:
  11312. @example
  11313. qp=2+2*sin(PI*qp)
  11314. @end example
  11315. @end itemize
  11316. @section random
  11317. Flush video frames from internal cache of frames into a random order.
  11318. No frame is discarded.
  11319. Inspired by @ref{frei0r} nervous filter.
  11320. @table @option
  11321. @item frames
  11322. Set size in number of frames of internal cache, in range from @code{2} to
  11323. @code{512}. Default is @code{30}.
  11324. @item seed
  11325. Set seed for random number generator, must be an integer included between
  11326. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11327. less than @code{0}, the filter will try to use a good random seed on a
  11328. best effort basis.
  11329. @end table
  11330. @section readeia608
  11331. Read closed captioning (EIA-608) information from the top lines of a video frame.
  11332. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  11333. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  11334. with EIA-608 data (starting from 0). A description of each metadata value follows:
  11335. @table @option
  11336. @item lavfi.readeia608.X.cc
  11337. The two bytes stored as EIA-608 data (printed in hexadecimal).
  11338. @item lavfi.readeia608.X.line
  11339. The number of the line on which the EIA-608 data was identified and read.
  11340. @end table
  11341. This filter accepts the following options:
  11342. @table @option
  11343. @item scan_min
  11344. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  11345. @item scan_max
  11346. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  11347. @item mac
  11348. Set minimal acceptable amplitude change for sync codes detection.
  11349. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  11350. @item spw
  11351. Set the ratio of width reserved for sync code detection.
  11352. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  11353. @item mhd
  11354. Set the max peaks height difference for sync code detection.
  11355. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11356. @item mpd
  11357. Set max peaks period difference for sync code detection.
  11358. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11359. @item msd
  11360. Set the first two max start code bits differences.
  11361. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  11362. @item bhd
  11363. Set the minimum ratio of bits height compared to 3rd start code bit.
  11364. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  11365. @item th_w
  11366. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  11367. @item th_b
  11368. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  11369. @item chp
  11370. Enable checking the parity bit. In the event of a parity error, the filter will output
  11371. @code{0x00} for that character. Default is false.
  11372. @item lp
  11373. Lowpass lines prior to further processing. Default is disabled.
  11374. @end table
  11375. @subsection Examples
  11376. @itemize
  11377. @item
  11378. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  11379. @example
  11380. 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
  11381. @end example
  11382. @end itemize
  11383. @section readvitc
  11384. Read vertical interval timecode (VITC) information from the top lines of a
  11385. video frame.
  11386. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  11387. timecode value, if a valid timecode has been detected. Further metadata key
  11388. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  11389. timecode data has been found or not.
  11390. This filter accepts the following options:
  11391. @table @option
  11392. @item scan_max
  11393. Set the maximum number of lines to scan for VITC data. If the value is set to
  11394. @code{-1} the full video frame is scanned. Default is @code{45}.
  11395. @item thr_b
  11396. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  11397. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  11398. @item thr_w
  11399. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  11400. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  11401. @end table
  11402. @subsection Examples
  11403. @itemize
  11404. @item
  11405. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  11406. draw @code{--:--:--:--} as a placeholder:
  11407. @example
  11408. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  11409. @end example
  11410. @end itemize
  11411. @section remap
  11412. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  11413. Destination pixel at position (X, Y) will be picked from source (x, y) position
  11414. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  11415. value for pixel will be used for destination pixel.
  11416. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  11417. will have Xmap/Ymap video stream dimensions.
  11418. Xmap and Ymap input video streams are 16bit depth, single channel.
  11419. @table @option
  11420. @item format
  11421. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  11422. Default is @code{color}.
  11423. @end table
  11424. @section removegrain
  11425. The removegrain filter is a spatial denoiser for progressive video.
  11426. @table @option
  11427. @item m0
  11428. Set mode for the first plane.
  11429. @item m1
  11430. Set mode for the second plane.
  11431. @item m2
  11432. Set mode for the third plane.
  11433. @item m3
  11434. Set mode for the fourth plane.
  11435. @end table
  11436. Range of mode is from 0 to 24. Description of each mode follows:
  11437. @table @var
  11438. @item 0
  11439. Leave input plane unchanged. Default.
  11440. @item 1
  11441. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  11442. @item 2
  11443. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  11444. @item 3
  11445. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  11446. @item 4
  11447. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  11448. This is equivalent to a median filter.
  11449. @item 5
  11450. Line-sensitive clipping giving the minimal change.
  11451. @item 6
  11452. Line-sensitive clipping, intermediate.
  11453. @item 7
  11454. Line-sensitive clipping, intermediate.
  11455. @item 8
  11456. Line-sensitive clipping, intermediate.
  11457. @item 9
  11458. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  11459. @item 10
  11460. Replaces the target pixel with the closest neighbour.
  11461. @item 11
  11462. [1 2 1] horizontal and vertical kernel blur.
  11463. @item 12
  11464. Same as mode 11.
  11465. @item 13
  11466. Bob mode, interpolates top field from the line where the neighbours
  11467. pixels are the closest.
  11468. @item 14
  11469. Bob mode, interpolates bottom field from the line where the neighbours
  11470. pixels are the closest.
  11471. @item 15
  11472. Bob mode, interpolates top field. Same as 13 but with a more complicated
  11473. interpolation formula.
  11474. @item 16
  11475. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  11476. interpolation formula.
  11477. @item 17
  11478. Clips the pixel with the minimum and maximum of respectively the maximum and
  11479. minimum of each pair of opposite neighbour pixels.
  11480. @item 18
  11481. Line-sensitive clipping using opposite neighbours whose greatest distance from
  11482. the current pixel is minimal.
  11483. @item 19
  11484. Replaces the pixel with the average of its 8 neighbours.
  11485. @item 20
  11486. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  11487. @item 21
  11488. Clips pixels using the averages of opposite neighbour.
  11489. @item 22
  11490. Same as mode 21 but simpler and faster.
  11491. @item 23
  11492. Small edge and halo removal, but reputed useless.
  11493. @item 24
  11494. Similar as 23.
  11495. @end table
  11496. @section removelogo
  11497. Suppress a TV station logo, using an image file to determine which
  11498. pixels comprise the logo. It works by filling in the pixels that
  11499. comprise the logo with neighboring pixels.
  11500. The filter accepts the following options:
  11501. @table @option
  11502. @item filename, f
  11503. Set the filter bitmap file, which can be any image format supported by
  11504. libavformat. The width and height of the image file must match those of the
  11505. video stream being processed.
  11506. @end table
  11507. Pixels in the provided bitmap image with a value of zero are not
  11508. considered part of the logo, non-zero pixels are considered part of
  11509. the logo. If you use white (255) for the logo and black (0) for the
  11510. rest, you will be safe. For making the filter bitmap, it is
  11511. recommended to take a screen capture of a black frame with the logo
  11512. visible, and then using a threshold filter followed by the erode
  11513. filter once or twice.
  11514. If needed, little splotches can be fixed manually. Remember that if
  11515. logo pixels are not covered, the filter quality will be much
  11516. reduced. Marking too many pixels as part of the logo does not hurt as
  11517. much, but it will increase the amount of blurring needed to cover over
  11518. the image and will destroy more information than necessary, and extra
  11519. pixels will slow things down on a large logo.
  11520. @section repeatfields
  11521. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  11522. fields based on its value.
  11523. @section reverse
  11524. Reverse a video clip.
  11525. Warning: This filter requires memory to buffer the entire clip, so trimming
  11526. is suggested.
  11527. @subsection Examples
  11528. @itemize
  11529. @item
  11530. Take the first 5 seconds of a clip, and reverse it.
  11531. @example
  11532. trim=end=5,reverse
  11533. @end example
  11534. @end itemize
  11535. @section rgbashift
  11536. Shift R/G/B/A pixels horizontally and/or vertically.
  11537. The filter accepts the following options:
  11538. @table @option
  11539. @item rh
  11540. Set amount to shift red horizontally.
  11541. @item rv
  11542. Set amount to shift red vertically.
  11543. @item gh
  11544. Set amount to shift green horizontally.
  11545. @item gv
  11546. Set amount to shift green vertically.
  11547. @item bh
  11548. Set amount to shift blue horizontally.
  11549. @item bv
  11550. Set amount to shift blue vertically.
  11551. @item ah
  11552. Set amount to shift alpha horizontally.
  11553. @item av
  11554. Set amount to shift alpha vertically.
  11555. @item edge
  11556. Set edge mode, can be @var{smear}, default, or @var{warp}.
  11557. @end table
  11558. @section roberts
  11559. Apply roberts cross operator to input video stream.
  11560. The filter accepts the following option:
  11561. @table @option
  11562. @item planes
  11563. Set which planes will be processed, unprocessed planes will be copied.
  11564. By default value 0xf, all planes will be processed.
  11565. @item scale
  11566. Set value which will be multiplied with filtered result.
  11567. @item delta
  11568. Set value which will be added to filtered result.
  11569. @end table
  11570. @section rotate
  11571. Rotate video by an arbitrary angle expressed in radians.
  11572. The filter accepts the following options:
  11573. A description of the optional parameters follows.
  11574. @table @option
  11575. @item angle, a
  11576. Set an expression for the angle by which to rotate the input video
  11577. clockwise, expressed as a number of radians. A negative value will
  11578. result in a counter-clockwise rotation. By default it is set to "0".
  11579. This expression is evaluated for each frame.
  11580. @item out_w, ow
  11581. Set the output width expression, default value is "iw".
  11582. This expression is evaluated just once during configuration.
  11583. @item out_h, oh
  11584. Set the output height expression, default value is "ih".
  11585. This expression is evaluated just once during configuration.
  11586. @item bilinear
  11587. Enable bilinear interpolation if set to 1, a value of 0 disables
  11588. it. Default value is 1.
  11589. @item fillcolor, c
  11590. Set the color used to fill the output area not covered by the rotated
  11591. image. For the general syntax of this option, check the
  11592. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11593. If the special value "none" is selected then no
  11594. background is printed (useful for example if the background is never shown).
  11595. Default value is "black".
  11596. @end table
  11597. The expressions for the angle and the output size can contain the
  11598. following constants and functions:
  11599. @table @option
  11600. @item n
  11601. sequential number of the input frame, starting from 0. It is always NAN
  11602. before the first frame is filtered.
  11603. @item t
  11604. time in seconds of the input frame, it is set to 0 when the filter is
  11605. configured. It is always NAN before the first frame is filtered.
  11606. @item hsub
  11607. @item vsub
  11608. horizontal and vertical chroma subsample values. For example for the
  11609. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11610. @item in_w, iw
  11611. @item in_h, ih
  11612. the input video width and height
  11613. @item out_w, ow
  11614. @item out_h, oh
  11615. the output width and height, that is the size of the padded area as
  11616. specified by the @var{width} and @var{height} expressions
  11617. @item rotw(a)
  11618. @item roth(a)
  11619. the minimal width/height required for completely containing the input
  11620. video rotated by @var{a} radians.
  11621. These are only available when computing the @option{out_w} and
  11622. @option{out_h} expressions.
  11623. @end table
  11624. @subsection Examples
  11625. @itemize
  11626. @item
  11627. Rotate the input by PI/6 radians clockwise:
  11628. @example
  11629. rotate=PI/6
  11630. @end example
  11631. @item
  11632. Rotate the input by PI/6 radians counter-clockwise:
  11633. @example
  11634. rotate=-PI/6
  11635. @end example
  11636. @item
  11637. Rotate the input by 45 degrees clockwise:
  11638. @example
  11639. rotate=45*PI/180
  11640. @end example
  11641. @item
  11642. Apply a constant rotation with period T, starting from an angle of PI/3:
  11643. @example
  11644. rotate=PI/3+2*PI*t/T
  11645. @end example
  11646. @item
  11647. Make the input video rotation oscillating with a period of T
  11648. seconds and an amplitude of A radians:
  11649. @example
  11650. rotate=A*sin(2*PI/T*t)
  11651. @end example
  11652. @item
  11653. Rotate the video, output size is chosen so that the whole rotating
  11654. input video is always completely contained in the output:
  11655. @example
  11656. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  11657. @end example
  11658. @item
  11659. Rotate the video, reduce the output size so that no background is ever
  11660. shown:
  11661. @example
  11662. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  11663. @end example
  11664. @end itemize
  11665. @subsection Commands
  11666. The filter supports the following commands:
  11667. @table @option
  11668. @item a, angle
  11669. Set the angle expression.
  11670. The command accepts the same syntax of the corresponding option.
  11671. If the specified expression is not valid, it is kept at its current
  11672. value.
  11673. @end table
  11674. @section sab
  11675. Apply Shape Adaptive Blur.
  11676. The filter accepts the following options:
  11677. @table @option
  11678. @item luma_radius, lr
  11679. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  11680. value is 1.0. A greater value will result in a more blurred image, and
  11681. in slower processing.
  11682. @item luma_pre_filter_radius, lpfr
  11683. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  11684. value is 1.0.
  11685. @item luma_strength, ls
  11686. Set luma maximum difference between pixels to still be considered, must
  11687. be a value in the 0.1-100.0 range, default value is 1.0.
  11688. @item chroma_radius, cr
  11689. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  11690. greater value will result in a more blurred image, and in slower
  11691. processing.
  11692. @item chroma_pre_filter_radius, cpfr
  11693. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  11694. @item chroma_strength, cs
  11695. Set chroma maximum difference between pixels to still be considered,
  11696. must be a value in the -0.9-100.0 range.
  11697. @end table
  11698. Each chroma option value, if not explicitly specified, is set to the
  11699. corresponding luma option value.
  11700. @anchor{scale}
  11701. @section scale
  11702. Scale (resize) the input video, using the libswscale library.
  11703. The scale filter forces the output display aspect ratio to be the same
  11704. of the input, by changing the output sample aspect ratio.
  11705. If the input image format is different from the format requested by
  11706. the next filter, the scale filter will convert the input to the
  11707. requested format.
  11708. @subsection Options
  11709. The filter accepts the following options, or any of the options
  11710. supported by the libswscale scaler.
  11711. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  11712. the complete list of scaler options.
  11713. @table @option
  11714. @item width, w
  11715. @item height, h
  11716. Set the output video dimension expression. Default value is the input
  11717. dimension.
  11718. If the @var{width} or @var{w} value is 0, the input width is used for
  11719. the output. If the @var{height} or @var{h} value is 0, the input height
  11720. is used for the output.
  11721. If one and only one of the values is -n with n >= 1, the scale filter
  11722. will use a value that maintains the aspect ratio of the input image,
  11723. calculated from the other specified dimension. After that it will,
  11724. however, make sure that the calculated dimension is divisible by n and
  11725. adjust the value if necessary.
  11726. If both values are -n with n >= 1, the behavior will be identical to
  11727. both values being set to 0 as previously detailed.
  11728. See below for the list of accepted constants for use in the dimension
  11729. expression.
  11730. @item eval
  11731. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  11732. @table @samp
  11733. @item init
  11734. Only evaluate expressions once during the filter initialization or when a command is processed.
  11735. @item frame
  11736. Evaluate expressions for each incoming frame.
  11737. @end table
  11738. Default value is @samp{init}.
  11739. @item interl
  11740. Set the interlacing mode. It accepts the following values:
  11741. @table @samp
  11742. @item 1
  11743. Force interlaced aware scaling.
  11744. @item 0
  11745. Do not apply interlaced scaling.
  11746. @item -1
  11747. Select interlaced aware scaling depending on whether the source frames
  11748. are flagged as interlaced or not.
  11749. @end table
  11750. Default value is @samp{0}.
  11751. @item flags
  11752. Set libswscale scaling flags. See
  11753. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11754. complete list of values. If not explicitly specified the filter applies
  11755. the default flags.
  11756. @item param0, param1
  11757. Set libswscale input parameters for scaling algorithms that need them. See
  11758. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11759. complete documentation. If not explicitly specified the filter applies
  11760. empty parameters.
  11761. @item size, s
  11762. Set the video size. For the syntax of this option, check the
  11763. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11764. @item in_color_matrix
  11765. @item out_color_matrix
  11766. Set in/output YCbCr color space type.
  11767. This allows the autodetected value to be overridden as well as allows forcing
  11768. a specific value used for the output and encoder.
  11769. If not specified, the color space type depends on the pixel format.
  11770. Possible values:
  11771. @table @samp
  11772. @item auto
  11773. Choose automatically.
  11774. @item bt709
  11775. Format conforming to International Telecommunication Union (ITU)
  11776. Recommendation BT.709.
  11777. @item fcc
  11778. Set color space conforming to the United States Federal Communications
  11779. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  11780. @item bt601
  11781. @item bt470
  11782. @item smpte170m
  11783. Set color space conforming to:
  11784. @itemize
  11785. @item
  11786. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  11787. @item
  11788. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  11789. @item
  11790. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  11791. @end itemize
  11792. @item smpte240m
  11793. Set color space conforming to SMPTE ST 240:1999.
  11794. @item bt2020
  11795. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  11796. @end table
  11797. @item in_range
  11798. @item out_range
  11799. Set in/output YCbCr sample range.
  11800. This allows the autodetected value to be overridden as well as allows forcing
  11801. a specific value used for the output and encoder. If not specified, the
  11802. range depends on the pixel format. Possible values:
  11803. @table @samp
  11804. @item auto/unknown
  11805. Choose automatically.
  11806. @item jpeg/full/pc
  11807. Set full range (0-255 in case of 8-bit luma).
  11808. @item mpeg/limited/tv
  11809. Set "MPEG" range (16-235 in case of 8-bit luma).
  11810. @end table
  11811. @item force_original_aspect_ratio
  11812. Enable decreasing or increasing output video width or height if necessary to
  11813. keep the original aspect ratio. Possible values:
  11814. @table @samp
  11815. @item disable
  11816. Scale the video as specified and disable this feature.
  11817. @item decrease
  11818. The output video dimensions will automatically be decreased if needed.
  11819. @item increase
  11820. The output video dimensions will automatically be increased if needed.
  11821. @end table
  11822. One useful instance of this option is that when you know a specific device's
  11823. maximum allowed resolution, you can use this to limit the output video to
  11824. that, while retaining the aspect ratio. For example, device A allows
  11825. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  11826. decrease) and specifying 1280x720 to the command line makes the output
  11827. 1280x533.
  11828. Please note that this is a different thing than specifying -1 for @option{w}
  11829. or @option{h}, you still need to specify the output resolution for this option
  11830. to work.
  11831. @item force_divisible_by Ensures that the output resolution is divisible by the
  11832. given integer when used together with @option{force_original_aspect_ratio}. This
  11833. works similar to using -n in the @option{w} and @option{h} options.
  11834. This option respects the value set for @option{force_original_aspect_ratio},
  11835. increasing or decreasing the resolution accordingly. This may slightly modify
  11836. the video's aspect ration.
  11837. This can be handy, for example, if you want to have a video fit within a defined
  11838. resolution using the @option{force_original_aspect_ratio} option but have
  11839. encoder restrictions when it comes to width or height.
  11840. @end table
  11841. The values of the @option{w} and @option{h} options are expressions
  11842. containing the following constants:
  11843. @table @var
  11844. @item in_w
  11845. @item in_h
  11846. The input width and height
  11847. @item iw
  11848. @item ih
  11849. These are the same as @var{in_w} and @var{in_h}.
  11850. @item out_w
  11851. @item out_h
  11852. The output (scaled) width and height
  11853. @item ow
  11854. @item oh
  11855. These are the same as @var{out_w} and @var{out_h}
  11856. @item a
  11857. The same as @var{iw} / @var{ih}
  11858. @item sar
  11859. input sample aspect ratio
  11860. @item dar
  11861. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11862. @item hsub
  11863. @item vsub
  11864. horizontal and vertical input chroma subsample values. For example for the
  11865. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11866. @item ohsub
  11867. @item ovsub
  11868. horizontal and vertical output chroma subsample values. For example for the
  11869. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11870. @end table
  11871. @subsection Examples
  11872. @itemize
  11873. @item
  11874. Scale the input video to a size of 200x100
  11875. @example
  11876. scale=w=200:h=100
  11877. @end example
  11878. This is equivalent to:
  11879. @example
  11880. scale=200:100
  11881. @end example
  11882. or:
  11883. @example
  11884. scale=200x100
  11885. @end example
  11886. @item
  11887. Specify a size abbreviation for the output size:
  11888. @example
  11889. scale=qcif
  11890. @end example
  11891. which can also be written as:
  11892. @example
  11893. scale=size=qcif
  11894. @end example
  11895. @item
  11896. Scale the input to 2x:
  11897. @example
  11898. scale=w=2*iw:h=2*ih
  11899. @end example
  11900. @item
  11901. The above is the same as:
  11902. @example
  11903. scale=2*in_w:2*in_h
  11904. @end example
  11905. @item
  11906. Scale the input to 2x with forced interlaced scaling:
  11907. @example
  11908. scale=2*iw:2*ih:interl=1
  11909. @end example
  11910. @item
  11911. Scale the input to half size:
  11912. @example
  11913. scale=w=iw/2:h=ih/2
  11914. @end example
  11915. @item
  11916. Increase the width, and set the height to the same size:
  11917. @example
  11918. scale=3/2*iw:ow
  11919. @end example
  11920. @item
  11921. Seek Greek harmony:
  11922. @example
  11923. scale=iw:1/PHI*iw
  11924. scale=ih*PHI:ih
  11925. @end example
  11926. @item
  11927. Increase the height, and set the width to 3/2 of the height:
  11928. @example
  11929. scale=w=3/2*oh:h=3/5*ih
  11930. @end example
  11931. @item
  11932. Increase the size, making the size a multiple of the chroma
  11933. subsample values:
  11934. @example
  11935. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  11936. @end example
  11937. @item
  11938. Increase the width to a maximum of 500 pixels,
  11939. keeping the same aspect ratio as the input:
  11940. @example
  11941. scale=w='min(500\, iw*3/2):h=-1'
  11942. @end example
  11943. @item
  11944. Make pixels square by combining scale and setsar:
  11945. @example
  11946. scale='trunc(ih*dar):ih',setsar=1/1
  11947. @end example
  11948. @item
  11949. Make pixels square by combining scale and setsar,
  11950. making sure the resulting resolution is even (required by some codecs):
  11951. @example
  11952. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  11953. @end example
  11954. @end itemize
  11955. @subsection Commands
  11956. This filter supports the following commands:
  11957. @table @option
  11958. @item width, w
  11959. @item height, h
  11960. Set the output video dimension expression.
  11961. The command accepts the same syntax of the corresponding option.
  11962. If the specified expression is not valid, it is kept at its current
  11963. value.
  11964. @end table
  11965. @section scale_npp
  11966. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  11967. format conversion on CUDA video frames. Setting the output width and height
  11968. works in the same way as for the @var{scale} filter.
  11969. The following additional options are accepted:
  11970. @table @option
  11971. @item format
  11972. The pixel format of the output CUDA frames. If set to the string "same" (the
  11973. default), the input format will be kept. Note that automatic format negotiation
  11974. and conversion is not yet supported for hardware frames
  11975. @item interp_algo
  11976. The interpolation algorithm used for resizing. One of the following:
  11977. @table @option
  11978. @item nn
  11979. Nearest neighbour.
  11980. @item linear
  11981. @item cubic
  11982. @item cubic2p_bspline
  11983. 2-parameter cubic (B=1, C=0)
  11984. @item cubic2p_catmullrom
  11985. 2-parameter cubic (B=0, C=1/2)
  11986. @item cubic2p_b05c03
  11987. 2-parameter cubic (B=1/2, C=3/10)
  11988. @item super
  11989. Supersampling
  11990. @item lanczos
  11991. @end table
  11992. @end table
  11993. @section scale2ref
  11994. Scale (resize) the input video, based on a reference video.
  11995. See the scale filter for available options, scale2ref supports the same but
  11996. uses the reference video instead of the main input as basis. scale2ref also
  11997. supports the following additional constants for the @option{w} and
  11998. @option{h} options:
  11999. @table @var
  12000. @item main_w
  12001. @item main_h
  12002. The main input video's width and height
  12003. @item main_a
  12004. The same as @var{main_w} / @var{main_h}
  12005. @item main_sar
  12006. The main input video's sample aspect ratio
  12007. @item main_dar, mdar
  12008. The main input video's display aspect ratio. Calculated from
  12009. @code{(main_w / main_h) * main_sar}.
  12010. @item main_hsub
  12011. @item main_vsub
  12012. The main input video's horizontal and vertical chroma subsample values.
  12013. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  12014. is 1.
  12015. @end table
  12016. @subsection Examples
  12017. @itemize
  12018. @item
  12019. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  12020. @example
  12021. 'scale2ref[b][a];[a][b]overlay'
  12022. @end example
  12023. @item
  12024. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  12025. @example
  12026. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  12027. @end example
  12028. @end itemize
  12029. @section scroll
  12030. Scroll input video horizontally and/or vertically by constant speed.
  12031. The filter accepts the following options:
  12032. @table @option
  12033. @item horizontal, h
  12034. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12035. Negative values changes scrolling direction.
  12036. @item vertical, v
  12037. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12038. Negative values changes scrolling direction.
  12039. @item hpos
  12040. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  12041. @item vpos
  12042. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  12043. @end table
  12044. @anchor{selectivecolor}
  12045. @section selectivecolor
  12046. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  12047. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  12048. by the "purity" of the color (that is, how saturated it already is).
  12049. This filter is similar to the Adobe Photoshop Selective Color tool.
  12050. The filter accepts the following options:
  12051. @table @option
  12052. @item correction_method
  12053. Select color correction method.
  12054. Available values are:
  12055. @table @samp
  12056. @item absolute
  12057. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  12058. component value).
  12059. @item relative
  12060. Specified adjustments are relative to the original component value.
  12061. @end table
  12062. Default is @code{absolute}.
  12063. @item reds
  12064. Adjustments for red pixels (pixels where the red component is the maximum)
  12065. @item yellows
  12066. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  12067. @item greens
  12068. Adjustments for green pixels (pixels where the green component is the maximum)
  12069. @item cyans
  12070. Adjustments for cyan pixels (pixels where the red component is the minimum)
  12071. @item blues
  12072. Adjustments for blue pixels (pixels where the blue component is the maximum)
  12073. @item magentas
  12074. Adjustments for magenta pixels (pixels where the green component is the minimum)
  12075. @item whites
  12076. Adjustments for white pixels (pixels where all components are greater than 128)
  12077. @item neutrals
  12078. Adjustments for all pixels except pure black and pure white
  12079. @item blacks
  12080. Adjustments for black pixels (pixels where all components are lesser than 128)
  12081. @item psfile
  12082. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  12083. @end table
  12084. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  12085. 4 space separated floating point adjustment values in the [-1,1] range,
  12086. respectively to adjust the amount of cyan, magenta, yellow and black for the
  12087. pixels of its range.
  12088. @subsection Examples
  12089. @itemize
  12090. @item
  12091. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  12092. increase magenta by 27% in blue areas:
  12093. @example
  12094. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  12095. @end example
  12096. @item
  12097. Use a Photoshop selective color preset:
  12098. @example
  12099. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  12100. @end example
  12101. @end itemize
  12102. @anchor{separatefields}
  12103. @section separatefields
  12104. The @code{separatefields} takes a frame-based video input and splits
  12105. each frame into its components fields, producing a new half height clip
  12106. with twice the frame rate and twice the frame count.
  12107. This filter use field-dominance information in frame to decide which
  12108. of each pair of fields to place first in the output.
  12109. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  12110. @section setdar, setsar
  12111. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  12112. output video.
  12113. This is done by changing the specified Sample (aka Pixel) Aspect
  12114. Ratio, according to the following equation:
  12115. @example
  12116. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  12117. @end example
  12118. Keep in mind that the @code{setdar} filter does not modify the pixel
  12119. dimensions of the video frame. Also, the display aspect ratio set by
  12120. this filter may be changed by later filters in the filterchain,
  12121. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  12122. applied.
  12123. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  12124. the filter output video.
  12125. Note that as a consequence of the application of this filter, the
  12126. output display aspect ratio will change according to the equation
  12127. above.
  12128. Keep in mind that the sample aspect ratio set by the @code{setsar}
  12129. filter may be changed by later filters in the filterchain, e.g. if
  12130. another "setsar" or a "setdar" filter is applied.
  12131. It accepts the following parameters:
  12132. @table @option
  12133. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  12134. Set the aspect ratio used by the filter.
  12135. The parameter can be a floating point number string, an expression, or
  12136. a string of the form @var{num}:@var{den}, where @var{num} and
  12137. @var{den} are the numerator and denominator of the aspect ratio. If
  12138. the parameter is not specified, it is assumed the value "0".
  12139. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  12140. should be escaped.
  12141. @item max
  12142. Set the maximum integer value to use for expressing numerator and
  12143. denominator when reducing the expressed aspect ratio to a rational.
  12144. Default value is @code{100}.
  12145. @end table
  12146. The parameter @var{sar} is an expression containing
  12147. the following constants:
  12148. @table @option
  12149. @item E, PI, PHI
  12150. These are approximated values for the mathematical constants e
  12151. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  12152. @item w, h
  12153. The input width and height.
  12154. @item a
  12155. These are the same as @var{w} / @var{h}.
  12156. @item sar
  12157. The input sample aspect ratio.
  12158. @item dar
  12159. The input display aspect ratio. It is the same as
  12160. (@var{w} / @var{h}) * @var{sar}.
  12161. @item hsub, vsub
  12162. Horizontal and vertical chroma subsample values. For example, for the
  12163. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12164. @end table
  12165. @subsection Examples
  12166. @itemize
  12167. @item
  12168. To change the display aspect ratio to 16:9, specify one of the following:
  12169. @example
  12170. setdar=dar=1.77777
  12171. setdar=dar=16/9
  12172. @end example
  12173. @item
  12174. To change the sample aspect ratio to 10:11, specify:
  12175. @example
  12176. setsar=sar=10/11
  12177. @end example
  12178. @item
  12179. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  12180. 1000 in the aspect ratio reduction, use the command:
  12181. @example
  12182. setdar=ratio=16/9:max=1000
  12183. @end example
  12184. @end itemize
  12185. @anchor{setfield}
  12186. @section setfield
  12187. Force field for the output video frame.
  12188. The @code{setfield} filter marks the interlace type field for the
  12189. output frames. It does not change the input frame, but only sets the
  12190. corresponding property, which affects how the frame is treated by
  12191. following filters (e.g. @code{fieldorder} or @code{yadif}).
  12192. The filter accepts the following options:
  12193. @table @option
  12194. @item mode
  12195. Available values are:
  12196. @table @samp
  12197. @item auto
  12198. Keep the same field property.
  12199. @item bff
  12200. Mark the frame as bottom-field-first.
  12201. @item tff
  12202. Mark the frame as top-field-first.
  12203. @item prog
  12204. Mark the frame as progressive.
  12205. @end table
  12206. @end table
  12207. @anchor{setparams}
  12208. @section setparams
  12209. Force frame parameter for the output video frame.
  12210. The @code{setparams} filter marks interlace and color range for the
  12211. output frames. It does not change the input frame, but only sets the
  12212. corresponding property, which affects how the frame is treated by
  12213. filters/encoders.
  12214. @table @option
  12215. @item field_mode
  12216. Available values are:
  12217. @table @samp
  12218. @item auto
  12219. Keep the same field property (default).
  12220. @item bff
  12221. Mark the frame as bottom-field-first.
  12222. @item tff
  12223. Mark the frame as top-field-first.
  12224. @item prog
  12225. Mark the frame as progressive.
  12226. @end table
  12227. @item range
  12228. Available values are:
  12229. @table @samp
  12230. @item auto
  12231. Keep the same color range property (default).
  12232. @item unspecified, unknown
  12233. Mark the frame as unspecified color range.
  12234. @item limited, tv, mpeg
  12235. Mark the frame as limited range.
  12236. @item full, pc, jpeg
  12237. Mark the frame as full range.
  12238. @end table
  12239. @item color_primaries
  12240. Set the color primaries.
  12241. Available values are:
  12242. @table @samp
  12243. @item auto
  12244. Keep the same color primaries property (default).
  12245. @item bt709
  12246. @item unknown
  12247. @item bt470m
  12248. @item bt470bg
  12249. @item smpte170m
  12250. @item smpte240m
  12251. @item film
  12252. @item bt2020
  12253. @item smpte428
  12254. @item smpte431
  12255. @item smpte432
  12256. @item jedec-p22
  12257. @end table
  12258. @item color_trc
  12259. Set the color transfer.
  12260. Available values are:
  12261. @table @samp
  12262. @item auto
  12263. Keep the same color trc property (default).
  12264. @item bt709
  12265. @item unknown
  12266. @item bt470m
  12267. @item bt470bg
  12268. @item smpte170m
  12269. @item smpte240m
  12270. @item linear
  12271. @item log100
  12272. @item log316
  12273. @item iec61966-2-4
  12274. @item bt1361e
  12275. @item iec61966-2-1
  12276. @item bt2020-10
  12277. @item bt2020-12
  12278. @item smpte2084
  12279. @item smpte428
  12280. @item arib-std-b67
  12281. @end table
  12282. @item colorspace
  12283. Set the colorspace.
  12284. Available values are:
  12285. @table @samp
  12286. @item auto
  12287. Keep the same colorspace property (default).
  12288. @item gbr
  12289. @item bt709
  12290. @item unknown
  12291. @item fcc
  12292. @item bt470bg
  12293. @item smpte170m
  12294. @item smpte240m
  12295. @item ycgco
  12296. @item bt2020nc
  12297. @item bt2020c
  12298. @item smpte2085
  12299. @item chroma-derived-nc
  12300. @item chroma-derived-c
  12301. @item ictcp
  12302. @end table
  12303. @end table
  12304. @section showinfo
  12305. Show a line containing various information for each input video frame.
  12306. The input video is not modified.
  12307. This filter supports the following options:
  12308. @table @option
  12309. @item checksum
  12310. Calculate checksums of each plane. By default enabled.
  12311. @end table
  12312. The shown line contains a sequence of key/value pairs of the form
  12313. @var{key}:@var{value}.
  12314. The following values are shown in the output:
  12315. @table @option
  12316. @item n
  12317. The (sequential) number of the input frame, starting from 0.
  12318. @item pts
  12319. The Presentation TimeStamp of the input frame, expressed as a number of
  12320. time base units. The time base unit depends on the filter input pad.
  12321. @item pts_time
  12322. The Presentation TimeStamp of the input frame, expressed as a number of
  12323. seconds.
  12324. @item pos
  12325. The position of the frame in the input stream, or -1 if this information is
  12326. unavailable and/or meaningless (for example in case of synthetic video).
  12327. @item fmt
  12328. The pixel format name.
  12329. @item sar
  12330. The sample aspect ratio of the input frame, expressed in the form
  12331. @var{num}/@var{den}.
  12332. @item s
  12333. The size of the input frame. For the syntax of this option, check the
  12334. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12335. @item i
  12336. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  12337. for bottom field first).
  12338. @item iskey
  12339. This is 1 if the frame is a key frame, 0 otherwise.
  12340. @item type
  12341. The picture type of the input frame ("I" for an I-frame, "P" for a
  12342. P-frame, "B" for a B-frame, or "?" for an unknown type).
  12343. Also refer to the documentation of the @code{AVPictureType} enum and of
  12344. the @code{av_get_picture_type_char} function defined in
  12345. @file{libavutil/avutil.h}.
  12346. @item checksum
  12347. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  12348. @item plane_checksum
  12349. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  12350. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  12351. @end table
  12352. @section showpalette
  12353. Displays the 256 colors palette of each frame. This filter is only relevant for
  12354. @var{pal8} pixel format frames.
  12355. It accepts the following option:
  12356. @table @option
  12357. @item s
  12358. Set the size of the box used to represent one palette color entry. Default is
  12359. @code{30} (for a @code{30x30} pixel box).
  12360. @end table
  12361. @section shuffleframes
  12362. Reorder and/or duplicate and/or drop video frames.
  12363. It accepts the following parameters:
  12364. @table @option
  12365. @item mapping
  12366. Set the destination indexes of input frames.
  12367. This is space or '|' separated list of indexes that maps input frames to output
  12368. frames. Number of indexes also sets maximal value that each index may have.
  12369. '-1' index have special meaning and that is to drop frame.
  12370. @end table
  12371. The first frame has the index 0. The default is to keep the input unchanged.
  12372. @subsection Examples
  12373. @itemize
  12374. @item
  12375. Swap second and third frame of every three frames of the input:
  12376. @example
  12377. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  12378. @end example
  12379. @item
  12380. Swap 10th and 1st frame of every ten frames of the input:
  12381. @example
  12382. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  12383. @end example
  12384. @end itemize
  12385. @section shuffleplanes
  12386. Reorder and/or duplicate video planes.
  12387. It accepts the following parameters:
  12388. @table @option
  12389. @item map0
  12390. The index of the input plane to be used as the first output plane.
  12391. @item map1
  12392. The index of the input plane to be used as the second output plane.
  12393. @item map2
  12394. The index of the input plane to be used as the third output plane.
  12395. @item map3
  12396. The index of the input plane to be used as the fourth output plane.
  12397. @end table
  12398. The first plane has the index 0. The default is to keep the input unchanged.
  12399. @subsection Examples
  12400. @itemize
  12401. @item
  12402. Swap the second and third planes of the input:
  12403. @example
  12404. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  12405. @end example
  12406. @end itemize
  12407. @anchor{signalstats}
  12408. @section signalstats
  12409. Evaluate various visual metrics that assist in determining issues associated
  12410. with the digitization of analog video media.
  12411. By default the filter will log these metadata values:
  12412. @table @option
  12413. @item YMIN
  12414. Display the minimal Y value contained within the input frame. Expressed in
  12415. range of [0-255].
  12416. @item YLOW
  12417. Display the Y value at the 10% percentile within the input frame. Expressed in
  12418. range of [0-255].
  12419. @item YAVG
  12420. Display the average Y value within the input frame. Expressed in range of
  12421. [0-255].
  12422. @item YHIGH
  12423. Display the Y value at the 90% percentile within the input frame. Expressed in
  12424. range of [0-255].
  12425. @item YMAX
  12426. Display the maximum Y value contained within the input frame. Expressed in
  12427. range of [0-255].
  12428. @item UMIN
  12429. Display the minimal U value contained within the input frame. Expressed in
  12430. range of [0-255].
  12431. @item ULOW
  12432. Display the U value at the 10% percentile within the input frame. Expressed in
  12433. range of [0-255].
  12434. @item UAVG
  12435. Display the average U value within the input frame. Expressed in range of
  12436. [0-255].
  12437. @item UHIGH
  12438. Display the U value at the 90% percentile within the input frame. Expressed in
  12439. range of [0-255].
  12440. @item UMAX
  12441. Display the maximum U value contained within the input frame. Expressed in
  12442. range of [0-255].
  12443. @item VMIN
  12444. Display the minimal V value contained within the input frame. Expressed in
  12445. range of [0-255].
  12446. @item VLOW
  12447. Display the V value at the 10% percentile within the input frame. Expressed in
  12448. range of [0-255].
  12449. @item VAVG
  12450. Display the average V value within the input frame. Expressed in range of
  12451. [0-255].
  12452. @item VHIGH
  12453. Display the V value at the 90% percentile within the input frame. Expressed in
  12454. range of [0-255].
  12455. @item VMAX
  12456. Display the maximum V value contained within the input frame. Expressed in
  12457. range of [0-255].
  12458. @item SATMIN
  12459. Display the minimal saturation value contained within the input frame.
  12460. Expressed in range of [0-~181.02].
  12461. @item SATLOW
  12462. Display the saturation value at the 10% percentile within the input frame.
  12463. Expressed in range of [0-~181.02].
  12464. @item SATAVG
  12465. Display the average saturation value within the input frame. Expressed in range
  12466. of [0-~181.02].
  12467. @item SATHIGH
  12468. Display the saturation value at the 90% percentile within the input frame.
  12469. Expressed in range of [0-~181.02].
  12470. @item SATMAX
  12471. Display the maximum saturation value contained within the input frame.
  12472. Expressed in range of [0-~181.02].
  12473. @item HUEMED
  12474. Display the median value for hue within the input frame. Expressed in range of
  12475. [0-360].
  12476. @item HUEAVG
  12477. Display the average value for hue within the input frame. Expressed in range of
  12478. [0-360].
  12479. @item YDIF
  12480. Display the average of sample value difference between all values of the Y
  12481. plane in the current frame and corresponding values of the previous input frame.
  12482. Expressed in range of [0-255].
  12483. @item UDIF
  12484. Display the average of sample value difference between all values of the U
  12485. plane in the current frame and corresponding values of the previous input frame.
  12486. Expressed in range of [0-255].
  12487. @item VDIF
  12488. Display the average of sample value difference between all values of the V
  12489. plane in the current frame and corresponding values of the previous input frame.
  12490. Expressed in range of [0-255].
  12491. @item YBITDEPTH
  12492. Display bit depth of Y plane in current frame.
  12493. Expressed in range of [0-16].
  12494. @item UBITDEPTH
  12495. Display bit depth of U plane in current frame.
  12496. Expressed in range of [0-16].
  12497. @item VBITDEPTH
  12498. Display bit depth of V plane in current frame.
  12499. Expressed in range of [0-16].
  12500. @end table
  12501. The filter accepts the following options:
  12502. @table @option
  12503. @item stat
  12504. @item out
  12505. @option{stat} specify an additional form of image analysis.
  12506. @option{out} output video with the specified type of pixel highlighted.
  12507. Both options accept the following values:
  12508. @table @samp
  12509. @item tout
  12510. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  12511. unlike the neighboring pixels of the same field. Examples of temporal outliers
  12512. include the results of video dropouts, head clogs, or tape tracking issues.
  12513. @item vrep
  12514. Identify @var{vertical line repetition}. Vertical line repetition includes
  12515. similar rows of pixels within a frame. In born-digital video vertical line
  12516. repetition is common, but this pattern is uncommon in video digitized from an
  12517. analog source. When it occurs in video that results from the digitization of an
  12518. analog source it can indicate concealment from a dropout compensator.
  12519. @item brng
  12520. Identify pixels that fall outside of legal broadcast range.
  12521. @end table
  12522. @item color, c
  12523. Set the highlight color for the @option{out} option. The default color is
  12524. yellow.
  12525. @end table
  12526. @subsection Examples
  12527. @itemize
  12528. @item
  12529. Output data of various video metrics:
  12530. @example
  12531. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  12532. @end example
  12533. @item
  12534. Output specific data about the minimum and maximum values of the Y plane per frame:
  12535. @example
  12536. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  12537. @end example
  12538. @item
  12539. Playback video while highlighting pixels that are outside of broadcast range in red.
  12540. @example
  12541. ffplay example.mov -vf signalstats="out=brng:color=red"
  12542. @end example
  12543. @item
  12544. Playback video with signalstats metadata drawn over the frame.
  12545. @example
  12546. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  12547. @end example
  12548. The contents of signalstat_drawtext.txt used in the command are:
  12549. @example
  12550. time %@{pts:hms@}
  12551. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  12552. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  12553. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  12554. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  12555. @end example
  12556. @end itemize
  12557. @anchor{signature}
  12558. @section signature
  12559. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  12560. input. In this case the matching between the inputs can be calculated additionally.
  12561. The filter always passes through the first input. The signature of each stream can
  12562. be written into a file.
  12563. It accepts the following options:
  12564. @table @option
  12565. @item detectmode
  12566. Enable or disable the matching process.
  12567. Available values are:
  12568. @table @samp
  12569. @item off
  12570. Disable the calculation of a matching (default).
  12571. @item full
  12572. Calculate the matching for the whole video and output whether the whole video
  12573. matches or only parts.
  12574. @item fast
  12575. Calculate only until a matching is found or the video ends. Should be faster in
  12576. some cases.
  12577. @end table
  12578. @item nb_inputs
  12579. Set the number of inputs. The option value must be a non negative integer.
  12580. Default value is 1.
  12581. @item filename
  12582. Set the path to which the output is written. If there is more than one input,
  12583. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  12584. integer), that will be replaced with the input number. If no filename is
  12585. specified, no output will be written. This is the default.
  12586. @item format
  12587. Choose the output format.
  12588. Available values are:
  12589. @table @samp
  12590. @item binary
  12591. Use the specified binary representation (default).
  12592. @item xml
  12593. Use the specified xml representation.
  12594. @end table
  12595. @item th_d
  12596. Set threshold to detect one word as similar. The option value must be an integer
  12597. greater than zero. The default value is 9000.
  12598. @item th_dc
  12599. Set threshold to detect all words as similar. The option value must be an integer
  12600. greater than zero. The default value is 60000.
  12601. @item th_xh
  12602. Set threshold to detect frames as similar. The option value must be an integer
  12603. greater than zero. The default value is 116.
  12604. @item th_di
  12605. Set the minimum length of a sequence in frames to recognize it as matching
  12606. sequence. The option value must be a non negative integer value.
  12607. The default value is 0.
  12608. @item th_it
  12609. Set the minimum relation, that matching frames to all frames must have.
  12610. The option value must be a double value between 0 and 1. The default value is 0.5.
  12611. @end table
  12612. @subsection Examples
  12613. @itemize
  12614. @item
  12615. To calculate the signature of an input video and store it in signature.bin:
  12616. @example
  12617. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  12618. @end example
  12619. @item
  12620. To detect whether two videos match and store the signatures in XML format in
  12621. signature0.xml and signature1.xml:
  12622. @example
  12623. 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 -
  12624. @end example
  12625. @end itemize
  12626. @anchor{smartblur}
  12627. @section smartblur
  12628. Blur the input video without impacting the outlines.
  12629. It accepts the following options:
  12630. @table @option
  12631. @item luma_radius, lr
  12632. Set the luma radius. The option value must be a float number in
  12633. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12634. used to blur the image (slower if larger). Default value is 1.0.
  12635. @item luma_strength, ls
  12636. Set the luma strength. The option value must be a float number
  12637. in the range [-1.0,1.0] that configures the blurring. A value included
  12638. in [0.0,1.0] will blur the image whereas a value included in
  12639. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  12640. @item luma_threshold, lt
  12641. Set the luma threshold used as a coefficient to determine
  12642. whether a pixel should be blurred or not. The option value must be an
  12643. integer in the range [-30,30]. A value of 0 will filter all the image,
  12644. a value included in [0,30] will filter flat areas and a value included
  12645. in [-30,0] will filter edges. Default value is 0.
  12646. @item chroma_radius, cr
  12647. Set the chroma radius. The option value must be a float number in
  12648. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12649. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  12650. @item chroma_strength, cs
  12651. Set the chroma strength. The option value must be a float number
  12652. in the range [-1.0,1.0] that configures the blurring. A value included
  12653. in [0.0,1.0] will blur the image whereas a value included in
  12654. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  12655. @item chroma_threshold, ct
  12656. Set the chroma threshold used as a coefficient to determine
  12657. whether a pixel should be blurred or not. The option value must be an
  12658. integer in the range [-30,30]. A value of 0 will filter all the image,
  12659. a value included in [0,30] will filter flat areas and a value included
  12660. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  12661. @end table
  12662. If a chroma option is not explicitly set, the corresponding luma value
  12663. is set.
  12664. @section sobel
  12665. Apply sobel operator to input video stream.
  12666. The filter accepts the following option:
  12667. @table @option
  12668. @item planes
  12669. Set which planes will be processed, unprocessed planes will be copied.
  12670. By default value 0xf, all planes will be processed.
  12671. @item scale
  12672. Set value which will be multiplied with filtered result.
  12673. @item delta
  12674. Set value which will be added to filtered result.
  12675. @end table
  12676. @anchor{spp}
  12677. @section spp
  12678. Apply a simple postprocessing filter that compresses and decompresses the image
  12679. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  12680. and average the results.
  12681. The filter accepts the following options:
  12682. @table @option
  12683. @item quality
  12684. Set quality. This option defines the number of levels for averaging. It accepts
  12685. an integer in the range 0-6. If set to @code{0}, the filter will have no
  12686. effect. A value of @code{6} means the higher quality. For each increment of
  12687. that value the speed drops by a factor of approximately 2. Default value is
  12688. @code{3}.
  12689. @item qp
  12690. Force a constant quantization parameter. If not set, the filter will use the QP
  12691. from the video stream (if available).
  12692. @item mode
  12693. Set thresholding mode. Available modes are:
  12694. @table @samp
  12695. @item hard
  12696. Set hard thresholding (default).
  12697. @item soft
  12698. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12699. @end table
  12700. @item use_bframe_qp
  12701. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  12702. option may cause flicker since the B-Frames have often larger QP. Default is
  12703. @code{0} (not enabled).
  12704. @end table
  12705. @section sr
  12706. Scale the input by applying one of the super-resolution methods based on
  12707. convolutional neural networks. Supported models:
  12708. @itemize
  12709. @item
  12710. Super-Resolution Convolutional Neural Network model (SRCNN).
  12711. See @url{https://arxiv.org/abs/1501.00092}.
  12712. @item
  12713. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  12714. See @url{https://arxiv.org/abs/1609.05158}.
  12715. @end itemize
  12716. Training scripts as well as scripts for model file (.pb) saving can be found at
  12717. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  12718. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  12719. Native model files (.model) can be generated from TensorFlow model
  12720. files (.pb) by using tools/python/convert.py
  12721. The filter accepts the following options:
  12722. @table @option
  12723. @item dnn_backend
  12724. Specify which DNN backend to use for model loading and execution. This option accepts
  12725. the following values:
  12726. @table @samp
  12727. @item native
  12728. Native implementation of DNN loading and execution.
  12729. @item tensorflow
  12730. TensorFlow backend. To enable this backend you
  12731. need to install the TensorFlow for C library (see
  12732. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  12733. @code{--enable-libtensorflow}
  12734. @end table
  12735. Default value is @samp{native}.
  12736. @item model
  12737. Set path to model file specifying network architecture and its parameters.
  12738. Note that different backends use different file formats. TensorFlow backend
  12739. can load files for both formats, while native backend can load files for only
  12740. its format.
  12741. @item scale_factor
  12742. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  12743. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  12744. input upscaled using bicubic upscaling with proper scale factor.
  12745. @end table
  12746. @section ssim
  12747. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  12748. This filter takes in input two input videos, the first input is
  12749. considered the "main" source and is passed unchanged to the
  12750. output. The second input is used as a "reference" video for computing
  12751. the SSIM.
  12752. Both video inputs must have the same resolution and pixel format for
  12753. this filter to work correctly. Also it assumes that both inputs
  12754. have the same number of frames, which are compared one by one.
  12755. The filter stores the calculated SSIM of each frame.
  12756. The description of the accepted parameters follows.
  12757. @table @option
  12758. @item stats_file, f
  12759. If specified the filter will use the named file to save the SSIM of
  12760. each individual frame. When filename equals "-" the data is sent to
  12761. standard output.
  12762. @end table
  12763. The file printed if @var{stats_file} is selected, contains a sequence of
  12764. key/value pairs of the form @var{key}:@var{value} for each compared
  12765. couple of frames.
  12766. A description of each shown parameter follows:
  12767. @table @option
  12768. @item n
  12769. sequential number of the input frame, starting from 1
  12770. @item Y, U, V, R, G, B
  12771. SSIM of the compared frames for the component specified by the suffix.
  12772. @item All
  12773. SSIM of the compared frames for the whole frame.
  12774. @item dB
  12775. Same as above but in dB representation.
  12776. @end table
  12777. This filter also supports the @ref{framesync} options.
  12778. For example:
  12779. @example
  12780. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12781. [main][ref] ssim="stats_file=stats.log" [out]
  12782. @end example
  12783. On this example the input file being processed is compared with the
  12784. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  12785. is stored in @file{stats.log}.
  12786. Another example with both psnr and ssim at same time:
  12787. @example
  12788. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  12789. @end example
  12790. @section stereo3d
  12791. Convert between different stereoscopic image formats.
  12792. The filters accept the following options:
  12793. @table @option
  12794. @item in
  12795. Set stereoscopic image format of input.
  12796. Available values for input image formats are:
  12797. @table @samp
  12798. @item sbsl
  12799. side by side parallel (left eye left, right eye right)
  12800. @item sbsr
  12801. side by side crosseye (right eye left, left eye right)
  12802. @item sbs2l
  12803. side by side parallel with half width resolution
  12804. (left eye left, right eye right)
  12805. @item sbs2r
  12806. side by side crosseye with half width resolution
  12807. (right eye left, left eye right)
  12808. @item abl
  12809. @item tbl
  12810. above-below (left eye above, right eye below)
  12811. @item abr
  12812. @item tbr
  12813. above-below (right eye above, left eye below)
  12814. @item ab2l
  12815. @item tb2l
  12816. above-below with half height resolution
  12817. (left eye above, right eye below)
  12818. @item ab2r
  12819. @item tb2r
  12820. above-below with half height resolution
  12821. (right eye above, left eye below)
  12822. @item al
  12823. alternating frames (left eye first, right eye second)
  12824. @item ar
  12825. alternating frames (right eye first, left eye second)
  12826. @item irl
  12827. interleaved rows (left eye has top row, right eye starts on next row)
  12828. @item irr
  12829. interleaved rows (right eye has top row, left eye starts on next row)
  12830. @item icl
  12831. interleaved columns, left eye first
  12832. @item icr
  12833. interleaved columns, right eye first
  12834. Default value is @samp{sbsl}.
  12835. @end table
  12836. @item out
  12837. Set stereoscopic image format of output.
  12838. @table @samp
  12839. @item sbsl
  12840. side by side parallel (left eye left, right eye right)
  12841. @item sbsr
  12842. side by side crosseye (right eye left, left eye right)
  12843. @item sbs2l
  12844. side by side parallel with half width resolution
  12845. (left eye left, right eye right)
  12846. @item sbs2r
  12847. side by side crosseye with half width resolution
  12848. (right eye left, left eye right)
  12849. @item abl
  12850. @item tbl
  12851. above-below (left eye above, right eye below)
  12852. @item abr
  12853. @item tbr
  12854. above-below (right eye above, left eye below)
  12855. @item ab2l
  12856. @item tb2l
  12857. above-below with half height resolution
  12858. (left eye above, right eye below)
  12859. @item ab2r
  12860. @item tb2r
  12861. above-below with half height resolution
  12862. (right eye above, left eye below)
  12863. @item al
  12864. alternating frames (left eye first, right eye second)
  12865. @item ar
  12866. alternating frames (right eye first, left eye second)
  12867. @item irl
  12868. interleaved rows (left eye has top row, right eye starts on next row)
  12869. @item irr
  12870. interleaved rows (right eye has top row, left eye starts on next row)
  12871. @item arbg
  12872. anaglyph red/blue gray
  12873. (red filter on left eye, blue filter on right eye)
  12874. @item argg
  12875. anaglyph red/green gray
  12876. (red filter on left eye, green filter on right eye)
  12877. @item arcg
  12878. anaglyph red/cyan gray
  12879. (red filter on left eye, cyan filter on right eye)
  12880. @item arch
  12881. anaglyph red/cyan half colored
  12882. (red filter on left eye, cyan filter on right eye)
  12883. @item arcc
  12884. anaglyph red/cyan color
  12885. (red filter on left eye, cyan filter on right eye)
  12886. @item arcd
  12887. anaglyph red/cyan color optimized with the least squares projection of dubois
  12888. (red filter on left eye, cyan filter on right eye)
  12889. @item agmg
  12890. anaglyph green/magenta gray
  12891. (green filter on left eye, magenta filter on right eye)
  12892. @item agmh
  12893. anaglyph green/magenta half colored
  12894. (green filter on left eye, magenta filter on right eye)
  12895. @item agmc
  12896. anaglyph green/magenta colored
  12897. (green filter on left eye, magenta filter on right eye)
  12898. @item agmd
  12899. anaglyph green/magenta color optimized with the least squares projection of dubois
  12900. (green filter on left eye, magenta filter on right eye)
  12901. @item aybg
  12902. anaglyph yellow/blue gray
  12903. (yellow filter on left eye, blue filter on right eye)
  12904. @item aybh
  12905. anaglyph yellow/blue half colored
  12906. (yellow filter on left eye, blue filter on right eye)
  12907. @item aybc
  12908. anaglyph yellow/blue colored
  12909. (yellow filter on left eye, blue filter on right eye)
  12910. @item aybd
  12911. anaglyph yellow/blue color optimized with the least squares projection of dubois
  12912. (yellow filter on left eye, blue filter on right eye)
  12913. @item ml
  12914. mono output (left eye only)
  12915. @item mr
  12916. mono output (right eye only)
  12917. @item chl
  12918. checkerboard, left eye first
  12919. @item chr
  12920. checkerboard, right eye first
  12921. @item icl
  12922. interleaved columns, left eye first
  12923. @item icr
  12924. interleaved columns, right eye first
  12925. @item hdmi
  12926. HDMI frame pack
  12927. @end table
  12928. Default value is @samp{arcd}.
  12929. @end table
  12930. @subsection Examples
  12931. @itemize
  12932. @item
  12933. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  12934. @example
  12935. stereo3d=sbsl:aybd
  12936. @end example
  12937. @item
  12938. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  12939. @example
  12940. stereo3d=abl:sbsr
  12941. @end example
  12942. @end itemize
  12943. @section streamselect, astreamselect
  12944. Select video or audio streams.
  12945. The filter accepts the following options:
  12946. @table @option
  12947. @item inputs
  12948. Set number of inputs. Default is 2.
  12949. @item map
  12950. Set input indexes to remap to outputs.
  12951. @end table
  12952. @subsection Commands
  12953. The @code{streamselect} and @code{astreamselect} filter supports the following
  12954. commands:
  12955. @table @option
  12956. @item map
  12957. Set input indexes to remap to outputs.
  12958. @end table
  12959. @subsection Examples
  12960. @itemize
  12961. @item
  12962. Select first 5 seconds 1st stream and rest of time 2nd stream:
  12963. @example
  12964. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  12965. @end example
  12966. @item
  12967. Same as above, but for audio:
  12968. @example
  12969. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  12970. @end example
  12971. @end itemize
  12972. @anchor{subtitles}
  12973. @section subtitles
  12974. Draw subtitles on top of input video using the libass library.
  12975. To enable compilation of this filter you need to configure FFmpeg with
  12976. @code{--enable-libass}. This filter also requires a build with libavcodec and
  12977. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  12978. Alpha) subtitles format.
  12979. The filter accepts the following options:
  12980. @table @option
  12981. @item filename, f
  12982. Set the filename of the subtitle file to read. It must be specified.
  12983. @item original_size
  12984. Specify the size of the original video, the video for which the ASS file
  12985. was composed. For the syntax of this option, check the
  12986. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12987. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  12988. correctly scale the fonts if the aspect ratio has been changed.
  12989. @item fontsdir
  12990. Set a directory path containing fonts that can be used by the filter.
  12991. These fonts will be used in addition to whatever the font provider uses.
  12992. @item alpha
  12993. Process alpha channel, by default alpha channel is untouched.
  12994. @item charenc
  12995. Set subtitles input character encoding. @code{subtitles} filter only. Only
  12996. useful if not UTF-8.
  12997. @item stream_index, si
  12998. Set subtitles stream index. @code{subtitles} filter only.
  12999. @item force_style
  13000. Override default style or script info parameters of the subtitles. It accepts a
  13001. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  13002. @end table
  13003. If the first key is not specified, it is assumed that the first value
  13004. specifies the @option{filename}.
  13005. For example, to render the file @file{sub.srt} on top of the input
  13006. video, use the command:
  13007. @example
  13008. subtitles=sub.srt
  13009. @end example
  13010. which is equivalent to:
  13011. @example
  13012. subtitles=filename=sub.srt
  13013. @end example
  13014. To render the default subtitles stream from file @file{video.mkv}, use:
  13015. @example
  13016. subtitles=video.mkv
  13017. @end example
  13018. To render the second subtitles stream from that file, use:
  13019. @example
  13020. subtitles=video.mkv:si=1
  13021. @end example
  13022. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  13023. @code{DejaVu Serif}, use:
  13024. @example
  13025. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  13026. @end example
  13027. @section super2xsai
  13028. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  13029. Interpolate) pixel art scaling algorithm.
  13030. Useful for enlarging pixel art images without reducing sharpness.
  13031. @section swaprect
  13032. Swap two rectangular objects in video.
  13033. This filter accepts the following options:
  13034. @table @option
  13035. @item w
  13036. Set object width.
  13037. @item h
  13038. Set object height.
  13039. @item x1
  13040. Set 1st rect x coordinate.
  13041. @item y1
  13042. Set 1st rect y coordinate.
  13043. @item x2
  13044. Set 2nd rect x coordinate.
  13045. @item y2
  13046. Set 2nd rect y coordinate.
  13047. All expressions are evaluated once for each frame.
  13048. @end table
  13049. The all options are expressions containing the following constants:
  13050. @table @option
  13051. @item w
  13052. @item h
  13053. The input width and height.
  13054. @item a
  13055. same as @var{w} / @var{h}
  13056. @item sar
  13057. input sample aspect ratio
  13058. @item dar
  13059. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  13060. @item n
  13061. The number of the input frame, starting from 0.
  13062. @item t
  13063. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  13064. @item pos
  13065. the position in the file of the input frame, NAN if unknown
  13066. @end table
  13067. @section swapuv
  13068. Swap U & V plane.
  13069. @section telecine
  13070. Apply telecine process to the video.
  13071. This filter accepts the following options:
  13072. @table @option
  13073. @item first_field
  13074. @table @samp
  13075. @item top, t
  13076. top field first
  13077. @item bottom, b
  13078. bottom field first
  13079. The default value is @code{top}.
  13080. @end table
  13081. @item pattern
  13082. A string of numbers representing the pulldown pattern you wish to apply.
  13083. The default value is @code{23}.
  13084. @end table
  13085. @example
  13086. Some typical patterns:
  13087. NTSC output (30i):
  13088. 27.5p: 32222
  13089. 24p: 23 (classic)
  13090. 24p: 2332 (preferred)
  13091. 20p: 33
  13092. 18p: 334
  13093. 16p: 3444
  13094. PAL output (25i):
  13095. 27.5p: 12222
  13096. 24p: 222222222223 ("Euro pulldown")
  13097. 16.67p: 33
  13098. 16p: 33333334
  13099. @end example
  13100. @section threshold
  13101. Apply threshold effect to video stream.
  13102. This filter needs four video streams to perform thresholding.
  13103. First stream is stream we are filtering.
  13104. Second stream is holding threshold values, third stream is holding min values,
  13105. and last, fourth stream is holding max values.
  13106. The filter accepts the following option:
  13107. @table @option
  13108. @item planes
  13109. Set which planes will be processed, unprocessed planes will be copied.
  13110. By default value 0xf, all planes will be processed.
  13111. @end table
  13112. For example if first stream pixel's component value is less then threshold value
  13113. of pixel component from 2nd threshold stream, third stream value will picked,
  13114. otherwise fourth stream pixel component value will be picked.
  13115. Using color source filter one can perform various types of thresholding:
  13116. @subsection Examples
  13117. @itemize
  13118. @item
  13119. Binary threshold, using gray color as threshold:
  13120. @example
  13121. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  13122. @end example
  13123. @item
  13124. Inverted binary threshold, using gray color as threshold:
  13125. @example
  13126. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  13127. @end example
  13128. @item
  13129. Truncate binary threshold, using gray color as threshold:
  13130. @example
  13131. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  13132. @end example
  13133. @item
  13134. Threshold to zero, using gray color as threshold:
  13135. @example
  13136. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  13137. @end example
  13138. @item
  13139. Inverted threshold to zero, using gray color as threshold:
  13140. @example
  13141. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  13142. @end example
  13143. @end itemize
  13144. @section thumbnail
  13145. Select the most representative frame in a given sequence of consecutive frames.
  13146. The filter accepts the following options:
  13147. @table @option
  13148. @item n
  13149. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  13150. will pick one of them, and then handle the next batch of @var{n} frames until
  13151. the end. Default is @code{100}.
  13152. @end table
  13153. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  13154. value will result in a higher memory usage, so a high value is not recommended.
  13155. @subsection Examples
  13156. @itemize
  13157. @item
  13158. Extract one picture each 50 frames:
  13159. @example
  13160. thumbnail=50
  13161. @end example
  13162. @item
  13163. Complete example of a thumbnail creation with @command{ffmpeg}:
  13164. @example
  13165. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  13166. @end example
  13167. @end itemize
  13168. @section tile
  13169. Tile several successive frames together.
  13170. The filter accepts the following options:
  13171. @table @option
  13172. @item layout
  13173. Set the grid size (i.e. the number of lines and columns). For the syntax of
  13174. this option, check the
  13175. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13176. @item nb_frames
  13177. Set the maximum number of frames to render in the given area. It must be less
  13178. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  13179. the area will be used.
  13180. @item margin
  13181. Set the outer border margin in pixels.
  13182. @item padding
  13183. Set the inner border thickness (i.e. the number of pixels between frames). For
  13184. more advanced padding options (such as having different values for the edges),
  13185. refer to the pad video filter.
  13186. @item color
  13187. Specify the color of the unused area. For the syntax of this option, check the
  13188. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13189. The default value of @var{color} is "black".
  13190. @item overlap
  13191. Set the number of frames to overlap when tiling several successive frames together.
  13192. The value must be between @code{0} and @var{nb_frames - 1}.
  13193. @item init_padding
  13194. Set the number of frames to initially be empty before displaying first output frame.
  13195. This controls how soon will one get first output frame.
  13196. The value must be between @code{0} and @var{nb_frames - 1}.
  13197. @end table
  13198. @subsection Examples
  13199. @itemize
  13200. @item
  13201. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  13202. @example
  13203. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  13204. @end example
  13205. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  13206. duplicating each output frame to accommodate the originally detected frame
  13207. rate.
  13208. @item
  13209. Display @code{5} pictures in an area of @code{3x2} frames,
  13210. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  13211. mixed flat and named options:
  13212. @example
  13213. tile=3x2:nb_frames=5:padding=7:margin=2
  13214. @end example
  13215. @end itemize
  13216. @section tinterlace
  13217. Perform various types of temporal field interlacing.
  13218. Frames are counted starting from 1, so the first input frame is
  13219. considered odd.
  13220. The filter accepts the following options:
  13221. @table @option
  13222. @item mode
  13223. Specify the mode of the interlacing. This option can also be specified
  13224. as a value alone. See below for a list of values for this option.
  13225. Available values are:
  13226. @table @samp
  13227. @item merge, 0
  13228. Move odd frames into the upper field, even into the lower field,
  13229. generating a double height frame at half frame rate.
  13230. @example
  13231. ------> time
  13232. Input:
  13233. Frame 1 Frame 2 Frame 3 Frame 4
  13234. 11111 22222 33333 44444
  13235. 11111 22222 33333 44444
  13236. 11111 22222 33333 44444
  13237. 11111 22222 33333 44444
  13238. Output:
  13239. 11111 33333
  13240. 22222 44444
  13241. 11111 33333
  13242. 22222 44444
  13243. 11111 33333
  13244. 22222 44444
  13245. 11111 33333
  13246. 22222 44444
  13247. @end example
  13248. @item drop_even, 1
  13249. Only output odd frames, even frames are dropped, generating a frame with
  13250. unchanged height at half frame rate.
  13251. @example
  13252. ------> time
  13253. Input:
  13254. Frame 1 Frame 2 Frame 3 Frame 4
  13255. 11111 22222 33333 44444
  13256. 11111 22222 33333 44444
  13257. 11111 22222 33333 44444
  13258. 11111 22222 33333 44444
  13259. Output:
  13260. 11111 33333
  13261. 11111 33333
  13262. 11111 33333
  13263. 11111 33333
  13264. @end example
  13265. @item drop_odd, 2
  13266. Only output even frames, odd frames are dropped, generating a frame with
  13267. unchanged height at half frame rate.
  13268. @example
  13269. ------> time
  13270. Input:
  13271. Frame 1 Frame 2 Frame 3 Frame 4
  13272. 11111 22222 33333 44444
  13273. 11111 22222 33333 44444
  13274. 11111 22222 33333 44444
  13275. 11111 22222 33333 44444
  13276. Output:
  13277. 22222 44444
  13278. 22222 44444
  13279. 22222 44444
  13280. 22222 44444
  13281. @end example
  13282. @item pad, 3
  13283. Expand each frame to full height, but pad alternate lines with black,
  13284. generating a frame with double height at the same input 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. ..... 22222 ..... 44444
  13296. 11111 ..... 33333 .....
  13297. ..... 22222 ..... 44444
  13298. 11111 ..... 33333 .....
  13299. ..... 22222 ..... 44444
  13300. 11111 ..... 33333 .....
  13301. ..... 22222 ..... 44444
  13302. @end example
  13303. @item interleave_top, 4
  13304. Interleave the upper field from odd frames with the lower field from
  13305. even frames, generating a frame with unchanged height at half frame rate.
  13306. @example
  13307. ------> time
  13308. Input:
  13309. Frame 1 Frame 2 Frame 3 Frame 4
  13310. 11111<- 22222 33333<- 44444
  13311. 11111 22222<- 33333 44444<-
  13312. 11111<- 22222 33333<- 44444
  13313. 11111 22222<- 33333 44444<-
  13314. Output:
  13315. 11111 33333
  13316. 22222 44444
  13317. 11111 33333
  13318. 22222 44444
  13319. @end example
  13320. @item interleave_bottom, 5
  13321. Interleave the lower field from odd frames with the upper field from
  13322. even frames, generating a frame with unchanged height at half frame rate.
  13323. @example
  13324. ------> time
  13325. Input:
  13326. Frame 1 Frame 2 Frame 3 Frame 4
  13327. 11111 22222<- 33333 44444<-
  13328. 11111<- 22222 33333<- 44444
  13329. 11111 22222<- 33333 44444<-
  13330. 11111<- 22222 33333<- 44444
  13331. Output:
  13332. 22222 44444
  13333. 11111 33333
  13334. 22222 44444
  13335. 11111 33333
  13336. @end example
  13337. @item interlacex2, 6
  13338. Double frame rate with unchanged height. Frames are inserted each
  13339. containing the second temporal field from the previous input frame and
  13340. the first temporal field from the next input frame. This mode relies on
  13341. the top_field_first flag. Useful for interlaced video displays with no
  13342. field synchronisation.
  13343. @example
  13344. ------> time
  13345. Input:
  13346. Frame 1 Frame 2 Frame 3 Frame 4
  13347. 11111 22222 33333 44444
  13348. 11111 22222 33333 44444
  13349. 11111 22222 33333 44444
  13350. 11111 22222 33333 44444
  13351. Output:
  13352. 11111 22222 22222 33333 33333 44444 44444
  13353. 11111 11111 22222 22222 33333 33333 44444
  13354. 11111 22222 22222 33333 33333 44444 44444
  13355. 11111 11111 22222 22222 33333 33333 44444
  13356. @end example
  13357. @item mergex2, 7
  13358. Move odd frames into the upper field, even into the lower field,
  13359. generating a double height frame at same frame rate.
  13360. @example
  13361. ------> time
  13362. Input:
  13363. Frame 1 Frame 2 Frame 3 Frame 4
  13364. 11111 22222 33333 44444
  13365. 11111 22222 33333 44444
  13366. 11111 22222 33333 44444
  13367. 11111 22222 33333 44444
  13368. Output:
  13369. 11111 33333 33333 55555
  13370. 22222 22222 44444 44444
  13371. 11111 33333 33333 55555
  13372. 22222 22222 44444 44444
  13373. 11111 33333 33333 55555
  13374. 22222 22222 44444 44444
  13375. 11111 33333 33333 55555
  13376. 22222 22222 44444 44444
  13377. @end example
  13378. @end table
  13379. Numeric values are deprecated but are accepted for backward
  13380. compatibility reasons.
  13381. Default mode is @code{merge}.
  13382. @item flags
  13383. Specify flags influencing the filter process.
  13384. Available value for @var{flags} is:
  13385. @table @option
  13386. @item low_pass_filter, vlpf
  13387. Enable linear vertical low-pass filtering in the filter.
  13388. Vertical low-pass filtering is required when creating an interlaced
  13389. destination from a progressive source which contains high-frequency
  13390. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  13391. patterning.
  13392. @item complex_filter, cvlpf
  13393. Enable complex vertical low-pass filtering.
  13394. This will slightly less reduce interlace 'twitter' and Moire
  13395. patterning but better retain detail and subjective sharpness impression.
  13396. @end table
  13397. Vertical low-pass filtering can only be enabled for @option{mode}
  13398. @var{interleave_top} and @var{interleave_bottom}.
  13399. @end table
  13400. @section tmix
  13401. Mix successive video frames.
  13402. A description of the accepted options follows.
  13403. @table @option
  13404. @item frames
  13405. The number of successive frames to mix. If unspecified, it defaults to 3.
  13406. @item weights
  13407. Specify weight of each input video frame.
  13408. Each weight is separated by space. If number of weights is smaller than
  13409. number of @var{frames} last specified weight will be used for all remaining
  13410. unset weights.
  13411. @item scale
  13412. Specify scale, if it is set it will be multiplied with sum
  13413. of each weight multiplied with pixel values to give final destination
  13414. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13415. @end table
  13416. @subsection Examples
  13417. @itemize
  13418. @item
  13419. Average 7 successive frames:
  13420. @example
  13421. tmix=frames=7:weights="1 1 1 1 1 1 1"
  13422. @end example
  13423. @item
  13424. Apply simple temporal convolution:
  13425. @example
  13426. tmix=frames=3:weights="-1 3 -1"
  13427. @end example
  13428. @item
  13429. Similar as above but only showing temporal differences:
  13430. @example
  13431. tmix=frames=3:weights="-1 2 -1":scale=1
  13432. @end example
  13433. @end itemize
  13434. @anchor{tonemap}
  13435. @section tonemap
  13436. Tone map colors from different dynamic ranges.
  13437. This filter expects data in single precision floating point, as it needs to
  13438. operate on (and can output) out-of-range values. Another filter, such as
  13439. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  13440. The tonemapping algorithms implemented only work on linear light, so input
  13441. data should be linearized beforehand (and possibly correctly tagged).
  13442. @example
  13443. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  13444. @end example
  13445. @subsection Options
  13446. The filter accepts the following options.
  13447. @table @option
  13448. @item tonemap
  13449. Set the tone map algorithm to use.
  13450. Possible values are:
  13451. @table @var
  13452. @item none
  13453. Do not apply any tone map, only desaturate overbright pixels.
  13454. @item clip
  13455. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  13456. in-range values, while distorting out-of-range values.
  13457. @item linear
  13458. Stretch the entire reference gamut to a linear multiple of the display.
  13459. @item gamma
  13460. Fit a logarithmic transfer between the tone curves.
  13461. @item reinhard
  13462. Preserve overall image brightness with a simple curve, using nonlinear
  13463. contrast, which results in flattening details and degrading color accuracy.
  13464. @item hable
  13465. Preserve both dark and bright details better than @var{reinhard}, at the cost
  13466. of slightly darkening everything. Use it when detail preservation is more
  13467. important than color and brightness accuracy.
  13468. @item mobius
  13469. Smoothly map out-of-range values, while retaining contrast and colors for
  13470. in-range material as much as possible. Use it when color accuracy is more
  13471. important than detail preservation.
  13472. @end table
  13473. Default is none.
  13474. @item param
  13475. Tune the tone mapping algorithm.
  13476. This affects the following algorithms:
  13477. @table @var
  13478. @item none
  13479. Ignored.
  13480. @item linear
  13481. Specifies the scale factor to use while stretching.
  13482. Default to 1.0.
  13483. @item gamma
  13484. Specifies the exponent of the function.
  13485. Default to 1.8.
  13486. @item clip
  13487. Specify an extra linear coefficient to multiply into the signal before clipping.
  13488. Default to 1.0.
  13489. @item reinhard
  13490. Specify the local contrast coefficient at the display peak.
  13491. Default to 0.5, which means that in-gamut values will be about half as bright
  13492. as when clipping.
  13493. @item hable
  13494. Ignored.
  13495. @item mobius
  13496. Specify the transition point from linear to mobius transform. Every value
  13497. below this point is guaranteed to be mapped 1:1. The higher the value, the
  13498. more accurate the result will be, at the cost of losing bright details.
  13499. Default to 0.3, which due to the steep initial slope still preserves in-range
  13500. colors fairly accurately.
  13501. @end table
  13502. @item desat
  13503. Apply desaturation for highlights that exceed this level of brightness. The
  13504. higher the parameter, the more color information will be preserved. This
  13505. setting helps prevent unnaturally blown-out colors for super-highlights, by
  13506. (smoothly) turning into white instead. This makes images feel more natural,
  13507. at the cost of reducing information about out-of-range colors.
  13508. The default of 2.0 is somewhat conservative and will mostly just apply to
  13509. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  13510. This option works only if the input frame has a supported color tag.
  13511. @item peak
  13512. Override signal/nominal/reference peak with this value. Useful when the
  13513. embedded peak information in display metadata is not reliable or when tone
  13514. mapping from a lower range to a higher range.
  13515. @end table
  13516. @section tpad
  13517. Temporarily pad video frames.
  13518. The filter accepts the following options:
  13519. @table @option
  13520. @item start
  13521. Specify number of delay frames before input video stream.
  13522. @item stop
  13523. Specify number of padding frames after input video stream.
  13524. Set to -1 to pad indefinitely.
  13525. @item start_mode
  13526. Set kind of frames added to beginning of stream.
  13527. Can be either @var{add} or @var{clone}.
  13528. With @var{add} frames of solid-color are added.
  13529. With @var{clone} frames are clones of first frame.
  13530. @item stop_mode
  13531. Set kind of frames added to end of stream.
  13532. Can be either @var{add} or @var{clone}.
  13533. With @var{add} frames of solid-color are added.
  13534. With @var{clone} frames are clones of last frame.
  13535. @item start_duration, stop_duration
  13536. Specify the duration of the start/stop delay. See
  13537. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13538. for the accepted syntax.
  13539. These options override @var{start} and @var{stop}.
  13540. @item color
  13541. Specify the color of the padded area. For the syntax of this option,
  13542. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  13543. manual,ffmpeg-utils}.
  13544. The default value of @var{color} is "black".
  13545. @end table
  13546. @anchor{transpose}
  13547. @section transpose
  13548. Transpose rows with columns in the input video and optionally flip it.
  13549. It accepts the following parameters:
  13550. @table @option
  13551. @item dir
  13552. Specify the transposition direction.
  13553. Can assume the following values:
  13554. @table @samp
  13555. @item 0, 4, cclock_flip
  13556. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  13557. @example
  13558. L.R L.l
  13559. . . -> . .
  13560. l.r R.r
  13561. @end example
  13562. @item 1, 5, clock
  13563. Rotate by 90 degrees clockwise, that is:
  13564. @example
  13565. L.R l.L
  13566. . . -> . .
  13567. l.r r.R
  13568. @end example
  13569. @item 2, 6, cclock
  13570. Rotate by 90 degrees counterclockwise, that is:
  13571. @example
  13572. L.R R.r
  13573. . . -> . .
  13574. l.r L.l
  13575. @end example
  13576. @item 3, 7, clock_flip
  13577. Rotate by 90 degrees clockwise and vertically flip, that is:
  13578. @example
  13579. L.R r.R
  13580. . . -> . .
  13581. l.r l.L
  13582. @end example
  13583. @end table
  13584. For values between 4-7, the transposition is only done if the input
  13585. video geometry is portrait and not landscape. These values are
  13586. deprecated, the @code{passthrough} option should be used instead.
  13587. Numerical values are deprecated, and should be dropped in favor of
  13588. symbolic constants.
  13589. @item passthrough
  13590. Do not apply the transposition if the input geometry matches the one
  13591. specified by the specified value. It accepts the following values:
  13592. @table @samp
  13593. @item none
  13594. Always apply transposition.
  13595. @item portrait
  13596. Preserve portrait geometry (when @var{height} >= @var{width}).
  13597. @item landscape
  13598. Preserve landscape geometry (when @var{width} >= @var{height}).
  13599. @end table
  13600. Default value is @code{none}.
  13601. @end table
  13602. For example to rotate by 90 degrees clockwise and preserve portrait
  13603. layout:
  13604. @example
  13605. transpose=dir=1:passthrough=portrait
  13606. @end example
  13607. The command above can also be specified as:
  13608. @example
  13609. transpose=1:portrait
  13610. @end example
  13611. @section transpose_npp
  13612. Transpose rows with columns in the input video and optionally flip it.
  13613. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  13614. It accepts the following parameters:
  13615. @table @option
  13616. @item dir
  13617. Specify the transposition direction.
  13618. Can assume the following values:
  13619. @table @samp
  13620. @item cclock_flip
  13621. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  13622. @item clock
  13623. Rotate by 90 degrees clockwise.
  13624. @item cclock
  13625. Rotate by 90 degrees counterclockwise.
  13626. @item clock_flip
  13627. Rotate by 90 degrees clockwise and vertically flip.
  13628. @end table
  13629. @item passthrough
  13630. Do not apply the transposition if the input geometry matches the one
  13631. specified by the specified value. It accepts the following values:
  13632. @table @samp
  13633. @item none
  13634. Always apply transposition. (default)
  13635. @item portrait
  13636. Preserve portrait geometry (when @var{height} >= @var{width}).
  13637. @item landscape
  13638. Preserve landscape geometry (when @var{width} >= @var{height}).
  13639. @end table
  13640. @end table
  13641. @section trim
  13642. Trim the input so that the output contains one continuous subpart of the input.
  13643. It accepts the following parameters:
  13644. @table @option
  13645. @item start
  13646. Specify the time of the start of the kept section, i.e. the frame with the
  13647. timestamp @var{start} will be the first frame in the output.
  13648. @item end
  13649. Specify the time of the first frame that will be dropped, i.e. the frame
  13650. immediately preceding the one with the timestamp @var{end} will be the last
  13651. frame in the output.
  13652. @item start_pts
  13653. This is the same as @var{start}, except this option sets the start timestamp
  13654. in timebase units instead of seconds.
  13655. @item end_pts
  13656. This is the same as @var{end}, except this option sets the end timestamp
  13657. in timebase units instead of seconds.
  13658. @item duration
  13659. The maximum duration of the output in seconds.
  13660. @item start_frame
  13661. The number of the first frame that should be passed to the output.
  13662. @item end_frame
  13663. The number of the first frame that should be dropped.
  13664. @end table
  13665. @option{start}, @option{end}, and @option{duration} are expressed as time
  13666. duration specifications; see
  13667. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13668. for the accepted syntax.
  13669. Note that the first two sets of the start/end options and the @option{duration}
  13670. option look at the frame timestamp, while the _frame variants simply count the
  13671. frames that pass through the filter. Also note that this filter does not modify
  13672. the timestamps. If you wish for the output timestamps to start at zero, insert a
  13673. setpts filter after the trim filter.
  13674. If multiple start or end options are set, this filter tries to be greedy and
  13675. keep all the frames that match at least one of the specified constraints. To keep
  13676. only the part that matches all the constraints at once, chain multiple trim
  13677. filters.
  13678. The defaults are such that all the input is kept. So it is possible to set e.g.
  13679. just the end values to keep everything before the specified time.
  13680. Examples:
  13681. @itemize
  13682. @item
  13683. Drop everything except the second minute of input:
  13684. @example
  13685. ffmpeg -i INPUT -vf trim=60:120
  13686. @end example
  13687. @item
  13688. Keep only the first second:
  13689. @example
  13690. ffmpeg -i INPUT -vf trim=duration=1
  13691. @end example
  13692. @end itemize
  13693. @section unpremultiply
  13694. Apply alpha unpremultiply effect to input video stream using first plane
  13695. of second stream as alpha.
  13696. Both streams must have same dimensions and same pixel format.
  13697. The filter accepts the following option:
  13698. @table @option
  13699. @item planes
  13700. Set which planes will be processed, unprocessed planes will be copied.
  13701. By default value 0xf, all planes will be processed.
  13702. If the format has 1 or 2 components, then luma is bit 0.
  13703. If the format has 3 or 4 components:
  13704. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  13705. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  13706. If present, the alpha channel is always the last bit.
  13707. @item inplace
  13708. Do not require 2nd input for processing, instead use alpha plane from input stream.
  13709. @end table
  13710. @anchor{unsharp}
  13711. @section unsharp
  13712. Sharpen or blur the input video.
  13713. It accepts the following parameters:
  13714. @table @option
  13715. @item luma_msize_x, lx
  13716. Set the luma matrix horizontal size. It must be an odd integer between
  13717. 3 and 23. The default value is 5.
  13718. @item luma_msize_y, ly
  13719. Set the luma matrix vertical size. It must be an odd integer between 3
  13720. and 23. The default value is 5.
  13721. @item luma_amount, la
  13722. Set the luma effect strength. It must be a floating point number, reasonable
  13723. values lay between -1.5 and 1.5.
  13724. Negative values will blur the input video, while positive values will
  13725. sharpen it, a value of zero will disable the effect.
  13726. Default value is 1.0.
  13727. @item chroma_msize_x, cx
  13728. Set the chroma matrix horizontal size. It must be an odd integer
  13729. between 3 and 23. The default value is 5.
  13730. @item chroma_msize_y, cy
  13731. Set the chroma matrix vertical size. It must be an odd integer
  13732. between 3 and 23. The default value is 5.
  13733. @item chroma_amount, ca
  13734. Set the chroma effect strength. It must be a floating point number, reasonable
  13735. values lay between -1.5 and 1.5.
  13736. Negative values will blur the input video, while positive values will
  13737. sharpen it, a value of zero will disable the effect.
  13738. Default value is 0.0.
  13739. @end table
  13740. All parameters are optional and default to the equivalent of the
  13741. string '5:5:1.0:5:5:0.0'.
  13742. @subsection Examples
  13743. @itemize
  13744. @item
  13745. Apply strong luma sharpen effect:
  13746. @example
  13747. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  13748. @end example
  13749. @item
  13750. Apply a strong blur of both luma and chroma parameters:
  13751. @example
  13752. unsharp=7:7:-2:7:7:-2
  13753. @end example
  13754. @end itemize
  13755. @section uspp
  13756. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  13757. the image at several (or - in the case of @option{quality} level @code{8} - all)
  13758. shifts and average the results.
  13759. The way this differs from the behavior of spp is that uspp actually encodes &
  13760. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  13761. DCT similar to MJPEG.
  13762. The filter accepts the following options:
  13763. @table @option
  13764. @item quality
  13765. Set quality. This option defines the number of levels for averaging. It accepts
  13766. an integer in the range 0-8. If set to @code{0}, the filter will have no
  13767. effect. A value of @code{8} means the higher quality. For each increment of
  13768. that value the speed drops by a factor of approximately 2. Default value is
  13769. @code{3}.
  13770. @item qp
  13771. Force a constant quantization parameter. If not set, the filter will use the QP
  13772. from the video stream (if available).
  13773. @end table
  13774. @section v360
  13775. Convert 360 videos between various formats.
  13776. The filter accepts the following options:
  13777. @table @option
  13778. @item input
  13779. @item output
  13780. Set format of the input/output video.
  13781. Available formats:
  13782. @table @samp
  13783. @item e
  13784. @item equirect
  13785. Equirectangular projection.
  13786. @item c3x2
  13787. @item c6x1
  13788. @item c1x6
  13789. Cubemap with 3x2/6x1/1x6 layout.
  13790. Format specific options:
  13791. @table @option
  13792. @item in_pad
  13793. @item out_pad
  13794. Set padding proportion for the input/output cubemap. Values in decimals.
  13795. Example values:
  13796. @table @samp
  13797. @item 0
  13798. No padding.
  13799. @item 0.01
  13800. 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)
  13801. @end table
  13802. Default value is @b{@samp{0}}.
  13803. @item fin_pad
  13804. @item fout_pad
  13805. Set fixed padding for the input/output cubemap. Values in pixels.
  13806. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  13807. @item in_forder
  13808. @item out_forder
  13809. Set order of faces for the input/output cubemap. Choose one direction for each position.
  13810. Designation of directions:
  13811. @table @samp
  13812. @item r
  13813. right
  13814. @item l
  13815. left
  13816. @item u
  13817. up
  13818. @item d
  13819. down
  13820. @item f
  13821. forward
  13822. @item b
  13823. back
  13824. @end table
  13825. Default value is @b{@samp{rludfb}}.
  13826. @item in_frot
  13827. @item out_frot
  13828. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  13829. Designation of angles:
  13830. @table @samp
  13831. @item 0
  13832. 0 degrees clockwise
  13833. @item 1
  13834. 90 degrees clockwise
  13835. @item 2
  13836. 180 degrees clockwise
  13837. @item 3
  13838. 270 degrees clockwise
  13839. @end table
  13840. Default value is @b{@samp{000000}}.
  13841. @end table
  13842. @item eac
  13843. Equi-Angular Cubemap.
  13844. @item flat
  13845. @item gnomonic
  13846. @item rectilinear
  13847. Regular video. @i{(output only)}
  13848. Format specific options:
  13849. @table @option
  13850. @item h_fov
  13851. @item v_fov
  13852. @item d_fov
  13853. Set horizontal/vertical/diagonal field of view. Values in degrees.
  13854. If diagonal field of view is set it overrides horizontal and vertical field of view.
  13855. @end table
  13856. @item dfisheye
  13857. Dual fisheye.
  13858. Format specific options:
  13859. @table @option
  13860. @item in_pad
  13861. @item out_pad
  13862. Set padding proportion. Values in decimals.
  13863. Example values:
  13864. @table @samp
  13865. @item 0
  13866. No padding.
  13867. @item 0.01
  13868. 1% padding.
  13869. @end table
  13870. Default value is @b{@samp{0}}.
  13871. @end table
  13872. @item barrel
  13873. @item fb
  13874. Facebook's 360 format.
  13875. @item sg
  13876. Stereographic format.
  13877. Format specific options:
  13878. @table @option
  13879. @item h_fov
  13880. @item v_fov
  13881. @item d_fov
  13882. Set horizontal/vertical/diagonal field of view. Values in degrees.
  13883. If diagonal field of view is set it overrides horizontal and vertical field of view.
  13884. @end table
  13885. @item mercator
  13886. Mercator format.
  13887. @item ball
  13888. Ball format, gives significant distortion toward the back.
  13889. @item hammer
  13890. Hammer-Aitoff map projection format.
  13891. @item sinusoidal
  13892. Sinusoidal map projection format.
  13893. @end table
  13894. @item interp
  13895. Set interpolation method.@*
  13896. @i{Note: more complex interpolation methods require much more memory to run.}
  13897. Available methods:
  13898. @table @samp
  13899. @item near
  13900. @item nearest
  13901. Nearest neighbour.
  13902. @item line
  13903. @item linear
  13904. Bilinear interpolation.
  13905. @item cube
  13906. @item cubic
  13907. Bicubic interpolation.
  13908. @item lanc
  13909. @item lanczos
  13910. Lanczos interpolation.
  13911. @end table
  13912. Default value is @b{@samp{line}}.
  13913. @item w
  13914. @item h
  13915. Set the output video resolution.
  13916. Default resolution depends on formats.
  13917. @item in_stereo
  13918. @item out_stereo
  13919. Set the input/output stereo format.
  13920. @table @samp
  13921. @item 2d
  13922. 2D mono
  13923. @item sbs
  13924. Side by side
  13925. @item tb
  13926. Top bottom
  13927. @end table
  13928. Default value is @b{@samp{2d}} for input and output format.
  13929. @item yaw
  13930. @item pitch
  13931. @item roll
  13932. Set rotation for the output video. Values in degrees.
  13933. @item rorder
  13934. Set rotation order for the output video. Choose one item for each position.
  13935. @table @samp
  13936. @item y, Y
  13937. yaw
  13938. @item p, P
  13939. pitch
  13940. @item r, R
  13941. roll
  13942. @end table
  13943. Default value is @b{@samp{ypr}}.
  13944. @item h_flip
  13945. @item v_flip
  13946. @item d_flip
  13947. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  13948. @item ih_flip
  13949. @item iv_flip
  13950. Set if input video is flipped horizontally/vertically. Boolean values.
  13951. @item in_trans
  13952. Set if input video is transposed. Boolean value, by default disabled.
  13953. @item out_trans
  13954. Set if output video needs to be transposed. Boolean value, by default disabled.
  13955. @end table
  13956. @subsection Examples
  13957. @itemize
  13958. @item
  13959. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  13960. @example
  13961. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  13962. @end example
  13963. @item
  13964. Extract back view of Equi-Angular Cubemap:
  13965. @example
  13966. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  13967. @end example
  13968. @item
  13969. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  13970. @example
  13971. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  13972. @end example
  13973. @end itemize
  13974. @section vaguedenoiser
  13975. Apply a wavelet based denoiser.
  13976. It transforms each frame from the video input into the wavelet domain,
  13977. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  13978. the obtained coefficients. It does an inverse wavelet transform after.
  13979. Due to wavelet properties, it should give a nice smoothed result, and
  13980. reduced noise, without blurring picture features.
  13981. This filter accepts the following options:
  13982. @table @option
  13983. @item threshold
  13984. The filtering strength. The higher, the more filtered the video will be.
  13985. Hard thresholding can use a higher threshold than soft thresholding
  13986. before the video looks overfiltered. Default value is 2.
  13987. @item method
  13988. The filtering method the filter will use.
  13989. It accepts the following values:
  13990. @table @samp
  13991. @item hard
  13992. All values under the threshold will be zeroed.
  13993. @item soft
  13994. All values under the threshold will be zeroed. All values above will be
  13995. reduced by the threshold.
  13996. @item garrote
  13997. Scales or nullifies coefficients - intermediary between (more) soft and
  13998. (less) hard thresholding.
  13999. @end table
  14000. Default is garrote.
  14001. @item nsteps
  14002. Number of times, the wavelet will decompose the picture. Picture can't
  14003. be decomposed beyond a particular point (typically, 8 for a 640x480
  14004. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  14005. @item percent
  14006. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  14007. @item planes
  14008. A list of the planes to process. By default all planes are processed.
  14009. @end table
  14010. @section vectorscope
  14011. Display 2 color component values in the two dimensional graph (which is called
  14012. a vectorscope).
  14013. This filter accepts the following options:
  14014. @table @option
  14015. @item mode, m
  14016. Set vectorscope mode.
  14017. It accepts the following values:
  14018. @table @samp
  14019. @item gray
  14020. Gray values are displayed on graph, higher brightness means more pixels have
  14021. same component color value on location in graph. This is the default mode.
  14022. @item color
  14023. Gray values are displayed on graph. Surrounding pixels values which are not
  14024. present in video frame are drawn in gradient of 2 color components which are
  14025. set by option @code{x} and @code{y}. The 3rd color component is static.
  14026. @item color2
  14027. Actual color components values present in video frame are displayed on graph.
  14028. @item color3
  14029. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  14030. on graph increases value of another color component, which is luminance by
  14031. default values of @code{x} and @code{y}.
  14032. @item color4
  14033. Actual colors present in video frame are displayed on graph. If two different
  14034. colors map to same position on graph then color with higher value of component
  14035. not present in graph is picked.
  14036. @item color5
  14037. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  14038. component picked from radial gradient.
  14039. @end table
  14040. @item x
  14041. Set which color component will be represented on X-axis. Default is @code{1}.
  14042. @item y
  14043. Set which color component will be represented on Y-axis. Default is @code{2}.
  14044. @item intensity, i
  14045. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  14046. of color component which represents frequency of (X, Y) location in graph.
  14047. @item envelope, e
  14048. @table @samp
  14049. @item none
  14050. No envelope, this is default.
  14051. @item instant
  14052. Instant envelope, even darkest single pixel will be clearly highlighted.
  14053. @item peak
  14054. Hold maximum and minimum values presented in graph over time. This way you
  14055. can still spot out of range values without constantly looking at vectorscope.
  14056. @item peak+instant
  14057. Peak and instant envelope combined together.
  14058. @end table
  14059. @item graticule, g
  14060. Set what kind of graticule to draw.
  14061. @table @samp
  14062. @item none
  14063. @item green
  14064. @item color
  14065. @end table
  14066. @item opacity, o
  14067. Set graticule opacity.
  14068. @item flags, f
  14069. Set graticule flags.
  14070. @table @samp
  14071. @item white
  14072. Draw graticule for white point.
  14073. @item black
  14074. Draw graticule for black point.
  14075. @item name
  14076. Draw color points short names.
  14077. @end table
  14078. @item bgopacity, b
  14079. Set background opacity.
  14080. @item lthreshold, l
  14081. Set low threshold for color component not represented on X or Y axis.
  14082. Values lower than this value will be ignored. Default is 0.
  14083. Note this value is multiplied with actual max possible value one pixel component
  14084. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  14085. is 0.1 * 255 = 25.
  14086. @item hthreshold, h
  14087. Set high threshold for color component not represented on X or Y axis.
  14088. Values higher than this value will be ignored. Default is 1.
  14089. Note this value is multiplied with actual max possible value one pixel component
  14090. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  14091. is 0.9 * 255 = 230.
  14092. @item colorspace, c
  14093. Set what kind of colorspace to use when drawing graticule.
  14094. @table @samp
  14095. @item auto
  14096. @item 601
  14097. @item 709
  14098. @end table
  14099. Default is auto.
  14100. @end table
  14101. @anchor{vidstabdetect}
  14102. @section vidstabdetect
  14103. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  14104. @ref{vidstabtransform} for pass 2.
  14105. This filter generates a file with relative translation and rotation
  14106. transform information about subsequent frames, which is then used by
  14107. the @ref{vidstabtransform} filter.
  14108. To enable compilation of this filter you need to configure FFmpeg with
  14109. @code{--enable-libvidstab}.
  14110. This filter accepts the following options:
  14111. @table @option
  14112. @item result
  14113. Set the path to the file used to write the transforms information.
  14114. Default value is @file{transforms.trf}.
  14115. @item shakiness
  14116. Set how shaky the video is and how quick the camera is. It accepts an
  14117. integer in the range 1-10, a value of 1 means little shakiness, a
  14118. value of 10 means strong shakiness. Default value is 5.
  14119. @item accuracy
  14120. Set the accuracy of the detection process. It must be a value in the
  14121. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  14122. accuracy. Default value is 15.
  14123. @item stepsize
  14124. Set stepsize of the search process. The region around minimum is
  14125. scanned with 1 pixel resolution. Default value is 6.
  14126. @item mincontrast
  14127. Set minimum contrast. Below this value a local measurement field is
  14128. discarded. Must be a floating point value in the range 0-1. Default
  14129. value is 0.3.
  14130. @item tripod
  14131. Set reference frame number for tripod mode.
  14132. If enabled, the motion of the frames is compared to a reference frame
  14133. in the filtered stream, identified by the specified number. The idea
  14134. is to compensate all movements in a more-or-less static scene and keep
  14135. the camera view absolutely still.
  14136. If set to 0, it is disabled. The frames are counted starting from 1.
  14137. @item show
  14138. Show fields and transforms in the resulting frames. It accepts an
  14139. integer in the range 0-2. Default value is 0, which disables any
  14140. visualization.
  14141. @end table
  14142. @subsection Examples
  14143. @itemize
  14144. @item
  14145. Use default values:
  14146. @example
  14147. vidstabdetect
  14148. @end example
  14149. @item
  14150. Analyze strongly shaky movie and put the results in file
  14151. @file{mytransforms.trf}:
  14152. @example
  14153. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  14154. @end example
  14155. @item
  14156. Visualize the result of internal transformations in the resulting
  14157. video:
  14158. @example
  14159. vidstabdetect=show=1
  14160. @end example
  14161. @item
  14162. Analyze a video with medium shakiness using @command{ffmpeg}:
  14163. @example
  14164. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  14165. @end example
  14166. @end itemize
  14167. @anchor{vidstabtransform}
  14168. @section vidstabtransform
  14169. Video stabilization/deshaking: pass 2 of 2,
  14170. see @ref{vidstabdetect} for pass 1.
  14171. Read a file with transform information for each frame and
  14172. apply/compensate them. Together with the @ref{vidstabdetect}
  14173. filter this can be used to deshake videos. See also
  14174. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  14175. the @ref{unsharp} filter, see below.
  14176. To enable compilation of this filter you need to configure FFmpeg with
  14177. @code{--enable-libvidstab}.
  14178. @subsection Options
  14179. @table @option
  14180. @item input
  14181. Set path to the file used to read the transforms. Default value is
  14182. @file{transforms.trf}.
  14183. @item smoothing
  14184. Set the number of frames (value*2 + 1) used for lowpass filtering the
  14185. camera movements. Default value is 10.
  14186. For example a number of 10 means that 21 frames are used (10 in the
  14187. past and 10 in the future) to smoothen the motion in the video. A
  14188. larger value leads to a smoother video, but limits the acceleration of
  14189. the camera (pan/tilt movements). 0 is a special case where a static
  14190. camera is simulated.
  14191. @item optalgo
  14192. Set the camera path optimization algorithm.
  14193. Accepted values are:
  14194. @table @samp
  14195. @item gauss
  14196. gaussian kernel low-pass filter on camera motion (default)
  14197. @item avg
  14198. averaging on transformations
  14199. @end table
  14200. @item maxshift
  14201. Set maximal number of pixels to translate frames. Default value is -1,
  14202. meaning no limit.
  14203. @item maxangle
  14204. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  14205. value is -1, meaning no limit.
  14206. @item crop
  14207. Specify how to deal with borders that may be visible due to movement
  14208. compensation.
  14209. Available values are:
  14210. @table @samp
  14211. @item keep
  14212. keep image information from previous frame (default)
  14213. @item black
  14214. fill the border black
  14215. @end table
  14216. @item invert
  14217. Invert transforms if set to 1. Default value is 0.
  14218. @item relative
  14219. Consider transforms as relative to previous frame if set to 1,
  14220. absolute if set to 0. Default value is 0.
  14221. @item zoom
  14222. Set percentage to zoom. A positive value will result in a zoom-in
  14223. effect, a negative value in a zoom-out effect. Default value is 0 (no
  14224. zoom).
  14225. @item optzoom
  14226. Set optimal zooming to avoid borders.
  14227. Accepted values are:
  14228. @table @samp
  14229. @item 0
  14230. disabled
  14231. @item 1
  14232. optimal static zoom value is determined (only very strong movements
  14233. will lead to visible borders) (default)
  14234. @item 2
  14235. optimal adaptive zoom value is determined (no borders will be
  14236. visible), see @option{zoomspeed}
  14237. @end table
  14238. Note that the value given at zoom is added to the one calculated here.
  14239. @item zoomspeed
  14240. Set percent to zoom maximally each frame (enabled when
  14241. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  14242. 0.25.
  14243. @item interpol
  14244. Specify type of interpolation.
  14245. Available values are:
  14246. @table @samp
  14247. @item no
  14248. no interpolation
  14249. @item linear
  14250. linear only horizontal
  14251. @item bilinear
  14252. linear in both directions (default)
  14253. @item bicubic
  14254. cubic in both directions (slow)
  14255. @end table
  14256. @item tripod
  14257. Enable virtual tripod mode if set to 1, which is equivalent to
  14258. @code{relative=0:smoothing=0}. Default value is 0.
  14259. Use also @code{tripod} option of @ref{vidstabdetect}.
  14260. @item debug
  14261. Increase log verbosity if set to 1. Also the detected global motions
  14262. are written to the temporary file @file{global_motions.trf}. Default
  14263. value is 0.
  14264. @end table
  14265. @subsection Examples
  14266. @itemize
  14267. @item
  14268. Use @command{ffmpeg} for a typical stabilization with default values:
  14269. @example
  14270. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  14271. @end example
  14272. Note the use of the @ref{unsharp} filter which is always recommended.
  14273. @item
  14274. Zoom in a bit more and load transform data from a given file:
  14275. @example
  14276. vidstabtransform=zoom=5:input="mytransforms.trf"
  14277. @end example
  14278. @item
  14279. Smoothen the video even more:
  14280. @example
  14281. vidstabtransform=smoothing=30
  14282. @end example
  14283. @end itemize
  14284. @section vflip
  14285. Flip the input video vertically.
  14286. For example, to vertically flip a video with @command{ffmpeg}:
  14287. @example
  14288. ffmpeg -i in.avi -vf "vflip" out.avi
  14289. @end example
  14290. @section vfrdet
  14291. Detect variable frame rate video.
  14292. This filter tries to detect if the input is variable or constant frame rate.
  14293. At end it will output number of frames detected as having variable delta pts,
  14294. and ones with constant delta pts.
  14295. If there was frames with variable delta, than it will also show min and max delta
  14296. encountered.
  14297. @section vibrance
  14298. Boost or alter saturation.
  14299. The filter accepts the following options:
  14300. @table @option
  14301. @item intensity
  14302. Set strength of boost if positive value or strength of alter if negative value.
  14303. Default is 0. Allowed range is from -2 to 2.
  14304. @item rbal
  14305. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  14306. @item gbal
  14307. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  14308. @item bbal
  14309. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  14310. @item rlum
  14311. Set the red luma coefficient.
  14312. @item glum
  14313. Set the green luma coefficient.
  14314. @item blum
  14315. Set the blue luma coefficient.
  14316. @item alternate
  14317. If @code{intensity} is negative and this is set to 1, colors will change,
  14318. otherwise colors will be less saturated, more towards gray.
  14319. @end table
  14320. @anchor{vignette}
  14321. @section vignette
  14322. Make or reverse a natural vignetting effect.
  14323. The filter accepts the following options:
  14324. @table @option
  14325. @item angle, a
  14326. Set lens angle expression as a number of radians.
  14327. The value is clipped in the @code{[0,PI/2]} range.
  14328. Default value: @code{"PI/5"}
  14329. @item x0
  14330. @item y0
  14331. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  14332. by default.
  14333. @item mode
  14334. Set forward/backward mode.
  14335. Available modes are:
  14336. @table @samp
  14337. @item forward
  14338. The larger the distance from the central point, the darker the image becomes.
  14339. @item backward
  14340. The larger the distance from the central point, the brighter the image becomes.
  14341. This can be used to reverse a vignette effect, though there is no automatic
  14342. detection to extract the lens @option{angle} and other settings (yet). It can
  14343. also be used to create a burning effect.
  14344. @end table
  14345. Default value is @samp{forward}.
  14346. @item eval
  14347. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  14348. It accepts the following values:
  14349. @table @samp
  14350. @item init
  14351. Evaluate expressions only once during the filter initialization.
  14352. @item frame
  14353. Evaluate expressions for each incoming frame. This is way slower than the
  14354. @samp{init} mode since it requires all the scalers to be re-computed, but it
  14355. allows advanced dynamic expressions.
  14356. @end table
  14357. Default value is @samp{init}.
  14358. @item dither
  14359. Set dithering to reduce the circular banding effects. Default is @code{1}
  14360. (enabled).
  14361. @item aspect
  14362. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  14363. Setting this value to the SAR of the input will make a rectangular vignetting
  14364. following the dimensions of the video.
  14365. Default is @code{1/1}.
  14366. @end table
  14367. @subsection Expressions
  14368. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  14369. following parameters.
  14370. @table @option
  14371. @item w
  14372. @item h
  14373. input width and height
  14374. @item n
  14375. the number of input frame, starting from 0
  14376. @item pts
  14377. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  14378. @var{TB} units, NAN if undefined
  14379. @item r
  14380. frame rate of the input video, NAN if the input frame rate is unknown
  14381. @item t
  14382. the PTS (Presentation TimeStamp) of the filtered video frame,
  14383. expressed in seconds, NAN if undefined
  14384. @item tb
  14385. time base of the input video
  14386. @end table
  14387. @subsection Examples
  14388. @itemize
  14389. @item
  14390. Apply simple strong vignetting effect:
  14391. @example
  14392. vignette=PI/4
  14393. @end example
  14394. @item
  14395. Make a flickering vignetting:
  14396. @example
  14397. vignette='PI/4+random(1)*PI/50':eval=frame
  14398. @end example
  14399. @end itemize
  14400. @section vmafmotion
  14401. Obtain the average vmaf motion score of a video.
  14402. It is one of the component filters of VMAF.
  14403. The obtained average motion score is printed through the logging system.
  14404. In the below example the input file @file{ref.mpg} is being processed and score
  14405. is computed.
  14406. @example
  14407. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  14408. @end example
  14409. @section vstack
  14410. Stack input videos vertically.
  14411. All streams must be of same pixel format and of same width.
  14412. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  14413. to create same output.
  14414. The filter accepts the following options:
  14415. @table @option
  14416. @item inputs
  14417. Set number of input streams. Default is 2.
  14418. @item shortest
  14419. If set to 1, force the output to terminate when the shortest input
  14420. terminates. Default value is 0.
  14421. @end table
  14422. @section w3fdif
  14423. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  14424. Deinterlacing Filter").
  14425. Based on the process described by Martin Weston for BBC R&D, and
  14426. implemented based on the de-interlace algorithm written by Jim
  14427. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  14428. uses filter coefficients calculated by BBC R&D.
  14429. This filter uses field-dominance information in frame to decide which
  14430. of each pair of fields to place first in the output.
  14431. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  14432. There are two sets of filter coefficients, so called "simple"
  14433. and "complex". Which set of filter coefficients is used can
  14434. be set by passing an optional parameter:
  14435. @table @option
  14436. @item filter
  14437. Set the interlacing filter coefficients. Accepts one of the following values:
  14438. @table @samp
  14439. @item simple
  14440. Simple filter coefficient set.
  14441. @item complex
  14442. More-complex filter coefficient set.
  14443. @end table
  14444. Default value is @samp{complex}.
  14445. @item deint
  14446. Specify which frames to deinterlace. Accepts one of the following values:
  14447. @table @samp
  14448. @item all
  14449. Deinterlace all frames,
  14450. @item interlaced
  14451. Only deinterlace frames marked as interlaced.
  14452. @end table
  14453. Default value is @samp{all}.
  14454. @end table
  14455. @section waveform
  14456. Video waveform monitor.
  14457. The waveform monitor plots color component intensity. By default luminance
  14458. only. Each column of the waveform corresponds to a column of pixels in the
  14459. source video.
  14460. It accepts the following options:
  14461. @table @option
  14462. @item mode, m
  14463. Can be either @code{row}, or @code{column}. Default is @code{column}.
  14464. In row mode, the graph on the left side represents color component value 0 and
  14465. the right side represents value = 255. In column mode, the top side represents
  14466. color component value = 0 and bottom side represents value = 255.
  14467. @item intensity, i
  14468. Set intensity. Smaller values are useful to find out how many values of the same
  14469. luminance are distributed across input rows/columns.
  14470. Default value is @code{0.04}. Allowed range is [0, 1].
  14471. @item mirror, r
  14472. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  14473. In mirrored mode, higher values will be represented on the left
  14474. side for @code{row} mode and at the top for @code{column} mode. Default is
  14475. @code{1} (mirrored).
  14476. @item display, d
  14477. Set display mode.
  14478. It accepts the following values:
  14479. @table @samp
  14480. @item overlay
  14481. Presents information identical to that in the @code{parade}, except
  14482. that the graphs representing color components are superimposed directly
  14483. over one another.
  14484. This display mode makes it easier to spot relative differences or similarities
  14485. in overlapping areas of the color components that are supposed to be identical,
  14486. such as neutral whites, grays, or blacks.
  14487. @item stack
  14488. Display separate graph for the color components side by side in
  14489. @code{row} mode or one below the other in @code{column} mode.
  14490. @item parade
  14491. Display separate graph for the color components side by side in
  14492. @code{column} mode or one below the other in @code{row} mode.
  14493. Using this display mode makes it easy to spot color casts in the highlights
  14494. and shadows of an image, by comparing the contours of the top and the bottom
  14495. graphs of each waveform. Since whites, grays, and blacks are characterized
  14496. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  14497. should display three waveforms of roughly equal width/height. If not, the
  14498. correction is easy to perform by making level adjustments the three waveforms.
  14499. @end table
  14500. Default is @code{stack}.
  14501. @item components, c
  14502. Set which color components to display. Default is 1, which means only luminance
  14503. or red color component if input is in RGB colorspace. If is set for example to
  14504. 7 it will display all 3 (if) available color components.
  14505. @item envelope, e
  14506. @table @samp
  14507. @item none
  14508. No envelope, this is default.
  14509. @item instant
  14510. Instant envelope, minimum and maximum values presented in graph will be easily
  14511. visible even with small @code{step} value.
  14512. @item peak
  14513. Hold minimum and maximum values presented in graph across time. This way you
  14514. can still spot out of range values without constantly looking at waveforms.
  14515. @item peak+instant
  14516. Peak and instant envelope combined together.
  14517. @end table
  14518. @item filter, f
  14519. @table @samp
  14520. @item lowpass
  14521. No filtering, this is default.
  14522. @item flat
  14523. Luma and chroma combined together.
  14524. @item aflat
  14525. Similar as above, but shows difference between blue and red chroma.
  14526. @item xflat
  14527. Similar as above, but use different colors.
  14528. @item chroma
  14529. Displays only chroma.
  14530. @item color
  14531. Displays actual color value on waveform.
  14532. @item acolor
  14533. Similar as above, but with luma showing frequency of chroma values.
  14534. @end table
  14535. @item graticule, g
  14536. Set which graticule to display.
  14537. @table @samp
  14538. @item none
  14539. Do not display graticule.
  14540. @item green
  14541. Display green graticule showing legal broadcast ranges.
  14542. @item orange
  14543. Display orange graticule showing legal broadcast ranges.
  14544. @end table
  14545. @item opacity, o
  14546. Set graticule opacity.
  14547. @item flags, fl
  14548. Set graticule flags.
  14549. @table @samp
  14550. @item numbers
  14551. Draw numbers above lines. By default enabled.
  14552. @item dots
  14553. Draw dots instead of lines.
  14554. @end table
  14555. @item scale, s
  14556. Set scale used for displaying graticule.
  14557. @table @samp
  14558. @item digital
  14559. @item millivolts
  14560. @item ire
  14561. @end table
  14562. Default is digital.
  14563. @item bgopacity, b
  14564. Set background opacity.
  14565. @end table
  14566. @section weave, doubleweave
  14567. The @code{weave} takes a field-based video input and join
  14568. each two sequential fields into single frame, producing a new double
  14569. height clip with half the frame rate and half the frame count.
  14570. The @code{doubleweave} works same as @code{weave} but without
  14571. halving frame rate and frame count.
  14572. It accepts the following option:
  14573. @table @option
  14574. @item first_field
  14575. Set first field. Available values are:
  14576. @table @samp
  14577. @item top, t
  14578. Set the frame as top-field-first.
  14579. @item bottom, b
  14580. Set the frame as bottom-field-first.
  14581. @end table
  14582. @end table
  14583. @subsection Examples
  14584. @itemize
  14585. @item
  14586. Interlace video using @ref{select} and @ref{separatefields} filter:
  14587. @example
  14588. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  14589. @end example
  14590. @end itemize
  14591. @section xbr
  14592. Apply the xBR high-quality magnification filter which is designed for pixel
  14593. art. It follows a set of edge-detection rules, see
  14594. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  14595. It accepts the following option:
  14596. @table @option
  14597. @item n
  14598. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  14599. @code{3xBR} and @code{4} for @code{4xBR}.
  14600. Default is @code{3}.
  14601. @end table
  14602. @section xmedian
  14603. Pick median pixels from several input videos.
  14604. The filter accepts the following options:
  14605. @table @option
  14606. @item inputs
  14607. Set number of inputs.
  14608. Default is 3. Allowed range is from 3 to 255.
  14609. If number of inputs is even number, than result will be mean value between two median values.
  14610. @item planes
  14611. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14612. @end table
  14613. @section xstack
  14614. Stack video inputs into custom layout.
  14615. All streams must be of same pixel format.
  14616. The filter accepts the following options:
  14617. @table @option
  14618. @item inputs
  14619. Set number of input streams. Default is 2.
  14620. @item layout
  14621. Specify layout of inputs.
  14622. This option requires the desired layout configuration to be explicitly set by the user.
  14623. This sets position of each video input in output. Each input
  14624. is separated by '|'.
  14625. The first number represents the column, and the second number represents the row.
  14626. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  14627. where X is video input from which to take width or height.
  14628. Multiple values can be used when separated by '+'. In such
  14629. case values are summed together.
  14630. Note that if inputs are of different sizes gaps may appear, as not all of
  14631. the output video frame will be filled. Similarly, videos can overlap each
  14632. other if their position doesn't leave enough space for the full frame of
  14633. adjoining videos.
  14634. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  14635. a layout must be set by the user.
  14636. @item shortest
  14637. If set to 1, force the output to terminate when the shortest input
  14638. terminates. Default value is 0.
  14639. @end table
  14640. @subsection Examples
  14641. @itemize
  14642. @item
  14643. Display 4 inputs into 2x2 grid.
  14644. Layout:
  14645. @example
  14646. input1(0, 0) | input3(w0, 0)
  14647. input2(0, h0) | input4(w0, h0)
  14648. @end example
  14649. @example
  14650. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  14651. @end example
  14652. Note that if inputs are of different sizes, gaps or overlaps may occur.
  14653. @item
  14654. Display 4 inputs into 1x4 grid.
  14655. Layout:
  14656. @example
  14657. input1(0, 0)
  14658. input2(0, h0)
  14659. input3(0, h0+h1)
  14660. input4(0, h0+h1+h2)
  14661. @end example
  14662. @example
  14663. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  14664. @end example
  14665. Note that if inputs are of different widths, unused space will appear.
  14666. @item
  14667. Display 9 inputs into 3x3 grid.
  14668. Layout:
  14669. @example
  14670. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  14671. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  14672. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  14673. @end example
  14674. @example
  14675. 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
  14676. @end example
  14677. Note that if inputs are of different sizes, gaps or overlaps may occur.
  14678. @item
  14679. Display 16 inputs into 4x4 grid.
  14680. Layout:
  14681. @example
  14682. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  14683. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  14684. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  14685. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  14686. @end example
  14687. @example
  14688. 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|
  14689. 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
  14690. @end example
  14691. Note that if inputs are of different sizes, gaps or overlaps may occur.
  14692. @end itemize
  14693. @anchor{yadif}
  14694. @section yadif
  14695. Deinterlace the input video ("yadif" means "yet another deinterlacing
  14696. filter").
  14697. It accepts the following parameters:
  14698. @table @option
  14699. @item mode
  14700. The interlacing mode to adopt. It accepts one of the following values:
  14701. @table @option
  14702. @item 0, send_frame
  14703. Output one frame for each frame.
  14704. @item 1, send_field
  14705. Output one frame for each field.
  14706. @item 2, send_frame_nospatial
  14707. Like @code{send_frame}, but it skips the spatial interlacing check.
  14708. @item 3, send_field_nospatial
  14709. Like @code{send_field}, but it skips the spatial interlacing check.
  14710. @end table
  14711. The default value is @code{send_frame}.
  14712. @item parity
  14713. The picture field parity assumed for the input interlaced video. It accepts one
  14714. of the following values:
  14715. @table @option
  14716. @item 0, tff
  14717. Assume the top field is first.
  14718. @item 1, bff
  14719. Assume the bottom field is first.
  14720. @item -1, auto
  14721. Enable automatic detection of field parity.
  14722. @end table
  14723. The default value is @code{auto}.
  14724. If the interlacing is unknown or the decoder does not export this information,
  14725. top field first will be assumed.
  14726. @item deint
  14727. Specify which frames to deinterlace. Accepts one of the following
  14728. values:
  14729. @table @option
  14730. @item 0, all
  14731. Deinterlace all frames.
  14732. @item 1, interlaced
  14733. Only deinterlace frames marked as interlaced.
  14734. @end table
  14735. The default value is @code{all}.
  14736. @end table
  14737. @section yadif_cuda
  14738. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  14739. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  14740. and/or nvenc.
  14741. It accepts the following parameters:
  14742. @table @option
  14743. @item mode
  14744. The interlacing mode to adopt. It accepts one of the following values:
  14745. @table @option
  14746. @item 0, send_frame
  14747. Output one frame for each frame.
  14748. @item 1, send_field
  14749. Output one frame for each field.
  14750. @item 2, send_frame_nospatial
  14751. Like @code{send_frame}, but it skips the spatial interlacing check.
  14752. @item 3, send_field_nospatial
  14753. Like @code{send_field}, but it skips the spatial interlacing check.
  14754. @end table
  14755. The default value is @code{send_frame}.
  14756. @item parity
  14757. The picture field parity assumed for the input interlaced video. It accepts one
  14758. of the following values:
  14759. @table @option
  14760. @item 0, tff
  14761. Assume the top field is first.
  14762. @item 1, bff
  14763. Assume the bottom field is first.
  14764. @item -1, auto
  14765. Enable automatic detection of field parity.
  14766. @end table
  14767. The default value is @code{auto}.
  14768. If the interlacing is unknown or the decoder does not export this information,
  14769. top field first will be assumed.
  14770. @item deint
  14771. Specify which frames to deinterlace. Accepts one of the following
  14772. values:
  14773. @table @option
  14774. @item 0, all
  14775. Deinterlace all frames.
  14776. @item 1, interlaced
  14777. Only deinterlace frames marked as interlaced.
  14778. @end table
  14779. The default value is @code{all}.
  14780. @end table
  14781. @section zoompan
  14782. Apply Zoom & Pan effect.
  14783. This filter accepts the following options:
  14784. @table @option
  14785. @item zoom, z
  14786. Set the zoom expression. Range is 1-10. Default is 1.
  14787. @item x
  14788. @item y
  14789. Set the x and y expression. Default is 0.
  14790. @item d
  14791. Set the duration expression in number of frames.
  14792. This sets for how many number of frames effect will last for
  14793. single input image.
  14794. @item s
  14795. Set the output image size, default is 'hd720'.
  14796. @item fps
  14797. Set the output frame rate, default is '25'.
  14798. @end table
  14799. Each expression can contain the following constants:
  14800. @table @option
  14801. @item in_w, iw
  14802. Input width.
  14803. @item in_h, ih
  14804. Input height.
  14805. @item out_w, ow
  14806. Output width.
  14807. @item out_h, oh
  14808. Output height.
  14809. @item in
  14810. Input frame count.
  14811. @item on
  14812. Output frame count.
  14813. @item x
  14814. @item y
  14815. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  14816. for current input frame.
  14817. @item px
  14818. @item py
  14819. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  14820. not yet such frame (first input frame).
  14821. @item zoom
  14822. Last calculated zoom from 'z' expression for current input frame.
  14823. @item pzoom
  14824. Last calculated zoom of last output frame of previous input frame.
  14825. @item duration
  14826. Number of output frames for current input frame. Calculated from 'd' expression
  14827. for each input frame.
  14828. @item pduration
  14829. number of output frames created for previous input frame
  14830. @item a
  14831. Rational number: input width / input height
  14832. @item sar
  14833. sample aspect ratio
  14834. @item dar
  14835. display aspect ratio
  14836. @end table
  14837. @subsection Examples
  14838. @itemize
  14839. @item
  14840. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  14841. @example
  14842. 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
  14843. @end example
  14844. @item
  14845. Zoom-in up to 1.5 and pan always at center of picture:
  14846. @example
  14847. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14848. @end example
  14849. @item
  14850. Same as above but without pausing:
  14851. @example
  14852. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14853. @end example
  14854. @end itemize
  14855. @anchor{zscale}
  14856. @section zscale
  14857. Scale (resize) the input video, using the z.lib library:
  14858. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  14859. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  14860. The zscale filter forces the output display aspect ratio to be the same
  14861. as the input, by changing the output sample aspect ratio.
  14862. If the input image format is different from the format requested by
  14863. the next filter, the zscale filter will convert the input to the
  14864. requested format.
  14865. @subsection Options
  14866. The filter accepts the following options.
  14867. @table @option
  14868. @item width, w
  14869. @item height, h
  14870. Set the output video dimension expression. Default value is the input
  14871. dimension.
  14872. If the @var{width} or @var{w} value is 0, the input width is used for
  14873. the output. If the @var{height} or @var{h} value is 0, the input height
  14874. is used for the output.
  14875. If one and only one of the values is -n with n >= 1, the zscale filter
  14876. will use a value that maintains the aspect ratio of the input image,
  14877. calculated from the other specified dimension. After that it will,
  14878. however, make sure that the calculated dimension is divisible by n and
  14879. adjust the value if necessary.
  14880. If both values are -n with n >= 1, the behavior will be identical to
  14881. both values being set to 0 as previously detailed.
  14882. See below for the list of accepted constants for use in the dimension
  14883. expression.
  14884. @item size, s
  14885. Set the video size. For the syntax of this option, check the
  14886. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14887. @item dither, d
  14888. Set the dither type.
  14889. Possible values are:
  14890. @table @var
  14891. @item none
  14892. @item ordered
  14893. @item random
  14894. @item error_diffusion
  14895. @end table
  14896. Default is none.
  14897. @item filter, f
  14898. Set the resize filter type.
  14899. Possible values are:
  14900. @table @var
  14901. @item point
  14902. @item bilinear
  14903. @item bicubic
  14904. @item spline16
  14905. @item spline36
  14906. @item lanczos
  14907. @end table
  14908. Default is bilinear.
  14909. @item range, r
  14910. Set the color range.
  14911. Possible values are:
  14912. @table @var
  14913. @item input
  14914. @item limited
  14915. @item full
  14916. @end table
  14917. Default is same as input.
  14918. @item primaries, p
  14919. Set the color primaries.
  14920. Possible values are:
  14921. @table @var
  14922. @item input
  14923. @item 709
  14924. @item unspecified
  14925. @item 170m
  14926. @item 240m
  14927. @item 2020
  14928. @end table
  14929. Default is same as input.
  14930. @item transfer, t
  14931. Set the transfer characteristics.
  14932. Possible values are:
  14933. @table @var
  14934. @item input
  14935. @item 709
  14936. @item unspecified
  14937. @item 601
  14938. @item linear
  14939. @item 2020_10
  14940. @item 2020_12
  14941. @item smpte2084
  14942. @item iec61966-2-1
  14943. @item arib-std-b67
  14944. @end table
  14945. Default is same as input.
  14946. @item matrix, m
  14947. Set the colorspace matrix.
  14948. Possible value are:
  14949. @table @var
  14950. @item input
  14951. @item 709
  14952. @item unspecified
  14953. @item 470bg
  14954. @item 170m
  14955. @item 2020_ncl
  14956. @item 2020_cl
  14957. @end table
  14958. Default is same as input.
  14959. @item rangein, rin
  14960. Set the input color range.
  14961. Possible values are:
  14962. @table @var
  14963. @item input
  14964. @item limited
  14965. @item full
  14966. @end table
  14967. Default is same as input.
  14968. @item primariesin, pin
  14969. Set the input color primaries.
  14970. Possible values are:
  14971. @table @var
  14972. @item input
  14973. @item 709
  14974. @item unspecified
  14975. @item 170m
  14976. @item 240m
  14977. @item 2020
  14978. @end table
  14979. Default is same as input.
  14980. @item transferin, tin
  14981. Set the input transfer characteristics.
  14982. Possible values are:
  14983. @table @var
  14984. @item input
  14985. @item 709
  14986. @item unspecified
  14987. @item 601
  14988. @item linear
  14989. @item 2020_10
  14990. @item 2020_12
  14991. @end table
  14992. Default is same as input.
  14993. @item matrixin, min
  14994. Set the input colorspace matrix.
  14995. Possible value are:
  14996. @table @var
  14997. @item input
  14998. @item 709
  14999. @item unspecified
  15000. @item 470bg
  15001. @item 170m
  15002. @item 2020_ncl
  15003. @item 2020_cl
  15004. @end table
  15005. @item chromal, c
  15006. Set the output chroma location.
  15007. Possible values are:
  15008. @table @var
  15009. @item input
  15010. @item left
  15011. @item center
  15012. @item topleft
  15013. @item top
  15014. @item bottomleft
  15015. @item bottom
  15016. @end table
  15017. @item chromalin, cin
  15018. Set the input chroma location.
  15019. Possible values are:
  15020. @table @var
  15021. @item input
  15022. @item left
  15023. @item center
  15024. @item topleft
  15025. @item top
  15026. @item bottomleft
  15027. @item bottom
  15028. @end table
  15029. @item npl
  15030. Set the nominal peak luminance.
  15031. @end table
  15032. The values of the @option{w} and @option{h} options are expressions
  15033. containing the following constants:
  15034. @table @var
  15035. @item in_w
  15036. @item in_h
  15037. The input width and height
  15038. @item iw
  15039. @item ih
  15040. These are the same as @var{in_w} and @var{in_h}.
  15041. @item out_w
  15042. @item out_h
  15043. The output (scaled) width and height
  15044. @item ow
  15045. @item oh
  15046. These are the same as @var{out_w} and @var{out_h}
  15047. @item a
  15048. The same as @var{iw} / @var{ih}
  15049. @item sar
  15050. input sample aspect ratio
  15051. @item dar
  15052. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  15053. @item hsub
  15054. @item vsub
  15055. horizontal and vertical input chroma subsample values. For example for the
  15056. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15057. @item ohsub
  15058. @item ovsub
  15059. horizontal and vertical output chroma subsample values. For example for the
  15060. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15061. @end table
  15062. @table @option
  15063. @end table
  15064. @c man end VIDEO FILTERS
  15065. @chapter OpenCL Video Filters
  15066. @c man begin OPENCL VIDEO FILTERS
  15067. Below is a description of the currently available OpenCL video filters.
  15068. To enable compilation of these filters you need to configure FFmpeg with
  15069. @code{--enable-opencl}.
  15070. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  15071. @table @option
  15072. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  15073. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  15074. given device parameters.
  15075. @item -filter_hw_device @var{name}
  15076. Pass the hardware device called @var{name} to all filters in any filter graph.
  15077. @end table
  15078. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  15079. @itemize
  15080. @item
  15081. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  15082. @example
  15083. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  15084. @end example
  15085. @end itemize
  15086. 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.
  15087. @section avgblur_opencl
  15088. Apply average blur filter.
  15089. The filter accepts the following options:
  15090. @table @option
  15091. @item sizeX
  15092. Set horizontal radius size.
  15093. Range is @code{[1, 1024]} and default value is @code{1}.
  15094. @item planes
  15095. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15096. @item sizeY
  15097. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  15098. @end table
  15099. @subsection Example
  15100. @itemize
  15101. @item
  15102. 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.
  15103. @example
  15104. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  15105. @end example
  15106. @end itemize
  15107. @section boxblur_opencl
  15108. Apply a boxblur algorithm to the input video.
  15109. It accepts the following parameters:
  15110. @table @option
  15111. @item luma_radius, lr
  15112. @item luma_power, lp
  15113. @item chroma_radius, cr
  15114. @item chroma_power, cp
  15115. @item alpha_radius, ar
  15116. @item alpha_power, ap
  15117. @end table
  15118. A description of the accepted options follows.
  15119. @table @option
  15120. @item luma_radius, lr
  15121. @item chroma_radius, cr
  15122. @item alpha_radius, ar
  15123. Set an expression for the box radius in pixels used for blurring the
  15124. corresponding input plane.
  15125. The radius value must be a non-negative number, and must not be
  15126. greater than the value of the expression @code{min(w,h)/2} for the
  15127. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  15128. planes.
  15129. Default value for @option{luma_radius} is "2". If not specified,
  15130. @option{chroma_radius} and @option{alpha_radius} default to the
  15131. corresponding value set for @option{luma_radius}.
  15132. The expressions can contain the following constants:
  15133. @table @option
  15134. @item w
  15135. @item h
  15136. The input width and height in pixels.
  15137. @item cw
  15138. @item ch
  15139. The input chroma image width and height in pixels.
  15140. @item hsub
  15141. @item vsub
  15142. The horizontal and vertical chroma subsample values. For example, for the
  15143. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  15144. @end table
  15145. @item luma_power, lp
  15146. @item chroma_power, cp
  15147. @item alpha_power, ap
  15148. Specify how many times the boxblur filter is applied to the
  15149. corresponding plane.
  15150. Default value for @option{luma_power} is 2. If not specified,
  15151. @option{chroma_power} and @option{alpha_power} default to the
  15152. corresponding value set for @option{luma_power}.
  15153. A value of 0 will disable the effect.
  15154. @end table
  15155. @subsection Examples
  15156. 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.
  15157. @itemize
  15158. @item
  15159. Apply a boxblur filter with the luma, chroma, and alpha radius
  15160. 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.
  15161. @example
  15162. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  15163. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  15164. @end example
  15165. @item
  15166. 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.
  15167. For the luma plane, a 2x2 box radius will be run once.
  15168. For the chroma plane, a 4x4 box radius will be run 5 times.
  15169. For the alpha plane, a 3x3 box radius will be run 7 times.
  15170. @example
  15171. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  15172. @end example
  15173. @end itemize
  15174. @section convolution_opencl
  15175. Apply convolution of 3x3, 5x5, 7x7 matrix.
  15176. The filter accepts the following options:
  15177. @table @option
  15178. @item 0m
  15179. @item 1m
  15180. @item 2m
  15181. @item 3m
  15182. Set matrix for each plane.
  15183. Matrix is sequence of 9, 25 or 49 signed numbers.
  15184. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  15185. @item 0rdiv
  15186. @item 1rdiv
  15187. @item 2rdiv
  15188. @item 3rdiv
  15189. Set multiplier for calculated value for each plane.
  15190. If unset or 0, it will be sum of all matrix elements.
  15191. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  15192. @item 0bias
  15193. @item 1bias
  15194. @item 2bias
  15195. @item 3bias
  15196. Set bias for each plane. This value is added to the result of the multiplication.
  15197. Useful for making the overall image brighter or darker.
  15198. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  15199. @end table
  15200. @subsection Examples
  15201. @itemize
  15202. @item
  15203. Apply sharpen:
  15204. @example
  15205. -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
  15206. @end example
  15207. @item
  15208. Apply blur:
  15209. @example
  15210. -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
  15211. @end example
  15212. @item
  15213. Apply edge enhance:
  15214. @example
  15215. -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
  15216. @end example
  15217. @item
  15218. Apply edge detect:
  15219. @example
  15220. -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
  15221. @end example
  15222. @item
  15223. Apply laplacian edge detector which includes diagonals:
  15224. @example
  15225. -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
  15226. @end example
  15227. @item
  15228. Apply emboss:
  15229. @example
  15230. -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
  15231. @end example
  15232. @end itemize
  15233. @section dilation_opencl
  15234. Apply dilation effect to the video.
  15235. This filter replaces the pixel by the local(3x3) maximum.
  15236. It accepts the following options:
  15237. @table @option
  15238. @item threshold0
  15239. @item threshold1
  15240. @item threshold2
  15241. @item threshold3
  15242. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  15243. If @code{0}, plane will remain unchanged.
  15244. @item coordinates
  15245. Flag which specifies the pixel to refer to.
  15246. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  15247. Flags to local 3x3 coordinates region centered on @code{x}:
  15248. 1 2 3
  15249. 4 x 5
  15250. 6 7 8
  15251. @end table
  15252. @subsection Example
  15253. @itemize
  15254. @item
  15255. 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.
  15256. @example
  15257. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  15258. @end example
  15259. @end itemize
  15260. @section erosion_opencl
  15261. Apply erosion effect to the video.
  15262. This filter replaces the pixel by the local(3x3) minimum.
  15263. It accepts the following options:
  15264. @table @option
  15265. @item threshold0
  15266. @item threshold1
  15267. @item threshold2
  15268. @item threshold3
  15269. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  15270. If @code{0}, plane will remain unchanged.
  15271. @item coordinates
  15272. Flag which specifies the pixel to refer to.
  15273. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  15274. Flags to local 3x3 coordinates region centered on @code{x}:
  15275. 1 2 3
  15276. 4 x 5
  15277. 6 7 8
  15278. @end table
  15279. @subsection Example
  15280. @itemize
  15281. @item
  15282. 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.
  15283. @example
  15284. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  15285. @end example
  15286. @end itemize
  15287. @section colorkey_opencl
  15288. RGB colorspace color keying.
  15289. The filter accepts the following options:
  15290. @table @option
  15291. @item color
  15292. The color which will be replaced with transparency.
  15293. @item similarity
  15294. Similarity percentage with the key color.
  15295. 0.01 matches only the exact key color, while 1.0 matches everything.
  15296. @item blend
  15297. Blend percentage.
  15298. 0.0 makes pixels either fully transparent, or not transparent at all.
  15299. Higher values result in semi-transparent pixels, with a higher transparency
  15300. the more similar the pixels color is to the key color.
  15301. @end table
  15302. @subsection Examples
  15303. @itemize
  15304. @item
  15305. Make every semi-green pixel in the input transparent with some slight blending:
  15306. @example
  15307. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  15308. @end example
  15309. @end itemize
  15310. @section deshake_opencl
  15311. Feature-point based video stabilization filter.
  15312. The filter accepts the following options:
  15313. @table @option
  15314. @item tripod
  15315. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  15316. @item debug
  15317. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  15318. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  15319. Viewing point matches in the output video is only supported for RGB input.
  15320. Defaults to @code{0}.
  15321. @item adaptive_crop
  15322. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  15323. Defaults to @code{1}.
  15324. @item refine_features
  15325. Whether or not feature points should be refined at a sub-pixel level.
  15326. This can be turned off for a slight performance gain at the cost of precision.
  15327. Defaults to @code{1}.
  15328. @item smooth_strength
  15329. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  15330. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  15331. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  15332. Defaults to @code{0.0}.
  15333. @item smooth_window_multiplier
  15334. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  15335. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  15336. Acceptable values range from @code{0.1} to @code{10.0}.
  15337. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  15338. potentially improving smoothness, but also increase latency and memory usage.
  15339. Defaults to @code{2.0}.
  15340. @end table
  15341. @subsection Examples
  15342. @itemize
  15343. @item
  15344. Stabilize a video with a fixed, medium smoothing strength:
  15345. @example
  15346. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  15347. @end example
  15348. @item
  15349. Stabilize a video with debugging (both in console and in rendered video):
  15350. @example
  15351. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  15352. @end example
  15353. @end itemize
  15354. @section nlmeans_opencl
  15355. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  15356. @section overlay_opencl
  15357. Overlay one video on top of another.
  15358. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  15359. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  15360. The filter accepts the following options:
  15361. @table @option
  15362. @item x
  15363. Set the x coordinate of the overlaid video on the main video.
  15364. Default value is @code{0}.
  15365. @item y
  15366. Set the x coordinate of the overlaid video on the main video.
  15367. Default value is @code{0}.
  15368. @end table
  15369. @subsection Examples
  15370. @itemize
  15371. @item
  15372. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  15373. @example
  15374. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  15375. @end example
  15376. @item
  15377. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  15378. @example
  15379. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  15380. @end example
  15381. @end itemize
  15382. @section prewitt_opencl
  15383. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  15384. The filter accepts the following option:
  15385. @table @option
  15386. @item planes
  15387. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15388. @item scale
  15389. Set value which will be multiplied with filtered result.
  15390. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15391. @item delta
  15392. Set value which will be added to filtered result.
  15393. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15394. @end table
  15395. @subsection Example
  15396. @itemize
  15397. @item
  15398. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  15399. @example
  15400. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15401. @end example
  15402. @end itemize
  15403. @section roberts_opencl
  15404. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  15405. The filter accepts the following option:
  15406. @table @option
  15407. @item planes
  15408. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15409. @item scale
  15410. Set value which will be multiplied with filtered result.
  15411. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15412. @item delta
  15413. Set value which will be added to filtered result.
  15414. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15415. @end table
  15416. @subsection Example
  15417. @itemize
  15418. @item
  15419. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  15420. @example
  15421. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15422. @end example
  15423. @end itemize
  15424. @section sobel_opencl
  15425. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  15426. The filter accepts the following option:
  15427. @table @option
  15428. @item planes
  15429. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15430. @item scale
  15431. Set value which will be multiplied with filtered result.
  15432. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15433. @item delta
  15434. Set value which will be added to filtered result.
  15435. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15436. @end table
  15437. @subsection Example
  15438. @itemize
  15439. @item
  15440. Apply sobel operator with scale set to 2 and delta set to 10
  15441. @example
  15442. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15443. @end example
  15444. @end itemize
  15445. @section tonemap_opencl
  15446. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  15447. It accepts the following parameters:
  15448. @table @option
  15449. @item tonemap
  15450. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  15451. @item param
  15452. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  15453. @item desat
  15454. Apply desaturation for highlights that exceed this level of brightness. The
  15455. higher the parameter, the more color information will be preserved. This
  15456. setting helps prevent unnaturally blown-out colors for super-highlights, by
  15457. (smoothly) turning into white instead. This makes images feel more natural,
  15458. at the cost of reducing information about out-of-range colors.
  15459. The default value is 0.5, and the algorithm here is a little different from
  15460. the cpu version tonemap currently. A setting of 0.0 disables this option.
  15461. @item threshold
  15462. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  15463. is used to detect whether the scene has changed or not. If the distance between
  15464. the current frame average brightness and the current running average exceeds
  15465. a threshold value, we would re-calculate scene average and peak brightness.
  15466. The default value is 0.2.
  15467. @item format
  15468. Specify the output pixel format.
  15469. Currently supported formats are:
  15470. @table @var
  15471. @item p010
  15472. @item nv12
  15473. @end table
  15474. @item range, r
  15475. Set the output color range.
  15476. Possible values are:
  15477. @table @var
  15478. @item tv/mpeg
  15479. @item pc/jpeg
  15480. @end table
  15481. Default is same as input.
  15482. @item primaries, p
  15483. Set the output color primaries.
  15484. Possible values are:
  15485. @table @var
  15486. @item bt709
  15487. @item bt2020
  15488. @end table
  15489. Default is same as input.
  15490. @item transfer, t
  15491. Set the output transfer characteristics.
  15492. Possible values are:
  15493. @table @var
  15494. @item bt709
  15495. @item bt2020
  15496. @end table
  15497. Default is bt709.
  15498. @item matrix, m
  15499. Set the output colorspace matrix.
  15500. Possible value are:
  15501. @table @var
  15502. @item bt709
  15503. @item bt2020
  15504. @end table
  15505. Default is same as input.
  15506. @end table
  15507. @subsection Example
  15508. @itemize
  15509. @item
  15510. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  15511. @example
  15512. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  15513. @end example
  15514. @end itemize
  15515. @section unsharp_opencl
  15516. Sharpen or blur the input video.
  15517. It accepts the following parameters:
  15518. @table @option
  15519. @item luma_msize_x, lx
  15520. Set the luma matrix horizontal size.
  15521. Range is @code{[1, 23]} and default value is @code{5}.
  15522. @item luma_msize_y, ly
  15523. Set the luma matrix vertical size.
  15524. Range is @code{[1, 23]} and default value is @code{5}.
  15525. @item luma_amount, la
  15526. Set the luma effect strength.
  15527. Range is @code{[-10, 10]} and default value is @code{1.0}.
  15528. Negative values will blur the input video, while positive values will
  15529. sharpen it, a value of zero will disable the effect.
  15530. @item chroma_msize_x, cx
  15531. Set the chroma matrix horizontal size.
  15532. Range is @code{[1, 23]} and default value is @code{5}.
  15533. @item chroma_msize_y, cy
  15534. Set the chroma matrix vertical size.
  15535. Range is @code{[1, 23]} and default value is @code{5}.
  15536. @item chroma_amount, ca
  15537. Set the chroma effect strength.
  15538. Range is @code{[-10, 10]} and default value is @code{0.0}.
  15539. Negative values will blur the input video, while positive values will
  15540. sharpen it, a value of zero will disable the effect.
  15541. @end table
  15542. All parameters are optional and default to the equivalent of the
  15543. string '5:5:1.0:5:5:0.0'.
  15544. @subsection Examples
  15545. @itemize
  15546. @item
  15547. Apply strong luma sharpen effect:
  15548. @example
  15549. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  15550. @end example
  15551. @item
  15552. Apply a strong blur of both luma and chroma parameters:
  15553. @example
  15554. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  15555. @end example
  15556. @end itemize
  15557. @c man end OPENCL VIDEO FILTERS
  15558. @chapter Video Sources
  15559. @c man begin VIDEO SOURCES
  15560. Below is a description of the currently available video sources.
  15561. @section buffer
  15562. Buffer video frames, and make them available to the filter chain.
  15563. This source is mainly intended for a programmatic use, in particular
  15564. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  15565. It accepts the following parameters:
  15566. @table @option
  15567. @item video_size
  15568. Specify the size (width and height) of the buffered video frames. For the
  15569. syntax of this option, check the
  15570. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15571. @item width
  15572. The input video width.
  15573. @item height
  15574. The input video height.
  15575. @item pix_fmt
  15576. A string representing the pixel format of the buffered video frames.
  15577. It may be a number corresponding to a pixel format, or a pixel format
  15578. name.
  15579. @item time_base
  15580. Specify the timebase assumed by the timestamps of the buffered frames.
  15581. @item frame_rate
  15582. Specify the frame rate expected for the video stream.
  15583. @item pixel_aspect, sar
  15584. The sample (pixel) aspect ratio of the input video.
  15585. @item sws_param
  15586. Specify the optional parameters to be used for the scale filter which
  15587. is automatically inserted when an input change is detected in the
  15588. input size or format.
  15589. @item hw_frames_ctx
  15590. When using a hardware pixel format, this should be a reference to an
  15591. AVHWFramesContext describing input frames.
  15592. @end table
  15593. For example:
  15594. @example
  15595. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  15596. @end example
  15597. will instruct the source to accept video frames with size 320x240 and
  15598. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  15599. square pixels (1:1 sample aspect ratio).
  15600. Since the pixel format with name "yuv410p" corresponds to the number 6
  15601. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  15602. this example corresponds to:
  15603. @example
  15604. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  15605. @end example
  15606. Alternatively, the options can be specified as a flat string, but this
  15607. syntax is deprecated:
  15608. @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}]
  15609. @section cellauto
  15610. Create a pattern generated by an elementary cellular automaton.
  15611. The initial state of the cellular automaton can be defined through the
  15612. @option{filename} and @option{pattern} options. If such options are
  15613. not specified an initial state is created randomly.
  15614. At each new frame a new row in the video is filled with the result of
  15615. the cellular automaton next generation. The behavior when the whole
  15616. frame is filled is defined by the @option{scroll} option.
  15617. This source accepts the following options:
  15618. @table @option
  15619. @item filename, f
  15620. Read the initial cellular automaton state, i.e. the starting row, from
  15621. the specified file.
  15622. In the file, each non-whitespace character is considered an alive
  15623. cell, a newline will terminate the row, and further characters in the
  15624. file will be ignored.
  15625. @item pattern, p
  15626. Read the initial cellular automaton state, i.e. the starting row, from
  15627. the specified string.
  15628. Each non-whitespace character in the string is considered an alive
  15629. cell, a newline will terminate the row, and further characters in the
  15630. string will be ignored.
  15631. @item rate, r
  15632. Set the video rate, that is the number of frames generated per second.
  15633. Default is 25.
  15634. @item random_fill_ratio, ratio
  15635. Set the random fill ratio for the initial cellular automaton row. It
  15636. is a floating point number value ranging from 0 to 1, defaults to
  15637. 1/PHI.
  15638. This option is ignored when a file or a pattern is specified.
  15639. @item random_seed, seed
  15640. Set the seed for filling randomly the initial row, must be an integer
  15641. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15642. set to -1, the filter will try to use a good random seed on a best
  15643. effort basis.
  15644. @item rule
  15645. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  15646. Default value is 110.
  15647. @item size, s
  15648. Set the size of the output video. For the syntax of this option, check the
  15649. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15650. If @option{filename} or @option{pattern} is specified, the size is set
  15651. by default to the width of the specified initial state row, and the
  15652. height is set to @var{width} * PHI.
  15653. If @option{size} is set, it must contain the width of the specified
  15654. pattern string, and the specified pattern will be centered in the
  15655. larger row.
  15656. If a filename or a pattern string is not specified, the size value
  15657. defaults to "320x518" (used for a randomly generated initial state).
  15658. @item scroll
  15659. If set to 1, scroll the output upward when all the rows in the output
  15660. have been already filled. If set to 0, the new generated row will be
  15661. written over the top row just after the bottom row is filled.
  15662. Defaults to 1.
  15663. @item start_full, full
  15664. If set to 1, completely fill the output with generated rows before
  15665. outputting the first frame.
  15666. This is the default behavior, for disabling set the value to 0.
  15667. @item stitch
  15668. If set to 1, stitch the left and right row edges together.
  15669. This is the default behavior, for disabling set the value to 0.
  15670. @end table
  15671. @subsection Examples
  15672. @itemize
  15673. @item
  15674. Read the initial state from @file{pattern}, and specify an output of
  15675. size 200x400.
  15676. @example
  15677. cellauto=f=pattern:s=200x400
  15678. @end example
  15679. @item
  15680. Generate a random initial row with a width of 200 cells, with a fill
  15681. ratio of 2/3:
  15682. @example
  15683. cellauto=ratio=2/3:s=200x200
  15684. @end example
  15685. @item
  15686. Create a pattern generated by rule 18 starting by a single alive cell
  15687. centered on an initial row with width 100:
  15688. @example
  15689. cellauto=p=@@:s=100x400:full=0:rule=18
  15690. @end example
  15691. @item
  15692. Specify a more elaborated initial pattern:
  15693. @example
  15694. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  15695. @end example
  15696. @end itemize
  15697. @anchor{coreimagesrc}
  15698. @section coreimagesrc
  15699. Video source generated on GPU using Apple's CoreImage API on OSX.
  15700. This video source is a specialized version of the @ref{coreimage} video filter.
  15701. Use a core image generator at the beginning of the applied filterchain to
  15702. generate the content.
  15703. The coreimagesrc video source accepts the following options:
  15704. @table @option
  15705. @item list_generators
  15706. List all available generators along with all their respective options as well as
  15707. possible minimum and maximum values along with the default values.
  15708. @example
  15709. list_generators=true
  15710. @end example
  15711. @item size, s
  15712. Specify the size of the sourced video. For the syntax of this option, check the
  15713. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15714. The default value is @code{320x240}.
  15715. @item rate, r
  15716. Specify the frame rate of the sourced video, as the number of frames
  15717. generated per second. It has to be a string in the format
  15718. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15719. number or a valid video frame rate abbreviation. The default value is
  15720. "25".
  15721. @item sar
  15722. Set the sample aspect ratio of the sourced video.
  15723. @item duration, d
  15724. Set the duration of the sourced video. See
  15725. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15726. for the accepted syntax.
  15727. If not specified, or the expressed duration is negative, the video is
  15728. supposed to be generated forever.
  15729. @end table
  15730. Additionally, all options of the @ref{coreimage} video filter are accepted.
  15731. A complete filterchain can be used for further processing of the
  15732. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  15733. and examples for details.
  15734. @subsection Examples
  15735. @itemize
  15736. @item
  15737. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  15738. given as complete and escaped command-line for Apple's standard bash shell:
  15739. @example
  15740. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  15741. @end example
  15742. This example is equivalent to the QRCode example of @ref{coreimage} without the
  15743. need for a nullsrc video source.
  15744. @end itemize
  15745. @section mandelbrot
  15746. Generate a Mandelbrot set fractal, and progressively zoom towards the
  15747. point specified with @var{start_x} and @var{start_y}.
  15748. This source accepts the following options:
  15749. @table @option
  15750. @item end_pts
  15751. Set the terminal pts value. Default value is 400.
  15752. @item end_scale
  15753. Set the terminal scale value.
  15754. Must be a floating point value. Default value is 0.3.
  15755. @item inner
  15756. Set the inner coloring mode, that is the algorithm used to draw the
  15757. Mandelbrot fractal internal region.
  15758. It shall assume one of the following values:
  15759. @table @option
  15760. @item black
  15761. Set black mode.
  15762. @item convergence
  15763. Show time until convergence.
  15764. @item mincol
  15765. Set color based on point closest to the origin of the iterations.
  15766. @item period
  15767. Set period mode.
  15768. @end table
  15769. Default value is @var{mincol}.
  15770. @item bailout
  15771. Set the bailout value. Default value is 10.0.
  15772. @item maxiter
  15773. Set the maximum of iterations performed by the rendering
  15774. algorithm. Default value is 7189.
  15775. @item outer
  15776. Set outer coloring mode.
  15777. It shall assume one of following values:
  15778. @table @option
  15779. @item iteration_count
  15780. Set iteration count mode.
  15781. @item normalized_iteration_count
  15782. set normalized iteration count mode.
  15783. @end table
  15784. Default value is @var{normalized_iteration_count}.
  15785. @item rate, r
  15786. Set frame rate, expressed as number of frames per second. Default
  15787. value is "25".
  15788. @item size, s
  15789. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  15790. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  15791. @item start_scale
  15792. Set the initial scale value. Default value is 3.0.
  15793. @item start_x
  15794. Set the initial x position. Must be a floating point value between
  15795. -100 and 100. Default value is -0.743643887037158704752191506114774.
  15796. @item start_y
  15797. Set the initial y position. Must be a floating point value between
  15798. -100 and 100. Default value is -0.131825904205311970493132056385139.
  15799. @end table
  15800. @section mptestsrc
  15801. Generate various test patterns, as generated by the MPlayer test filter.
  15802. The size of the generated video is fixed, and is 256x256.
  15803. This source is useful in particular for testing encoding features.
  15804. This source accepts the following options:
  15805. @table @option
  15806. @item rate, r
  15807. Specify the frame rate of the sourced video, as the number of frames
  15808. generated per second. It has to be a string in the format
  15809. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15810. number or a valid video frame rate abbreviation. The default value is
  15811. "25".
  15812. @item duration, d
  15813. Set the duration of the sourced video. See
  15814. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15815. for the accepted syntax.
  15816. If not specified, or the expressed duration is negative, the video is
  15817. supposed to be generated forever.
  15818. @item test, t
  15819. Set the number or the name of the test to perform. Supported tests are:
  15820. @table @option
  15821. @item dc_luma
  15822. @item dc_chroma
  15823. @item freq_luma
  15824. @item freq_chroma
  15825. @item amp_luma
  15826. @item amp_chroma
  15827. @item cbp
  15828. @item mv
  15829. @item ring1
  15830. @item ring2
  15831. @item all
  15832. @end table
  15833. Default value is "all", which will cycle through the list of all tests.
  15834. @end table
  15835. Some examples:
  15836. @example
  15837. mptestsrc=t=dc_luma
  15838. @end example
  15839. will generate a "dc_luma" test pattern.
  15840. @section frei0r_src
  15841. Provide a frei0r source.
  15842. To enable compilation of this filter you need to install the frei0r
  15843. header and configure FFmpeg with @code{--enable-frei0r}.
  15844. This source accepts the following parameters:
  15845. @table @option
  15846. @item size
  15847. The size of the video to generate. For the syntax of this option, check the
  15848. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15849. @item framerate
  15850. The framerate of the generated video. It may be a string of the form
  15851. @var{num}/@var{den} or a frame rate abbreviation.
  15852. @item filter_name
  15853. The name to the frei0r source to load. For more information regarding frei0r and
  15854. how to set the parameters, read the @ref{frei0r} section in the video filters
  15855. documentation.
  15856. @item filter_params
  15857. A '|'-separated list of parameters to pass to the frei0r source.
  15858. @end table
  15859. For example, to generate a frei0r partik0l source with size 200x200
  15860. and frame rate 10 which is overlaid on the overlay filter main input:
  15861. @example
  15862. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  15863. @end example
  15864. @section life
  15865. Generate a life pattern.
  15866. This source is based on a generalization of John Conway's life game.
  15867. The sourced input represents a life grid, each pixel represents a cell
  15868. which can be in one of two possible states, alive or dead. Every cell
  15869. interacts with its eight neighbours, which are the cells that are
  15870. horizontally, vertically, or diagonally adjacent.
  15871. At each interaction the grid evolves according to the adopted rule,
  15872. which specifies the number of neighbor alive cells which will make a
  15873. cell stay alive or born. The @option{rule} option allows one to specify
  15874. the rule to adopt.
  15875. This source accepts the following options:
  15876. @table @option
  15877. @item filename, f
  15878. Set the file from which to read the initial grid state. In the file,
  15879. each non-whitespace character is considered an alive cell, and newline
  15880. is used to delimit the end of each row.
  15881. If this option is not specified, the initial grid is generated
  15882. randomly.
  15883. @item rate, r
  15884. Set the video rate, that is the number of frames generated per second.
  15885. Default is 25.
  15886. @item random_fill_ratio, ratio
  15887. Set the random fill ratio for the initial random grid. It is a
  15888. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  15889. It is ignored when a file is specified.
  15890. @item random_seed, seed
  15891. Set the seed for filling the initial random grid, must be an integer
  15892. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15893. set to -1, the filter will try to use a good random seed on a best
  15894. effort basis.
  15895. @item rule
  15896. Set the life rule.
  15897. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  15898. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  15899. @var{NS} specifies the number of alive neighbor cells which make a
  15900. live cell stay alive, and @var{NB} the number of alive neighbor cells
  15901. which make a dead cell to become alive (i.e. to "born").
  15902. "s" and "b" can be used in place of "S" and "B", respectively.
  15903. Alternatively a rule can be specified by an 18-bits integer. The 9
  15904. high order bits are used to encode the next cell state if it is alive
  15905. for each number of neighbor alive cells, the low order bits specify
  15906. the rule for "borning" new cells. Higher order bits encode for an
  15907. higher number of neighbor cells.
  15908. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  15909. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  15910. Default value is "S23/B3", which is the original Conway's game of life
  15911. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  15912. cells, and will born a new cell if there are three alive cells around
  15913. a dead cell.
  15914. @item size, s
  15915. Set the size of the output video. For the syntax of this option, check the
  15916. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15917. If @option{filename} is specified, the size is set by default to the
  15918. same size of the input file. If @option{size} is set, it must contain
  15919. the size specified in the input file, and the initial grid defined in
  15920. that file is centered in the larger resulting area.
  15921. If a filename is not specified, the size value defaults to "320x240"
  15922. (used for a randomly generated initial grid).
  15923. @item stitch
  15924. If set to 1, stitch the left and right grid edges together, and the
  15925. top and bottom edges also. Defaults to 1.
  15926. @item mold
  15927. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  15928. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  15929. value from 0 to 255.
  15930. @item life_color
  15931. Set the color of living (or new born) cells.
  15932. @item death_color
  15933. Set the color of dead cells. If @option{mold} is set, this is the first color
  15934. used to represent a dead cell.
  15935. @item mold_color
  15936. Set mold color, for definitely dead and moldy cells.
  15937. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  15938. ffmpeg-utils manual,ffmpeg-utils}.
  15939. @end table
  15940. @subsection Examples
  15941. @itemize
  15942. @item
  15943. Read a grid from @file{pattern}, and center it on a grid of size
  15944. 300x300 pixels:
  15945. @example
  15946. life=f=pattern:s=300x300
  15947. @end example
  15948. @item
  15949. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  15950. @example
  15951. life=ratio=2/3:s=200x200
  15952. @end example
  15953. @item
  15954. Specify a custom rule for evolving a randomly generated grid:
  15955. @example
  15956. life=rule=S14/B34
  15957. @end example
  15958. @item
  15959. Full example with slow death effect (mold) using @command{ffplay}:
  15960. @example
  15961. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  15962. @end example
  15963. @end itemize
  15964. @anchor{allrgb}
  15965. @anchor{allyuv}
  15966. @anchor{color}
  15967. @anchor{haldclutsrc}
  15968. @anchor{nullsrc}
  15969. @anchor{pal75bars}
  15970. @anchor{pal100bars}
  15971. @anchor{rgbtestsrc}
  15972. @anchor{smptebars}
  15973. @anchor{smptehdbars}
  15974. @anchor{testsrc}
  15975. @anchor{testsrc2}
  15976. @anchor{yuvtestsrc}
  15977. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  15978. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  15979. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  15980. The @code{color} source provides an uniformly colored input.
  15981. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  15982. @ref{haldclut} filter.
  15983. The @code{nullsrc} source returns unprocessed video frames. It is
  15984. mainly useful to be employed in analysis / debugging tools, or as the
  15985. source for filters which ignore the input data.
  15986. The @code{pal75bars} source generates a color bars pattern, based on
  15987. EBU PAL recommendations with 75% color levels.
  15988. The @code{pal100bars} source generates a color bars pattern, based on
  15989. EBU PAL recommendations with 100% color levels.
  15990. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  15991. detecting RGB vs BGR issues. You should see a red, green and blue
  15992. stripe from top to bottom.
  15993. The @code{smptebars} source generates a color bars pattern, based on
  15994. the SMPTE Engineering Guideline EG 1-1990.
  15995. The @code{smptehdbars} source generates a color bars pattern, based on
  15996. the SMPTE RP 219-2002.
  15997. The @code{testsrc} source generates a test video pattern, showing a
  15998. color pattern, a scrolling gradient and a timestamp. This is mainly
  15999. intended for testing purposes.
  16000. The @code{testsrc2} source is similar to testsrc, but supports more
  16001. pixel formats instead of just @code{rgb24}. This allows using it as an
  16002. input for other tests without requiring a format conversion.
  16003. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  16004. see a y, cb and cr stripe from top to bottom.
  16005. The sources accept the following parameters:
  16006. @table @option
  16007. @item level
  16008. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  16009. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  16010. pixels to be used as identity matrix for 3D lookup tables. Each component is
  16011. coded on a @code{1/(N*N)} scale.
  16012. @item color, c
  16013. Specify the color of the source, only available in the @code{color}
  16014. source. For the syntax of this option, check the
  16015. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16016. @item size, s
  16017. Specify the size of the sourced video. For the syntax of this option, check the
  16018. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16019. The default value is @code{320x240}.
  16020. This option is not available with the @code{allrgb}, @code{allyuv}, and
  16021. @code{haldclutsrc} filters.
  16022. @item rate, r
  16023. Specify the frame rate of the sourced video, as the number of frames
  16024. generated per second. It has to be a string in the format
  16025. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  16026. number or a valid video frame rate abbreviation. The default value is
  16027. "25".
  16028. @item duration, d
  16029. Set the duration of the sourced video. See
  16030. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16031. for the accepted syntax.
  16032. If not specified, or the expressed duration is negative, the video is
  16033. supposed to be generated forever.
  16034. @item sar
  16035. Set the sample aspect ratio of the sourced video.
  16036. @item alpha
  16037. Specify the alpha (opacity) of the background, only available in the
  16038. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  16039. 255 (fully opaque, the default).
  16040. @item decimals, n
  16041. Set the number of decimals to show in the timestamp, only available in the
  16042. @code{testsrc} source.
  16043. The displayed timestamp value will correspond to the original
  16044. timestamp value multiplied by the power of 10 of the specified
  16045. value. Default value is 0.
  16046. @end table
  16047. @subsection Examples
  16048. @itemize
  16049. @item
  16050. Generate a video with a duration of 5.3 seconds, with size
  16051. 176x144 and a frame rate of 10 frames per second:
  16052. @example
  16053. testsrc=duration=5.3:size=qcif:rate=10
  16054. @end example
  16055. @item
  16056. The following graph description will generate a red source
  16057. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  16058. frames per second:
  16059. @example
  16060. color=c=red@@0.2:s=qcif:r=10
  16061. @end example
  16062. @item
  16063. If the input content is to be ignored, @code{nullsrc} can be used. The
  16064. following command generates noise in the luminance plane by employing
  16065. the @code{geq} filter:
  16066. @example
  16067. nullsrc=s=256x256, geq=random(1)*255:128:128
  16068. @end example
  16069. @end itemize
  16070. @subsection Commands
  16071. The @code{color} source supports the following commands:
  16072. @table @option
  16073. @item c, color
  16074. Set the color of the created image. Accepts the same syntax of the
  16075. corresponding @option{color} option.
  16076. @end table
  16077. @section openclsrc
  16078. Generate video using an OpenCL program.
  16079. @table @option
  16080. @item source
  16081. OpenCL program source file.
  16082. @item kernel
  16083. Kernel name in program.
  16084. @item size, s
  16085. Size of frames to generate. This must be set.
  16086. @item format
  16087. Pixel format to use for the generated frames. This must be set.
  16088. @item rate, r
  16089. Number of frames generated every second. Default value is '25'.
  16090. @end table
  16091. For details of how the program loading works, see the @ref{program_opencl}
  16092. filter.
  16093. Example programs:
  16094. @itemize
  16095. @item
  16096. Generate a colour ramp by setting pixel values from the position of the pixel
  16097. in the output image. (Note that this will work with all pixel formats, but
  16098. the generated output will not be the same.)
  16099. @verbatim
  16100. __kernel void ramp(__write_only image2d_t dst,
  16101. unsigned int index)
  16102. {
  16103. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  16104. float4 val;
  16105. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  16106. write_imagef(dst, loc, val);
  16107. }
  16108. @end verbatim
  16109. @item
  16110. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  16111. @verbatim
  16112. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  16113. unsigned int index)
  16114. {
  16115. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  16116. float4 value = 0.0f;
  16117. int x = loc.x + index;
  16118. int y = loc.y + index;
  16119. while (x > 0 || y > 0) {
  16120. if (x % 3 == 1 && y % 3 == 1) {
  16121. value = 1.0f;
  16122. break;
  16123. }
  16124. x /= 3;
  16125. y /= 3;
  16126. }
  16127. write_imagef(dst, loc, value);
  16128. }
  16129. @end verbatim
  16130. @end itemize
  16131. @section sierpinski
  16132. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  16133. This source accepts the following options:
  16134. @table @option
  16135. @item size, s
  16136. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  16137. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  16138. @item rate, r
  16139. Set frame rate, expressed as number of frames per second. Default
  16140. value is "25".
  16141. @item seed
  16142. Set seed which is used for random panning.
  16143. @item jump
  16144. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  16145. @item type
  16146. Set fractal type, can be default @code{carpet} or @code{triangle}.
  16147. @end table
  16148. @c man end VIDEO SOURCES
  16149. @chapter Video Sinks
  16150. @c man begin VIDEO SINKS
  16151. Below is a description of the currently available video sinks.
  16152. @section buffersink
  16153. Buffer video frames, and make them available to the end of the filter
  16154. graph.
  16155. This sink is mainly intended for programmatic use, in particular
  16156. through the interface defined in @file{libavfilter/buffersink.h}
  16157. or the options system.
  16158. It accepts a pointer to an AVBufferSinkContext structure, which
  16159. defines the incoming buffers' formats, to be passed as the opaque
  16160. parameter to @code{avfilter_init_filter} for initialization.
  16161. @section nullsink
  16162. Null video sink: do absolutely nothing with the input video. It is
  16163. mainly useful as a template and for use in analysis / debugging
  16164. tools.
  16165. @c man end VIDEO SINKS
  16166. @chapter Multimedia Filters
  16167. @c man begin MULTIMEDIA FILTERS
  16168. Below is a description of the currently available multimedia filters.
  16169. @section abitscope
  16170. Convert input audio to a video output, displaying the audio bit scope.
  16171. The filter accepts the following options:
  16172. @table @option
  16173. @item rate, r
  16174. Set frame rate, expressed as number of frames per second. Default
  16175. value is "25".
  16176. @item size, s
  16177. Specify the video size for the output. For the syntax of this option, check the
  16178. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16179. Default value is @code{1024x256}.
  16180. @item colors
  16181. Specify list of colors separated by space or by '|' which will be used to
  16182. draw channels. Unrecognized or missing colors will be replaced
  16183. by white color.
  16184. @end table
  16185. @section ahistogram
  16186. Convert input audio to a video output, displaying the volume histogram.
  16187. The filter accepts the following options:
  16188. @table @option
  16189. @item dmode
  16190. Specify how histogram is calculated.
  16191. It accepts the following values:
  16192. @table @samp
  16193. @item single
  16194. Use single histogram for all channels.
  16195. @item separate
  16196. Use separate histogram for each channel.
  16197. @end table
  16198. Default is @code{single}.
  16199. @item rate, r
  16200. Set frame rate, expressed as number of frames per second. Default
  16201. value is "25".
  16202. @item size, s
  16203. Specify the video size for the output. For the syntax of this option, check the
  16204. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16205. Default value is @code{hd720}.
  16206. @item scale
  16207. Set display scale.
  16208. It accepts the following values:
  16209. @table @samp
  16210. @item log
  16211. logarithmic
  16212. @item sqrt
  16213. square root
  16214. @item cbrt
  16215. cubic root
  16216. @item lin
  16217. linear
  16218. @item rlog
  16219. reverse logarithmic
  16220. @end table
  16221. Default is @code{log}.
  16222. @item ascale
  16223. Set amplitude scale.
  16224. It accepts the following values:
  16225. @table @samp
  16226. @item log
  16227. logarithmic
  16228. @item lin
  16229. linear
  16230. @end table
  16231. Default is @code{log}.
  16232. @item acount
  16233. Set how much frames to accumulate in histogram.
  16234. Default is 1. Setting this to -1 accumulates all frames.
  16235. @item rheight
  16236. Set histogram ratio of window height.
  16237. @item slide
  16238. Set sonogram sliding.
  16239. It accepts the following values:
  16240. @table @samp
  16241. @item replace
  16242. replace old rows with new ones.
  16243. @item scroll
  16244. scroll from top to bottom.
  16245. @end table
  16246. Default is @code{replace}.
  16247. @end table
  16248. @section aphasemeter
  16249. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  16250. representing mean phase of current audio frame. A video output can also be produced and is
  16251. enabled by default. The audio is passed through as first output.
  16252. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  16253. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  16254. and @code{1} means channels are in phase.
  16255. The filter accepts the following options, all related to its video output:
  16256. @table @option
  16257. @item rate, r
  16258. Set the output frame rate. Default value is @code{25}.
  16259. @item size, s
  16260. Set the video size for the output. For the syntax of this option, check the
  16261. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16262. Default value is @code{800x400}.
  16263. @item rc
  16264. @item gc
  16265. @item bc
  16266. Specify the red, green, blue contrast. Default values are @code{2},
  16267. @code{7} and @code{1}.
  16268. Allowed range is @code{[0, 255]}.
  16269. @item mpc
  16270. Set color which will be used for drawing median phase. If color is
  16271. @code{none} which is default, no median phase value will be drawn.
  16272. @item video
  16273. Enable video output. Default is enabled.
  16274. @end table
  16275. @section avectorscope
  16276. Convert input audio to a video output, representing the audio vector
  16277. scope.
  16278. The filter is used to measure the difference between channels of stereo
  16279. audio stream. A monaural signal, consisting of identical left and right
  16280. signal, results in straight vertical line. Any stereo separation is visible
  16281. as a deviation from this line, creating a Lissajous figure.
  16282. If the straight (or deviation from it) but horizontal line appears this
  16283. indicates that the left and right channels are out of phase.
  16284. The filter accepts the following options:
  16285. @table @option
  16286. @item mode, m
  16287. Set the vectorscope mode.
  16288. Available values are:
  16289. @table @samp
  16290. @item lissajous
  16291. Lissajous rotated by 45 degrees.
  16292. @item lissajous_xy
  16293. Same as above but not rotated.
  16294. @item polar
  16295. Shape resembling half of circle.
  16296. @end table
  16297. Default value is @samp{lissajous}.
  16298. @item size, s
  16299. Set the video size for the output. For the syntax of this option, check the
  16300. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16301. Default value is @code{400x400}.
  16302. @item rate, r
  16303. Set the output frame rate. Default value is @code{25}.
  16304. @item rc
  16305. @item gc
  16306. @item bc
  16307. @item ac
  16308. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  16309. @code{160}, @code{80} and @code{255}.
  16310. Allowed range is @code{[0, 255]}.
  16311. @item rf
  16312. @item gf
  16313. @item bf
  16314. @item af
  16315. Specify the red, green, blue and alpha fade. Default values are @code{15},
  16316. @code{10}, @code{5} and @code{5}.
  16317. Allowed range is @code{[0, 255]}.
  16318. @item zoom
  16319. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  16320. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  16321. @item draw
  16322. Set the vectorscope drawing mode.
  16323. Available values are:
  16324. @table @samp
  16325. @item dot
  16326. Draw dot for each sample.
  16327. @item line
  16328. Draw line between previous and current sample.
  16329. @end table
  16330. Default value is @samp{dot}.
  16331. @item scale
  16332. Specify amplitude scale of audio samples.
  16333. Available values are:
  16334. @table @samp
  16335. @item lin
  16336. Linear.
  16337. @item sqrt
  16338. Square root.
  16339. @item cbrt
  16340. Cubic root.
  16341. @item log
  16342. Logarithmic.
  16343. @end table
  16344. @item swap
  16345. Swap left channel axis with right channel axis.
  16346. @item mirror
  16347. Mirror axis.
  16348. @table @samp
  16349. @item none
  16350. No mirror.
  16351. @item x
  16352. Mirror only x axis.
  16353. @item y
  16354. Mirror only y axis.
  16355. @item xy
  16356. Mirror both axis.
  16357. @end table
  16358. @end table
  16359. @subsection Examples
  16360. @itemize
  16361. @item
  16362. Complete example using @command{ffplay}:
  16363. @example
  16364. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  16365. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  16366. @end example
  16367. @end itemize
  16368. @section bench, abench
  16369. Benchmark part of a filtergraph.
  16370. The filter accepts the following options:
  16371. @table @option
  16372. @item action
  16373. Start or stop a timer.
  16374. Available values are:
  16375. @table @samp
  16376. @item start
  16377. Get the current time, set it as frame metadata (using the key
  16378. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  16379. @item stop
  16380. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  16381. the input frame metadata to get the time difference. Time difference, average,
  16382. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  16383. @code{min}) are then printed. The timestamps are expressed in seconds.
  16384. @end table
  16385. @end table
  16386. @subsection Examples
  16387. @itemize
  16388. @item
  16389. Benchmark @ref{selectivecolor} filter:
  16390. @example
  16391. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  16392. @end example
  16393. @end itemize
  16394. @section concat
  16395. Concatenate audio and video streams, joining them together one after the
  16396. other.
  16397. The filter works on segments of synchronized video and audio streams. All
  16398. segments must have the same number of streams of each type, and that will
  16399. also be the number of streams at output.
  16400. The filter accepts the following options:
  16401. @table @option
  16402. @item n
  16403. Set the number of segments. Default is 2.
  16404. @item v
  16405. Set the number of output video streams, that is also the number of video
  16406. streams in each segment. Default is 1.
  16407. @item a
  16408. Set the number of output audio streams, that is also the number of audio
  16409. streams in each segment. Default is 0.
  16410. @item unsafe
  16411. Activate unsafe mode: do not fail if segments have a different format.
  16412. @end table
  16413. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  16414. @var{a} audio outputs.
  16415. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  16416. segment, in the same order as the outputs, then the inputs for the second
  16417. segment, etc.
  16418. Related streams do not always have exactly the same duration, for various
  16419. reasons including codec frame size or sloppy authoring. For that reason,
  16420. related synchronized streams (e.g. a video and its audio track) should be
  16421. concatenated at once. The concat filter will use the duration of the longest
  16422. stream in each segment (except the last one), and if necessary pad shorter
  16423. audio streams with silence.
  16424. For this filter to work correctly, all segments must start at timestamp 0.
  16425. All corresponding streams must have the same parameters in all segments; the
  16426. filtering system will automatically select a common pixel format for video
  16427. streams, and a common sample format, sample rate and channel layout for
  16428. audio streams, but other settings, such as resolution, must be converted
  16429. explicitly by the user.
  16430. Different frame rates are acceptable but will result in variable frame rate
  16431. at output; be sure to configure the output file to handle it.
  16432. @subsection Examples
  16433. @itemize
  16434. @item
  16435. Concatenate an opening, an episode and an ending, all in bilingual version
  16436. (video in stream 0, audio in streams 1 and 2):
  16437. @example
  16438. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  16439. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  16440. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  16441. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  16442. @end example
  16443. @item
  16444. Concatenate two parts, handling audio and video separately, using the
  16445. (a)movie sources, and adjusting the resolution:
  16446. @example
  16447. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  16448. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  16449. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  16450. @end example
  16451. Note that a desync will happen at the stitch if the audio and video streams
  16452. do not have exactly the same duration in the first file.
  16453. @end itemize
  16454. @subsection Commands
  16455. This filter supports the following commands:
  16456. @table @option
  16457. @item next
  16458. Close the current segment and step to the next one
  16459. @end table
  16460. @section drawgraph, adrawgraph
  16461. Draw a graph using input video or audio metadata.
  16462. It accepts the following parameters:
  16463. @table @option
  16464. @item m1
  16465. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  16466. @item fg1
  16467. Set 1st foreground color expression.
  16468. @item m2
  16469. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  16470. @item fg2
  16471. Set 2nd foreground color expression.
  16472. @item m3
  16473. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  16474. @item fg3
  16475. Set 3rd foreground color expression.
  16476. @item m4
  16477. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  16478. @item fg4
  16479. Set 4th foreground color expression.
  16480. @item min
  16481. Set minimal value of metadata value.
  16482. @item max
  16483. Set maximal value of metadata value.
  16484. @item bg
  16485. Set graph background color. Default is white.
  16486. @item mode
  16487. Set graph mode.
  16488. Available values for mode is:
  16489. @table @samp
  16490. @item bar
  16491. @item dot
  16492. @item line
  16493. @end table
  16494. Default is @code{line}.
  16495. @item slide
  16496. Set slide mode.
  16497. Available values for slide is:
  16498. @table @samp
  16499. @item frame
  16500. Draw new frame when right border is reached.
  16501. @item replace
  16502. Replace old columns with new ones.
  16503. @item scroll
  16504. Scroll from right to left.
  16505. @item rscroll
  16506. Scroll from left to right.
  16507. @item picture
  16508. Draw single picture.
  16509. @end table
  16510. Default is @code{frame}.
  16511. @item size
  16512. Set size of graph video. For the syntax of this option, check the
  16513. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16514. The default value is @code{900x256}.
  16515. The foreground color expressions can use the following variables:
  16516. @table @option
  16517. @item MIN
  16518. Minimal value of metadata value.
  16519. @item MAX
  16520. Maximal value of metadata value.
  16521. @item VAL
  16522. Current metadata key value.
  16523. @end table
  16524. The color is defined as 0xAABBGGRR.
  16525. @end table
  16526. Example using metadata from @ref{signalstats} filter:
  16527. @example
  16528. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  16529. @end example
  16530. Example using metadata from @ref{ebur128} filter:
  16531. @example
  16532. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  16533. @end example
  16534. @anchor{ebur128}
  16535. @section ebur128
  16536. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  16537. level. By default, it logs a message at a frequency of 10Hz with the
  16538. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  16539. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  16540. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  16541. sample format is double-precision floating point. The input stream will be converted to
  16542. this specification, if needed. Users may need to insert aformat and/or aresample filters
  16543. after this filter to obtain the original parameters.
  16544. The filter also has a video output (see the @var{video} option) with a real
  16545. time graph to observe the loudness evolution. The graphic contains the logged
  16546. message mentioned above, so it is not printed anymore when this option is set,
  16547. unless the verbose logging is set. The main graphing area contains the
  16548. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  16549. the momentary loudness (400 milliseconds), but can optionally be configured
  16550. to instead display short-term loudness (see @var{gauge}).
  16551. The green area marks a +/- 1LU target range around the target loudness
  16552. (-23LUFS by default, unless modified through @var{target}).
  16553. More information about the Loudness Recommendation EBU R128 on
  16554. @url{http://tech.ebu.ch/loudness}.
  16555. The filter accepts the following options:
  16556. @table @option
  16557. @item video
  16558. Activate the video output. The audio stream is passed unchanged whether this
  16559. option is set or no. The video stream will be the first output stream if
  16560. activated. Default is @code{0}.
  16561. @item size
  16562. Set the video size. This option is for video only. For the syntax of this
  16563. option, check the
  16564. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16565. Default and minimum resolution is @code{640x480}.
  16566. @item meter
  16567. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  16568. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  16569. other integer value between this range is allowed.
  16570. @item metadata
  16571. Set metadata injection. If set to @code{1}, the audio input will be segmented
  16572. into 100ms output frames, each of them containing various loudness information
  16573. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  16574. Default is @code{0}.
  16575. @item framelog
  16576. Force the frame logging level.
  16577. Available values are:
  16578. @table @samp
  16579. @item info
  16580. information logging level
  16581. @item verbose
  16582. verbose logging level
  16583. @end table
  16584. By default, the logging level is set to @var{info}. If the @option{video} or
  16585. the @option{metadata} options are set, it switches to @var{verbose}.
  16586. @item peak
  16587. Set peak mode(s).
  16588. Available modes can be cumulated (the option is a @code{flag} type). Possible
  16589. values are:
  16590. @table @samp
  16591. @item none
  16592. Disable any peak mode (default).
  16593. @item sample
  16594. Enable sample-peak mode.
  16595. Simple peak mode looking for the higher sample value. It logs a message
  16596. for sample-peak (identified by @code{SPK}).
  16597. @item true
  16598. Enable true-peak mode.
  16599. If enabled, the peak lookup is done on an over-sampled version of the input
  16600. stream for better peak accuracy. It logs a message for true-peak.
  16601. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  16602. This mode requires a build with @code{libswresample}.
  16603. @end table
  16604. @item dualmono
  16605. Treat mono input files as "dual mono". If a mono file is intended for playback
  16606. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  16607. If set to @code{true}, this option will compensate for this effect.
  16608. Multi-channel input files are not affected by this option.
  16609. @item panlaw
  16610. Set a specific pan law to be used for the measurement of dual mono files.
  16611. This parameter is optional, and has a default value of -3.01dB.
  16612. @item target
  16613. Set a specific target level (in LUFS) used as relative zero in the visualization.
  16614. This parameter is optional and has a default value of -23LUFS as specified
  16615. by EBU R128. However, material published online may prefer a level of -16LUFS
  16616. (e.g. for use with podcasts or video platforms).
  16617. @item gauge
  16618. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  16619. @code{shortterm}. By default the momentary value will be used, but in certain
  16620. scenarios it may be more useful to observe the short term value instead (e.g.
  16621. live mixing).
  16622. @item scale
  16623. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  16624. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  16625. video output, not the summary or continuous log output.
  16626. @end table
  16627. @subsection Examples
  16628. @itemize
  16629. @item
  16630. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  16631. @example
  16632. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  16633. @end example
  16634. @item
  16635. Run an analysis with @command{ffmpeg}:
  16636. @example
  16637. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  16638. @end example
  16639. @end itemize
  16640. @section interleave, ainterleave
  16641. Temporally interleave frames from several inputs.
  16642. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  16643. These filters read frames from several inputs and send the oldest
  16644. queued frame to the output.
  16645. Input streams must have well defined, monotonically increasing frame
  16646. timestamp values.
  16647. In order to submit one frame to output, these filters need to enqueue
  16648. at least one frame for each input, so they cannot work in case one
  16649. input is not yet terminated and will not receive incoming frames.
  16650. For example consider the case when one input is a @code{select} filter
  16651. which always drops input frames. The @code{interleave} filter will keep
  16652. reading from that input, but it will never be able to send new frames
  16653. to output until the input sends an end-of-stream signal.
  16654. Also, depending on inputs synchronization, the filters will drop
  16655. frames in case one input receives more frames than the other ones, and
  16656. the queue is already filled.
  16657. These filters accept the following options:
  16658. @table @option
  16659. @item nb_inputs, n
  16660. Set the number of different inputs, it is 2 by default.
  16661. @end table
  16662. @subsection Examples
  16663. @itemize
  16664. @item
  16665. Interleave frames belonging to different streams using @command{ffmpeg}:
  16666. @example
  16667. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  16668. @end example
  16669. @item
  16670. Add flickering blur effect:
  16671. @example
  16672. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  16673. @end example
  16674. @end itemize
  16675. @section metadata, ametadata
  16676. Manipulate frame metadata.
  16677. This filter accepts the following options:
  16678. @table @option
  16679. @item mode
  16680. Set mode of operation of the filter.
  16681. Can be one of the following:
  16682. @table @samp
  16683. @item select
  16684. If both @code{value} and @code{key} is set, select frames
  16685. which have such metadata. If only @code{key} is set, select
  16686. every frame that has such key in metadata.
  16687. @item add
  16688. Add new metadata @code{key} and @code{value}. If key is already available
  16689. do nothing.
  16690. @item modify
  16691. Modify value of already present key.
  16692. @item delete
  16693. If @code{value} is set, delete only keys that have such value.
  16694. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  16695. the frame.
  16696. @item print
  16697. Print key and its value if metadata was found. If @code{key} is not set print all
  16698. metadata values available in frame.
  16699. @end table
  16700. @item key
  16701. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  16702. @item value
  16703. Set metadata value which will be used. This option is mandatory for
  16704. @code{modify} and @code{add} mode.
  16705. @item function
  16706. Which function to use when comparing metadata value and @code{value}.
  16707. Can be one of following:
  16708. @table @samp
  16709. @item same_str
  16710. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  16711. @item starts_with
  16712. Values are interpreted as strings, returns true if metadata value starts with
  16713. the @code{value} option string.
  16714. @item less
  16715. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  16716. @item equal
  16717. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  16718. @item greater
  16719. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  16720. @item expr
  16721. Values are interpreted as floats, returns true if expression from option @code{expr}
  16722. evaluates to true.
  16723. @item ends_with
  16724. Values are interpreted as strings, returns true if metadata value ends with
  16725. the @code{value} option string.
  16726. @end table
  16727. @item expr
  16728. Set expression which is used when @code{function} is set to @code{expr}.
  16729. The expression is evaluated through the eval API and can contain the following
  16730. constants:
  16731. @table @option
  16732. @item VALUE1
  16733. Float representation of @code{value} from metadata key.
  16734. @item VALUE2
  16735. Float representation of @code{value} as supplied by user in @code{value} option.
  16736. @end table
  16737. @item file
  16738. If specified in @code{print} mode, output is written to the named file. Instead of
  16739. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  16740. for standard output. If @code{file} option is not set, output is written to the log
  16741. with AV_LOG_INFO loglevel.
  16742. @end table
  16743. @subsection Examples
  16744. @itemize
  16745. @item
  16746. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  16747. between 0 and 1.
  16748. @example
  16749. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  16750. @end example
  16751. @item
  16752. Print silencedetect output to file @file{metadata.txt}.
  16753. @example
  16754. silencedetect,ametadata=mode=print:file=metadata.txt
  16755. @end example
  16756. @item
  16757. Direct all metadata to a pipe with file descriptor 4.
  16758. @example
  16759. metadata=mode=print:file='pipe\:4'
  16760. @end example
  16761. @end itemize
  16762. @section perms, aperms
  16763. Set read/write permissions for the output frames.
  16764. These filters are mainly aimed at developers to test direct path in the
  16765. following filter in the filtergraph.
  16766. The filters accept the following options:
  16767. @table @option
  16768. @item mode
  16769. Select the permissions mode.
  16770. It accepts the following values:
  16771. @table @samp
  16772. @item none
  16773. Do nothing. This is the default.
  16774. @item ro
  16775. Set all the output frames read-only.
  16776. @item rw
  16777. Set all the output frames directly writable.
  16778. @item toggle
  16779. Make the frame read-only if writable, and writable if read-only.
  16780. @item random
  16781. Set each output frame read-only or writable randomly.
  16782. @end table
  16783. @item seed
  16784. Set the seed for the @var{random} mode, must be an integer included between
  16785. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  16786. @code{-1}, the filter will try to use a good random seed on a best effort
  16787. basis.
  16788. @end table
  16789. Note: in case of auto-inserted filter between the permission filter and the
  16790. following one, the permission might not be received as expected in that
  16791. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  16792. perms/aperms filter can avoid this problem.
  16793. @section realtime, arealtime
  16794. Slow down filtering to match real time approximately.
  16795. These filters will pause the filtering for a variable amount of time to
  16796. match the output rate with the input timestamps.
  16797. They are similar to the @option{re} option to @code{ffmpeg}.
  16798. They accept the following options:
  16799. @table @option
  16800. @item limit
  16801. Time limit for the pauses. Any pause longer than that will be considered
  16802. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  16803. @item speed
  16804. Speed factor for processing. The value must be a float larger than zero.
  16805. Values larger than 1.0 will result in faster than realtime processing,
  16806. smaller will slow processing down. The @var{limit} is automatically adapted
  16807. accordingly. Default is 1.0.
  16808. A processing speed faster than what is possible without these filters cannot
  16809. be achieved.
  16810. @end table
  16811. @anchor{select}
  16812. @section select, aselect
  16813. Select frames to pass in output.
  16814. This filter accepts the following options:
  16815. @table @option
  16816. @item expr, e
  16817. Set expression, which is evaluated for each input frame.
  16818. If the expression is evaluated to zero, the frame is discarded.
  16819. If the evaluation result is negative or NaN, the frame is sent to the
  16820. first output; otherwise it is sent to the output with index
  16821. @code{ceil(val)-1}, assuming that the input index starts from 0.
  16822. For example a value of @code{1.2} corresponds to the output with index
  16823. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  16824. @item outputs, n
  16825. Set the number of outputs. The output to which to send the selected
  16826. frame is based on the result of the evaluation. Default value is 1.
  16827. @end table
  16828. The expression can contain the following constants:
  16829. @table @option
  16830. @item n
  16831. The (sequential) number of the filtered frame, starting from 0.
  16832. @item selected_n
  16833. The (sequential) number of the selected frame, starting from 0.
  16834. @item prev_selected_n
  16835. The sequential number of the last selected frame. It's NAN if undefined.
  16836. @item TB
  16837. The timebase of the input timestamps.
  16838. @item pts
  16839. The PTS (Presentation TimeStamp) of the filtered video frame,
  16840. expressed in @var{TB} units. It's NAN if undefined.
  16841. @item t
  16842. The PTS of the filtered video frame,
  16843. expressed in seconds. It's NAN if undefined.
  16844. @item prev_pts
  16845. The PTS of the previously filtered video frame. It's NAN if undefined.
  16846. @item prev_selected_pts
  16847. The PTS of the last previously filtered video frame. It's NAN if undefined.
  16848. @item prev_selected_t
  16849. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  16850. @item start_pts
  16851. The PTS of the first video frame in the video. It's NAN if undefined.
  16852. @item start_t
  16853. The time of the first video frame in the video. It's NAN if undefined.
  16854. @item pict_type @emph{(video only)}
  16855. The type of the filtered frame. It can assume one of the following
  16856. values:
  16857. @table @option
  16858. @item I
  16859. @item P
  16860. @item B
  16861. @item S
  16862. @item SI
  16863. @item SP
  16864. @item BI
  16865. @end table
  16866. @item interlace_type @emph{(video only)}
  16867. The frame interlace type. It can assume one of the following values:
  16868. @table @option
  16869. @item PROGRESSIVE
  16870. The frame is progressive (not interlaced).
  16871. @item TOPFIRST
  16872. The frame is top-field-first.
  16873. @item BOTTOMFIRST
  16874. The frame is bottom-field-first.
  16875. @end table
  16876. @item consumed_sample_n @emph{(audio only)}
  16877. the number of selected samples before the current frame
  16878. @item samples_n @emph{(audio only)}
  16879. the number of samples in the current frame
  16880. @item sample_rate @emph{(audio only)}
  16881. the input sample rate
  16882. @item key
  16883. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  16884. @item pos
  16885. the position in the file of the filtered frame, -1 if the information
  16886. is not available (e.g. for synthetic video)
  16887. @item scene @emph{(video only)}
  16888. value between 0 and 1 to indicate a new scene; a low value reflects a low
  16889. probability for the current frame to introduce a new scene, while a higher
  16890. value means the current frame is more likely to be one (see the example below)
  16891. @item concatdec_select
  16892. The concat demuxer can select only part of a concat input file by setting an
  16893. inpoint and an outpoint, but the output packets may not be entirely contained
  16894. in the selected interval. By using this variable, it is possible to skip frames
  16895. generated by the concat demuxer which are not exactly contained in the selected
  16896. interval.
  16897. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  16898. and the @var{lavf.concat.duration} packet metadata values which are also
  16899. present in the decoded frames.
  16900. The @var{concatdec_select} variable is -1 if the frame pts is at least
  16901. start_time and either the duration metadata is missing or the frame pts is less
  16902. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  16903. missing.
  16904. That basically means that an input frame is selected if its pts is within the
  16905. interval set by the concat demuxer.
  16906. @end table
  16907. The default value of the select expression is "1".
  16908. @subsection Examples
  16909. @itemize
  16910. @item
  16911. Select all frames in input:
  16912. @example
  16913. select
  16914. @end example
  16915. The example above is the same as:
  16916. @example
  16917. select=1
  16918. @end example
  16919. @item
  16920. Skip all frames:
  16921. @example
  16922. select=0
  16923. @end example
  16924. @item
  16925. Select only I-frames:
  16926. @example
  16927. select='eq(pict_type\,I)'
  16928. @end example
  16929. @item
  16930. Select one frame every 100:
  16931. @example
  16932. select='not(mod(n\,100))'
  16933. @end example
  16934. @item
  16935. Select only frames contained in the 10-20 time interval:
  16936. @example
  16937. select=between(t\,10\,20)
  16938. @end example
  16939. @item
  16940. Select only I-frames contained in the 10-20 time interval:
  16941. @example
  16942. select=between(t\,10\,20)*eq(pict_type\,I)
  16943. @end example
  16944. @item
  16945. Select frames with a minimum distance of 10 seconds:
  16946. @example
  16947. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  16948. @end example
  16949. @item
  16950. Use aselect to select only audio frames with samples number > 100:
  16951. @example
  16952. aselect='gt(samples_n\,100)'
  16953. @end example
  16954. @item
  16955. Create a mosaic of the first scenes:
  16956. @example
  16957. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  16958. @end example
  16959. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  16960. choice.
  16961. @item
  16962. Send even and odd frames to separate outputs, and compose them:
  16963. @example
  16964. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  16965. @end example
  16966. @item
  16967. Select useful frames from an ffconcat file which is using inpoints and
  16968. outpoints but where the source files are not intra frame only.
  16969. @example
  16970. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  16971. @end example
  16972. @end itemize
  16973. @section sendcmd, asendcmd
  16974. Send commands to filters in the filtergraph.
  16975. These filters read commands to be sent to other filters in the
  16976. filtergraph.
  16977. @code{sendcmd} must be inserted between two video filters,
  16978. @code{asendcmd} must be inserted between two audio filters, but apart
  16979. from that they act the same way.
  16980. The specification of commands can be provided in the filter arguments
  16981. with the @var{commands} option, or in a file specified by the
  16982. @var{filename} option.
  16983. These filters accept the following options:
  16984. @table @option
  16985. @item commands, c
  16986. Set the commands to be read and sent to the other filters.
  16987. @item filename, f
  16988. Set the filename of the commands to be read and sent to the other
  16989. filters.
  16990. @end table
  16991. @subsection Commands syntax
  16992. A commands description consists of a sequence of interval
  16993. specifications, comprising a list of commands to be executed when a
  16994. particular event related to that interval occurs. The occurring event
  16995. is typically the current frame time entering or leaving a given time
  16996. interval.
  16997. An interval is specified by the following syntax:
  16998. @example
  16999. @var{START}[-@var{END}] @var{COMMANDS};
  17000. @end example
  17001. The time interval is specified by the @var{START} and @var{END} times.
  17002. @var{END} is optional and defaults to the maximum time.
  17003. The current frame time is considered within the specified interval if
  17004. it is included in the interval [@var{START}, @var{END}), that is when
  17005. the time is greater or equal to @var{START} and is lesser than
  17006. @var{END}.
  17007. @var{COMMANDS} consists of a sequence of one or more command
  17008. specifications, separated by ",", relating to that interval. The
  17009. syntax of a command specification is given by:
  17010. @example
  17011. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  17012. @end example
  17013. @var{FLAGS} is optional and specifies the type of events relating to
  17014. the time interval which enable sending the specified command, and must
  17015. be a non-null sequence of identifier flags separated by "+" or "|" and
  17016. enclosed between "[" and "]".
  17017. The following flags are recognized:
  17018. @table @option
  17019. @item enter
  17020. The command is sent when the current frame timestamp enters the
  17021. specified interval. In other words, the command is sent when the
  17022. previous frame timestamp was not in the given interval, and the
  17023. current is.
  17024. @item leave
  17025. The command is sent when the current frame timestamp leaves the
  17026. specified interval. In other words, the command is sent when the
  17027. previous frame timestamp was in the given interval, and the
  17028. current is not.
  17029. @end table
  17030. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  17031. assumed.
  17032. @var{TARGET} specifies the target of the command, usually the name of
  17033. the filter class or a specific filter instance name.
  17034. @var{COMMAND} specifies the name of the command for the target filter.
  17035. @var{ARG} is optional and specifies the optional list of argument for
  17036. the given @var{COMMAND}.
  17037. Between one interval specification and another, whitespaces, or
  17038. sequences of characters starting with @code{#} until the end of line,
  17039. are ignored and can be used to annotate comments.
  17040. A simplified BNF description of the commands specification syntax
  17041. follows:
  17042. @example
  17043. @var{COMMAND_FLAG} ::= "enter" | "leave"
  17044. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  17045. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  17046. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  17047. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  17048. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  17049. @end example
  17050. @subsection Examples
  17051. @itemize
  17052. @item
  17053. Specify audio tempo change at second 4:
  17054. @example
  17055. asendcmd=c='4.0 atempo tempo 1.5',atempo
  17056. @end example
  17057. @item
  17058. Target a specific filter instance:
  17059. @example
  17060. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  17061. @end example
  17062. @item
  17063. Specify a list of drawtext and hue commands in a file.
  17064. @example
  17065. # show text in the interval 5-10
  17066. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  17067. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  17068. # desaturate the image in the interval 15-20
  17069. 15.0-20.0 [enter] hue s 0,
  17070. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  17071. [leave] hue s 1,
  17072. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  17073. # apply an exponential saturation fade-out effect, starting from time 25
  17074. 25 [enter] hue s exp(25-t)
  17075. @end example
  17076. A filtergraph allowing to read and process the above command list
  17077. stored in a file @file{test.cmd}, can be specified with:
  17078. @example
  17079. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  17080. @end example
  17081. @end itemize
  17082. @anchor{setpts}
  17083. @section setpts, asetpts
  17084. Change the PTS (presentation timestamp) of the input frames.
  17085. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  17086. This filter accepts the following options:
  17087. @table @option
  17088. @item expr
  17089. The expression which is evaluated for each frame to construct its timestamp.
  17090. @end table
  17091. The expression is evaluated through the eval API and can contain the following
  17092. constants:
  17093. @table @option
  17094. @item FRAME_RATE, FR
  17095. frame rate, only defined for constant frame-rate video
  17096. @item PTS
  17097. The presentation timestamp in input
  17098. @item N
  17099. The count of the input frame for video or the number of consumed samples,
  17100. not including the current frame for audio, starting from 0.
  17101. @item NB_CONSUMED_SAMPLES
  17102. The number of consumed samples, not including the current frame (only
  17103. audio)
  17104. @item NB_SAMPLES, S
  17105. The number of samples in the current frame (only audio)
  17106. @item SAMPLE_RATE, SR
  17107. The audio sample rate.
  17108. @item STARTPTS
  17109. The PTS of the first frame.
  17110. @item STARTT
  17111. the time in seconds of the first frame
  17112. @item INTERLACED
  17113. State whether the current frame is interlaced.
  17114. @item T
  17115. the time in seconds of the current frame
  17116. @item POS
  17117. original position in the file of the frame, or undefined if undefined
  17118. for the current frame
  17119. @item PREV_INPTS
  17120. The previous input PTS.
  17121. @item PREV_INT
  17122. previous input time in seconds
  17123. @item PREV_OUTPTS
  17124. The previous output PTS.
  17125. @item PREV_OUTT
  17126. previous output time in seconds
  17127. @item RTCTIME
  17128. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  17129. instead.
  17130. @item RTCSTART
  17131. The wallclock (RTC) time at the start of the movie in microseconds.
  17132. @item TB
  17133. The timebase of the input timestamps.
  17134. @end table
  17135. @subsection Examples
  17136. @itemize
  17137. @item
  17138. Start counting PTS from zero
  17139. @example
  17140. setpts=PTS-STARTPTS
  17141. @end example
  17142. @item
  17143. Apply fast motion effect:
  17144. @example
  17145. setpts=0.5*PTS
  17146. @end example
  17147. @item
  17148. Apply slow motion effect:
  17149. @example
  17150. setpts=2.0*PTS
  17151. @end example
  17152. @item
  17153. Set fixed rate of 25 frames per second:
  17154. @example
  17155. setpts=N/(25*TB)
  17156. @end example
  17157. @item
  17158. Set fixed rate 25 fps with some jitter:
  17159. @example
  17160. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  17161. @end example
  17162. @item
  17163. Apply an offset of 10 seconds to the input PTS:
  17164. @example
  17165. setpts=PTS+10/TB
  17166. @end example
  17167. @item
  17168. Generate timestamps from a "live source" and rebase onto the current timebase:
  17169. @example
  17170. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  17171. @end example
  17172. @item
  17173. Generate timestamps by counting samples:
  17174. @example
  17175. asetpts=N/SR/TB
  17176. @end example
  17177. @end itemize
  17178. @section setrange
  17179. Force color range for the output video frame.
  17180. The @code{setrange} filter marks the color range property for the
  17181. output frames. It does not change the input frame, but only sets the
  17182. corresponding property, which affects how the frame is treated by
  17183. following filters.
  17184. The filter accepts the following options:
  17185. @table @option
  17186. @item range
  17187. Available values are:
  17188. @table @samp
  17189. @item auto
  17190. Keep the same color range property.
  17191. @item unspecified, unknown
  17192. Set the color range as unspecified.
  17193. @item limited, tv, mpeg
  17194. Set the color range as limited.
  17195. @item full, pc, jpeg
  17196. Set the color range as full.
  17197. @end table
  17198. @end table
  17199. @section settb, asettb
  17200. Set the timebase to use for the output frames timestamps.
  17201. It is mainly useful for testing timebase configuration.
  17202. It accepts the following parameters:
  17203. @table @option
  17204. @item expr, tb
  17205. The expression which is evaluated into the output timebase.
  17206. @end table
  17207. The value for @option{tb} is an arithmetic expression representing a
  17208. rational. The expression can contain the constants "AVTB" (the default
  17209. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  17210. audio only). Default value is "intb".
  17211. @subsection Examples
  17212. @itemize
  17213. @item
  17214. Set the timebase to 1/25:
  17215. @example
  17216. settb=expr=1/25
  17217. @end example
  17218. @item
  17219. Set the timebase to 1/10:
  17220. @example
  17221. settb=expr=0.1
  17222. @end example
  17223. @item
  17224. Set the timebase to 1001/1000:
  17225. @example
  17226. settb=1+0.001
  17227. @end example
  17228. @item
  17229. Set the timebase to 2*intb:
  17230. @example
  17231. settb=2*intb
  17232. @end example
  17233. @item
  17234. Set the default timebase value:
  17235. @example
  17236. settb=AVTB
  17237. @end example
  17238. @end itemize
  17239. @section showcqt
  17240. Convert input audio to a video output representing frequency spectrum
  17241. logarithmically using Brown-Puckette constant Q transform algorithm with
  17242. direct frequency domain coefficient calculation (but the transform itself
  17243. is not really constant Q, instead the Q factor is actually variable/clamped),
  17244. with musical tone scale, from E0 to D#10.
  17245. The filter accepts the following options:
  17246. @table @option
  17247. @item size, s
  17248. Specify the video size for the output. It must be even. For the syntax of this option,
  17249. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17250. Default value is @code{1920x1080}.
  17251. @item fps, rate, r
  17252. Set the output frame rate. Default value is @code{25}.
  17253. @item bar_h
  17254. Set the bargraph height. It must be even. Default value is @code{-1} which
  17255. computes the bargraph height automatically.
  17256. @item axis_h
  17257. Set the axis height. It must be even. Default value is @code{-1} which computes
  17258. the axis height automatically.
  17259. @item sono_h
  17260. Set the sonogram height. It must be even. Default value is @code{-1} which
  17261. computes the sonogram height automatically.
  17262. @item fullhd
  17263. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  17264. instead. Default value is @code{1}.
  17265. @item sono_v, volume
  17266. Specify the sonogram volume expression. It can contain variables:
  17267. @table @option
  17268. @item bar_v
  17269. the @var{bar_v} evaluated expression
  17270. @item frequency, freq, f
  17271. the frequency where it is evaluated
  17272. @item timeclamp, tc
  17273. the value of @var{timeclamp} option
  17274. @end table
  17275. and functions:
  17276. @table @option
  17277. @item a_weighting(f)
  17278. A-weighting of equal loudness
  17279. @item b_weighting(f)
  17280. B-weighting of equal loudness
  17281. @item c_weighting(f)
  17282. C-weighting of equal loudness.
  17283. @end table
  17284. Default value is @code{16}.
  17285. @item bar_v, volume2
  17286. Specify the bargraph volume expression. It can contain variables:
  17287. @table @option
  17288. @item sono_v
  17289. the @var{sono_v} evaluated expression
  17290. @item frequency, freq, f
  17291. the frequency where it is evaluated
  17292. @item timeclamp, tc
  17293. the value of @var{timeclamp} option
  17294. @end table
  17295. and functions:
  17296. @table @option
  17297. @item a_weighting(f)
  17298. A-weighting of equal loudness
  17299. @item b_weighting(f)
  17300. B-weighting of equal loudness
  17301. @item c_weighting(f)
  17302. C-weighting of equal loudness.
  17303. @end table
  17304. Default value is @code{sono_v}.
  17305. @item sono_g, gamma
  17306. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  17307. higher gamma makes the spectrum having more range. Default value is @code{3}.
  17308. Acceptable range is @code{[1, 7]}.
  17309. @item bar_g, gamma2
  17310. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  17311. @code{[1, 7]}.
  17312. @item bar_t
  17313. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  17314. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  17315. @item timeclamp, tc
  17316. Specify the transform timeclamp. At low frequency, there is trade-off between
  17317. accuracy in time domain and frequency domain. If timeclamp is lower,
  17318. event in time domain is represented more accurately (such as fast bass drum),
  17319. otherwise event in frequency domain is represented more accurately
  17320. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  17321. @item attack
  17322. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  17323. limits future samples by applying asymmetric windowing in time domain, useful
  17324. when low latency is required. Accepted range is @code{[0, 1]}.
  17325. @item basefreq
  17326. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  17327. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  17328. @item endfreq
  17329. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  17330. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  17331. @item coeffclamp
  17332. This option is deprecated and ignored.
  17333. @item tlength
  17334. Specify the transform length in time domain. Use this option to control accuracy
  17335. trade-off between time domain and frequency domain at every frequency sample.
  17336. It can contain variables:
  17337. @table @option
  17338. @item frequency, freq, f
  17339. the frequency where it is evaluated
  17340. @item timeclamp, tc
  17341. the value of @var{timeclamp} option.
  17342. @end table
  17343. Default value is @code{384*tc/(384+tc*f)}.
  17344. @item count
  17345. Specify the transform count for every video frame. Default value is @code{6}.
  17346. Acceptable range is @code{[1, 30]}.
  17347. @item fcount
  17348. Specify the transform count for every single pixel. Default value is @code{0},
  17349. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  17350. @item fontfile
  17351. Specify font file for use with freetype to draw the axis. If not specified,
  17352. use embedded font. Note that drawing with font file or embedded font is not
  17353. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  17354. option instead.
  17355. @item font
  17356. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  17357. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  17358. escaping.
  17359. @item fontcolor
  17360. Specify font color expression. This is arithmetic expression that should return
  17361. integer value 0xRRGGBB. It can contain variables:
  17362. @table @option
  17363. @item frequency, freq, f
  17364. the frequency where it is evaluated
  17365. @item timeclamp, tc
  17366. the value of @var{timeclamp} option
  17367. @end table
  17368. and functions:
  17369. @table @option
  17370. @item midi(f)
  17371. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  17372. @item r(x), g(x), b(x)
  17373. red, green, and blue value of intensity x.
  17374. @end table
  17375. Default value is @code{st(0, (midi(f)-59.5)/12);
  17376. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  17377. r(1-ld(1)) + b(ld(1))}.
  17378. @item axisfile
  17379. Specify image file to draw the axis. This option override @var{fontfile} and
  17380. @var{fontcolor} option.
  17381. @item axis, text
  17382. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  17383. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  17384. Default value is @code{1}.
  17385. @item csp
  17386. Set colorspace. The accepted values are:
  17387. @table @samp
  17388. @item unspecified
  17389. Unspecified (default)
  17390. @item bt709
  17391. BT.709
  17392. @item fcc
  17393. FCC
  17394. @item bt470bg
  17395. BT.470BG or BT.601-6 625
  17396. @item smpte170m
  17397. SMPTE-170M or BT.601-6 525
  17398. @item smpte240m
  17399. SMPTE-240M
  17400. @item bt2020ncl
  17401. BT.2020 with non-constant luminance
  17402. @end table
  17403. @item cscheme
  17404. Set spectrogram color scheme. This is list of floating point values with format
  17405. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  17406. The default is @code{1|0.5|0|0|0.5|1}.
  17407. @end table
  17408. @subsection Examples
  17409. @itemize
  17410. @item
  17411. Playing audio while showing the spectrum:
  17412. @example
  17413. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  17414. @end example
  17415. @item
  17416. Same as above, but with frame rate 30 fps:
  17417. @example
  17418. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  17419. @end example
  17420. @item
  17421. Playing at 1280x720:
  17422. @example
  17423. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  17424. @end example
  17425. @item
  17426. Disable sonogram display:
  17427. @example
  17428. sono_h=0
  17429. @end example
  17430. @item
  17431. A1 and its harmonics: A1, A2, (near)E3, A3:
  17432. @example
  17433. 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),
  17434. asplit[a][out1]; [a] showcqt [out0]'
  17435. @end example
  17436. @item
  17437. Same as above, but with more accuracy in frequency domain:
  17438. @example
  17439. 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),
  17440. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  17441. @end example
  17442. @item
  17443. Custom volume:
  17444. @example
  17445. bar_v=10:sono_v=bar_v*a_weighting(f)
  17446. @end example
  17447. @item
  17448. Custom gamma, now spectrum is linear to the amplitude.
  17449. @example
  17450. bar_g=2:sono_g=2
  17451. @end example
  17452. @item
  17453. Custom tlength equation:
  17454. @example
  17455. 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)))'
  17456. @end example
  17457. @item
  17458. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  17459. @example
  17460. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  17461. @end example
  17462. @item
  17463. Custom font using fontconfig:
  17464. @example
  17465. font='Courier New,Monospace,mono|bold'
  17466. @end example
  17467. @item
  17468. Custom frequency range with custom axis using image file:
  17469. @example
  17470. axisfile=myaxis.png:basefreq=40:endfreq=10000
  17471. @end example
  17472. @end itemize
  17473. @section showfreqs
  17474. Convert input audio to video output representing the audio power spectrum.
  17475. Audio amplitude is on Y-axis while frequency is on X-axis.
  17476. The filter accepts the following options:
  17477. @table @option
  17478. @item size, s
  17479. Specify size of video. For the syntax of this option, check the
  17480. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17481. Default is @code{1024x512}.
  17482. @item mode
  17483. Set display mode.
  17484. This set how each frequency bin will be represented.
  17485. It accepts the following values:
  17486. @table @samp
  17487. @item line
  17488. @item bar
  17489. @item dot
  17490. @end table
  17491. Default is @code{bar}.
  17492. @item ascale
  17493. Set amplitude scale.
  17494. It accepts the following values:
  17495. @table @samp
  17496. @item lin
  17497. Linear scale.
  17498. @item sqrt
  17499. Square root scale.
  17500. @item cbrt
  17501. Cubic root scale.
  17502. @item log
  17503. Logarithmic scale.
  17504. @end table
  17505. Default is @code{log}.
  17506. @item fscale
  17507. Set frequency scale.
  17508. It accepts the following values:
  17509. @table @samp
  17510. @item lin
  17511. Linear scale.
  17512. @item log
  17513. Logarithmic scale.
  17514. @item rlog
  17515. Reverse logarithmic scale.
  17516. @end table
  17517. Default is @code{lin}.
  17518. @item win_size
  17519. Set window size. Allowed range is from 16 to 65536.
  17520. Default is @code{2048}
  17521. @item win_func
  17522. Set windowing function.
  17523. It accepts the following values:
  17524. @table @samp
  17525. @item rect
  17526. @item bartlett
  17527. @item hanning
  17528. @item hamming
  17529. @item blackman
  17530. @item welch
  17531. @item flattop
  17532. @item bharris
  17533. @item bnuttall
  17534. @item bhann
  17535. @item sine
  17536. @item nuttall
  17537. @item lanczos
  17538. @item gauss
  17539. @item tukey
  17540. @item dolph
  17541. @item cauchy
  17542. @item parzen
  17543. @item poisson
  17544. @item bohman
  17545. @end table
  17546. Default is @code{hanning}.
  17547. @item overlap
  17548. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17549. which means optimal overlap for selected window function will be picked.
  17550. @item averaging
  17551. Set time averaging. Setting this to 0 will display current maximal peaks.
  17552. Default is @code{1}, which means time averaging is disabled.
  17553. @item colors
  17554. Specify list of colors separated by space or by '|' which will be used to
  17555. draw channel frequencies. Unrecognized or missing colors will be replaced
  17556. by white color.
  17557. @item cmode
  17558. Set channel display mode.
  17559. It accepts the following values:
  17560. @table @samp
  17561. @item combined
  17562. @item separate
  17563. @end table
  17564. Default is @code{combined}.
  17565. @item minamp
  17566. Set minimum amplitude used in @code{log} amplitude scaler.
  17567. @end table
  17568. @section showspatial
  17569. Convert stereo input audio to a video output, representing the spatial relationship
  17570. between two channels.
  17571. The filter accepts the following options:
  17572. @table @option
  17573. @item size, s
  17574. Specify the video size for the output. For the syntax of this option, check the
  17575. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17576. Default value is @code{512x512}.
  17577. @item win_size
  17578. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  17579. @item win_func
  17580. Set window function.
  17581. It accepts the following values:
  17582. @table @samp
  17583. @item rect
  17584. @item bartlett
  17585. @item hann
  17586. @item hanning
  17587. @item hamming
  17588. @item blackman
  17589. @item welch
  17590. @item flattop
  17591. @item bharris
  17592. @item bnuttall
  17593. @item bhann
  17594. @item sine
  17595. @item nuttall
  17596. @item lanczos
  17597. @item gauss
  17598. @item tukey
  17599. @item dolph
  17600. @item cauchy
  17601. @item parzen
  17602. @item poisson
  17603. @item bohman
  17604. @end table
  17605. Default value is @code{hann}.
  17606. @item overlap
  17607. Set ratio of overlap window. Default value is @code{0.5}.
  17608. When value is @code{1} overlap is set to recommended size for specific
  17609. window function currently used.
  17610. @end table
  17611. @anchor{showspectrum}
  17612. @section showspectrum
  17613. Convert input audio to a video output, representing the audio frequency
  17614. spectrum.
  17615. The filter accepts the following options:
  17616. @table @option
  17617. @item size, s
  17618. Specify the video size for the output. For the syntax of this option, check the
  17619. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17620. Default value is @code{640x512}.
  17621. @item slide
  17622. Specify how the spectrum should slide along the window.
  17623. It accepts the following values:
  17624. @table @samp
  17625. @item replace
  17626. the samples start again on the left when they reach the right
  17627. @item scroll
  17628. the samples scroll from right to left
  17629. @item fullframe
  17630. frames are only produced when the samples reach the right
  17631. @item rscroll
  17632. the samples scroll from left to right
  17633. @end table
  17634. Default value is @code{replace}.
  17635. @item mode
  17636. Specify display mode.
  17637. It accepts the following values:
  17638. @table @samp
  17639. @item combined
  17640. all channels are displayed in the same row
  17641. @item separate
  17642. all channels are displayed in separate rows
  17643. @end table
  17644. Default value is @samp{combined}.
  17645. @item color
  17646. Specify display color mode.
  17647. It accepts the following values:
  17648. @table @samp
  17649. @item channel
  17650. each channel is displayed in a separate color
  17651. @item intensity
  17652. each channel is displayed using the same color scheme
  17653. @item rainbow
  17654. each channel is displayed using the rainbow color scheme
  17655. @item moreland
  17656. each channel is displayed using the moreland color scheme
  17657. @item nebulae
  17658. each channel is displayed using the nebulae color scheme
  17659. @item fire
  17660. each channel is displayed using the fire color scheme
  17661. @item fiery
  17662. each channel is displayed using the fiery color scheme
  17663. @item fruit
  17664. each channel is displayed using the fruit color scheme
  17665. @item cool
  17666. each channel is displayed using the cool color scheme
  17667. @item magma
  17668. each channel is displayed using the magma color scheme
  17669. @item green
  17670. each channel is displayed using the green color scheme
  17671. @item viridis
  17672. each channel is displayed using the viridis color scheme
  17673. @item plasma
  17674. each channel is displayed using the plasma color scheme
  17675. @item cividis
  17676. each channel is displayed using the cividis color scheme
  17677. @item terrain
  17678. each channel is displayed using the terrain color scheme
  17679. @end table
  17680. Default value is @samp{channel}.
  17681. @item scale
  17682. Specify scale used for calculating intensity color values.
  17683. It accepts the following values:
  17684. @table @samp
  17685. @item lin
  17686. linear
  17687. @item sqrt
  17688. square root, default
  17689. @item cbrt
  17690. cubic root
  17691. @item log
  17692. logarithmic
  17693. @item 4thrt
  17694. 4th root
  17695. @item 5thrt
  17696. 5th root
  17697. @end table
  17698. Default value is @samp{sqrt}.
  17699. @item fscale
  17700. Specify frequency scale.
  17701. It accepts the following values:
  17702. @table @samp
  17703. @item lin
  17704. linear
  17705. @item log
  17706. logarithmic
  17707. @end table
  17708. Default value is @samp{lin}.
  17709. @item saturation
  17710. Set saturation modifier for displayed colors. Negative values provide
  17711. alternative color scheme. @code{0} is no saturation at all.
  17712. Saturation must be in [-10.0, 10.0] range.
  17713. Default value is @code{1}.
  17714. @item win_func
  17715. Set window function.
  17716. It accepts the following values:
  17717. @table @samp
  17718. @item rect
  17719. @item bartlett
  17720. @item hann
  17721. @item hanning
  17722. @item hamming
  17723. @item blackman
  17724. @item welch
  17725. @item flattop
  17726. @item bharris
  17727. @item bnuttall
  17728. @item bhann
  17729. @item sine
  17730. @item nuttall
  17731. @item lanczos
  17732. @item gauss
  17733. @item tukey
  17734. @item dolph
  17735. @item cauchy
  17736. @item parzen
  17737. @item poisson
  17738. @item bohman
  17739. @end table
  17740. Default value is @code{hann}.
  17741. @item orientation
  17742. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17743. @code{horizontal}. Default is @code{vertical}.
  17744. @item overlap
  17745. Set ratio of overlap window. Default value is @code{0}.
  17746. When value is @code{1} overlap is set to recommended size for specific
  17747. window function currently used.
  17748. @item gain
  17749. Set scale gain for calculating intensity color values.
  17750. Default value is @code{1}.
  17751. @item data
  17752. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  17753. @item rotation
  17754. Set color rotation, must be in [-1.0, 1.0] range.
  17755. Default value is @code{0}.
  17756. @item start
  17757. Set start frequency from which to display spectrogram. Default is @code{0}.
  17758. @item stop
  17759. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17760. @item fps
  17761. Set upper frame rate limit. Default is @code{auto}, unlimited.
  17762. @item legend
  17763. Draw time and frequency axes and legends. Default is disabled.
  17764. @end table
  17765. The usage is very similar to the showwaves filter; see the examples in that
  17766. section.
  17767. @subsection Examples
  17768. @itemize
  17769. @item
  17770. Large window with logarithmic color scaling:
  17771. @example
  17772. showspectrum=s=1280x480:scale=log
  17773. @end example
  17774. @item
  17775. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  17776. @example
  17777. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  17778. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  17779. @end example
  17780. @end itemize
  17781. @section showspectrumpic
  17782. Convert input audio to a single video frame, representing the audio frequency
  17783. spectrum.
  17784. The filter accepts the following options:
  17785. @table @option
  17786. @item size, s
  17787. Specify the video size for the output. For the syntax of this option, check the
  17788. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17789. Default value is @code{4096x2048}.
  17790. @item mode
  17791. Specify display mode.
  17792. It accepts the following values:
  17793. @table @samp
  17794. @item combined
  17795. all channels are displayed in the same row
  17796. @item separate
  17797. all channels are displayed in separate rows
  17798. @end table
  17799. Default value is @samp{combined}.
  17800. @item color
  17801. Specify display color mode.
  17802. It accepts the following values:
  17803. @table @samp
  17804. @item channel
  17805. each channel is displayed in a separate color
  17806. @item intensity
  17807. each channel is displayed using the same color scheme
  17808. @item rainbow
  17809. each channel is displayed using the rainbow color scheme
  17810. @item moreland
  17811. each channel is displayed using the moreland color scheme
  17812. @item nebulae
  17813. each channel is displayed using the nebulae color scheme
  17814. @item fire
  17815. each channel is displayed using the fire color scheme
  17816. @item fiery
  17817. each channel is displayed using the fiery color scheme
  17818. @item fruit
  17819. each channel is displayed using the fruit color scheme
  17820. @item cool
  17821. each channel is displayed using the cool color scheme
  17822. @item magma
  17823. each channel is displayed using the magma color scheme
  17824. @item green
  17825. each channel is displayed using the green color scheme
  17826. @item viridis
  17827. each channel is displayed using the viridis color scheme
  17828. @item plasma
  17829. each channel is displayed using the plasma color scheme
  17830. @item cividis
  17831. each channel is displayed using the cividis color scheme
  17832. @item terrain
  17833. each channel is displayed using the terrain color scheme
  17834. @end table
  17835. Default value is @samp{intensity}.
  17836. @item scale
  17837. Specify scale used for calculating intensity color values.
  17838. It accepts the following values:
  17839. @table @samp
  17840. @item lin
  17841. linear
  17842. @item sqrt
  17843. square root, default
  17844. @item cbrt
  17845. cubic root
  17846. @item log
  17847. logarithmic
  17848. @item 4thrt
  17849. 4th root
  17850. @item 5thrt
  17851. 5th root
  17852. @end table
  17853. Default value is @samp{log}.
  17854. @item fscale
  17855. Specify frequency scale.
  17856. It accepts the following values:
  17857. @table @samp
  17858. @item lin
  17859. linear
  17860. @item log
  17861. logarithmic
  17862. @end table
  17863. Default value is @samp{lin}.
  17864. @item saturation
  17865. Set saturation modifier for displayed colors. Negative values provide
  17866. alternative color scheme. @code{0} is no saturation at all.
  17867. Saturation must be in [-10.0, 10.0] range.
  17868. Default value is @code{1}.
  17869. @item win_func
  17870. Set window function.
  17871. It accepts the following values:
  17872. @table @samp
  17873. @item rect
  17874. @item bartlett
  17875. @item hann
  17876. @item hanning
  17877. @item hamming
  17878. @item blackman
  17879. @item welch
  17880. @item flattop
  17881. @item bharris
  17882. @item bnuttall
  17883. @item bhann
  17884. @item sine
  17885. @item nuttall
  17886. @item lanczos
  17887. @item gauss
  17888. @item tukey
  17889. @item dolph
  17890. @item cauchy
  17891. @item parzen
  17892. @item poisson
  17893. @item bohman
  17894. @end table
  17895. Default value is @code{hann}.
  17896. @item orientation
  17897. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17898. @code{horizontal}. Default is @code{vertical}.
  17899. @item gain
  17900. Set scale gain for calculating intensity color values.
  17901. Default value is @code{1}.
  17902. @item legend
  17903. Draw time and frequency axes and legends. Default is enabled.
  17904. @item rotation
  17905. Set color rotation, must be in [-1.0, 1.0] range.
  17906. Default value is @code{0}.
  17907. @item start
  17908. Set start frequency from which to display spectrogram. Default is @code{0}.
  17909. @item stop
  17910. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17911. @end table
  17912. @subsection Examples
  17913. @itemize
  17914. @item
  17915. Extract an audio spectrogram of a whole audio track
  17916. in a 1024x1024 picture using @command{ffmpeg}:
  17917. @example
  17918. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  17919. @end example
  17920. @end itemize
  17921. @section showvolume
  17922. Convert input audio volume to a video output.
  17923. The filter accepts the following options:
  17924. @table @option
  17925. @item rate, r
  17926. Set video rate.
  17927. @item b
  17928. Set border width, allowed range is [0, 5]. Default is 1.
  17929. @item w
  17930. Set channel width, allowed range is [80, 8192]. Default is 400.
  17931. @item h
  17932. Set channel height, allowed range is [1, 900]. Default is 20.
  17933. @item f
  17934. Set fade, allowed range is [0, 1]. Default is 0.95.
  17935. @item c
  17936. Set volume color expression.
  17937. The expression can use the following variables:
  17938. @table @option
  17939. @item VOLUME
  17940. Current max volume of channel in dB.
  17941. @item PEAK
  17942. Current peak.
  17943. @item CHANNEL
  17944. Current channel number, starting from 0.
  17945. @end table
  17946. @item t
  17947. If set, displays channel names. Default is enabled.
  17948. @item v
  17949. If set, displays volume values. Default is enabled.
  17950. @item o
  17951. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  17952. default is @code{h}.
  17953. @item s
  17954. Set step size, allowed range is [0, 5]. Default is 0, which means
  17955. step is disabled.
  17956. @item p
  17957. Set background opacity, allowed range is [0, 1]. Default is 0.
  17958. @item m
  17959. Set metering mode, can be peak: @code{p} or rms: @code{r},
  17960. default is @code{p}.
  17961. @item ds
  17962. Set display scale, can be linear: @code{lin} or log: @code{log},
  17963. default is @code{lin}.
  17964. @item dm
  17965. In second.
  17966. If set to > 0., display a line for the max level
  17967. in the previous seconds.
  17968. default is disabled: @code{0.}
  17969. @item dmc
  17970. The color of the max line. Use when @code{dm} option is set to > 0.
  17971. default is: @code{orange}
  17972. @end table
  17973. @section showwaves
  17974. Convert input audio to a video output, representing the samples waves.
  17975. The filter accepts the following options:
  17976. @table @option
  17977. @item size, s
  17978. Specify the video size for the output. For the syntax of this option, check the
  17979. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17980. Default value is @code{600x240}.
  17981. @item mode
  17982. Set display mode.
  17983. Available values are:
  17984. @table @samp
  17985. @item point
  17986. Draw a point for each sample.
  17987. @item line
  17988. Draw a vertical line for each sample.
  17989. @item p2p
  17990. Draw a point for each sample and a line between them.
  17991. @item cline
  17992. Draw a centered vertical line for each sample.
  17993. @end table
  17994. Default value is @code{point}.
  17995. @item n
  17996. Set the number of samples which are printed on the same column. A
  17997. larger value will decrease the frame rate. Must be a positive
  17998. integer. This option can be set only if the value for @var{rate}
  17999. is not explicitly specified.
  18000. @item rate, r
  18001. Set the (approximate) output frame rate. This is done by setting the
  18002. option @var{n}. Default value is "25".
  18003. @item split_channels
  18004. Set if channels should be drawn separately or overlap. Default value is 0.
  18005. @item colors
  18006. Set colors separated by '|' which are going to be used for drawing of each channel.
  18007. @item scale
  18008. Set amplitude scale.
  18009. Available values are:
  18010. @table @samp
  18011. @item lin
  18012. Linear.
  18013. @item log
  18014. Logarithmic.
  18015. @item sqrt
  18016. Square root.
  18017. @item cbrt
  18018. Cubic root.
  18019. @end table
  18020. Default is linear.
  18021. @item draw
  18022. Set the draw mode. This is mostly useful to set for high @var{n}.
  18023. Available values are:
  18024. @table @samp
  18025. @item scale
  18026. Scale pixel values for each drawn sample.
  18027. @item full
  18028. Draw every sample directly.
  18029. @end table
  18030. Default value is @code{scale}.
  18031. @end table
  18032. @subsection Examples
  18033. @itemize
  18034. @item
  18035. Output the input file audio and the corresponding video representation
  18036. at the same time:
  18037. @example
  18038. amovie=a.mp3,asplit[out0],showwaves[out1]
  18039. @end example
  18040. @item
  18041. Create a synthetic signal and show it with showwaves, forcing a
  18042. frame rate of 30 frames per second:
  18043. @example
  18044. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  18045. @end example
  18046. @end itemize
  18047. @section showwavespic
  18048. Convert input audio to a single video frame, representing the samples waves.
  18049. The filter accepts the following options:
  18050. @table @option
  18051. @item size, s
  18052. Specify the video size for the output. For the syntax of this option, check the
  18053. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18054. Default value is @code{600x240}.
  18055. @item split_channels
  18056. Set if channels should be drawn separately or overlap. Default value is 0.
  18057. @item colors
  18058. Set colors separated by '|' which are going to be used for drawing of each channel.
  18059. @item scale
  18060. Set amplitude scale.
  18061. Available values are:
  18062. @table @samp
  18063. @item lin
  18064. Linear.
  18065. @item log
  18066. Logarithmic.
  18067. @item sqrt
  18068. Square root.
  18069. @item cbrt
  18070. Cubic root.
  18071. @end table
  18072. Default is linear.
  18073. @item draw
  18074. Set the draw mode.
  18075. Available values are:
  18076. @table @samp
  18077. @item scale
  18078. Scale pixel values for each drawn sample.
  18079. @item full
  18080. Draw every sample directly.
  18081. @end table
  18082. Default value is @code{scale}.
  18083. @end table
  18084. @subsection Examples
  18085. @itemize
  18086. @item
  18087. Extract a channel split representation of the wave form of a whole audio track
  18088. in a 1024x800 picture using @command{ffmpeg}:
  18089. @example
  18090. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  18091. @end example
  18092. @end itemize
  18093. @section sidedata, asidedata
  18094. Delete frame side data, or select frames based on it.
  18095. This filter accepts the following options:
  18096. @table @option
  18097. @item mode
  18098. Set mode of operation of the filter.
  18099. Can be one of the following:
  18100. @table @samp
  18101. @item select
  18102. Select every frame with side data of @code{type}.
  18103. @item delete
  18104. Delete side data of @code{type}. If @code{type} is not set, delete all side
  18105. data in the frame.
  18106. @end table
  18107. @item type
  18108. Set side data type used with all modes. Must be set for @code{select} mode. For
  18109. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  18110. in @file{libavutil/frame.h}. For example, to choose
  18111. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  18112. @end table
  18113. @section spectrumsynth
  18114. Synthesize audio from 2 input video spectrums, first input stream represents
  18115. magnitude across time and second represents phase across time.
  18116. The filter will transform from frequency domain as displayed in videos back
  18117. to time domain as presented in audio output.
  18118. This filter is primarily created for reversing processed @ref{showspectrum}
  18119. filter outputs, but can synthesize sound from other spectrograms too.
  18120. But in such case results are going to be poor if the phase data is not
  18121. available, because in such cases phase data need to be recreated, usually
  18122. it's just recreated from random noise.
  18123. For best results use gray only output (@code{channel} color mode in
  18124. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  18125. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  18126. @code{data} option. Inputs videos should generally use @code{fullframe}
  18127. slide mode as that saves resources needed for decoding video.
  18128. The filter accepts the following options:
  18129. @table @option
  18130. @item sample_rate
  18131. Specify sample rate of output audio, the sample rate of audio from which
  18132. spectrum was generated may differ.
  18133. @item channels
  18134. Set number of channels represented in input video spectrums.
  18135. @item scale
  18136. Set scale which was used when generating magnitude input spectrum.
  18137. Can be @code{lin} or @code{log}. Default is @code{log}.
  18138. @item slide
  18139. Set slide which was used when generating inputs spectrums.
  18140. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  18141. Default is @code{fullframe}.
  18142. @item win_func
  18143. Set window function used for resynthesis.
  18144. @item overlap
  18145. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  18146. which means optimal overlap for selected window function will be picked.
  18147. @item orientation
  18148. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  18149. Default is @code{vertical}.
  18150. @end table
  18151. @subsection Examples
  18152. @itemize
  18153. @item
  18154. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  18155. then resynthesize videos back to audio with spectrumsynth:
  18156. @example
  18157. 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
  18158. 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
  18159. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  18160. @end example
  18161. @end itemize
  18162. @section split, asplit
  18163. Split input into several identical outputs.
  18164. @code{asplit} works with audio input, @code{split} with video.
  18165. The filter accepts a single parameter which specifies the number of outputs. If
  18166. unspecified, it defaults to 2.
  18167. @subsection Examples
  18168. @itemize
  18169. @item
  18170. Create two separate outputs from the same input:
  18171. @example
  18172. [in] split [out0][out1]
  18173. @end example
  18174. @item
  18175. To create 3 or more outputs, you need to specify the number of
  18176. outputs, like in:
  18177. @example
  18178. [in] asplit=3 [out0][out1][out2]
  18179. @end example
  18180. @item
  18181. Create two separate outputs from the same input, one cropped and
  18182. one padded:
  18183. @example
  18184. [in] split [splitout1][splitout2];
  18185. [splitout1] crop=100:100:0:0 [cropout];
  18186. [splitout2] pad=200:200:100:100 [padout];
  18187. @end example
  18188. @item
  18189. Create 5 copies of the input audio with @command{ffmpeg}:
  18190. @example
  18191. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  18192. @end example
  18193. @end itemize
  18194. @section zmq, azmq
  18195. Receive commands sent through a libzmq client, and forward them to
  18196. filters in the filtergraph.
  18197. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  18198. must be inserted between two video filters, @code{azmq} between two
  18199. audio filters. Both are capable to send messages to any filter type.
  18200. To enable these filters you need to install the libzmq library and
  18201. headers and configure FFmpeg with @code{--enable-libzmq}.
  18202. For more information about libzmq see:
  18203. @url{http://www.zeromq.org/}
  18204. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  18205. receives messages sent through a network interface defined by the
  18206. @option{bind_address} (or the abbreviation "@option{b}") option.
  18207. Default value of this option is @file{tcp://localhost:5555}. You may
  18208. want to alter this value to your needs, but do not forget to escape any
  18209. ':' signs (see @ref{filtergraph escaping}).
  18210. The received message must be in the form:
  18211. @example
  18212. @var{TARGET} @var{COMMAND} [@var{ARG}]
  18213. @end example
  18214. @var{TARGET} specifies the target of the command, usually the name of
  18215. the filter class or a specific filter instance name. The default
  18216. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  18217. but you can override this by using the @samp{filter_name@@id} syntax
  18218. (see @ref{Filtergraph syntax}).
  18219. @var{COMMAND} specifies the name of the command for the target filter.
  18220. @var{ARG} is optional and specifies the optional argument list for the
  18221. given @var{COMMAND}.
  18222. Upon reception, the message is processed and the corresponding command
  18223. is injected into the filtergraph. Depending on the result, the filter
  18224. will send a reply to the client, adopting the format:
  18225. @example
  18226. @var{ERROR_CODE} @var{ERROR_REASON}
  18227. @var{MESSAGE}
  18228. @end example
  18229. @var{MESSAGE} is optional.
  18230. @subsection Examples
  18231. Look at @file{tools/zmqsend} for an example of a zmq client which can
  18232. be used to send commands processed by these filters.
  18233. Consider the following filtergraph generated by @command{ffplay}.
  18234. In this example the last overlay filter has an instance name. All other
  18235. filters will have default instance names.
  18236. @example
  18237. ffplay -dumpgraph 1 -f lavfi "
  18238. color=s=100x100:c=red [l];
  18239. color=s=100x100:c=blue [r];
  18240. nullsrc=s=200x100, zmq [bg];
  18241. [bg][l] overlay [bg+l];
  18242. [bg+l][r] overlay@@my=x=100 "
  18243. @end example
  18244. To change the color of the left side of the video, the following
  18245. command can be used:
  18246. @example
  18247. echo Parsed_color_0 c yellow | tools/zmqsend
  18248. @end example
  18249. To change the right side:
  18250. @example
  18251. echo Parsed_color_1 c pink | tools/zmqsend
  18252. @end example
  18253. To change the position of the right side:
  18254. @example
  18255. echo overlay@@my x 150 | tools/zmqsend
  18256. @end example
  18257. @c man end MULTIMEDIA FILTERS
  18258. @chapter Multimedia Sources
  18259. @c man begin MULTIMEDIA SOURCES
  18260. Below is a description of the currently available multimedia sources.
  18261. @section amovie
  18262. This is the same as @ref{movie} source, except it selects an audio
  18263. stream by default.
  18264. @anchor{movie}
  18265. @section movie
  18266. Read audio and/or video stream(s) from a movie container.
  18267. It accepts the following parameters:
  18268. @table @option
  18269. @item filename
  18270. The name of the resource to read (not necessarily a file; it can also be a
  18271. device or a stream accessed through some protocol).
  18272. @item format_name, f
  18273. Specifies the format assumed for the movie to read, and can be either
  18274. the name of a container or an input device. If not specified, the
  18275. format is guessed from @var{movie_name} or by probing.
  18276. @item seek_point, sp
  18277. Specifies the seek point in seconds. The frames will be output
  18278. starting from this seek point. The parameter is evaluated with
  18279. @code{av_strtod}, so the numerical value may be suffixed by an IS
  18280. postfix. The default value is "0".
  18281. @item streams, s
  18282. Specifies the streams to read. Several streams can be specified,
  18283. separated by "+". The source will then have as many outputs, in the
  18284. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  18285. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  18286. respectively the default (best suited) video and audio stream. Default
  18287. is "dv", or "da" if the filter is called as "amovie".
  18288. @item stream_index, si
  18289. Specifies the index of the video stream to read. If the value is -1,
  18290. the most suitable video stream will be automatically selected. The default
  18291. value is "-1". Deprecated. If the filter is called "amovie", it will select
  18292. audio instead of video.
  18293. @item loop
  18294. Specifies how many times to read the stream in sequence.
  18295. If the value is 0, the stream will be looped infinitely.
  18296. Default value is "1".
  18297. Note that when the movie is looped the source timestamps are not
  18298. changed, so it will generate non monotonically increasing timestamps.
  18299. @item discontinuity
  18300. Specifies the time difference between frames above which the point is
  18301. considered a timestamp discontinuity which is removed by adjusting the later
  18302. timestamps.
  18303. @end table
  18304. It allows overlaying a second video on top of the main input of
  18305. a filtergraph, as shown in this graph:
  18306. @example
  18307. input -----------> deltapts0 --> overlay --> output
  18308. ^
  18309. |
  18310. movie --> scale--> deltapts1 -------+
  18311. @end example
  18312. @subsection Examples
  18313. @itemize
  18314. @item
  18315. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  18316. on top of the input labelled "in":
  18317. @example
  18318. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  18319. [in] setpts=PTS-STARTPTS [main];
  18320. [main][over] overlay=16:16 [out]
  18321. @end example
  18322. @item
  18323. Read from a video4linux2 device, and overlay it on top of the input
  18324. labelled "in":
  18325. @example
  18326. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  18327. [in] setpts=PTS-STARTPTS [main];
  18328. [main][over] overlay=16:16 [out]
  18329. @end example
  18330. @item
  18331. Read the first video stream and the audio stream with id 0x81 from
  18332. dvd.vob; the video is connected to the pad named "video" and the audio is
  18333. connected to the pad named "audio":
  18334. @example
  18335. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  18336. @end example
  18337. @end itemize
  18338. @subsection Commands
  18339. Both movie and amovie support the following commands:
  18340. @table @option
  18341. @item seek
  18342. Perform seek using "av_seek_frame".
  18343. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  18344. @itemize
  18345. @item
  18346. @var{stream_index}: If stream_index is -1, a default
  18347. stream is selected, and @var{timestamp} is automatically converted
  18348. from AV_TIME_BASE units to the stream specific time_base.
  18349. @item
  18350. @var{timestamp}: Timestamp in AVStream.time_base units
  18351. or, if no stream is specified, in AV_TIME_BASE units.
  18352. @item
  18353. @var{flags}: Flags which select direction and seeking mode.
  18354. @end itemize
  18355. @item get_duration
  18356. Get movie duration in AV_TIME_BASE units.
  18357. @end table
  18358. @c man end MULTIMEDIA SOURCES