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.

24075 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 ammount, 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. @section anull
  1436. Pass the audio source unchanged to the output.
  1437. @section apad
  1438. Pad the end of an audio stream with silence.
  1439. This can be used together with @command{ffmpeg} @option{-shortest} to
  1440. extend audio streams to the same length as the video stream.
  1441. A description of the accepted options follows.
  1442. @table @option
  1443. @item packet_size
  1444. Set silence packet size. Default value is 4096.
  1445. @item pad_len
  1446. Set the number of samples of silence to add to the end. After the
  1447. value is reached, the stream is terminated. This option is mutually
  1448. exclusive with @option{whole_len}.
  1449. @item whole_len
  1450. Set the minimum total number of samples in the output audio stream. If
  1451. the value is longer than the input audio length, silence is added to
  1452. the end, until the value is reached. This option is mutually exclusive
  1453. with @option{pad_len}.
  1454. @item pad_dur
  1455. Specify the duration of samples of silence to add. See
  1456. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1457. for the accepted syntax. Used only if set to non-zero value.
  1458. @item whole_dur
  1459. Specify the minimum total duration in the output audio stream. See
  1460. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1461. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1462. the input audio length, silence is added to the end, until the value is reached.
  1463. This option is mutually exclusive with @option{pad_dur}
  1464. @end table
  1465. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1466. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1467. the input stream indefinitely.
  1468. @subsection Examples
  1469. @itemize
  1470. @item
  1471. Add 1024 samples of silence to the end of the input:
  1472. @example
  1473. apad=pad_len=1024
  1474. @end example
  1475. @item
  1476. Make sure the audio output will contain at least 10000 samples, pad
  1477. the input with silence if required:
  1478. @example
  1479. apad=whole_len=10000
  1480. @end example
  1481. @item
  1482. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1483. video stream will always result the shortest and will be converted
  1484. until the end in the output file when using the @option{shortest}
  1485. option:
  1486. @example
  1487. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1488. @end example
  1489. @end itemize
  1490. @section aphaser
  1491. Add a phasing effect to the input audio.
  1492. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1493. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1494. A description of the accepted parameters follows.
  1495. @table @option
  1496. @item in_gain
  1497. Set input gain. Default is 0.4.
  1498. @item out_gain
  1499. Set output gain. Default is 0.74
  1500. @item delay
  1501. Set delay in milliseconds. Default is 3.0.
  1502. @item decay
  1503. Set decay. Default is 0.4.
  1504. @item speed
  1505. Set modulation speed in Hz. Default is 0.5.
  1506. @item type
  1507. Set modulation type. Default is triangular.
  1508. It accepts the following values:
  1509. @table @samp
  1510. @item triangular, t
  1511. @item sinusoidal, s
  1512. @end table
  1513. @end table
  1514. @section apulsator
  1515. Audio pulsator is something between an autopanner and a tremolo.
  1516. But it can produce funny stereo effects as well. Pulsator changes the volume
  1517. of the left and right channel based on a LFO (low frequency oscillator) with
  1518. different waveforms and shifted phases.
  1519. This filter have the ability to define an offset between left and right
  1520. channel. An offset of 0 means that both LFO shapes match each other.
  1521. The left and right channel are altered equally - a conventional tremolo.
  1522. An offset of 50% means that the shape of the right channel is exactly shifted
  1523. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1524. an autopanner. At 1 both curves match again. Every setting in between moves the
  1525. phase shift gapless between all stages and produces some "bypassing" sounds with
  1526. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1527. the 0.5) the faster the signal passes from the left to the right speaker.
  1528. The filter accepts the following options:
  1529. @table @option
  1530. @item level_in
  1531. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1532. @item level_out
  1533. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1534. @item mode
  1535. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1536. sawup or sawdown. Default is sine.
  1537. @item amount
  1538. Set modulation. Define how much of original signal is affected by the LFO.
  1539. @item offset_l
  1540. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1541. @item offset_r
  1542. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1543. @item width
  1544. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1545. @item timing
  1546. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1547. @item bpm
  1548. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1549. is set to bpm.
  1550. @item ms
  1551. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1552. is set to ms.
  1553. @item hz
  1554. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1555. if timing is set to hz.
  1556. @end table
  1557. @anchor{aresample}
  1558. @section aresample
  1559. Resample the input audio to the specified parameters, using the
  1560. libswresample library. If none are specified then the filter will
  1561. automatically convert between its input and output.
  1562. This filter is also able to stretch/squeeze the audio data to make it match
  1563. the timestamps or to inject silence / cut out audio to make it match the
  1564. timestamps, do a combination of both or do neither.
  1565. The filter accepts the syntax
  1566. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1567. expresses a sample rate and @var{resampler_options} is a list of
  1568. @var{key}=@var{value} pairs, separated by ":". See the
  1569. @ref{Resampler Options,,"Resampler Options" section in the
  1570. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1571. for the complete list of supported options.
  1572. @subsection Examples
  1573. @itemize
  1574. @item
  1575. Resample the input audio to 44100Hz:
  1576. @example
  1577. aresample=44100
  1578. @end example
  1579. @item
  1580. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1581. samples per second compensation:
  1582. @example
  1583. aresample=async=1000
  1584. @end example
  1585. @end itemize
  1586. @section areverse
  1587. Reverse an audio clip.
  1588. Warning: This filter requires memory to buffer the entire clip, so trimming
  1589. is suggested.
  1590. @subsection Examples
  1591. @itemize
  1592. @item
  1593. Take the first 5 seconds of a clip, and reverse it.
  1594. @example
  1595. atrim=end=5,areverse
  1596. @end example
  1597. @end itemize
  1598. @section asetnsamples
  1599. Set the number of samples per each output audio frame.
  1600. The last output packet may contain a different number of samples, as
  1601. the filter will flush all the remaining samples when the input audio
  1602. signals its end.
  1603. The filter accepts the following options:
  1604. @table @option
  1605. @item nb_out_samples, n
  1606. Set the number of frames per each output audio frame. The number is
  1607. intended as the number of samples @emph{per each channel}.
  1608. Default value is 1024.
  1609. @item pad, p
  1610. If set to 1, the filter will pad the last audio frame with zeroes, so
  1611. that the last frame will contain the same number of samples as the
  1612. previous ones. Default value is 1.
  1613. @end table
  1614. For example, to set the number of per-frame samples to 1234 and
  1615. disable padding for the last frame, use:
  1616. @example
  1617. asetnsamples=n=1234:p=0
  1618. @end example
  1619. @section asetrate
  1620. Set the sample rate without altering the PCM data.
  1621. This will result in a change of speed and pitch.
  1622. The filter accepts the following options:
  1623. @table @option
  1624. @item sample_rate, r
  1625. Set the output sample rate. Default is 44100 Hz.
  1626. @end table
  1627. @section ashowinfo
  1628. Show a line containing various information for each input audio frame.
  1629. The input audio is not modified.
  1630. The shown line contains a sequence of key/value pairs of the form
  1631. @var{key}:@var{value}.
  1632. The following values are shown in the output:
  1633. @table @option
  1634. @item n
  1635. The (sequential) number of the input frame, starting from 0.
  1636. @item pts
  1637. The presentation timestamp of the input frame, in time base units; the time base
  1638. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1639. @item pts_time
  1640. The presentation timestamp of the input frame in seconds.
  1641. @item pos
  1642. position of the frame in the input stream, -1 if this information in
  1643. unavailable and/or meaningless (for example in case of synthetic audio)
  1644. @item fmt
  1645. The sample format.
  1646. @item chlayout
  1647. The channel layout.
  1648. @item rate
  1649. The sample rate for the audio frame.
  1650. @item nb_samples
  1651. The number of samples (per channel) in the frame.
  1652. @item checksum
  1653. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1654. audio, the data is treated as if all the planes were concatenated.
  1655. @item plane_checksums
  1656. A list of Adler-32 checksums for each data plane.
  1657. @end table
  1658. @section asoftclip
  1659. Apply audio soft clipping.
  1660. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1661. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1662. This filter accepts the following options:
  1663. @table @option
  1664. @item type
  1665. Set type of soft-clipping.
  1666. It accepts the following values:
  1667. @table @option
  1668. @item tanh
  1669. @item atan
  1670. @item cubic
  1671. @item exp
  1672. @item alg
  1673. @item quintic
  1674. @item sin
  1675. @end table
  1676. @item param
  1677. Set additional parameter which controls sigmoid function.
  1678. @end table
  1679. @section asr
  1680. Automatic Speech Recognition
  1681. This filter uses PocketSphinx for speech recognition. To enable
  1682. compilation of this filter, you need to configure FFmpeg with
  1683. @code{--enable-pocketsphinx}.
  1684. It accepts the following options:
  1685. @table @option
  1686. @item rate
  1687. Set sampling rate of input audio. Defaults is @code{16000}.
  1688. This need to match speech models, otherwise one will get poor results.
  1689. @item hmm
  1690. Set dictionary containing acoustic model files.
  1691. @item dict
  1692. Set pronunciation dictionary.
  1693. @item lm
  1694. Set language model file.
  1695. @item lmctl
  1696. Set language model set.
  1697. @item lmname
  1698. Set which language model to use.
  1699. @item logfn
  1700. Set output for log messages.
  1701. @end table
  1702. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1703. @anchor{astats}
  1704. @section astats
  1705. Display time domain statistical information about the audio channels.
  1706. Statistics are calculated and displayed for each audio channel and,
  1707. where applicable, an overall figure is also given.
  1708. It accepts the following option:
  1709. @table @option
  1710. @item length
  1711. Short window length in seconds, used for peak and trough RMS measurement.
  1712. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1713. @item metadata
  1714. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1715. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1716. disabled.
  1717. Available keys for each channel are:
  1718. DC_offset
  1719. Min_level
  1720. Max_level
  1721. Min_difference
  1722. Max_difference
  1723. Mean_difference
  1724. RMS_difference
  1725. Peak_level
  1726. RMS_peak
  1727. RMS_trough
  1728. Crest_factor
  1729. Flat_factor
  1730. Peak_count
  1731. Bit_depth
  1732. Dynamic_range
  1733. Zero_crossings
  1734. Zero_crossings_rate
  1735. Number_of_NaNs
  1736. Number_of_Infs
  1737. Number_of_denormals
  1738. and for Overall:
  1739. DC_offset
  1740. Min_level
  1741. Max_level
  1742. Min_difference
  1743. Max_difference
  1744. Mean_difference
  1745. RMS_difference
  1746. Peak_level
  1747. RMS_level
  1748. RMS_peak
  1749. RMS_trough
  1750. Flat_factor
  1751. Peak_count
  1752. Bit_depth
  1753. Number_of_samples
  1754. Number_of_NaNs
  1755. Number_of_Infs
  1756. Number_of_denormals
  1757. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1758. this @code{lavfi.astats.Overall.Peak_count}.
  1759. For description what each key means read below.
  1760. @item reset
  1761. Set number of frame after which stats are going to be recalculated.
  1762. Default is disabled.
  1763. @item measure_perchannel
  1764. Select the entries which need to be measured per channel. The metadata keys can
  1765. be used as flags, default is @option{all} which measures everything.
  1766. @option{none} disables all per channel measurement.
  1767. @item measure_overall
  1768. Select the entries which need to be measured overall. The metadata keys can
  1769. be used as flags, default is @option{all} which measures everything.
  1770. @option{none} disables all overall measurement.
  1771. @end table
  1772. A description of each shown parameter follows:
  1773. @table @option
  1774. @item DC offset
  1775. Mean amplitude displacement from zero.
  1776. @item Min level
  1777. Minimal sample level.
  1778. @item Max level
  1779. Maximal sample level.
  1780. @item Min difference
  1781. Minimal difference between two consecutive samples.
  1782. @item Max difference
  1783. Maximal difference between two consecutive samples.
  1784. @item Mean difference
  1785. Mean difference between two consecutive samples.
  1786. The average of each difference between two consecutive samples.
  1787. @item RMS difference
  1788. Root Mean Square difference between two consecutive samples.
  1789. @item Peak level dB
  1790. @item RMS level dB
  1791. Standard peak and RMS level measured in dBFS.
  1792. @item RMS peak dB
  1793. @item RMS trough dB
  1794. Peak and trough values for RMS level measured over a short window.
  1795. @item Crest factor
  1796. Standard ratio of peak to RMS level (note: not in dB).
  1797. @item Flat factor
  1798. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1799. (i.e. either @var{Min level} or @var{Max level}).
  1800. @item Peak count
  1801. Number of occasions (not the number of samples) that the signal attained either
  1802. @var{Min level} or @var{Max level}.
  1803. @item Bit depth
  1804. Overall bit depth of audio. Number of bits used for each sample.
  1805. @item Dynamic range
  1806. Measured dynamic range of audio in dB.
  1807. @item Zero crossings
  1808. Number of points where the waveform crosses the zero level axis.
  1809. @item Zero crossings rate
  1810. Rate of Zero crossings and number of audio samples.
  1811. @end table
  1812. @section atempo
  1813. Adjust audio tempo.
  1814. The filter accepts exactly one parameter, the audio tempo. If not
  1815. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1816. be in the [0.5, 100.0] range.
  1817. Note that tempo greater than 2 will skip some samples rather than
  1818. blend them in. If for any reason this is a concern it is always
  1819. possible to daisy-chain several instances of atempo to achieve the
  1820. desired product tempo.
  1821. @subsection Examples
  1822. @itemize
  1823. @item
  1824. Slow down audio to 80% tempo:
  1825. @example
  1826. atempo=0.8
  1827. @end example
  1828. @item
  1829. To speed up audio to 300% tempo:
  1830. @example
  1831. atempo=3
  1832. @end example
  1833. @item
  1834. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1835. @example
  1836. atempo=sqrt(3),atempo=sqrt(3)
  1837. @end example
  1838. @end itemize
  1839. @section atrim
  1840. Trim the input so that the output contains one continuous subpart of the input.
  1841. It accepts the following parameters:
  1842. @table @option
  1843. @item start
  1844. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1845. sample with the timestamp @var{start} will be the first sample in the output.
  1846. @item end
  1847. Specify time of the first audio sample that will be dropped, i.e. the
  1848. audio sample immediately preceding the one with the timestamp @var{end} will be
  1849. the last sample in the output.
  1850. @item start_pts
  1851. Same as @var{start}, except this option sets the start timestamp in samples
  1852. instead of seconds.
  1853. @item end_pts
  1854. Same as @var{end}, except this option sets the end timestamp in samples instead
  1855. of seconds.
  1856. @item duration
  1857. The maximum duration of the output in seconds.
  1858. @item start_sample
  1859. The number of the first sample that should be output.
  1860. @item end_sample
  1861. The number of the first sample that should be dropped.
  1862. @end table
  1863. @option{start}, @option{end}, and @option{duration} are expressed as time
  1864. duration specifications; see
  1865. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1866. Note that the first two sets of the start/end options and the @option{duration}
  1867. option look at the frame timestamp, while the _sample options simply count the
  1868. samples that pass through the filter. So start/end_pts and start/end_sample will
  1869. give different results when the timestamps are wrong, inexact or do not start at
  1870. zero. Also note that this filter does not modify the timestamps. If you wish
  1871. to have the output timestamps start at zero, insert the asetpts filter after the
  1872. atrim filter.
  1873. If multiple start or end options are set, this filter tries to be greedy and
  1874. keep all samples that match at least one of the specified constraints. To keep
  1875. only the part that matches all the constraints at once, chain multiple atrim
  1876. filters.
  1877. The defaults are such that all the input is kept. So it is possible to set e.g.
  1878. just the end values to keep everything before the specified time.
  1879. Examples:
  1880. @itemize
  1881. @item
  1882. Drop everything except the second minute of input:
  1883. @example
  1884. ffmpeg -i INPUT -af atrim=60:120
  1885. @end example
  1886. @item
  1887. Keep only the first 1000 samples:
  1888. @example
  1889. ffmpeg -i INPUT -af atrim=end_sample=1000
  1890. @end example
  1891. @end itemize
  1892. @section bandpass
  1893. Apply a two-pole Butterworth band-pass filter with central
  1894. frequency @var{frequency}, and (3dB-point) band-width width.
  1895. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1896. instead of the default: constant 0dB peak gain.
  1897. The filter roll off at 6dB per octave (20dB per decade).
  1898. The filter accepts the following options:
  1899. @table @option
  1900. @item frequency, f
  1901. Set the filter's central frequency. Default is @code{3000}.
  1902. @item csg
  1903. Constant skirt gain if set to 1. Defaults to 0.
  1904. @item width_type, t
  1905. Set method to specify band-width of filter.
  1906. @table @option
  1907. @item h
  1908. Hz
  1909. @item q
  1910. Q-Factor
  1911. @item o
  1912. octave
  1913. @item s
  1914. slope
  1915. @item k
  1916. kHz
  1917. @end table
  1918. @item width, w
  1919. Specify the band-width of a filter in width_type units.
  1920. @item mix, m
  1921. How much to use filtered signal in output. Default is 1.
  1922. Range is between 0 and 1.
  1923. @item channels, c
  1924. Specify which channels to filter, by default all available are filtered.
  1925. @end table
  1926. @subsection Commands
  1927. This filter supports the following commands:
  1928. @table @option
  1929. @item frequency, f
  1930. Change bandpass frequency.
  1931. Syntax for the command is : "@var{frequency}"
  1932. @item width_type, t
  1933. Change bandpass width_type.
  1934. Syntax for the command is : "@var{width_type}"
  1935. @item width, w
  1936. Change bandpass width.
  1937. Syntax for the command is : "@var{width}"
  1938. @item mix, m
  1939. Change bandpass mix.
  1940. Syntax for the command is : "@var{mix}"
  1941. @end table
  1942. @section bandreject
  1943. Apply a two-pole Butterworth band-reject filter with central
  1944. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1945. The filter roll off at 6dB per octave (20dB per decade).
  1946. The filter accepts the following options:
  1947. @table @option
  1948. @item frequency, f
  1949. Set the filter's central frequency. Default is @code{3000}.
  1950. @item width_type, t
  1951. Set method to specify band-width of filter.
  1952. @table @option
  1953. @item h
  1954. Hz
  1955. @item q
  1956. Q-Factor
  1957. @item o
  1958. octave
  1959. @item s
  1960. slope
  1961. @item k
  1962. kHz
  1963. @end table
  1964. @item width, w
  1965. Specify the band-width of a filter in width_type units.
  1966. @item mix, m
  1967. How much to use filtered signal in output. Default is 1.
  1968. Range is between 0 and 1.
  1969. @item channels, c
  1970. Specify which channels to filter, by default all available are filtered.
  1971. @end table
  1972. @subsection Commands
  1973. This filter supports the following commands:
  1974. @table @option
  1975. @item frequency, f
  1976. Change bandreject frequency.
  1977. Syntax for the command is : "@var{frequency}"
  1978. @item width_type, t
  1979. Change bandreject width_type.
  1980. Syntax for the command is : "@var{width_type}"
  1981. @item width, w
  1982. Change bandreject width.
  1983. Syntax for the command is : "@var{width}"
  1984. @item mix, m
  1985. Change bandreject mix.
  1986. Syntax for the command is : "@var{mix}"
  1987. @end table
  1988. @section bass, lowshelf
  1989. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1990. shelving filter with a response similar to that of a standard
  1991. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1992. The filter accepts the following options:
  1993. @table @option
  1994. @item gain, g
  1995. Give the gain at 0 Hz. Its useful range is about -20
  1996. (for a large cut) to +20 (for a large boost).
  1997. Beware of clipping when using a positive gain.
  1998. @item frequency, f
  1999. Set the filter's central frequency and so can be used
  2000. to extend or reduce the frequency range to be boosted or cut.
  2001. The default value is @code{100} Hz.
  2002. @item width_type, t
  2003. Set method to specify band-width of filter.
  2004. @table @option
  2005. @item h
  2006. Hz
  2007. @item q
  2008. Q-Factor
  2009. @item o
  2010. octave
  2011. @item s
  2012. slope
  2013. @item k
  2014. kHz
  2015. @end table
  2016. @item width, w
  2017. Determine how steep is the filter's shelf transition.
  2018. @item mix, m
  2019. How much to use filtered signal in output. Default is 1.
  2020. Range is between 0 and 1.
  2021. @item channels, c
  2022. Specify which channels to filter, by default all available are filtered.
  2023. @end table
  2024. @subsection Commands
  2025. This filter supports the following commands:
  2026. @table @option
  2027. @item frequency, f
  2028. Change bass frequency.
  2029. Syntax for the command is : "@var{frequency}"
  2030. @item width_type, t
  2031. Change bass width_type.
  2032. Syntax for the command is : "@var{width_type}"
  2033. @item width, w
  2034. Change bass width.
  2035. Syntax for the command is : "@var{width}"
  2036. @item gain, g
  2037. Change bass gain.
  2038. Syntax for the command is : "@var{gain}"
  2039. @item mix, m
  2040. Change bass mix.
  2041. Syntax for the command is : "@var{mix}"
  2042. @end table
  2043. @section biquad
  2044. Apply a biquad IIR filter with the given coefficients.
  2045. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2046. are the numerator and denominator coefficients respectively.
  2047. and @var{channels}, @var{c} specify which channels to filter, by default all
  2048. available are filtered.
  2049. @subsection Commands
  2050. This filter supports the following commands:
  2051. @table @option
  2052. @item a0
  2053. @item a1
  2054. @item a2
  2055. @item b0
  2056. @item b1
  2057. @item b2
  2058. Change biquad parameter.
  2059. Syntax for the command is : "@var{value}"
  2060. @item mix, m
  2061. How much to use filtered signal in output. Default is 1.
  2062. Range is between 0 and 1.
  2063. @end table
  2064. @section bs2b
  2065. Bauer stereo to binaural transformation, which improves headphone listening of
  2066. stereo audio records.
  2067. To enable compilation of this filter you need to configure FFmpeg with
  2068. @code{--enable-libbs2b}.
  2069. It accepts the following parameters:
  2070. @table @option
  2071. @item profile
  2072. Pre-defined crossfeed level.
  2073. @table @option
  2074. @item default
  2075. Default level (fcut=700, feed=50).
  2076. @item cmoy
  2077. Chu Moy circuit (fcut=700, feed=60).
  2078. @item jmeier
  2079. Jan Meier circuit (fcut=650, feed=95).
  2080. @end table
  2081. @item fcut
  2082. Cut frequency (in Hz).
  2083. @item feed
  2084. Feed level (in Hz).
  2085. @end table
  2086. @section channelmap
  2087. Remap input channels to new locations.
  2088. It accepts the following parameters:
  2089. @table @option
  2090. @item map
  2091. Map channels from input to output. The argument is a '|'-separated list of
  2092. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2093. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2094. channel (e.g. FL for front left) or its index in the input channel layout.
  2095. @var{out_channel} is the name of the output channel or its index in the output
  2096. channel layout. If @var{out_channel} is not given then it is implicitly an
  2097. index, starting with zero and increasing by one for each mapping.
  2098. @item channel_layout
  2099. The channel layout of the output stream.
  2100. @end table
  2101. If no mapping is present, the filter will implicitly map input channels to
  2102. output channels, preserving indices.
  2103. @subsection Examples
  2104. @itemize
  2105. @item
  2106. For example, assuming a 5.1+downmix input MOV file,
  2107. @example
  2108. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2109. @end example
  2110. will create an output WAV file tagged as stereo from the downmix channels of
  2111. the input.
  2112. @item
  2113. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2114. @example
  2115. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2116. @end example
  2117. @end itemize
  2118. @section channelsplit
  2119. Split each channel from an input audio stream into a separate output stream.
  2120. It accepts the following parameters:
  2121. @table @option
  2122. @item channel_layout
  2123. The channel layout of the input stream. The default is "stereo".
  2124. @item channels
  2125. A channel layout describing the channels to be extracted as separate output streams
  2126. or "all" to extract each input channel as a separate stream. The default is "all".
  2127. Choosing channels not present in channel layout in the input will result in an error.
  2128. @end table
  2129. @subsection Examples
  2130. @itemize
  2131. @item
  2132. For example, assuming a stereo input MP3 file,
  2133. @example
  2134. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2135. @end example
  2136. will create an output Matroska file with two audio streams, one containing only
  2137. the left channel and the other the right channel.
  2138. @item
  2139. Split a 5.1 WAV file into per-channel files:
  2140. @example
  2141. ffmpeg -i in.wav -filter_complex
  2142. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2143. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2144. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2145. side_right.wav
  2146. @end example
  2147. @item
  2148. Extract only LFE from a 5.1 WAV file:
  2149. @example
  2150. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2151. -map '[LFE]' lfe.wav
  2152. @end example
  2153. @end itemize
  2154. @section chorus
  2155. Add a chorus effect to the audio.
  2156. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2157. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2158. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2159. The modulation depth defines the range the modulated delay is played before or after
  2160. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2161. sound tuned around the original one, like in a chorus where some vocals are slightly
  2162. off key.
  2163. It accepts the following parameters:
  2164. @table @option
  2165. @item in_gain
  2166. Set input gain. Default is 0.4.
  2167. @item out_gain
  2168. Set output gain. Default is 0.4.
  2169. @item delays
  2170. Set delays. A typical delay is around 40ms to 60ms.
  2171. @item decays
  2172. Set decays.
  2173. @item speeds
  2174. Set speeds.
  2175. @item depths
  2176. Set depths.
  2177. @end table
  2178. @subsection Examples
  2179. @itemize
  2180. @item
  2181. A single delay:
  2182. @example
  2183. chorus=0.7:0.9:55:0.4:0.25:2
  2184. @end example
  2185. @item
  2186. Two delays:
  2187. @example
  2188. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2189. @end example
  2190. @item
  2191. Fuller sounding chorus with three delays:
  2192. @example
  2193. 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
  2194. @end example
  2195. @end itemize
  2196. @section compand
  2197. Compress or expand the audio's dynamic range.
  2198. It accepts the following parameters:
  2199. @table @option
  2200. @item attacks
  2201. @item decays
  2202. A list of times in seconds for each channel over which the instantaneous level
  2203. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2204. increase of volume and @var{decays} refers to decrease of volume. For most
  2205. situations, the attack time (response to the audio getting louder) should be
  2206. shorter than the decay time, because the human ear is more sensitive to sudden
  2207. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2208. a typical value for decay is 0.8 seconds.
  2209. If specified number of attacks & decays is lower than number of channels, the last
  2210. set attack/decay will be used for all remaining channels.
  2211. @item points
  2212. A list of points for the transfer function, specified in dB relative to the
  2213. maximum possible signal amplitude. Each key points list must be defined using
  2214. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2215. @code{x0/y0 x1/y1 x2/y2 ....}
  2216. The input values must be in strictly increasing order but the transfer function
  2217. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2218. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2219. function are @code{-70/-70|-60/-20|1/0}.
  2220. @item soft-knee
  2221. Set the curve radius in dB for all joints. It defaults to 0.01.
  2222. @item gain
  2223. Set the additional gain in dB to be applied at all points on the transfer
  2224. function. This allows for easy adjustment of the overall gain.
  2225. It defaults to 0.
  2226. @item volume
  2227. Set an initial volume, in dB, to be assumed for each channel when filtering
  2228. starts. This permits the user to supply a nominal level initially, so that, for
  2229. example, a very large gain is not applied to initial signal levels before the
  2230. companding has begun to operate. A typical value for audio which is initially
  2231. quiet is -90 dB. It defaults to 0.
  2232. @item delay
  2233. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2234. delayed before being fed to the volume adjuster. Specifying a delay
  2235. approximately equal to the attack/decay times allows the filter to effectively
  2236. operate in predictive rather than reactive mode. It defaults to 0.
  2237. @end table
  2238. @subsection Examples
  2239. @itemize
  2240. @item
  2241. Make music with both quiet and loud passages suitable for listening to in a
  2242. noisy environment:
  2243. @example
  2244. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2245. @end example
  2246. Another example for audio with whisper and explosion parts:
  2247. @example
  2248. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2249. @end example
  2250. @item
  2251. A noise gate for when the noise is at a lower level than the signal:
  2252. @example
  2253. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2254. @end example
  2255. @item
  2256. Here is another noise gate, this time for when the noise is at a higher level
  2257. than the signal (making it, in some ways, similar to squelch):
  2258. @example
  2259. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2260. @end example
  2261. @item
  2262. 2:1 compression starting at -6dB:
  2263. @example
  2264. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2265. @end example
  2266. @item
  2267. 2:1 compression starting at -9dB:
  2268. @example
  2269. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2270. @end example
  2271. @item
  2272. 2:1 compression starting at -12dB:
  2273. @example
  2274. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2275. @end example
  2276. @item
  2277. 2:1 compression starting at -18dB:
  2278. @example
  2279. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2280. @end example
  2281. @item
  2282. 3:1 compression starting at -15dB:
  2283. @example
  2284. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2285. @end example
  2286. @item
  2287. Compressor/Gate:
  2288. @example
  2289. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2290. @end example
  2291. @item
  2292. Expander:
  2293. @example
  2294. 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
  2295. @end example
  2296. @item
  2297. Hard limiter at -6dB:
  2298. @example
  2299. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2300. @end example
  2301. @item
  2302. Hard limiter at -12dB:
  2303. @example
  2304. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2305. @end example
  2306. @item
  2307. Hard noise gate at -35 dB:
  2308. @example
  2309. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2310. @end example
  2311. @item
  2312. Soft limiter:
  2313. @example
  2314. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2315. @end example
  2316. @end itemize
  2317. @section compensationdelay
  2318. Compensation Delay Line is a metric based delay to compensate differing
  2319. positions of microphones or speakers.
  2320. For example, you have recorded guitar with two microphones placed in
  2321. different locations. Because the front of sound wave has fixed speed in
  2322. normal conditions, the phasing of microphones can vary and depends on
  2323. their location and interposition. The best sound mix can be achieved when
  2324. these microphones are in phase (synchronized). Note that a distance of
  2325. ~30 cm between microphones makes one microphone capture the signal in
  2326. antiphase to the other microphone. That makes the final mix sound moody.
  2327. This filter helps to solve phasing problems by adding different delays
  2328. to each microphone track and make them synchronized.
  2329. The best result can be reached when you take one track as base and
  2330. synchronize other tracks one by one with it.
  2331. Remember that synchronization/delay tolerance depends on sample rate, too.
  2332. Higher sample rates will give more tolerance.
  2333. The filter accepts the following parameters:
  2334. @table @option
  2335. @item mm
  2336. Set millimeters distance. This is compensation distance for fine tuning.
  2337. Default is 0.
  2338. @item cm
  2339. Set cm distance. This is compensation distance for tightening distance setup.
  2340. Default is 0.
  2341. @item m
  2342. Set meters distance. This is compensation distance for hard distance setup.
  2343. Default is 0.
  2344. @item dry
  2345. Set dry amount. Amount of unprocessed (dry) signal.
  2346. Default is 0.
  2347. @item wet
  2348. Set wet amount. Amount of processed (wet) signal.
  2349. Default is 1.
  2350. @item temp
  2351. Set temperature in degrees Celsius. This is the temperature of the environment.
  2352. Default is 20.
  2353. @end table
  2354. @section crossfeed
  2355. Apply headphone crossfeed filter.
  2356. Crossfeed is the process of blending the left and right channels of stereo
  2357. audio recording.
  2358. It is mainly used to reduce extreme stereo separation of low frequencies.
  2359. The intent is to produce more speaker like sound to the listener.
  2360. The filter accepts the following options:
  2361. @table @option
  2362. @item strength
  2363. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2364. This sets gain of low shelf filter for side part of stereo image.
  2365. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2366. @item range
  2367. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2368. This sets cut off frequency of low shelf filter. Default is cut off near
  2369. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2370. @item level_in
  2371. Set input gain. Default is 0.9.
  2372. @item level_out
  2373. Set output gain. Default is 1.
  2374. @end table
  2375. @section crystalizer
  2376. Simple algorithm to expand audio dynamic range.
  2377. The filter accepts the following options:
  2378. @table @option
  2379. @item i
  2380. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2381. (unchanged sound) to 10.0 (maximum effect).
  2382. @item c
  2383. Enable clipping. By default is enabled.
  2384. @end table
  2385. @section dcshift
  2386. Apply a DC shift to the audio.
  2387. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2388. in the recording chain) from the audio. The effect of a DC offset is reduced
  2389. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2390. a signal has a DC offset.
  2391. @table @option
  2392. @item shift
  2393. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2394. the audio.
  2395. @item limitergain
  2396. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2397. used to prevent clipping.
  2398. @end table
  2399. @section deesser
  2400. Apply de-essing to the audio samples.
  2401. @table @option
  2402. @item i
  2403. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2404. Default is 0.
  2405. @item m
  2406. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2407. Default is 0.5.
  2408. @item f
  2409. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2410. Default is 0.5.
  2411. @item s
  2412. Set the output mode.
  2413. It accepts the following values:
  2414. @table @option
  2415. @item i
  2416. Pass input unchanged.
  2417. @item o
  2418. Pass ess filtered out.
  2419. @item e
  2420. Pass only ess.
  2421. Default value is @var{o}.
  2422. @end table
  2423. @end table
  2424. @section drmeter
  2425. Measure audio dynamic range.
  2426. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2427. is found in transition material. And anything less that 8 have very poor dynamics
  2428. and is very compressed.
  2429. The filter accepts the following options:
  2430. @table @option
  2431. @item length
  2432. Set window length in seconds used to split audio into segments of equal length.
  2433. Default is 3 seconds.
  2434. @end table
  2435. @section dynaudnorm
  2436. Dynamic Audio Normalizer.
  2437. This filter applies a certain amount of gain to the input audio in order
  2438. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2439. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2440. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2441. This allows for applying extra gain to the "quiet" sections of the audio
  2442. while avoiding distortions or clipping the "loud" sections. In other words:
  2443. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2444. sections, in the sense that the volume of each section is brought to the
  2445. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2446. this goal *without* applying "dynamic range compressing". It will retain 100%
  2447. of the dynamic range *within* each section of the audio file.
  2448. @table @option
  2449. @item framelen, f
  2450. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2451. Default is 500 milliseconds.
  2452. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2453. referred to as frames. This is required, because a peak magnitude has no
  2454. meaning for just a single sample value. Instead, we need to determine the
  2455. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2456. normalizer would simply use the peak magnitude of the complete file, the
  2457. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2458. frame. The length of a frame is specified in milliseconds. By default, the
  2459. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2460. been found to give good results with most files.
  2461. Note that the exact frame length, in number of samples, will be determined
  2462. automatically, based on the sampling rate of the individual input audio file.
  2463. @item gausssize, g
  2464. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2465. number. Default is 31.
  2466. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2467. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2468. is specified in frames, centered around the current frame. For the sake of
  2469. simplicity, this must be an odd number. Consequently, the default value of 31
  2470. takes into account the current frame, as well as the 15 preceding frames and
  2471. the 15 subsequent frames. Using a larger window results in a stronger
  2472. smoothing effect and thus in less gain variation, i.e. slower gain
  2473. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2474. effect and thus in more gain variation, i.e. faster gain adaptation.
  2475. In other words, the more you increase this value, the more the Dynamic Audio
  2476. Normalizer will behave like a "traditional" normalization filter. On the
  2477. contrary, the more you decrease this value, the more the Dynamic Audio
  2478. Normalizer will behave like a dynamic range compressor.
  2479. @item peak, p
  2480. Set the target peak value. This specifies the highest permissible magnitude
  2481. level for the normalized audio input. This filter will try to approach the
  2482. target peak magnitude as closely as possible, but at the same time it also
  2483. makes sure that the normalized signal will never exceed the peak magnitude.
  2484. A frame's maximum local gain factor is imposed directly by the target peak
  2485. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2486. It is not recommended to go above this value.
  2487. @item maxgain, m
  2488. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2489. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2490. factor for each input frame, i.e. the maximum gain factor that does not
  2491. result in clipping or distortion. The maximum gain factor is determined by
  2492. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2493. additionally bounds the frame's maximum gain factor by a predetermined
  2494. (global) maximum gain factor. This is done in order to avoid excessive gain
  2495. factors in "silent" or almost silent frames. By default, the maximum gain
  2496. factor is 10.0, For most inputs the default value should be sufficient and
  2497. it usually is not recommended to increase this value. Though, for input
  2498. with an extremely low overall volume level, it may be necessary to allow even
  2499. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2500. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2501. Instead, a "sigmoid" threshold function will be applied. This way, the
  2502. gain factors will smoothly approach the threshold value, but never exceed that
  2503. value.
  2504. @item targetrms, r
  2505. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2506. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2507. This means that the maximum local gain factor for each frame is defined
  2508. (only) by the frame's highest magnitude sample. This way, the samples can
  2509. be amplified as much as possible without exceeding the maximum signal
  2510. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2511. Normalizer can also take into account the frame's root mean square,
  2512. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2513. determine the power of a time-varying signal. It is therefore considered
  2514. that the RMS is a better approximation of the "perceived loudness" than
  2515. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2516. frames to a constant RMS value, a uniform "perceived loudness" can be
  2517. established. If a target RMS value has been specified, a frame's local gain
  2518. factor is defined as the factor that would result in exactly that RMS value.
  2519. Note, however, that the maximum local gain factor is still restricted by the
  2520. frame's highest magnitude sample, in order to prevent clipping.
  2521. @item coupling, n
  2522. Enable channels coupling. By default is enabled.
  2523. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2524. amount. This means the same gain factor will be applied to all channels, i.e.
  2525. the maximum possible gain factor is determined by the "loudest" channel.
  2526. However, in some recordings, it may happen that the volume of the different
  2527. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2528. In this case, this option can be used to disable the channel coupling. This way,
  2529. the gain factor will be determined independently for each channel, depending
  2530. only on the individual channel's highest magnitude sample. This allows for
  2531. harmonizing the volume of the different channels.
  2532. @item correctdc, c
  2533. Enable DC bias correction. By default is disabled.
  2534. An audio signal (in the time domain) is a sequence of sample values.
  2535. In the Dynamic Audio Normalizer these sample values are represented in the
  2536. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2537. audio signal, or "waveform", should be centered around the zero point.
  2538. That means if we calculate the mean value of all samples in a file, or in a
  2539. single frame, then the result should be 0.0 or at least very close to that
  2540. value. If, however, there is a significant deviation of the mean value from
  2541. 0.0, in either positive or negative direction, this is referred to as a
  2542. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2543. Audio Normalizer provides optional DC bias correction.
  2544. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2545. the mean value, or "DC correction" offset, of each input frame and subtract
  2546. that value from all of the frame's sample values which ensures those samples
  2547. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2548. boundaries, the DC correction offset values will be interpolated smoothly
  2549. between neighbouring frames.
  2550. @item altboundary, b
  2551. Enable alternative boundary mode. By default is disabled.
  2552. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2553. around each frame. This includes the preceding frames as well as the
  2554. subsequent frames. However, for the "boundary" frames, located at the very
  2555. beginning and at the very end of the audio file, not all neighbouring
  2556. frames are available. In particular, for the first few frames in the audio
  2557. file, the preceding frames are not known. And, similarly, for the last few
  2558. frames in the audio file, the subsequent frames are not known. Thus, the
  2559. question arises which gain factors should be assumed for the missing frames
  2560. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2561. to deal with this situation. The default boundary mode assumes a gain factor
  2562. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2563. "fade out" at the beginning and at the end of the input, respectively.
  2564. @item compress, s
  2565. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2566. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2567. compression. This means that signal peaks will not be pruned and thus the
  2568. full dynamic range will be retained within each local neighbourhood. However,
  2569. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2570. normalization algorithm with a more "traditional" compression.
  2571. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2572. (thresholding) function. If (and only if) the compression feature is enabled,
  2573. all input frames will be processed by a soft knee thresholding function prior
  2574. to the actual normalization process. Put simply, the thresholding function is
  2575. going to prune all samples whose magnitude exceeds a certain threshold value.
  2576. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2577. value. Instead, the threshold value will be adjusted for each individual
  2578. frame.
  2579. In general, smaller parameters result in stronger compression, and vice versa.
  2580. Values below 3.0 are not recommended, because audible distortion may appear.
  2581. @end table
  2582. @section earwax
  2583. Make audio easier to listen to on headphones.
  2584. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2585. so that when listened to on headphones the stereo image is moved from
  2586. inside your head (standard for headphones) to outside and in front of
  2587. the listener (standard for speakers).
  2588. Ported from SoX.
  2589. @section equalizer
  2590. Apply a two-pole peaking equalisation (EQ) filter. With this
  2591. filter, the signal-level at and around a selected frequency can
  2592. be increased or decreased, whilst (unlike bandpass and bandreject
  2593. filters) that at all other frequencies is unchanged.
  2594. In order to produce complex equalisation curves, this filter can
  2595. be given several times, each with a different central frequency.
  2596. The filter accepts the following options:
  2597. @table @option
  2598. @item frequency, f
  2599. Set the filter's central frequency in Hz.
  2600. @item width_type, t
  2601. Set method to specify band-width of filter.
  2602. @table @option
  2603. @item h
  2604. Hz
  2605. @item q
  2606. Q-Factor
  2607. @item o
  2608. octave
  2609. @item s
  2610. slope
  2611. @item k
  2612. kHz
  2613. @end table
  2614. @item width, w
  2615. Specify the band-width of a filter in width_type units.
  2616. @item gain, g
  2617. Set the required gain or attenuation in dB.
  2618. Beware of clipping when using a positive gain.
  2619. @item mix, m
  2620. How much to use filtered signal in output. Default is 1.
  2621. Range is between 0 and 1.
  2622. @item channels, c
  2623. Specify which channels to filter, by default all available are filtered.
  2624. @end table
  2625. @subsection Examples
  2626. @itemize
  2627. @item
  2628. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2629. @example
  2630. equalizer=f=1000:t=h:width=200:g=-10
  2631. @end example
  2632. @item
  2633. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2634. @example
  2635. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2636. @end example
  2637. @end itemize
  2638. @subsection Commands
  2639. This filter supports the following commands:
  2640. @table @option
  2641. @item frequency, f
  2642. Change equalizer frequency.
  2643. Syntax for the command is : "@var{frequency}"
  2644. @item width_type, t
  2645. Change equalizer width_type.
  2646. Syntax for the command is : "@var{width_type}"
  2647. @item width, w
  2648. Change equalizer width.
  2649. Syntax for the command is : "@var{width}"
  2650. @item gain, g
  2651. Change equalizer gain.
  2652. Syntax for the command is : "@var{gain}"
  2653. @item mix, m
  2654. Change equalizer mix.
  2655. Syntax for the command is : "@var{mix}"
  2656. @end table
  2657. @section extrastereo
  2658. Linearly increases the difference between left and right channels which
  2659. adds some sort of "live" effect to playback.
  2660. The filter accepts the following options:
  2661. @table @option
  2662. @item m
  2663. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2664. (average of both channels), with 1.0 sound will be unchanged, with
  2665. -1.0 left and right channels will be swapped.
  2666. @item c
  2667. Enable clipping. By default is enabled.
  2668. @end table
  2669. @section firequalizer
  2670. Apply FIR Equalization using arbitrary frequency response.
  2671. The filter accepts the following option:
  2672. @table @option
  2673. @item gain
  2674. Set gain curve equation (in dB). The expression can contain variables:
  2675. @table @option
  2676. @item f
  2677. the evaluated frequency
  2678. @item sr
  2679. sample rate
  2680. @item ch
  2681. channel number, set to 0 when multichannels evaluation is disabled
  2682. @item chid
  2683. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2684. multichannels evaluation is disabled
  2685. @item chs
  2686. number of channels
  2687. @item chlayout
  2688. channel_layout, see libavutil/channel_layout.h
  2689. @end table
  2690. and functions:
  2691. @table @option
  2692. @item gain_interpolate(f)
  2693. interpolate gain on frequency f based on gain_entry
  2694. @item cubic_interpolate(f)
  2695. same as gain_interpolate, but smoother
  2696. @end table
  2697. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2698. @item gain_entry
  2699. Set gain entry for gain_interpolate function. The expression can
  2700. contain functions:
  2701. @table @option
  2702. @item entry(f, g)
  2703. store gain entry at frequency f with value g
  2704. @end table
  2705. This option is also available as command.
  2706. @item delay
  2707. Set filter delay in seconds. Higher value means more accurate.
  2708. Default is @code{0.01}.
  2709. @item accuracy
  2710. Set filter accuracy in Hz. Lower value means more accurate.
  2711. Default is @code{5}.
  2712. @item wfunc
  2713. Set window function. Acceptable values are:
  2714. @table @option
  2715. @item rectangular
  2716. rectangular window, useful when gain curve is already smooth
  2717. @item hann
  2718. hann window (default)
  2719. @item hamming
  2720. hamming window
  2721. @item blackman
  2722. blackman window
  2723. @item nuttall3
  2724. 3-terms continuous 1st derivative nuttall window
  2725. @item mnuttall3
  2726. minimum 3-terms discontinuous nuttall window
  2727. @item nuttall
  2728. 4-terms continuous 1st derivative nuttall window
  2729. @item bnuttall
  2730. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2731. @item bharris
  2732. blackman-harris window
  2733. @item tukey
  2734. tukey window
  2735. @end table
  2736. @item fixed
  2737. If enabled, use fixed number of audio samples. This improves speed when
  2738. filtering with large delay. Default is disabled.
  2739. @item multi
  2740. Enable multichannels evaluation on gain. Default is disabled.
  2741. @item zero_phase
  2742. Enable zero phase mode by subtracting timestamp to compensate delay.
  2743. Default is disabled.
  2744. @item scale
  2745. Set scale used by gain. Acceptable values are:
  2746. @table @option
  2747. @item linlin
  2748. linear frequency, linear gain
  2749. @item linlog
  2750. linear frequency, logarithmic (in dB) gain (default)
  2751. @item loglin
  2752. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2753. @item loglog
  2754. logarithmic frequency, logarithmic gain
  2755. @end table
  2756. @item dumpfile
  2757. Set file for dumping, suitable for gnuplot.
  2758. @item dumpscale
  2759. Set scale for dumpfile. Acceptable values are same with scale option.
  2760. Default is linlog.
  2761. @item fft2
  2762. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2763. Default is disabled.
  2764. @item min_phase
  2765. Enable minimum phase impulse response. Default is disabled.
  2766. @end table
  2767. @subsection Examples
  2768. @itemize
  2769. @item
  2770. lowpass at 1000 Hz:
  2771. @example
  2772. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2773. @end example
  2774. @item
  2775. lowpass at 1000 Hz with gain_entry:
  2776. @example
  2777. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2778. @end example
  2779. @item
  2780. custom equalization:
  2781. @example
  2782. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2783. @end example
  2784. @item
  2785. higher delay with zero phase to compensate delay:
  2786. @example
  2787. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2788. @end example
  2789. @item
  2790. lowpass on left channel, highpass on right channel:
  2791. @example
  2792. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2793. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2794. @end example
  2795. @end itemize
  2796. @section flanger
  2797. Apply a flanging effect to the audio.
  2798. The filter accepts the following options:
  2799. @table @option
  2800. @item delay
  2801. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2802. @item depth
  2803. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2804. @item regen
  2805. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2806. Default value is 0.
  2807. @item width
  2808. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2809. Default value is 71.
  2810. @item speed
  2811. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2812. @item shape
  2813. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2814. Default value is @var{sinusoidal}.
  2815. @item phase
  2816. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2817. Default value is 25.
  2818. @item interp
  2819. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2820. Default is @var{linear}.
  2821. @end table
  2822. @section haas
  2823. Apply Haas effect to audio.
  2824. Note that this makes most sense to apply on mono signals.
  2825. With this filter applied to mono signals it give some directionality and
  2826. stretches its stereo image.
  2827. The filter accepts the following options:
  2828. @table @option
  2829. @item level_in
  2830. Set input level. By default is @var{1}, or 0dB
  2831. @item level_out
  2832. Set output level. By default is @var{1}, or 0dB.
  2833. @item side_gain
  2834. Set gain applied to side part of signal. By default is @var{1}.
  2835. @item middle_source
  2836. Set kind of middle source. Can be one of the following:
  2837. @table @samp
  2838. @item left
  2839. Pick left channel.
  2840. @item right
  2841. Pick right channel.
  2842. @item mid
  2843. Pick middle part signal of stereo image.
  2844. @item side
  2845. Pick side part signal of stereo image.
  2846. @end table
  2847. @item middle_phase
  2848. Change middle phase. By default is disabled.
  2849. @item left_delay
  2850. Set left channel delay. By default is @var{2.05} milliseconds.
  2851. @item left_balance
  2852. Set left channel balance. By default is @var{-1}.
  2853. @item left_gain
  2854. Set left channel gain. By default is @var{1}.
  2855. @item left_phase
  2856. Change left phase. By default is disabled.
  2857. @item right_delay
  2858. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2859. @item right_balance
  2860. Set right channel balance. By default is @var{1}.
  2861. @item right_gain
  2862. Set right channel gain. By default is @var{1}.
  2863. @item right_phase
  2864. Change right phase. By default is enabled.
  2865. @end table
  2866. @section hdcd
  2867. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2868. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2869. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2870. of HDCD, and detects the Transient Filter flag.
  2871. @example
  2872. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2873. @end example
  2874. When using the filter with wav, note the default encoding for wav is 16-bit,
  2875. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2876. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2877. @example
  2878. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2879. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2880. @end example
  2881. The filter accepts the following options:
  2882. @table @option
  2883. @item disable_autoconvert
  2884. Disable any automatic format conversion or resampling in the filter graph.
  2885. @item process_stereo
  2886. Process the stereo channels together. If target_gain does not match between
  2887. channels, consider it invalid and use the last valid target_gain.
  2888. @item cdt_ms
  2889. Set the code detect timer period in ms.
  2890. @item force_pe
  2891. Always extend peaks above -3dBFS even if PE isn't signaled.
  2892. @item analyze_mode
  2893. Replace audio with a solid tone and adjust the amplitude to signal some
  2894. specific aspect of the decoding process. The output file can be loaded in
  2895. an audio editor alongside the original to aid analysis.
  2896. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2897. Modes are:
  2898. @table @samp
  2899. @item 0, off
  2900. Disabled
  2901. @item 1, lle
  2902. Gain adjustment level at each sample
  2903. @item 2, pe
  2904. Samples where peak extend occurs
  2905. @item 3, cdt
  2906. Samples where the code detect timer is active
  2907. @item 4, tgm
  2908. Samples where the target gain does not match between channels
  2909. @end table
  2910. @end table
  2911. @section headphone
  2912. Apply head-related transfer functions (HRTFs) to create virtual
  2913. loudspeakers around the user for binaural listening via headphones.
  2914. The HRIRs are provided via additional streams, for each channel
  2915. one stereo input stream is needed.
  2916. The filter accepts the following options:
  2917. @table @option
  2918. @item map
  2919. Set mapping of input streams for convolution.
  2920. The argument is a '|'-separated list of channel names in order as they
  2921. are given as additional stream inputs for filter.
  2922. This also specify number of input streams. Number of input streams
  2923. must be not less than number of channels in first stream plus one.
  2924. @item gain
  2925. Set gain applied to audio. Value is in dB. Default is 0.
  2926. @item type
  2927. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2928. processing audio in time domain which is slow.
  2929. @var{freq} is processing audio in frequency domain which is fast.
  2930. Default is @var{freq}.
  2931. @item lfe
  2932. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2933. @item size
  2934. Set size of frame in number of samples which will be processed at once.
  2935. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2936. @item hrir
  2937. Set format of hrir stream.
  2938. Default value is @var{stereo}. Alternative value is @var{multich}.
  2939. If value is set to @var{stereo}, number of additional streams should
  2940. be greater or equal to number of input channels in first input stream.
  2941. Also each additional stream should have stereo number of channels.
  2942. If value is set to @var{multich}, number of additional streams should
  2943. be exactly one. Also number of input channels of additional stream
  2944. should be equal or greater than twice number of channels of first input
  2945. stream.
  2946. @end table
  2947. @subsection Examples
  2948. @itemize
  2949. @item
  2950. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2951. each amovie filter use stereo file with IR coefficients as input.
  2952. The files give coefficients for each position of virtual loudspeaker:
  2953. @example
  2954. ffmpeg -i input.wav
  2955. -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"
  2956. output.wav
  2957. @end example
  2958. @item
  2959. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2960. but now in @var{multich} @var{hrir} format.
  2961. @example
  2962. 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"
  2963. output.wav
  2964. @end example
  2965. @end itemize
  2966. @section highpass
  2967. Apply a high-pass filter with 3dB point frequency.
  2968. The filter can be either single-pole, or double-pole (the default).
  2969. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2970. The filter accepts the following options:
  2971. @table @option
  2972. @item frequency, f
  2973. Set frequency in Hz. Default is 3000.
  2974. @item poles, p
  2975. Set number of poles. Default is 2.
  2976. @item width_type, t
  2977. Set method to specify band-width of filter.
  2978. @table @option
  2979. @item h
  2980. Hz
  2981. @item q
  2982. Q-Factor
  2983. @item o
  2984. octave
  2985. @item s
  2986. slope
  2987. @item k
  2988. kHz
  2989. @end table
  2990. @item width, w
  2991. Specify the band-width of a filter in width_type units.
  2992. Applies only to double-pole filter.
  2993. The default is 0.707q and gives a Butterworth response.
  2994. @item mix, m
  2995. How much to use filtered signal in output. Default is 1.
  2996. Range is between 0 and 1.
  2997. @item channels, c
  2998. Specify which channels to filter, by default all available are filtered.
  2999. @end table
  3000. @subsection Commands
  3001. This filter supports the following commands:
  3002. @table @option
  3003. @item frequency, f
  3004. Change highpass frequency.
  3005. Syntax for the command is : "@var{frequency}"
  3006. @item width_type, t
  3007. Change highpass width_type.
  3008. Syntax for the command is : "@var{width_type}"
  3009. @item width, w
  3010. Change highpass width.
  3011. Syntax for the command is : "@var{width}"
  3012. @item mix, m
  3013. Change highpass mix.
  3014. Syntax for the command is : "@var{mix}"
  3015. @end table
  3016. @section join
  3017. Join multiple input streams into one multi-channel stream.
  3018. It accepts the following parameters:
  3019. @table @option
  3020. @item inputs
  3021. The number of input streams. It defaults to 2.
  3022. @item channel_layout
  3023. The desired output channel layout. It defaults to stereo.
  3024. @item map
  3025. Map channels from inputs to output. The argument is a '|'-separated list of
  3026. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3027. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3028. can be either the name of the input channel (e.g. FL for front left) or its
  3029. index in the specified input stream. @var{out_channel} is the name of the output
  3030. channel.
  3031. @end table
  3032. The filter will attempt to guess the mappings when they are not specified
  3033. explicitly. It does so by first trying to find an unused matching input channel
  3034. and if that fails it picks the first unused input channel.
  3035. Join 3 inputs (with properly set channel layouts):
  3036. @example
  3037. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3038. @end example
  3039. Build a 5.1 output from 6 single-channel streams:
  3040. @example
  3041. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3042. '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'
  3043. out
  3044. @end example
  3045. @section ladspa
  3046. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3047. To enable compilation of this filter you need to configure FFmpeg with
  3048. @code{--enable-ladspa}.
  3049. @table @option
  3050. @item file, f
  3051. Specifies the name of LADSPA plugin library to load. If the environment
  3052. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3053. each one of the directories specified by the colon separated list in
  3054. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3055. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3056. @file{/usr/lib/ladspa/}.
  3057. @item plugin, p
  3058. Specifies the plugin within the library. Some libraries contain only
  3059. one plugin, but others contain many of them. If this is not set filter
  3060. will list all available plugins within the specified library.
  3061. @item controls, c
  3062. Set the '|' separated list of controls which are zero or more floating point
  3063. values that determine the behavior of the loaded plugin (for example delay,
  3064. threshold or gain).
  3065. Controls need to be defined using the following syntax:
  3066. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3067. @var{valuei} is the value set on the @var{i}-th control.
  3068. Alternatively they can be also defined using the following syntax:
  3069. @var{value0}|@var{value1}|@var{value2}|..., where
  3070. @var{valuei} is the value set on the @var{i}-th control.
  3071. If @option{controls} is set to @code{help}, all available controls and
  3072. their valid ranges are printed.
  3073. @item sample_rate, s
  3074. Specify the sample rate, default to 44100. Only used if plugin have
  3075. zero inputs.
  3076. @item nb_samples, n
  3077. Set the number of samples per channel per each output frame, default
  3078. is 1024. Only used if plugin have zero inputs.
  3079. @item duration, d
  3080. Set the minimum duration of the sourced audio. See
  3081. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3082. for the accepted syntax.
  3083. Note that the resulting duration may be greater than the specified duration,
  3084. as the generated audio is always cut at the end of a complete frame.
  3085. If not specified, or the expressed duration is negative, the audio is
  3086. supposed to be generated forever.
  3087. Only used if plugin have zero inputs.
  3088. @end table
  3089. @subsection Examples
  3090. @itemize
  3091. @item
  3092. List all available plugins within amp (LADSPA example plugin) library:
  3093. @example
  3094. ladspa=file=amp
  3095. @end example
  3096. @item
  3097. List all available controls and their valid ranges for @code{vcf_notch}
  3098. plugin from @code{VCF} library:
  3099. @example
  3100. ladspa=f=vcf:p=vcf_notch:c=help
  3101. @end example
  3102. @item
  3103. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3104. plugin library:
  3105. @example
  3106. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3107. @end example
  3108. @item
  3109. Add reverberation to the audio using TAP-plugins
  3110. (Tom's Audio Processing plugins):
  3111. @example
  3112. ladspa=file=tap_reverb:tap_reverb
  3113. @end example
  3114. @item
  3115. Generate white noise, with 0.2 amplitude:
  3116. @example
  3117. ladspa=file=cmt:noise_source_white:c=c0=.2
  3118. @end example
  3119. @item
  3120. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3121. @code{C* Audio Plugin Suite} (CAPS) library:
  3122. @example
  3123. ladspa=file=caps:Click:c=c1=20'
  3124. @end example
  3125. @item
  3126. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3127. @example
  3128. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3129. @end example
  3130. @item
  3131. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3132. @code{SWH Plugins} collection:
  3133. @example
  3134. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3135. @end example
  3136. @item
  3137. Attenuate low frequencies using Multiband EQ from Steve Harris
  3138. @code{SWH Plugins} collection:
  3139. @example
  3140. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3141. @end example
  3142. @item
  3143. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3144. (CAPS) library:
  3145. @example
  3146. ladspa=caps:Narrower
  3147. @end example
  3148. @item
  3149. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3150. @example
  3151. ladspa=caps:White:.2
  3152. @end example
  3153. @item
  3154. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3155. @example
  3156. ladspa=caps:Fractal:c=c1=1
  3157. @end example
  3158. @item
  3159. Dynamic volume normalization using @code{VLevel} plugin:
  3160. @example
  3161. ladspa=vlevel-ladspa:vlevel_mono
  3162. @end example
  3163. @end itemize
  3164. @subsection Commands
  3165. This filter supports the following commands:
  3166. @table @option
  3167. @item cN
  3168. Modify the @var{N}-th control value.
  3169. If the specified value is not valid, it is ignored and prior one is kept.
  3170. @end table
  3171. @section loudnorm
  3172. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3173. Support for both single pass (livestreams, files) and double pass (files) modes.
  3174. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  3175. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  3176. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3177. The filter accepts the following options:
  3178. @table @option
  3179. @item I, i
  3180. Set integrated loudness target.
  3181. Range is -70.0 - -5.0. Default value is -24.0.
  3182. @item LRA, lra
  3183. Set loudness range target.
  3184. Range is 1.0 - 20.0. Default value is 7.0.
  3185. @item TP, tp
  3186. Set maximum true peak.
  3187. Range is -9.0 - +0.0. Default value is -2.0.
  3188. @item measured_I, measured_i
  3189. Measured IL of input file.
  3190. Range is -99.0 - +0.0.
  3191. @item measured_LRA, measured_lra
  3192. Measured LRA of input file.
  3193. Range is 0.0 - 99.0.
  3194. @item measured_TP, measured_tp
  3195. Measured true peak of input file.
  3196. Range is -99.0 - +99.0.
  3197. @item measured_thresh
  3198. Measured threshold of input file.
  3199. Range is -99.0 - +0.0.
  3200. @item offset
  3201. Set offset gain. Gain is applied before the true-peak limiter.
  3202. Range is -99.0 - +99.0. Default is +0.0.
  3203. @item linear
  3204. Normalize linearly if possible.
  3205. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  3206. to be specified in order to use this mode.
  3207. Options are true or false. Default is true.
  3208. @item dual_mono
  3209. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3210. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3211. If set to @code{true}, this option will compensate for this effect.
  3212. Multi-channel input files are not affected by this option.
  3213. Options are true or false. Default is false.
  3214. @item print_format
  3215. Set print format for stats. Options are summary, json, or none.
  3216. Default value is none.
  3217. @end table
  3218. @section lowpass
  3219. Apply a low-pass filter with 3dB point frequency.
  3220. The filter can be either single-pole or double-pole (the default).
  3221. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3222. The filter accepts the following options:
  3223. @table @option
  3224. @item frequency, f
  3225. Set frequency in Hz. Default is 500.
  3226. @item poles, p
  3227. Set number of poles. Default is 2.
  3228. @item width_type, t
  3229. Set method to specify band-width of filter.
  3230. @table @option
  3231. @item h
  3232. Hz
  3233. @item q
  3234. Q-Factor
  3235. @item o
  3236. octave
  3237. @item s
  3238. slope
  3239. @item k
  3240. kHz
  3241. @end table
  3242. @item width, w
  3243. Specify the band-width of a filter in width_type units.
  3244. Applies only to double-pole filter.
  3245. The default is 0.707q and gives a Butterworth response.
  3246. @item mix, m
  3247. How much to use filtered signal in output. Default is 1.
  3248. Range is between 0 and 1.
  3249. @item channels, c
  3250. Specify which channels to filter, by default all available are filtered.
  3251. @end table
  3252. @subsection Examples
  3253. @itemize
  3254. @item
  3255. Lowpass only LFE channel, it LFE is not present it does nothing:
  3256. @example
  3257. lowpass=c=LFE
  3258. @end example
  3259. @end itemize
  3260. @subsection Commands
  3261. This filter supports the following commands:
  3262. @table @option
  3263. @item frequency, f
  3264. Change lowpass frequency.
  3265. Syntax for the command is : "@var{frequency}"
  3266. @item width_type, t
  3267. Change lowpass width_type.
  3268. Syntax for the command is : "@var{width_type}"
  3269. @item width, w
  3270. Change lowpass width.
  3271. Syntax for the command is : "@var{width}"
  3272. @item mix, m
  3273. Change lowpass mix.
  3274. Syntax for the command is : "@var{mix}"
  3275. @end table
  3276. @section lv2
  3277. Load a LV2 (LADSPA Version 2) plugin.
  3278. To enable compilation of this filter you need to configure FFmpeg with
  3279. @code{--enable-lv2}.
  3280. @table @option
  3281. @item plugin, p
  3282. Specifies the plugin URI. You may need to escape ':'.
  3283. @item controls, c
  3284. Set the '|' separated list of controls which are zero or more floating point
  3285. values that determine the behavior of the loaded plugin (for example delay,
  3286. threshold or gain).
  3287. If @option{controls} is set to @code{help}, all available controls and
  3288. their valid ranges are printed.
  3289. @item sample_rate, s
  3290. Specify the sample rate, default to 44100. Only used if plugin have
  3291. zero inputs.
  3292. @item nb_samples, n
  3293. Set the number of samples per channel per each output frame, default
  3294. is 1024. Only used if plugin have zero inputs.
  3295. @item duration, d
  3296. Set the minimum duration of the sourced audio. See
  3297. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3298. for the accepted syntax.
  3299. Note that the resulting duration may be greater than the specified duration,
  3300. as the generated audio is always cut at the end of a complete frame.
  3301. If not specified, or the expressed duration is negative, the audio is
  3302. supposed to be generated forever.
  3303. Only used if plugin have zero inputs.
  3304. @end table
  3305. @subsection Examples
  3306. @itemize
  3307. @item
  3308. Apply bass enhancer plugin from Calf:
  3309. @example
  3310. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3311. @end example
  3312. @item
  3313. Apply vinyl plugin from Calf:
  3314. @example
  3315. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3316. @end example
  3317. @item
  3318. Apply bit crusher plugin from ArtyFX:
  3319. @example
  3320. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3321. @end example
  3322. @end itemize
  3323. @section mcompand
  3324. Multiband Compress or expand the audio's dynamic range.
  3325. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3326. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3327. response when absent compander action.
  3328. It accepts the following parameters:
  3329. @table @option
  3330. @item args
  3331. This option syntax is:
  3332. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3333. For explanation of each item refer to compand filter documentation.
  3334. @end table
  3335. @anchor{pan}
  3336. @section pan
  3337. Mix channels with specific gain levels. The filter accepts the output
  3338. channel layout followed by a set of channels definitions.
  3339. This filter is also designed to efficiently remap the channels of an audio
  3340. stream.
  3341. The filter accepts parameters of the form:
  3342. "@var{l}|@var{outdef}|@var{outdef}|..."
  3343. @table @option
  3344. @item l
  3345. output channel layout or number of channels
  3346. @item outdef
  3347. output channel specification, of the form:
  3348. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3349. @item out_name
  3350. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3351. number (c0, c1, etc.)
  3352. @item gain
  3353. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3354. @item in_name
  3355. input channel to use, see out_name for details; it is not possible to mix
  3356. named and numbered input channels
  3357. @end table
  3358. If the `=' in a channel specification is replaced by `<', then the gains for
  3359. that specification will be renormalized so that the total is 1, thus
  3360. avoiding clipping noise.
  3361. @subsection Mixing examples
  3362. For example, if you want to down-mix from stereo to mono, but with a bigger
  3363. factor for the left channel:
  3364. @example
  3365. pan=1c|c0=0.9*c0+0.1*c1
  3366. @end example
  3367. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3368. 7-channels surround:
  3369. @example
  3370. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3371. @end example
  3372. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3373. that should be preferred (see "-ac" option) unless you have very specific
  3374. needs.
  3375. @subsection Remapping examples
  3376. The channel remapping will be effective if, and only if:
  3377. @itemize
  3378. @item gain coefficients are zeroes or ones,
  3379. @item only one input per channel output,
  3380. @end itemize
  3381. If all these conditions are satisfied, the filter will notify the user ("Pure
  3382. channel mapping detected"), and use an optimized and lossless method to do the
  3383. remapping.
  3384. For example, if you have a 5.1 source and want a stereo audio stream by
  3385. dropping the extra channels:
  3386. @example
  3387. pan="stereo| c0=FL | c1=FR"
  3388. @end example
  3389. Given the same source, you can also switch front left and front right channels
  3390. and keep the input channel layout:
  3391. @example
  3392. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3393. @end example
  3394. If the input is a stereo audio stream, you can mute the front left channel (and
  3395. still keep the stereo channel layout) with:
  3396. @example
  3397. pan="stereo|c1=c1"
  3398. @end example
  3399. Still with a stereo audio stream input, you can copy the right channel in both
  3400. front left and right:
  3401. @example
  3402. pan="stereo| c0=FR | c1=FR"
  3403. @end example
  3404. @section replaygain
  3405. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3406. outputs it unchanged.
  3407. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3408. @section resample
  3409. Convert the audio sample format, sample rate and channel layout. It is
  3410. not meant to be used directly.
  3411. @section rubberband
  3412. Apply time-stretching and pitch-shifting with librubberband.
  3413. To enable compilation of this filter, you need to configure FFmpeg with
  3414. @code{--enable-librubberband}.
  3415. The filter accepts the following options:
  3416. @table @option
  3417. @item tempo
  3418. Set tempo scale factor.
  3419. @item pitch
  3420. Set pitch scale factor.
  3421. @item transients
  3422. Set transients detector.
  3423. Possible values are:
  3424. @table @var
  3425. @item crisp
  3426. @item mixed
  3427. @item smooth
  3428. @end table
  3429. @item detector
  3430. Set detector.
  3431. Possible values are:
  3432. @table @var
  3433. @item compound
  3434. @item percussive
  3435. @item soft
  3436. @end table
  3437. @item phase
  3438. Set phase.
  3439. Possible values are:
  3440. @table @var
  3441. @item laminar
  3442. @item independent
  3443. @end table
  3444. @item window
  3445. Set processing window size.
  3446. Possible values are:
  3447. @table @var
  3448. @item standard
  3449. @item short
  3450. @item long
  3451. @end table
  3452. @item smoothing
  3453. Set smoothing.
  3454. Possible values are:
  3455. @table @var
  3456. @item off
  3457. @item on
  3458. @end table
  3459. @item formant
  3460. Enable formant preservation when shift pitching.
  3461. Possible values are:
  3462. @table @var
  3463. @item shifted
  3464. @item preserved
  3465. @end table
  3466. @item pitchq
  3467. Set pitch quality.
  3468. Possible values are:
  3469. @table @var
  3470. @item quality
  3471. @item speed
  3472. @item consistency
  3473. @end table
  3474. @item channels
  3475. Set channels.
  3476. Possible values are:
  3477. @table @var
  3478. @item apart
  3479. @item together
  3480. @end table
  3481. @end table
  3482. @section sidechaincompress
  3483. This filter acts like normal compressor but has the ability to compress
  3484. detected signal using second input signal.
  3485. It needs two input streams and returns one output stream.
  3486. First input stream will be processed depending on second stream signal.
  3487. The filtered signal then can be filtered with other filters in later stages of
  3488. processing. See @ref{pan} and @ref{amerge} filter.
  3489. The filter accepts the following options:
  3490. @table @option
  3491. @item level_in
  3492. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3493. @item mode
  3494. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3495. Default is @code{downward}.
  3496. @item threshold
  3497. If a signal of second stream raises above this level it will affect the gain
  3498. reduction of first stream.
  3499. By default is 0.125. Range is between 0.00097563 and 1.
  3500. @item ratio
  3501. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3502. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3503. Default is 2. Range is between 1 and 20.
  3504. @item attack
  3505. Amount of milliseconds the signal has to rise above the threshold before gain
  3506. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3507. @item release
  3508. Amount of milliseconds the signal has to fall below the threshold before
  3509. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3510. @item makeup
  3511. Set the amount by how much signal will be amplified after processing.
  3512. Default is 1. Range is from 1 to 64.
  3513. @item knee
  3514. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3515. Default is 2.82843. Range is between 1 and 8.
  3516. @item link
  3517. Choose if the @code{average} level between all channels of side-chain stream
  3518. or the louder(@code{maximum}) channel of side-chain stream affects the
  3519. reduction. Default is @code{average}.
  3520. @item detection
  3521. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3522. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3523. @item level_sc
  3524. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3525. @item mix
  3526. How much to use compressed signal in output. Default is 1.
  3527. Range is between 0 and 1.
  3528. @end table
  3529. @subsection Examples
  3530. @itemize
  3531. @item
  3532. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3533. depending on the signal of 2nd input and later compressed signal to be
  3534. merged with 2nd input:
  3535. @example
  3536. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3537. @end example
  3538. @end itemize
  3539. @section sidechaingate
  3540. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3541. filter the detected signal before sending it to the gain reduction stage.
  3542. Normally a gate uses the full range signal to detect a level above the
  3543. threshold.
  3544. For example: If you cut all lower frequencies from your sidechain signal
  3545. the gate will decrease the volume of your track only if not enough highs
  3546. appear. With this technique you are able to reduce the resonation of a
  3547. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3548. guitar.
  3549. It needs two input streams and returns one output stream.
  3550. First input stream will be processed depending on second stream signal.
  3551. The filter accepts the following options:
  3552. @table @option
  3553. @item level_in
  3554. Set input level before filtering.
  3555. Default is 1. Allowed range is from 0.015625 to 64.
  3556. @item mode
  3557. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3558. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3559. will be amplified, expanding dynamic range in upward direction.
  3560. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3561. @item range
  3562. Set the level of gain reduction when the signal is below the threshold.
  3563. Default is 0.06125. Allowed range is from 0 to 1.
  3564. Setting this to 0 disables reduction and then filter behaves like expander.
  3565. @item threshold
  3566. If a signal rises above this level the gain reduction is released.
  3567. Default is 0.125. Allowed range is from 0 to 1.
  3568. @item ratio
  3569. Set a ratio about which the signal is reduced.
  3570. Default is 2. Allowed range is from 1 to 9000.
  3571. @item attack
  3572. Amount of milliseconds the signal has to rise above the threshold before gain
  3573. reduction stops.
  3574. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3575. @item release
  3576. Amount of milliseconds the signal has to fall below the threshold before the
  3577. reduction is increased again. Default is 250 milliseconds.
  3578. Allowed range is from 0.01 to 9000.
  3579. @item makeup
  3580. Set amount of amplification of signal after processing.
  3581. Default is 1. Allowed range is from 1 to 64.
  3582. @item knee
  3583. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3584. Default is 2.828427125. Allowed range is from 1 to 8.
  3585. @item detection
  3586. Choose if exact signal should be taken for detection or an RMS like one.
  3587. Default is rms. Can be peak or rms.
  3588. @item link
  3589. Choose if the average level between all channels or the louder channel affects
  3590. the reduction.
  3591. Default is average. Can be average or maximum.
  3592. @item level_sc
  3593. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3594. @end table
  3595. @section silencedetect
  3596. Detect silence in an audio stream.
  3597. This filter logs a message when it detects that the input audio volume is less
  3598. or equal to a noise tolerance value for a duration greater or equal to the
  3599. minimum detected noise duration.
  3600. The printed times and duration are expressed in seconds.
  3601. The filter accepts the following options:
  3602. @table @option
  3603. @item noise, n
  3604. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3605. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3606. @item duration, d
  3607. Set silence duration until notification (default is 2 seconds).
  3608. @item mono, m
  3609. Process each channel separately, instead of combined. By default is disabled.
  3610. @end table
  3611. @subsection Examples
  3612. @itemize
  3613. @item
  3614. Detect 5 seconds of silence with -50dB noise tolerance:
  3615. @example
  3616. silencedetect=n=-50dB:d=5
  3617. @end example
  3618. @item
  3619. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3620. tolerance in @file{silence.mp3}:
  3621. @example
  3622. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3623. @end example
  3624. @end itemize
  3625. @section silenceremove
  3626. Remove silence from the beginning, middle or end of the audio.
  3627. The filter accepts the following options:
  3628. @table @option
  3629. @item start_periods
  3630. This value is used to indicate if audio should be trimmed at beginning of
  3631. the audio. A value of zero indicates no silence should be trimmed from the
  3632. beginning. When specifying a non-zero value, it trims audio up until it
  3633. finds non-silence. Normally, when trimming silence from beginning of audio
  3634. the @var{start_periods} will be @code{1} but it can be increased to higher
  3635. values to trim all audio up to specific count of non-silence periods.
  3636. Default value is @code{0}.
  3637. @item start_duration
  3638. Specify the amount of time that non-silence must be detected before it stops
  3639. trimming audio. By increasing the duration, bursts of noises can be treated
  3640. as silence and trimmed off. Default value is @code{0}.
  3641. @item start_threshold
  3642. This indicates what sample value should be treated as silence. For digital
  3643. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3644. you may wish to increase the value to account for background noise.
  3645. Can be specified in dB (in case "dB" is appended to the specified value)
  3646. or amplitude ratio. Default value is @code{0}.
  3647. @item start_silence
  3648. Specify max duration of silence at beginning that will be kept after
  3649. trimming. Default is 0, which is equal to trimming all samples detected
  3650. as silence.
  3651. @item start_mode
  3652. Specify mode of detection of silence end in start of multi-channel audio.
  3653. Can be @var{any} or @var{all}. Default is @var{any}.
  3654. With @var{any}, any sample that is detected as non-silence will cause
  3655. stopped trimming of silence.
  3656. With @var{all}, only if all channels are detected as non-silence will cause
  3657. stopped trimming of silence.
  3658. @item stop_periods
  3659. Set the count for trimming silence from the end of audio.
  3660. To remove silence from the middle of a file, specify a @var{stop_periods}
  3661. that is negative. This value is then treated as a positive value and is
  3662. used to indicate the effect should restart processing as specified by
  3663. @var{start_periods}, making it suitable for removing periods of silence
  3664. in the middle of the audio.
  3665. Default value is @code{0}.
  3666. @item stop_duration
  3667. Specify a duration of silence that must exist before audio is not copied any
  3668. more. By specifying a higher duration, silence that is wanted can be left in
  3669. the audio.
  3670. Default value is @code{0}.
  3671. @item stop_threshold
  3672. This is the same as @option{start_threshold} but for trimming silence from
  3673. the end of audio.
  3674. Can be specified in dB (in case "dB" is appended to the specified value)
  3675. or amplitude ratio. Default value is @code{0}.
  3676. @item stop_silence
  3677. Specify max duration of silence at end that will be kept after
  3678. trimming. Default is 0, which is equal to trimming all samples detected
  3679. as silence.
  3680. @item stop_mode
  3681. Specify mode of detection of silence start in end of multi-channel audio.
  3682. Can be @var{any} or @var{all}. Default is @var{any}.
  3683. With @var{any}, any sample that is detected as non-silence will cause
  3684. stopped trimming of silence.
  3685. With @var{all}, only if all channels are detected as non-silence will cause
  3686. stopped trimming of silence.
  3687. @item detection
  3688. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3689. and works better with digital silence which is exactly 0.
  3690. Default value is @code{rms}.
  3691. @item window
  3692. Set duration in number of seconds used to calculate size of window in number
  3693. of samples for detecting silence.
  3694. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3695. @end table
  3696. @subsection Examples
  3697. @itemize
  3698. @item
  3699. The following example shows how this filter can be used to start a recording
  3700. that does not contain the delay at the start which usually occurs between
  3701. pressing the record button and the start of the performance:
  3702. @example
  3703. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3704. @end example
  3705. @item
  3706. Trim all silence encountered from beginning to end where there is more than 1
  3707. second of silence in audio:
  3708. @example
  3709. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3710. @end example
  3711. @item
  3712. Trim all digital silence samples, using peak detection, from beginning to end
  3713. where there is more than 0 samples of digital silence in audio and digital
  3714. silence is detected in all channels at same positions in stream:
  3715. @example
  3716. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  3717. @end example
  3718. @end itemize
  3719. @section sofalizer
  3720. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3721. loudspeakers around the user for binaural listening via headphones (audio
  3722. formats up to 9 channels supported).
  3723. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3724. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3725. Austrian Academy of Sciences.
  3726. To enable compilation of this filter you need to configure FFmpeg with
  3727. @code{--enable-libmysofa}.
  3728. The filter accepts the following options:
  3729. @table @option
  3730. @item sofa
  3731. Set the SOFA file used for rendering.
  3732. @item gain
  3733. Set gain applied to audio. Value is in dB. Default is 0.
  3734. @item rotation
  3735. Set rotation of virtual loudspeakers in deg. Default is 0.
  3736. @item elevation
  3737. Set elevation of virtual speakers in deg. Default is 0.
  3738. @item radius
  3739. Set distance in meters between loudspeakers and the listener with near-field
  3740. HRTFs. Default is 1.
  3741. @item type
  3742. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3743. processing audio in time domain which is slow.
  3744. @var{freq} is processing audio in frequency domain which is fast.
  3745. Default is @var{freq}.
  3746. @item speakers
  3747. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3748. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3749. Each virtual loudspeaker is described with short channel name following with
  3750. azimuth and elevation in degrees.
  3751. Each virtual loudspeaker description is separated by '|'.
  3752. For example to override front left and front right channel positions use:
  3753. 'speakers=FL 45 15|FR 345 15'.
  3754. Descriptions with unrecognised channel names are ignored.
  3755. @item lfegain
  3756. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3757. @item framesize
  3758. Set custom frame size in number of samples. Default is 1024.
  3759. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3760. is set to @var{freq}.
  3761. @item normalize
  3762. Should all IRs be normalized upon importing SOFA file.
  3763. By default is enabled.
  3764. @item interpolate
  3765. Should nearest IRs be interpolated with neighbor IRs if exact position
  3766. does not match. By default is disabled.
  3767. @item minphase
  3768. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3769. @item anglestep
  3770. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3771. @item radstep
  3772. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3773. @end table
  3774. @subsection Examples
  3775. @itemize
  3776. @item
  3777. Using ClubFritz6 sofa file:
  3778. @example
  3779. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3780. @end example
  3781. @item
  3782. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3783. @example
  3784. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3785. @end example
  3786. @item
  3787. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3788. and also with custom gain:
  3789. @example
  3790. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3791. @end example
  3792. @end itemize
  3793. @section stereotools
  3794. This filter has some handy utilities to manage stereo signals, for converting
  3795. M/S stereo recordings to L/R signal while having control over the parameters
  3796. or spreading the stereo image of master track.
  3797. The filter accepts the following options:
  3798. @table @option
  3799. @item level_in
  3800. Set input level before filtering for both channels. Defaults is 1.
  3801. Allowed range is from 0.015625 to 64.
  3802. @item level_out
  3803. Set output level after filtering for both channels. Defaults is 1.
  3804. Allowed range is from 0.015625 to 64.
  3805. @item balance_in
  3806. Set input balance between both channels. Default is 0.
  3807. Allowed range is from -1 to 1.
  3808. @item balance_out
  3809. Set output balance between both channels. Default is 0.
  3810. Allowed range is from -1 to 1.
  3811. @item softclip
  3812. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3813. clipping. Disabled by default.
  3814. @item mutel
  3815. Mute the left channel. Disabled by default.
  3816. @item muter
  3817. Mute the right channel. Disabled by default.
  3818. @item phasel
  3819. Change the phase of the left channel. Disabled by default.
  3820. @item phaser
  3821. Change the phase of the right channel. Disabled by default.
  3822. @item mode
  3823. Set stereo mode. Available values are:
  3824. @table @samp
  3825. @item lr>lr
  3826. Left/Right to Left/Right, this is default.
  3827. @item lr>ms
  3828. Left/Right to Mid/Side.
  3829. @item ms>lr
  3830. Mid/Side to Left/Right.
  3831. @item lr>ll
  3832. Left/Right to Left/Left.
  3833. @item lr>rr
  3834. Left/Right to Right/Right.
  3835. @item lr>l+r
  3836. Left/Right to Left + Right.
  3837. @item lr>rl
  3838. Left/Right to Right/Left.
  3839. @item ms>ll
  3840. Mid/Side to Left/Left.
  3841. @item ms>rr
  3842. Mid/Side to Right/Right.
  3843. @end table
  3844. @item slev
  3845. Set level of side signal. Default is 1.
  3846. Allowed range is from 0.015625 to 64.
  3847. @item sbal
  3848. Set balance of side signal. Default is 0.
  3849. Allowed range is from -1 to 1.
  3850. @item mlev
  3851. Set level of the middle signal. Default is 1.
  3852. Allowed range is from 0.015625 to 64.
  3853. @item mpan
  3854. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3855. @item base
  3856. Set stereo base between mono and inversed channels. Default is 0.
  3857. Allowed range is from -1 to 1.
  3858. @item delay
  3859. Set delay in milliseconds how much to delay left from right channel and
  3860. vice versa. Default is 0. Allowed range is from -20 to 20.
  3861. @item sclevel
  3862. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3863. @item phase
  3864. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3865. @item bmode_in, bmode_out
  3866. Set balance mode for balance_in/balance_out option.
  3867. Can be one of the following:
  3868. @table @samp
  3869. @item balance
  3870. Classic balance mode. Attenuate one channel at time.
  3871. Gain is raised up to 1.
  3872. @item amplitude
  3873. Similar as classic mode above but gain is raised up to 2.
  3874. @item power
  3875. Equal power distribution, from -6dB to +6dB range.
  3876. @end table
  3877. @end table
  3878. @subsection Examples
  3879. @itemize
  3880. @item
  3881. Apply karaoke like effect:
  3882. @example
  3883. stereotools=mlev=0.015625
  3884. @end example
  3885. @item
  3886. Convert M/S signal to L/R:
  3887. @example
  3888. "stereotools=mode=ms>lr"
  3889. @end example
  3890. @end itemize
  3891. @section stereowiden
  3892. This filter enhance the stereo effect by suppressing signal common to both
  3893. channels and by delaying the signal of left into right and vice versa,
  3894. thereby widening the stereo effect.
  3895. The filter accepts the following options:
  3896. @table @option
  3897. @item delay
  3898. Time in milliseconds of the delay of left signal into right and vice versa.
  3899. Default is 20 milliseconds.
  3900. @item feedback
  3901. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3902. effect of left signal in right output and vice versa which gives widening
  3903. effect. Default is 0.3.
  3904. @item crossfeed
  3905. Cross feed of left into right with inverted phase. This helps in suppressing
  3906. the mono. If the value is 1 it will cancel all the signal common to both
  3907. channels. Default is 0.3.
  3908. @item drymix
  3909. Set level of input signal of original channel. Default is 0.8.
  3910. @end table
  3911. @section superequalizer
  3912. Apply 18 band equalizer.
  3913. The filter accepts the following options:
  3914. @table @option
  3915. @item 1b
  3916. Set 65Hz band gain.
  3917. @item 2b
  3918. Set 92Hz band gain.
  3919. @item 3b
  3920. Set 131Hz band gain.
  3921. @item 4b
  3922. Set 185Hz band gain.
  3923. @item 5b
  3924. Set 262Hz band gain.
  3925. @item 6b
  3926. Set 370Hz band gain.
  3927. @item 7b
  3928. Set 523Hz band gain.
  3929. @item 8b
  3930. Set 740Hz band gain.
  3931. @item 9b
  3932. Set 1047Hz band gain.
  3933. @item 10b
  3934. Set 1480Hz band gain.
  3935. @item 11b
  3936. Set 2093Hz band gain.
  3937. @item 12b
  3938. Set 2960Hz band gain.
  3939. @item 13b
  3940. Set 4186Hz band gain.
  3941. @item 14b
  3942. Set 5920Hz band gain.
  3943. @item 15b
  3944. Set 8372Hz band gain.
  3945. @item 16b
  3946. Set 11840Hz band gain.
  3947. @item 17b
  3948. Set 16744Hz band gain.
  3949. @item 18b
  3950. Set 20000Hz band gain.
  3951. @end table
  3952. @section surround
  3953. Apply audio surround upmix filter.
  3954. This filter allows to produce multichannel output from audio stream.
  3955. The filter accepts the following options:
  3956. @table @option
  3957. @item chl_out
  3958. Set output channel layout. By default, this is @var{5.1}.
  3959. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3960. for the required syntax.
  3961. @item chl_in
  3962. Set input channel layout. By default, this is @var{stereo}.
  3963. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3964. for the required syntax.
  3965. @item level_in
  3966. Set input volume level. By default, this is @var{1}.
  3967. @item level_out
  3968. Set output volume level. By default, this is @var{1}.
  3969. @item lfe
  3970. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3971. @item lfe_low
  3972. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3973. @item lfe_high
  3974. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3975. @item lfe_mode
  3976. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  3977. In @var{add} mode, LFE channel is created from input audio and added to output.
  3978. In @var{sub} mode, LFE channel is created from input audio and added to output but
  3979. also all non-LFE output channels are subtracted with output LFE channel.
  3980. @item angle
  3981. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  3982. Default is @var{90}.
  3983. @item fc_in
  3984. Set front center input volume. By default, this is @var{1}.
  3985. @item fc_out
  3986. Set front center output volume. By default, this is @var{1}.
  3987. @item fl_in
  3988. Set front left input volume. By default, this is @var{1}.
  3989. @item fl_out
  3990. Set front left output volume. By default, this is @var{1}.
  3991. @item fr_in
  3992. Set front right input volume. By default, this is @var{1}.
  3993. @item fr_out
  3994. Set front right output volume. By default, this is @var{1}.
  3995. @item sl_in
  3996. Set side left input volume. By default, this is @var{1}.
  3997. @item sl_out
  3998. Set side left output volume. By default, this is @var{1}.
  3999. @item sr_in
  4000. Set side right input volume. By default, this is @var{1}.
  4001. @item sr_out
  4002. Set side right output volume. By default, this is @var{1}.
  4003. @item bl_in
  4004. Set back left input volume. By default, this is @var{1}.
  4005. @item bl_out
  4006. Set back left output volume. By default, this is @var{1}.
  4007. @item br_in
  4008. Set back right input volume. By default, this is @var{1}.
  4009. @item br_out
  4010. Set back right output volume. By default, this is @var{1}.
  4011. @item bc_in
  4012. Set back center input volume. By default, this is @var{1}.
  4013. @item bc_out
  4014. Set back center output volume. By default, this is @var{1}.
  4015. @item lfe_in
  4016. Set LFE input volume. By default, this is @var{1}.
  4017. @item lfe_out
  4018. Set LFE output volume. By default, this is @var{1}.
  4019. @item allx
  4020. Set spread usage of stereo image across X axis for all channels.
  4021. @item ally
  4022. Set spread usage of stereo image across Y axis for all channels.
  4023. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4024. Set spread usage of stereo image across X axis for each channel.
  4025. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4026. Set spread usage of stereo image across Y axis for each channel.
  4027. @item win_size
  4028. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4029. @item win_func
  4030. Set window function.
  4031. It accepts the following values:
  4032. @table @samp
  4033. @item rect
  4034. @item bartlett
  4035. @item hann, hanning
  4036. @item hamming
  4037. @item blackman
  4038. @item welch
  4039. @item flattop
  4040. @item bharris
  4041. @item bnuttall
  4042. @item bhann
  4043. @item sine
  4044. @item nuttall
  4045. @item lanczos
  4046. @item gauss
  4047. @item tukey
  4048. @item dolph
  4049. @item cauchy
  4050. @item parzen
  4051. @item poisson
  4052. @item bohman
  4053. @end table
  4054. Default is @code{hann}.
  4055. @item overlap
  4056. Set window overlap. If set to 1, the recommended overlap for selected
  4057. window function will be picked. Default is @code{0.5}.
  4058. @end table
  4059. @section treble, highshelf
  4060. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4061. shelving filter with a response similar to that of a standard
  4062. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4063. The filter accepts the following options:
  4064. @table @option
  4065. @item gain, g
  4066. Give the gain at whichever is the lower of ~22 kHz and the
  4067. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4068. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4069. @item frequency, f
  4070. Set the filter's central frequency and so can be used
  4071. to extend or reduce the frequency range to be boosted or cut.
  4072. The default value is @code{3000} Hz.
  4073. @item width_type, t
  4074. Set method to specify band-width of filter.
  4075. @table @option
  4076. @item h
  4077. Hz
  4078. @item q
  4079. Q-Factor
  4080. @item o
  4081. octave
  4082. @item s
  4083. slope
  4084. @item k
  4085. kHz
  4086. @end table
  4087. @item width, w
  4088. Determine how steep is the filter's shelf transition.
  4089. @item mix, m
  4090. How much to use filtered signal in output. Default is 1.
  4091. Range is between 0 and 1.
  4092. @item channels, c
  4093. Specify which channels to filter, by default all available are filtered.
  4094. @end table
  4095. @subsection Commands
  4096. This filter supports the following commands:
  4097. @table @option
  4098. @item frequency, f
  4099. Change treble frequency.
  4100. Syntax for the command is : "@var{frequency}"
  4101. @item width_type, t
  4102. Change treble width_type.
  4103. Syntax for the command is : "@var{width_type}"
  4104. @item width, w
  4105. Change treble width.
  4106. Syntax for the command is : "@var{width}"
  4107. @item gain, g
  4108. Change treble gain.
  4109. Syntax for the command is : "@var{gain}"
  4110. @item mix, m
  4111. Change treble mix.
  4112. Syntax for the command is : "@var{mix}"
  4113. @end table
  4114. @section tremolo
  4115. Sinusoidal amplitude modulation.
  4116. The filter accepts the following options:
  4117. @table @option
  4118. @item f
  4119. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4120. (20 Hz or lower) will result in a tremolo effect.
  4121. This filter may also be used as a ring modulator by specifying
  4122. a modulation frequency higher than 20 Hz.
  4123. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4124. @item d
  4125. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4126. Default value is 0.5.
  4127. @end table
  4128. @section vibrato
  4129. Sinusoidal phase modulation.
  4130. The filter accepts the following options:
  4131. @table @option
  4132. @item f
  4133. Modulation frequency in Hertz.
  4134. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4135. @item d
  4136. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4137. Default value is 0.5.
  4138. @end table
  4139. @section volume
  4140. Adjust the input audio volume.
  4141. It accepts the following parameters:
  4142. @table @option
  4143. @item volume
  4144. Set audio volume expression.
  4145. Output values are clipped to the maximum value.
  4146. The output audio volume is given by the relation:
  4147. @example
  4148. @var{output_volume} = @var{volume} * @var{input_volume}
  4149. @end example
  4150. The default value for @var{volume} is "1.0".
  4151. @item precision
  4152. This parameter represents the mathematical precision.
  4153. It determines which input sample formats will be allowed, which affects the
  4154. precision of the volume scaling.
  4155. @table @option
  4156. @item fixed
  4157. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4158. @item float
  4159. 32-bit floating-point; this limits input sample format to FLT. (default)
  4160. @item double
  4161. 64-bit floating-point; this limits input sample format to DBL.
  4162. @end table
  4163. @item replaygain
  4164. Choose the behaviour on encountering ReplayGain side data in input frames.
  4165. @table @option
  4166. @item drop
  4167. Remove ReplayGain side data, ignoring its contents (the default).
  4168. @item ignore
  4169. Ignore ReplayGain side data, but leave it in the frame.
  4170. @item track
  4171. Prefer the track gain, if present.
  4172. @item album
  4173. Prefer the album gain, if present.
  4174. @end table
  4175. @item replaygain_preamp
  4176. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4177. Default value for @var{replaygain_preamp} is 0.0.
  4178. @item eval
  4179. Set when the volume expression is evaluated.
  4180. It accepts the following values:
  4181. @table @samp
  4182. @item once
  4183. only evaluate expression once during the filter initialization, or
  4184. when the @samp{volume} command is sent
  4185. @item frame
  4186. evaluate expression for each incoming frame
  4187. @end table
  4188. Default value is @samp{once}.
  4189. @end table
  4190. The volume expression can contain the following parameters.
  4191. @table @option
  4192. @item n
  4193. frame number (starting at zero)
  4194. @item nb_channels
  4195. number of channels
  4196. @item nb_consumed_samples
  4197. number of samples consumed by the filter
  4198. @item nb_samples
  4199. number of samples in the current frame
  4200. @item pos
  4201. original frame position in the file
  4202. @item pts
  4203. frame PTS
  4204. @item sample_rate
  4205. sample rate
  4206. @item startpts
  4207. PTS at start of stream
  4208. @item startt
  4209. time at start of stream
  4210. @item t
  4211. frame time
  4212. @item tb
  4213. timestamp timebase
  4214. @item volume
  4215. last set volume value
  4216. @end table
  4217. Note that when @option{eval} is set to @samp{once} only the
  4218. @var{sample_rate} and @var{tb} variables are available, all other
  4219. variables will evaluate to NAN.
  4220. @subsection Commands
  4221. This filter supports the following commands:
  4222. @table @option
  4223. @item volume
  4224. Modify the volume expression.
  4225. The command accepts the same syntax of the corresponding option.
  4226. If the specified expression is not valid, it is kept at its current
  4227. value.
  4228. @item replaygain_noclip
  4229. Prevent clipping by limiting the gain applied.
  4230. Default value for @var{replaygain_noclip} is 1.
  4231. @end table
  4232. @subsection Examples
  4233. @itemize
  4234. @item
  4235. Halve the input audio volume:
  4236. @example
  4237. volume=volume=0.5
  4238. volume=volume=1/2
  4239. volume=volume=-6.0206dB
  4240. @end example
  4241. In all the above example the named key for @option{volume} can be
  4242. omitted, for example like in:
  4243. @example
  4244. volume=0.5
  4245. @end example
  4246. @item
  4247. Increase input audio power by 6 decibels using fixed-point precision:
  4248. @example
  4249. volume=volume=6dB:precision=fixed
  4250. @end example
  4251. @item
  4252. Fade volume after time 10 with an annihilation period of 5 seconds:
  4253. @example
  4254. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4255. @end example
  4256. @end itemize
  4257. @section volumedetect
  4258. Detect the volume of the input video.
  4259. The filter has no parameters. The input is not modified. Statistics about
  4260. the volume will be printed in the log when the input stream end is reached.
  4261. In particular it will show the mean volume (root mean square), maximum
  4262. volume (on a per-sample basis), and the beginning of a histogram of the
  4263. registered volume values (from the maximum value to a cumulated 1/1000 of
  4264. the samples).
  4265. All volumes are in decibels relative to the maximum PCM value.
  4266. @subsection Examples
  4267. Here is an excerpt of the output:
  4268. @example
  4269. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4270. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4271. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4272. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4273. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4274. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4275. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4276. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4277. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4278. @end example
  4279. It means that:
  4280. @itemize
  4281. @item
  4282. The mean square energy is approximately -27 dB, or 10^-2.7.
  4283. @item
  4284. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4285. @item
  4286. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4287. @end itemize
  4288. In other words, raising the volume by +4 dB does not cause any clipping,
  4289. raising it by +5 dB causes clipping for 6 samples, etc.
  4290. @c man end AUDIO FILTERS
  4291. @chapter Audio Sources
  4292. @c man begin AUDIO SOURCES
  4293. Below is a description of the currently available audio sources.
  4294. @section abuffer
  4295. Buffer audio frames, and make them available to the filter chain.
  4296. This source is mainly intended for a programmatic use, in particular
  4297. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4298. It accepts the following parameters:
  4299. @table @option
  4300. @item time_base
  4301. The timebase which will be used for timestamps of submitted frames. It must be
  4302. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4303. @item sample_rate
  4304. The sample rate of the incoming audio buffers.
  4305. @item sample_fmt
  4306. The sample format of the incoming audio buffers.
  4307. Either a sample format name or its corresponding integer representation from
  4308. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4309. @item channel_layout
  4310. The channel layout of the incoming audio buffers.
  4311. Either a channel layout name from channel_layout_map in
  4312. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4313. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4314. @item channels
  4315. The number of channels of the incoming audio buffers.
  4316. If both @var{channels} and @var{channel_layout} are specified, then they
  4317. must be consistent.
  4318. @end table
  4319. @subsection Examples
  4320. @example
  4321. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4322. @end example
  4323. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4324. Since the sample format with name "s16p" corresponds to the number
  4325. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4326. equivalent to:
  4327. @example
  4328. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4329. @end example
  4330. @section aevalsrc
  4331. Generate an audio signal specified by an expression.
  4332. This source accepts in input one or more expressions (one for each
  4333. channel), which are evaluated and used to generate a corresponding
  4334. audio signal.
  4335. This source accepts the following options:
  4336. @table @option
  4337. @item exprs
  4338. Set the '|'-separated expressions list for each separate channel. In case the
  4339. @option{channel_layout} option is not specified, the selected channel layout
  4340. depends on the number of provided expressions. Otherwise the last
  4341. specified expression is applied to the remaining output channels.
  4342. @item channel_layout, c
  4343. Set the channel layout. The number of channels in the specified layout
  4344. must be equal to the number of specified expressions.
  4345. @item duration, d
  4346. Set the minimum duration of the sourced audio. See
  4347. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4348. for the accepted syntax.
  4349. Note that the resulting duration may be greater than the specified
  4350. duration, as the generated audio is always cut at the end of a
  4351. complete frame.
  4352. If not specified, or the expressed duration is negative, the audio is
  4353. supposed to be generated forever.
  4354. @item nb_samples, n
  4355. Set the number of samples per channel per each output frame,
  4356. default to 1024.
  4357. @item sample_rate, s
  4358. Specify the sample rate, default to 44100.
  4359. @end table
  4360. Each expression in @var{exprs} can contain the following constants:
  4361. @table @option
  4362. @item n
  4363. number of the evaluated sample, starting from 0
  4364. @item t
  4365. time of the evaluated sample expressed in seconds, starting from 0
  4366. @item s
  4367. sample rate
  4368. @end table
  4369. @subsection Examples
  4370. @itemize
  4371. @item
  4372. Generate silence:
  4373. @example
  4374. aevalsrc=0
  4375. @end example
  4376. @item
  4377. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4378. 8000 Hz:
  4379. @example
  4380. aevalsrc="sin(440*2*PI*t):s=8000"
  4381. @end example
  4382. @item
  4383. Generate a two channels signal, specify the channel layout (Front
  4384. Center + Back Center) explicitly:
  4385. @example
  4386. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4387. @end example
  4388. @item
  4389. Generate white noise:
  4390. @example
  4391. aevalsrc="-2+random(0)"
  4392. @end example
  4393. @item
  4394. Generate an amplitude modulated signal:
  4395. @example
  4396. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4397. @end example
  4398. @item
  4399. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4400. @example
  4401. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4402. @end example
  4403. @end itemize
  4404. @section anullsrc
  4405. The null audio source, return unprocessed audio frames. It is mainly useful
  4406. as a template and to be employed in analysis / debugging tools, or as
  4407. the source for filters which ignore the input data (for example the sox
  4408. synth filter).
  4409. This source accepts the following options:
  4410. @table @option
  4411. @item channel_layout, cl
  4412. Specifies the channel layout, and can be either an integer or a string
  4413. representing a channel layout. The default value of @var{channel_layout}
  4414. is "stereo".
  4415. Check the channel_layout_map definition in
  4416. @file{libavutil/channel_layout.c} for the mapping between strings and
  4417. channel layout values.
  4418. @item sample_rate, r
  4419. Specifies the sample rate, and defaults to 44100.
  4420. @item nb_samples, n
  4421. Set the number of samples per requested frames.
  4422. @end table
  4423. @subsection Examples
  4424. @itemize
  4425. @item
  4426. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4427. @example
  4428. anullsrc=r=48000:cl=4
  4429. @end example
  4430. @item
  4431. Do the same operation with a more obvious syntax:
  4432. @example
  4433. anullsrc=r=48000:cl=mono
  4434. @end example
  4435. @end itemize
  4436. All the parameters need to be explicitly defined.
  4437. @section flite
  4438. Synthesize a voice utterance using the libflite library.
  4439. To enable compilation of this filter you need to configure FFmpeg with
  4440. @code{--enable-libflite}.
  4441. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4442. The filter accepts the following options:
  4443. @table @option
  4444. @item list_voices
  4445. If set to 1, list the names of the available voices and exit
  4446. immediately. Default value is 0.
  4447. @item nb_samples, n
  4448. Set the maximum number of samples per frame. Default value is 512.
  4449. @item textfile
  4450. Set the filename containing the text to speak.
  4451. @item text
  4452. Set the text to speak.
  4453. @item voice, v
  4454. Set the voice to use for the speech synthesis. Default value is
  4455. @code{kal}. See also the @var{list_voices} option.
  4456. @end table
  4457. @subsection Examples
  4458. @itemize
  4459. @item
  4460. Read from file @file{speech.txt}, and synthesize the text using the
  4461. standard flite voice:
  4462. @example
  4463. flite=textfile=speech.txt
  4464. @end example
  4465. @item
  4466. Read the specified text selecting the @code{slt} voice:
  4467. @example
  4468. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4469. @end example
  4470. @item
  4471. Input text to ffmpeg:
  4472. @example
  4473. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4474. @end example
  4475. @item
  4476. Make @file{ffplay} speak the specified text, using @code{flite} and
  4477. the @code{lavfi} device:
  4478. @example
  4479. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4480. @end example
  4481. @end itemize
  4482. For more information about libflite, check:
  4483. @url{http://www.festvox.org/flite/}
  4484. @section anoisesrc
  4485. Generate a noise audio signal.
  4486. The filter accepts the following options:
  4487. @table @option
  4488. @item sample_rate, r
  4489. Specify the sample rate. Default value is 48000 Hz.
  4490. @item amplitude, a
  4491. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4492. is 1.0.
  4493. @item duration, d
  4494. Specify the duration of the generated audio stream. Not specifying this option
  4495. results in noise with an infinite length.
  4496. @item color, colour, c
  4497. Specify the color of noise. Available noise colors are white, pink, brown,
  4498. blue and violet. Default color is white.
  4499. @item seed, s
  4500. Specify a value used to seed the PRNG.
  4501. @item nb_samples, n
  4502. Set the number of samples per each output frame, default is 1024.
  4503. @end table
  4504. @subsection Examples
  4505. @itemize
  4506. @item
  4507. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4508. @example
  4509. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4510. @end example
  4511. @end itemize
  4512. @section hilbert
  4513. Generate odd-tap Hilbert transform FIR coefficients.
  4514. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4515. the signal by 90 degrees.
  4516. This is used in many matrix coding schemes and for analytic signal generation.
  4517. The process is often written as a multiplication by i (or j), the imaginary unit.
  4518. The filter accepts the following options:
  4519. @table @option
  4520. @item sample_rate, s
  4521. Set sample rate, default is 44100.
  4522. @item taps, t
  4523. Set length of FIR filter, default is 22051.
  4524. @item nb_samples, n
  4525. Set number of samples per each frame.
  4526. @item win_func, w
  4527. Set window function to be used when generating FIR coefficients.
  4528. @end table
  4529. @section sinc
  4530. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4531. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4532. The filter accepts the following options:
  4533. @table @option
  4534. @item sample_rate, r
  4535. Set sample rate, default is 44100.
  4536. @item nb_samples, n
  4537. Set number of samples per each frame. Default is 1024.
  4538. @item hp
  4539. Set high-pass frequency. Default is 0.
  4540. @item lp
  4541. Set low-pass frequency. Default is 0.
  4542. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4543. is higher than 0 then filter will create band-pass filter coefficients,
  4544. otherwise band-reject filter coefficients.
  4545. @item phase
  4546. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4547. @item beta
  4548. Set Kaiser window beta.
  4549. @item att
  4550. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4551. @item round
  4552. Enable rounding, by default is disabled.
  4553. @item hptaps
  4554. Set number of taps for high-pass filter.
  4555. @item lptaps
  4556. Set number of taps for low-pass filter.
  4557. @end table
  4558. @section sine
  4559. Generate an audio signal made of a sine wave with amplitude 1/8.
  4560. The audio signal is bit-exact.
  4561. The filter accepts the following options:
  4562. @table @option
  4563. @item frequency, f
  4564. Set the carrier frequency. Default is 440 Hz.
  4565. @item beep_factor, b
  4566. Enable a periodic beep every second with frequency @var{beep_factor} times
  4567. the carrier frequency. Default is 0, meaning the beep is disabled.
  4568. @item sample_rate, r
  4569. Specify the sample rate, default is 44100.
  4570. @item duration, d
  4571. Specify the duration of the generated audio stream.
  4572. @item samples_per_frame
  4573. Set the number of samples per output frame.
  4574. The expression can contain the following constants:
  4575. @table @option
  4576. @item n
  4577. The (sequential) number of the output audio frame, starting from 0.
  4578. @item pts
  4579. The PTS (Presentation TimeStamp) of the output audio frame,
  4580. expressed in @var{TB} units.
  4581. @item t
  4582. The PTS of the output audio frame, expressed in seconds.
  4583. @item TB
  4584. The timebase of the output audio frames.
  4585. @end table
  4586. Default is @code{1024}.
  4587. @end table
  4588. @subsection Examples
  4589. @itemize
  4590. @item
  4591. Generate a simple 440 Hz sine wave:
  4592. @example
  4593. sine
  4594. @end example
  4595. @item
  4596. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4597. @example
  4598. sine=220:4:d=5
  4599. sine=f=220:b=4:d=5
  4600. sine=frequency=220:beep_factor=4:duration=5
  4601. @end example
  4602. @item
  4603. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4604. pattern:
  4605. @example
  4606. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4607. @end example
  4608. @end itemize
  4609. @c man end AUDIO SOURCES
  4610. @chapter Audio Sinks
  4611. @c man begin AUDIO SINKS
  4612. Below is a description of the currently available audio sinks.
  4613. @section abuffersink
  4614. Buffer audio frames, and make them available to the end of filter chain.
  4615. This sink is mainly intended for programmatic use, in particular
  4616. through the interface defined in @file{libavfilter/buffersink.h}
  4617. or the options system.
  4618. It accepts a pointer to an AVABufferSinkContext structure, which
  4619. defines the incoming buffers' formats, to be passed as the opaque
  4620. parameter to @code{avfilter_init_filter} for initialization.
  4621. @section anullsink
  4622. Null audio sink; do absolutely nothing with the input audio. It is
  4623. mainly useful as a template and for use in analysis / debugging
  4624. tools.
  4625. @c man end AUDIO SINKS
  4626. @chapter Video Filters
  4627. @c man begin VIDEO FILTERS
  4628. When you configure your FFmpeg build, you can disable any of the
  4629. existing filters using @code{--disable-filters}.
  4630. The configure output will show the video filters included in your
  4631. build.
  4632. Below is a description of the currently available video filters.
  4633. @section addroi
  4634. Mark a region of interest in a video frame.
  4635. The frame data is passed through unchanged, but metadata is attached
  4636. to the frame indicating regions of interest which can affect the
  4637. behaviour of later encoding. Multiple regions can be marked by
  4638. applying the filter multiple times.
  4639. @table @option
  4640. @item x
  4641. Region distance in pixels from the left edge of the frame.
  4642. @item y
  4643. Region distance in pixels from the top edge of the frame.
  4644. @item w
  4645. Region width in pixels.
  4646. @item h
  4647. Region height in pixels.
  4648. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  4649. and may contain the following variables:
  4650. @table @option
  4651. @item iw
  4652. Width of the input frame.
  4653. @item ih
  4654. Height of the input frame.
  4655. @end table
  4656. @item qoffset
  4657. Quantisation offset to apply within the region.
  4658. This must be a real value in the range -1 to +1. A value of zero
  4659. indicates no quality change. A negative value asks for better quality
  4660. (less quantisation), while a positive value asks for worse quality
  4661. (greater quantisation).
  4662. The range is calibrated so that the extreme values indicate the
  4663. largest possible offset - if the rest of the frame is encoded with the
  4664. worst possible quality, an offset of -1 indicates that this region
  4665. should be encoded with the best possible quality anyway. Intermediate
  4666. values are then interpolated in some codec-dependent way.
  4667. For example, in 10-bit H.264 the quantisation parameter varies between
  4668. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  4669. this region should be encoded with a QP around one-tenth of the full
  4670. range better than the rest of the frame. So, if most of the frame
  4671. were to be encoded with a QP of around 30, this region would get a QP
  4672. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  4673. An extreme value of -1 would indicate that this region should be
  4674. encoded with the best possible quality regardless of the treatment of
  4675. the rest of the frame - that is, should be encoded at a QP of -12.
  4676. @item clear
  4677. If set to true, remove any existing regions of interest marked on the
  4678. frame before adding the new one.
  4679. @end table
  4680. @subsection Examples
  4681. @itemize
  4682. @item
  4683. Mark the centre quarter of the frame as interesting.
  4684. @example
  4685. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  4686. @end example
  4687. @item
  4688. Mark the 100-pixel-wide region on the left edge of the frame as very
  4689. uninteresting (to be encoded at much lower quality than the rest of
  4690. the frame).
  4691. @example
  4692. addroi=0:0:100:ih:+1/5
  4693. @end example
  4694. @end itemize
  4695. @section alphaextract
  4696. Extract the alpha component from the input as a grayscale video. This
  4697. is especially useful with the @var{alphamerge} filter.
  4698. @section alphamerge
  4699. Add or replace the alpha component of the primary input with the
  4700. grayscale value of a second input. This is intended for use with
  4701. @var{alphaextract} to allow the transmission or storage of frame
  4702. sequences that have alpha in a format that doesn't support an alpha
  4703. channel.
  4704. For example, to reconstruct full frames from a normal YUV-encoded video
  4705. and a separate video created with @var{alphaextract}, you might use:
  4706. @example
  4707. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4708. @end example
  4709. Since this filter is designed for reconstruction, it operates on frame
  4710. sequences without considering timestamps, and terminates when either
  4711. input reaches end of stream. This will cause problems if your encoding
  4712. pipeline drops frames. If you're trying to apply an image as an
  4713. overlay to a video stream, consider the @var{overlay} filter instead.
  4714. @section amplify
  4715. Amplify differences between current pixel and pixels of adjacent frames in
  4716. same pixel location.
  4717. This filter accepts the following options:
  4718. @table @option
  4719. @item radius
  4720. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4721. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4722. @item factor
  4723. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4724. @item threshold
  4725. Set threshold for difference amplification. Any difference greater or equal to
  4726. this value will not alter source pixel. Default is 10.
  4727. Allowed range is from 0 to 65535.
  4728. @item tolerance
  4729. Set tolerance for difference amplification. Any difference lower to
  4730. this value will not alter source pixel. Default is 0.
  4731. Allowed range is from 0 to 65535.
  4732. @item low
  4733. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4734. This option controls maximum possible value that will decrease source pixel value.
  4735. @item high
  4736. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4737. This option controls maximum possible value that will increase source pixel value.
  4738. @item planes
  4739. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4740. @end table
  4741. @section ass
  4742. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4743. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4744. Substation Alpha) subtitles files.
  4745. This filter accepts the following option in addition to the common options from
  4746. the @ref{subtitles} filter:
  4747. @table @option
  4748. @item shaping
  4749. Set the shaping engine
  4750. Available values are:
  4751. @table @samp
  4752. @item auto
  4753. The default libass shaping engine, which is the best available.
  4754. @item simple
  4755. Fast, font-agnostic shaper that can do only substitutions
  4756. @item complex
  4757. Slower shaper using OpenType for substitutions and positioning
  4758. @end table
  4759. The default is @code{auto}.
  4760. @end table
  4761. @section atadenoise
  4762. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4763. The filter accepts the following options:
  4764. @table @option
  4765. @item 0a
  4766. Set threshold A for 1st plane. Default is 0.02.
  4767. Valid range is 0 to 0.3.
  4768. @item 0b
  4769. Set threshold B for 1st plane. Default is 0.04.
  4770. Valid range is 0 to 5.
  4771. @item 1a
  4772. Set threshold A for 2nd plane. Default is 0.02.
  4773. Valid range is 0 to 0.3.
  4774. @item 1b
  4775. Set threshold B for 2nd plane. Default is 0.04.
  4776. Valid range is 0 to 5.
  4777. @item 2a
  4778. Set threshold A for 3rd plane. Default is 0.02.
  4779. Valid range is 0 to 0.3.
  4780. @item 2b
  4781. Set threshold B for 3rd plane. Default is 0.04.
  4782. Valid range is 0 to 5.
  4783. Threshold A is designed to react on abrupt changes in the input signal and
  4784. threshold B is designed to react on continuous changes in the input signal.
  4785. @item s
  4786. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4787. number in range [5, 129].
  4788. @item p
  4789. Set what planes of frame filter will use for averaging. Default is all.
  4790. @end table
  4791. @section avgblur
  4792. Apply average blur filter.
  4793. The filter accepts the following options:
  4794. @table @option
  4795. @item sizeX
  4796. Set horizontal radius size.
  4797. @item planes
  4798. Set which planes to filter. By default all planes are filtered.
  4799. @item sizeY
  4800. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4801. Default is @code{0}.
  4802. @end table
  4803. @subsection Commands
  4804. This filter supports same commands as options.
  4805. The command accepts the same syntax of the corresponding option.
  4806. If the specified expression is not valid, it is kept at its current
  4807. value.
  4808. @section bbox
  4809. Compute the bounding box for the non-black pixels in the input frame
  4810. luminance plane.
  4811. This filter computes the bounding box containing all the pixels with a
  4812. luminance value greater than the minimum allowed value.
  4813. The parameters describing the bounding box are printed on the filter
  4814. log.
  4815. The filter accepts the following option:
  4816. @table @option
  4817. @item min_val
  4818. Set the minimal luminance value. Default is @code{16}.
  4819. @end table
  4820. @section bitplanenoise
  4821. Show and measure bit plane noise.
  4822. The filter accepts the following options:
  4823. @table @option
  4824. @item bitplane
  4825. Set which plane to analyze. Default is @code{1}.
  4826. @item filter
  4827. Filter out noisy pixels from @code{bitplane} set above.
  4828. Default is disabled.
  4829. @end table
  4830. @section blackdetect
  4831. Detect video intervals that are (almost) completely black. Can be
  4832. useful to detect chapter transitions, commercials, or invalid
  4833. recordings. Output lines contains the time for the start, end and
  4834. duration of the detected black interval expressed in seconds.
  4835. In order to display the output lines, you need to set the loglevel at
  4836. least to the AV_LOG_INFO value.
  4837. The filter accepts the following options:
  4838. @table @option
  4839. @item black_min_duration, d
  4840. Set the minimum detected black duration expressed in seconds. It must
  4841. be a non-negative floating point number.
  4842. Default value is 2.0.
  4843. @item picture_black_ratio_th, pic_th
  4844. Set the threshold for considering a picture "black".
  4845. Express the minimum value for the ratio:
  4846. @example
  4847. @var{nb_black_pixels} / @var{nb_pixels}
  4848. @end example
  4849. for which a picture is considered black.
  4850. Default value is 0.98.
  4851. @item pixel_black_th, pix_th
  4852. Set the threshold for considering a pixel "black".
  4853. The threshold expresses the maximum pixel luminance value for which a
  4854. pixel is considered "black". The provided value is scaled according to
  4855. the following equation:
  4856. @example
  4857. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4858. @end example
  4859. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4860. the input video format, the range is [0-255] for YUV full-range
  4861. formats and [16-235] for YUV non full-range formats.
  4862. Default value is 0.10.
  4863. @end table
  4864. The following example sets the maximum pixel threshold to the minimum
  4865. value, and detects only black intervals of 2 or more seconds:
  4866. @example
  4867. blackdetect=d=2:pix_th=0.00
  4868. @end example
  4869. @section blackframe
  4870. Detect frames that are (almost) completely black. Can be useful to
  4871. detect chapter transitions or commercials. Output lines consist of
  4872. the frame number of the detected frame, the percentage of blackness,
  4873. the position in the file if known or -1 and the timestamp in seconds.
  4874. In order to display the output lines, you need to set the loglevel at
  4875. least to the AV_LOG_INFO value.
  4876. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4877. The value represents the percentage of pixels in the picture that
  4878. are below the threshold value.
  4879. It accepts the following parameters:
  4880. @table @option
  4881. @item amount
  4882. The percentage of the pixels that have to be below the threshold; it defaults to
  4883. @code{98}.
  4884. @item threshold, thresh
  4885. The threshold below which a pixel value is considered black; it defaults to
  4886. @code{32}.
  4887. @end table
  4888. @section blend, tblend
  4889. Blend two video frames into each other.
  4890. The @code{blend} filter takes two input streams and outputs one
  4891. stream, the first input is the "top" layer and second input is
  4892. "bottom" layer. By default, the output terminates when the longest input terminates.
  4893. The @code{tblend} (time blend) filter takes two consecutive frames
  4894. from one single stream, and outputs the result obtained by blending
  4895. the new frame on top of the old frame.
  4896. A description of the accepted options follows.
  4897. @table @option
  4898. @item c0_mode
  4899. @item c1_mode
  4900. @item c2_mode
  4901. @item c3_mode
  4902. @item all_mode
  4903. Set blend mode for specific pixel component or all pixel components in case
  4904. of @var{all_mode}. Default value is @code{normal}.
  4905. Available values for component modes are:
  4906. @table @samp
  4907. @item addition
  4908. @item grainmerge
  4909. @item and
  4910. @item average
  4911. @item burn
  4912. @item darken
  4913. @item difference
  4914. @item grainextract
  4915. @item divide
  4916. @item dodge
  4917. @item freeze
  4918. @item exclusion
  4919. @item extremity
  4920. @item glow
  4921. @item hardlight
  4922. @item hardmix
  4923. @item heat
  4924. @item lighten
  4925. @item linearlight
  4926. @item multiply
  4927. @item multiply128
  4928. @item negation
  4929. @item normal
  4930. @item or
  4931. @item overlay
  4932. @item phoenix
  4933. @item pinlight
  4934. @item reflect
  4935. @item screen
  4936. @item softlight
  4937. @item subtract
  4938. @item vividlight
  4939. @item xor
  4940. @end table
  4941. @item c0_opacity
  4942. @item c1_opacity
  4943. @item c2_opacity
  4944. @item c3_opacity
  4945. @item all_opacity
  4946. Set blend opacity for specific pixel component or all pixel components in case
  4947. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4948. @item c0_expr
  4949. @item c1_expr
  4950. @item c2_expr
  4951. @item c3_expr
  4952. @item all_expr
  4953. Set blend expression for specific pixel component or all pixel components in case
  4954. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4955. The expressions can use the following variables:
  4956. @table @option
  4957. @item N
  4958. The sequential number of the filtered frame, starting from @code{0}.
  4959. @item X
  4960. @item Y
  4961. the coordinates of the current sample
  4962. @item W
  4963. @item H
  4964. the width and height of currently filtered plane
  4965. @item SW
  4966. @item SH
  4967. Width and height scale for the plane being filtered. It is the
  4968. ratio between the dimensions of the current plane to the luma plane,
  4969. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4970. the luma plane and @code{0.5,0.5} for the chroma planes.
  4971. @item T
  4972. Time of the current frame, expressed in seconds.
  4973. @item TOP, A
  4974. Value of pixel component at current location for first video frame (top layer).
  4975. @item BOTTOM, B
  4976. Value of pixel component at current location for second video frame (bottom layer).
  4977. @end table
  4978. @end table
  4979. The @code{blend} filter also supports the @ref{framesync} options.
  4980. @subsection Examples
  4981. @itemize
  4982. @item
  4983. Apply transition from bottom layer to top layer in first 10 seconds:
  4984. @example
  4985. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4986. @end example
  4987. @item
  4988. Apply linear horizontal transition from top layer to bottom layer:
  4989. @example
  4990. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4991. @end example
  4992. @item
  4993. Apply 1x1 checkerboard effect:
  4994. @example
  4995. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4996. @end example
  4997. @item
  4998. Apply uncover left effect:
  4999. @example
  5000. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  5001. @end example
  5002. @item
  5003. Apply uncover down effect:
  5004. @example
  5005. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  5006. @end example
  5007. @item
  5008. Apply uncover up-left effect:
  5009. @example
  5010. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5011. @end example
  5012. @item
  5013. Split diagonally video and shows top and bottom layer on each side:
  5014. @example
  5015. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5016. @end example
  5017. @item
  5018. Display differences between the current and the previous frame:
  5019. @example
  5020. tblend=all_mode=grainextract
  5021. @end example
  5022. @end itemize
  5023. @section bm3d
  5024. Denoise frames using Block-Matching 3D algorithm.
  5025. The filter accepts the following options.
  5026. @table @option
  5027. @item sigma
  5028. Set denoising strength. Default value is 1.
  5029. Allowed range is from 0 to 999.9.
  5030. The denoising algorithm is very sensitive to sigma, so adjust it
  5031. according to the source.
  5032. @item block
  5033. Set local patch size. This sets dimensions in 2D.
  5034. @item bstep
  5035. Set sliding step for processing blocks. Default value is 4.
  5036. Allowed range is from 1 to 64.
  5037. Smaller values allows processing more reference blocks and is slower.
  5038. @item group
  5039. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5040. When set to 1, no block matching is done. Larger values allows more blocks
  5041. in single group.
  5042. Allowed range is from 1 to 256.
  5043. @item range
  5044. Set radius for search block matching. Default is 9.
  5045. Allowed range is from 1 to INT32_MAX.
  5046. @item mstep
  5047. Set step between two search locations for block matching. Default is 1.
  5048. Allowed range is from 1 to 64. Smaller is slower.
  5049. @item thmse
  5050. Set threshold of mean square error for block matching. Valid range is 0 to
  5051. INT32_MAX.
  5052. @item hdthr
  5053. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5054. Larger values results in stronger hard-thresholding filtering in frequency
  5055. domain.
  5056. @item estim
  5057. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5058. Default is @code{basic}.
  5059. @item ref
  5060. If enabled, filter will use 2nd stream for block matching.
  5061. Default is disabled for @code{basic} value of @var{estim} option,
  5062. and always enabled if value of @var{estim} is @code{final}.
  5063. @item planes
  5064. Set planes to filter. Default is all available except alpha.
  5065. @end table
  5066. @subsection Examples
  5067. @itemize
  5068. @item
  5069. Basic filtering with bm3d:
  5070. @example
  5071. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5072. @end example
  5073. @item
  5074. Same as above, but filtering only luma:
  5075. @example
  5076. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5077. @end example
  5078. @item
  5079. Same as above, but with both estimation modes:
  5080. @example
  5081. 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
  5082. @end example
  5083. @item
  5084. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5085. @example
  5086. 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
  5087. @end example
  5088. @end itemize
  5089. @section boxblur
  5090. Apply a boxblur algorithm to the input video.
  5091. It accepts the following parameters:
  5092. @table @option
  5093. @item luma_radius, lr
  5094. @item luma_power, lp
  5095. @item chroma_radius, cr
  5096. @item chroma_power, cp
  5097. @item alpha_radius, ar
  5098. @item alpha_power, ap
  5099. @end table
  5100. A description of the accepted options follows.
  5101. @table @option
  5102. @item luma_radius, lr
  5103. @item chroma_radius, cr
  5104. @item alpha_radius, ar
  5105. Set an expression for the box radius in pixels used for blurring the
  5106. corresponding input plane.
  5107. The radius value must be a non-negative number, and must not be
  5108. greater than the value of the expression @code{min(w,h)/2} for the
  5109. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5110. planes.
  5111. Default value for @option{luma_radius} is "2". If not specified,
  5112. @option{chroma_radius} and @option{alpha_radius} default to the
  5113. corresponding value set for @option{luma_radius}.
  5114. The expressions can contain the following constants:
  5115. @table @option
  5116. @item w
  5117. @item h
  5118. The input width and height in pixels.
  5119. @item cw
  5120. @item ch
  5121. The input chroma image width and height in pixels.
  5122. @item hsub
  5123. @item vsub
  5124. The horizontal and vertical chroma subsample values. For example, for the
  5125. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5126. @end table
  5127. @item luma_power, lp
  5128. @item chroma_power, cp
  5129. @item alpha_power, ap
  5130. Specify how many times the boxblur filter is applied to the
  5131. corresponding plane.
  5132. Default value for @option{luma_power} is 2. If not specified,
  5133. @option{chroma_power} and @option{alpha_power} default to the
  5134. corresponding value set for @option{luma_power}.
  5135. A value of 0 will disable the effect.
  5136. @end table
  5137. @subsection Examples
  5138. @itemize
  5139. @item
  5140. Apply a boxblur filter with the luma, chroma, and alpha radii
  5141. set to 2:
  5142. @example
  5143. boxblur=luma_radius=2:luma_power=1
  5144. boxblur=2:1
  5145. @end example
  5146. @item
  5147. Set the luma radius to 2, and alpha and chroma radius to 0:
  5148. @example
  5149. boxblur=2:1:cr=0:ar=0
  5150. @end example
  5151. @item
  5152. Set the luma and chroma radii to a fraction of the video dimension:
  5153. @example
  5154. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5155. @end example
  5156. @end itemize
  5157. @section bwdif
  5158. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5159. Deinterlacing Filter").
  5160. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5161. interpolation algorithms.
  5162. It accepts the following parameters:
  5163. @table @option
  5164. @item mode
  5165. The interlacing mode to adopt. It accepts one of the following values:
  5166. @table @option
  5167. @item 0, send_frame
  5168. Output one frame for each frame.
  5169. @item 1, send_field
  5170. Output one frame for each field.
  5171. @end table
  5172. The default value is @code{send_field}.
  5173. @item parity
  5174. The picture field parity assumed for the input interlaced video. It accepts one
  5175. of the following values:
  5176. @table @option
  5177. @item 0, tff
  5178. Assume the top field is first.
  5179. @item 1, bff
  5180. Assume the bottom field is first.
  5181. @item -1, auto
  5182. Enable automatic detection of field parity.
  5183. @end table
  5184. The default value is @code{auto}.
  5185. If the interlacing is unknown or the decoder does not export this information,
  5186. top field first will be assumed.
  5187. @item deint
  5188. Specify which frames to deinterlace. Accepts one of the following
  5189. values:
  5190. @table @option
  5191. @item 0, all
  5192. Deinterlace all frames.
  5193. @item 1, interlaced
  5194. Only deinterlace frames marked as interlaced.
  5195. @end table
  5196. The default value is @code{all}.
  5197. @end table
  5198. @section chromahold
  5199. Remove all color information for all colors except for certain one.
  5200. The filter accepts the following options:
  5201. @table @option
  5202. @item color
  5203. The color which will not be replaced with neutral chroma.
  5204. @item similarity
  5205. Similarity percentage with the above color.
  5206. 0.01 matches only the exact key color, while 1.0 matches everything.
  5207. @item blend
  5208. Blend percentage.
  5209. 0.0 makes pixels either fully gray, or not gray at all.
  5210. Higher values result in more preserved color.
  5211. @item yuv
  5212. Signals that the color passed is already in YUV instead of RGB.
  5213. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5214. This can be used to pass exact YUV values as hexadecimal numbers.
  5215. @end table
  5216. @section chromakey
  5217. YUV colorspace color/chroma keying.
  5218. The filter accepts the following options:
  5219. @table @option
  5220. @item color
  5221. The color which will be replaced with transparency.
  5222. @item similarity
  5223. Similarity percentage with the key color.
  5224. 0.01 matches only the exact key color, while 1.0 matches everything.
  5225. @item blend
  5226. Blend percentage.
  5227. 0.0 makes pixels either fully transparent, or not transparent at all.
  5228. Higher values result in semi-transparent pixels, with a higher transparency
  5229. the more similar the pixels color is to the key color.
  5230. @item yuv
  5231. Signals that the color passed is already in YUV instead of RGB.
  5232. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5233. This can be used to pass exact YUV values as hexadecimal numbers.
  5234. @end table
  5235. @subsection Examples
  5236. @itemize
  5237. @item
  5238. Make every green pixel in the input image transparent:
  5239. @example
  5240. ffmpeg -i input.png -vf chromakey=green out.png
  5241. @end example
  5242. @item
  5243. Overlay a greenscreen-video on top of a static black background.
  5244. @example
  5245. 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
  5246. @end example
  5247. @end itemize
  5248. @section chromashift
  5249. Shift chroma pixels horizontally and/or vertically.
  5250. The filter accepts the following options:
  5251. @table @option
  5252. @item cbh
  5253. Set amount to shift chroma-blue horizontally.
  5254. @item cbv
  5255. Set amount to shift chroma-blue vertically.
  5256. @item crh
  5257. Set amount to shift chroma-red horizontally.
  5258. @item crv
  5259. Set amount to shift chroma-red vertically.
  5260. @item edge
  5261. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5262. @end table
  5263. @section ciescope
  5264. Display CIE color diagram with pixels overlaid onto it.
  5265. The filter accepts the following options:
  5266. @table @option
  5267. @item system
  5268. Set color system.
  5269. @table @samp
  5270. @item ntsc, 470m
  5271. @item ebu, 470bg
  5272. @item smpte
  5273. @item 240m
  5274. @item apple
  5275. @item widergb
  5276. @item cie1931
  5277. @item rec709, hdtv
  5278. @item uhdtv, rec2020
  5279. @item dcip3
  5280. @end table
  5281. @item cie
  5282. Set CIE system.
  5283. @table @samp
  5284. @item xyy
  5285. @item ucs
  5286. @item luv
  5287. @end table
  5288. @item gamuts
  5289. Set what gamuts to draw.
  5290. See @code{system} option for available values.
  5291. @item size, s
  5292. Set ciescope size, by default set to 512.
  5293. @item intensity, i
  5294. Set intensity used to map input pixel values to CIE diagram.
  5295. @item contrast
  5296. Set contrast used to draw tongue colors that are out of active color system gamut.
  5297. @item corrgamma
  5298. Correct gamma displayed on scope, by default enabled.
  5299. @item showwhite
  5300. Show white point on CIE diagram, by default disabled.
  5301. @item gamma
  5302. Set input gamma. Used only with XYZ input color space.
  5303. @end table
  5304. @section codecview
  5305. Visualize information exported by some codecs.
  5306. Some codecs can export information through frames using side-data or other
  5307. means. For example, some MPEG based codecs export motion vectors through the
  5308. @var{export_mvs} flag in the codec @option{flags2} option.
  5309. The filter accepts the following option:
  5310. @table @option
  5311. @item mv
  5312. Set motion vectors to visualize.
  5313. Available flags for @var{mv} are:
  5314. @table @samp
  5315. @item pf
  5316. forward predicted MVs of P-frames
  5317. @item bf
  5318. forward predicted MVs of B-frames
  5319. @item bb
  5320. backward predicted MVs of B-frames
  5321. @end table
  5322. @item qp
  5323. Display quantization parameters using the chroma planes.
  5324. @item mv_type, mvt
  5325. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5326. Available flags for @var{mv_type} are:
  5327. @table @samp
  5328. @item fp
  5329. forward predicted MVs
  5330. @item bp
  5331. backward predicted MVs
  5332. @end table
  5333. @item frame_type, ft
  5334. Set frame type to visualize motion vectors of.
  5335. Available flags for @var{frame_type} are:
  5336. @table @samp
  5337. @item if
  5338. intra-coded frames (I-frames)
  5339. @item pf
  5340. predicted frames (P-frames)
  5341. @item bf
  5342. bi-directionally predicted frames (B-frames)
  5343. @end table
  5344. @end table
  5345. @subsection Examples
  5346. @itemize
  5347. @item
  5348. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5349. @example
  5350. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5351. @end example
  5352. @item
  5353. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5354. @example
  5355. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5356. @end example
  5357. @end itemize
  5358. @section colorbalance
  5359. Modify intensity of primary colors (red, green and blue) of input frames.
  5360. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5361. regions for the red-cyan, green-magenta or blue-yellow balance.
  5362. A positive adjustment value shifts the balance towards the primary color, a negative
  5363. value towards the complementary color.
  5364. The filter accepts the following options:
  5365. @table @option
  5366. @item rs
  5367. @item gs
  5368. @item bs
  5369. Adjust red, green and blue shadows (darkest pixels).
  5370. @item rm
  5371. @item gm
  5372. @item bm
  5373. Adjust red, green and blue midtones (medium pixels).
  5374. @item rh
  5375. @item gh
  5376. @item bh
  5377. Adjust red, green and blue highlights (brightest pixels).
  5378. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5379. @end table
  5380. @subsection Examples
  5381. @itemize
  5382. @item
  5383. Add red color cast to shadows:
  5384. @example
  5385. colorbalance=rs=.3
  5386. @end example
  5387. @end itemize
  5388. @section colorchannelmixer
  5389. Adjust video input frames by re-mixing color channels.
  5390. This filter modifies a color channel by adding the values associated to
  5391. the other channels of the same pixels. For example if the value to
  5392. modify is red, the output value will be:
  5393. @example
  5394. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5395. @end example
  5396. The filter accepts the following options:
  5397. @table @option
  5398. @item rr
  5399. @item rg
  5400. @item rb
  5401. @item ra
  5402. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5403. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5404. @item gr
  5405. @item gg
  5406. @item gb
  5407. @item ga
  5408. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5409. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5410. @item br
  5411. @item bg
  5412. @item bb
  5413. @item ba
  5414. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5415. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5416. @item ar
  5417. @item ag
  5418. @item ab
  5419. @item aa
  5420. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5421. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5422. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5423. @end table
  5424. @subsection Examples
  5425. @itemize
  5426. @item
  5427. Convert source to grayscale:
  5428. @example
  5429. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5430. @end example
  5431. @item
  5432. Simulate sepia tones:
  5433. @example
  5434. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5435. @end example
  5436. @end itemize
  5437. @section colorkey
  5438. RGB colorspace color keying.
  5439. The filter accepts the following options:
  5440. @table @option
  5441. @item color
  5442. The color which will be replaced with transparency.
  5443. @item similarity
  5444. Similarity percentage with the key color.
  5445. 0.01 matches only the exact key color, while 1.0 matches everything.
  5446. @item blend
  5447. Blend percentage.
  5448. 0.0 makes pixels either fully transparent, or not transparent at all.
  5449. Higher values result in semi-transparent pixels, with a higher transparency
  5450. the more similar the pixels color is to the key color.
  5451. @end table
  5452. @subsection Examples
  5453. @itemize
  5454. @item
  5455. Make every green pixel in the input image transparent:
  5456. @example
  5457. ffmpeg -i input.png -vf colorkey=green out.png
  5458. @end example
  5459. @item
  5460. Overlay a greenscreen-video on top of a static background image.
  5461. @example
  5462. 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
  5463. @end example
  5464. @end itemize
  5465. @section colorhold
  5466. Remove all color information for all RGB colors except for certain one.
  5467. The filter accepts the following options:
  5468. @table @option
  5469. @item color
  5470. The color which will not be replaced with neutral gray.
  5471. @item similarity
  5472. Similarity percentage with the above color.
  5473. 0.01 matches only the exact key color, while 1.0 matches everything.
  5474. @item blend
  5475. Blend percentage. 0.0 makes pixels fully gray.
  5476. Higher values result in more preserved color.
  5477. @end table
  5478. @section colorlevels
  5479. Adjust video input frames using levels.
  5480. The filter accepts the following options:
  5481. @table @option
  5482. @item rimin
  5483. @item gimin
  5484. @item bimin
  5485. @item aimin
  5486. Adjust red, green, blue and alpha input black point.
  5487. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5488. @item rimax
  5489. @item gimax
  5490. @item bimax
  5491. @item aimax
  5492. Adjust red, green, blue and alpha input white point.
  5493. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5494. Input levels are used to lighten highlights (bright tones), darken shadows
  5495. (dark tones), change the balance of bright and dark tones.
  5496. @item romin
  5497. @item gomin
  5498. @item bomin
  5499. @item aomin
  5500. Adjust red, green, blue and alpha output black point.
  5501. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5502. @item romax
  5503. @item gomax
  5504. @item bomax
  5505. @item aomax
  5506. Adjust red, green, blue and alpha output white point.
  5507. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5508. Output levels allows manual selection of a constrained output level range.
  5509. @end table
  5510. @subsection Examples
  5511. @itemize
  5512. @item
  5513. Make video output darker:
  5514. @example
  5515. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5516. @end example
  5517. @item
  5518. Increase contrast:
  5519. @example
  5520. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5521. @end example
  5522. @item
  5523. Make video output lighter:
  5524. @example
  5525. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5526. @end example
  5527. @item
  5528. Increase brightness:
  5529. @example
  5530. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5531. @end example
  5532. @end itemize
  5533. @section colormatrix
  5534. Convert color matrix.
  5535. The filter accepts the following options:
  5536. @table @option
  5537. @item src
  5538. @item dst
  5539. Specify the source and destination color matrix. Both values must be
  5540. specified.
  5541. The accepted values are:
  5542. @table @samp
  5543. @item bt709
  5544. BT.709
  5545. @item fcc
  5546. FCC
  5547. @item bt601
  5548. BT.601
  5549. @item bt470
  5550. BT.470
  5551. @item bt470bg
  5552. BT.470BG
  5553. @item smpte170m
  5554. SMPTE-170M
  5555. @item smpte240m
  5556. SMPTE-240M
  5557. @item bt2020
  5558. BT.2020
  5559. @end table
  5560. @end table
  5561. For example to convert from BT.601 to SMPTE-240M, use the command:
  5562. @example
  5563. colormatrix=bt601:smpte240m
  5564. @end example
  5565. @section colorspace
  5566. Convert colorspace, transfer characteristics or color primaries.
  5567. Input video needs to have an even size.
  5568. The filter accepts the following options:
  5569. @table @option
  5570. @anchor{all}
  5571. @item all
  5572. Specify all color properties at once.
  5573. The accepted values are:
  5574. @table @samp
  5575. @item bt470m
  5576. BT.470M
  5577. @item bt470bg
  5578. BT.470BG
  5579. @item bt601-6-525
  5580. BT.601-6 525
  5581. @item bt601-6-625
  5582. BT.601-6 625
  5583. @item bt709
  5584. BT.709
  5585. @item smpte170m
  5586. SMPTE-170M
  5587. @item smpte240m
  5588. SMPTE-240M
  5589. @item bt2020
  5590. BT.2020
  5591. @end table
  5592. @anchor{space}
  5593. @item space
  5594. Specify output colorspace.
  5595. The accepted values are:
  5596. @table @samp
  5597. @item bt709
  5598. BT.709
  5599. @item fcc
  5600. FCC
  5601. @item bt470bg
  5602. BT.470BG or BT.601-6 625
  5603. @item smpte170m
  5604. SMPTE-170M or BT.601-6 525
  5605. @item smpte240m
  5606. SMPTE-240M
  5607. @item ycgco
  5608. YCgCo
  5609. @item bt2020ncl
  5610. BT.2020 with non-constant luminance
  5611. @end table
  5612. @anchor{trc}
  5613. @item trc
  5614. Specify output transfer characteristics.
  5615. The accepted values are:
  5616. @table @samp
  5617. @item bt709
  5618. BT.709
  5619. @item bt470m
  5620. BT.470M
  5621. @item bt470bg
  5622. BT.470BG
  5623. @item gamma22
  5624. Constant gamma of 2.2
  5625. @item gamma28
  5626. Constant gamma of 2.8
  5627. @item smpte170m
  5628. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5629. @item smpte240m
  5630. SMPTE-240M
  5631. @item srgb
  5632. SRGB
  5633. @item iec61966-2-1
  5634. iec61966-2-1
  5635. @item iec61966-2-4
  5636. iec61966-2-4
  5637. @item xvycc
  5638. xvycc
  5639. @item bt2020-10
  5640. BT.2020 for 10-bits content
  5641. @item bt2020-12
  5642. BT.2020 for 12-bits content
  5643. @end table
  5644. @anchor{primaries}
  5645. @item primaries
  5646. Specify output color primaries.
  5647. The accepted values are:
  5648. @table @samp
  5649. @item bt709
  5650. BT.709
  5651. @item bt470m
  5652. BT.470M
  5653. @item bt470bg
  5654. BT.470BG or BT.601-6 625
  5655. @item smpte170m
  5656. SMPTE-170M or BT.601-6 525
  5657. @item smpte240m
  5658. SMPTE-240M
  5659. @item film
  5660. film
  5661. @item smpte431
  5662. SMPTE-431
  5663. @item smpte432
  5664. SMPTE-432
  5665. @item bt2020
  5666. BT.2020
  5667. @item jedec-p22
  5668. JEDEC P22 phosphors
  5669. @end table
  5670. @anchor{range}
  5671. @item range
  5672. Specify output color range.
  5673. The accepted values are:
  5674. @table @samp
  5675. @item tv
  5676. TV (restricted) range
  5677. @item mpeg
  5678. MPEG (restricted) range
  5679. @item pc
  5680. PC (full) range
  5681. @item jpeg
  5682. JPEG (full) range
  5683. @end table
  5684. @item format
  5685. Specify output color format.
  5686. The accepted values are:
  5687. @table @samp
  5688. @item yuv420p
  5689. YUV 4:2:0 planar 8-bits
  5690. @item yuv420p10
  5691. YUV 4:2:0 planar 10-bits
  5692. @item yuv420p12
  5693. YUV 4:2:0 planar 12-bits
  5694. @item yuv422p
  5695. YUV 4:2:2 planar 8-bits
  5696. @item yuv422p10
  5697. YUV 4:2:2 planar 10-bits
  5698. @item yuv422p12
  5699. YUV 4:2:2 planar 12-bits
  5700. @item yuv444p
  5701. YUV 4:4:4 planar 8-bits
  5702. @item yuv444p10
  5703. YUV 4:4:4 planar 10-bits
  5704. @item yuv444p12
  5705. YUV 4:4:4 planar 12-bits
  5706. @end table
  5707. @item fast
  5708. Do a fast conversion, which skips gamma/primary correction. This will take
  5709. significantly less CPU, but will be mathematically incorrect. To get output
  5710. compatible with that produced by the colormatrix filter, use fast=1.
  5711. @item dither
  5712. Specify dithering mode.
  5713. The accepted values are:
  5714. @table @samp
  5715. @item none
  5716. No dithering
  5717. @item fsb
  5718. Floyd-Steinberg dithering
  5719. @end table
  5720. @item wpadapt
  5721. Whitepoint adaptation mode.
  5722. The accepted values are:
  5723. @table @samp
  5724. @item bradford
  5725. Bradford whitepoint adaptation
  5726. @item vonkries
  5727. von Kries whitepoint adaptation
  5728. @item identity
  5729. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5730. @end table
  5731. @item iall
  5732. Override all input properties at once. Same accepted values as @ref{all}.
  5733. @item ispace
  5734. Override input colorspace. Same accepted values as @ref{space}.
  5735. @item iprimaries
  5736. Override input color primaries. Same accepted values as @ref{primaries}.
  5737. @item itrc
  5738. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5739. @item irange
  5740. Override input color range. Same accepted values as @ref{range}.
  5741. @end table
  5742. The filter converts the transfer characteristics, color space and color
  5743. primaries to the specified user values. The output value, if not specified,
  5744. is set to a default value based on the "all" property. If that property is
  5745. also not specified, the filter will log an error. The output color range and
  5746. format default to the same value as the input color range and format. The
  5747. input transfer characteristics, color space, color primaries and color range
  5748. should be set on the input data. If any of these are missing, the filter will
  5749. log an error and no conversion will take place.
  5750. For example to convert the input to SMPTE-240M, use the command:
  5751. @example
  5752. colorspace=smpte240m
  5753. @end example
  5754. @section convolution
  5755. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5756. The filter accepts the following options:
  5757. @table @option
  5758. @item 0m
  5759. @item 1m
  5760. @item 2m
  5761. @item 3m
  5762. Set matrix for each plane.
  5763. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5764. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5765. @item 0rdiv
  5766. @item 1rdiv
  5767. @item 2rdiv
  5768. @item 3rdiv
  5769. Set multiplier for calculated value for each plane.
  5770. If unset or 0, it will be sum of all matrix elements.
  5771. @item 0bias
  5772. @item 1bias
  5773. @item 2bias
  5774. @item 3bias
  5775. Set bias for each plane. This value is added to the result of the multiplication.
  5776. Useful for making the overall image brighter or darker. Default is 0.0.
  5777. @item 0mode
  5778. @item 1mode
  5779. @item 2mode
  5780. @item 3mode
  5781. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5782. Default is @var{square}.
  5783. @end table
  5784. @subsection Examples
  5785. @itemize
  5786. @item
  5787. Apply sharpen:
  5788. @example
  5789. 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"
  5790. @end example
  5791. @item
  5792. Apply blur:
  5793. @example
  5794. 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"
  5795. @end example
  5796. @item
  5797. Apply edge enhance:
  5798. @example
  5799. 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"
  5800. @end example
  5801. @item
  5802. Apply edge detect:
  5803. @example
  5804. 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"
  5805. @end example
  5806. @item
  5807. Apply laplacian edge detector which includes diagonals:
  5808. @example
  5809. 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"
  5810. @end example
  5811. @item
  5812. Apply emboss:
  5813. @example
  5814. 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"
  5815. @end example
  5816. @end itemize
  5817. @section convolve
  5818. Apply 2D convolution of video stream in frequency domain using second stream
  5819. as impulse.
  5820. The filter accepts the following options:
  5821. @table @option
  5822. @item planes
  5823. Set which planes to process.
  5824. @item impulse
  5825. Set which impulse video frames will be processed, can be @var{first}
  5826. or @var{all}. Default is @var{all}.
  5827. @end table
  5828. The @code{convolve} filter also supports the @ref{framesync} options.
  5829. @section copy
  5830. Copy the input video source unchanged to the output. This is mainly useful for
  5831. testing purposes.
  5832. @anchor{coreimage}
  5833. @section coreimage
  5834. Video filtering on GPU using Apple's CoreImage API on OSX.
  5835. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5836. processed by video hardware. However, software-based OpenGL implementations
  5837. exist which means there is no guarantee for hardware processing. It depends on
  5838. the respective OSX.
  5839. There are many filters and image generators provided by Apple that come with a
  5840. large variety of options. The filter has to be referenced by its name along
  5841. with its options.
  5842. The coreimage filter accepts the following options:
  5843. @table @option
  5844. @item list_filters
  5845. List all available filters and generators along with all their respective
  5846. options as well as possible minimum and maximum values along with the default
  5847. values.
  5848. @example
  5849. list_filters=true
  5850. @end example
  5851. @item filter
  5852. Specify all filters by their respective name and options.
  5853. Use @var{list_filters} to determine all valid filter names and options.
  5854. Numerical options are specified by a float value and are automatically clamped
  5855. to their respective value range. Vector and color options have to be specified
  5856. by a list of space separated float values. Character escaping has to be done.
  5857. A special option name @code{default} is available to use default options for a
  5858. filter.
  5859. It is required to specify either @code{default} or at least one of the filter options.
  5860. All omitted options are used with their default values.
  5861. The syntax of the filter string is as follows:
  5862. @example
  5863. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5864. @end example
  5865. @item output_rect
  5866. Specify a rectangle where the output of the filter chain is copied into the
  5867. input image. It is given by a list of space separated float values:
  5868. @example
  5869. output_rect=x\ y\ width\ height
  5870. @end example
  5871. If not given, the output rectangle equals the dimensions of the input image.
  5872. The output rectangle is automatically cropped at the borders of the input
  5873. image. Negative values are valid for each component.
  5874. @example
  5875. output_rect=25\ 25\ 100\ 100
  5876. @end example
  5877. @end table
  5878. Several filters can be chained for successive processing without GPU-HOST
  5879. transfers allowing for fast processing of complex filter chains.
  5880. Currently, only filters with zero (generators) or exactly one (filters) input
  5881. image and one output image are supported. Also, transition filters are not yet
  5882. usable as intended.
  5883. Some filters generate output images with additional padding depending on the
  5884. respective filter kernel. The padding is automatically removed to ensure the
  5885. filter output has the same size as the input image.
  5886. For image generators, the size of the output image is determined by the
  5887. previous output image of the filter chain or the input image of the whole
  5888. filterchain, respectively. The generators do not use the pixel information of
  5889. this image to generate their output. However, the generated output is
  5890. blended onto this image, resulting in partial or complete coverage of the
  5891. output image.
  5892. The @ref{coreimagesrc} video source can be used for generating input images
  5893. which are directly fed into the filter chain. By using it, providing input
  5894. images by another video source or an input video is not required.
  5895. @subsection Examples
  5896. @itemize
  5897. @item
  5898. List all filters available:
  5899. @example
  5900. coreimage=list_filters=true
  5901. @end example
  5902. @item
  5903. Use the CIBoxBlur filter with default options to blur an image:
  5904. @example
  5905. coreimage=filter=CIBoxBlur@@default
  5906. @end example
  5907. @item
  5908. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5909. its center at 100x100 and a radius of 50 pixels:
  5910. @example
  5911. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5912. @end example
  5913. @item
  5914. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5915. given as complete and escaped command-line for Apple's standard bash shell:
  5916. @example
  5917. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5918. @end example
  5919. @end itemize
  5920. @section cover_rect
  5921. Cover a rectangular object
  5922. It accepts the following options:
  5923. @table @option
  5924. @item cover
  5925. Filepath of the optional cover image, needs to be in yuv420.
  5926. @item mode
  5927. Set covering mode.
  5928. It accepts the following values:
  5929. @table @samp
  5930. @item cover
  5931. cover it by the supplied image
  5932. @item blur
  5933. cover it by interpolating the surrounding pixels
  5934. @end table
  5935. Default value is @var{blur}.
  5936. @end table
  5937. @subsection Examples
  5938. @itemize
  5939. @item
  5940. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  5941. @example
  5942. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  5943. @end example
  5944. @end itemize
  5945. @section crop
  5946. Crop the input video to given dimensions.
  5947. It accepts the following parameters:
  5948. @table @option
  5949. @item w, out_w
  5950. The width of the output video. It defaults to @code{iw}.
  5951. This expression is evaluated only once during the filter
  5952. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5953. @item h, out_h
  5954. The height of the output video. It defaults to @code{ih}.
  5955. This expression is evaluated only once during the filter
  5956. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5957. @item x
  5958. The horizontal position, in the input video, of the left edge of the output
  5959. video. It defaults to @code{(in_w-out_w)/2}.
  5960. This expression is evaluated per-frame.
  5961. @item y
  5962. The vertical position, in the input video, of the top edge of the output video.
  5963. It defaults to @code{(in_h-out_h)/2}.
  5964. This expression is evaluated per-frame.
  5965. @item keep_aspect
  5966. If set to 1 will force the output display aspect ratio
  5967. to be the same of the input, by changing the output sample aspect
  5968. ratio. It defaults to 0.
  5969. @item exact
  5970. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5971. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5972. It defaults to 0.
  5973. @end table
  5974. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5975. expressions containing the following constants:
  5976. @table @option
  5977. @item x
  5978. @item y
  5979. The computed values for @var{x} and @var{y}. They are evaluated for
  5980. each new frame.
  5981. @item in_w
  5982. @item in_h
  5983. The input width and height.
  5984. @item iw
  5985. @item ih
  5986. These are the same as @var{in_w} and @var{in_h}.
  5987. @item out_w
  5988. @item out_h
  5989. The output (cropped) width and height.
  5990. @item ow
  5991. @item oh
  5992. These are the same as @var{out_w} and @var{out_h}.
  5993. @item a
  5994. same as @var{iw} / @var{ih}
  5995. @item sar
  5996. input sample aspect ratio
  5997. @item dar
  5998. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5999. @item hsub
  6000. @item vsub
  6001. horizontal and vertical chroma subsample values. For example for the
  6002. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6003. @item n
  6004. The number of the input frame, starting from 0.
  6005. @item pos
  6006. the position in the file of the input frame, NAN if unknown
  6007. @item t
  6008. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6009. @end table
  6010. The expression for @var{out_w} may depend on the value of @var{out_h},
  6011. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6012. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6013. evaluated after @var{out_w} and @var{out_h}.
  6014. The @var{x} and @var{y} parameters specify the expressions for the
  6015. position of the top-left corner of the output (non-cropped) area. They
  6016. are evaluated for each frame. If the evaluated value is not valid, it
  6017. is approximated to the nearest valid value.
  6018. The expression for @var{x} may depend on @var{y}, and the expression
  6019. for @var{y} may depend on @var{x}.
  6020. @subsection Examples
  6021. @itemize
  6022. @item
  6023. Crop area with size 100x100 at position (12,34).
  6024. @example
  6025. crop=100:100:12:34
  6026. @end example
  6027. Using named options, the example above becomes:
  6028. @example
  6029. crop=w=100:h=100:x=12:y=34
  6030. @end example
  6031. @item
  6032. Crop the central input area with size 100x100:
  6033. @example
  6034. crop=100:100
  6035. @end example
  6036. @item
  6037. Crop the central input area with size 2/3 of the input video:
  6038. @example
  6039. crop=2/3*in_w:2/3*in_h
  6040. @end example
  6041. @item
  6042. Crop the input video central square:
  6043. @example
  6044. crop=out_w=in_h
  6045. crop=in_h
  6046. @end example
  6047. @item
  6048. Delimit the rectangle with the top-left corner placed at position
  6049. 100:100 and the right-bottom corner corresponding to the right-bottom
  6050. corner of the input image.
  6051. @example
  6052. crop=in_w-100:in_h-100:100:100
  6053. @end example
  6054. @item
  6055. Crop 10 pixels from the left and right borders, and 20 pixels from
  6056. the top and bottom borders
  6057. @example
  6058. crop=in_w-2*10:in_h-2*20
  6059. @end example
  6060. @item
  6061. Keep only the bottom right quarter of the input image:
  6062. @example
  6063. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6064. @end example
  6065. @item
  6066. Crop height for getting Greek harmony:
  6067. @example
  6068. crop=in_w:1/PHI*in_w
  6069. @end example
  6070. @item
  6071. Apply trembling effect:
  6072. @example
  6073. 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)
  6074. @end example
  6075. @item
  6076. Apply erratic camera effect depending on timestamp:
  6077. @example
  6078. 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)"
  6079. @end example
  6080. @item
  6081. Set x depending on the value of y:
  6082. @example
  6083. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6084. @end example
  6085. @end itemize
  6086. @subsection Commands
  6087. This filter supports the following commands:
  6088. @table @option
  6089. @item w, out_w
  6090. @item h, out_h
  6091. @item x
  6092. @item y
  6093. Set width/height of the output video and the horizontal/vertical position
  6094. in the input video.
  6095. The command accepts the same syntax of the corresponding option.
  6096. If the specified expression is not valid, it is kept at its current
  6097. value.
  6098. @end table
  6099. @section cropdetect
  6100. Auto-detect the crop size.
  6101. It calculates the necessary cropping parameters and prints the
  6102. recommended parameters via the logging system. The detected dimensions
  6103. correspond to the non-black area of the input video.
  6104. It accepts the following parameters:
  6105. @table @option
  6106. @item limit
  6107. Set higher black value threshold, which can be optionally specified
  6108. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6109. value greater to the set value is considered non-black. It defaults to 24.
  6110. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6111. on the bitdepth of the pixel format.
  6112. @item round
  6113. The value which the width/height should be divisible by. It defaults to
  6114. 16. The offset is automatically adjusted to center the video. Use 2 to
  6115. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6116. encoding to most video codecs.
  6117. @item reset_count, reset
  6118. Set the counter that determines after how many frames cropdetect will
  6119. reset the previously detected largest video area and start over to
  6120. detect the current optimal crop area. Default value is 0.
  6121. This can be useful when channel logos distort the video area. 0
  6122. indicates 'never reset', and returns the largest area encountered during
  6123. playback.
  6124. @end table
  6125. @anchor{cue}
  6126. @section cue
  6127. Delay video filtering until a given wallclock timestamp. The filter first
  6128. passes on @option{preroll} amount of frames, then it buffers at most
  6129. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6130. it forwards the buffered frames and also any subsequent frames coming in its
  6131. input.
  6132. The filter can be used synchronize the output of multiple ffmpeg processes for
  6133. realtime output devices like decklink. By putting the delay in the filtering
  6134. chain and pre-buffering frames the process can pass on data to output almost
  6135. immediately after the target wallclock timestamp is reached.
  6136. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6137. some use cases.
  6138. @table @option
  6139. @item cue
  6140. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6141. @item preroll
  6142. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6143. @item buffer
  6144. The maximum duration of content to buffer before waiting for the cue expressed
  6145. in seconds. Default is 0.
  6146. @end table
  6147. @anchor{curves}
  6148. @section curves
  6149. Apply color adjustments using curves.
  6150. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6151. component (red, green and blue) has its values defined by @var{N} key points
  6152. tied from each other using a smooth curve. The x-axis represents the pixel
  6153. values from the input frame, and the y-axis the new pixel values to be set for
  6154. the output frame.
  6155. By default, a component curve is defined by the two points @var{(0;0)} and
  6156. @var{(1;1)}. This creates a straight line where each original pixel value is
  6157. "adjusted" to its own value, which means no change to the image.
  6158. The filter allows you to redefine these two points and add some more. A new
  6159. curve (using a natural cubic spline interpolation) will be define to pass
  6160. smoothly through all these new coordinates. The new defined points needs to be
  6161. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6162. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6163. the vector spaces, the values will be clipped accordingly.
  6164. The filter accepts the following options:
  6165. @table @option
  6166. @item preset
  6167. Select one of the available color presets. This option can be used in addition
  6168. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6169. options takes priority on the preset values.
  6170. Available presets are:
  6171. @table @samp
  6172. @item none
  6173. @item color_negative
  6174. @item cross_process
  6175. @item darker
  6176. @item increase_contrast
  6177. @item lighter
  6178. @item linear_contrast
  6179. @item medium_contrast
  6180. @item negative
  6181. @item strong_contrast
  6182. @item vintage
  6183. @end table
  6184. Default is @code{none}.
  6185. @item master, m
  6186. Set the master key points. These points will define a second pass mapping. It
  6187. is sometimes called a "luminance" or "value" mapping. It can be used with
  6188. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6189. post-processing LUT.
  6190. @item red, r
  6191. Set the key points for the red component.
  6192. @item green, g
  6193. Set the key points for the green component.
  6194. @item blue, b
  6195. Set the key points for the blue component.
  6196. @item all
  6197. Set the key points for all components (not including master).
  6198. Can be used in addition to the other key points component
  6199. options. In this case, the unset component(s) will fallback on this
  6200. @option{all} setting.
  6201. @item psfile
  6202. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6203. @item plot
  6204. Save Gnuplot script of the curves in specified file.
  6205. @end table
  6206. To avoid some filtergraph syntax conflicts, each key points list need to be
  6207. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6208. @subsection Examples
  6209. @itemize
  6210. @item
  6211. Increase slightly the middle level of blue:
  6212. @example
  6213. curves=blue='0/0 0.5/0.58 1/1'
  6214. @end example
  6215. @item
  6216. Vintage effect:
  6217. @example
  6218. 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'
  6219. @end example
  6220. Here we obtain the following coordinates for each components:
  6221. @table @var
  6222. @item red
  6223. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6224. @item green
  6225. @code{(0;0) (0.50;0.48) (1;1)}
  6226. @item blue
  6227. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6228. @end table
  6229. @item
  6230. The previous example can also be achieved with the associated built-in preset:
  6231. @example
  6232. curves=preset=vintage
  6233. @end example
  6234. @item
  6235. Or simply:
  6236. @example
  6237. curves=vintage
  6238. @end example
  6239. @item
  6240. Use a Photoshop preset and redefine the points of the green component:
  6241. @example
  6242. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6243. @end example
  6244. @item
  6245. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6246. and @command{gnuplot}:
  6247. @example
  6248. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6249. gnuplot -p /tmp/curves.plt
  6250. @end example
  6251. @end itemize
  6252. @section datascope
  6253. Video data analysis filter.
  6254. This filter shows hexadecimal pixel values of part of video.
  6255. The filter accepts the following options:
  6256. @table @option
  6257. @item size, s
  6258. Set output video size.
  6259. @item x
  6260. Set x offset from where to pick pixels.
  6261. @item y
  6262. Set y offset from where to pick pixels.
  6263. @item mode
  6264. Set scope mode, can be one of the following:
  6265. @table @samp
  6266. @item mono
  6267. Draw hexadecimal pixel values with white color on black background.
  6268. @item color
  6269. Draw hexadecimal pixel values with input video pixel color on black
  6270. background.
  6271. @item color2
  6272. Draw hexadecimal pixel values on color background picked from input video,
  6273. the text color is picked in such way so its always visible.
  6274. @end table
  6275. @item axis
  6276. Draw rows and columns numbers on left and top of video.
  6277. @item opacity
  6278. Set background opacity.
  6279. @end table
  6280. @section dctdnoiz
  6281. Denoise frames using 2D DCT (frequency domain filtering).
  6282. This filter is not designed for real time.
  6283. The filter accepts the following options:
  6284. @table @option
  6285. @item sigma, s
  6286. Set the noise sigma constant.
  6287. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6288. coefficient (absolute value) below this threshold with be dropped.
  6289. If you need a more advanced filtering, see @option{expr}.
  6290. Default is @code{0}.
  6291. @item overlap
  6292. Set number overlapping pixels for each block. Since the filter can be slow, you
  6293. may want to reduce this value, at the cost of a less effective filter and the
  6294. risk of various artefacts.
  6295. If the overlapping value doesn't permit processing the whole input width or
  6296. height, a warning will be displayed and according borders won't be denoised.
  6297. Default value is @var{blocksize}-1, which is the best possible setting.
  6298. @item expr, e
  6299. Set the coefficient factor expression.
  6300. For each coefficient of a DCT block, this expression will be evaluated as a
  6301. multiplier value for the coefficient.
  6302. If this is option is set, the @option{sigma} option will be ignored.
  6303. The absolute value of the coefficient can be accessed through the @var{c}
  6304. variable.
  6305. @item n
  6306. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6307. @var{blocksize}, which is the width and height of the processed blocks.
  6308. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6309. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6310. on the speed processing. Also, a larger block size does not necessarily means a
  6311. better de-noising.
  6312. @end table
  6313. @subsection Examples
  6314. Apply a denoise with a @option{sigma} of @code{4.5}:
  6315. @example
  6316. dctdnoiz=4.5
  6317. @end example
  6318. The same operation can be achieved using the expression system:
  6319. @example
  6320. dctdnoiz=e='gte(c, 4.5*3)'
  6321. @end example
  6322. Violent denoise using a block size of @code{16x16}:
  6323. @example
  6324. dctdnoiz=15:n=4
  6325. @end example
  6326. @section deband
  6327. Remove banding artifacts from input video.
  6328. It works by replacing banded pixels with average value of referenced pixels.
  6329. The filter accepts the following options:
  6330. @table @option
  6331. @item 1thr
  6332. @item 2thr
  6333. @item 3thr
  6334. @item 4thr
  6335. Set banding detection threshold for each plane. Default is 0.02.
  6336. Valid range is 0.00003 to 0.5.
  6337. If difference between current pixel and reference pixel is less than threshold,
  6338. it will be considered as banded.
  6339. @item range, r
  6340. Banding detection range in pixels. Default is 16. If positive, random number
  6341. in range 0 to set value will be used. If negative, exact absolute value
  6342. will be used.
  6343. The range defines square of four pixels around current pixel.
  6344. @item direction, d
  6345. Set direction in radians from which four pixel will be compared. If positive,
  6346. random direction from 0 to set direction will be picked. If negative, exact of
  6347. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6348. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6349. column.
  6350. @item blur, b
  6351. If enabled, current pixel is compared with average value of all four
  6352. surrounding pixels. The default is enabled. If disabled current pixel is
  6353. compared with all four surrounding pixels. The pixel is considered banded
  6354. if only all four differences with surrounding pixels are less than threshold.
  6355. @item coupling, c
  6356. If enabled, current pixel is changed if and only if all pixel components are banded,
  6357. e.g. banding detection threshold is triggered for all color components.
  6358. The default is disabled.
  6359. @end table
  6360. @section deblock
  6361. Remove blocking artifacts from input video.
  6362. The filter accepts the following options:
  6363. @table @option
  6364. @item filter
  6365. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6366. This controls what kind of deblocking is applied.
  6367. @item block
  6368. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6369. @item alpha
  6370. @item beta
  6371. @item gamma
  6372. @item delta
  6373. Set blocking detection thresholds. Allowed range is 0 to 1.
  6374. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6375. Using higher threshold gives more deblocking strength.
  6376. Setting @var{alpha} controls threshold detection at exact edge of block.
  6377. Remaining options controls threshold detection near the edge. Each one for
  6378. below/above or left/right. Setting any of those to @var{0} disables
  6379. deblocking.
  6380. @item planes
  6381. Set planes to filter. Default is to filter all available planes.
  6382. @end table
  6383. @subsection Examples
  6384. @itemize
  6385. @item
  6386. Deblock using weak filter and block size of 4 pixels.
  6387. @example
  6388. deblock=filter=weak:block=4
  6389. @end example
  6390. @item
  6391. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6392. deblocking more edges.
  6393. @example
  6394. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6395. @end example
  6396. @item
  6397. Similar as above, but filter only first plane.
  6398. @example
  6399. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6400. @end example
  6401. @item
  6402. Similar as above, but filter only second and third plane.
  6403. @example
  6404. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6405. @end example
  6406. @end itemize
  6407. @anchor{decimate}
  6408. @section decimate
  6409. Drop duplicated frames at regular intervals.
  6410. The filter accepts the following options:
  6411. @table @option
  6412. @item cycle
  6413. Set the number of frames from which one will be dropped. Setting this to
  6414. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6415. Default is @code{5}.
  6416. @item dupthresh
  6417. Set the threshold for duplicate detection. If the difference metric for a frame
  6418. is less than or equal to this value, then it is declared as duplicate. Default
  6419. is @code{1.1}
  6420. @item scthresh
  6421. Set scene change threshold. Default is @code{15}.
  6422. @item blockx
  6423. @item blocky
  6424. Set the size of the x and y-axis blocks used during metric calculations.
  6425. Larger blocks give better noise suppression, but also give worse detection of
  6426. small movements. Must be a power of two. Default is @code{32}.
  6427. @item ppsrc
  6428. Mark main input as a pre-processed input and activate clean source input
  6429. stream. This allows the input to be pre-processed with various filters to help
  6430. the metrics calculation while keeping the frame selection lossless. When set to
  6431. @code{1}, the first stream is for the pre-processed input, and the second
  6432. stream is the clean source from where the kept frames are chosen. Default is
  6433. @code{0}.
  6434. @item chroma
  6435. Set whether or not chroma is considered in the metric calculations. Default is
  6436. @code{1}.
  6437. @end table
  6438. @section deconvolve
  6439. Apply 2D deconvolution of video stream in frequency domain using second stream
  6440. as impulse.
  6441. The filter accepts the following options:
  6442. @table @option
  6443. @item planes
  6444. Set which planes to process.
  6445. @item impulse
  6446. Set which impulse video frames will be processed, can be @var{first}
  6447. or @var{all}. Default is @var{all}.
  6448. @item noise
  6449. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6450. and height are not same and not power of 2 or if stream prior to convolving
  6451. had noise.
  6452. @end table
  6453. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6454. @section dedot
  6455. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6456. It accepts the following options:
  6457. @table @option
  6458. @item m
  6459. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6460. @var{rainbows} for cross-color reduction.
  6461. @item lt
  6462. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6463. @item tl
  6464. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6465. @item tc
  6466. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6467. @item ct
  6468. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6469. @end table
  6470. @section deflate
  6471. Apply deflate effect to the video.
  6472. This filter replaces the pixel by the local(3x3) average by taking into account
  6473. only values lower than the pixel.
  6474. It accepts the following options:
  6475. @table @option
  6476. @item threshold0
  6477. @item threshold1
  6478. @item threshold2
  6479. @item threshold3
  6480. Limit the maximum change for each plane, default is 65535.
  6481. If 0, plane will remain unchanged.
  6482. @end table
  6483. @section deflicker
  6484. Remove temporal frame luminance variations.
  6485. It accepts the following options:
  6486. @table @option
  6487. @item size, s
  6488. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6489. @item mode, m
  6490. Set averaging mode to smooth temporal luminance variations.
  6491. Available values are:
  6492. @table @samp
  6493. @item am
  6494. Arithmetic mean
  6495. @item gm
  6496. Geometric mean
  6497. @item hm
  6498. Harmonic mean
  6499. @item qm
  6500. Quadratic mean
  6501. @item cm
  6502. Cubic mean
  6503. @item pm
  6504. Power mean
  6505. @item median
  6506. Median
  6507. @end table
  6508. @item bypass
  6509. Do not actually modify frame. Useful when one only wants metadata.
  6510. @end table
  6511. @section dejudder
  6512. Remove judder produced by partially interlaced telecined content.
  6513. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6514. source was partially telecined content then the output of @code{pullup,dejudder}
  6515. will have a variable frame rate. May change the recorded frame rate of the
  6516. container. Aside from that change, this filter will not affect constant frame
  6517. rate video.
  6518. The option available in this filter is:
  6519. @table @option
  6520. @item cycle
  6521. Specify the length of the window over which the judder repeats.
  6522. Accepts any integer greater than 1. Useful values are:
  6523. @table @samp
  6524. @item 4
  6525. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6526. @item 5
  6527. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6528. @item 20
  6529. If a mixture of the two.
  6530. @end table
  6531. The default is @samp{4}.
  6532. @end table
  6533. @section delogo
  6534. Suppress a TV station logo by a simple interpolation of the surrounding
  6535. pixels. Just set a rectangle covering the logo and watch it disappear
  6536. (and sometimes something even uglier appear - your mileage may vary).
  6537. It accepts the following parameters:
  6538. @table @option
  6539. @item x
  6540. @item y
  6541. Specify the top left corner coordinates of the logo. They must be
  6542. specified.
  6543. @item w
  6544. @item h
  6545. Specify the width and height of the logo to clear. They must be
  6546. specified.
  6547. @item band, t
  6548. Specify the thickness of the fuzzy edge of the rectangle (added to
  6549. @var{w} and @var{h}). The default value is 1. This option is
  6550. deprecated, setting higher values should no longer be necessary and
  6551. is not recommended.
  6552. @item show
  6553. When set to 1, a green rectangle is drawn on the screen to simplify
  6554. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6555. The default value is 0.
  6556. The rectangle is drawn on the outermost pixels which will be (partly)
  6557. replaced with interpolated values. The values of the next pixels
  6558. immediately outside this rectangle in each direction will be used to
  6559. compute the interpolated pixel values inside the rectangle.
  6560. @end table
  6561. @subsection Examples
  6562. @itemize
  6563. @item
  6564. Set a rectangle covering the area with top left corner coordinates 0,0
  6565. and size 100x77, and a band of size 10:
  6566. @example
  6567. delogo=x=0:y=0:w=100:h=77:band=10
  6568. @end example
  6569. @end itemize
  6570. @section derain
  6571. Remove the rain in the input image/video by applying the derain methods based on
  6572. convolutional neural networks. Supported models:
  6573. @itemize
  6574. @item
  6575. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  6576. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  6577. @end itemize
  6578. Training as well as model generation scripts are provided in
  6579. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  6580. Native model files (.model) can be generated from TensorFlow model
  6581. files (.pb) by using tools/python/convert.py
  6582. The filter accepts the following options:
  6583. @table @option
  6584. @item filter_type
  6585. Specify which filter to use. This option accepts the following values:
  6586. @table @samp
  6587. @item derain
  6588. Derain filter. To conduct derain filter, you need to use a derain model.
  6589. @item dehaze
  6590. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  6591. @end table
  6592. Default value is @samp{derain}.
  6593. @item dnn_backend
  6594. Specify which DNN backend to use for model loading and execution. This option accepts
  6595. the following values:
  6596. @table @samp
  6597. @item native
  6598. Native implementation of DNN loading and execution.
  6599. @item tensorflow
  6600. TensorFlow backend. To enable this backend you
  6601. need to install the TensorFlow for C library (see
  6602. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  6603. @code{--enable-libtensorflow}
  6604. @end table
  6605. Default value is @samp{native}.
  6606. @item model
  6607. Set path to model file specifying network architecture and its parameters.
  6608. Note that different backends use different file formats. TensorFlow and native
  6609. backend can load files for only its format.
  6610. @end table
  6611. @section deshake
  6612. Attempt to fix small changes in horizontal and/or vertical shift. This
  6613. filter helps remove camera shake from hand-holding a camera, bumping a
  6614. tripod, moving on a vehicle, etc.
  6615. The filter accepts the following options:
  6616. @table @option
  6617. @item x
  6618. @item y
  6619. @item w
  6620. @item h
  6621. Specify a rectangular area where to limit the search for motion
  6622. vectors.
  6623. If desired the search for motion vectors can be limited to a
  6624. rectangular area of the frame defined by its top left corner, width
  6625. and height. These parameters have the same meaning as the drawbox
  6626. filter which can be used to visualise the position of the bounding
  6627. box.
  6628. This is useful when simultaneous movement of subjects within the frame
  6629. might be confused for camera motion by the motion vector search.
  6630. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6631. then the full frame is used. This allows later options to be set
  6632. without specifying the bounding box for the motion vector search.
  6633. Default - search the whole frame.
  6634. @item rx
  6635. @item ry
  6636. Specify the maximum extent of movement in x and y directions in the
  6637. range 0-64 pixels. Default 16.
  6638. @item edge
  6639. Specify how to generate pixels to fill blanks at the edge of the
  6640. frame. Available values are:
  6641. @table @samp
  6642. @item blank, 0
  6643. Fill zeroes at blank locations
  6644. @item original, 1
  6645. Original image at blank locations
  6646. @item clamp, 2
  6647. Extruded edge value at blank locations
  6648. @item mirror, 3
  6649. Mirrored edge at blank locations
  6650. @end table
  6651. Default value is @samp{mirror}.
  6652. @item blocksize
  6653. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6654. default 8.
  6655. @item contrast
  6656. Specify the contrast threshold for blocks. Only blocks with more than
  6657. the specified contrast (difference between darkest and lightest
  6658. pixels) will be considered. Range 1-255, default 125.
  6659. @item search
  6660. Specify the search strategy. Available values are:
  6661. @table @samp
  6662. @item exhaustive, 0
  6663. Set exhaustive search
  6664. @item less, 1
  6665. Set less exhaustive search.
  6666. @end table
  6667. Default value is @samp{exhaustive}.
  6668. @item filename
  6669. If set then a detailed log of the motion search is written to the
  6670. specified file.
  6671. @end table
  6672. @section despill
  6673. Remove unwanted contamination of foreground colors, caused by reflected color of
  6674. greenscreen or bluescreen.
  6675. This filter accepts the following options:
  6676. @table @option
  6677. @item type
  6678. Set what type of despill to use.
  6679. @item mix
  6680. Set how spillmap will be generated.
  6681. @item expand
  6682. Set how much to get rid of still remaining spill.
  6683. @item red
  6684. Controls amount of red in spill area.
  6685. @item green
  6686. Controls amount of green in spill area.
  6687. Should be -1 for greenscreen.
  6688. @item blue
  6689. Controls amount of blue in spill area.
  6690. Should be -1 for bluescreen.
  6691. @item brightness
  6692. Controls brightness of spill area, preserving colors.
  6693. @item alpha
  6694. Modify alpha from generated spillmap.
  6695. @end table
  6696. @section detelecine
  6697. Apply an exact inverse of the telecine operation. It requires a predefined
  6698. pattern specified using the pattern option which must be the same as that passed
  6699. to the telecine filter.
  6700. This filter accepts the following options:
  6701. @table @option
  6702. @item first_field
  6703. @table @samp
  6704. @item top, t
  6705. top field first
  6706. @item bottom, b
  6707. bottom field first
  6708. The default value is @code{top}.
  6709. @end table
  6710. @item pattern
  6711. A string of numbers representing the pulldown pattern you wish to apply.
  6712. The default value is @code{23}.
  6713. @item start_frame
  6714. A number representing position of the first frame with respect to the telecine
  6715. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6716. @end table
  6717. @section dilation
  6718. Apply dilation effect to the video.
  6719. This filter replaces the pixel by the local(3x3) maximum.
  6720. It accepts the following options:
  6721. @table @option
  6722. @item threshold0
  6723. @item threshold1
  6724. @item threshold2
  6725. @item threshold3
  6726. Limit the maximum change for each plane, default is 65535.
  6727. If 0, plane will remain unchanged.
  6728. @item coordinates
  6729. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6730. pixels are used.
  6731. Flags to local 3x3 coordinates maps like this:
  6732. 1 2 3
  6733. 4 5
  6734. 6 7 8
  6735. @end table
  6736. @section displace
  6737. Displace pixels as indicated by second and third input stream.
  6738. It takes three input streams and outputs one stream, the first input is the
  6739. source, and second and third input are displacement maps.
  6740. The second input specifies how much to displace pixels along the
  6741. x-axis, while the third input specifies how much to displace pixels
  6742. along the y-axis.
  6743. If one of displacement map streams terminates, last frame from that
  6744. displacement map will be used.
  6745. Note that once generated, displacements maps can be reused over and over again.
  6746. A description of the accepted options follows.
  6747. @table @option
  6748. @item edge
  6749. Set displace behavior for pixels that are out of range.
  6750. Available values are:
  6751. @table @samp
  6752. @item blank
  6753. Missing pixels are replaced by black pixels.
  6754. @item smear
  6755. Adjacent pixels will spread out to replace missing pixels.
  6756. @item wrap
  6757. Out of range pixels are wrapped so they point to pixels of other side.
  6758. @item mirror
  6759. Out of range pixels will be replaced with mirrored pixels.
  6760. @end table
  6761. Default is @samp{smear}.
  6762. @end table
  6763. @subsection Examples
  6764. @itemize
  6765. @item
  6766. Add ripple effect to rgb input of video size hd720:
  6767. @example
  6768. 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
  6769. @end example
  6770. @item
  6771. Add wave effect to rgb input of video size hd720:
  6772. @example
  6773. 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
  6774. @end example
  6775. @end itemize
  6776. @section drawbox
  6777. Draw a colored box on the input image.
  6778. It accepts the following parameters:
  6779. @table @option
  6780. @item x
  6781. @item y
  6782. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6783. @item width, w
  6784. @item height, h
  6785. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6786. the input width and height. It defaults to 0.
  6787. @item color, c
  6788. Specify the color of the box to write. For the general syntax of this option,
  6789. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6790. value @code{invert} is used, the box edge color is the same as the
  6791. video with inverted luma.
  6792. @item thickness, t
  6793. The expression which sets the thickness of the box edge.
  6794. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6795. See below for the list of accepted constants.
  6796. @item replace
  6797. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6798. will overwrite the video's color and alpha pixels.
  6799. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6800. @end table
  6801. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6802. following constants:
  6803. @table @option
  6804. @item dar
  6805. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6806. @item hsub
  6807. @item vsub
  6808. horizontal and vertical chroma subsample values. For example for the
  6809. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6810. @item in_h, ih
  6811. @item in_w, iw
  6812. The input width and height.
  6813. @item sar
  6814. The input sample aspect ratio.
  6815. @item x
  6816. @item y
  6817. The x and y offset coordinates where the box is drawn.
  6818. @item w
  6819. @item h
  6820. The width and height of the drawn box.
  6821. @item t
  6822. The thickness of the drawn box.
  6823. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6824. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6825. @end table
  6826. @subsection Examples
  6827. @itemize
  6828. @item
  6829. Draw a black box around the edge of the input image:
  6830. @example
  6831. drawbox
  6832. @end example
  6833. @item
  6834. Draw a box with color red and an opacity of 50%:
  6835. @example
  6836. drawbox=10:20:200:60:red@@0.5
  6837. @end example
  6838. The previous example can be specified as:
  6839. @example
  6840. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6841. @end example
  6842. @item
  6843. Fill the box with pink color:
  6844. @example
  6845. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6846. @end example
  6847. @item
  6848. Draw a 2-pixel red 2.40:1 mask:
  6849. @example
  6850. 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
  6851. @end example
  6852. @end itemize
  6853. @subsection Commands
  6854. This filter supports same commands as options.
  6855. The command accepts the same syntax of the corresponding option.
  6856. If the specified expression is not valid, it is kept at its current
  6857. value.
  6858. @section drawgrid
  6859. Draw a grid on the input image.
  6860. It accepts the following parameters:
  6861. @table @option
  6862. @item x
  6863. @item y
  6864. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6865. @item width, w
  6866. @item height, h
  6867. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6868. input width and height, respectively, minus @code{thickness}, so image gets
  6869. framed. Default to 0.
  6870. @item color, c
  6871. Specify the color of the grid. For the general syntax of this option,
  6872. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6873. value @code{invert} is used, the grid color is the same as the
  6874. video with inverted luma.
  6875. @item thickness, t
  6876. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6877. See below for the list of accepted constants.
  6878. @item replace
  6879. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6880. will overwrite the video's color and alpha pixels.
  6881. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6882. @end table
  6883. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6884. following constants:
  6885. @table @option
  6886. @item dar
  6887. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6888. @item hsub
  6889. @item vsub
  6890. horizontal and vertical chroma subsample values. For example for the
  6891. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6892. @item in_h, ih
  6893. @item in_w, iw
  6894. The input grid cell width and height.
  6895. @item sar
  6896. The input sample aspect ratio.
  6897. @item x
  6898. @item y
  6899. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6900. @item w
  6901. @item h
  6902. The width and height of the drawn cell.
  6903. @item t
  6904. The thickness of the drawn cell.
  6905. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6906. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6907. @end table
  6908. @subsection Examples
  6909. @itemize
  6910. @item
  6911. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6912. @example
  6913. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6914. @end example
  6915. @item
  6916. Draw a white 3x3 grid with an opacity of 50%:
  6917. @example
  6918. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6919. @end example
  6920. @end itemize
  6921. @subsection Commands
  6922. This filter supports same commands as options.
  6923. The command accepts the same syntax of the corresponding option.
  6924. If the specified expression is not valid, it is kept at its current
  6925. value.
  6926. @anchor{drawtext}
  6927. @section drawtext
  6928. Draw a text string or text from a specified file on top of a video, using the
  6929. libfreetype library.
  6930. To enable compilation of this filter, you need to configure FFmpeg with
  6931. @code{--enable-libfreetype}.
  6932. To enable default font fallback and the @var{font} option you need to
  6933. configure FFmpeg with @code{--enable-libfontconfig}.
  6934. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6935. @code{--enable-libfribidi}.
  6936. @subsection Syntax
  6937. It accepts the following parameters:
  6938. @table @option
  6939. @item box
  6940. Used to draw a box around text using the background color.
  6941. The value must be either 1 (enable) or 0 (disable).
  6942. The default value of @var{box} is 0.
  6943. @item boxborderw
  6944. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6945. The default value of @var{boxborderw} is 0.
  6946. @item boxcolor
  6947. The color to be used for drawing box around text. For the syntax of this
  6948. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6949. The default value of @var{boxcolor} is "white".
  6950. @item line_spacing
  6951. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6952. The default value of @var{line_spacing} is 0.
  6953. @item borderw
  6954. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6955. The default value of @var{borderw} is 0.
  6956. @item bordercolor
  6957. Set the color to be used for drawing border around text. For the syntax of this
  6958. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6959. The default value of @var{bordercolor} is "black".
  6960. @item expansion
  6961. Select how the @var{text} is expanded. Can be either @code{none},
  6962. @code{strftime} (deprecated) or
  6963. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6964. below for details.
  6965. @item basetime
  6966. Set a start time for the count. Value is in microseconds. Only applied
  6967. in the deprecated strftime expansion mode. To emulate in normal expansion
  6968. mode use the @code{pts} function, supplying the start time (in seconds)
  6969. as the second argument.
  6970. @item fix_bounds
  6971. If true, check and fix text coords to avoid clipping.
  6972. @item fontcolor
  6973. The color to be used for drawing fonts. For the syntax of this option, check
  6974. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6975. The default value of @var{fontcolor} is "black".
  6976. @item fontcolor_expr
  6977. String which is expanded the same way as @var{text} to obtain dynamic
  6978. @var{fontcolor} value. By default this option has empty value and is not
  6979. processed. When this option is set, it overrides @var{fontcolor} option.
  6980. @item font
  6981. The font family to be used for drawing text. By default Sans.
  6982. @item fontfile
  6983. The font file to be used for drawing text. The path must be included.
  6984. This parameter is mandatory if the fontconfig support is disabled.
  6985. @item alpha
  6986. Draw the text applying alpha blending. The value can
  6987. be a number between 0.0 and 1.0.
  6988. The expression accepts the same variables @var{x, y} as well.
  6989. The default value is 1.
  6990. Please see @var{fontcolor_expr}.
  6991. @item fontsize
  6992. The font size to be used for drawing text.
  6993. The default value of @var{fontsize} is 16.
  6994. @item text_shaping
  6995. If set to 1, attempt to shape the text (for example, reverse the order of
  6996. right-to-left text and join Arabic characters) before drawing it.
  6997. Otherwise, just draw the text exactly as given.
  6998. By default 1 (if supported).
  6999. @item ft_load_flags
  7000. The flags to be used for loading the fonts.
  7001. The flags map the corresponding flags supported by libfreetype, and are
  7002. a combination of the following values:
  7003. @table @var
  7004. @item default
  7005. @item no_scale
  7006. @item no_hinting
  7007. @item render
  7008. @item no_bitmap
  7009. @item vertical_layout
  7010. @item force_autohint
  7011. @item crop_bitmap
  7012. @item pedantic
  7013. @item ignore_global_advance_width
  7014. @item no_recurse
  7015. @item ignore_transform
  7016. @item monochrome
  7017. @item linear_design
  7018. @item no_autohint
  7019. @end table
  7020. Default value is "default".
  7021. For more information consult the documentation for the FT_LOAD_*
  7022. libfreetype flags.
  7023. @item shadowcolor
  7024. The color to be used for drawing a shadow behind the drawn text. For the
  7025. syntax of this option, check the @ref{color syntax,,"Color" section in the
  7026. ffmpeg-utils manual,ffmpeg-utils}.
  7027. The default value of @var{shadowcolor} is "black".
  7028. @item shadowx
  7029. @item shadowy
  7030. The x and y offsets for the text shadow position with respect to the
  7031. position of the text. They can be either positive or negative
  7032. values. The default value for both is "0".
  7033. @item start_number
  7034. The starting frame number for the n/frame_num variable. The default value
  7035. is "0".
  7036. @item tabsize
  7037. The size in number of spaces to use for rendering the tab.
  7038. Default value is 4.
  7039. @item timecode
  7040. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  7041. format. It can be used with or without text parameter. @var{timecode_rate}
  7042. option must be specified.
  7043. @item timecode_rate, rate, r
  7044. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  7045. integer. Minimum value is "1".
  7046. Drop-frame timecode is supported for frame rates 30 & 60.
  7047. @item tc24hmax
  7048. If set to 1, the output of the timecode option will wrap around at 24 hours.
  7049. Default is 0 (disabled).
  7050. @item text
  7051. The text string to be drawn. The text must be a sequence of UTF-8
  7052. encoded characters.
  7053. This parameter is mandatory if no file is specified with the parameter
  7054. @var{textfile}.
  7055. @item textfile
  7056. A text file containing text to be drawn. The text must be a sequence
  7057. of UTF-8 encoded characters.
  7058. This parameter is mandatory if no text string is specified with the
  7059. parameter @var{text}.
  7060. If both @var{text} and @var{textfile} are specified, an error is thrown.
  7061. @item reload
  7062. If set to 1, the @var{textfile} will be reloaded before each frame.
  7063. Be sure to update it atomically, or it may be read partially, or even fail.
  7064. @item x
  7065. @item y
  7066. The expressions which specify the offsets where text will be drawn
  7067. within the video frame. They are relative to the top/left border of the
  7068. output image.
  7069. The default value of @var{x} and @var{y} is "0".
  7070. See below for the list of accepted constants and functions.
  7071. @end table
  7072. The parameters for @var{x} and @var{y} are expressions containing the
  7073. following constants and functions:
  7074. @table @option
  7075. @item dar
  7076. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  7077. @item hsub
  7078. @item vsub
  7079. horizontal and vertical chroma subsample values. For example for the
  7080. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7081. @item line_h, lh
  7082. the height of each text line
  7083. @item main_h, h, H
  7084. the input height
  7085. @item main_w, w, W
  7086. the input width
  7087. @item max_glyph_a, ascent
  7088. the maximum distance from the baseline to the highest/upper grid
  7089. coordinate used to place a glyph outline point, for all the rendered
  7090. glyphs.
  7091. It is a positive value, due to the grid's orientation with the Y axis
  7092. upwards.
  7093. @item max_glyph_d, descent
  7094. the maximum distance from the baseline to the lowest grid coordinate
  7095. used to place a glyph outline point, for all the rendered glyphs.
  7096. This is a negative value, due to the grid's orientation, with the Y axis
  7097. upwards.
  7098. @item max_glyph_h
  7099. maximum glyph height, that is the maximum height for all the glyphs
  7100. contained in the rendered text, it is equivalent to @var{ascent} -
  7101. @var{descent}.
  7102. @item max_glyph_w
  7103. maximum glyph width, that is the maximum width for all the glyphs
  7104. contained in the rendered text
  7105. @item n
  7106. the number of input frame, starting from 0
  7107. @item rand(min, max)
  7108. return a random number included between @var{min} and @var{max}
  7109. @item sar
  7110. The input sample aspect ratio.
  7111. @item t
  7112. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7113. @item text_h, th
  7114. the height of the rendered text
  7115. @item text_w, tw
  7116. the width of the rendered text
  7117. @item x
  7118. @item y
  7119. the x and y offset coordinates where the text is drawn.
  7120. These parameters allow the @var{x} and @var{y} expressions to refer
  7121. to each other, so you can for example specify @code{y=x/dar}.
  7122. @item pict_type
  7123. A one character description of the current frame's picture type.
  7124. @item pkt_pos
  7125. The current packet's position in the input file or stream
  7126. (in bytes, from the start of the input). A value of -1 indicates
  7127. this info is not available.
  7128. @item pkt_duration
  7129. The current packet's duration, in seconds.
  7130. @item pkt_size
  7131. The current packet's size (in bytes).
  7132. @end table
  7133. @anchor{drawtext_expansion}
  7134. @subsection Text expansion
  7135. If @option{expansion} is set to @code{strftime},
  7136. the filter recognizes strftime() sequences in the provided text and
  7137. expands them accordingly. Check the documentation of strftime(). This
  7138. feature is deprecated.
  7139. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  7140. If @option{expansion} is set to @code{normal} (which is the default),
  7141. the following expansion mechanism is used.
  7142. The backslash character @samp{\}, followed by any character, always expands to
  7143. the second character.
  7144. Sequences of the form @code{%@{...@}} are expanded. The text between the
  7145. braces is a function name, possibly followed by arguments separated by ':'.
  7146. If the arguments contain special characters or delimiters (':' or '@}'),
  7147. they should be escaped.
  7148. Note that they probably must also be escaped as the value for the
  7149. @option{text} option in the filter argument string and as the filter
  7150. argument in the filtergraph description, and possibly also for the shell,
  7151. that makes up to four levels of escaping; using a text file avoids these
  7152. problems.
  7153. The following functions are available:
  7154. @table @command
  7155. @item expr, e
  7156. The expression evaluation result.
  7157. It must take one argument specifying the expression to be evaluated,
  7158. which accepts the same constants and functions as the @var{x} and
  7159. @var{y} values. Note that not all constants should be used, for
  7160. example the text size is not known when evaluating the expression, so
  7161. the constants @var{text_w} and @var{text_h} will have an undefined
  7162. value.
  7163. @item expr_int_format, eif
  7164. Evaluate the expression's value and output as formatted integer.
  7165. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  7166. The second argument specifies the output format. Allowed values are @samp{x},
  7167. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  7168. @code{printf} function.
  7169. The third parameter is optional and sets the number of positions taken by the output.
  7170. It can be used to add padding with zeros from the left.
  7171. @item gmtime
  7172. The time at which the filter is running, expressed in UTC.
  7173. It can accept an argument: a strftime() format string.
  7174. @item localtime
  7175. The time at which the filter is running, expressed in the local time zone.
  7176. It can accept an argument: a strftime() format string.
  7177. @item metadata
  7178. Frame metadata. Takes one or two arguments.
  7179. The first argument is mandatory and specifies the metadata key.
  7180. The second argument is optional and specifies a default value, used when the
  7181. metadata key is not found or empty.
  7182. Available metadata can be identified by inspecting entries
  7183. starting with TAG included within each frame section
  7184. printed by running @code{ffprobe -show_frames}.
  7185. String metadata generated in filters leading to
  7186. the drawtext filter are also available.
  7187. @item n, frame_num
  7188. The frame number, starting from 0.
  7189. @item pict_type
  7190. A one character description of the current picture type.
  7191. @item pts
  7192. The timestamp of the current frame.
  7193. It can take up to three arguments.
  7194. The first argument is the format of the timestamp; it defaults to @code{flt}
  7195. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  7196. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  7197. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  7198. @code{localtime} stands for the timestamp of the frame formatted as
  7199. local time zone time.
  7200. The second argument is an offset added to the timestamp.
  7201. If the format is set to @code{hms}, a third argument @code{24HH} may be
  7202. supplied to present the hour part of the formatted timestamp in 24h format
  7203. (00-23).
  7204. If the format is set to @code{localtime} or @code{gmtime},
  7205. a third argument may be supplied: a strftime() format string.
  7206. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  7207. @end table
  7208. @subsection Commands
  7209. This filter supports altering parameters via commands:
  7210. @table @option
  7211. @item reinit
  7212. Alter existing filter parameters.
  7213. Syntax for the argument is the same as for filter invocation, e.g.
  7214. @example
  7215. fontsize=56:fontcolor=green:text='Hello World'
  7216. @end example
  7217. Full filter invocation with sendcmd would look like this:
  7218. @example
  7219. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7220. @end example
  7221. @end table
  7222. If the entire argument can't be parsed or applied as valid values then the filter will
  7223. continue with its existing parameters.
  7224. @subsection Examples
  7225. @itemize
  7226. @item
  7227. Draw "Test Text" with font FreeSerif, using the default values for the
  7228. optional parameters.
  7229. @example
  7230. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7231. @end example
  7232. @item
  7233. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7234. and y=50 (counting from the top-left corner of the screen), text is
  7235. yellow with a red box around it. Both the text and the box have an
  7236. opacity of 20%.
  7237. @example
  7238. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7239. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7240. @end example
  7241. Note that the double quotes are not necessary if spaces are not used
  7242. within the parameter list.
  7243. @item
  7244. Show the text at the center of the video frame:
  7245. @example
  7246. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7247. @end example
  7248. @item
  7249. Show the text at a random position, switching to a new position every 30 seconds:
  7250. @example
  7251. 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)"
  7252. @end example
  7253. @item
  7254. Show a text line sliding from right to left in the last row of the video
  7255. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7256. with no newlines.
  7257. @example
  7258. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7259. @end example
  7260. @item
  7261. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7262. @example
  7263. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7264. @end example
  7265. @item
  7266. Draw a single green letter "g", at the center of the input video.
  7267. The glyph baseline is placed at half screen height.
  7268. @example
  7269. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7270. @end example
  7271. @item
  7272. Show text for 1 second every 3 seconds:
  7273. @example
  7274. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7275. @end example
  7276. @item
  7277. Use fontconfig to set the font. Note that the colons need to be escaped.
  7278. @example
  7279. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7280. @end example
  7281. @item
  7282. Print the date of a real-time encoding (see strftime(3)):
  7283. @example
  7284. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7285. @end example
  7286. @item
  7287. Show text fading in and out (appearing/disappearing):
  7288. @example
  7289. #!/bin/sh
  7290. DS=1.0 # display start
  7291. DE=10.0 # display end
  7292. FID=1.5 # fade in duration
  7293. FOD=5 # fade out duration
  7294. 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 @}"
  7295. @end example
  7296. @item
  7297. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7298. and the @option{fontsize} value are included in the @option{y} offset.
  7299. @example
  7300. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7301. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7302. @end example
  7303. @end itemize
  7304. For more information about libfreetype, check:
  7305. @url{http://www.freetype.org/}.
  7306. For more information about fontconfig, check:
  7307. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7308. For more information about libfribidi, check:
  7309. @url{http://fribidi.org/}.
  7310. @section edgedetect
  7311. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7312. The filter accepts the following options:
  7313. @table @option
  7314. @item low
  7315. @item high
  7316. Set low and high threshold values used by the Canny thresholding
  7317. algorithm.
  7318. The high threshold selects the "strong" edge pixels, which are then
  7319. connected through 8-connectivity with the "weak" edge pixels selected
  7320. by the low threshold.
  7321. @var{low} and @var{high} threshold values must be chosen in the range
  7322. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7323. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  7324. is @code{50/255}.
  7325. @item mode
  7326. Define the drawing mode.
  7327. @table @samp
  7328. @item wires
  7329. Draw white/gray wires on black background.
  7330. @item colormix
  7331. Mix the colors to create a paint/cartoon effect.
  7332. @item canny
  7333. Apply Canny edge detector on all selected planes.
  7334. @end table
  7335. Default value is @var{wires}.
  7336. @item planes
  7337. Select planes for filtering. By default all available planes are filtered.
  7338. @end table
  7339. @subsection Examples
  7340. @itemize
  7341. @item
  7342. Standard edge detection with custom values for the hysteresis thresholding:
  7343. @example
  7344. edgedetect=low=0.1:high=0.4
  7345. @end example
  7346. @item
  7347. Painting effect without thresholding:
  7348. @example
  7349. edgedetect=mode=colormix:high=0
  7350. @end example
  7351. @end itemize
  7352. @section elbg
  7353. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7354. For each input image, the filter will compute the optimal mapping from
  7355. the input to the output given the codebook length, that is the number
  7356. of distinct output colors.
  7357. This filter accepts the following options.
  7358. @table @option
  7359. @item codebook_length, l
  7360. Set codebook length. The value must be a positive integer, and
  7361. represents the number of distinct output colors. Default value is 256.
  7362. @item nb_steps, n
  7363. Set the maximum number of iterations to apply for computing the optimal
  7364. mapping. The higher the value the better the result and the higher the
  7365. computation time. Default value is 1.
  7366. @item seed, s
  7367. Set a random seed, must be an integer included between 0 and
  7368. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7369. will try to use a good random seed on a best effort basis.
  7370. @item pal8
  7371. Set pal8 output pixel format. This option does not work with codebook
  7372. length greater than 256.
  7373. @end table
  7374. @section entropy
  7375. Measure graylevel entropy in histogram of color channels of video frames.
  7376. It accepts the following parameters:
  7377. @table @option
  7378. @item mode
  7379. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7380. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7381. between neighbour histogram values.
  7382. @end table
  7383. @section eq
  7384. Set brightness, contrast, saturation and approximate gamma adjustment.
  7385. The filter accepts the following options:
  7386. @table @option
  7387. @item contrast
  7388. Set the contrast expression. The value must be a float value in range
  7389. @code{-1000.0} to @code{1000.0}. The default value is "1".
  7390. @item brightness
  7391. Set the brightness expression. The value must be a float value in
  7392. range @code{-1.0} to @code{1.0}. The default value is "0".
  7393. @item saturation
  7394. Set the saturation expression. The value must be a float in
  7395. range @code{0.0} to @code{3.0}. The default value is "1".
  7396. @item gamma
  7397. Set the gamma expression. The value must be a float in range
  7398. @code{0.1} to @code{10.0}. The default value is "1".
  7399. @item gamma_r
  7400. Set the gamma expression for red. The value must be a float in
  7401. range @code{0.1} to @code{10.0}. The default value is "1".
  7402. @item gamma_g
  7403. Set the gamma expression for green. The value must be a float in range
  7404. @code{0.1} to @code{10.0}. The default value is "1".
  7405. @item gamma_b
  7406. Set the gamma expression for blue. The value must be a float in range
  7407. @code{0.1} to @code{10.0}. The default value is "1".
  7408. @item gamma_weight
  7409. Set the gamma weight expression. It can be used to reduce the effect
  7410. of a high gamma value on bright image areas, e.g. keep them from
  7411. getting overamplified and just plain white. The value must be a float
  7412. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7413. gamma correction all the way down while @code{1.0} leaves it at its
  7414. full strength. Default is "1".
  7415. @item eval
  7416. Set when the expressions for brightness, contrast, saturation and
  7417. gamma expressions are evaluated.
  7418. It accepts the following values:
  7419. @table @samp
  7420. @item init
  7421. only evaluate expressions once during the filter initialization or
  7422. when a command is processed
  7423. @item frame
  7424. evaluate expressions for each incoming frame
  7425. @end table
  7426. Default value is @samp{init}.
  7427. @end table
  7428. The expressions accept the following parameters:
  7429. @table @option
  7430. @item n
  7431. frame count of the input frame starting from 0
  7432. @item pos
  7433. byte position of the corresponding packet in the input file, NAN if
  7434. unspecified
  7435. @item r
  7436. frame rate of the input video, NAN if the input frame rate is unknown
  7437. @item t
  7438. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7439. @end table
  7440. @subsection Commands
  7441. The filter supports the following commands:
  7442. @table @option
  7443. @item contrast
  7444. Set the contrast expression.
  7445. @item brightness
  7446. Set the brightness expression.
  7447. @item saturation
  7448. Set the saturation expression.
  7449. @item gamma
  7450. Set the gamma expression.
  7451. @item gamma_r
  7452. Set the gamma_r expression.
  7453. @item gamma_g
  7454. Set gamma_g expression.
  7455. @item gamma_b
  7456. Set gamma_b expression.
  7457. @item gamma_weight
  7458. Set gamma_weight expression.
  7459. The command accepts the same syntax of the corresponding option.
  7460. If the specified expression is not valid, it is kept at its current
  7461. value.
  7462. @end table
  7463. @section erosion
  7464. Apply erosion effect to the video.
  7465. This filter replaces the pixel by the local(3x3) minimum.
  7466. It accepts the following options:
  7467. @table @option
  7468. @item threshold0
  7469. @item threshold1
  7470. @item threshold2
  7471. @item threshold3
  7472. Limit the maximum change for each plane, default is 65535.
  7473. If 0, plane will remain unchanged.
  7474. @item coordinates
  7475. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7476. pixels are used.
  7477. Flags to local 3x3 coordinates maps like this:
  7478. 1 2 3
  7479. 4 5
  7480. 6 7 8
  7481. @end table
  7482. @section extractplanes
  7483. Extract color channel components from input video stream into
  7484. separate grayscale video streams.
  7485. The filter accepts the following option:
  7486. @table @option
  7487. @item planes
  7488. Set plane(s) to extract.
  7489. Available values for planes are:
  7490. @table @samp
  7491. @item y
  7492. @item u
  7493. @item v
  7494. @item a
  7495. @item r
  7496. @item g
  7497. @item b
  7498. @end table
  7499. Choosing planes not available in the input will result in an error.
  7500. That means you cannot select @code{r}, @code{g}, @code{b} planes
  7501. with @code{y}, @code{u}, @code{v} planes at same time.
  7502. @end table
  7503. @subsection Examples
  7504. @itemize
  7505. @item
  7506. Extract luma, u and v color channel component from input video frame
  7507. into 3 grayscale outputs:
  7508. @example
  7509. 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
  7510. @end example
  7511. @end itemize
  7512. @section fade
  7513. Apply a fade-in/out effect to the input video.
  7514. It accepts the following parameters:
  7515. @table @option
  7516. @item type, t
  7517. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7518. effect.
  7519. Default is @code{in}.
  7520. @item start_frame, s
  7521. Specify the number of the frame to start applying the fade
  7522. effect at. Default is 0.
  7523. @item nb_frames, n
  7524. The number of frames that the fade effect lasts. At the end of the
  7525. fade-in effect, the output video will have the same intensity as the input video.
  7526. At the end of the fade-out transition, the output video will be filled with the
  7527. selected @option{color}.
  7528. Default is 25.
  7529. @item alpha
  7530. If set to 1, fade only alpha channel, if one exists on the input.
  7531. Default value is 0.
  7532. @item start_time, st
  7533. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7534. effect. If both start_frame and start_time are specified, the fade will start at
  7535. whichever comes last. Default is 0.
  7536. @item duration, d
  7537. The number of seconds for which the fade effect has to last. At the end of the
  7538. fade-in effect the output video will have the same intensity as the input video,
  7539. at the end of the fade-out transition the output video will be filled with the
  7540. selected @option{color}.
  7541. If both duration and nb_frames are specified, duration is used. Default is 0
  7542. (nb_frames is used by default).
  7543. @item color, c
  7544. Specify the color of the fade. Default is "black".
  7545. @end table
  7546. @subsection Examples
  7547. @itemize
  7548. @item
  7549. Fade in the first 30 frames of video:
  7550. @example
  7551. fade=in:0:30
  7552. @end example
  7553. The command above is equivalent to:
  7554. @example
  7555. fade=t=in:s=0:n=30
  7556. @end example
  7557. @item
  7558. Fade out the last 45 frames of a 200-frame video:
  7559. @example
  7560. fade=out:155:45
  7561. fade=type=out:start_frame=155:nb_frames=45
  7562. @end example
  7563. @item
  7564. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7565. @example
  7566. fade=in:0:25, fade=out:975:25
  7567. @end example
  7568. @item
  7569. Make the first 5 frames yellow, then fade in from frame 5-24:
  7570. @example
  7571. fade=in:5:20:color=yellow
  7572. @end example
  7573. @item
  7574. Fade in alpha over first 25 frames of video:
  7575. @example
  7576. fade=in:0:25:alpha=1
  7577. @end example
  7578. @item
  7579. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7580. @example
  7581. fade=t=in:st=5.5:d=0.5
  7582. @end example
  7583. @end itemize
  7584. @section fftdnoiz
  7585. Denoise frames using 3D FFT (frequency domain filtering).
  7586. The filter accepts the following options:
  7587. @table @option
  7588. @item sigma
  7589. Set the noise sigma constant. This sets denoising strength.
  7590. Default value is 1. Allowed range is from 0 to 30.
  7591. Using very high sigma with low overlap may give blocking artifacts.
  7592. @item amount
  7593. Set amount of denoising. By default all detected noise is reduced.
  7594. Default value is 1. Allowed range is from 0 to 1.
  7595. @item block
  7596. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7597. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7598. block size in pixels is 2^4 which is 16.
  7599. @item overlap
  7600. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7601. @item prev
  7602. Set number of previous frames to use for denoising. By default is set to 0.
  7603. @item next
  7604. Set number of next frames to to use for denoising. By default is set to 0.
  7605. @item planes
  7606. Set planes which will be filtered, by default are all available filtered
  7607. except alpha.
  7608. @end table
  7609. @section fftfilt
  7610. Apply arbitrary expressions to samples in frequency domain
  7611. @table @option
  7612. @item dc_Y
  7613. Adjust the dc value (gain) of the luma plane of the image. The filter
  7614. accepts an integer value in range @code{0} to @code{1000}. The default
  7615. value is set to @code{0}.
  7616. @item dc_U
  7617. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7618. filter accepts an integer value in range @code{0} to @code{1000}. The
  7619. default value is set to @code{0}.
  7620. @item dc_V
  7621. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7622. filter accepts an integer value in range @code{0} to @code{1000}. The
  7623. default value is set to @code{0}.
  7624. @item weight_Y
  7625. Set the frequency domain weight expression for the luma plane.
  7626. @item weight_U
  7627. Set the frequency domain weight expression for the 1st chroma plane.
  7628. @item weight_V
  7629. Set the frequency domain weight expression for the 2nd chroma plane.
  7630. @item eval
  7631. Set when the expressions are evaluated.
  7632. It accepts the following values:
  7633. @table @samp
  7634. @item init
  7635. Only evaluate expressions once during the filter initialization.
  7636. @item frame
  7637. Evaluate expressions for each incoming frame.
  7638. @end table
  7639. Default value is @samp{init}.
  7640. The filter accepts the following variables:
  7641. @item X
  7642. @item Y
  7643. The coordinates of the current sample.
  7644. @item W
  7645. @item H
  7646. The width and height of the image.
  7647. @item N
  7648. The number of input frame, starting from 0.
  7649. @end table
  7650. @subsection Examples
  7651. @itemize
  7652. @item
  7653. High-pass:
  7654. @example
  7655. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7656. @end example
  7657. @item
  7658. Low-pass:
  7659. @example
  7660. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7661. @end example
  7662. @item
  7663. Sharpen:
  7664. @example
  7665. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7666. @end example
  7667. @item
  7668. Blur:
  7669. @example
  7670. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7671. @end example
  7672. @end itemize
  7673. @section field
  7674. Extract a single field from an interlaced image using stride
  7675. arithmetic to avoid wasting CPU time. The output frames are marked as
  7676. non-interlaced.
  7677. The filter accepts the following options:
  7678. @table @option
  7679. @item type
  7680. Specify whether to extract the top (if the value is @code{0} or
  7681. @code{top}) or the bottom field (if the value is @code{1} or
  7682. @code{bottom}).
  7683. @end table
  7684. @section fieldhint
  7685. Create new frames by copying the top and bottom fields from surrounding frames
  7686. supplied as numbers by the hint file.
  7687. @table @option
  7688. @item hint
  7689. Set file containing hints: absolute/relative frame numbers.
  7690. There must be one line for each frame in a clip. Each line must contain two
  7691. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7692. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7693. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7694. for @code{relative} mode. First number tells from which frame to pick up top
  7695. field and second number tells from which frame to pick up bottom field.
  7696. If optionally followed by @code{+} output frame will be marked as interlaced,
  7697. else if followed by @code{-} output frame will be marked as progressive, else
  7698. it will be marked same as input frame.
  7699. If line starts with @code{#} or @code{;} that line is skipped.
  7700. @item mode
  7701. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7702. @end table
  7703. Example of first several lines of @code{hint} file for @code{relative} mode:
  7704. @example
  7705. 0,0 - # first frame
  7706. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7707. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7708. 1,0 -
  7709. 0,0 -
  7710. 0,0 -
  7711. 1,0 -
  7712. 1,0 -
  7713. 1,0 -
  7714. 0,0 -
  7715. 0,0 -
  7716. 1,0 -
  7717. 1,0 -
  7718. 1,0 -
  7719. 0,0 -
  7720. @end example
  7721. @section fieldmatch
  7722. Field matching filter for inverse telecine. It is meant to reconstruct the
  7723. progressive frames from a telecined stream. The filter does not drop duplicated
  7724. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7725. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7726. The separation of the field matching and the decimation is notably motivated by
  7727. the possibility of inserting a de-interlacing filter fallback between the two.
  7728. If the source has mixed telecined and real interlaced content,
  7729. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7730. But these remaining combed frames will be marked as interlaced, and thus can be
  7731. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7732. In addition to the various configuration options, @code{fieldmatch} can take an
  7733. optional second stream, activated through the @option{ppsrc} option. If
  7734. enabled, the frames reconstruction will be based on the fields and frames from
  7735. this second stream. This allows the first input to be pre-processed in order to
  7736. help the various algorithms of the filter, while keeping the output lossless
  7737. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7738. or brightness/contrast adjustments can help.
  7739. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7740. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7741. which @code{fieldmatch} is based on. While the semantic and usage are very
  7742. close, some behaviour and options names can differ.
  7743. The @ref{decimate} filter currently only works for constant frame rate input.
  7744. If your input has mixed telecined (30fps) and progressive content with a lower
  7745. framerate like 24fps use the following filterchain to produce the necessary cfr
  7746. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7747. The filter accepts the following options:
  7748. @table @option
  7749. @item order
  7750. Specify the assumed field order of the input stream. Available values are:
  7751. @table @samp
  7752. @item auto
  7753. Auto detect parity (use FFmpeg's internal parity value).
  7754. @item bff
  7755. Assume bottom field first.
  7756. @item tff
  7757. Assume top field first.
  7758. @end table
  7759. Note that it is sometimes recommended not to trust the parity announced by the
  7760. stream.
  7761. Default value is @var{auto}.
  7762. @item mode
  7763. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7764. sense that it won't risk creating jerkiness due to duplicate frames when
  7765. possible, but if there are bad edits or blended fields it will end up
  7766. outputting combed frames when a good match might actually exist. On the other
  7767. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7768. but will almost always find a good frame if there is one. The other values are
  7769. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7770. jerkiness and creating duplicate frames versus finding good matches in sections
  7771. with bad edits, orphaned fields, blended fields, etc.
  7772. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7773. Available values are:
  7774. @table @samp
  7775. @item pc
  7776. 2-way matching (p/c)
  7777. @item pc_n
  7778. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7779. @item pc_u
  7780. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7781. @item pc_n_ub
  7782. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7783. still combed (p/c + n + u/b)
  7784. @item pcn
  7785. 3-way matching (p/c/n)
  7786. @item pcn_ub
  7787. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7788. detected as combed (p/c/n + u/b)
  7789. @end table
  7790. The parenthesis at the end indicate the matches that would be used for that
  7791. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7792. @var{top}).
  7793. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7794. the slowest.
  7795. Default value is @var{pc_n}.
  7796. @item ppsrc
  7797. Mark the main input stream as a pre-processed input, and enable the secondary
  7798. input stream as the clean source to pick the fields from. See the filter
  7799. introduction for more details. It is similar to the @option{clip2} feature from
  7800. VFM/TFM.
  7801. Default value is @code{0} (disabled).
  7802. @item field
  7803. Set the field to match from. It is recommended to set this to the same value as
  7804. @option{order} unless you experience matching failures with that setting. In
  7805. certain circumstances changing the field that is used to match from can have a
  7806. large impact on matching performance. Available values are:
  7807. @table @samp
  7808. @item auto
  7809. Automatic (same value as @option{order}).
  7810. @item bottom
  7811. Match from the bottom field.
  7812. @item top
  7813. Match from the top field.
  7814. @end table
  7815. Default value is @var{auto}.
  7816. @item mchroma
  7817. Set whether or not chroma is included during the match comparisons. In most
  7818. cases it is recommended to leave this enabled. You should set this to @code{0}
  7819. only if your clip has bad chroma problems such as heavy rainbowing or other
  7820. artifacts. Setting this to @code{0} could also be used to speed things up at
  7821. the cost of some accuracy.
  7822. Default value is @code{1}.
  7823. @item y0
  7824. @item y1
  7825. These define an exclusion band which excludes the lines between @option{y0} and
  7826. @option{y1} from being included in the field matching decision. An exclusion
  7827. band can be used to ignore subtitles, a logo, or other things that may
  7828. interfere with the matching. @option{y0} sets the starting scan line and
  7829. @option{y1} sets the ending line; all lines in between @option{y0} and
  7830. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7831. @option{y0} and @option{y1} to the same value will disable the feature.
  7832. @option{y0} and @option{y1} defaults to @code{0}.
  7833. @item scthresh
  7834. Set the scene change detection threshold as a percentage of maximum change on
  7835. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7836. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7837. @option{scthresh} is @code{[0.0, 100.0]}.
  7838. Default value is @code{12.0}.
  7839. @item combmatch
  7840. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7841. account the combed scores of matches when deciding what match to use as the
  7842. final match. Available values are:
  7843. @table @samp
  7844. @item none
  7845. No final matching based on combed scores.
  7846. @item sc
  7847. Combed scores are only used when a scene change is detected.
  7848. @item full
  7849. Use combed scores all the time.
  7850. @end table
  7851. Default is @var{sc}.
  7852. @item combdbg
  7853. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7854. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7855. Available values are:
  7856. @table @samp
  7857. @item none
  7858. No forced calculation.
  7859. @item pcn
  7860. Force p/c/n calculations.
  7861. @item pcnub
  7862. Force p/c/n/u/b calculations.
  7863. @end table
  7864. Default value is @var{none}.
  7865. @item cthresh
  7866. This is the area combing threshold used for combed frame detection. This
  7867. essentially controls how "strong" or "visible" combing must be to be detected.
  7868. Larger values mean combing must be more visible and smaller values mean combing
  7869. can be less visible or strong and still be detected. Valid settings are from
  7870. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7871. be detected as combed). This is basically a pixel difference value. A good
  7872. range is @code{[8, 12]}.
  7873. Default value is @code{9}.
  7874. @item chroma
  7875. Sets whether or not chroma is considered in the combed frame decision. Only
  7876. disable this if your source has chroma problems (rainbowing, etc.) that are
  7877. causing problems for the combed frame detection with chroma enabled. Actually,
  7878. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7879. where there is chroma only combing in the source.
  7880. Default value is @code{0}.
  7881. @item blockx
  7882. @item blocky
  7883. Respectively set the x-axis and y-axis size of the window used during combed
  7884. frame detection. This has to do with the size of the area in which
  7885. @option{combpel} pixels are required to be detected as combed for a frame to be
  7886. declared combed. See the @option{combpel} parameter description for more info.
  7887. Possible values are any number that is a power of 2 starting at 4 and going up
  7888. to 512.
  7889. Default value is @code{16}.
  7890. @item combpel
  7891. The number of combed pixels inside any of the @option{blocky} by
  7892. @option{blockx} size blocks on the frame for the frame to be detected as
  7893. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7894. setting controls "how much" combing there must be in any localized area (a
  7895. window defined by the @option{blockx} and @option{blocky} settings) on the
  7896. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7897. which point no frames will ever be detected as combed). This setting is known
  7898. as @option{MI} in TFM/VFM vocabulary.
  7899. Default value is @code{80}.
  7900. @end table
  7901. @anchor{p/c/n/u/b meaning}
  7902. @subsection p/c/n/u/b meaning
  7903. @subsubsection p/c/n
  7904. We assume the following telecined stream:
  7905. @example
  7906. Top fields: 1 2 2 3 4
  7907. Bottom fields: 1 2 3 4 4
  7908. @end example
  7909. The numbers correspond to the progressive frame the fields relate to. Here, the
  7910. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7911. When @code{fieldmatch} is configured to run a matching from bottom
  7912. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7913. @example
  7914. Input stream:
  7915. T 1 2 2 3 4
  7916. B 1 2 3 4 4 <-- matching reference
  7917. Matches: c c n n c
  7918. Output stream:
  7919. T 1 2 3 4 4
  7920. B 1 2 3 4 4
  7921. @end example
  7922. As a result of the field matching, we can see that some frames get duplicated.
  7923. To perform a complete inverse telecine, you need to rely on a decimation filter
  7924. after this operation. See for instance the @ref{decimate} filter.
  7925. The same operation now matching from top fields (@option{field}=@var{top})
  7926. looks like this:
  7927. @example
  7928. Input stream:
  7929. T 1 2 2 3 4 <-- matching reference
  7930. B 1 2 3 4 4
  7931. Matches: c c p p c
  7932. Output stream:
  7933. T 1 2 2 3 4
  7934. B 1 2 2 3 4
  7935. @end example
  7936. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7937. basically, they refer to the frame and field of the opposite parity:
  7938. @itemize
  7939. @item @var{p} matches the field of the opposite parity in the previous frame
  7940. @item @var{c} matches the field of the opposite parity in the current frame
  7941. @item @var{n} matches the field of the opposite parity in the next frame
  7942. @end itemize
  7943. @subsubsection u/b
  7944. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7945. from the opposite parity flag. In the following examples, we assume that we are
  7946. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7947. 'x' is placed above and below each matched fields.
  7948. With bottom matching (@option{field}=@var{bottom}):
  7949. @example
  7950. Match: c p n b u
  7951. x x x x x
  7952. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7953. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7954. x x x x x
  7955. Output frames:
  7956. 2 1 2 2 2
  7957. 2 2 2 1 3
  7958. @end example
  7959. With top matching (@option{field}=@var{top}):
  7960. @example
  7961. Match: c p n b u
  7962. x x x x x
  7963. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7964. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7965. x x x x x
  7966. Output frames:
  7967. 2 2 2 1 2
  7968. 2 1 3 2 2
  7969. @end example
  7970. @subsection Examples
  7971. Simple IVTC of a top field first telecined stream:
  7972. @example
  7973. fieldmatch=order=tff:combmatch=none, decimate
  7974. @end example
  7975. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7976. @example
  7977. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7978. @end example
  7979. @section fieldorder
  7980. Transform the field order of the input video.
  7981. It accepts the following parameters:
  7982. @table @option
  7983. @item order
  7984. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7985. for bottom field first.
  7986. @end table
  7987. The default value is @samp{tff}.
  7988. The transformation is done by shifting the picture content up or down
  7989. by one line, and filling the remaining line with appropriate picture content.
  7990. This method is consistent with most broadcast field order converters.
  7991. If the input video is not flagged as being interlaced, or it is already
  7992. flagged as being of the required output field order, then this filter does
  7993. not alter the incoming video.
  7994. It is very useful when converting to or from PAL DV material,
  7995. which is bottom field first.
  7996. For example:
  7997. @example
  7998. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7999. @end example
  8000. @section fifo, afifo
  8001. Buffer input images and send them when they are requested.
  8002. It is mainly useful when auto-inserted by the libavfilter
  8003. framework.
  8004. It does not take parameters.
  8005. @section fillborders
  8006. Fill borders of the input video, without changing video stream dimensions.
  8007. Sometimes video can have garbage at the four edges and you may not want to
  8008. crop video input to keep size multiple of some number.
  8009. This filter accepts the following options:
  8010. @table @option
  8011. @item left
  8012. Number of pixels to fill from left border.
  8013. @item right
  8014. Number of pixels to fill from right border.
  8015. @item top
  8016. Number of pixels to fill from top border.
  8017. @item bottom
  8018. Number of pixels to fill from bottom border.
  8019. @item mode
  8020. Set fill mode.
  8021. It accepts the following values:
  8022. @table @samp
  8023. @item smear
  8024. fill pixels using outermost pixels
  8025. @item mirror
  8026. fill pixels using mirroring
  8027. @item fixed
  8028. fill pixels with constant value
  8029. @end table
  8030. Default is @var{smear}.
  8031. @item color
  8032. Set color for pixels in fixed mode. Default is @var{black}.
  8033. @end table
  8034. @section find_rect
  8035. Find a rectangular object
  8036. It accepts the following options:
  8037. @table @option
  8038. @item object
  8039. Filepath of the object image, needs to be in gray8.
  8040. @item threshold
  8041. Detection threshold, default is 0.5.
  8042. @item mipmaps
  8043. Number of mipmaps, default is 3.
  8044. @item xmin, ymin, xmax, ymax
  8045. Specifies the rectangle in which to search.
  8046. @end table
  8047. @subsection Examples
  8048. @itemize
  8049. @item
  8050. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8051. @example
  8052. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8053. @end example
  8054. @end itemize
  8055. @section floodfill
  8056. Flood area with values of same pixel components with another values.
  8057. It accepts the following options:
  8058. @table @option
  8059. @item x
  8060. Set pixel x coordinate.
  8061. @item y
  8062. Set pixel y coordinate.
  8063. @item s0
  8064. Set source #0 component value.
  8065. @item s1
  8066. Set source #1 component value.
  8067. @item s2
  8068. Set source #2 component value.
  8069. @item s3
  8070. Set source #3 component value.
  8071. @item d0
  8072. Set destination #0 component value.
  8073. @item d1
  8074. Set destination #1 component value.
  8075. @item d2
  8076. Set destination #2 component value.
  8077. @item d3
  8078. Set destination #3 component value.
  8079. @end table
  8080. @anchor{format}
  8081. @section format
  8082. Convert the input video to one of the specified pixel formats.
  8083. Libavfilter will try to pick one that is suitable as input to
  8084. the next filter.
  8085. It accepts the following parameters:
  8086. @table @option
  8087. @item pix_fmts
  8088. A '|'-separated list of pixel format names, such as
  8089. "pix_fmts=yuv420p|monow|rgb24".
  8090. @end table
  8091. @subsection Examples
  8092. @itemize
  8093. @item
  8094. Convert the input video to the @var{yuv420p} format
  8095. @example
  8096. format=pix_fmts=yuv420p
  8097. @end example
  8098. Convert the input video to any of the formats in the list
  8099. @example
  8100. format=pix_fmts=yuv420p|yuv444p|yuv410p
  8101. @end example
  8102. @end itemize
  8103. @anchor{fps}
  8104. @section fps
  8105. Convert the video to specified constant frame rate by duplicating or dropping
  8106. frames as necessary.
  8107. It accepts the following parameters:
  8108. @table @option
  8109. @item fps
  8110. The desired output frame rate. The default is @code{25}.
  8111. @item start_time
  8112. Assume the first PTS should be the given value, in seconds. This allows for
  8113. padding/trimming at the start of stream. By default, no assumption is made
  8114. about the first frame's expected PTS, so no padding or trimming is done.
  8115. For example, this could be set to 0 to pad the beginning with duplicates of
  8116. the first frame if a video stream starts after the audio stream or to trim any
  8117. frames with a negative PTS.
  8118. @item round
  8119. Timestamp (PTS) rounding method.
  8120. Possible values are:
  8121. @table @option
  8122. @item zero
  8123. round towards 0
  8124. @item inf
  8125. round away from 0
  8126. @item down
  8127. round towards -infinity
  8128. @item up
  8129. round towards +infinity
  8130. @item near
  8131. round to nearest
  8132. @end table
  8133. The default is @code{near}.
  8134. @item eof_action
  8135. Action performed when reading the last frame.
  8136. Possible values are:
  8137. @table @option
  8138. @item round
  8139. Use same timestamp rounding method as used for other frames.
  8140. @item pass
  8141. Pass through last frame if input duration has not been reached yet.
  8142. @end table
  8143. The default is @code{round}.
  8144. @end table
  8145. Alternatively, the options can be specified as a flat string:
  8146. @var{fps}[:@var{start_time}[:@var{round}]].
  8147. See also the @ref{setpts} filter.
  8148. @subsection Examples
  8149. @itemize
  8150. @item
  8151. A typical usage in order to set the fps to 25:
  8152. @example
  8153. fps=fps=25
  8154. @end example
  8155. @item
  8156. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  8157. @example
  8158. fps=fps=film:round=near
  8159. @end example
  8160. @end itemize
  8161. @section framepack
  8162. Pack two different video streams into a stereoscopic video, setting proper
  8163. metadata on supported codecs. The two views should have the same size and
  8164. framerate and processing will stop when the shorter video ends. Please note
  8165. that you may conveniently adjust view properties with the @ref{scale} and
  8166. @ref{fps} filters.
  8167. It accepts the following parameters:
  8168. @table @option
  8169. @item format
  8170. The desired packing format. Supported values are:
  8171. @table @option
  8172. @item sbs
  8173. The views are next to each other (default).
  8174. @item tab
  8175. The views are on top of each other.
  8176. @item lines
  8177. The views are packed by line.
  8178. @item columns
  8179. The views are packed by column.
  8180. @item frameseq
  8181. The views are temporally interleaved.
  8182. @end table
  8183. @end table
  8184. Some examples:
  8185. @example
  8186. # Convert left and right views into a frame-sequential video
  8187. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8188. # Convert views into a side-by-side video with the same output resolution as the input
  8189. 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
  8190. @end example
  8191. @section framerate
  8192. Change the frame rate by interpolating new video output frames from the source
  8193. frames.
  8194. This filter is not designed to function correctly with interlaced media. If
  8195. you wish to change the frame rate of interlaced media then you are required
  8196. to deinterlace before this filter and re-interlace after this filter.
  8197. A description of the accepted options follows.
  8198. @table @option
  8199. @item fps
  8200. Specify the output frames per second. This option can also be specified
  8201. as a value alone. The default is @code{50}.
  8202. @item interp_start
  8203. Specify the start of a range where the output frame will be created as a
  8204. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8205. the default is @code{15}.
  8206. @item interp_end
  8207. Specify the end of a range where the output frame will be created as a
  8208. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8209. the default is @code{240}.
  8210. @item scene
  8211. Specify the level at which a scene change is detected as a value between
  8212. 0 and 100 to indicate a new scene; a low value reflects a low
  8213. probability for the current frame to introduce a new scene, while a higher
  8214. value means the current frame is more likely to be one.
  8215. The default is @code{8.2}.
  8216. @item flags
  8217. Specify flags influencing the filter process.
  8218. Available value for @var{flags} is:
  8219. @table @option
  8220. @item scene_change_detect, scd
  8221. Enable scene change detection using the value of the option @var{scene}.
  8222. This flag is enabled by default.
  8223. @end table
  8224. @end table
  8225. @section framestep
  8226. Select one frame every N-th frame.
  8227. This filter accepts the following option:
  8228. @table @option
  8229. @item step
  8230. Select frame after every @code{step} frames.
  8231. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8232. @end table
  8233. @section freezedetect
  8234. Detect frozen video.
  8235. This filter logs a message and sets frame metadata when it detects that the
  8236. input video has no significant change in content during a specified duration.
  8237. Video freeze detection calculates the mean average absolute difference of all
  8238. the components of video frames and compares it to a noise floor.
  8239. The printed times and duration are expressed in seconds. The
  8240. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8241. whose timestamp equals or exceeds the detection duration and it contains the
  8242. timestamp of the first frame of the freeze. The
  8243. @code{lavfi.freezedetect.freeze_duration} and
  8244. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8245. after the freeze.
  8246. The filter accepts the following options:
  8247. @table @option
  8248. @item noise, n
  8249. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8250. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8251. 0.001.
  8252. @item duration, d
  8253. Set freeze duration until notification (default is 2 seconds).
  8254. @end table
  8255. @anchor{frei0r}
  8256. @section frei0r
  8257. Apply a frei0r effect to the input video.
  8258. To enable the compilation of this filter, you need to install the frei0r
  8259. header and configure FFmpeg with @code{--enable-frei0r}.
  8260. It accepts the following parameters:
  8261. @table @option
  8262. @item filter_name
  8263. The name of the frei0r effect to load. If the environment variable
  8264. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8265. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8266. Otherwise, the standard frei0r paths are searched, in this order:
  8267. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8268. @file{/usr/lib/frei0r-1/}.
  8269. @item filter_params
  8270. A '|'-separated list of parameters to pass to the frei0r effect.
  8271. @end table
  8272. A frei0r effect parameter can be a boolean (its value is either
  8273. "y" or "n"), a double, a color (specified as
  8274. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8275. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8276. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8277. a position (specified as @var{X}/@var{Y}, where
  8278. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8279. The number and types of parameters depend on the loaded effect. If an
  8280. effect parameter is not specified, the default value is set.
  8281. @subsection Examples
  8282. @itemize
  8283. @item
  8284. Apply the distort0r effect, setting the first two double parameters:
  8285. @example
  8286. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8287. @end example
  8288. @item
  8289. Apply the colordistance effect, taking a color as the first parameter:
  8290. @example
  8291. frei0r=colordistance:0.2/0.3/0.4
  8292. frei0r=colordistance:violet
  8293. frei0r=colordistance:0x112233
  8294. @end example
  8295. @item
  8296. Apply the perspective effect, specifying the top left and top right image
  8297. positions:
  8298. @example
  8299. frei0r=perspective:0.2/0.2|0.8/0.2
  8300. @end example
  8301. @end itemize
  8302. For more information, see
  8303. @url{http://frei0r.dyne.org}
  8304. @section fspp
  8305. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8306. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8307. processing filter, one of them is performed once per block, not per pixel.
  8308. This allows for much higher speed.
  8309. The filter accepts the following options:
  8310. @table @option
  8311. @item quality
  8312. Set quality. This option defines the number of levels for averaging. It accepts
  8313. an integer in the range 4-5. Default value is @code{4}.
  8314. @item qp
  8315. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8316. If not set, the filter will use the QP from the video stream (if available).
  8317. @item strength
  8318. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8319. more details but also more artifacts, while higher values make the image smoother
  8320. but also blurrier. Default value is @code{0} − PSNR optimal.
  8321. @item use_bframe_qp
  8322. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8323. option may cause flicker since the B-Frames have often larger QP. Default is
  8324. @code{0} (not enabled).
  8325. @end table
  8326. @section gblur
  8327. Apply Gaussian blur filter.
  8328. The filter accepts the following options:
  8329. @table @option
  8330. @item sigma
  8331. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8332. @item steps
  8333. Set number of steps for Gaussian approximation. Default is @code{1}.
  8334. @item planes
  8335. Set which planes to filter. By default all planes are filtered.
  8336. @item sigmaV
  8337. Set vertical sigma, if negative it will be same as @code{sigma}.
  8338. Default is @code{-1}.
  8339. @end table
  8340. @subsection Commands
  8341. This filter supports same commands as options.
  8342. The command accepts the same syntax of the corresponding option.
  8343. If the specified expression is not valid, it is kept at its current
  8344. value.
  8345. @section geq
  8346. Apply generic equation to each pixel.
  8347. The filter accepts the following options:
  8348. @table @option
  8349. @item lum_expr, lum
  8350. Set the luminance expression.
  8351. @item cb_expr, cb
  8352. Set the chrominance blue expression.
  8353. @item cr_expr, cr
  8354. Set the chrominance red expression.
  8355. @item alpha_expr, a
  8356. Set the alpha expression.
  8357. @item red_expr, r
  8358. Set the red expression.
  8359. @item green_expr, g
  8360. Set the green expression.
  8361. @item blue_expr, b
  8362. Set the blue expression.
  8363. @end table
  8364. The colorspace is selected according to the specified options. If one
  8365. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8366. options is specified, the filter will automatically select a YCbCr
  8367. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8368. @option{blue_expr} options is specified, it will select an RGB
  8369. colorspace.
  8370. If one of the chrominance expression is not defined, it falls back on the other
  8371. one. If no alpha expression is specified it will evaluate to opaque value.
  8372. If none of chrominance expressions are specified, they will evaluate
  8373. to the luminance expression.
  8374. The expressions can use the following variables and functions:
  8375. @table @option
  8376. @item N
  8377. The sequential number of the filtered frame, starting from @code{0}.
  8378. @item X
  8379. @item Y
  8380. The coordinates of the current sample.
  8381. @item W
  8382. @item H
  8383. The width and height of the image.
  8384. @item SW
  8385. @item SH
  8386. Width and height scale depending on the currently filtered plane. It is the
  8387. ratio between the corresponding luma plane number of pixels and the current
  8388. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8389. @code{0.5,0.5} for chroma planes.
  8390. @item T
  8391. Time of the current frame, expressed in seconds.
  8392. @item p(x, y)
  8393. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8394. plane.
  8395. @item lum(x, y)
  8396. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8397. plane.
  8398. @item cb(x, y)
  8399. Return the value of the pixel at location (@var{x},@var{y}) of the
  8400. blue-difference chroma plane. Return 0 if there is no such plane.
  8401. @item cr(x, y)
  8402. Return the value of the pixel at location (@var{x},@var{y}) of the
  8403. red-difference chroma plane. Return 0 if there is no such plane.
  8404. @item r(x, y)
  8405. @item g(x, y)
  8406. @item b(x, y)
  8407. Return the value of the pixel at location (@var{x},@var{y}) of the
  8408. red/green/blue component. Return 0 if there is no such component.
  8409. @item alpha(x, y)
  8410. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8411. plane. Return 0 if there is no such plane.
  8412. @end table
  8413. For functions, if @var{x} and @var{y} are outside the area, the value will be
  8414. automatically clipped to the closer edge.
  8415. @subsection Examples
  8416. @itemize
  8417. @item
  8418. Flip the image horizontally:
  8419. @example
  8420. geq=p(W-X\,Y)
  8421. @end example
  8422. @item
  8423. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  8424. wavelength of 100 pixels:
  8425. @example
  8426. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  8427. @end example
  8428. @item
  8429. Generate a fancy enigmatic moving light:
  8430. @example
  8431. 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
  8432. @end example
  8433. @item
  8434. Generate a quick emboss effect:
  8435. @example
  8436. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  8437. @end example
  8438. @item
  8439. Modify RGB components depending on pixel position:
  8440. @example
  8441. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  8442. @end example
  8443. @item
  8444. Create a radial gradient that is the same size as the input (also see
  8445. the @ref{vignette} filter):
  8446. @example
  8447. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8448. @end example
  8449. @end itemize
  8450. @section gradfun
  8451. Fix the banding artifacts that are sometimes introduced into nearly flat
  8452. regions by truncation to 8-bit color depth.
  8453. Interpolate the gradients that should go where the bands are, and
  8454. dither them.
  8455. It is designed for playback only. Do not use it prior to
  8456. lossy compression, because compression tends to lose the dither and
  8457. bring back the bands.
  8458. It accepts the following parameters:
  8459. @table @option
  8460. @item strength
  8461. The maximum amount by which the filter will change any one pixel. This is also
  8462. the threshold for detecting nearly flat regions. Acceptable values range from
  8463. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8464. valid range.
  8465. @item radius
  8466. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8467. gradients, but also prevents the filter from modifying the pixels near detailed
  8468. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8469. values will be clipped to the valid range.
  8470. @end table
  8471. Alternatively, the options can be specified as a flat string:
  8472. @var{strength}[:@var{radius}]
  8473. @subsection Examples
  8474. @itemize
  8475. @item
  8476. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8477. @example
  8478. gradfun=3.5:8
  8479. @end example
  8480. @item
  8481. Specify radius, omitting the strength (which will fall-back to the default
  8482. value):
  8483. @example
  8484. gradfun=radius=8
  8485. @end example
  8486. @end itemize
  8487. @section graphmonitor, agraphmonitor
  8488. Show various filtergraph stats.
  8489. With this filter one can debug complete filtergraph.
  8490. Especially issues with links filling with queued frames.
  8491. The filter accepts the following options:
  8492. @table @option
  8493. @item size, s
  8494. Set video output size. Default is @var{hd720}.
  8495. @item opacity, o
  8496. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8497. @item mode, m
  8498. Set output mode, can be @var{fulll} or @var{compact}.
  8499. In @var{compact} mode only filters with some queued frames have displayed stats.
  8500. @item flags, f
  8501. Set flags which enable which stats are shown in video.
  8502. Available values for flags are:
  8503. @table @samp
  8504. @item queue
  8505. Display number of queued frames in each link.
  8506. @item frame_count_in
  8507. Display number of frames taken from filter.
  8508. @item frame_count_out
  8509. Display number of frames given out from filter.
  8510. @item pts
  8511. Display current filtered frame pts.
  8512. @item time
  8513. Display current filtered frame time.
  8514. @item timebase
  8515. Display time base for filter link.
  8516. @item format
  8517. Display used format for filter link.
  8518. @item size
  8519. Display video size or number of audio channels in case of audio used by filter link.
  8520. @item rate
  8521. Display video frame rate or sample rate in case of audio used by filter link.
  8522. @end table
  8523. @item rate, r
  8524. Set upper limit for video rate of output stream, Default value is @var{25}.
  8525. This guarantee that output video frame rate will not be higher than this value.
  8526. @end table
  8527. @section greyedge
  8528. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8529. and corrects the scene colors accordingly.
  8530. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8531. The filter accepts the following options:
  8532. @table @option
  8533. @item difford
  8534. The order of differentiation to be applied on the scene. Must be chosen in the range
  8535. [0,2] and default value is 1.
  8536. @item minknorm
  8537. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8538. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8539. max value instead of calculating Minkowski distance.
  8540. @item sigma
  8541. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8542. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8543. can't be equal to 0 if @var{difford} is greater than 0.
  8544. @end table
  8545. @subsection Examples
  8546. @itemize
  8547. @item
  8548. Grey Edge:
  8549. @example
  8550. greyedge=difford=1:minknorm=5:sigma=2
  8551. @end example
  8552. @item
  8553. Max Edge:
  8554. @example
  8555. greyedge=difford=1:minknorm=0:sigma=2
  8556. @end example
  8557. @end itemize
  8558. @anchor{haldclut}
  8559. @section haldclut
  8560. Apply a Hald CLUT to a video stream.
  8561. First input is the video stream to process, and second one is the Hald CLUT.
  8562. The Hald CLUT input can be a simple picture or a complete video stream.
  8563. The filter accepts the following options:
  8564. @table @option
  8565. @item shortest
  8566. Force termination when the shortest input terminates. Default is @code{0}.
  8567. @item repeatlast
  8568. Continue applying the last CLUT after the end of the stream. A value of
  8569. @code{0} disable the filter after the last frame of the CLUT is reached.
  8570. Default is @code{1}.
  8571. @end table
  8572. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8573. filters share the same internals).
  8574. This filter also supports the @ref{framesync} options.
  8575. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8576. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8577. @subsection Workflow examples
  8578. @subsubsection Hald CLUT video stream
  8579. Generate an identity Hald CLUT stream altered with various effects:
  8580. @example
  8581. 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
  8582. @end example
  8583. Note: make sure you use a lossless codec.
  8584. Then use it with @code{haldclut} to apply it on some random stream:
  8585. @example
  8586. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8587. @end example
  8588. The Hald CLUT will be applied to the 10 first seconds (duration of
  8589. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8590. to the remaining frames of the @code{mandelbrot} stream.
  8591. @subsubsection Hald CLUT with preview
  8592. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8593. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8594. biggest possible square starting at the top left of the picture. The remaining
  8595. padding pixels (bottom or right) will be ignored. This area can be used to add
  8596. a preview of the Hald CLUT.
  8597. Typically, the following generated Hald CLUT will be supported by the
  8598. @code{haldclut} filter:
  8599. @example
  8600. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8601. pad=iw+320 [padded_clut];
  8602. smptebars=s=320x256, split [a][b];
  8603. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8604. [main][b] overlay=W-320" -frames:v 1 clut.png
  8605. @end example
  8606. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8607. bars are displayed on the right-top, and below the same color bars processed by
  8608. the color changes.
  8609. Then, the effect of this Hald CLUT can be visualized with:
  8610. @example
  8611. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8612. @end example
  8613. @section hflip
  8614. Flip the input video horizontally.
  8615. For example, to horizontally flip the input video with @command{ffmpeg}:
  8616. @example
  8617. ffmpeg -i in.avi -vf "hflip" out.avi
  8618. @end example
  8619. @section histeq
  8620. This filter applies a global color histogram equalization on a
  8621. per-frame basis.
  8622. It can be used to correct video that has a compressed range of pixel
  8623. intensities. The filter redistributes the pixel intensities to
  8624. equalize their distribution across the intensity range. It may be
  8625. viewed as an "automatically adjusting contrast filter". This filter is
  8626. useful only for correcting degraded or poorly captured source
  8627. video.
  8628. The filter accepts the following options:
  8629. @table @option
  8630. @item strength
  8631. Determine the amount of equalization to be applied. As the strength
  8632. is reduced, the distribution of pixel intensities more-and-more
  8633. approaches that of the input frame. The value must be a float number
  8634. in the range [0,1] and defaults to 0.200.
  8635. @item intensity
  8636. Set the maximum intensity that can generated and scale the output
  8637. values appropriately. The strength should be set as desired and then
  8638. the intensity can be limited if needed to avoid washing-out. The value
  8639. must be a float number in the range [0,1] and defaults to 0.210.
  8640. @item antibanding
  8641. Set the antibanding level. If enabled the filter will randomly vary
  8642. the luminance of output pixels by a small amount to avoid banding of
  8643. the histogram. Possible values are @code{none}, @code{weak} or
  8644. @code{strong}. It defaults to @code{none}.
  8645. @end table
  8646. @section histogram
  8647. Compute and draw a color distribution histogram for the input video.
  8648. The computed histogram is a representation of the color component
  8649. distribution in an image.
  8650. Standard histogram displays the color components distribution in an image.
  8651. Displays color graph for each color component. Shows distribution of
  8652. the Y, U, V, A or R, G, B components, depending on input format, in the
  8653. current frame. Below each graph a color component scale meter is shown.
  8654. The filter accepts the following options:
  8655. @table @option
  8656. @item level_height
  8657. Set height of level. Default value is @code{200}.
  8658. Allowed range is [50, 2048].
  8659. @item scale_height
  8660. Set height of color scale. Default value is @code{12}.
  8661. Allowed range is [0, 40].
  8662. @item display_mode
  8663. Set display mode.
  8664. It accepts the following values:
  8665. @table @samp
  8666. @item stack
  8667. Per color component graphs are placed below each other.
  8668. @item parade
  8669. Per color component graphs are placed side by side.
  8670. @item overlay
  8671. Presents information identical to that in the @code{parade}, except
  8672. that the graphs representing color components are superimposed directly
  8673. over one another.
  8674. @end table
  8675. Default is @code{stack}.
  8676. @item levels_mode
  8677. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8678. Default is @code{linear}.
  8679. @item components
  8680. Set what color components to display.
  8681. Default is @code{7}.
  8682. @item fgopacity
  8683. Set foreground opacity. Default is @code{0.7}.
  8684. @item bgopacity
  8685. Set background opacity. Default is @code{0.5}.
  8686. @end table
  8687. @subsection Examples
  8688. @itemize
  8689. @item
  8690. Calculate and draw histogram:
  8691. @example
  8692. ffplay -i input -vf histogram
  8693. @end example
  8694. @end itemize
  8695. @anchor{hqdn3d}
  8696. @section hqdn3d
  8697. This is a high precision/quality 3d denoise filter. It aims to reduce
  8698. image noise, producing smooth images and making still images really
  8699. still. It should enhance compressibility.
  8700. It accepts the following optional parameters:
  8701. @table @option
  8702. @item luma_spatial
  8703. A non-negative floating point number which specifies spatial luma strength.
  8704. It defaults to 4.0.
  8705. @item chroma_spatial
  8706. A non-negative floating point number which specifies spatial chroma strength.
  8707. It defaults to 3.0*@var{luma_spatial}/4.0.
  8708. @item luma_tmp
  8709. A floating point number which specifies luma temporal strength. It defaults to
  8710. 6.0*@var{luma_spatial}/4.0.
  8711. @item chroma_tmp
  8712. A floating point number which specifies chroma temporal strength. It defaults to
  8713. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8714. @end table
  8715. @anchor{hwdownload}
  8716. @section hwdownload
  8717. Download hardware frames to system memory.
  8718. The input must be in hardware frames, and the output a non-hardware format.
  8719. Not all formats will be supported on the output - it may be necessary to insert
  8720. an additional @option{format} filter immediately following in the graph to get
  8721. the output in a supported format.
  8722. @section hwmap
  8723. Map hardware frames to system memory or to another device.
  8724. This filter has several different modes of operation; which one is used depends
  8725. on the input and output formats:
  8726. @itemize
  8727. @item
  8728. Hardware frame input, normal frame output
  8729. Map the input frames to system memory and pass them to the output. If the
  8730. original hardware frame is later required (for example, after overlaying
  8731. something else on part of it), the @option{hwmap} filter can be used again
  8732. in the next mode to retrieve it.
  8733. @item
  8734. Normal frame input, hardware frame output
  8735. If the input is actually a software-mapped hardware frame, then unmap it -
  8736. that is, return the original hardware frame.
  8737. Otherwise, a device must be provided. Create new hardware surfaces on that
  8738. device for the output, then map them back to the software format at the input
  8739. and give those frames to the preceding filter. This will then act like the
  8740. @option{hwupload} filter, but may be able to avoid an additional copy when
  8741. the input is already in a compatible format.
  8742. @item
  8743. Hardware frame input and output
  8744. A device must be supplied for the output, either directly or with the
  8745. @option{derive_device} option. The input and output devices must be of
  8746. different types and compatible - the exact meaning of this is
  8747. system-dependent, but typically it means that they must refer to the same
  8748. underlying hardware context (for example, refer to the same graphics card).
  8749. If the input frames were originally created on the output device, then unmap
  8750. to retrieve the original frames.
  8751. Otherwise, map the frames to the output device - create new hardware frames
  8752. on the output corresponding to the frames on the input.
  8753. @end itemize
  8754. The following additional parameters are accepted:
  8755. @table @option
  8756. @item mode
  8757. Set the frame mapping mode. Some combination of:
  8758. @table @var
  8759. @item read
  8760. The mapped frame should be readable.
  8761. @item write
  8762. The mapped frame should be writeable.
  8763. @item overwrite
  8764. The mapping will always overwrite the entire frame.
  8765. This may improve performance in some cases, as the original contents of the
  8766. frame need not be loaded.
  8767. @item direct
  8768. The mapping must not involve any copying.
  8769. Indirect mappings to copies of frames are created in some cases where either
  8770. direct mapping is not possible or it would have unexpected properties.
  8771. Setting this flag ensures that the mapping is direct and will fail if that is
  8772. not possible.
  8773. @end table
  8774. Defaults to @var{read+write} if not specified.
  8775. @item derive_device @var{type}
  8776. Rather than using the device supplied at initialisation, instead derive a new
  8777. device of type @var{type} from the device the input frames exist on.
  8778. @item reverse
  8779. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8780. and map them back to the source. This may be necessary in some cases where
  8781. a mapping in one direction is required but only the opposite direction is
  8782. supported by the devices being used.
  8783. This option is dangerous - it may break the preceding filter in undefined
  8784. ways if there are any additional constraints on that filter's output.
  8785. Do not use it without fully understanding the implications of its use.
  8786. @end table
  8787. @anchor{hwupload}
  8788. @section hwupload
  8789. Upload system memory frames to hardware surfaces.
  8790. The device to upload to must be supplied when the filter is initialised. If
  8791. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8792. option.
  8793. @anchor{hwupload_cuda}
  8794. @section hwupload_cuda
  8795. Upload system memory frames to a CUDA device.
  8796. It accepts the following optional parameters:
  8797. @table @option
  8798. @item device
  8799. The number of the CUDA device to use
  8800. @end table
  8801. @section hqx
  8802. Apply a high-quality magnification filter designed for pixel art. This filter
  8803. was originally created by Maxim Stepin.
  8804. It accepts the following option:
  8805. @table @option
  8806. @item n
  8807. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8808. @code{hq3x} and @code{4} for @code{hq4x}.
  8809. Default is @code{3}.
  8810. @end table
  8811. @section hstack
  8812. Stack input videos horizontally.
  8813. All streams must be of same pixel format and of same height.
  8814. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8815. to create same output.
  8816. The filter accepts the following option:
  8817. @table @option
  8818. @item inputs
  8819. Set number of input streams. Default is 2.
  8820. @item shortest
  8821. If set to 1, force the output to terminate when the shortest input
  8822. terminates. Default value is 0.
  8823. @end table
  8824. @section hue
  8825. Modify the hue and/or the saturation of the input.
  8826. It accepts the following parameters:
  8827. @table @option
  8828. @item h
  8829. Specify the hue angle as a number of degrees. It accepts an expression,
  8830. and defaults to "0".
  8831. @item s
  8832. Specify the saturation in the [-10,10] range. It accepts an expression and
  8833. defaults to "1".
  8834. @item H
  8835. Specify the hue angle as a number of radians. It accepts an
  8836. expression, and defaults to "0".
  8837. @item b
  8838. Specify the brightness in the [-10,10] range. It accepts an expression and
  8839. defaults to "0".
  8840. @end table
  8841. @option{h} and @option{H} are mutually exclusive, and can't be
  8842. specified at the same time.
  8843. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8844. expressions containing the following constants:
  8845. @table @option
  8846. @item n
  8847. frame count of the input frame starting from 0
  8848. @item pts
  8849. presentation timestamp of the input frame expressed in time base units
  8850. @item r
  8851. frame rate of the input video, NAN if the input frame rate is unknown
  8852. @item t
  8853. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8854. @item tb
  8855. time base of the input video
  8856. @end table
  8857. @subsection Examples
  8858. @itemize
  8859. @item
  8860. Set the hue to 90 degrees and the saturation to 1.0:
  8861. @example
  8862. hue=h=90:s=1
  8863. @end example
  8864. @item
  8865. Same command but expressing the hue in radians:
  8866. @example
  8867. hue=H=PI/2:s=1
  8868. @end example
  8869. @item
  8870. Rotate hue and make the saturation swing between 0
  8871. and 2 over a period of 1 second:
  8872. @example
  8873. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8874. @end example
  8875. @item
  8876. Apply a 3 seconds saturation fade-in effect starting at 0:
  8877. @example
  8878. hue="s=min(t/3\,1)"
  8879. @end example
  8880. The general fade-in expression can be written as:
  8881. @example
  8882. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8883. @end example
  8884. @item
  8885. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8886. @example
  8887. hue="s=max(0\, min(1\, (8-t)/3))"
  8888. @end example
  8889. The general fade-out expression can be written as:
  8890. @example
  8891. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8892. @end example
  8893. @end itemize
  8894. @subsection Commands
  8895. This filter supports the following commands:
  8896. @table @option
  8897. @item b
  8898. @item s
  8899. @item h
  8900. @item H
  8901. Modify the hue and/or the saturation and/or brightness of the input video.
  8902. The command accepts the same syntax of the corresponding option.
  8903. If the specified expression is not valid, it is kept at its current
  8904. value.
  8905. @end table
  8906. @section hysteresis
  8907. Grow first stream into second stream by connecting components.
  8908. This makes it possible to build more robust edge masks.
  8909. This filter accepts the following options:
  8910. @table @option
  8911. @item planes
  8912. Set which planes will be processed as bitmap, unprocessed planes will be
  8913. copied from first stream.
  8914. By default value 0xf, all planes will be processed.
  8915. @item threshold
  8916. Set threshold which is used in filtering. If pixel component value is higher than
  8917. this value filter algorithm for connecting components is activated.
  8918. By default value is 0.
  8919. @end table
  8920. @section idet
  8921. Detect video interlacing type.
  8922. This filter tries to detect if the input frames are interlaced, progressive,
  8923. top or bottom field first. It will also try to detect fields that are
  8924. repeated between adjacent frames (a sign of telecine).
  8925. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8926. Multiple frame detection incorporates the classification history of previous frames.
  8927. The filter will log these metadata values:
  8928. @table @option
  8929. @item single.current_frame
  8930. Detected type of current frame using single-frame detection. One of:
  8931. ``tff'' (top field first), ``bff'' (bottom field first),
  8932. ``progressive'', or ``undetermined''
  8933. @item single.tff
  8934. Cumulative number of frames detected as top field first using single-frame detection.
  8935. @item multiple.tff
  8936. Cumulative number of frames detected as top field first using multiple-frame detection.
  8937. @item single.bff
  8938. Cumulative number of frames detected as bottom field first using single-frame detection.
  8939. @item multiple.current_frame
  8940. Detected type of current frame using multiple-frame detection. One of:
  8941. ``tff'' (top field first), ``bff'' (bottom field first),
  8942. ``progressive'', or ``undetermined''
  8943. @item multiple.bff
  8944. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8945. @item single.progressive
  8946. Cumulative number of frames detected as progressive using single-frame detection.
  8947. @item multiple.progressive
  8948. Cumulative number of frames detected as progressive using multiple-frame detection.
  8949. @item single.undetermined
  8950. Cumulative number of frames that could not be classified using single-frame detection.
  8951. @item multiple.undetermined
  8952. Cumulative number of frames that could not be classified using multiple-frame detection.
  8953. @item repeated.current_frame
  8954. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8955. @item repeated.neither
  8956. Cumulative number of frames with no repeated field.
  8957. @item repeated.top
  8958. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8959. @item repeated.bottom
  8960. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8961. @end table
  8962. The filter accepts the following options:
  8963. @table @option
  8964. @item intl_thres
  8965. Set interlacing threshold.
  8966. @item prog_thres
  8967. Set progressive threshold.
  8968. @item rep_thres
  8969. Threshold for repeated field detection.
  8970. @item half_life
  8971. Number of frames after which a given frame's contribution to the
  8972. statistics is halved (i.e., it contributes only 0.5 to its
  8973. classification). The default of 0 means that all frames seen are given
  8974. full weight of 1.0 forever.
  8975. @item analyze_interlaced_flag
  8976. When this is not 0 then idet will use the specified number of frames to determine
  8977. if the interlaced flag is accurate, it will not count undetermined frames.
  8978. If the flag is found to be accurate it will be used without any further
  8979. computations, if it is found to be inaccurate it will be cleared without any
  8980. further computations. This allows inserting the idet filter as a low computational
  8981. method to clean up the interlaced flag
  8982. @end table
  8983. @section il
  8984. Deinterleave or interleave fields.
  8985. This filter allows one to process interlaced images fields without
  8986. deinterlacing them. Deinterleaving splits the input frame into 2
  8987. fields (so called half pictures). Odd lines are moved to the top
  8988. half of the output image, even lines to the bottom half.
  8989. You can process (filter) them independently and then re-interleave them.
  8990. The filter accepts the following options:
  8991. @table @option
  8992. @item luma_mode, l
  8993. @item chroma_mode, c
  8994. @item alpha_mode, a
  8995. Available values for @var{luma_mode}, @var{chroma_mode} and
  8996. @var{alpha_mode} are:
  8997. @table @samp
  8998. @item none
  8999. Do nothing.
  9000. @item deinterleave, d
  9001. Deinterleave fields, placing one above the other.
  9002. @item interleave, i
  9003. Interleave fields. Reverse the effect of deinterleaving.
  9004. @end table
  9005. Default value is @code{none}.
  9006. @item luma_swap, ls
  9007. @item chroma_swap, cs
  9008. @item alpha_swap, as
  9009. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  9010. @end table
  9011. @section inflate
  9012. Apply inflate effect to the video.
  9013. This filter replaces the pixel by the local(3x3) average by taking into account
  9014. only values higher than the pixel.
  9015. It accepts the following options:
  9016. @table @option
  9017. @item threshold0
  9018. @item threshold1
  9019. @item threshold2
  9020. @item threshold3
  9021. Limit the maximum change for each plane, default is 65535.
  9022. If 0, plane will remain unchanged.
  9023. @end table
  9024. @section interlace
  9025. Simple interlacing filter from progressive contents. This interleaves upper (or
  9026. lower) lines from odd frames with lower (or upper) lines from even frames,
  9027. halving the frame rate and preserving image height.
  9028. @example
  9029. Original Original New Frame
  9030. Frame 'j' Frame 'j+1' (tff)
  9031. ========== =========== ==================
  9032. Line 0 --------------------> Frame 'j' Line 0
  9033. Line 1 Line 1 ----> Frame 'j+1' Line 1
  9034. Line 2 ---------------------> Frame 'j' Line 2
  9035. Line 3 Line 3 ----> Frame 'j+1' Line 3
  9036. ... ... ...
  9037. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  9038. @end example
  9039. It accepts the following optional parameters:
  9040. @table @option
  9041. @item scan
  9042. This determines whether the interlaced frame is taken from the even
  9043. (tff - default) or odd (bff) lines of the progressive frame.
  9044. @item lowpass
  9045. Vertical lowpass filter to avoid twitter interlacing and
  9046. reduce moire patterns.
  9047. @table @samp
  9048. @item 0, off
  9049. Disable vertical lowpass filter
  9050. @item 1, linear
  9051. Enable linear filter (default)
  9052. @item 2, complex
  9053. Enable complex filter. This will slightly less reduce twitter and moire
  9054. but better retain detail and subjective sharpness impression.
  9055. @end table
  9056. @end table
  9057. @section kerndeint
  9058. Deinterlace input video by applying Donald Graft's adaptive kernel
  9059. deinterling. Work on interlaced parts of a video to produce
  9060. progressive frames.
  9061. The description of the accepted parameters follows.
  9062. @table @option
  9063. @item thresh
  9064. Set the threshold which affects the filter's tolerance when
  9065. determining if a pixel line must be processed. It must be an integer
  9066. in the range [0,255] and defaults to 10. A value of 0 will result in
  9067. applying the process on every pixels.
  9068. @item map
  9069. Paint pixels exceeding the threshold value to white if set to 1.
  9070. Default is 0.
  9071. @item order
  9072. Set the fields order. Swap fields if set to 1, leave fields alone if
  9073. 0. Default is 0.
  9074. @item sharp
  9075. Enable additional sharpening if set to 1. Default is 0.
  9076. @item twoway
  9077. Enable twoway sharpening if set to 1. Default is 0.
  9078. @end table
  9079. @subsection Examples
  9080. @itemize
  9081. @item
  9082. Apply default values:
  9083. @example
  9084. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  9085. @end example
  9086. @item
  9087. Enable additional sharpening:
  9088. @example
  9089. kerndeint=sharp=1
  9090. @end example
  9091. @item
  9092. Paint processed pixels in white:
  9093. @example
  9094. kerndeint=map=1
  9095. @end example
  9096. @end itemize
  9097. @section lagfun
  9098. Slowly update darker pixels.
  9099. This filter makes short flashes of light appear longer.
  9100. This filter accepts the following options:
  9101. @table @option
  9102. @item decay
  9103. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  9104. @item planes
  9105. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  9106. @end table
  9107. @section lenscorrection
  9108. Correct radial lens distortion
  9109. This filter can be used to correct for radial distortion as can result from the use
  9110. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  9111. one can use tools available for example as part of opencv or simply trial-and-error.
  9112. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  9113. and extract the k1 and k2 coefficients from the resulting matrix.
  9114. Note that effectively the same filter is available in the open-source tools Krita and
  9115. Digikam from the KDE project.
  9116. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  9117. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  9118. brightness distribution, so you may want to use both filters together in certain
  9119. cases, though you will have to take care of ordering, i.e. whether vignetting should
  9120. be applied before or after lens correction.
  9121. @subsection Options
  9122. The filter accepts the following options:
  9123. @table @option
  9124. @item cx
  9125. Relative x-coordinate of the focal point of the image, and thereby the center of the
  9126. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9127. width. Default is 0.5.
  9128. @item cy
  9129. Relative y-coordinate of the focal point of the image, and thereby the center of the
  9130. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9131. height. Default is 0.5.
  9132. @item k1
  9133. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  9134. no correction. Default is 0.
  9135. @item k2
  9136. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  9137. 0 means no correction. Default is 0.
  9138. @end table
  9139. The formula that generates the correction is:
  9140. @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)
  9141. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  9142. distances from the focal point in the source and target images, respectively.
  9143. @section lensfun
  9144. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  9145. The @code{lensfun} filter requires the camera make, camera model, and lens model
  9146. to apply the lens correction. The filter will load the lensfun database and
  9147. query it to find the corresponding camera and lens entries in the database. As
  9148. long as these entries can be found with the given options, the filter can
  9149. perform corrections on frames. Note that incomplete strings will result in the
  9150. filter choosing the best match with the given options, and the filter will
  9151. output the chosen camera and lens models (logged with level "info"). You must
  9152. provide the make, camera model, and lens model as they are required.
  9153. The filter accepts the following options:
  9154. @table @option
  9155. @item make
  9156. The make of the camera (for example, "Canon"). This option is required.
  9157. @item model
  9158. The model of the camera (for example, "Canon EOS 100D"). This option is
  9159. required.
  9160. @item lens_model
  9161. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  9162. option is required.
  9163. @item mode
  9164. The type of correction to apply. The following values are valid options:
  9165. @table @samp
  9166. @item vignetting
  9167. Enables fixing lens vignetting.
  9168. @item geometry
  9169. Enables fixing lens geometry. This is the default.
  9170. @item subpixel
  9171. Enables fixing chromatic aberrations.
  9172. @item vig_geo
  9173. Enables fixing lens vignetting and lens geometry.
  9174. @item vig_subpixel
  9175. Enables fixing lens vignetting and chromatic aberrations.
  9176. @item distortion
  9177. Enables fixing both lens geometry and chromatic aberrations.
  9178. @item all
  9179. Enables all possible corrections.
  9180. @end table
  9181. @item focal_length
  9182. The focal length of the image/video (zoom; expected constant for video). For
  9183. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  9184. range should be chosen when using that lens. Default 18.
  9185. @item aperture
  9186. The aperture of the image/video (expected constant for video). Note that
  9187. aperture is only used for vignetting correction. Default 3.5.
  9188. @item focus_distance
  9189. The focus distance of the image/video (expected constant for video). Note that
  9190. focus distance is only used for vignetting and only slightly affects the
  9191. vignetting correction process. If unknown, leave it at the default value (which
  9192. is 1000).
  9193. @item scale
  9194. The scale factor which is applied after transformation. After correction the
  9195. video is no longer necessarily rectangular. This parameter controls how much of
  9196. the resulting image is visible. The value 0 means that a value will be chosen
  9197. automatically such that there is little or no unmapped area in the output
  9198. image. 1.0 means that no additional scaling is done. Lower values may result
  9199. in more of the corrected image being visible, while higher values may avoid
  9200. unmapped areas in the output.
  9201. @item target_geometry
  9202. The target geometry of the output image/video. The following values are valid
  9203. options:
  9204. @table @samp
  9205. @item rectilinear (default)
  9206. @item fisheye
  9207. @item panoramic
  9208. @item equirectangular
  9209. @item fisheye_orthographic
  9210. @item fisheye_stereographic
  9211. @item fisheye_equisolid
  9212. @item fisheye_thoby
  9213. @end table
  9214. @item reverse
  9215. Apply the reverse of image correction (instead of correcting distortion, apply
  9216. it).
  9217. @item interpolation
  9218. The type of interpolation used when correcting distortion. The following values
  9219. are valid options:
  9220. @table @samp
  9221. @item nearest
  9222. @item linear (default)
  9223. @item lanczos
  9224. @end table
  9225. @end table
  9226. @subsection Examples
  9227. @itemize
  9228. @item
  9229. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9230. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9231. aperture of "8.0".
  9232. @example
  9233. 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
  9234. @end example
  9235. @item
  9236. Apply the same as before, but only for the first 5 seconds of video.
  9237. @example
  9238. 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
  9239. @end example
  9240. @end itemize
  9241. @section libvmaf
  9242. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9243. score between two input videos.
  9244. The obtained VMAF score is printed through the logging system.
  9245. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9246. After installing the library it can be enabled using:
  9247. @code{./configure --enable-libvmaf --enable-version3}.
  9248. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9249. The filter has following options:
  9250. @table @option
  9251. @item model_path
  9252. Set the model path which is to be used for SVM.
  9253. Default value: @code{"vmaf_v0.6.1.pkl"}
  9254. @item log_path
  9255. Set the file path to be used to store logs.
  9256. @item log_fmt
  9257. Set the format of the log file (xml or json).
  9258. @item enable_transform
  9259. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  9260. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  9261. Default value: @code{false}
  9262. @item phone_model
  9263. Invokes the phone model which will generate VMAF scores higher than in the
  9264. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  9265. @item psnr
  9266. Enables computing psnr along with vmaf.
  9267. @item ssim
  9268. Enables computing ssim along with vmaf.
  9269. @item ms_ssim
  9270. Enables computing ms_ssim along with vmaf.
  9271. @item pool
  9272. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  9273. @item n_threads
  9274. Set number of threads to be used when computing vmaf.
  9275. @item n_subsample
  9276. Set interval for frame subsampling used when computing vmaf.
  9277. @item enable_conf_interval
  9278. Enables confidence interval.
  9279. @end table
  9280. This filter also supports the @ref{framesync} options.
  9281. On the below examples the input file @file{main.mpg} being processed is
  9282. compared with the reference file @file{ref.mpg}.
  9283. @example
  9284. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  9285. @end example
  9286. Example with options:
  9287. @example
  9288. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  9289. @end example
  9290. @section limiter
  9291. Limits the pixel components values to the specified range [min, max].
  9292. The filter accepts the following options:
  9293. @table @option
  9294. @item min
  9295. Lower bound. Defaults to the lowest allowed value for the input.
  9296. @item max
  9297. Upper bound. Defaults to the highest allowed value for the input.
  9298. @item planes
  9299. Specify which planes will be processed. Defaults to all available.
  9300. @end table
  9301. @section loop
  9302. Loop video frames.
  9303. The filter accepts the following options:
  9304. @table @option
  9305. @item loop
  9306. Set the number of loops. Setting this value to -1 will result in infinite loops.
  9307. Default is 0.
  9308. @item size
  9309. Set maximal size in number of frames. Default is 0.
  9310. @item start
  9311. Set first frame of loop. Default is 0.
  9312. @end table
  9313. @subsection Examples
  9314. @itemize
  9315. @item
  9316. Loop single first frame infinitely:
  9317. @example
  9318. loop=loop=-1:size=1:start=0
  9319. @end example
  9320. @item
  9321. Loop single first frame 10 times:
  9322. @example
  9323. loop=loop=10:size=1:start=0
  9324. @end example
  9325. @item
  9326. Loop 10 first frames 5 times:
  9327. @example
  9328. loop=loop=5:size=10:start=0
  9329. @end example
  9330. @end itemize
  9331. @section lut1d
  9332. Apply a 1D LUT to an input video.
  9333. The filter accepts the following options:
  9334. @table @option
  9335. @item file
  9336. Set the 1D LUT file name.
  9337. Currently supported formats:
  9338. @table @samp
  9339. @item cube
  9340. Iridas
  9341. @item csp
  9342. cineSpace
  9343. @end table
  9344. @item interp
  9345. Select interpolation mode.
  9346. Available values are:
  9347. @table @samp
  9348. @item nearest
  9349. Use values from the nearest defined point.
  9350. @item linear
  9351. Interpolate values using the linear interpolation.
  9352. @item cosine
  9353. Interpolate values using the cosine interpolation.
  9354. @item cubic
  9355. Interpolate values using the cubic interpolation.
  9356. @item spline
  9357. Interpolate values using the spline interpolation.
  9358. @end table
  9359. @end table
  9360. @anchor{lut3d}
  9361. @section lut3d
  9362. Apply a 3D LUT to an input video.
  9363. The filter accepts the following options:
  9364. @table @option
  9365. @item file
  9366. Set the 3D LUT file name.
  9367. Currently supported formats:
  9368. @table @samp
  9369. @item 3dl
  9370. AfterEffects
  9371. @item cube
  9372. Iridas
  9373. @item dat
  9374. DaVinci
  9375. @item m3d
  9376. Pandora
  9377. @item csp
  9378. cineSpace
  9379. @end table
  9380. @item interp
  9381. Select interpolation mode.
  9382. Available values are:
  9383. @table @samp
  9384. @item nearest
  9385. Use values from the nearest defined point.
  9386. @item trilinear
  9387. Interpolate values using the 8 points defining a cube.
  9388. @item tetrahedral
  9389. Interpolate values using a tetrahedron.
  9390. @end table
  9391. @end table
  9392. @section lumakey
  9393. Turn certain luma values into transparency.
  9394. The filter accepts the following options:
  9395. @table @option
  9396. @item threshold
  9397. Set the luma which will be used as base for transparency.
  9398. Default value is @code{0}.
  9399. @item tolerance
  9400. Set the range of luma values to be keyed out.
  9401. Default value is @code{0}.
  9402. @item softness
  9403. Set the range of softness. Default value is @code{0}.
  9404. Use this to control gradual transition from zero to full transparency.
  9405. @end table
  9406. @section lut, lutrgb, lutyuv
  9407. Compute a look-up table for binding each pixel component input value
  9408. to an output value, and apply it to the input video.
  9409. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  9410. to an RGB input video.
  9411. These filters accept the following parameters:
  9412. @table @option
  9413. @item c0
  9414. set first pixel component expression
  9415. @item c1
  9416. set second pixel component expression
  9417. @item c2
  9418. set third pixel component expression
  9419. @item c3
  9420. set fourth pixel component expression, corresponds to the alpha component
  9421. @item r
  9422. set red component expression
  9423. @item g
  9424. set green component expression
  9425. @item b
  9426. set blue component expression
  9427. @item a
  9428. alpha component expression
  9429. @item y
  9430. set Y/luminance component expression
  9431. @item u
  9432. set U/Cb component expression
  9433. @item v
  9434. set V/Cr component expression
  9435. @end table
  9436. Each of them specifies the expression to use for computing the lookup table for
  9437. the corresponding pixel component values.
  9438. The exact component associated to each of the @var{c*} options depends on the
  9439. format in input.
  9440. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  9441. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  9442. The expressions can contain the following constants and functions:
  9443. @table @option
  9444. @item w
  9445. @item h
  9446. The input width and height.
  9447. @item val
  9448. The input value for the pixel component.
  9449. @item clipval
  9450. The input value, clipped to the @var{minval}-@var{maxval} range.
  9451. @item maxval
  9452. The maximum value for the pixel component.
  9453. @item minval
  9454. The minimum value for the pixel component.
  9455. @item negval
  9456. The negated value for the pixel component value, clipped to the
  9457. @var{minval}-@var{maxval} range; it corresponds to the expression
  9458. "maxval-clipval+minval".
  9459. @item clip(val)
  9460. The computed value in @var{val}, clipped to the
  9461. @var{minval}-@var{maxval} range.
  9462. @item gammaval(gamma)
  9463. The computed gamma correction value of the pixel component value,
  9464. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  9465. expression
  9466. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  9467. @end table
  9468. All expressions default to "val".
  9469. @subsection Examples
  9470. @itemize
  9471. @item
  9472. Negate input video:
  9473. @example
  9474. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  9475. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  9476. @end example
  9477. The above is the same as:
  9478. @example
  9479. lutrgb="r=negval:g=negval:b=negval"
  9480. lutyuv="y=negval:u=negval:v=negval"
  9481. @end example
  9482. @item
  9483. Negate luminance:
  9484. @example
  9485. lutyuv=y=negval
  9486. @end example
  9487. @item
  9488. Remove chroma components, turning the video into a graytone image:
  9489. @example
  9490. lutyuv="u=128:v=128"
  9491. @end example
  9492. @item
  9493. Apply a luma burning effect:
  9494. @example
  9495. lutyuv="y=2*val"
  9496. @end example
  9497. @item
  9498. Remove green and blue components:
  9499. @example
  9500. lutrgb="g=0:b=0"
  9501. @end example
  9502. @item
  9503. Set a constant alpha channel value on input:
  9504. @example
  9505. format=rgba,lutrgb=a="maxval-minval/2"
  9506. @end example
  9507. @item
  9508. Correct luminance gamma by a factor of 0.5:
  9509. @example
  9510. lutyuv=y=gammaval(0.5)
  9511. @end example
  9512. @item
  9513. Discard least significant bits of luma:
  9514. @example
  9515. lutyuv=y='bitand(val, 128+64+32)'
  9516. @end example
  9517. @item
  9518. Technicolor like effect:
  9519. @example
  9520. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9521. @end example
  9522. @end itemize
  9523. @section lut2, tlut2
  9524. The @code{lut2} filter takes two input streams and outputs one
  9525. stream.
  9526. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9527. from one single stream.
  9528. This filter accepts the following parameters:
  9529. @table @option
  9530. @item c0
  9531. set first pixel component expression
  9532. @item c1
  9533. set second pixel component expression
  9534. @item c2
  9535. set third pixel component expression
  9536. @item c3
  9537. set fourth pixel component expression, corresponds to the alpha component
  9538. @item d
  9539. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9540. which means bit depth is automatically picked from first input format.
  9541. @end table
  9542. Each of them specifies the expression to use for computing the lookup table for
  9543. the corresponding pixel component values.
  9544. The exact component associated to each of the @var{c*} options depends on the
  9545. format in inputs.
  9546. The expressions can contain the following constants:
  9547. @table @option
  9548. @item w
  9549. @item h
  9550. The input width and height.
  9551. @item x
  9552. The first input value for the pixel component.
  9553. @item y
  9554. The second input value for the pixel component.
  9555. @item bdx
  9556. The first input video bit depth.
  9557. @item bdy
  9558. The second input video bit depth.
  9559. @end table
  9560. All expressions default to "x".
  9561. @subsection Examples
  9562. @itemize
  9563. @item
  9564. Highlight differences between two RGB video streams:
  9565. @example
  9566. 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)'
  9567. @end example
  9568. @item
  9569. Highlight differences between two YUV video streams:
  9570. @example
  9571. 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)'
  9572. @end example
  9573. @item
  9574. Show max difference between two video streams:
  9575. @example
  9576. 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)))'
  9577. @end example
  9578. @end itemize
  9579. @section maskedclamp
  9580. Clamp the first input stream with the second input and third input stream.
  9581. Returns the value of first stream to be between second input
  9582. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9583. This filter accepts the following options:
  9584. @table @option
  9585. @item undershoot
  9586. Default value is @code{0}.
  9587. @item overshoot
  9588. Default value is @code{0}.
  9589. @item planes
  9590. Set which planes will be processed as bitmap, unprocessed planes will be
  9591. copied from first stream.
  9592. By default value 0xf, all planes will be processed.
  9593. @end table
  9594. @section maskedmerge
  9595. Merge the first input stream with the second input stream using per pixel
  9596. weights in the third input stream.
  9597. A value of 0 in the third stream pixel component means that pixel component
  9598. from first stream is returned unchanged, while maximum value (eg. 255 for
  9599. 8-bit videos) means that pixel component from second stream is returned
  9600. unchanged. Intermediate values define the amount of merging between both
  9601. input stream's pixel components.
  9602. This filter accepts the following options:
  9603. @table @option
  9604. @item planes
  9605. Set which planes will be processed as bitmap, unprocessed planes will be
  9606. copied from first stream.
  9607. By default value 0xf, all planes will be processed.
  9608. @end table
  9609. @section maskfun
  9610. Create mask from input video.
  9611. For example it is useful to create motion masks after @code{tblend} filter.
  9612. This filter accepts the following options:
  9613. @table @option
  9614. @item low
  9615. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  9616. @item high
  9617. Set high threshold. Any pixel component higher than this value will be set to max value
  9618. allowed for current pixel format.
  9619. @item planes
  9620. Set planes to filter, by default all available planes are filtered.
  9621. @item fill
  9622. Fill all frame pixels with this value.
  9623. @item sum
  9624. Set max average pixel value for frame. If sum of all pixel components is higher that this
  9625. average, output frame will be completely filled with value set by @var{fill} option.
  9626. Typically useful for scene changes when used in combination with @code{tblend} filter.
  9627. @end table
  9628. @section mcdeint
  9629. Apply motion-compensation deinterlacing.
  9630. It needs one field per frame as input and must thus be used together
  9631. with yadif=1/3 or equivalent.
  9632. This filter accepts the following options:
  9633. @table @option
  9634. @item mode
  9635. Set the deinterlacing mode.
  9636. It accepts one of the following values:
  9637. @table @samp
  9638. @item fast
  9639. @item medium
  9640. @item slow
  9641. use iterative motion estimation
  9642. @item extra_slow
  9643. like @samp{slow}, but use multiple reference frames.
  9644. @end table
  9645. Default value is @samp{fast}.
  9646. @item parity
  9647. Set the picture field parity assumed for the input video. It must be
  9648. one of the following values:
  9649. @table @samp
  9650. @item 0, tff
  9651. assume top field first
  9652. @item 1, bff
  9653. assume bottom field first
  9654. @end table
  9655. Default value is @samp{bff}.
  9656. @item qp
  9657. Set per-block quantization parameter (QP) used by the internal
  9658. encoder.
  9659. Higher values should result in a smoother motion vector field but less
  9660. optimal individual vectors. Default value is 1.
  9661. @end table
  9662. @section mergeplanes
  9663. Merge color channel components from several video streams.
  9664. The filter accepts up to 4 input streams, and merge selected input
  9665. planes to the output video.
  9666. This filter accepts the following options:
  9667. @table @option
  9668. @item mapping
  9669. Set input to output plane mapping. Default is @code{0}.
  9670. The mappings is specified as a bitmap. It should be specified as a
  9671. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  9672. mapping for the first plane of the output stream. 'A' sets the number of
  9673. the input stream to use (from 0 to 3), and 'a' the plane number of the
  9674. corresponding input to use (from 0 to 3). The rest of the mappings is
  9675. similar, 'Bb' describes the mapping for the output stream second
  9676. plane, 'Cc' describes the mapping for the output stream third plane and
  9677. 'Dd' describes the mapping for the output stream fourth plane.
  9678. @item format
  9679. Set output pixel format. Default is @code{yuva444p}.
  9680. @end table
  9681. @subsection Examples
  9682. @itemize
  9683. @item
  9684. Merge three gray video streams of same width and height into single video stream:
  9685. @example
  9686. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  9687. @end example
  9688. @item
  9689. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  9690. @example
  9691. [a0][a1]mergeplanes=0x00010210:yuva444p
  9692. @end example
  9693. @item
  9694. Swap Y and A plane in yuva444p stream:
  9695. @example
  9696. format=yuva444p,mergeplanes=0x03010200:yuva444p
  9697. @end example
  9698. @item
  9699. Swap U and V plane in yuv420p stream:
  9700. @example
  9701. format=yuv420p,mergeplanes=0x000201:yuv420p
  9702. @end example
  9703. @item
  9704. Cast a rgb24 clip to yuv444p:
  9705. @example
  9706. format=rgb24,mergeplanes=0x000102:yuv444p
  9707. @end example
  9708. @end itemize
  9709. @section mestimate
  9710. Estimate and export motion vectors using block matching algorithms.
  9711. Motion vectors are stored in frame side data to be used by other filters.
  9712. This filter accepts the following options:
  9713. @table @option
  9714. @item method
  9715. Specify the motion estimation method. Accepts one of the following values:
  9716. @table @samp
  9717. @item esa
  9718. Exhaustive search algorithm.
  9719. @item tss
  9720. Three step search algorithm.
  9721. @item tdls
  9722. Two dimensional logarithmic search algorithm.
  9723. @item ntss
  9724. New three step search algorithm.
  9725. @item fss
  9726. Four step search algorithm.
  9727. @item ds
  9728. Diamond search algorithm.
  9729. @item hexbs
  9730. Hexagon-based search algorithm.
  9731. @item epzs
  9732. Enhanced predictive zonal search algorithm.
  9733. @item umh
  9734. Uneven multi-hexagon search algorithm.
  9735. @end table
  9736. Default value is @samp{esa}.
  9737. @item mb_size
  9738. Macroblock size. Default @code{16}.
  9739. @item search_param
  9740. Search parameter. Default @code{7}.
  9741. @end table
  9742. @section midequalizer
  9743. Apply Midway Image Equalization effect using two video streams.
  9744. Midway Image Equalization adjusts a pair of images to have the same
  9745. histogram, while maintaining their dynamics as much as possible. It's
  9746. useful for e.g. matching exposures from a pair of stereo cameras.
  9747. This filter has two inputs and one output, which must be of same pixel format, but
  9748. may be of different sizes. The output of filter is first input adjusted with
  9749. midway histogram of both inputs.
  9750. This filter accepts the following option:
  9751. @table @option
  9752. @item planes
  9753. Set which planes to process. Default is @code{15}, which is all available planes.
  9754. @end table
  9755. @section minterpolate
  9756. Convert the video to specified frame rate using motion interpolation.
  9757. This filter accepts the following options:
  9758. @table @option
  9759. @item fps
  9760. 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}.
  9761. @item mi_mode
  9762. Motion interpolation mode. Following values are accepted:
  9763. @table @samp
  9764. @item dup
  9765. Duplicate previous or next frame for interpolating new ones.
  9766. @item blend
  9767. Blend source frames. Interpolated frame is mean of previous and next frames.
  9768. @item mci
  9769. Motion compensated interpolation. Following options are effective when this mode is selected:
  9770. @table @samp
  9771. @item mc_mode
  9772. Motion compensation mode. Following values are accepted:
  9773. @table @samp
  9774. @item obmc
  9775. Overlapped block motion compensation.
  9776. @item aobmc
  9777. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  9778. @end table
  9779. Default mode is @samp{obmc}.
  9780. @item me_mode
  9781. Motion estimation mode. Following values are accepted:
  9782. @table @samp
  9783. @item bidir
  9784. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  9785. @item bilat
  9786. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  9787. @end table
  9788. Default mode is @samp{bilat}.
  9789. @item me
  9790. The algorithm to be used for motion estimation. Following values are accepted:
  9791. @table @samp
  9792. @item esa
  9793. Exhaustive search algorithm.
  9794. @item tss
  9795. Three step search algorithm.
  9796. @item tdls
  9797. Two dimensional logarithmic search algorithm.
  9798. @item ntss
  9799. New three step search algorithm.
  9800. @item fss
  9801. Four step search algorithm.
  9802. @item ds
  9803. Diamond search algorithm.
  9804. @item hexbs
  9805. Hexagon-based search algorithm.
  9806. @item epzs
  9807. Enhanced predictive zonal search algorithm.
  9808. @item umh
  9809. Uneven multi-hexagon search algorithm.
  9810. @end table
  9811. Default algorithm is @samp{epzs}.
  9812. @item mb_size
  9813. Macroblock size. Default @code{16}.
  9814. @item search_param
  9815. Motion estimation search parameter. Default @code{32}.
  9816. @item vsbmc
  9817. 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).
  9818. @end table
  9819. @end table
  9820. @item scd
  9821. 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:
  9822. @table @samp
  9823. @item none
  9824. Disable scene change detection.
  9825. @item fdiff
  9826. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  9827. @end table
  9828. Default method is @samp{fdiff}.
  9829. @item scd_threshold
  9830. Scene change detection threshold. Default is @code{5.0}.
  9831. @end table
  9832. @section mix
  9833. Mix several video input streams into one video stream.
  9834. A description of the accepted options follows.
  9835. @table @option
  9836. @item nb_inputs
  9837. The number of inputs. If unspecified, it defaults to 2.
  9838. @item weights
  9839. Specify weight of each input video stream as sequence.
  9840. Each weight is separated by space. If number of weights
  9841. is smaller than number of @var{frames} last specified
  9842. weight will be used for all remaining unset weights.
  9843. @item scale
  9844. Specify scale, if it is set it will be multiplied with sum
  9845. of each weight multiplied with pixel values to give final destination
  9846. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9847. @item duration
  9848. Specify how end of stream is determined.
  9849. @table @samp
  9850. @item longest
  9851. The duration of the longest input. (default)
  9852. @item shortest
  9853. The duration of the shortest input.
  9854. @item first
  9855. The duration of the first input.
  9856. @end table
  9857. @end table
  9858. @section mpdecimate
  9859. Drop frames that do not differ greatly from the previous frame in
  9860. order to reduce frame rate.
  9861. The main use of this filter is for very-low-bitrate encoding
  9862. (e.g. streaming over dialup modem), but it could in theory be used for
  9863. fixing movies that were inverse-telecined incorrectly.
  9864. A description of the accepted options follows.
  9865. @table @option
  9866. @item max
  9867. Set the maximum number of consecutive frames which can be dropped (if
  9868. positive), or the minimum interval between dropped frames (if
  9869. negative). If the value is 0, the frame is dropped disregarding the
  9870. number of previous sequentially dropped frames.
  9871. Default value is 0.
  9872. @item hi
  9873. @item lo
  9874. @item frac
  9875. Set the dropping threshold values.
  9876. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9877. represent actual pixel value differences, so a threshold of 64
  9878. corresponds to 1 unit of difference for each pixel, or the same spread
  9879. out differently over the block.
  9880. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9881. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9882. meaning the whole image) differ by more than a threshold of @option{lo}.
  9883. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9884. 64*5, and default value for @option{frac} is 0.33.
  9885. @end table
  9886. @section negate
  9887. Negate (invert) the input video.
  9888. It accepts the following option:
  9889. @table @option
  9890. @item negate_alpha
  9891. With value 1, it negates the alpha component, if present. Default value is 0.
  9892. @end table
  9893. @anchor{nlmeans}
  9894. @section nlmeans
  9895. Denoise frames using Non-Local Means algorithm.
  9896. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9897. context similarity is defined by comparing their surrounding patches of size
  9898. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9899. around the pixel.
  9900. Note that the research area defines centers for patches, which means some
  9901. patches will be made of pixels outside that research area.
  9902. The filter accepts the following options.
  9903. @table @option
  9904. @item s
  9905. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  9906. @item p
  9907. Set patch size. Default is 7. Must be odd number in range [0, 99].
  9908. @item pc
  9909. Same as @option{p} but for chroma planes.
  9910. The default value is @var{0} and means automatic.
  9911. @item r
  9912. Set research size. Default is 15. Must be odd number in range [0, 99].
  9913. @item rc
  9914. Same as @option{r} but for chroma planes.
  9915. The default value is @var{0} and means automatic.
  9916. @end table
  9917. @section nnedi
  9918. Deinterlace video using neural network edge directed interpolation.
  9919. This filter accepts the following options:
  9920. @table @option
  9921. @item weights
  9922. Mandatory option, without binary file filter can not work.
  9923. Currently file can be found here:
  9924. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9925. @item deint
  9926. Set which frames to deinterlace, by default it is @code{all}.
  9927. Can be @code{all} or @code{interlaced}.
  9928. @item field
  9929. Set mode of operation.
  9930. Can be one of the following:
  9931. @table @samp
  9932. @item af
  9933. Use frame flags, both fields.
  9934. @item a
  9935. Use frame flags, single field.
  9936. @item t
  9937. Use top field only.
  9938. @item b
  9939. Use bottom field only.
  9940. @item tf
  9941. Use both fields, top first.
  9942. @item bf
  9943. Use both fields, bottom first.
  9944. @end table
  9945. @item planes
  9946. Set which planes to process, by default filter process all frames.
  9947. @item nsize
  9948. Set size of local neighborhood around each pixel, used by the predictor neural
  9949. network.
  9950. Can be one of the following:
  9951. @table @samp
  9952. @item s8x6
  9953. @item s16x6
  9954. @item s32x6
  9955. @item s48x6
  9956. @item s8x4
  9957. @item s16x4
  9958. @item s32x4
  9959. @end table
  9960. @item nns
  9961. Set the number of neurons in predictor neural network.
  9962. Can be one of the following:
  9963. @table @samp
  9964. @item n16
  9965. @item n32
  9966. @item n64
  9967. @item n128
  9968. @item n256
  9969. @end table
  9970. @item qual
  9971. Controls the number of different neural network predictions that are blended
  9972. together to compute the final output value. Can be @code{fast}, default or
  9973. @code{slow}.
  9974. @item etype
  9975. Set which set of weights to use in the predictor.
  9976. Can be one of the following:
  9977. @table @samp
  9978. @item a
  9979. weights trained to minimize absolute error
  9980. @item s
  9981. weights trained to minimize squared error
  9982. @end table
  9983. @item pscrn
  9984. Controls whether or not the prescreener neural network is used to decide
  9985. which pixels should be processed by the predictor neural network and which
  9986. can be handled by simple cubic interpolation.
  9987. The prescreener is trained to know whether cubic interpolation will be
  9988. sufficient for a pixel or whether it should be predicted by the predictor nn.
  9989. The computational complexity of the prescreener nn is much less than that of
  9990. the predictor nn. Since most pixels can be handled by cubic interpolation,
  9991. using the prescreener generally results in much faster processing.
  9992. The prescreener is pretty accurate, so the difference between using it and not
  9993. using it is almost always unnoticeable.
  9994. Can be one of the following:
  9995. @table @samp
  9996. @item none
  9997. @item original
  9998. @item new
  9999. @end table
  10000. Default is @code{new}.
  10001. @item fapprox
  10002. Set various debugging flags.
  10003. @end table
  10004. @section noformat
  10005. Force libavfilter not to use any of the specified pixel formats for the
  10006. input to the next filter.
  10007. It accepts the following parameters:
  10008. @table @option
  10009. @item pix_fmts
  10010. A '|'-separated list of pixel format names, such as
  10011. pix_fmts=yuv420p|monow|rgb24".
  10012. @end table
  10013. @subsection Examples
  10014. @itemize
  10015. @item
  10016. Force libavfilter to use a format different from @var{yuv420p} for the
  10017. input to the vflip filter:
  10018. @example
  10019. noformat=pix_fmts=yuv420p,vflip
  10020. @end example
  10021. @item
  10022. Convert the input video to any of the formats not contained in the list:
  10023. @example
  10024. noformat=yuv420p|yuv444p|yuv410p
  10025. @end example
  10026. @end itemize
  10027. @section noise
  10028. Add noise on video input frame.
  10029. The filter accepts the following options:
  10030. @table @option
  10031. @item all_seed
  10032. @item c0_seed
  10033. @item c1_seed
  10034. @item c2_seed
  10035. @item c3_seed
  10036. Set noise seed for specific pixel component or all pixel components in case
  10037. of @var{all_seed}. Default value is @code{123457}.
  10038. @item all_strength, alls
  10039. @item c0_strength, c0s
  10040. @item c1_strength, c1s
  10041. @item c2_strength, c2s
  10042. @item c3_strength, c3s
  10043. Set noise strength for specific pixel component or all pixel components in case
  10044. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  10045. @item all_flags, allf
  10046. @item c0_flags, c0f
  10047. @item c1_flags, c1f
  10048. @item c2_flags, c2f
  10049. @item c3_flags, c3f
  10050. Set pixel component flags or set flags for all components if @var{all_flags}.
  10051. Available values for component flags are:
  10052. @table @samp
  10053. @item a
  10054. averaged temporal noise (smoother)
  10055. @item p
  10056. mix random noise with a (semi)regular pattern
  10057. @item t
  10058. temporal noise (noise pattern changes between frames)
  10059. @item u
  10060. uniform noise (gaussian otherwise)
  10061. @end table
  10062. @end table
  10063. @subsection Examples
  10064. Add temporal and uniform noise to input video:
  10065. @example
  10066. noise=alls=20:allf=t+u
  10067. @end example
  10068. @section normalize
  10069. Normalize RGB video (aka histogram stretching, contrast stretching).
  10070. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  10071. For each channel of each frame, the filter computes the input range and maps
  10072. it linearly to the user-specified output range. The output range defaults
  10073. to the full dynamic range from pure black to pure white.
  10074. Temporal smoothing can be used on the input range to reduce flickering (rapid
  10075. changes in brightness) caused when small dark or bright objects enter or leave
  10076. the scene. This is similar to the auto-exposure (automatic gain control) on a
  10077. video camera, and, like a video camera, it may cause a period of over- or
  10078. under-exposure of the video.
  10079. The R,G,B channels can be normalized independently, which may cause some
  10080. color shifting, or linked together as a single channel, which prevents
  10081. color shifting. Linked normalization preserves hue. Independent normalization
  10082. does not, so it can be used to remove some color casts. Independent and linked
  10083. normalization can be combined in any ratio.
  10084. The normalize filter accepts the following options:
  10085. @table @option
  10086. @item blackpt
  10087. @item whitept
  10088. Colors which define the output range. The minimum input value is mapped to
  10089. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  10090. The defaults are black and white respectively. Specifying white for
  10091. @var{blackpt} and black for @var{whitept} will give color-inverted,
  10092. normalized video. Shades of grey can be used to reduce the dynamic range
  10093. (contrast). Specifying saturated colors here can create some interesting
  10094. effects.
  10095. @item smoothing
  10096. The number of previous frames to use for temporal smoothing. The input range
  10097. of each channel is smoothed using a rolling average over the current frame
  10098. and the @var{smoothing} previous frames. The default is 0 (no temporal
  10099. smoothing).
  10100. @item independence
  10101. Controls the ratio of independent (color shifting) channel normalization to
  10102. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  10103. independent. Defaults to 1.0 (fully independent).
  10104. @item strength
  10105. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  10106. expensive no-op. Defaults to 1.0 (full strength).
  10107. @end table
  10108. @subsection Examples
  10109. Stretch video contrast to use the full dynamic range, with no temporal
  10110. smoothing; may flicker depending on the source content:
  10111. @example
  10112. normalize=blackpt=black:whitept=white:smoothing=0
  10113. @end example
  10114. As above, but with 50 frames of temporal smoothing; flicker should be
  10115. reduced, depending on the source content:
  10116. @example
  10117. normalize=blackpt=black:whitept=white:smoothing=50
  10118. @end example
  10119. As above, but with hue-preserving linked channel normalization:
  10120. @example
  10121. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  10122. @end example
  10123. As above, but with half strength:
  10124. @example
  10125. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  10126. @end example
  10127. Map the darkest input color to red, the brightest input color to cyan:
  10128. @example
  10129. normalize=blackpt=red:whitept=cyan
  10130. @end example
  10131. @section null
  10132. Pass the video source unchanged to the output.
  10133. @section ocr
  10134. Optical Character Recognition
  10135. This filter uses Tesseract for optical character recognition. To enable
  10136. compilation of this filter, you need to configure FFmpeg with
  10137. @code{--enable-libtesseract}.
  10138. It accepts the following options:
  10139. @table @option
  10140. @item datapath
  10141. Set datapath to tesseract data. Default is to use whatever was
  10142. set at installation.
  10143. @item language
  10144. Set language, default is "eng".
  10145. @item whitelist
  10146. Set character whitelist.
  10147. @item blacklist
  10148. Set character blacklist.
  10149. @end table
  10150. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  10151. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  10152. @section ocv
  10153. Apply a video transform using libopencv.
  10154. To enable this filter, install the libopencv library and headers and
  10155. configure FFmpeg with @code{--enable-libopencv}.
  10156. It accepts the following parameters:
  10157. @table @option
  10158. @item filter_name
  10159. The name of the libopencv filter to apply.
  10160. @item filter_params
  10161. The parameters to pass to the libopencv filter. If not specified, the default
  10162. values are assumed.
  10163. @end table
  10164. Refer to the official libopencv documentation for more precise
  10165. information:
  10166. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  10167. Several libopencv filters are supported; see the following subsections.
  10168. @anchor{dilate}
  10169. @subsection dilate
  10170. Dilate an image by using a specific structuring element.
  10171. It corresponds to the libopencv function @code{cvDilate}.
  10172. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  10173. @var{struct_el} represents a structuring element, and has the syntax:
  10174. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  10175. @var{cols} and @var{rows} represent the number of columns and rows of
  10176. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  10177. point, and @var{shape} the shape for the structuring element. @var{shape}
  10178. must be "rect", "cross", "ellipse", or "custom".
  10179. If the value for @var{shape} is "custom", it must be followed by a
  10180. string of the form "=@var{filename}". The file with name
  10181. @var{filename} is assumed to represent a binary image, with each
  10182. printable character corresponding to a bright pixel. When a custom
  10183. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  10184. or columns and rows of the read file are assumed instead.
  10185. The default value for @var{struct_el} is "3x3+0x0/rect".
  10186. @var{nb_iterations} specifies the number of times the transform is
  10187. applied to the image, and defaults to 1.
  10188. Some examples:
  10189. @example
  10190. # Use the default values
  10191. ocv=dilate
  10192. # Dilate using a structuring element with a 5x5 cross, iterating two times
  10193. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  10194. # Read the shape from the file diamond.shape, iterating two times.
  10195. # The file diamond.shape may contain a pattern of characters like this
  10196. # *
  10197. # ***
  10198. # *****
  10199. # ***
  10200. # *
  10201. # The specified columns and rows are ignored
  10202. # but the anchor point coordinates are not
  10203. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  10204. @end example
  10205. @subsection erode
  10206. Erode an image by using a specific structuring element.
  10207. It corresponds to the libopencv function @code{cvErode}.
  10208. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  10209. with the same syntax and semantics as the @ref{dilate} filter.
  10210. @subsection smooth
  10211. Smooth the input video.
  10212. The filter takes the following parameters:
  10213. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  10214. @var{type} is the type of smooth filter to apply, and must be one of
  10215. the following values: "blur", "blur_no_scale", "median", "gaussian",
  10216. or "bilateral". The default value is "gaussian".
  10217. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  10218. depends on the smooth type. @var{param1} and
  10219. @var{param2} accept integer positive values or 0. @var{param3} and
  10220. @var{param4} accept floating point values.
  10221. The default value for @var{param1} is 3. The default value for the
  10222. other parameters is 0.
  10223. These parameters correspond to the parameters assigned to the
  10224. libopencv function @code{cvSmooth}.
  10225. @section oscilloscope
  10226. 2D Video Oscilloscope.
  10227. Useful to measure spatial impulse, step responses, chroma delays, etc.
  10228. It accepts the following parameters:
  10229. @table @option
  10230. @item x
  10231. Set scope center x position.
  10232. @item y
  10233. Set scope center y position.
  10234. @item s
  10235. Set scope size, relative to frame diagonal.
  10236. @item t
  10237. Set scope tilt/rotation.
  10238. @item o
  10239. Set trace opacity.
  10240. @item tx
  10241. Set trace center x position.
  10242. @item ty
  10243. Set trace center y position.
  10244. @item tw
  10245. Set trace width, relative to width of frame.
  10246. @item th
  10247. Set trace height, relative to height of frame.
  10248. @item c
  10249. Set which components to trace. By default it traces first three components.
  10250. @item g
  10251. Draw trace grid. By default is enabled.
  10252. @item st
  10253. Draw some statistics. By default is enabled.
  10254. @item sc
  10255. Draw scope. By default is enabled.
  10256. @end table
  10257. @subsection Examples
  10258. @itemize
  10259. @item
  10260. Inspect full first row of video frame.
  10261. @example
  10262. oscilloscope=x=0.5:y=0:s=1
  10263. @end example
  10264. @item
  10265. Inspect full last row of video frame.
  10266. @example
  10267. oscilloscope=x=0.5:y=1:s=1
  10268. @end example
  10269. @item
  10270. Inspect full 5th line of video frame of height 1080.
  10271. @example
  10272. oscilloscope=x=0.5:y=5/1080:s=1
  10273. @end example
  10274. @item
  10275. Inspect full last column of video frame.
  10276. @example
  10277. oscilloscope=x=1:y=0.5:s=1:t=1
  10278. @end example
  10279. @end itemize
  10280. @anchor{overlay}
  10281. @section overlay
  10282. Overlay one video on top of another.
  10283. It takes two inputs and has one output. The first input is the "main"
  10284. video on which the second input is overlaid.
  10285. It accepts the following parameters:
  10286. A description of the accepted options follows.
  10287. @table @option
  10288. @item x
  10289. @item y
  10290. Set the expression for the x and y coordinates of the overlaid video
  10291. on the main video. Default value is "0" for both expressions. In case
  10292. the expression is invalid, it is set to a huge value (meaning that the
  10293. overlay will not be displayed within the output visible area).
  10294. @item eof_action
  10295. See @ref{framesync}.
  10296. @item eval
  10297. Set when the expressions for @option{x}, and @option{y} are evaluated.
  10298. It accepts the following values:
  10299. @table @samp
  10300. @item init
  10301. only evaluate expressions once during the filter initialization or
  10302. when a command is processed
  10303. @item frame
  10304. evaluate expressions for each incoming frame
  10305. @end table
  10306. Default value is @samp{frame}.
  10307. @item shortest
  10308. See @ref{framesync}.
  10309. @item format
  10310. Set the format for the output video.
  10311. It accepts the following values:
  10312. @table @samp
  10313. @item yuv420
  10314. force YUV420 output
  10315. @item yuv422
  10316. force YUV422 output
  10317. @item yuv444
  10318. force YUV444 output
  10319. @item rgb
  10320. force packed RGB output
  10321. @item gbrp
  10322. force planar RGB output
  10323. @item auto
  10324. automatically pick format
  10325. @end table
  10326. Default value is @samp{yuv420}.
  10327. @item repeatlast
  10328. See @ref{framesync}.
  10329. @item alpha
  10330. Set format of alpha of the overlaid video, it can be @var{straight} or
  10331. @var{premultiplied}. Default is @var{straight}.
  10332. @end table
  10333. The @option{x}, and @option{y} expressions can contain the following
  10334. parameters.
  10335. @table @option
  10336. @item main_w, W
  10337. @item main_h, H
  10338. The main input width and height.
  10339. @item overlay_w, w
  10340. @item overlay_h, h
  10341. The overlay input width and height.
  10342. @item x
  10343. @item y
  10344. The computed values for @var{x} and @var{y}. They are evaluated for
  10345. each new frame.
  10346. @item hsub
  10347. @item vsub
  10348. horizontal and vertical chroma subsample values of the output
  10349. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  10350. @var{vsub} is 1.
  10351. @item n
  10352. the number of input frame, starting from 0
  10353. @item pos
  10354. the position in the file of the input frame, NAN if unknown
  10355. @item t
  10356. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  10357. @end table
  10358. This filter also supports the @ref{framesync} options.
  10359. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  10360. when evaluation is done @emph{per frame}, and will evaluate to NAN
  10361. when @option{eval} is set to @samp{init}.
  10362. Be aware that frames are taken from each input video in timestamp
  10363. order, hence, if their initial timestamps differ, it is a good idea
  10364. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  10365. have them begin in the same zero timestamp, as the example for
  10366. the @var{movie} filter does.
  10367. You can chain together more overlays but you should test the
  10368. efficiency of such approach.
  10369. @subsection Commands
  10370. This filter supports the following commands:
  10371. @table @option
  10372. @item x
  10373. @item y
  10374. Modify the x and y of the overlay input.
  10375. The command accepts the same syntax of the corresponding option.
  10376. If the specified expression is not valid, it is kept at its current
  10377. value.
  10378. @end table
  10379. @subsection Examples
  10380. @itemize
  10381. @item
  10382. Draw the overlay at 10 pixels from the bottom right corner of the main
  10383. video:
  10384. @example
  10385. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  10386. @end example
  10387. Using named options the example above becomes:
  10388. @example
  10389. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  10390. @end example
  10391. @item
  10392. Insert a transparent PNG logo in the bottom left corner of the input,
  10393. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  10394. @example
  10395. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  10396. @end example
  10397. @item
  10398. Insert 2 different transparent PNG logos (second logo on bottom
  10399. right corner) using the @command{ffmpeg} tool:
  10400. @example
  10401. 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
  10402. @end example
  10403. @item
  10404. Add a transparent color layer on top of the main video; @code{WxH}
  10405. must specify the size of the main input to the overlay filter:
  10406. @example
  10407. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  10408. @end example
  10409. @item
  10410. Play an original video and a filtered version (here with the deshake
  10411. filter) side by side using the @command{ffplay} tool:
  10412. @example
  10413. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  10414. @end example
  10415. The above command is the same as:
  10416. @example
  10417. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  10418. @end example
  10419. @item
  10420. Make a sliding overlay appearing from the left to the right top part of the
  10421. screen starting since time 2:
  10422. @example
  10423. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  10424. @end example
  10425. @item
  10426. Compose output by putting two input videos side to side:
  10427. @example
  10428. ffmpeg -i left.avi -i right.avi -filter_complex "
  10429. nullsrc=size=200x100 [background];
  10430. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  10431. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  10432. [background][left] overlay=shortest=1 [background+left];
  10433. [background+left][right] overlay=shortest=1:x=100 [left+right]
  10434. "
  10435. @end example
  10436. @item
  10437. Mask 10-20 seconds of a video by applying the delogo filter to a section
  10438. @example
  10439. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  10440. -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]'
  10441. masked.avi
  10442. @end example
  10443. @item
  10444. Chain several overlays in cascade:
  10445. @example
  10446. nullsrc=s=200x200 [bg];
  10447. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  10448. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  10449. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  10450. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  10451. [in3] null, [mid2] overlay=100:100 [out0]
  10452. @end example
  10453. @end itemize
  10454. @section owdenoise
  10455. Apply Overcomplete Wavelet denoiser.
  10456. The filter accepts the following options:
  10457. @table @option
  10458. @item depth
  10459. Set depth.
  10460. Larger depth values will denoise lower frequency components more, but
  10461. slow down filtering.
  10462. Must be an int in the range 8-16, default is @code{8}.
  10463. @item luma_strength, ls
  10464. Set luma strength.
  10465. Must be a double value in the range 0-1000, default is @code{1.0}.
  10466. @item chroma_strength, cs
  10467. Set chroma strength.
  10468. Must be a double value in the range 0-1000, default is @code{1.0}.
  10469. @end table
  10470. @anchor{pad}
  10471. @section pad
  10472. Add paddings to the input image, and place the original input at the
  10473. provided @var{x}, @var{y} coordinates.
  10474. It accepts the following parameters:
  10475. @table @option
  10476. @item width, w
  10477. @item height, h
  10478. Specify an expression for the size of the output image with the
  10479. paddings added. If the value for @var{width} or @var{height} is 0, the
  10480. corresponding input size is used for the output.
  10481. The @var{width} expression can reference the value set by the
  10482. @var{height} expression, and vice versa.
  10483. The default value of @var{width} and @var{height} is 0.
  10484. @item x
  10485. @item y
  10486. Specify the offsets to place the input image at within the padded area,
  10487. with respect to the top/left border of the output image.
  10488. The @var{x} expression can reference the value set by the @var{y}
  10489. expression, and vice versa.
  10490. The default value of @var{x} and @var{y} is 0.
  10491. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  10492. so the input image is centered on the padded area.
  10493. @item color
  10494. Specify the color of the padded area. For the syntax of this option,
  10495. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10496. manual,ffmpeg-utils}.
  10497. The default value of @var{color} is "black".
  10498. @item eval
  10499. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  10500. It accepts the following values:
  10501. @table @samp
  10502. @item init
  10503. Only evaluate expressions once during the filter initialization or when
  10504. a command is processed.
  10505. @item frame
  10506. Evaluate expressions for each incoming frame.
  10507. @end table
  10508. Default value is @samp{init}.
  10509. @item aspect
  10510. Pad to aspect instead to a resolution.
  10511. @end table
  10512. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  10513. options are expressions containing the following constants:
  10514. @table @option
  10515. @item in_w
  10516. @item in_h
  10517. The input video width and height.
  10518. @item iw
  10519. @item ih
  10520. These are the same as @var{in_w} and @var{in_h}.
  10521. @item out_w
  10522. @item out_h
  10523. The output width and height (the size of the padded area), as
  10524. specified by the @var{width} and @var{height} expressions.
  10525. @item ow
  10526. @item oh
  10527. These are the same as @var{out_w} and @var{out_h}.
  10528. @item x
  10529. @item y
  10530. The x and y offsets as specified by the @var{x} and @var{y}
  10531. expressions, or NAN if not yet specified.
  10532. @item a
  10533. same as @var{iw} / @var{ih}
  10534. @item sar
  10535. input sample aspect ratio
  10536. @item dar
  10537. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  10538. @item hsub
  10539. @item vsub
  10540. The horizontal and vertical chroma subsample values. For example for the
  10541. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10542. @end table
  10543. @subsection Examples
  10544. @itemize
  10545. @item
  10546. Add paddings with the color "violet" to the input video. The output video
  10547. size is 640x480, and the top-left corner of the input video is placed at
  10548. column 0, row 40
  10549. @example
  10550. pad=640:480:0:40:violet
  10551. @end example
  10552. The example above is equivalent to the following command:
  10553. @example
  10554. pad=width=640:height=480:x=0:y=40:color=violet
  10555. @end example
  10556. @item
  10557. Pad the input to get an output with dimensions increased by 3/2,
  10558. and put the input video at the center of the padded area:
  10559. @example
  10560. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10561. @end example
  10562. @item
  10563. Pad the input to get a squared output with size equal to the maximum
  10564. value between the input width and height, and put the input video at
  10565. the center of the padded area:
  10566. @example
  10567. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10568. @end example
  10569. @item
  10570. Pad the input to get a final w/h ratio of 16:9:
  10571. @example
  10572. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10573. @end example
  10574. @item
  10575. In case of anamorphic video, in order to set the output display aspect
  10576. correctly, it is necessary to use @var{sar} in the expression,
  10577. according to the relation:
  10578. @example
  10579. (ih * X / ih) * sar = output_dar
  10580. X = output_dar / sar
  10581. @end example
  10582. Thus the previous example needs to be modified to:
  10583. @example
  10584. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  10585. @end example
  10586. @item
  10587. Double the output size and put the input video in the bottom-right
  10588. corner of the output padded area:
  10589. @example
  10590. pad="2*iw:2*ih:ow-iw:oh-ih"
  10591. @end example
  10592. @end itemize
  10593. @anchor{palettegen}
  10594. @section palettegen
  10595. Generate one palette for a whole video stream.
  10596. It accepts the following options:
  10597. @table @option
  10598. @item max_colors
  10599. Set the maximum number of colors to quantize in the palette.
  10600. Note: the palette will still contain 256 colors; the unused palette entries
  10601. will be black.
  10602. @item reserve_transparent
  10603. Create a palette of 255 colors maximum and reserve the last one for
  10604. transparency. Reserving the transparency color is useful for GIF optimization.
  10605. If not set, the maximum of colors in the palette will be 256. You probably want
  10606. to disable this option for a standalone image.
  10607. Set by default.
  10608. @item transparency_color
  10609. Set the color that will be used as background for transparency.
  10610. @item stats_mode
  10611. Set statistics mode.
  10612. It accepts the following values:
  10613. @table @samp
  10614. @item full
  10615. Compute full frame histograms.
  10616. @item diff
  10617. Compute histograms only for the part that differs from previous frame. This
  10618. might be relevant to give more importance to the moving part of your input if
  10619. the background is static.
  10620. @item single
  10621. Compute new histogram for each frame.
  10622. @end table
  10623. Default value is @var{full}.
  10624. @end table
  10625. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  10626. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  10627. color quantization of the palette. This information is also visible at
  10628. @var{info} logging level.
  10629. @subsection Examples
  10630. @itemize
  10631. @item
  10632. Generate a representative palette of a given video using @command{ffmpeg}:
  10633. @example
  10634. ffmpeg -i input.mkv -vf palettegen palette.png
  10635. @end example
  10636. @end itemize
  10637. @section paletteuse
  10638. Use a palette to downsample an input video stream.
  10639. The filter takes two inputs: one video stream and a palette. The palette must
  10640. be a 256 pixels image.
  10641. It accepts the following options:
  10642. @table @option
  10643. @item dither
  10644. Select dithering mode. Available algorithms are:
  10645. @table @samp
  10646. @item bayer
  10647. Ordered 8x8 bayer dithering (deterministic)
  10648. @item heckbert
  10649. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  10650. Note: this dithering is sometimes considered "wrong" and is included as a
  10651. reference.
  10652. @item floyd_steinberg
  10653. Floyd and Steingberg dithering (error diffusion)
  10654. @item sierra2
  10655. Frankie Sierra dithering v2 (error diffusion)
  10656. @item sierra2_4a
  10657. Frankie Sierra dithering v2 "Lite" (error diffusion)
  10658. @end table
  10659. Default is @var{sierra2_4a}.
  10660. @item bayer_scale
  10661. When @var{bayer} dithering is selected, this option defines the scale of the
  10662. pattern (how much the crosshatch pattern is visible). A low value means more
  10663. visible pattern for less banding, and higher value means less visible pattern
  10664. at the cost of more banding.
  10665. The option must be an integer value in the range [0,5]. Default is @var{2}.
  10666. @item diff_mode
  10667. If set, define the zone to process
  10668. @table @samp
  10669. @item rectangle
  10670. Only the changing rectangle will be reprocessed. This is similar to GIF
  10671. cropping/offsetting compression mechanism. This option can be useful for speed
  10672. if only a part of the image is changing, and has use cases such as limiting the
  10673. scope of the error diffusal @option{dither} to the rectangle that bounds the
  10674. moving scene (it leads to more deterministic output if the scene doesn't change
  10675. much, and as a result less moving noise and better GIF compression).
  10676. @end table
  10677. Default is @var{none}.
  10678. @item new
  10679. Take new palette for each output frame.
  10680. @item alpha_threshold
  10681. Sets the alpha threshold for transparency. Alpha values above this threshold
  10682. will be treated as completely opaque, and values below this threshold will be
  10683. treated as completely transparent.
  10684. The option must be an integer value in the range [0,255]. Default is @var{128}.
  10685. @end table
  10686. @subsection Examples
  10687. @itemize
  10688. @item
  10689. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  10690. using @command{ffmpeg}:
  10691. @example
  10692. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  10693. @end example
  10694. @end itemize
  10695. @section perspective
  10696. Correct perspective of video not recorded perpendicular to the screen.
  10697. A description of the accepted parameters follows.
  10698. @table @option
  10699. @item x0
  10700. @item y0
  10701. @item x1
  10702. @item y1
  10703. @item x2
  10704. @item y2
  10705. @item x3
  10706. @item y3
  10707. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  10708. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  10709. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  10710. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  10711. then the corners of the source will be sent to the specified coordinates.
  10712. The expressions can use the following variables:
  10713. @table @option
  10714. @item W
  10715. @item H
  10716. the width and height of video frame.
  10717. @item in
  10718. Input frame count.
  10719. @item on
  10720. Output frame count.
  10721. @end table
  10722. @item interpolation
  10723. Set interpolation for perspective correction.
  10724. It accepts the following values:
  10725. @table @samp
  10726. @item linear
  10727. @item cubic
  10728. @end table
  10729. Default value is @samp{linear}.
  10730. @item sense
  10731. Set interpretation of coordinate options.
  10732. It accepts the following values:
  10733. @table @samp
  10734. @item 0, source
  10735. Send point in the source specified by the given coordinates to
  10736. the corners of the destination.
  10737. @item 1, destination
  10738. Send the corners of the source to the point in the destination specified
  10739. by the given coordinates.
  10740. Default value is @samp{source}.
  10741. @end table
  10742. @item eval
  10743. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  10744. It accepts the following values:
  10745. @table @samp
  10746. @item init
  10747. only evaluate expressions once during the filter initialization or
  10748. when a command is processed
  10749. @item frame
  10750. evaluate expressions for each incoming frame
  10751. @end table
  10752. Default value is @samp{init}.
  10753. @end table
  10754. @section phase
  10755. Delay interlaced video by one field time so that the field order changes.
  10756. The intended use is to fix PAL movies that have been captured with the
  10757. opposite field order to the film-to-video transfer.
  10758. A description of the accepted parameters follows.
  10759. @table @option
  10760. @item mode
  10761. Set phase mode.
  10762. It accepts the following values:
  10763. @table @samp
  10764. @item t
  10765. Capture field order top-first, transfer bottom-first.
  10766. Filter will delay the bottom field.
  10767. @item b
  10768. Capture field order bottom-first, transfer top-first.
  10769. Filter will delay the top field.
  10770. @item p
  10771. Capture and transfer with the same field order. This mode only exists
  10772. for the documentation of the other options to refer to, but if you
  10773. actually select it, the filter will faithfully do nothing.
  10774. @item a
  10775. Capture field order determined automatically by field flags, transfer
  10776. opposite.
  10777. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  10778. basis using field flags. If no field information is available,
  10779. then this works just like @samp{u}.
  10780. @item u
  10781. Capture unknown or varying, transfer opposite.
  10782. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  10783. analyzing the images and selecting the alternative that produces best
  10784. match between the fields.
  10785. @item T
  10786. Capture top-first, transfer unknown or varying.
  10787. Filter selects among @samp{t} and @samp{p} using image analysis.
  10788. @item B
  10789. Capture bottom-first, transfer unknown or varying.
  10790. Filter selects among @samp{b} and @samp{p} using image analysis.
  10791. @item A
  10792. Capture determined by field flags, transfer unknown or varying.
  10793. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  10794. image analysis. If no field information is available, then this works just
  10795. like @samp{U}. This is the default mode.
  10796. @item U
  10797. Both capture and transfer unknown or varying.
  10798. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  10799. @end table
  10800. @end table
  10801. @section photosensitivity
  10802. Reduce various flashes in video, so to help users with epilepsy.
  10803. It accepts the following options:
  10804. @table @option
  10805. @item frames, f
  10806. Set how many frames to use when filtering. Default is 30.
  10807. @item threshold, t
  10808. Set detection threshold factor. Default is 1.
  10809. Lower is stricter.
  10810. @item skip
  10811. Set how many pixels to skip when sampling frames. Defalt is 1.
  10812. Allowed range is from 1 to 1024.
  10813. @item bypass
  10814. Leave frames unchanged. Default is disabled.
  10815. @end table
  10816. @section pixdesctest
  10817. Pixel format descriptor test filter, mainly useful for internal
  10818. testing. The output video should be equal to the input video.
  10819. For example:
  10820. @example
  10821. format=monow, pixdesctest
  10822. @end example
  10823. can be used to test the monowhite pixel format descriptor definition.
  10824. @section pixscope
  10825. Display sample values of color channels. Mainly useful for checking color
  10826. and levels. Minimum supported resolution is 640x480.
  10827. The filters accept the following options:
  10828. @table @option
  10829. @item x
  10830. Set scope X position, relative offset on X axis.
  10831. @item y
  10832. Set scope Y position, relative offset on Y axis.
  10833. @item w
  10834. Set scope width.
  10835. @item h
  10836. Set scope height.
  10837. @item o
  10838. Set window opacity. This window also holds statistics about pixel area.
  10839. @item wx
  10840. Set window X position, relative offset on X axis.
  10841. @item wy
  10842. Set window Y position, relative offset on Y axis.
  10843. @end table
  10844. @section pp
  10845. Enable the specified chain of postprocessing subfilters using libpostproc. This
  10846. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  10847. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  10848. Each subfilter and some options have a short and a long name that can be used
  10849. interchangeably, i.e. dr/dering are the same.
  10850. The filters accept the following options:
  10851. @table @option
  10852. @item subfilters
  10853. Set postprocessing subfilters string.
  10854. @end table
  10855. All subfilters share common options to determine their scope:
  10856. @table @option
  10857. @item a/autoq
  10858. Honor the quality commands for this subfilter.
  10859. @item c/chrom
  10860. Do chrominance filtering, too (default).
  10861. @item y/nochrom
  10862. Do luminance filtering only (no chrominance).
  10863. @item n/noluma
  10864. Do chrominance filtering only (no luminance).
  10865. @end table
  10866. These options can be appended after the subfilter name, separated by a '|'.
  10867. Available subfilters are:
  10868. @table @option
  10869. @item hb/hdeblock[|difference[|flatness]]
  10870. Horizontal deblocking filter
  10871. @table @option
  10872. @item difference
  10873. Difference factor where higher values mean more deblocking (default: @code{32}).
  10874. @item flatness
  10875. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10876. @end table
  10877. @item vb/vdeblock[|difference[|flatness]]
  10878. Vertical deblocking filter
  10879. @table @option
  10880. @item difference
  10881. Difference factor where higher values mean more deblocking (default: @code{32}).
  10882. @item flatness
  10883. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10884. @end table
  10885. @item ha/hadeblock[|difference[|flatness]]
  10886. Accurate horizontal deblocking filter
  10887. @table @option
  10888. @item difference
  10889. Difference factor where higher values mean more deblocking (default: @code{32}).
  10890. @item flatness
  10891. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10892. @end table
  10893. @item va/vadeblock[|difference[|flatness]]
  10894. Accurate vertical deblocking filter
  10895. @table @option
  10896. @item difference
  10897. Difference factor where higher values mean more deblocking (default: @code{32}).
  10898. @item flatness
  10899. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10900. @end table
  10901. @end table
  10902. The horizontal and vertical deblocking filters share the difference and
  10903. flatness values so you cannot set different horizontal and vertical
  10904. thresholds.
  10905. @table @option
  10906. @item h1/x1hdeblock
  10907. Experimental horizontal deblocking filter
  10908. @item v1/x1vdeblock
  10909. Experimental vertical deblocking filter
  10910. @item dr/dering
  10911. Deringing filter
  10912. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10913. @table @option
  10914. @item threshold1
  10915. larger -> stronger filtering
  10916. @item threshold2
  10917. larger -> stronger filtering
  10918. @item threshold3
  10919. larger -> stronger filtering
  10920. @end table
  10921. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10922. @table @option
  10923. @item f/fullyrange
  10924. Stretch luminance to @code{0-255}.
  10925. @end table
  10926. @item lb/linblenddeint
  10927. Linear blend deinterlacing filter that deinterlaces the given block by
  10928. filtering all lines with a @code{(1 2 1)} filter.
  10929. @item li/linipoldeint
  10930. Linear interpolating deinterlacing filter that deinterlaces the given block by
  10931. linearly interpolating every second line.
  10932. @item ci/cubicipoldeint
  10933. Cubic interpolating deinterlacing filter deinterlaces the given block by
  10934. cubically interpolating every second line.
  10935. @item md/mediandeint
  10936. Median deinterlacing filter that deinterlaces the given block by applying a
  10937. median filter to every second line.
  10938. @item fd/ffmpegdeint
  10939. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  10940. second line with a @code{(-1 4 2 4 -1)} filter.
  10941. @item l5/lowpass5
  10942. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  10943. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  10944. @item fq/forceQuant[|quantizer]
  10945. Overrides the quantizer table from the input with the constant quantizer you
  10946. specify.
  10947. @table @option
  10948. @item quantizer
  10949. Quantizer to use
  10950. @end table
  10951. @item de/default
  10952. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  10953. @item fa/fast
  10954. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  10955. @item ac
  10956. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  10957. @end table
  10958. @subsection Examples
  10959. @itemize
  10960. @item
  10961. Apply horizontal and vertical deblocking, deringing and automatic
  10962. brightness/contrast:
  10963. @example
  10964. pp=hb/vb/dr/al
  10965. @end example
  10966. @item
  10967. Apply default filters without brightness/contrast correction:
  10968. @example
  10969. pp=de/-al
  10970. @end example
  10971. @item
  10972. Apply default filters and temporal denoiser:
  10973. @example
  10974. pp=default/tmpnoise|1|2|3
  10975. @end example
  10976. @item
  10977. Apply deblocking on luminance only, and switch vertical deblocking on or off
  10978. automatically depending on available CPU time:
  10979. @example
  10980. pp=hb|y/vb|a
  10981. @end example
  10982. @end itemize
  10983. @section pp7
  10984. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  10985. similar to spp = 6 with 7 point DCT, where only the center sample is
  10986. used after IDCT.
  10987. The filter accepts the following options:
  10988. @table @option
  10989. @item qp
  10990. Force a constant quantization parameter. It accepts an integer in range
  10991. 0 to 63. If not set, the filter will use the QP from the video stream
  10992. (if available).
  10993. @item mode
  10994. Set thresholding mode. Available modes are:
  10995. @table @samp
  10996. @item hard
  10997. Set hard thresholding.
  10998. @item soft
  10999. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11000. @item medium
  11001. Set medium thresholding (good results, default).
  11002. @end table
  11003. @end table
  11004. @section premultiply
  11005. Apply alpha premultiply effect to input video stream using first plane
  11006. of second stream as alpha.
  11007. Both streams must have same dimensions and same pixel format.
  11008. The filter accepts the following option:
  11009. @table @option
  11010. @item planes
  11011. Set which planes will be processed, unprocessed planes will be copied.
  11012. By default value 0xf, all planes will be processed.
  11013. @item inplace
  11014. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11015. @end table
  11016. @section prewitt
  11017. Apply prewitt operator to input video stream.
  11018. The filter accepts the following option:
  11019. @table @option
  11020. @item planes
  11021. Set which planes will be processed, unprocessed planes will be copied.
  11022. By default value 0xf, all planes will be processed.
  11023. @item scale
  11024. Set value which will be multiplied with filtered result.
  11025. @item delta
  11026. Set value which will be added to filtered result.
  11027. @end table
  11028. @anchor{program_opencl}
  11029. @section program_opencl
  11030. Filter video using an OpenCL program.
  11031. @table @option
  11032. @item source
  11033. OpenCL program source file.
  11034. @item kernel
  11035. Kernel name in program.
  11036. @item inputs
  11037. Number of inputs to the filter. Defaults to 1.
  11038. @item size, s
  11039. Size of output frames. Defaults to the same as the first input.
  11040. @end table
  11041. The program source file must contain a kernel function with the given name,
  11042. which will be run once for each plane of the output. Each run on a plane
  11043. gets enqueued as a separate 2D global NDRange with one work-item for each
  11044. pixel to be generated. The global ID offset for each work-item is therefore
  11045. the coordinates of a pixel in the destination image.
  11046. The kernel function needs to take the following arguments:
  11047. @itemize
  11048. @item
  11049. Destination image, @var{__write_only image2d_t}.
  11050. This image will become the output; the kernel should write all of it.
  11051. @item
  11052. Frame index, @var{unsigned int}.
  11053. This is a counter starting from zero and increasing by one for each frame.
  11054. @item
  11055. Source images, @var{__read_only image2d_t}.
  11056. These are the most recent images on each input. The kernel may read from
  11057. them to generate the output, but they can't be written to.
  11058. @end itemize
  11059. Example programs:
  11060. @itemize
  11061. @item
  11062. Copy the input to the output (output must be the same size as the input).
  11063. @verbatim
  11064. __kernel void copy(__write_only image2d_t destination,
  11065. unsigned int index,
  11066. __read_only image2d_t source)
  11067. {
  11068. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  11069. int2 location = (int2)(get_global_id(0), get_global_id(1));
  11070. float4 value = read_imagef(source, sampler, location);
  11071. write_imagef(destination, location, value);
  11072. }
  11073. @end verbatim
  11074. @item
  11075. Apply a simple transformation, rotating the input by an amount increasing
  11076. with the index counter. Pixel values are linearly interpolated by the
  11077. sampler, and the output need not have the same dimensions as the input.
  11078. @verbatim
  11079. __kernel void rotate_image(__write_only image2d_t dst,
  11080. unsigned int index,
  11081. __read_only image2d_t src)
  11082. {
  11083. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  11084. CLK_FILTER_LINEAR);
  11085. float angle = (float)index / 100.0f;
  11086. float2 dst_dim = convert_float2(get_image_dim(dst));
  11087. float2 src_dim = convert_float2(get_image_dim(src));
  11088. float2 dst_cen = dst_dim / 2.0f;
  11089. float2 src_cen = src_dim / 2.0f;
  11090. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  11091. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  11092. float2 src_pos = {
  11093. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  11094. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  11095. };
  11096. src_pos = src_pos * src_dim / dst_dim;
  11097. float2 src_loc = src_pos + src_cen;
  11098. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  11099. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  11100. write_imagef(dst, dst_loc, 0.5f);
  11101. else
  11102. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  11103. }
  11104. @end verbatim
  11105. @item
  11106. Blend two inputs together, with the amount of each input used varying
  11107. with the index counter.
  11108. @verbatim
  11109. __kernel void blend_images(__write_only image2d_t dst,
  11110. unsigned int index,
  11111. __read_only image2d_t src1,
  11112. __read_only image2d_t src2)
  11113. {
  11114. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  11115. CLK_FILTER_LINEAR);
  11116. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  11117. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  11118. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  11119. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  11120. float4 val1 = read_imagef(src1, sampler, src1_loc);
  11121. float4 val2 = read_imagef(src2, sampler, src2_loc);
  11122. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  11123. }
  11124. @end verbatim
  11125. @end itemize
  11126. @section pseudocolor
  11127. Alter frame colors in video with pseudocolors.
  11128. This filter accepts the following options:
  11129. @table @option
  11130. @item c0
  11131. set pixel first component expression
  11132. @item c1
  11133. set pixel second component expression
  11134. @item c2
  11135. set pixel third component expression
  11136. @item c3
  11137. set pixel fourth component expression, corresponds to the alpha component
  11138. @item i
  11139. set component to use as base for altering colors
  11140. @end table
  11141. Each of them specifies the expression to use for computing the lookup table for
  11142. the corresponding pixel component values.
  11143. The expressions can contain the following constants and functions:
  11144. @table @option
  11145. @item w
  11146. @item h
  11147. The input width and height.
  11148. @item val
  11149. The input value for the pixel component.
  11150. @item ymin, umin, vmin, amin
  11151. The minimum allowed component value.
  11152. @item ymax, umax, vmax, amax
  11153. The maximum allowed component value.
  11154. @end table
  11155. All expressions default to "val".
  11156. @subsection Examples
  11157. @itemize
  11158. @item
  11159. Change too high luma values to gradient:
  11160. @example
  11161. 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'"
  11162. @end example
  11163. @end itemize
  11164. @section psnr
  11165. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  11166. Ratio) between two input videos.
  11167. This filter takes in input two input videos, the first input is
  11168. considered the "main" source and is passed unchanged to the
  11169. output. The second input is used as a "reference" video for computing
  11170. the PSNR.
  11171. Both video inputs must have the same resolution and pixel format for
  11172. this filter to work correctly. Also it assumes that both inputs
  11173. have the same number of frames, which are compared one by one.
  11174. The obtained average PSNR is printed through the logging system.
  11175. The filter stores the accumulated MSE (mean squared error) of each
  11176. frame, and at the end of the processing it is averaged across all frames
  11177. equally, and the following formula is applied to obtain the PSNR:
  11178. @example
  11179. PSNR = 10*log10(MAX^2/MSE)
  11180. @end example
  11181. Where MAX is the average of the maximum values of each component of the
  11182. image.
  11183. The description of the accepted parameters follows.
  11184. @table @option
  11185. @item stats_file, f
  11186. If specified the filter will use the named file to save the PSNR of
  11187. each individual frame. When filename equals "-" the data is sent to
  11188. standard output.
  11189. @item stats_version
  11190. Specifies which version of the stats file format to use. Details of
  11191. each format are written below.
  11192. Default value is 1.
  11193. @item stats_add_max
  11194. Determines whether the max value is output to the stats log.
  11195. Default value is 0.
  11196. Requires stats_version >= 2. If this is set and stats_version < 2,
  11197. the filter will return an error.
  11198. @end table
  11199. This filter also supports the @ref{framesync} options.
  11200. The file printed if @var{stats_file} is selected, contains a sequence of
  11201. key/value pairs of the form @var{key}:@var{value} for each compared
  11202. couple of frames.
  11203. If a @var{stats_version} greater than 1 is specified, a header line precedes
  11204. the list of per-frame-pair stats, with key value pairs following the frame
  11205. format with the following parameters:
  11206. @table @option
  11207. @item psnr_log_version
  11208. The version of the log file format. Will match @var{stats_version}.
  11209. @item fields
  11210. A comma separated list of the per-frame-pair parameters included in
  11211. the log.
  11212. @end table
  11213. A description of each shown per-frame-pair parameter follows:
  11214. @table @option
  11215. @item n
  11216. sequential number of the input frame, starting from 1
  11217. @item mse_avg
  11218. Mean Square Error pixel-by-pixel average difference of the compared
  11219. frames, averaged over all the image components.
  11220. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  11221. Mean Square Error pixel-by-pixel average difference of the compared
  11222. frames for the component specified by the suffix.
  11223. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  11224. Peak Signal to Noise ratio of the compared frames for the component
  11225. specified by the suffix.
  11226. @item max_avg, max_y, max_u, max_v
  11227. Maximum allowed value for each channel, and average over all
  11228. channels.
  11229. @end table
  11230. For example:
  11231. @example
  11232. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11233. [main][ref] psnr="stats_file=stats.log" [out]
  11234. @end example
  11235. On this example the input file being processed is compared with the
  11236. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  11237. is stored in @file{stats.log}.
  11238. @anchor{pullup}
  11239. @section pullup
  11240. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  11241. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  11242. content.
  11243. The pullup filter is designed to take advantage of future context in making
  11244. its decisions. This filter is stateless in the sense that it does not lock
  11245. onto a pattern to follow, but it instead looks forward to the following
  11246. fields in order to identify matches and rebuild progressive frames.
  11247. To produce content with an even framerate, insert the fps filter after
  11248. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  11249. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  11250. The filter accepts the following options:
  11251. @table @option
  11252. @item jl
  11253. @item jr
  11254. @item jt
  11255. @item jb
  11256. These options set the amount of "junk" to ignore at the left, right, top, and
  11257. bottom of the image, respectively. Left and right are in units of 8 pixels,
  11258. while top and bottom are in units of 2 lines.
  11259. The default is 8 pixels on each side.
  11260. @item sb
  11261. Set the strict breaks. Setting this option to 1 will reduce the chances of
  11262. filter generating an occasional mismatched frame, but it may also cause an
  11263. excessive number of frames to be dropped during high motion sequences.
  11264. Conversely, setting it to -1 will make filter match fields more easily.
  11265. This may help processing of video where there is slight blurring between
  11266. the fields, but may also cause there to be interlaced frames in the output.
  11267. Default value is @code{0}.
  11268. @item mp
  11269. Set the metric plane to use. It accepts the following values:
  11270. @table @samp
  11271. @item l
  11272. Use luma plane.
  11273. @item u
  11274. Use chroma blue plane.
  11275. @item v
  11276. Use chroma red plane.
  11277. @end table
  11278. This option may be set to use chroma plane instead of the default luma plane
  11279. for doing filter's computations. This may improve accuracy on very clean
  11280. source material, but more likely will decrease accuracy, especially if there
  11281. is chroma noise (rainbow effect) or any grayscale video.
  11282. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  11283. load and make pullup usable in realtime on slow machines.
  11284. @end table
  11285. For best results (without duplicated frames in the output file) it is
  11286. necessary to change the output frame rate. For example, to inverse
  11287. telecine NTSC input:
  11288. @example
  11289. ffmpeg -i input -vf pullup -r 24000/1001 ...
  11290. @end example
  11291. @section qp
  11292. Change video quantization parameters (QP).
  11293. The filter accepts the following option:
  11294. @table @option
  11295. @item qp
  11296. Set expression for quantization parameter.
  11297. @end table
  11298. The expression is evaluated through the eval API and can contain, among others,
  11299. the following constants:
  11300. @table @var
  11301. @item known
  11302. 1 if index is not 129, 0 otherwise.
  11303. @item qp
  11304. Sequential index starting from -129 to 128.
  11305. @end table
  11306. @subsection Examples
  11307. @itemize
  11308. @item
  11309. Some equation like:
  11310. @example
  11311. qp=2+2*sin(PI*qp)
  11312. @end example
  11313. @end itemize
  11314. @section random
  11315. Flush video frames from internal cache of frames into a random order.
  11316. No frame is discarded.
  11317. Inspired by @ref{frei0r} nervous filter.
  11318. @table @option
  11319. @item frames
  11320. Set size in number of frames of internal cache, in range from @code{2} to
  11321. @code{512}. Default is @code{30}.
  11322. @item seed
  11323. Set seed for random number generator, must be an integer included between
  11324. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11325. less than @code{0}, the filter will try to use a good random seed on a
  11326. best effort basis.
  11327. @end table
  11328. @section readeia608
  11329. Read closed captioning (EIA-608) information from the top lines of a video frame.
  11330. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  11331. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  11332. with EIA-608 data (starting from 0). A description of each metadata value follows:
  11333. @table @option
  11334. @item lavfi.readeia608.X.cc
  11335. The two bytes stored as EIA-608 data (printed in hexadecimal).
  11336. @item lavfi.readeia608.X.line
  11337. The number of the line on which the EIA-608 data was identified and read.
  11338. @end table
  11339. This filter accepts the following options:
  11340. @table @option
  11341. @item scan_min
  11342. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  11343. @item scan_max
  11344. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  11345. @item mac
  11346. Set minimal acceptable amplitude change for sync codes detection.
  11347. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  11348. @item spw
  11349. Set the ratio of width reserved for sync code detection.
  11350. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  11351. @item mhd
  11352. Set the max peaks height difference for sync code detection.
  11353. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11354. @item mpd
  11355. Set max peaks period difference for sync code detection.
  11356. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11357. @item msd
  11358. Set the first two max start code bits differences.
  11359. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  11360. @item bhd
  11361. Set the minimum ratio of bits height compared to 3rd start code bit.
  11362. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  11363. @item th_w
  11364. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  11365. @item th_b
  11366. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  11367. @item chp
  11368. Enable checking the parity bit. In the event of a parity error, the filter will output
  11369. @code{0x00} for that character. Default is false.
  11370. @item lp
  11371. Lowpass lines prior to further processing. Default is disabled.
  11372. @end table
  11373. @subsection Examples
  11374. @itemize
  11375. @item
  11376. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  11377. @example
  11378. 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
  11379. @end example
  11380. @end itemize
  11381. @section readvitc
  11382. Read vertical interval timecode (VITC) information from the top lines of a
  11383. video frame.
  11384. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  11385. timecode value, if a valid timecode has been detected. Further metadata key
  11386. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  11387. timecode data has been found or not.
  11388. This filter accepts the following options:
  11389. @table @option
  11390. @item scan_max
  11391. Set the maximum number of lines to scan for VITC data. If the value is set to
  11392. @code{-1} the full video frame is scanned. Default is @code{45}.
  11393. @item thr_b
  11394. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  11395. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  11396. @item thr_w
  11397. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  11398. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  11399. @end table
  11400. @subsection Examples
  11401. @itemize
  11402. @item
  11403. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  11404. draw @code{--:--:--:--} as a placeholder:
  11405. @example
  11406. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  11407. @end example
  11408. @end itemize
  11409. @section remap
  11410. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  11411. Destination pixel at position (X, Y) will be picked from source (x, y) position
  11412. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  11413. value for pixel will be used for destination pixel.
  11414. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  11415. will have Xmap/Ymap video stream dimensions.
  11416. Xmap and Ymap input video streams are 16bit depth, single channel.
  11417. @table @option
  11418. @item format
  11419. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  11420. Default is @code{color}.
  11421. @end table
  11422. @section removegrain
  11423. The removegrain filter is a spatial denoiser for progressive video.
  11424. @table @option
  11425. @item m0
  11426. Set mode for the first plane.
  11427. @item m1
  11428. Set mode for the second plane.
  11429. @item m2
  11430. Set mode for the third plane.
  11431. @item m3
  11432. Set mode for the fourth plane.
  11433. @end table
  11434. Range of mode is from 0 to 24. Description of each mode follows:
  11435. @table @var
  11436. @item 0
  11437. Leave input plane unchanged. Default.
  11438. @item 1
  11439. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  11440. @item 2
  11441. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  11442. @item 3
  11443. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  11444. @item 4
  11445. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  11446. This is equivalent to a median filter.
  11447. @item 5
  11448. Line-sensitive clipping giving the minimal change.
  11449. @item 6
  11450. Line-sensitive clipping, intermediate.
  11451. @item 7
  11452. Line-sensitive clipping, intermediate.
  11453. @item 8
  11454. Line-sensitive clipping, intermediate.
  11455. @item 9
  11456. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  11457. @item 10
  11458. Replaces the target pixel with the closest neighbour.
  11459. @item 11
  11460. [1 2 1] horizontal and vertical kernel blur.
  11461. @item 12
  11462. Same as mode 11.
  11463. @item 13
  11464. Bob mode, interpolates top field from the line where the neighbours
  11465. pixels are the closest.
  11466. @item 14
  11467. Bob mode, interpolates bottom field from the line where the neighbours
  11468. pixels are the closest.
  11469. @item 15
  11470. Bob mode, interpolates top field. Same as 13 but with a more complicated
  11471. interpolation formula.
  11472. @item 16
  11473. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  11474. interpolation formula.
  11475. @item 17
  11476. Clips the pixel with the minimum and maximum of respectively the maximum and
  11477. minimum of each pair of opposite neighbour pixels.
  11478. @item 18
  11479. Line-sensitive clipping using opposite neighbours whose greatest distance from
  11480. the current pixel is minimal.
  11481. @item 19
  11482. Replaces the pixel with the average of its 8 neighbours.
  11483. @item 20
  11484. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  11485. @item 21
  11486. Clips pixels using the averages of opposite neighbour.
  11487. @item 22
  11488. Same as mode 21 but simpler and faster.
  11489. @item 23
  11490. Small edge and halo removal, but reputed useless.
  11491. @item 24
  11492. Similar as 23.
  11493. @end table
  11494. @section removelogo
  11495. Suppress a TV station logo, using an image file to determine which
  11496. pixels comprise the logo. It works by filling in the pixels that
  11497. comprise the logo with neighboring pixels.
  11498. The filter accepts the following options:
  11499. @table @option
  11500. @item filename, f
  11501. Set the filter bitmap file, which can be any image format supported by
  11502. libavformat. The width and height of the image file must match those of the
  11503. video stream being processed.
  11504. @end table
  11505. Pixels in the provided bitmap image with a value of zero are not
  11506. considered part of the logo, non-zero pixels are considered part of
  11507. the logo. If you use white (255) for the logo and black (0) for the
  11508. rest, you will be safe. For making the filter bitmap, it is
  11509. recommended to take a screen capture of a black frame with the logo
  11510. visible, and then using a threshold filter followed by the erode
  11511. filter once or twice.
  11512. If needed, little splotches can be fixed manually. Remember that if
  11513. logo pixels are not covered, the filter quality will be much
  11514. reduced. Marking too many pixels as part of the logo does not hurt as
  11515. much, but it will increase the amount of blurring needed to cover over
  11516. the image and will destroy more information than necessary, and extra
  11517. pixels will slow things down on a large logo.
  11518. @section repeatfields
  11519. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  11520. fields based on its value.
  11521. @section reverse
  11522. Reverse a video clip.
  11523. Warning: This filter requires memory to buffer the entire clip, so trimming
  11524. is suggested.
  11525. @subsection Examples
  11526. @itemize
  11527. @item
  11528. Take the first 5 seconds of a clip, and reverse it.
  11529. @example
  11530. trim=end=5,reverse
  11531. @end example
  11532. @end itemize
  11533. @section rgbashift
  11534. Shift R/G/B/A pixels horizontally and/or vertically.
  11535. The filter accepts the following options:
  11536. @table @option
  11537. @item rh
  11538. Set amount to shift red horizontally.
  11539. @item rv
  11540. Set amount to shift red vertically.
  11541. @item gh
  11542. Set amount to shift green horizontally.
  11543. @item gv
  11544. Set amount to shift green vertically.
  11545. @item bh
  11546. Set amount to shift blue horizontally.
  11547. @item bv
  11548. Set amount to shift blue vertically.
  11549. @item ah
  11550. Set amount to shift alpha horizontally.
  11551. @item av
  11552. Set amount to shift alpha vertically.
  11553. @item edge
  11554. Set edge mode, can be @var{smear}, default, or @var{warp}.
  11555. @end table
  11556. @section roberts
  11557. Apply roberts cross operator to input video stream.
  11558. The filter accepts the following option:
  11559. @table @option
  11560. @item planes
  11561. Set which planes will be processed, unprocessed planes will be copied.
  11562. By default value 0xf, all planes will be processed.
  11563. @item scale
  11564. Set value which will be multiplied with filtered result.
  11565. @item delta
  11566. Set value which will be added to filtered result.
  11567. @end table
  11568. @section rotate
  11569. Rotate video by an arbitrary angle expressed in radians.
  11570. The filter accepts the following options:
  11571. A description of the optional parameters follows.
  11572. @table @option
  11573. @item angle, a
  11574. Set an expression for the angle by which to rotate the input video
  11575. clockwise, expressed as a number of radians. A negative value will
  11576. result in a counter-clockwise rotation. By default it is set to "0".
  11577. This expression is evaluated for each frame.
  11578. @item out_w, ow
  11579. Set the output width expression, default value is "iw".
  11580. This expression is evaluated just once during configuration.
  11581. @item out_h, oh
  11582. Set the output height expression, default value is "ih".
  11583. This expression is evaluated just once during configuration.
  11584. @item bilinear
  11585. Enable bilinear interpolation if set to 1, a value of 0 disables
  11586. it. Default value is 1.
  11587. @item fillcolor, c
  11588. Set the color used to fill the output area not covered by the rotated
  11589. image. For the general syntax of this option, check the
  11590. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11591. If the special value "none" is selected then no
  11592. background is printed (useful for example if the background is never shown).
  11593. Default value is "black".
  11594. @end table
  11595. The expressions for the angle and the output size can contain the
  11596. following constants and functions:
  11597. @table @option
  11598. @item n
  11599. sequential number of the input frame, starting from 0. It is always NAN
  11600. before the first frame is filtered.
  11601. @item t
  11602. time in seconds of the input frame, it is set to 0 when the filter is
  11603. configured. It is always NAN before the first frame is filtered.
  11604. @item hsub
  11605. @item vsub
  11606. horizontal and vertical chroma subsample values. For example for the
  11607. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11608. @item in_w, iw
  11609. @item in_h, ih
  11610. the input video width and height
  11611. @item out_w, ow
  11612. @item out_h, oh
  11613. the output width and height, that is the size of the padded area as
  11614. specified by the @var{width} and @var{height} expressions
  11615. @item rotw(a)
  11616. @item roth(a)
  11617. the minimal width/height required for completely containing the input
  11618. video rotated by @var{a} radians.
  11619. These are only available when computing the @option{out_w} and
  11620. @option{out_h} expressions.
  11621. @end table
  11622. @subsection Examples
  11623. @itemize
  11624. @item
  11625. Rotate the input by PI/6 radians clockwise:
  11626. @example
  11627. rotate=PI/6
  11628. @end example
  11629. @item
  11630. Rotate the input by PI/6 radians counter-clockwise:
  11631. @example
  11632. rotate=-PI/6
  11633. @end example
  11634. @item
  11635. Rotate the input by 45 degrees clockwise:
  11636. @example
  11637. rotate=45*PI/180
  11638. @end example
  11639. @item
  11640. Apply a constant rotation with period T, starting from an angle of PI/3:
  11641. @example
  11642. rotate=PI/3+2*PI*t/T
  11643. @end example
  11644. @item
  11645. Make the input video rotation oscillating with a period of T
  11646. seconds and an amplitude of A radians:
  11647. @example
  11648. rotate=A*sin(2*PI/T*t)
  11649. @end example
  11650. @item
  11651. Rotate the video, output size is chosen so that the whole rotating
  11652. input video is always completely contained in the output:
  11653. @example
  11654. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  11655. @end example
  11656. @item
  11657. Rotate the video, reduce the output size so that no background is ever
  11658. shown:
  11659. @example
  11660. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  11661. @end example
  11662. @end itemize
  11663. @subsection Commands
  11664. The filter supports the following commands:
  11665. @table @option
  11666. @item a, angle
  11667. Set the angle expression.
  11668. The command accepts the same syntax of the corresponding option.
  11669. If the specified expression is not valid, it is kept at its current
  11670. value.
  11671. @end table
  11672. @section sab
  11673. Apply Shape Adaptive Blur.
  11674. The filter accepts the following options:
  11675. @table @option
  11676. @item luma_radius, lr
  11677. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  11678. value is 1.0. A greater value will result in a more blurred image, and
  11679. in slower processing.
  11680. @item luma_pre_filter_radius, lpfr
  11681. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  11682. value is 1.0.
  11683. @item luma_strength, ls
  11684. Set luma maximum difference between pixels to still be considered, must
  11685. be a value in the 0.1-100.0 range, default value is 1.0.
  11686. @item chroma_radius, cr
  11687. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  11688. greater value will result in a more blurred image, and in slower
  11689. processing.
  11690. @item chroma_pre_filter_radius, cpfr
  11691. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  11692. @item chroma_strength, cs
  11693. Set chroma maximum difference between pixels to still be considered,
  11694. must be a value in the -0.9-100.0 range.
  11695. @end table
  11696. Each chroma option value, if not explicitly specified, is set to the
  11697. corresponding luma option value.
  11698. @anchor{scale}
  11699. @section scale
  11700. Scale (resize) the input video, using the libswscale library.
  11701. The scale filter forces the output display aspect ratio to be the same
  11702. of the input, by changing the output sample aspect ratio.
  11703. If the input image format is different from the format requested by
  11704. the next filter, the scale filter will convert the input to the
  11705. requested format.
  11706. @subsection Options
  11707. The filter accepts the following options, or any of the options
  11708. supported by the libswscale scaler.
  11709. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  11710. the complete list of scaler options.
  11711. @table @option
  11712. @item width, w
  11713. @item height, h
  11714. Set the output video dimension expression. Default value is the input
  11715. dimension.
  11716. If the @var{width} or @var{w} value is 0, the input width is used for
  11717. the output. If the @var{height} or @var{h} value is 0, the input height
  11718. is used for the output.
  11719. If one and only one of the values is -n with n >= 1, the scale filter
  11720. will use a value that maintains the aspect ratio of the input image,
  11721. calculated from the other specified dimension. After that it will,
  11722. however, make sure that the calculated dimension is divisible by n and
  11723. adjust the value if necessary.
  11724. If both values are -n with n >= 1, the behavior will be identical to
  11725. both values being set to 0 as previously detailed.
  11726. See below for the list of accepted constants for use in the dimension
  11727. expression.
  11728. @item eval
  11729. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  11730. @table @samp
  11731. @item init
  11732. Only evaluate expressions once during the filter initialization or when a command is processed.
  11733. @item frame
  11734. Evaluate expressions for each incoming frame.
  11735. @end table
  11736. Default value is @samp{init}.
  11737. @item interl
  11738. Set the interlacing mode. It accepts the following values:
  11739. @table @samp
  11740. @item 1
  11741. Force interlaced aware scaling.
  11742. @item 0
  11743. Do not apply interlaced scaling.
  11744. @item -1
  11745. Select interlaced aware scaling depending on whether the source frames
  11746. are flagged as interlaced or not.
  11747. @end table
  11748. Default value is @samp{0}.
  11749. @item flags
  11750. Set libswscale scaling flags. See
  11751. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11752. complete list of values. If not explicitly specified the filter applies
  11753. the default flags.
  11754. @item param0, param1
  11755. Set libswscale input parameters for scaling algorithms that need them. See
  11756. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11757. complete documentation. If not explicitly specified the filter applies
  11758. empty parameters.
  11759. @item size, s
  11760. Set the video size. For the syntax of this option, check the
  11761. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11762. @item in_color_matrix
  11763. @item out_color_matrix
  11764. Set in/output YCbCr color space type.
  11765. This allows the autodetected value to be overridden as well as allows forcing
  11766. a specific value used for the output and encoder.
  11767. If not specified, the color space type depends on the pixel format.
  11768. Possible values:
  11769. @table @samp
  11770. @item auto
  11771. Choose automatically.
  11772. @item bt709
  11773. Format conforming to International Telecommunication Union (ITU)
  11774. Recommendation BT.709.
  11775. @item fcc
  11776. Set color space conforming to the United States Federal Communications
  11777. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  11778. @item bt601
  11779. @item bt470
  11780. @item smpte170m
  11781. Set color space conforming to:
  11782. @itemize
  11783. @item
  11784. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  11785. @item
  11786. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  11787. @item
  11788. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  11789. @end itemize
  11790. @item smpte240m
  11791. Set color space conforming to SMPTE ST 240:1999.
  11792. @item bt2020
  11793. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  11794. @end table
  11795. @item in_range
  11796. @item out_range
  11797. Set in/output YCbCr sample range.
  11798. This allows the autodetected value to be overridden as well as allows forcing
  11799. a specific value used for the output and encoder. If not specified, the
  11800. range depends on the pixel format. Possible values:
  11801. @table @samp
  11802. @item auto/unknown
  11803. Choose automatically.
  11804. @item jpeg/full/pc
  11805. Set full range (0-255 in case of 8-bit luma).
  11806. @item mpeg/limited/tv
  11807. Set "MPEG" range (16-235 in case of 8-bit luma).
  11808. @end table
  11809. @item force_original_aspect_ratio
  11810. Enable decreasing or increasing output video width or height if necessary to
  11811. keep the original aspect ratio. Possible values:
  11812. @table @samp
  11813. @item disable
  11814. Scale the video as specified and disable this feature.
  11815. @item decrease
  11816. The output video dimensions will automatically be decreased if needed.
  11817. @item increase
  11818. The output video dimensions will automatically be increased if needed.
  11819. @end table
  11820. One useful instance of this option is that when you know a specific device's
  11821. maximum allowed resolution, you can use this to limit the output video to
  11822. that, while retaining the aspect ratio. For example, device A allows
  11823. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  11824. decrease) and specifying 1280x720 to the command line makes the output
  11825. 1280x533.
  11826. Please note that this is a different thing than specifying -1 for @option{w}
  11827. or @option{h}, you still need to specify the output resolution for this option
  11828. to work.
  11829. @item force_divisible_by Ensures that the output resolution is divisible by the
  11830. given integer when used together with @option{force_original_aspect_ratio}. This
  11831. works similar to using -n in the @option{w} and @option{h} options.
  11832. This option respects the value set for @option{force_original_aspect_ratio},
  11833. increasing or decreasing the resolution accordingly. This may slightly modify
  11834. the video's aspect ration.
  11835. This can be handy, for example, if you want to have a video fit within a defined
  11836. resolution using the @option{force_original_aspect_ratio} option but have
  11837. encoder restrictions when it comes to width or height.
  11838. @end table
  11839. The values of the @option{w} and @option{h} options are expressions
  11840. containing the following constants:
  11841. @table @var
  11842. @item in_w
  11843. @item in_h
  11844. The input width and height
  11845. @item iw
  11846. @item ih
  11847. These are the same as @var{in_w} and @var{in_h}.
  11848. @item out_w
  11849. @item out_h
  11850. The output (scaled) width and height
  11851. @item ow
  11852. @item oh
  11853. These are the same as @var{out_w} and @var{out_h}
  11854. @item a
  11855. The same as @var{iw} / @var{ih}
  11856. @item sar
  11857. input sample aspect ratio
  11858. @item dar
  11859. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11860. @item hsub
  11861. @item vsub
  11862. horizontal and vertical input chroma subsample values. For example for the
  11863. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11864. @item ohsub
  11865. @item ovsub
  11866. horizontal and vertical output chroma subsample values. For example for the
  11867. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11868. @end table
  11869. @subsection Examples
  11870. @itemize
  11871. @item
  11872. Scale the input video to a size of 200x100
  11873. @example
  11874. scale=w=200:h=100
  11875. @end example
  11876. This is equivalent to:
  11877. @example
  11878. scale=200:100
  11879. @end example
  11880. or:
  11881. @example
  11882. scale=200x100
  11883. @end example
  11884. @item
  11885. Specify a size abbreviation for the output size:
  11886. @example
  11887. scale=qcif
  11888. @end example
  11889. which can also be written as:
  11890. @example
  11891. scale=size=qcif
  11892. @end example
  11893. @item
  11894. Scale the input to 2x:
  11895. @example
  11896. scale=w=2*iw:h=2*ih
  11897. @end example
  11898. @item
  11899. The above is the same as:
  11900. @example
  11901. scale=2*in_w:2*in_h
  11902. @end example
  11903. @item
  11904. Scale the input to 2x with forced interlaced scaling:
  11905. @example
  11906. scale=2*iw:2*ih:interl=1
  11907. @end example
  11908. @item
  11909. Scale the input to half size:
  11910. @example
  11911. scale=w=iw/2:h=ih/2
  11912. @end example
  11913. @item
  11914. Increase the width, and set the height to the same size:
  11915. @example
  11916. scale=3/2*iw:ow
  11917. @end example
  11918. @item
  11919. Seek Greek harmony:
  11920. @example
  11921. scale=iw:1/PHI*iw
  11922. scale=ih*PHI:ih
  11923. @end example
  11924. @item
  11925. Increase the height, and set the width to 3/2 of the height:
  11926. @example
  11927. scale=w=3/2*oh:h=3/5*ih
  11928. @end example
  11929. @item
  11930. Increase the size, making the size a multiple of the chroma
  11931. subsample values:
  11932. @example
  11933. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  11934. @end example
  11935. @item
  11936. Increase the width to a maximum of 500 pixels,
  11937. keeping the same aspect ratio as the input:
  11938. @example
  11939. scale=w='min(500\, iw*3/2):h=-1'
  11940. @end example
  11941. @item
  11942. Make pixels square by combining scale and setsar:
  11943. @example
  11944. scale='trunc(ih*dar):ih',setsar=1/1
  11945. @end example
  11946. @item
  11947. Make pixels square by combining scale and setsar,
  11948. making sure the resulting resolution is even (required by some codecs):
  11949. @example
  11950. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  11951. @end example
  11952. @end itemize
  11953. @subsection Commands
  11954. This filter supports the following commands:
  11955. @table @option
  11956. @item width, w
  11957. @item height, h
  11958. Set the output video dimension expression.
  11959. The command accepts the same syntax of the corresponding option.
  11960. If the specified expression is not valid, it is kept at its current
  11961. value.
  11962. @end table
  11963. @section scale_npp
  11964. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  11965. format conversion on CUDA video frames. Setting the output width and height
  11966. works in the same way as for the @var{scale} filter.
  11967. The following additional options are accepted:
  11968. @table @option
  11969. @item format
  11970. The pixel format of the output CUDA frames. If set to the string "same" (the
  11971. default), the input format will be kept. Note that automatic format negotiation
  11972. and conversion is not yet supported for hardware frames
  11973. @item interp_algo
  11974. The interpolation algorithm used for resizing. One of the following:
  11975. @table @option
  11976. @item nn
  11977. Nearest neighbour.
  11978. @item linear
  11979. @item cubic
  11980. @item cubic2p_bspline
  11981. 2-parameter cubic (B=1, C=0)
  11982. @item cubic2p_catmullrom
  11983. 2-parameter cubic (B=0, C=1/2)
  11984. @item cubic2p_b05c03
  11985. 2-parameter cubic (B=1/2, C=3/10)
  11986. @item super
  11987. Supersampling
  11988. @item lanczos
  11989. @end table
  11990. @end table
  11991. @section scale2ref
  11992. Scale (resize) the input video, based on a reference video.
  11993. See the scale filter for available options, scale2ref supports the same but
  11994. uses the reference video instead of the main input as basis. scale2ref also
  11995. supports the following additional constants for the @option{w} and
  11996. @option{h} options:
  11997. @table @var
  11998. @item main_w
  11999. @item main_h
  12000. The main input video's width and height
  12001. @item main_a
  12002. The same as @var{main_w} / @var{main_h}
  12003. @item main_sar
  12004. The main input video's sample aspect ratio
  12005. @item main_dar, mdar
  12006. The main input video's display aspect ratio. Calculated from
  12007. @code{(main_w / main_h) * main_sar}.
  12008. @item main_hsub
  12009. @item main_vsub
  12010. The main input video's horizontal and vertical chroma subsample values.
  12011. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  12012. is 1.
  12013. @end table
  12014. @subsection Examples
  12015. @itemize
  12016. @item
  12017. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  12018. @example
  12019. 'scale2ref[b][a];[a][b]overlay'
  12020. @end example
  12021. @item
  12022. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  12023. @example
  12024. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  12025. @end example
  12026. @end itemize
  12027. @section scroll
  12028. Scroll input video horizontally and/or vertically by constant speed.
  12029. The filter accepts the following options:
  12030. @table @option
  12031. @item horizontal, h
  12032. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12033. Negative values changes scrolling direction.
  12034. @item vertical, v
  12035. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12036. Negative values changes scrolling direction.
  12037. @item hpos
  12038. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  12039. @item vpos
  12040. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  12041. @end table
  12042. @anchor{selectivecolor}
  12043. @section selectivecolor
  12044. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  12045. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  12046. by the "purity" of the color (that is, how saturated it already is).
  12047. This filter is similar to the Adobe Photoshop Selective Color tool.
  12048. The filter accepts the following options:
  12049. @table @option
  12050. @item correction_method
  12051. Select color correction method.
  12052. Available values are:
  12053. @table @samp
  12054. @item absolute
  12055. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  12056. component value).
  12057. @item relative
  12058. Specified adjustments are relative to the original component value.
  12059. @end table
  12060. Default is @code{absolute}.
  12061. @item reds
  12062. Adjustments for red pixels (pixels where the red component is the maximum)
  12063. @item yellows
  12064. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  12065. @item greens
  12066. Adjustments for green pixels (pixels where the green component is the maximum)
  12067. @item cyans
  12068. Adjustments for cyan pixels (pixels where the red component is the minimum)
  12069. @item blues
  12070. Adjustments for blue pixels (pixels where the blue component is the maximum)
  12071. @item magentas
  12072. Adjustments for magenta pixels (pixels where the green component is the minimum)
  12073. @item whites
  12074. Adjustments for white pixels (pixels where all components are greater than 128)
  12075. @item neutrals
  12076. Adjustments for all pixels except pure black and pure white
  12077. @item blacks
  12078. Adjustments for black pixels (pixels where all components are lesser than 128)
  12079. @item psfile
  12080. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  12081. @end table
  12082. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  12083. 4 space separated floating point adjustment values in the [-1,1] range,
  12084. respectively to adjust the amount of cyan, magenta, yellow and black for the
  12085. pixels of its range.
  12086. @subsection Examples
  12087. @itemize
  12088. @item
  12089. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  12090. increase magenta by 27% in blue areas:
  12091. @example
  12092. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  12093. @end example
  12094. @item
  12095. Use a Photoshop selective color preset:
  12096. @example
  12097. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  12098. @end example
  12099. @end itemize
  12100. @anchor{separatefields}
  12101. @section separatefields
  12102. The @code{separatefields} takes a frame-based video input and splits
  12103. each frame into its components fields, producing a new half height clip
  12104. with twice the frame rate and twice the frame count.
  12105. This filter use field-dominance information in frame to decide which
  12106. of each pair of fields to place first in the output.
  12107. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  12108. @section setdar, setsar
  12109. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  12110. output video.
  12111. This is done by changing the specified Sample (aka Pixel) Aspect
  12112. Ratio, according to the following equation:
  12113. @example
  12114. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  12115. @end example
  12116. Keep in mind that the @code{setdar} filter does not modify the pixel
  12117. dimensions of the video frame. Also, the display aspect ratio set by
  12118. this filter may be changed by later filters in the filterchain,
  12119. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  12120. applied.
  12121. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  12122. the filter output video.
  12123. Note that as a consequence of the application of this filter, the
  12124. output display aspect ratio will change according to the equation
  12125. above.
  12126. Keep in mind that the sample aspect ratio set by the @code{setsar}
  12127. filter may be changed by later filters in the filterchain, e.g. if
  12128. another "setsar" or a "setdar" filter is applied.
  12129. It accepts the following parameters:
  12130. @table @option
  12131. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  12132. Set the aspect ratio used by the filter.
  12133. The parameter can be a floating point number string, an expression, or
  12134. a string of the form @var{num}:@var{den}, where @var{num} and
  12135. @var{den} are the numerator and denominator of the aspect ratio. If
  12136. the parameter is not specified, it is assumed the value "0".
  12137. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  12138. should be escaped.
  12139. @item max
  12140. Set the maximum integer value to use for expressing numerator and
  12141. denominator when reducing the expressed aspect ratio to a rational.
  12142. Default value is @code{100}.
  12143. @end table
  12144. The parameter @var{sar} is an expression containing
  12145. the following constants:
  12146. @table @option
  12147. @item E, PI, PHI
  12148. These are approximated values for the mathematical constants e
  12149. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  12150. @item w, h
  12151. The input width and height.
  12152. @item a
  12153. These are the same as @var{w} / @var{h}.
  12154. @item sar
  12155. The input sample aspect ratio.
  12156. @item dar
  12157. The input display aspect ratio. It is the same as
  12158. (@var{w} / @var{h}) * @var{sar}.
  12159. @item hsub, vsub
  12160. Horizontal and vertical chroma subsample values. For example, for the
  12161. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12162. @end table
  12163. @subsection Examples
  12164. @itemize
  12165. @item
  12166. To change the display aspect ratio to 16:9, specify one of the following:
  12167. @example
  12168. setdar=dar=1.77777
  12169. setdar=dar=16/9
  12170. @end example
  12171. @item
  12172. To change the sample aspect ratio to 10:11, specify:
  12173. @example
  12174. setsar=sar=10/11
  12175. @end example
  12176. @item
  12177. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  12178. 1000 in the aspect ratio reduction, use the command:
  12179. @example
  12180. setdar=ratio=16/9:max=1000
  12181. @end example
  12182. @end itemize
  12183. @anchor{setfield}
  12184. @section setfield
  12185. Force field for the output video frame.
  12186. The @code{setfield} filter marks the interlace type field for the
  12187. output frames. It does not change the input frame, but only sets the
  12188. corresponding property, which affects how the frame is treated by
  12189. following filters (e.g. @code{fieldorder} or @code{yadif}).
  12190. The filter accepts the following options:
  12191. @table @option
  12192. @item mode
  12193. Available values are:
  12194. @table @samp
  12195. @item auto
  12196. Keep the same field property.
  12197. @item bff
  12198. Mark the frame as bottom-field-first.
  12199. @item tff
  12200. Mark the frame as top-field-first.
  12201. @item prog
  12202. Mark the frame as progressive.
  12203. @end table
  12204. @end table
  12205. @anchor{setparams}
  12206. @section setparams
  12207. Force frame parameter for the output video frame.
  12208. The @code{setparams} filter marks interlace and color range for the
  12209. output frames. It does not change the input frame, but only sets the
  12210. corresponding property, which affects how the frame is treated by
  12211. filters/encoders.
  12212. @table @option
  12213. @item field_mode
  12214. Available values are:
  12215. @table @samp
  12216. @item auto
  12217. Keep the same field property (default).
  12218. @item bff
  12219. Mark the frame as bottom-field-first.
  12220. @item tff
  12221. Mark the frame as top-field-first.
  12222. @item prog
  12223. Mark the frame as progressive.
  12224. @end table
  12225. @item range
  12226. Available values are:
  12227. @table @samp
  12228. @item auto
  12229. Keep the same color range property (default).
  12230. @item unspecified, unknown
  12231. Mark the frame as unspecified color range.
  12232. @item limited, tv, mpeg
  12233. Mark the frame as limited range.
  12234. @item full, pc, jpeg
  12235. Mark the frame as full range.
  12236. @end table
  12237. @item color_primaries
  12238. Set the color primaries.
  12239. Available values are:
  12240. @table @samp
  12241. @item auto
  12242. Keep the same color primaries property (default).
  12243. @item bt709
  12244. @item unknown
  12245. @item bt470m
  12246. @item bt470bg
  12247. @item smpte170m
  12248. @item smpte240m
  12249. @item film
  12250. @item bt2020
  12251. @item smpte428
  12252. @item smpte431
  12253. @item smpte432
  12254. @item jedec-p22
  12255. @end table
  12256. @item color_trc
  12257. Set the color transfer.
  12258. Available values are:
  12259. @table @samp
  12260. @item auto
  12261. Keep the same color trc property (default).
  12262. @item bt709
  12263. @item unknown
  12264. @item bt470m
  12265. @item bt470bg
  12266. @item smpte170m
  12267. @item smpte240m
  12268. @item linear
  12269. @item log100
  12270. @item log316
  12271. @item iec61966-2-4
  12272. @item bt1361e
  12273. @item iec61966-2-1
  12274. @item bt2020-10
  12275. @item bt2020-12
  12276. @item smpte2084
  12277. @item smpte428
  12278. @item arib-std-b67
  12279. @end table
  12280. @item colorspace
  12281. Set the colorspace.
  12282. Available values are:
  12283. @table @samp
  12284. @item auto
  12285. Keep the same colorspace property (default).
  12286. @item gbr
  12287. @item bt709
  12288. @item unknown
  12289. @item fcc
  12290. @item bt470bg
  12291. @item smpte170m
  12292. @item smpte240m
  12293. @item ycgco
  12294. @item bt2020nc
  12295. @item bt2020c
  12296. @item smpte2085
  12297. @item chroma-derived-nc
  12298. @item chroma-derived-c
  12299. @item ictcp
  12300. @end table
  12301. @end table
  12302. @section showinfo
  12303. Show a line containing various information for each input video frame.
  12304. The input video is not modified.
  12305. This filter supports the following options:
  12306. @table @option
  12307. @item checksum
  12308. Calculate checksums of each plane. By default enabled.
  12309. @end table
  12310. The shown line contains a sequence of key/value pairs of the form
  12311. @var{key}:@var{value}.
  12312. The following values are shown in the output:
  12313. @table @option
  12314. @item n
  12315. The (sequential) number of the input frame, starting from 0.
  12316. @item pts
  12317. The Presentation TimeStamp of the input frame, expressed as a number of
  12318. time base units. The time base unit depends on the filter input pad.
  12319. @item pts_time
  12320. The Presentation TimeStamp of the input frame, expressed as a number of
  12321. seconds.
  12322. @item pos
  12323. The position of the frame in the input stream, or -1 if this information is
  12324. unavailable and/or meaningless (for example in case of synthetic video).
  12325. @item fmt
  12326. The pixel format name.
  12327. @item sar
  12328. The sample aspect ratio of the input frame, expressed in the form
  12329. @var{num}/@var{den}.
  12330. @item s
  12331. The size of the input frame. For the syntax of this option, check the
  12332. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12333. @item i
  12334. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  12335. for bottom field first).
  12336. @item iskey
  12337. This is 1 if the frame is a key frame, 0 otherwise.
  12338. @item type
  12339. The picture type of the input frame ("I" for an I-frame, "P" for a
  12340. P-frame, "B" for a B-frame, or "?" for an unknown type).
  12341. Also refer to the documentation of the @code{AVPictureType} enum and of
  12342. the @code{av_get_picture_type_char} function defined in
  12343. @file{libavutil/avutil.h}.
  12344. @item checksum
  12345. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  12346. @item plane_checksum
  12347. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  12348. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  12349. @end table
  12350. @section showpalette
  12351. Displays the 256 colors palette of each frame. This filter is only relevant for
  12352. @var{pal8} pixel format frames.
  12353. It accepts the following option:
  12354. @table @option
  12355. @item s
  12356. Set the size of the box used to represent one palette color entry. Default is
  12357. @code{30} (for a @code{30x30} pixel box).
  12358. @end table
  12359. @section shuffleframes
  12360. Reorder and/or duplicate and/or drop video frames.
  12361. It accepts the following parameters:
  12362. @table @option
  12363. @item mapping
  12364. Set the destination indexes of input frames.
  12365. This is space or '|' separated list of indexes that maps input frames to output
  12366. frames. Number of indexes also sets maximal value that each index may have.
  12367. '-1' index have special meaning and that is to drop frame.
  12368. @end table
  12369. The first frame has the index 0. The default is to keep the input unchanged.
  12370. @subsection Examples
  12371. @itemize
  12372. @item
  12373. Swap second and third frame of every three frames of the input:
  12374. @example
  12375. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  12376. @end example
  12377. @item
  12378. Swap 10th and 1st frame of every ten frames of the input:
  12379. @example
  12380. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  12381. @end example
  12382. @end itemize
  12383. @section shuffleplanes
  12384. Reorder and/or duplicate video planes.
  12385. It accepts the following parameters:
  12386. @table @option
  12387. @item map0
  12388. The index of the input plane to be used as the first output plane.
  12389. @item map1
  12390. The index of the input plane to be used as the second output plane.
  12391. @item map2
  12392. The index of the input plane to be used as the third output plane.
  12393. @item map3
  12394. The index of the input plane to be used as the fourth output plane.
  12395. @end table
  12396. The first plane has the index 0. The default is to keep the input unchanged.
  12397. @subsection Examples
  12398. @itemize
  12399. @item
  12400. Swap the second and third planes of the input:
  12401. @example
  12402. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  12403. @end example
  12404. @end itemize
  12405. @anchor{signalstats}
  12406. @section signalstats
  12407. Evaluate various visual metrics that assist in determining issues associated
  12408. with the digitization of analog video media.
  12409. By default the filter will log these metadata values:
  12410. @table @option
  12411. @item YMIN
  12412. Display the minimal Y value contained within the input frame. Expressed in
  12413. range of [0-255].
  12414. @item YLOW
  12415. Display the Y value at the 10% percentile within the input frame. Expressed in
  12416. range of [0-255].
  12417. @item YAVG
  12418. Display the average Y value within the input frame. Expressed in range of
  12419. [0-255].
  12420. @item YHIGH
  12421. Display the Y value at the 90% percentile within the input frame. Expressed in
  12422. range of [0-255].
  12423. @item YMAX
  12424. Display the maximum Y value contained within the input frame. Expressed in
  12425. range of [0-255].
  12426. @item UMIN
  12427. Display the minimal U value contained within the input frame. Expressed in
  12428. range of [0-255].
  12429. @item ULOW
  12430. Display the U value at the 10% percentile within the input frame. Expressed in
  12431. range of [0-255].
  12432. @item UAVG
  12433. Display the average U value within the input frame. Expressed in range of
  12434. [0-255].
  12435. @item UHIGH
  12436. Display the U value at the 90% percentile within the input frame. Expressed in
  12437. range of [0-255].
  12438. @item UMAX
  12439. Display the maximum U value contained within the input frame. Expressed in
  12440. range of [0-255].
  12441. @item VMIN
  12442. Display the minimal V value contained within the input frame. Expressed in
  12443. range of [0-255].
  12444. @item VLOW
  12445. Display the V value at the 10% percentile within the input frame. Expressed in
  12446. range of [0-255].
  12447. @item VAVG
  12448. Display the average V value within the input frame. Expressed in range of
  12449. [0-255].
  12450. @item VHIGH
  12451. Display the V value at the 90% percentile within the input frame. Expressed in
  12452. range of [0-255].
  12453. @item VMAX
  12454. Display the maximum V value contained within the input frame. Expressed in
  12455. range of [0-255].
  12456. @item SATMIN
  12457. Display the minimal saturation value contained within the input frame.
  12458. Expressed in range of [0-~181.02].
  12459. @item SATLOW
  12460. Display the saturation value at the 10% percentile within the input frame.
  12461. Expressed in range of [0-~181.02].
  12462. @item SATAVG
  12463. Display the average saturation value within the input frame. Expressed in range
  12464. of [0-~181.02].
  12465. @item SATHIGH
  12466. Display the saturation value at the 90% percentile within the input frame.
  12467. Expressed in range of [0-~181.02].
  12468. @item SATMAX
  12469. Display the maximum saturation value contained within the input frame.
  12470. Expressed in range of [0-~181.02].
  12471. @item HUEMED
  12472. Display the median value for hue within the input frame. Expressed in range of
  12473. [0-360].
  12474. @item HUEAVG
  12475. Display the average value for hue within the input frame. Expressed in range of
  12476. [0-360].
  12477. @item YDIF
  12478. Display the average of sample value difference between all values of the Y
  12479. plane in the current frame and corresponding values of the previous input frame.
  12480. Expressed in range of [0-255].
  12481. @item UDIF
  12482. Display the average of sample value difference between all values of the U
  12483. plane in the current frame and corresponding values of the previous input frame.
  12484. Expressed in range of [0-255].
  12485. @item VDIF
  12486. Display the average of sample value difference between all values of the V
  12487. plane in the current frame and corresponding values of the previous input frame.
  12488. Expressed in range of [0-255].
  12489. @item YBITDEPTH
  12490. Display bit depth of Y plane in current frame.
  12491. Expressed in range of [0-16].
  12492. @item UBITDEPTH
  12493. Display bit depth of U plane in current frame.
  12494. Expressed in range of [0-16].
  12495. @item VBITDEPTH
  12496. Display bit depth of V plane in current frame.
  12497. Expressed in range of [0-16].
  12498. @end table
  12499. The filter accepts the following options:
  12500. @table @option
  12501. @item stat
  12502. @item out
  12503. @option{stat} specify an additional form of image analysis.
  12504. @option{out} output video with the specified type of pixel highlighted.
  12505. Both options accept the following values:
  12506. @table @samp
  12507. @item tout
  12508. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  12509. unlike the neighboring pixels of the same field. Examples of temporal outliers
  12510. include the results of video dropouts, head clogs, or tape tracking issues.
  12511. @item vrep
  12512. Identify @var{vertical line repetition}. Vertical line repetition includes
  12513. similar rows of pixels within a frame. In born-digital video vertical line
  12514. repetition is common, but this pattern is uncommon in video digitized from an
  12515. analog source. When it occurs in video that results from the digitization of an
  12516. analog source it can indicate concealment from a dropout compensator.
  12517. @item brng
  12518. Identify pixels that fall outside of legal broadcast range.
  12519. @end table
  12520. @item color, c
  12521. Set the highlight color for the @option{out} option. The default color is
  12522. yellow.
  12523. @end table
  12524. @subsection Examples
  12525. @itemize
  12526. @item
  12527. Output data of various video metrics:
  12528. @example
  12529. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  12530. @end example
  12531. @item
  12532. Output specific data about the minimum and maximum values of the Y plane per frame:
  12533. @example
  12534. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  12535. @end example
  12536. @item
  12537. Playback video while highlighting pixels that are outside of broadcast range in red.
  12538. @example
  12539. ffplay example.mov -vf signalstats="out=brng:color=red"
  12540. @end example
  12541. @item
  12542. Playback video with signalstats metadata drawn over the frame.
  12543. @example
  12544. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  12545. @end example
  12546. The contents of signalstat_drawtext.txt used in the command are:
  12547. @example
  12548. time %@{pts:hms@}
  12549. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  12550. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  12551. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  12552. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  12553. @end example
  12554. @end itemize
  12555. @anchor{signature}
  12556. @section signature
  12557. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  12558. input. In this case the matching between the inputs can be calculated additionally.
  12559. The filter always passes through the first input. The signature of each stream can
  12560. be written into a file.
  12561. It accepts the following options:
  12562. @table @option
  12563. @item detectmode
  12564. Enable or disable the matching process.
  12565. Available values are:
  12566. @table @samp
  12567. @item off
  12568. Disable the calculation of a matching (default).
  12569. @item full
  12570. Calculate the matching for the whole video and output whether the whole video
  12571. matches or only parts.
  12572. @item fast
  12573. Calculate only until a matching is found or the video ends. Should be faster in
  12574. some cases.
  12575. @end table
  12576. @item nb_inputs
  12577. Set the number of inputs. The option value must be a non negative integer.
  12578. Default value is 1.
  12579. @item filename
  12580. Set the path to which the output is written. If there is more than one input,
  12581. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  12582. integer), that will be replaced with the input number. If no filename is
  12583. specified, no output will be written. This is the default.
  12584. @item format
  12585. Choose the output format.
  12586. Available values are:
  12587. @table @samp
  12588. @item binary
  12589. Use the specified binary representation (default).
  12590. @item xml
  12591. Use the specified xml representation.
  12592. @end table
  12593. @item th_d
  12594. Set threshold to detect one word as similar. The option value must be an integer
  12595. greater than zero. The default value is 9000.
  12596. @item th_dc
  12597. Set threshold to detect all words as similar. The option value must be an integer
  12598. greater than zero. The default value is 60000.
  12599. @item th_xh
  12600. Set threshold to detect frames as similar. The option value must be an integer
  12601. greater than zero. The default value is 116.
  12602. @item th_di
  12603. Set the minimum length of a sequence in frames to recognize it as matching
  12604. sequence. The option value must be a non negative integer value.
  12605. The default value is 0.
  12606. @item th_it
  12607. Set the minimum relation, that matching frames to all frames must have.
  12608. The option value must be a double value between 0 and 1. The default value is 0.5.
  12609. @end table
  12610. @subsection Examples
  12611. @itemize
  12612. @item
  12613. To calculate the signature of an input video and store it in signature.bin:
  12614. @example
  12615. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  12616. @end example
  12617. @item
  12618. To detect whether two videos match and store the signatures in XML format in
  12619. signature0.xml and signature1.xml:
  12620. @example
  12621. 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 -
  12622. @end example
  12623. @end itemize
  12624. @anchor{smartblur}
  12625. @section smartblur
  12626. Blur the input video without impacting the outlines.
  12627. It accepts the following options:
  12628. @table @option
  12629. @item luma_radius, lr
  12630. Set the luma radius. The option value must be a float number in
  12631. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12632. used to blur the image (slower if larger). Default value is 1.0.
  12633. @item luma_strength, ls
  12634. Set the luma strength. The option value must be a float number
  12635. in the range [-1.0,1.0] that configures the blurring. A value included
  12636. in [0.0,1.0] will blur the image whereas a value included in
  12637. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  12638. @item luma_threshold, lt
  12639. Set the luma threshold used as a coefficient to determine
  12640. whether a pixel should be blurred or not. The option value must be an
  12641. integer in the range [-30,30]. A value of 0 will filter all the image,
  12642. a value included in [0,30] will filter flat areas and a value included
  12643. in [-30,0] will filter edges. Default value is 0.
  12644. @item chroma_radius, cr
  12645. Set the chroma radius. The option value must be a float number in
  12646. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12647. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  12648. @item chroma_strength, cs
  12649. Set the chroma strength. The option value must be a float number
  12650. in the range [-1.0,1.0] that configures the blurring. A value included
  12651. in [0.0,1.0] will blur the image whereas a value included in
  12652. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  12653. @item chroma_threshold, ct
  12654. Set the chroma threshold used as a coefficient to determine
  12655. whether a pixel should be blurred or not. The option value must be an
  12656. integer in the range [-30,30]. A value of 0 will filter all the image,
  12657. a value included in [0,30] will filter flat areas and a value included
  12658. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  12659. @end table
  12660. If a chroma option is not explicitly set, the corresponding luma value
  12661. is set.
  12662. @section sobel
  12663. Apply sobel operator to input video stream.
  12664. The filter accepts the following option:
  12665. @table @option
  12666. @item planes
  12667. Set which planes will be processed, unprocessed planes will be copied.
  12668. By default value 0xf, all planes will be processed.
  12669. @item scale
  12670. Set value which will be multiplied with filtered result.
  12671. @item delta
  12672. Set value which will be added to filtered result.
  12673. @end table
  12674. @anchor{spp}
  12675. @section spp
  12676. Apply a simple postprocessing filter that compresses and decompresses the image
  12677. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  12678. and average the results.
  12679. The filter accepts the following options:
  12680. @table @option
  12681. @item quality
  12682. Set quality. This option defines the number of levels for averaging. It accepts
  12683. an integer in the range 0-6. If set to @code{0}, the filter will have no
  12684. effect. A value of @code{6} means the higher quality. For each increment of
  12685. that value the speed drops by a factor of approximately 2. Default value is
  12686. @code{3}.
  12687. @item qp
  12688. Force a constant quantization parameter. If not set, the filter will use the QP
  12689. from the video stream (if available).
  12690. @item mode
  12691. Set thresholding mode. Available modes are:
  12692. @table @samp
  12693. @item hard
  12694. Set hard thresholding (default).
  12695. @item soft
  12696. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12697. @end table
  12698. @item use_bframe_qp
  12699. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  12700. option may cause flicker since the B-Frames have often larger QP. Default is
  12701. @code{0} (not enabled).
  12702. @end table
  12703. @section sr
  12704. Scale the input by applying one of the super-resolution methods based on
  12705. convolutional neural networks. Supported models:
  12706. @itemize
  12707. @item
  12708. Super-Resolution Convolutional Neural Network model (SRCNN).
  12709. See @url{https://arxiv.org/abs/1501.00092}.
  12710. @item
  12711. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  12712. See @url{https://arxiv.org/abs/1609.05158}.
  12713. @end itemize
  12714. Training scripts as well as scripts for model file (.pb) saving can be found at
  12715. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  12716. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  12717. Native model files (.model) can be generated from TensorFlow model
  12718. files (.pb) by using tools/python/convert.py
  12719. The filter accepts the following options:
  12720. @table @option
  12721. @item dnn_backend
  12722. Specify which DNN backend to use for model loading and execution. This option accepts
  12723. the following values:
  12724. @table @samp
  12725. @item native
  12726. Native implementation of DNN loading and execution.
  12727. @item tensorflow
  12728. TensorFlow backend. To enable this backend you
  12729. need to install the TensorFlow for C library (see
  12730. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  12731. @code{--enable-libtensorflow}
  12732. @end table
  12733. Default value is @samp{native}.
  12734. @item model
  12735. Set path to model file specifying network architecture and its parameters.
  12736. Note that different backends use different file formats. TensorFlow backend
  12737. can load files for both formats, while native backend can load files for only
  12738. its format.
  12739. @item scale_factor
  12740. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  12741. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  12742. input upscaled using bicubic upscaling with proper scale factor.
  12743. @end table
  12744. @section ssim
  12745. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  12746. This filter takes in input two input videos, the first input is
  12747. considered the "main" source and is passed unchanged to the
  12748. output. The second input is used as a "reference" video for computing
  12749. the SSIM.
  12750. Both video inputs must have the same resolution and pixel format for
  12751. this filter to work correctly. Also it assumes that both inputs
  12752. have the same number of frames, which are compared one by one.
  12753. The filter stores the calculated SSIM of each frame.
  12754. The description of the accepted parameters follows.
  12755. @table @option
  12756. @item stats_file, f
  12757. If specified the filter will use the named file to save the SSIM of
  12758. each individual frame. When filename equals "-" the data is sent to
  12759. standard output.
  12760. @end table
  12761. The file printed if @var{stats_file} is selected, contains a sequence of
  12762. key/value pairs of the form @var{key}:@var{value} for each compared
  12763. couple of frames.
  12764. A description of each shown parameter follows:
  12765. @table @option
  12766. @item n
  12767. sequential number of the input frame, starting from 1
  12768. @item Y, U, V, R, G, B
  12769. SSIM of the compared frames for the component specified by the suffix.
  12770. @item All
  12771. SSIM of the compared frames for the whole frame.
  12772. @item dB
  12773. Same as above but in dB representation.
  12774. @end table
  12775. This filter also supports the @ref{framesync} options.
  12776. For example:
  12777. @example
  12778. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12779. [main][ref] ssim="stats_file=stats.log" [out]
  12780. @end example
  12781. On this example the input file being processed is compared with the
  12782. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  12783. is stored in @file{stats.log}.
  12784. Another example with both psnr and ssim at same time:
  12785. @example
  12786. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  12787. @end example
  12788. @section stereo3d
  12789. Convert between different stereoscopic image formats.
  12790. The filters accept the following options:
  12791. @table @option
  12792. @item in
  12793. Set stereoscopic image format of input.
  12794. Available values for input image formats are:
  12795. @table @samp
  12796. @item sbsl
  12797. side by side parallel (left eye left, right eye right)
  12798. @item sbsr
  12799. side by side crosseye (right eye left, left eye right)
  12800. @item sbs2l
  12801. side by side parallel with half width resolution
  12802. (left eye left, right eye right)
  12803. @item sbs2r
  12804. side by side crosseye with half width resolution
  12805. (right eye left, left eye right)
  12806. @item abl
  12807. @item tbl
  12808. above-below (left eye above, right eye below)
  12809. @item abr
  12810. @item tbr
  12811. above-below (right eye above, left eye below)
  12812. @item ab2l
  12813. @item tb2l
  12814. above-below with half height resolution
  12815. (left eye above, right eye below)
  12816. @item ab2r
  12817. @item tb2r
  12818. above-below with half height resolution
  12819. (right eye above, left eye below)
  12820. @item al
  12821. alternating frames (left eye first, right eye second)
  12822. @item ar
  12823. alternating frames (right eye first, left eye second)
  12824. @item irl
  12825. interleaved rows (left eye has top row, right eye starts on next row)
  12826. @item irr
  12827. interleaved rows (right eye has top row, left eye starts on next row)
  12828. @item icl
  12829. interleaved columns, left eye first
  12830. @item icr
  12831. interleaved columns, right eye first
  12832. Default value is @samp{sbsl}.
  12833. @end table
  12834. @item out
  12835. Set stereoscopic image format of output.
  12836. @table @samp
  12837. @item sbsl
  12838. side by side parallel (left eye left, right eye right)
  12839. @item sbsr
  12840. side by side crosseye (right eye left, left eye right)
  12841. @item sbs2l
  12842. side by side parallel with half width resolution
  12843. (left eye left, right eye right)
  12844. @item sbs2r
  12845. side by side crosseye with half width resolution
  12846. (right eye left, left eye right)
  12847. @item abl
  12848. @item tbl
  12849. above-below (left eye above, right eye below)
  12850. @item abr
  12851. @item tbr
  12852. above-below (right eye above, left eye below)
  12853. @item ab2l
  12854. @item tb2l
  12855. above-below with half height resolution
  12856. (left eye above, right eye below)
  12857. @item ab2r
  12858. @item tb2r
  12859. above-below with half height resolution
  12860. (right eye above, left eye below)
  12861. @item al
  12862. alternating frames (left eye first, right eye second)
  12863. @item ar
  12864. alternating frames (right eye first, left eye second)
  12865. @item irl
  12866. interleaved rows (left eye has top row, right eye starts on next row)
  12867. @item irr
  12868. interleaved rows (right eye has top row, left eye starts on next row)
  12869. @item arbg
  12870. anaglyph red/blue gray
  12871. (red filter on left eye, blue filter on right eye)
  12872. @item argg
  12873. anaglyph red/green gray
  12874. (red filter on left eye, green filter on right eye)
  12875. @item arcg
  12876. anaglyph red/cyan gray
  12877. (red filter on left eye, cyan filter on right eye)
  12878. @item arch
  12879. anaglyph red/cyan half colored
  12880. (red filter on left eye, cyan filter on right eye)
  12881. @item arcc
  12882. anaglyph red/cyan color
  12883. (red filter on left eye, cyan filter on right eye)
  12884. @item arcd
  12885. anaglyph red/cyan color optimized with the least squares projection of dubois
  12886. (red filter on left eye, cyan filter on right eye)
  12887. @item agmg
  12888. anaglyph green/magenta gray
  12889. (green filter on left eye, magenta filter on right eye)
  12890. @item agmh
  12891. anaglyph green/magenta half colored
  12892. (green filter on left eye, magenta filter on right eye)
  12893. @item agmc
  12894. anaglyph green/magenta colored
  12895. (green filter on left eye, magenta filter on right eye)
  12896. @item agmd
  12897. anaglyph green/magenta color optimized with the least squares projection of dubois
  12898. (green filter on left eye, magenta filter on right eye)
  12899. @item aybg
  12900. anaglyph yellow/blue gray
  12901. (yellow filter on left eye, blue filter on right eye)
  12902. @item aybh
  12903. anaglyph yellow/blue half colored
  12904. (yellow filter on left eye, blue filter on right eye)
  12905. @item aybc
  12906. anaglyph yellow/blue colored
  12907. (yellow filter on left eye, blue filter on right eye)
  12908. @item aybd
  12909. anaglyph yellow/blue color optimized with the least squares projection of dubois
  12910. (yellow filter on left eye, blue filter on right eye)
  12911. @item ml
  12912. mono output (left eye only)
  12913. @item mr
  12914. mono output (right eye only)
  12915. @item chl
  12916. checkerboard, left eye first
  12917. @item chr
  12918. checkerboard, right eye first
  12919. @item icl
  12920. interleaved columns, left eye first
  12921. @item icr
  12922. interleaved columns, right eye first
  12923. @item hdmi
  12924. HDMI frame pack
  12925. @end table
  12926. Default value is @samp{arcd}.
  12927. @end table
  12928. @subsection Examples
  12929. @itemize
  12930. @item
  12931. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  12932. @example
  12933. stereo3d=sbsl:aybd
  12934. @end example
  12935. @item
  12936. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  12937. @example
  12938. stereo3d=abl:sbsr
  12939. @end example
  12940. @end itemize
  12941. @section streamselect, astreamselect
  12942. Select video or audio streams.
  12943. The filter accepts the following options:
  12944. @table @option
  12945. @item inputs
  12946. Set number of inputs. Default is 2.
  12947. @item map
  12948. Set input indexes to remap to outputs.
  12949. @end table
  12950. @subsection Commands
  12951. The @code{streamselect} and @code{astreamselect} filter supports the following
  12952. commands:
  12953. @table @option
  12954. @item map
  12955. Set input indexes to remap to outputs.
  12956. @end table
  12957. @subsection Examples
  12958. @itemize
  12959. @item
  12960. Select first 5 seconds 1st stream and rest of time 2nd stream:
  12961. @example
  12962. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  12963. @end example
  12964. @item
  12965. Same as above, but for audio:
  12966. @example
  12967. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  12968. @end example
  12969. @end itemize
  12970. @anchor{subtitles}
  12971. @section subtitles
  12972. Draw subtitles on top of input video using the libass library.
  12973. To enable compilation of this filter you need to configure FFmpeg with
  12974. @code{--enable-libass}. This filter also requires a build with libavcodec and
  12975. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  12976. Alpha) subtitles format.
  12977. The filter accepts the following options:
  12978. @table @option
  12979. @item filename, f
  12980. Set the filename of the subtitle file to read. It must be specified.
  12981. @item original_size
  12982. Specify the size of the original video, the video for which the ASS file
  12983. was composed. For the syntax of this option, check the
  12984. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12985. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  12986. correctly scale the fonts if the aspect ratio has been changed.
  12987. @item fontsdir
  12988. Set a directory path containing fonts that can be used by the filter.
  12989. These fonts will be used in addition to whatever the font provider uses.
  12990. @item alpha
  12991. Process alpha channel, by default alpha channel is untouched.
  12992. @item charenc
  12993. Set subtitles input character encoding. @code{subtitles} filter only. Only
  12994. useful if not UTF-8.
  12995. @item stream_index, si
  12996. Set subtitles stream index. @code{subtitles} filter only.
  12997. @item force_style
  12998. Override default style or script info parameters of the subtitles. It accepts a
  12999. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  13000. @end table
  13001. If the first key is not specified, it is assumed that the first value
  13002. specifies the @option{filename}.
  13003. For example, to render the file @file{sub.srt} on top of the input
  13004. video, use the command:
  13005. @example
  13006. subtitles=sub.srt
  13007. @end example
  13008. which is equivalent to:
  13009. @example
  13010. subtitles=filename=sub.srt
  13011. @end example
  13012. To render the default subtitles stream from file @file{video.mkv}, use:
  13013. @example
  13014. subtitles=video.mkv
  13015. @end example
  13016. To render the second subtitles stream from that file, use:
  13017. @example
  13018. subtitles=video.mkv:si=1
  13019. @end example
  13020. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  13021. @code{DejaVu Serif}, use:
  13022. @example
  13023. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  13024. @end example
  13025. @section super2xsai
  13026. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  13027. Interpolate) pixel art scaling algorithm.
  13028. Useful for enlarging pixel art images without reducing sharpness.
  13029. @section swaprect
  13030. Swap two rectangular objects in video.
  13031. This filter accepts the following options:
  13032. @table @option
  13033. @item w
  13034. Set object width.
  13035. @item h
  13036. Set object height.
  13037. @item x1
  13038. Set 1st rect x coordinate.
  13039. @item y1
  13040. Set 1st rect y coordinate.
  13041. @item x2
  13042. Set 2nd rect x coordinate.
  13043. @item y2
  13044. Set 2nd rect y coordinate.
  13045. All expressions are evaluated once for each frame.
  13046. @end table
  13047. The all options are expressions containing the following constants:
  13048. @table @option
  13049. @item w
  13050. @item h
  13051. The input width and height.
  13052. @item a
  13053. same as @var{w} / @var{h}
  13054. @item sar
  13055. input sample aspect ratio
  13056. @item dar
  13057. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  13058. @item n
  13059. The number of the input frame, starting from 0.
  13060. @item t
  13061. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  13062. @item pos
  13063. the position in the file of the input frame, NAN if unknown
  13064. @end table
  13065. @section swapuv
  13066. Swap U & V plane.
  13067. @section telecine
  13068. Apply telecine process to the video.
  13069. This filter accepts the following options:
  13070. @table @option
  13071. @item first_field
  13072. @table @samp
  13073. @item top, t
  13074. top field first
  13075. @item bottom, b
  13076. bottom field first
  13077. The default value is @code{top}.
  13078. @end table
  13079. @item pattern
  13080. A string of numbers representing the pulldown pattern you wish to apply.
  13081. The default value is @code{23}.
  13082. @end table
  13083. @example
  13084. Some typical patterns:
  13085. NTSC output (30i):
  13086. 27.5p: 32222
  13087. 24p: 23 (classic)
  13088. 24p: 2332 (preferred)
  13089. 20p: 33
  13090. 18p: 334
  13091. 16p: 3444
  13092. PAL output (25i):
  13093. 27.5p: 12222
  13094. 24p: 222222222223 ("Euro pulldown")
  13095. 16.67p: 33
  13096. 16p: 33333334
  13097. @end example
  13098. @section threshold
  13099. Apply threshold effect to video stream.
  13100. This filter needs four video streams to perform thresholding.
  13101. First stream is stream we are filtering.
  13102. Second stream is holding threshold values, third stream is holding min values,
  13103. and last, fourth stream is holding max values.
  13104. The filter accepts the following option:
  13105. @table @option
  13106. @item planes
  13107. Set which planes will be processed, unprocessed planes will be copied.
  13108. By default value 0xf, all planes will be processed.
  13109. @end table
  13110. For example if first stream pixel's component value is less then threshold value
  13111. of pixel component from 2nd threshold stream, third stream value will picked,
  13112. otherwise fourth stream pixel component value will be picked.
  13113. Using color source filter one can perform various types of thresholding:
  13114. @subsection Examples
  13115. @itemize
  13116. @item
  13117. Binary threshold, using gray color as threshold:
  13118. @example
  13119. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  13120. @end example
  13121. @item
  13122. Inverted binary threshold, using gray color as threshold:
  13123. @example
  13124. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  13125. @end example
  13126. @item
  13127. Truncate binary threshold, using gray color as threshold:
  13128. @example
  13129. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  13130. @end example
  13131. @item
  13132. Threshold to zero, using gray color as threshold:
  13133. @example
  13134. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  13135. @end example
  13136. @item
  13137. Inverted threshold to zero, using gray color as threshold:
  13138. @example
  13139. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  13140. @end example
  13141. @end itemize
  13142. @section thumbnail
  13143. Select the most representative frame in a given sequence of consecutive frames.
  13144. The filter accepts the following options:
  13145. @table @option
  13146. @item n
  13147. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  13148. will pick one of them, and then handle the next batch of @var{n} frames until
  13149. the end. Default is @code{100}.
  13150. @end table
  13151. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  13152. value will result in a higher memory usage, so a high value is not recommended.
  13153. @subsection Examples
  13154. @itemize
  13155. @item
  13156. Extract one picture each 50 frames:
  13157. @example
  13158. thumbnail=50
  13159. @end example
  13160. @item
  13161. Complete example of a thumbnail creation with @command{ffmpeg}:
  13162. @example
  13163. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  13164. @end example
  13165. @end itemize
  13166. @section tile
  13167. Tile several successive frames together.
  13168. The filter accepts the following options:
  13169. @table @option
  13170. @item layout
  13171. Set the grid size (i.e. the number of lines and columns). For the syntax of
  13172. this option, check the
  13173. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13174. @item nb_frames
  13175. Set the maximum number of frames to render in the given area. It must be less
  13176. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  13177. the area will be used.
  13178. @item margin
  13179. Set the outer border margin in pixels.
  13180. @item padding
  13181. Set the inner border thickness (i.e. the number of pixels between frames). For
  13182. more advanced padding options (such as having different values for the edges),
  13183. refer to the pad video filter.
  13184. @item color
  13185. Specify the color of the unused area. For the syntax of this option, check the
  13186. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13187. The default value of @var{color} is "black".
  13188. @item overlap
  13189. Set the number of frames to overlap when tiling several successive frames together.
  13190. The value must be between @code{0} and @var{nb_frames - 1}.
  13191. @item init_padding
  13192. Set the number of frames to initially be empty before displaying first output frame.
  13193. This controls how soon will one get first output frame.
  13194. The value must be between @code{0} and @var{nb_frames - 1}.
  13195. @end table
  13196. @subsection Examples
  13197. @itemize
  13198. @item
  13199. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  13200. @example
  13201. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  13202. @end example
  13203. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  13204. duplicating each output frame to accommodate the originally detected frame
  13205. rate.
  13206. @item
  13207. Display @code{5} pictures in an area of @code{3x2} frames,
  13208. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  13209. mixed flat and named options:
  13210. @example
  13211. tile=3x2:nb_frames=5:padding=7:margin=2
  13212. @end example
  13213. @end itemize
  13214. @section tinterlace
  13215. Perform various types of temporal field interlacing.
  13216. Frames are counted starting from 1, so the first input frame is
  13217. considered odd.
  13218. The filter accepts the following options:
  13219. @table @option
  13220. @item mode
  13221. Specify the mode of the interlacing. This option can also be specified
  13222. as a value alone. See below for a list of values for this option.
  13223. Available values are:
  13224. @table @samp
  13225. @item merge, 0
  13226. Move odd frames into the upper field, even into the lower field,
  13227. generating a double height frame at half frame rate.
  13228. @example
  13229. ------> time
  13230. Input:
  13231. Frame 1 Frame 2 Frame 3 Frame 4
  13232. 11111 22222 33333 44444
  13233. 11111 22222 33333 44444
  13234. 11111 22222 33333 44444
  13235. 11111 22222 33333 44444
  13236. Output:
  13237. 11111 33333
  13238. 22222 44444
  13239. 11111 33333
  13240. 22222 44444
  13241. 11111 33333
  13242. 22222 44444
  13243. 11111 33333
  13244. 22222 44444
  13245. @end example
  13246. @item drop_even, 1
  13247. Only output odd frames, even frames are dropped, generating a frame with
  13248. unchanged height at half frame rate.
  13249. @example
  13250. ------> time
  13251. Input:
  13252. Frame 1 Frame 2 Frame 3 Frame 4
  13253. 11111 22222 33333 44444
  13254. 11111 22222 33333 44444
  13255. 11111 22222 33333 44444
  13256. 11111 22222 33333 44444
  13257. Output:
  13258. 11111 33333
  13259. 11111 33333
  13260. 11111 33333
  13261. 11111 33333
  13262. @end example
  13263. @item drop_odd, 2
  13264. Only output even frames, odd frames are dropped, generating a frame with
  13265. unchanged height at half frame rate.
  13266. @example
  13267. ------> time
  13268. Input:
  13269. Frame 1 Frame 2 Frame 3 Frame 4
  13270. 11111 22222 33333 44444
  13271. 11111 22222 33333 44444
  13272. 11111 22222 33333 44444
  13273. 11111 22222 33333 44444
  13274. Output:
  13275. 22222 44444
  13276. 22222 44444
  13277. 22222 44444
  13278. 22222 44444
  13279. @end example
  13280. @item pad, 3
  13281. Expand each frame to full height, but pad alternate lines with black,
  13282. generating a frame with double height at the same input frame rate.
  13283. @example
  13284. ------> time
  13285. Input:
  13286. Frame 1 Frame 2 Frame 3 Frame 4
  13287. 11111 22222 33333 44444
  13288. 11111 22222 33333 44444
  13289. 11111 22222 33333 44444
  13290. 11111 22222 33333 44444
  13291. Output:
  13292. 11111 ..... 33333 .....
  13293. ..... 22222 ..... 44444
  13294. 11111 ..... 33333 .....
  13295. ..... 22222 ..... 44444
  13296. 11111 ..... 33333 .....
  13297. ..... 22222 ..... 44444
  13298. 11111 ..... 33333 .....
  13299. ..... 22222 ..... 44444
  13300. @end example
  13301. @item interleave_top, 4
  13302. Interleave the upper field from odd frames with the lower field from
  13303. even frames, generating a frame with unchanged height at half frame rate.
  13304. @example
  13305. ------> time
  13306. Input:
  13307. Frame 1 Frame 2 Frame 3 Frame 4
  13308. 11111<- 22222 33333<- 44444
  13309. 11111 22222<- 33333 44444<-
  13310. 11111<- 22222 33333<- 44444
  13311. 11111 22222<- 33333 44444<-
  13312. Output:
  13313. 11111 33333
  13314. 22222 44444
  13315. 11111 33333
  13316. 22222 44444
  13317. @end example
  13318. @item interleave_bottom, 5
  13319. Interleave the lower field from odd frames with the upper field from
  13320. even frames, generating a frame with unchanged height at half frame rate.
  13321. @example
  13322. ------> time
  13323. Input:
  13324. Frame 1 Frame 2 Frame 3 Frame 4
  13325. 11111 22222<- 33333 44444<-
  13326. 11111<- 22222 33333<- 44444
  13327. 11111 22222<- 33333 44444<-
  13328. 11111<- 22222 33333<- 44444
  13329. Output:
  13330. 22222 44444
  13331. 11111 33333
  13332. 22222 44444
  13333. 11111 33333
  13334. @end example
  13335. @item interlacex2, 6
  13336. Double frame rate with unchanged height. Frames are inserted each
  13337. containing the second temporal field from the previous input frame and
  13338. the first temporal field from the next input frame. This mode relies on
  13339. the top_field_first flag. Useful for interlaced video displays with no
  13340. field synchronisation.
  13341. @example
  13342. ------> time
  13343. Input:
  13344. Frame 1 Frame 2 Frame 3 Frame 4
  13345. 11111 22222 33333 44444
  13346. 11111 22222 33333 44444
  13347. 11111 22222 33333 44444
  13348. 11111 22222 33333 44444
  13349. Output:
  13350. 11111 22222 22222 33333 33333 44444 44444
  13351. 11111 11111 22222 22222 33333 33333 44444
  13352. 11111 22222 22222 33333 33333 44444 44444
  13353. 11111 11111 22222 22222 33333 33333 44444
  13354. @end example
  13355. @item mergex2, 7
  13356. Move odd frames into the upper field, even into the lower field,
  13357. generating a double height frame at same frame rate.
  13358. @example
  13359. ------> time
  13360. Input:
  13361. Frame 1 Frame 2 Frame 3 Frame 4
  13362. 11111 22222 33333 44444
  13363. 11111 22222 33333 44444
  13364. 11111 22222 33333 44444
  13365. 11111 22222 33333 44444
  13366. Output:
  13367. 11111 33333 33333 55555
  13368. 22222 22222 44444 44444
  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. @end example
  13376. @end table
  13377. Numeric values are deprecated but are accepted for backward
  13378. compatibility reasons.
  13379. Default mode is @code{merge}.
  13380. @item flags
  13381. Specify flags influencing the filter process.
  13382. Available value for @var{flags} is:
  13383. @table @option
  13384. @item low_pass_filter, vlpf
  13385. Enable linear vertical low-pass filtering in the filter.
  13386. Vertical low-pass filtering is required when creating an interlaced
  13387. destination from a progressive source which contains high-frequency
  13388. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  13389. patterning.
  13390. @item complex_filter, cvlpf
  13391. Enable complex vertical low-pass filtering.
  13392. This will slightly less reduce interlace 'twitter' and Moire
  13393. patterning but better retain detail and subjective sharpness impression.
  13394. @end table
  13395. Vertical low-pass filtering can only be enabled for @option{mode}
  13396. @var{interleave_top} and @var{interleave_bottom}.
  13397. @end table
  13398. @section tmix
  13399. Mix successive video frames.
  13400. A description of the accepted options follows.
  13401. @table @option
  13402. @item frames
  13403. The number of successive frames to mix. If unspecified, it defaults to 3.
  13404. @item weights
  13405. Specify weight of each input video frame.
  13406. Each weight is separated by space. If number of weights is smaller than
  13407. number of @var{frames} last specified weight will be used for all remaining
  13408. unset weights.
  13409. @item scale
  13410. Specify scale, if it is set it will be multiplied with sum
  13411. of each weight multiplied with pixel values to give final destination
  13412. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13413. @end table
  13414. @subsection Examples
  13415. @itemize
  13416. @item
  13417. Average 7 successive frames:
  13418. @example
  13419. tmix=frames=7:weights="1 1 1 1 1 1 1"
  13420. @end example
  13421. @item
  13422. Apply simple temporal convolution:
  13423. @example
  13424. tmix=frames=3:weights="-1 3 -1"
  13425. @end example
  13426. @item
  13427. Similar as above but only showing temporal differences:
  13428. @example
  13429. tmix=frames=3:weights="-1 2 -1":scale=1
  13430. @end example
  13431. @end itemize
  13432. @anchor{tonemap}
  13433. @section tonemap
  13434. Tone map colors from different dynamic ranges.
  13435. This filter expects data in single precision floating point, as it needs to
  13436. operate on (and can output) out-of-range values. Another filter, such as
  13437. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  13438. The tonemapping algorithms implemented only work on linear light, so input
  13439. data should be linearized beforehand (and possibly correctly tagged).
  13440. @example
  13441. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  13442. @end example
  13443. @subsection Options
  13444. The filter accepts the following options.
  13445. @table @option
  13446. @item tonemap
  13447. Set the tone map algorithm to use.
  13448. Possible values are:
  13449. @table @var
  13450. @item none
  13451. Do not apply any tone map, only desaturate overbright pixels.
  13452. @item clip
  13453. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  13454. in-range values, while distorting out-of-range values.
  13455. @item linear
  13456. Stretch the entire reference gamut to a linear multiple of the display.
  13457. @item gamma
  13458. Fit a logarithmic transfer between the tone curves.
  13459. @item reinhard
  13460. Preserve overall image brightness with a simple curve, using nonlinear
  13461. contrast, which results in flattening details and degrading color accuracy.
  13462. @item hable
  13463. Preserve both dark and bright details better than @var{reinhard}, at the cost
  13464. of slightly darkening everything. Use it when detail preservation is more
  13465. important than color and brightness accuracy.
  13466. @item mobius
  13467. Smoothly map out-of-range values, while retaining contrast and colors for
  13468. in-range material as much as possible. Use it when color accuracy is more
  13469. important than detail preservation.
  13470. @end table
  13471. Default is none.
  13472. @item param
  13473. Tune the tone mapping algorithm.
  13474. This affects the following algorithms:
  13475. @table @var
  13476. @item none
  13477. Ignored.
  13478. @item linear
  13479. Specifies the scale factor to use while stretching.
  13480. Default to 1.0.
  13481. @item gamma
  13482. Specifies the exponent of the function.
  13483. Default to 1.8.
  13484. @item clip
  13485. Specify an extra linear coefficient to multiply into the signal before clipping.
  13486. Default to 1.0.
  13487. @item reinhard
  13488. Specify the local contrast coefficient at the display peak.
  13489. Default to 0.5, which means that in-gamut values will be about half as bright
  13490. as when clipping.
  13491. @item hable
  13492. Ignored.
  13493. @item mobius
  13494. Specify the transition point from linear to mobius transform. Every value
  13495. below this point is guaranteed to be mapped 1:1. The higher the value, the
  13496. more accurate the result will be, at the cost of losing bright details.
  13497. Default to 0.3, which due to the steep initial slope still preserves in-range
  13498. colors fairly accurately.
  13499. @end table
  13500. @item desat
  13501. Apply desaturation for highlights that exceed this level of brightness. The
  13502. higher the parameter, the more color information will be preserved. This
  13503. setting helps prevent unnaturally blown-out colors for super-highlights, by
  13504. (smoothly) turning into white instead. This makes images feel more natural,
  13505. at the cost of reducing information about out-of-range colors.
  13506. The default of 2.0 is somewhat conservative and will mostly just apply to
  13507. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  13508. This option works only if the input frame has a supported color tag.
  13509. @item peak
  13510. Override signal/nominal/reference peak with this value. Useful when the
  13511. embedded peak information in display metadata is not reliable or when tone
  13512. mapping from a lower range to a higher range.
  13513. @end table
  13514. @section tpad
  13515. Temporarily pad video frames.
  13516. The filter accepts the following options:
  13517. @table @option
  13518. @item start
  13519. Specify number of delay frames before input video stream.
  13520. @item stop
  13521. Specify number of padding frames after input video stream.
  13522. Set to -1 to pad indefinitely.
  13523. @item start_mode
  13524. Set kind of frames added to beginning of stream.
  13525. Can be either @var{add} or @var{clone}.
  13526. With @var{add} frames of solid-color are added.
  13527. With @var{clone} frames are clones of first frame.
  13528. @item stop_mode
  13529. Set kind of frames added to end of stream.
  13530. Can be either @var{add} or @var{clone}.
  13531. With @var{add} frames of solid-color are added.
  13532. With @var{clone} frames are clones of last frame.
  13533. @item start_duration, stop_duration
  13534. Specify the duration of the start/stop delay. See
  13535. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13536. for the accepted syntax.
  13537. These options override @var{start} and @var{stop}.
  13538. @item color
  13539. Specify the color of the padded area. For the syntax of this option,
  13540. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  13541. manual,ffmpeg-utils}.
  13542. The default value of @var{color} is "black".
  13543. @end table
  13544. @anchor{transpose}
  13545. @section transpose
  13546. Transpose rows with columns in the input video and optionally flip it.
  13547. It accepts the following parameters:
  13548. @table @option
  13549. @item dir
  13550. Specify the transposition direction.
  13551. Can assume the following values:
  13552. @table @samp
  13553. @item 0, 4, cclock_flip
  13554. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  13555. @example
  13556. L.R L.l
  13557. . . -> . .
  13558. l.r R.r
  13559. @end example
  13560. @item 1, 5, clock
  13561. Rotate by 90 degrees clockwise, that is:
  13562. @example
  13563. L.R l.L
  13564. . . -> . .
  13565. l.r r.R
  13566. @end example
  13567. @item 2, 6, cclock
  13568. Rotate by 90 degrees counterclockwise, that is:
  13569. @example
  13570. L.R R.r
  13571. . . -> . .
  13572. l.r L.l
  13573. @end example
  13574. @item 3, 7, clock_flip
  13575. Rotate by 90 degrees clockwise and vertically flip, that is:
  13576. @example
  13577. L.R r.R
  13578. . . -> . .
  13579. l.r l.L
  13580. @end example
  13581. @end table
  13582. For values between 4-7, the transposition is only done if the input
  13583. video geometry is portrait and not landscape. These values are
  13584. deprecated, the @code{passthrough} option should be used instead.
  13585. Numerical values are deprecated, and should be dropped in favor of
  13586. symbolic constants.
  13587. @item passthrough
  13588. Do not apply the transposition if the input geometry matches the one
  13589. specified by the specified value. It accepts the following values:
  13590. @table @samp
  13591. @item none
  13592. Always apply transposition.
  13593. @item portrait
  13594. Preserve portrait geometry (when @var{height} >= @var{width}).
  13595. @item landscape
  13596. Preserve landscape geometry (when @var{width} >= @var{height}).
  13597. @end table
  13598. Default value is @code{none}.
  13599. @end table
  13600. For example to rotate by 90 degrees clockwise and preserve portrait
  13601. layout:
  13602. @example
  13603. transpose=dir=1:passthrough=portrait
  13604. @end example
  13605. The command above can also be specified as:
  13606. @example
  13607. transpose=1:portrait
  13608. @end example
  13609. @section transpose_npp
  13610. Transpose rows with columns in the input video and optionally flip it.
  13611. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  13612. It accepts the following parameters:
  13613. @table @option
  13614. @item dir
  13615. Specify the transposition direction.
  13616. Can assume the following values:
  13617. @table @samp
  13618. @item cclock_flip
  13619. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  13620. @item clock
  13621. Rotate by 90 degrees clockwise.
  13622. @item cclock
  13623. Rotate by 90 degrees counterclockwise.
  13624. @item clock_flip
  13625. Rotate by 90 degrees clockwise and vertically flip.
  13626. @end table
  13627. @item passthrough
  13628. Do not apply the transposition if the input geometry matches the one
  13629. specified by the specified value. It accepts the following values:
  13630. @table @samp
  13631. @item none
  13632. Always apply transposition. (default)
  13633. @item portrait
  13634. Preserve portrait geometry (when @var{height} >= @var{width}).
  13635. @item landscape
  13636. Preserve landscape geometry (when @var{width} >= @var{height}).
  13637. @end table
  13638. @end table
  13639. @section trim
  13640. Trim the input so that the output contains one continuous subpart of the input.
  13641. It accepts the following parameters:
  13642. @table @option
  13643. @item start
  13644. Specify the time of the start of the kept section, i.e. the frame with the
  13645. timestamp @var{start} will be the first frame in the output.
  13646. @item end
  13647. Specify the time of the first frame that will be dropped, i.e. the frame
  13648. immediately preceding the one with the timestamp @var{end} will be the last
  13649. frame in the output.
  13650. @item start_pts
  13651. This is the same as @var{start}, except this option sets the start timestamp
  13652. in timebase units instead of seconds.
  13653. @item end_pts
  13654. This is the same as @var{end}, except this option sets the end timestamp
  13655. in timebase units instead of seconds.
  13656. @item duration
  13657. The maximum duration of the output in seconds.
  13658. @item start_frame
  13659. The number of the first frame that should be passed to the output.
  13660. @item end_frame
  13661. The number of the first frame that should be dropped.
  13662. @end table
  13663. @option{start}, @option{end}, and @option{duration} are expressed as time
  13664. duration specifications; see
  13665. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13666. for the accepted syntax.
  13667. Note that the first two sets of the start/end options and the @option{duration}
  13668. option look at the frame timestamp, while the _frame variants simply count the
  13669. frames that pass through the filter. Also note that this filter does not modify
  13670. the timestamps. If you wish for the output timestamps to start at zero, insert a
  13671. setpts filter after the trim filter.
  13672. If multiple start or end options are set, this filter tries to be greedy and
  13673. keep all the frames that match at least one of the specified constraints. To keep
  13674. only the part that matches all the constraints at once, chain multiple trim
  13675. filters.
  13676. The defaults are such that all the input is kept. So it is possible to set e.g.
  13677. just the end values to keep everything before the specified time.
  13678. Examples:
  13679. @itemize
  13680. @item
  13681. Drop everything except the second minute of input:
  13682. @example
  13683. ffmpeg -i INPUT -vf trim=60:120
  13684. @end example
  13685. @item
  13686. Keep only the first second:
  13687. @example
  13688. ffmpeg -i INPUT -vf trim=duration=1
  13689. @end example
  13690. @end itemize
  13691. @section unpremultiply
  13692. Apply alpha unpremultiply effect to input video stream using first plane
  13693. of second stream as alpha.
  13694. Both streams must have same dimensions and same pixel format.
  13695. The filter accepts the following option:
  13696. @table @option
  13697. @item planes
  13698. Set which planes will be processed, unprocessed planes will be copied.
  13699. By default value 0xf, all planes will be processed.
  13700. If the format has 1 or 2 components, then luma is bit 0.
  13701. If the format has 3 or 4 components:
  13702. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  13703. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  13704. If present, the alpha channel is always the last bit.
  13705. @item inplace
  13706. Do not require 2nd input for processing, instead use alpha plane from input stream.
  13707. @end table
  13708. @anchor{unsharp}
  13709. @section unsharp
  13710. Sharpen or blur the input video.
  13711. It accepts the following parameters:
  13712. @table @option
  13713. @item luma_msize_x, lx
  13714. Set the luma matrix horizontal size. It must be an odd integer between
  13715. 3 and 23. The default value is 5.
  13716. @item luma_msize_y, ly
  13717. Set the luma matrix vertical size. It must be an odd integer between 3
  13718. and 23. The default value is 5.
  13719. @item luma_amount, la
  13720. Set the luma effect strength. It must be a floating point number, reasonable
  13721. values lay between -1.5 and 1.5.
  13722. Negative values will blur the input video, while positive values will
  13723. sharpen it, a value of zero will disable the effect.
  13724. Default value is 1.0.
  13725. @item chroma_msize_x, cx
  13726. Set the chroma matrix horizontal size. It must be an odd integer
  13727. between 3 and 23. The default value is 5.
  13728. @item chroma_msize_y, cy
  13729. Set the chroma matrix vertical size. It must be an odd integer
  13730. between 3 and 23. The default value is 5.
  13731. @item chroma_amount, ca
  13732. Set the chroma effect strength. It must be a floating point number, reasonable
  13733. values lay between -1.5 and 1.5.
  13734. Negative values will blur the input video, while positive values will
  13735. sharpen it, a value of zero will disable the effect.
  13736. Default value is 0.0.
  13737. @end table
  13738. All parameters are optional and default to the equivalent of the
  13739. string '5:5:1.0:5:5:0.0'.
  13740. @subsection Examples
  13741. @itemize
  13742. @item
  13743. Apply strong luma sharpen effect:
  13744. @example
  13745. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  13746. @end example
  13747. @item
  13748. Apply a strong blur of both luma and chroma parameters:
  13749. @example
  13750. unsharp=7:7:-2:7:7:-2
  13751. @end example
  13752. @end itemize
  13753. @section uspp
  13754. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  13755. the image at several (or - in the case of @option{quality} level @code{8} - all)
  13756. shifts and average the results.
  13757. The way this differs from the behavior of spp is that uspp actually encodes &
  13758. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  13759. DCT similar to MJPEG.
  13760. The filter accepts the following options:
  13761. @table @option
  13762. @item quality
  13763. Set quality. This option defines the number of levels for averaging. It accepts
  13764. an integer in the range 0-8. If set to @code{0}, the filter will have no
  13765. effect. A value of @code{8} means the higher quality. For each increment of
  13766. that value the speed drops by a factor of approximately 2. Default value is
  13767. @code{3}.
  13768. @item qp
  13769. Force a constant quantization parameter. If not set, the filter will use the QP
  13770. from the video stream (if available).
  13771. @end table
  13772. @section v360
  13773. Convert 360 videos between various formats.
  13774. The filter accepts the following options:
  13775. @table @option
  13776. @item input
  13777. @item output
  13778. Set format of the input/output video.
  13779. Available formats:
  13780. @table @samp
  13781. @item e
  13782. @item equirect
  13783. Equirectangular projection.
  13784. @item c3x2
  13785. @item c6x1
  13786. @item c1x6
  13787. Cubemap with 3x2/6x1/1x6 layout.
  13788. Format specific options:
  13789. @table @option
  13790. @item in_pad
  13791. @item out_pad
  13792. Set padding proportion for the input/output cubemap. Values in decimals.
  13793. Example values:
  13794. @table @samp
  13795. @item 0
  13796. No padding.
  13797. @item 0.01
  13798. 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)
  13799. @end table
  13800. Default value is @b{@samp{0}}.
  13801. @item fin_pad
  13802. @item fout_pad
  13803. Set fixed padding for the input/output cubemap. Values in pixels.
  13804. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  13805. @item in_forder
  13806. @item out_forder
  13807. Set order of faces for the input/output cubemap. Choose one direction for each position.
  13808. Designation of directions:
  13809. @table @samp
  13810. @item r
  13811. right
  13812. @item l
  13813. left
  13814. @item u
  13815. up
  13816. @item d
  13817. down
  13818. @item f
  13819. forward
  13820. @item b
  13821. back
  13822. @end table
  13823. Default value is @b{@samp{rludfb}}.
  13824. @item in_frot
  13825. @item out_frot
  13826. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  13827. Designation of angles:
  13828. @table @samp
  13829. @item 0
  13830. 0 degrees clockwise
  13831. @item 1
  13832. 90 degrees clockwise
  13833. @item 2
  13834. 180 degrees clockwise
  13835. @item 3
  13836. 270 degrees clockwise
  13837. @end table
  13838. Default value is @b{@samp{000000}}.
  13839. @end table
  13840. @item eac
  13841. Equi-Angular Cubemap.
  13842. @item flat
  13843. @item gnomonic
  13844. @item rectilinear
  13845. Regular video. @i{(output only)}
  13846. Format specific options:
  13847. @table @option
  13848. @item h_fov
  13849. @item v_fov
  13850. @item d_fov
  13851. Set horizontal/vertical/diagonal field of view. Values in degrees.
  13852. If diagonal field of view is set it overrides horizontal and vertical field of view.
  13853. @end table
  13854. @item dfisheye
  13855. Dual fisheye.
  13856. Format specific options:
  13857. @table @option
  13858. @item in_pad
  13859. @item out_pad
  13860. Set padding proportion. Values in decimals.
  13861. Example values:
  13862. @table @samp
  13863. @item 0
  13864. No padding.
  13865. @item 0.01
  13866. 1% padding.
  13867. @end table
  13868. Default value is @b{@samp{0}}.
  13869. @end table
  13870. @item barrel
  13871. @item fb
  13872. Facebook's 360 format.
  13873. @item sg
  13874. Stereographic format.
  13875. Format specific options:
  13876. @table @option
  13877. @item h_fov
  13878. @item v_fov
  13879. @item d_fov
  13880. Set horizontal/vertical/diagonal field of view. Values in degrees.
  13881. If diagonal field of view is set it overrides horizontal and vertical field of view.
  13882. @end table
  13883. @item mercator
  13884. Mercator format.
  13885. @item ball
  13886. Ball format, gives significant distortion toward the back.
  13887. @item hammer
  13888. Hammer-Aitoff map projection format.
  13889. @item sinusoidal
  13890. Sinusoidal map projection format.
  13891. @end table
  13892. @item interp
  13893. Set interpolation method.@*
  13894. @i{Note: more complex interpolation methods require much more memory to run.}
  13895. Available methods:
  13896. @table @samp
  13897. @item near
  13898. @item nearest
  13899. Nearest neighbour.
  13900. @item line
  13901. @item linear
  13902. Bilinear interpolation.
  13903. @item cube
  13904. @item cubic
  13905. Bicubic interpolation.
  13906. @item lanc
  13907. @item lanczos
  13908. Lanczos interpolation.
  13909. @end table
  13910. Default value is @b{@samp{line}}.
  13911. @item w
  13912. @item h
  13913. Set the output video resolution.
  13914. Default resolution depends on formats.
  13915. @item in_stereo
  13916. @item out_stereo
  13917. Set the input/output stereo format.
  13918. @table @samp
  13919. @item 2d
  13920. 2D mono
  13921. @item sbs
  13922. Side by side
  13923. @item tb
  13924. Top bottom
  13925. @end table
  13926. Default value is @b{@samp{2d}} for input and output format.
  13927. @item yaw
  13928. @item pitch
  13929. @item roll
  13930. Set rotation for the output video. Values in degrees.
  13931. @item rorder
  13932. Set rotation order for the output video. Choose one item for each position.
  13933. @table @samp
  13934. @item y, Y
  13935. yaw
  13936. @item p, P
  13937. pitch
  13938. @item r, R
  13939. roll
  13940. @end table
  13941. Default value is @b{@samp{ypr}}.
  13942. @item h_flip
  13943. @item v_flip
  13944. @item d_flip
  13945. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  13946. @item ih_flip
  13947. @item iv_flip
  13948. Set if input video is flipped horizontally/vertically. Boolean values.
  13949. @item in_trans
  13950. Set if input video is transposed. Boolean value, by default disabled.
  13951. @item out_trans
  13952. Set if output video needs to be transposed. Boolean value, by default disabled.
  13953. @end table
  13954. @subsection Examples
  13955. @itemize
  13956. @item
  13957. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  13958. @example
  13959. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  13960. @end example
  13961. @item
  13962. Extract back view of Equi-Angular Cubemap:
  13963. @example
  13964. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  13965. @end example
  13966. @item
  13967. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  13968. @example
  13969. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  13970. @end example
  13971. @end itemize
  13972. @section vaguedenoiser
  13973. Apply a wavelet based denoiser.
  13974. It transforms each frame from the video input into the wavelet domain,
  13975. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  13976. the obtained coefficients. It does an inverse wavelet transform after.
  13977. Due to wavelet properties, it should give a nice smoothed result, and
  13978. reduced noise, without blurring picture features.
  13979. This filter accepts the following options:
  13980. @table @option
  13981. @item threshold
  13982. The filtering strength. The higher, the more filtered the video will be.
  13983. Hard thresholding can use a higher threshold than soft thresholding
  13984. before the video looks overfiltered. Default value is 2.
  13985. @item method
  13986. The filtering method the filter will use.
  13987. It accepts the following values:
  13988. @table @samp
  13989. @item hard
  13990. All values under the threshold will be zeroed.
  13991. @item soft
  13992. All values under the threshold will be zeroed. All values above will be
  13993. reduced by the threshold.
  13994. @item garrote
  13995. Scales or nullifies coefficients - intermediary between (more) soft and
  13996. (less) hard thresholding.
  13997. @end table
  13998. Default is garrote.
  13999. @item nsteps
  14000. Number of times, the wavelet will decompose the picture. Picture can't
  14001. be decomposed beyond a particular point (typically, 8 for a 640x480
  14002. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  14003. @item percent
  14004. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  14005. @item planes
  14006. A list of the planes to process. By default all planes are processed.
  14007. @end table
  14008. @section vectorscope
  14009. Display 2 color component values in the two dimensional graph (which is called
  14010. a vectorscope).
  14011. This filter accepts the following options:
  14012. @table @option
  14013. @item mode, m
  14014. Set vectorscope mode.
  14015. It accepts the following values:
  14016. @table @samp
  14017. @item gray
  14018. Gray values are displayed on graph, higher brightness means more pixels have
  14019. same component color value on location in graph. This is the default mode.
  14020. @item color
  14021. Gray values are displayed on graph. Surrounding pixels values which are not
  14022. present in video frame are drawn in gradient of 2 color components which are
  14023. set by option @code{x} and @code{y}. The 3rd color component is static.
  14024. @item color2
  14025. Actual color components values present in video frame are displayed on graph.
  14026. @item color3
  14027. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  14028. on graph increases value of another color component, which is luminance by
  14029. default values of @code{x} and @code{y}.
  14030. @item color4
  14031. Actual colors present in video frame are displayed on graph. If two different
  14032. colors map to same position on graph then color with higher value of component
  14033. not present in graph is picked.
  14034. @item color5
  14035. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  14036. component picked from radial gradient.
  14037. @end table
  14038. @item x
  14039. Set which color component will be represented on X-axis. Default is @code{1}.
  14040. @item y
  14041. Set which color component will be represented on Y-axis. Default is @code{2}.
  14042. @item intensity, i
  14043. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  14044. of color component which represents frequency of (X, Y) location in graph.
  14045. @item envelope, e
  14046. @table @samp
  14047. @item none
  14048. No envelope, this is default.
  14049. @item instant
  14050. Instant envelope, even darkest single pixel will be clearly highlighted.
  14051. @item peak
  14052. Hold maximum and minimum values presented in graph over time. This way you
  14053. can still spot out of range values without constantly looking at vectorscope.
  14054. @item peak+instant
  14055. Peak and instant envelope combined together.
  14056. @end table
  14057. @item graticule, g
  14058. Set what kind of graticule to draw.
  14059. @table @samp
  14060. @item none
  14061. @item green
  14062. @item color
  14063. @end table
  14064. @item opacity, o
  14065. Set graticule opacity.
  14066. @item flags, f
  14067. Set graticule flags.
  14068. @table @samp
  14069. @item white
  14070. Draw graticule for white point.
  14071. @item black
  14072. Draw graticule for black point.
  14073. @item name
  14074. Draw color points short names.
  14075. @end table
  14076. @item bgopacity, b
  14077. Set background opacity.
  14078. @item lthreshold, l
  14079. Set low threshold for color component not represented on X or Y axis.
  14080. Values lower than this value will be ignored. Default is 0.
  14081. Note this value is multiplied with actual max possible value one pixel component
  14082. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  14083. is 0.1 * 255 = 25.
  14084. @item hthreshold, h
  14085. Set high threshold for color component not represented on X or Y axis.
  14086. Values higher than this value will be ignored. Default is 1.
  14087. Note this value is multiplied with actual max possible value one pixel component
  14088. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  14089. is 0.9 * 255 = 230.
  14090. @item colorspace, c
  14091. Set what kind of colorspace to use when drawing graticule.
  14092. @table @samp
  14093. @item auto
  14094. @item 601
  14095. @item 709
  14096. @end table
  14097. Default is auto.
  14098. @end table
  14099. @anchor{vidstabdetect}
  14100. @section vidstabdetect
  14101. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  14102. @ref{vidstabtransform} for pass 2.
  14103. This filter generates a file with relative translation and rotation
  14104. transform information about subsequent frames, which is then used by
  14105. the @ref{vidstabtransform} filter.
  14106. To enable compilation of this filter you need to configure FFmpeg with
  14107. @code{--enable-libvidstab}.
  14108. This filter accepts the following options:
  14109. @table @option
  14110. @item result
  14111. Set the path to the file used to write the transforms information.
  14112. Default value is @file{transforms.trf}.
  14113. @item shakiness
  14114. Set how shaky the video is and how quick the camera is. It accepts an
  14115. integer in the range 1-10, a value of 1 means little shakiness, a
  14116. value of 10 means strong shakiness. Default value is 5.
  14117. @item accuracy
  14118. Set the accuracy of the detection process. It must be a value in the
  14119. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  14120. accuracy. Default value is 15.
  14121. @item stepsize
  14122. Set stepsize of the search process. The region around minimum is
  14123. scanned with 1 pixel resolution. Default value is 6.
  14124. @item mincontrast
  14125. Set minimum contrast. Below this value a local measurement field is
  14126. discarded. Must be a floating point value in the range 0-1. Default
  14127. value is 0.3.
  14128. @item tripod
  14129. Set reference frame number for tripod mode.
  14130. If enabled, the motion of the frames is compared to a reference frame
  14131. in the filtered stream, identified by the specified number. The idea
  14132. is to compensate all movements in a more-or-less static scene and keep
  14133. the camera view absolutely still.
  14134. If set to 0, it is disabled. The frames are counted starting from 1.
  14135. @item show
  14136. Show fields and transforms in the resulting frames. It accepts an
  14137. integer in the range 0-2. Default value is 0, which disables any
  14138. visualization.
  14139. @end table
  14140. @subsection Examples
  14141. @itemize
  14142. @item
  14143. Use default values:
  14144. @example
  14145. vidstabdetect
  14146. @end example
  14147. @item
  14148. Analyze strongly shaky movie and put the results in file
  14149. @file{mytransforms.trf}:
  14150. @example
  14151. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  14152. @end example
  14153. @item
  14154. Visualize the result of internal transformations in the resulting
  14155. video:
  14156. @example
  14157. vidstabdetect=show=1
  14158. @end example
  14159. @item
  14160. Analyze a video with medium shakiness using @command{ffmpeg}:
  14161. @example
  14162. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  14163. @end example
  14164. @end itemize
  14165. @anchor{vidstabtransform}
  14166. @section vidstabtransform
  14167. Video stabilization/deshaking: pass 2 of 2,
  14168. see @ref{vidstabdetect} for pass 1.
  14169. Read a file with transform information for each frame and
  14170. apply/compensate them. Together with the @ref{vidstabdetect}
  14171. filter this can be used to deshake videos. See also
  14172. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  14173. the @ref{unsharp} filter, see below.
  14174. To enable compilation of this filter you need to configure FFmpeg with
  14175. @code{--enable-libvidstab}.
  14176. @subsection Options
  14177. @table @option
  14178. @item input
  14179. Set path to the file used to read the transforms. Default value is
  14180. @file{transforms.trf}.
  14181. @item smoothing
  14182. Set the number of frames (value*2 + 1) used for lowpass filtering the
  14183. camera movements. Default value is 10.
  14184. For example a number of 10 means that 21 frames are used (10 in the
  14185. past and 10 in the future) to smoothen the motion in the video. A
  14186. larger value leads to a smoother video, but limits the acceleration of
  14187. the camera (pan/tilt movements). 0 is a special case where a static
  14188. camera is simulated.
  14189. @item optalgo
  14190. Set the camera path optimization algorithm.
  14191. Accepted values are:
  14192. @table @samp
  14193. @item gauss
  14194. gaussian kernel low-pass filter on camera motion (default)
  14195. @item avg
  14196. averaging on transformations
  14197. @end table
  14198. @item maxshift
  14199. Set maximal number of pixels to translate frames. Default value is -1,
  14200. meaning no limit.
  14201. @item maxangle
  14202. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  14203. value is -1, meaning no limit.
  14204. @item crop
  14205. Specify how to deal with borders that may be visible due to movement
  14206. compensation.
  14207. Available values are:
  14208. @table @samp
  14209. @item keep
  14210. keep image information from previous frame (default)
  14211. @item black
  14212. fill the border black
  14213. @end table
  14214. @item invert
  14215. Invert transforms if set to 1. Default value is 0.
  14216. @item relative
  14217. Consider transforms as relative to previous frame if set to 1,
  14218. absolute if set to 0. Default value is 0.
  14219. @item zoom
  14220. Set percentage to zoom. A positive value will result in a zoom-in
  14221. effect, a negative value in a zoom-out effect. Default value is 0 (no
  14222. zoom).
  14223. @item optzoom
  14224. Set optimal zooming to avoid borders.
  14225. Accepted values are:
  14226. @table @samp
  14227. @item 0
  14228. disabled
  14229. @item 1
  14230. optimal static zoom value is determined (only very strong movements
  14231. will lead to visible borders) (default)
  14232. @item 2
  14233. optimal adaptive zoom value is determined (no borders will be
  14234. visible), see @option{zoomspeed}
  14235. @end table
  14236. Note that the value given at zoom is added to the one calculated here.
  14237. @item zoomspeed
  14238. Set percent to zoom maximally each frame (enabled when
  14239. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  14240. 0.25.
  14241. @item interpol
  14242. Specify type of interpolation.
  14243. Available values are:
  14244. @table @samp
  14245. @item no
  14246. no interpolation
  14247. @item linear
  14248. linear only horizontal
  14249. @item bilinear
  14250. linear in both directions (default)
  14251. @item bicubic
  14252. cubic in both directions (slow)
  14253. @end table
  14254. @item tripod
  14255. Enable virtual tripod mode if set to 1, which is equivalent to
  14256. @code{relative=0:smoothing=0}. Default value is 0.
  14257. Use also @code{tripod} option of @ref{vidstabdetect}.
  14258. @item debug
  14259. Increase log verbosity if set to 1. Also the detected global motions
  14260. are written to the temporary file @file{global_motions.trf}. Default
  14261. value is 0.
  14262. @end table
  14263. @subsection Examples
  14264. @itemize
  14265. @item
  14266. Use @command{ffmpeg} for a typical stabilization with default values:
  14267. @example
  14268. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  14269. @end example
  14270. Note the use of the @ref{unsharp} filter which is always recommended.
  14271. @item
  14272. Zoom in a bit more and load transform data from a given file:
  14273. @example
  14274. vidstabtransform=zoom=5:input="mytransforms.trf"
  14275. @end example
  14276. @item
  14277. Smoothen the video even more:
  14278. @example
  14279. vidstabtransform=smoothing=30
  14280. @end example
  14281. @end itemize
  14282. @section vflip
  14283. Flip the input video vertically.
  14284. For example, to vertically flip a video with @command{ffmpeg}:
  14285. @example
  14286. ffmpeg -i in.avi -vf "vflip" out.avi
  14287. @end example
  14288. @section vfrdet
  14289. Detect variable frame rate video.
  14290. This filter tries to detect if the input is variable or constant frame rate.
  14291. At end it will output number of frames detected as having variable delta pts,
  14292. and ones with constant delta pts.
  14293. If there was frames with variable delta, than it will also show min and max delta
  14294. encountered.
  14295. @section vibrance
  14296. Boost or alter saturation.
  14297. The filter accepts the following options:
  14298. @table @option
  14299. @item intensity
  14300. Set strength of boost if positive value or strength of alter if negative value.
  14301. Default is 0. Allowed range is from -2 to 2.
  14302. @item rbal
  14303. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  14304. @item gbal
  14305. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  14306. @item bbal
  14307. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  14308. @item rlum
  14309. Set the red luma coefficient.
  14310. @item glum
  14311. Set the green luma coefficient.
  14312. @item blum
  14313. Set the blue luma coefficient.
  14314. @item alternate
  14315. If @code{intensity} is negative and this is set to 1, colors will change,
  14316. otherwise colors will be less saturated, more towards gray.
  14317. @end table
  14318. @anchor{vignette}
  14319. @section vignette
  14320. Make or reverse a natural vignetting effect.
  14321. The filter accepts the following options:
  14322. @table @option
  14323. @item angle, a
  14324. Set lens angle expression as a number of radians.
  14325. The value is clipped in the @code{[0,PI/2]} range.
  14326. Default value: @code{"PI/5"}
  14327. @item x0
  14328. @item y0
  14329. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  14330. by default.
  14331. @item mode
  14332. Set forward/backward mode.
  14333. Available modes are:
  14334. @table @samp
  14335. @item forward
  14336. The larger the distance from the central point, the darker the image becomes.
  14337. @item backward
  14338. The larger the distance from the central point, the brighter the image becomes.
  14339. This can be used to reverse a vignette effect, though there is no automatic
  14340. detection to extract the lens @option{angle} and other settings (yet). It can
  14341. also be used to create a burning effect.
  14342. @end table
  14343. Default value is @samp{forward}.
  14344. @item eval
  14345. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  14346. It accepts the following values:
  14347. @table @samp
  14348. @item init
  14349. Evaluate expressions only once during the filter initialization.
  14350. @item frame
  14351. Evaluate expressions for each incoming frame. This is way slower than the
  14352. @samp{init} mode since it requires all the scalers to be re-computed, but it
  14353. allows advanced dynamic expressions.
  14354. @end table
  14355. Default value is @samp{init}.
  14356. @item dither
  14357. Set dithering to reduce the circular banding effects. Default is @code{1}
  14358. (enabled).
  14359. @item aspect
  14360. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  14361. Setting this value to the SAR of the input will make a rectangular vignetting
  14362. following the dimensions of the video.
  14363. Default is @code{1/1}.
  14364. @end table
  14365. @subsection Expressions
  14366. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  14367. following parameters.
  14368. @table @option
  14369. @item w
  14370. @item h
  14371. input width and height
  14372. @item n
  14373. the number of input frame, starting from 0
  14374. @item pts
  14375. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  14376. @var{TB} units, NAN if undefined
  14377. @item r
  14378. frame rate of the input video, NAN if the input frame rate is unknown
  14379. @item t
  14380. the PTS (Presentation TimeStamp) of the filtered video frame,
  14381. expressed in seconds, NAN if undefined
  14382. @item tb
  14383. time base of the input video
  14384. @end table
  14385. @subsection Examples
  14386. @itemize
  14387. @item
  14388. Apply simple strong vignetting effect:
  14389. @example
  14390. vignette=PI/4
  14391. @end example
  14392. @item
  14393. Make a flickering vignetting:
  14394. @example
  14395. vignette='PI/4+random(1)*PI/50':eval=frame
  14396. @end example
  14397. @end itemize
  14398. @section vmafmotion
  14399. Obtain the average vmaf motion score of a video.
  14400. It is one of the component filters of VMAF.
  14401. The obtained average motion score is printed through the logging system.
  14402. In the below example the input file @file{ref.mpg} is being processed and score
  14403. is computed.
  14404. @example
  14405. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  14406. @end example
  14407. @section vstack
  14408. Stack input videos vertically.
  14409. All streams must be of same pixel format and of same width.
  14410. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  14411. to create same output.
  14412. The filter accepts the following options:
  14413. @table @option
  14414. @item inputs
  14415. Set number of input streams. Default is 2.
  14416. @item shortest
  14417. If set to 1, force the output to terminate when the shortest input
  14418. terminates. Default value is 0.
  14419. @end table
  14420. @section w3fdif
  14421. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  14422. Deinterlacing Filter").
  14423. Based on the process described by Martin Weston for BBC R&D, and
  14424. implemented based on the de-interlace algorithm written by Jim
  14425. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  14426. uses filter coefficients calculated by BBC R&D.
  14427. This filter uses field-dominance information in frame to decide which
  14428. of each pair of fields to place first in the output.
  14429. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  14430. There are two sets of filter coefficients, so called "simple"
  14431. and "complex". Which set of filter coefficients is used can
  14432. be set by passing an optional parameter:
  14433. @table @option
  14434. @item filter
  14435. Set the interlacing filter coefficients. Accepts one of the following values:
  14436. @table @samp
  14437. @item simple
  14438. Simple filter coefficient set.
  14439. @item complex
  14440. More-complex filter coefficient set.
  14441. @end table
  14442. Default value is @samp{complex}.
  14443. @item deint
  14444. Specify which frames to deinterlace. Accepts one of the following values:
  14445. @table @samp
  14446. @item all
  14447. Deinterlace all frames,
  14448. @item interlaced
  14449. Only deinterlace frames marked as interlaced.
  14450. @end table
  14451. Default value is @samp{all}.
  14452. @end table
  14453. @section waveform
  14454. Video waveform monitor.
  14455. The waveform monitor plots color component intensity. By default luminance
  14456. only. Each column of the waveform corresponds to a column of pixels in the
  14457. source video.
  14458. It accepts the following options:
  14459. @table @option
  14460. @item mode, m
  14461. Can be either @code{row}, or @code{column}. Default is @code{column}.
  14462. In row mode, the graph on the left side represents color component value 0 and
  14463. the right side represents value = 255. In column mode, the top side represents
  14464. color component value = 0 and bottom side represents value = 255.
  14465. @item intensity, i
  14466. Set intensity. Smaller values are useful to find out how many values of the same
  14467. luminance are distributed across input rows/columns.
  14468. Default value is @code{0.04}. Allowed range is [0, 1].
  14469. @item mirror, r
  14470. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  14471. In mirrored mode, higher values will be represented on the left
  14472. side for @code{row} mode and at the top for @code{column} mode. Default is
  14473. @code{1} (mirrored).
  14474. @item display, d
  14475. Set display mode.
  14476. It accepts the following values:
  14477. @table @samp
  14478. @item overlay
  14479. Presents information identical to that in the @code{parade}, except
  14480. that the graphs representing color components are superimposed directly
  14481. over one another.
  14482. This display mode makes it easier to spot relative differences or similarities
  14483. in overlapping areas of the color components that are supposed to be identical,
  14484. such as neutral whites, grays, or blacks.
  14485. @item stack
  14486. Display separate graph for the color components side by side in
  14487. @code{row} mode or one below the other in @code{column} mode.
  14488. @item parade
  14489. Display separate graph for the color components side by side in
  14490. @code{column} mode or one below the other in @code{row} mode.
  14491. Using this display mode makes it easy to spot color casts in the highlights
  14492. and shadows of an image, by comparing the contours of the top and the bottom
  14493. graphs of each waveform. Since whites, grays, and blacks are characterized
  14494. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  14495. should display three waveforms of roughly equal width/height. If not, the
  14496. correction is easy to perform by making level adjustments the three waveforms.
  14497. @end table
  14498. Default is @code{stack}.
  14499. @item components, c
  14500. Set which color components to display. Default is 1, which means only luminance
  14501. or red color component if input is in RGB colorspace. If is set for example to
  14502. 7 it will display all 3 (if) available color components.
  14503. @item envelope, e
  14504. @table @samp
  14505. @item none
  14506. No envelope, this is default.
  14507. @item instant
  14508. Instant envelope, minimum and maximum values presented in graph will be easily
  14509. visible even with small @code{step} value.
  14510. @item peak
  14511. Hold minimum and maximum values presented in graph across time. This way you
  14512. can still spot out of range values without constantly looking at waveforms.
  14513. @item peak+instant
  14514. Peak and instant envelope combined together.
  14515. @end table
  14516. @item filter, f
  14517. @table @samp
  14518. @item lowpass
  14519. No filtering, this is default.
  14520. @item flat
  14521. Luma and chroma combined together.
  14522. @item aflat
  14523. Similar as above, but shows difference between blue and red chroma.
  14524. @item xflat
  14525. Similar as above, but use different colors.
  14526. @item chroma
  14527. Displays only chroma.
  14528. @item color
  14529. Displays actual color value on waveform.
  14530. @item acolor
  14531. Similar as above, but with luma showing frequency of chroma values.
  14532. @end table
  14533. @item graticule, g
  14534. Set which graticule to display.
  14535. @table @samp
  14536. @item none
  14537. Do not display graticule.
  14538. @item green
  14539. Display green graticule showing legal broadcast ranges.
  14540. @item orange
  14541. Display orange graticule showing legal broadcast ranges.
  14542. @end table
  14543. @item opacity, o
  14544. Set graticule opacity.
  14545. @item flags, fl
  14546. Set graticule flags.
  14547. @table @samp
  14548. @item numbers
  14549. Draw numbers above lines. By default enabled.
  14550. @item dots
  14551. Draw dots instead of lines.
  14552. @end table
  14553. @item scale, s
  14554. Set scale used for displaying graticule.
  14555. @table @samp
  14556. @item digital
  14557. @item millivolts
  14558. @item ire
  14559. @end table
  14560. Default is digital.
  14561. @item bgopacity, b
  14562. Set background opacity.
  14563. @end table
  14564. @section weave, doubleweave
  14565. The @code{weave} takes a field-based video input and join
  14566. each two sequential fields into single frame, producing a new double
  14567. height clip with half the frame rate and half the frame count.
  14568. The @code{doubleweave} works same as @code{weave} but without
  14569. halving frame rate and frame count.
  14570. It accepts the following option:
  14571. @table @option
  14572. @item first_field
  14573. Set first field. Available values are:
  14574. @table @samp
  14575. @item top, t
  14576. Set the frame as top-field-first.
  14577. @item bottom, b
  14578. Set the frame as bottom-field-first.
  14579. @end table
  14580. @end table
  14581. @subsection Examples
  14582. @itemize
  14583. @item
  14584. Interlace video using @ref{select} and @ref{separatefields} filter:
  14585. @example
  14586. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  14587. @end example
  14588. @end itemize
  14589. @section xbr
  14590. Apply the xBR high-quality magnification filter which is designed for pixel
  14591. art. It follows a set of edge-detection rules, see
  14592. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  14593. It accepts the following option:
  14594. @table @option
  14595. @item n
  14596. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  14597. @code{3xBR} and @code{4} for @code{4xBR}.
  14598. Default is @code{3}.
  14599. @end table
  14600. @section xmedian
  14601. Pick median pixels from several input videos.
  14602. The filter accepts the following options:
  14603. @table @option
  14604. @item inputs
  14605. Set number of inputs.
  14606. Default is 3. Allowed range is from 3 to 255.
  14607. If number of inputs is even number, than result will be mean value between two median values.
  14608. @item planes
  14609. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14610. @end table
  14611. @section xstack
  14612. Stack video inputs into custom layout.
  14613. All streams must be of same pixel format.
  14614. The filter accepts the following options:
  14615. @table @option
  14616. @item inputs
  14617. Set number of input streams. Default is 2.
  14618. @item layout
  14619. Specify layout of inputs.
  14620. This option requires the desired layout configuration to be explicitly set by the user.
  14621. This sets position of each video input in output. Each input
  14622. is separated by '|'.
  14623. The first number represents the column, and the second number represents the row.
  14624. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  14625. where X is video input from which to take width or height.
  14626. Multiple values can be used when separated by '+'. In such
  14627. case values are summed together.
  14628. Note that if inputs are of different sizes gaps may appear, as not all of
  14629. the output video frame will be filled. Similarly, videos can overlap each
  14630. other if their position doesn't leave enough space for the full frame of
  14631. adjoining videos.
  14632. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  14633. a layout must be set by the user.
  14634. @item shortest
  14635. If set to 1, force the output to terminate when the shortest input
  14636. terminates. Default value is 0.
  14637. @end table
  14638. @subsection Examples
  14639. @itemize
  14640. @item
  14641. Display 4 inputs into 2x2 grid.
  14642. Layout:
  14643. @example
  14644. input1(0, 0) | input3(w0, 0)
  14645. input2(0, h0) | input4(w0, h0)
  14646. @end example
  14647. @example
  14648. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  14649. @end example
  14650. Note that if inputs are of different sizes, gaps or overlaps may occur.
  14651. @item
  14652. Display 4 inputs into 1x4 grid.
  14653. Layout:
  14654. @example
  14655. input1(0, 0)
  14656. input2(0, h0)
  14657. input3(0, h0+h1)
  14658. input4(0, h0+h1+h2)
  14659. @end example
  14660. @example
  14661. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  14662. @end example
  14663. Note that if inputs are of different widths, unused space will appear.
  14664. @item
  14665. Display 9 inputs into 3x3 grid.
  14666. Layout:
  14667. @example
  14668. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  14669. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  14670. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  14671. @end example
  14672. @example
  14673. 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
  14674. @end example
  14675. Note that if inputs are of different sizes, gaps or overlaps may occur.
  14676. @item
  14677. Display 16 inputs into 4x4 grid.
  14678. Layout:
  14679. @example
  14680. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  14681. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  14682. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  14683. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  14684. @end example
  14685. @example
  14686. 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|
  14687. 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
  14688. @end example
  14689. Note that if inputs are of different sizes, gaps or overlaps may occur.
  14690. @end itemize
  14691. @anchor{yadif}
  14692. @section yadif
  14693. Deinterlace the input video ("yadif" means "yet another deinterlacing
  14694. filter").
  14695. It accepts the following parameters:
  14696. @table @option
  14697. @item mode
  14698. The interlacing mode to adopt. It accepts one of the following values:
  14699. @table @option
  14700. @item 0, send_frame
  14701. Output one frame for each frame.
  14702. @item 1, send_field
  14703. Output one frame for each field.
  14704. @item 2, send_frame_nospatial
  14705. Like @code{send_frame}, but it skips the spatial interlacing check.
  14706. @item 3, send_field_nospatial
  14707. Like @code{send_field}, but it skips the spatial interlacing check.
  14708. @end table
  14709. The default value is @code{send_frame}.
  14710. @item parity
  14711. The picture field parity assumed for the input interlaced video. It accepts one
  14712. of the following values:
  14713. @table @option
  14714. @item 0, tff
  14715. Assume the top field is first.
  14716. @item 1, bff
  14717. Assume the bottom field is first.
  14718. @item -1, auto
  14719. Enable automatic detection of field parity.
  14720. @end table
  14721. The default value is @code{auto}.
  14722. If the interlacing is unknown or the decoder does not export this information,
  14723. top field first will be assumed.
  14724. @item deint
  14725. Specify which frames to deinterlace. Accepts one of the following
  14726. values:
  14727. @table @option
  14728. @item 0, all
  14729. Deinterlace all frames.
  14730. @item 1, interlaced
  14731. Only deinterlace frames marked as interlaced.
  14732. @end table
  14733. The default value is @code{all}.
  14734. @end table
  14735. @section yadif_cuda
  14736. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  14737. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  14738. and/or nvenc.
  14739. It accepts the following parameters:
  14740. @table @option
  14741. @item mode
  14742. The interlacing mode to adopt. It accepts one of the following values:
  14743. @table @option
  14744. @item 0, send_frame
  14745. Output one frame for each frame.
  14746. @item 1, send_field
  14747. Output one frame for each field.
  14748. @item 2, send_frame_nospatial
  14749. Like @code{send_frame}, but it skips the spatial interlacing check.
  14750. @item 3, send_field_nospatial
  14751. Like @code{send_field}, but it skips the spatial interlacing check.
  14752. @end table
  14753. The default value is @code{send_frame}.
  14754. @item parity
  14755. The picture field parity assumed for the input interlaced video. It accepts one
  14756. of the following values:
  14757. @table @option
  14758. @item 0, tff
  14759. Assume the top field is first.
  14760. @item 1, bff
  14761. Assume the bottom field is first.
  14762. @item -1, auto
  14763. Enable automatic detection of field parity.
  14764. @end table
  14765. The default value is @code{auto}.
  14766. If the interlacing is unknown or the decoder does not export this information,
  14767. top field first will be assumed.
  14768. @item deint
  14769. Specify which frames to deinterlace. Accepts one of the following
  14770. values:
  14771. @table @option
  14772. @item 0, all
  14773. Deinterlace all frames.
  14774. @item 1, interlaced
  14775. Only deinterlace frames marked as interlaced.
  14776. @end table
  14777. The default value is @code{all}.
  14778. @end table
  14779. @section zoompan
  14780. Apply Zoom & Pan effect.
  14781. This filter accepts the following options:
  14782. @table @option
  14783. @item zoom, z
  14784. Set the zoom expression. Range is 1-10. Default is 1.
  14785. @item x
  14786. @item y
  14787. Set the x and y expression. Default is 0.
  14788. @item d
  14789. Set the duration expression in number of frames.
  14790. This sets for how many number of frames effect will last for
  14791. single input image.
  14792. @item s
  14793. Set the output image size, default is 'hd720'.
  14794. @item fps
  14795. Set the output frame rate, default is '25'.
  14796. @end table
  14797. Each expression can contain the following constants:
  14798. @table @option
  14799. @item in_w, iw
  14800. Input width.
  14801. @item in_h, ih
  14802. Input height.
  14803. @item out_w, ow
  14804. Output width.
  14805. @item out_h, oh
  14806. Output height.
  14807. @item in
  14808. Input frame count.
  14809. @item on
  14810. Output frame count.
  14811. @item x
  14812. @item y
  14813. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  14814. for current input frame.
  14815. @item px
  14816. @item py
  14817. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  14818. not yet such frame (first input frame).
  14819. @item zoom
  14820. Last calculated zoom from 'z' expression for current input frame.
  14821. @item pzoom
  14822. Last calculated zoom of last output frame of previous input frame.
  14823. @item duration
  14824. Number of output frames for current input frame. Calculated from 'd' expression
  14825. for each input frame.
  14826. @item pduration
  14827. number of output frames created for previous input frame
  14828. @item a
  14829. Rational number: input width / input height
  14830. @item sar
  14831. sample aspect ratio
  14832. @item dar
  14833. display aspect ratio
  14834. @end table
  14835. @subsection Examples
  14836. @itemize
  14837. @item
  14838. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  14839. @example
  14840. 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
  14841. @end example
  14842. @item
  14843. Zoom-in up to 1.5 and pan always at center of picture:
  14844. @example
  14845. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14846. @end example
  14847. @item
  14848. Same as above but without pausing:
  14849. @example
  14850. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14851. @end example
  14852. @end itemize
  14853. @anchor{zscale}
  14854. @section zscale
  14855. Scale (resize) the input video, using the z.lib library:
  14856. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  14857. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  14858. The zscale filter forces the output display aspect ratio to be the same
  14859. as the input, by changing the output sample aspect ratio.
  14860. If the input image format is different from the format requested by
  14861. the next filter, the zscale filter will convert the input to the
  14862. requested format.
  14863. @subsection Options
  14864. The filter accepts the following options.
  14865. @table @option
  14866. @item width, w
  14867. @item height, h
  14868. Set the output video dimension expression. Default value is the input
  14869. dimension.
  14870. If the @var{width} or @var{w} value is 0, the input width is used for
  14871. the output. If the @var{height} or @var{h} value is 0, the input height
  14872. is used for the output.
  14873. If one and only one of the values is -n with n >= 1, the zscale filter
  14874. will use a value that maintains the aspect ratio of the input image,
  14875. calculated from the other specified dimension. After that it will,
  14876. however, make sure that the calculated dimension is divisible by n and
  14877. adjust the value if necessary.
  14878. If both values are -n with n >= 1, the behavior will be identical to
  14879. both values being set to 0 as previously detailed.
  14880. See below for the list of accepted constants for use in the dimension
  14881. expression.
  14882. @item size, s
  14883. Set the video size. For the syntax of this option, check the
  14884. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14885. @item dither, d
  14886. Set the dither type.
  14887. Possible values are:
  14888. @table @var
  14889. @item none
  14890. @item ordered
  14891. @item random
  14892. @item error_diffusion
  14893. @end table
  14894. Default is none.
  14895. @item filter, f
  14896. Set the resize filter type.
  14897. Possible values are:
  14898. @table @var
  14899. @item point
  14900. @item bilinear
  14901. @item bicubic
  14902. @item spline16
  14903. @item spline36
  14904. @item lanczos
  14905. @end table
  14906. Default is bilinear.
  14907. @item range, r
  14908. Set the color range.
  14909. Possible values are:
  14910. @table @var
  14911. @item input
  14912. @item limited
  14913. @item full
  14914. @end table
  14915. Default is same as input.
  14916. @item primaries, p
  14917. Set the color primaries.
  14918. Possible values are:
  14919. @table @var
  14920. @item input
  14921. @item 709
  14922. @item unspecified
  14923. @item 170m
  14924. @item 240m
  14925. @item 2020
  14926. @end table
  14927. Default is same as input.
  14928. @item transfer, t
  14929. Set the transfer characteristics.
  14930. Possible values are:
  14931. @table @var
  14932. @item input
  14933. @item 709
  14934. @item unspecified
  14935. @item 601
  14936. @item linear
  14937. @item 2020_10
  14938. @item 2020_12
  14939. @item smpte2084
  14940. @item iec61966-2-1
  14941. @item arib-std-b67
  14942. @end table
  14943. Default is same as input.
  14944. @item matrix, m
  14945. Set the colorspace matrix.
  14946. Possible value are:
  14947. @table @var
  14948. @item input
  14949. @item 709
  14950. @item unspecified
  14951. @item 470bg
  14952. @item 170m
  14953. @item 2020_ncl
  14954. @item 2020_cl
  14955. @end table
  14956. Default is same as input.
  14957. @item rangein, rin
  14958. Set the input color range.
  14959. Possible values are:
  14960. @table @var
  14961. @item input
  14962. @item limited
  14963. @item full
  14964. @end table
  14965. Default is same as input.
  14966. @item primariesin, pin
  14967. Set the input color primaries.
  14968. Possible values are:
  14969. @table @var
  14970. @item input
  14971. @item 709
  14972. @item unspecified
  14973. @item 170m
  14974. @item 240m
  14975. @item 2020
  14976. @end table
  14977. Default is same as input.
  14978. @item transferin, tin
  14979. Set the input transfer characteristics.
  14980. Possible values are:
  14981. @table @var
  14982. @item input
  14983. @item 709
  14984. @item unspecified
  14985. @item 601
  14986. @item linear
  14987. @item 2020_10
  14988. @item 2020_12
  14989. @end table
  14990. Default is same as input.
  14991. @item matrixin, min
  14992. Set the input colorspace matrix.
  14993. Possible value are:
  14994. @table @var
  14995. @item input
  14996. @item 709
  14997. @item unspecified
  14998. @item 470bg
  14999. @item 170m
  15000. @item 2020_ncl
  15001. @item 2020_cl
  15002. @end table
  15003. @item chromal, c
  15004. Set the output chroma location.
  15005. Possible values are:
  15006. @table @var
  15007. @item input
  15008. @item left
  15009. @item center
  15010. @item topleft
  15011. @item top
  15012. @item bottomleft
  15013. @item bottom
  15014. @end table
  15015. @item chromalin, cin
  15016. Set the input chroma location.
  15017. Possible values are:
  15018. @table @var
  15019. @item input
  15020. @item left
  15021. @item center
  15022. @item topleft
  15023. @item top
  15024. @item bottomleft
  15025. @item bottom
  15026. @end table
  15027. @item npl
  15028. Set the nominal peak luminance.
  15029. @end table
  15030. The values of the @option{w} and @option{h} options are expressions
  15031. containing the following constants:
  15032. @table @var
  15033. @item in_w
  15034. @item in_h
  15035. The input width and height
  15036. @item iw
  15037. @item ih
  15038. These are the same as @var{in_w} and @var{in_h}.
  15039. @item out_w
  15040. @item out_h
  15041. The output (scaled) width and height
  15042. @item ow
  15043. @item oh
  15044. These are the same as @var{out_w} and @var{out_h}
  15045. @item a
  15046. The same as @var{iw} / @var{ih}
  15047. @item sar
  15048. input sample aspect ratio
  15049. @item dar
  15050. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  15051. @item hsub
  15052. @item vsub
  15053. horizontal and vertical input chroma subsample values. For example for the
  15054. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15055. @item ohsub
  15056. @item ovsub
  15057. horizontal and vertical output chroma subsample values. For example for the
  15058. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15059. @end table
  15060. @table @option
  15061. @end table
  15062. @c man end VIDEO FILTERS
  15063. @chapter OpenCL Video Filters
  15064. @c man begin OPENCL VIDEO FILTERS
  15065. Below is a description of the currently available OpenCL video filters.
  15066. To enable compilation of these filters you need to configure FFmpeg with
  15067. @code{--enable-opencl}.
  15068. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  15069. @table @option
  15070. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  15071. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  15072. given device parameters.
  15073. @item -filter_hw_device @var{name}
  15074. Pass the hardware device called @var{name} to all filters in any filter graph.
  15075. @end table
  15076. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  15077. @itemize
  15078. @item
  15079. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  15080. @example
  15081. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  15082. @end example
  15083. @end itemize
  15084. 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.
  15085. @section avgblur_opencl
  15086. Apply average blur filter.
  15087. The filter accepts the following options:
  15088. @table @option
  15089. @item sizeX
  15090. Set horizontal radius size.
  15091. Range is @code{[1, 1024]} and default value is @code{1}.
  15092. @item planes
  15093. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15094. @item sizeY
  15095. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  15096. @end table
  15097. @subsection Example
  15098. @itemize
  15099. @item
  15100. 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.
  15101. @example
  15102. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  15103. @end example
  15104. @end itemize
  15105. @section boxblur_opencl
  15106. Apply a boxblur algorithm to the input video.
  15107. It accepts the following parameters:
  15108. @table @option
  15109. @item luma_radius, lr
  15110. @item luma_power, lp
  15111. @item chroma_radius, cr
  15112. @item chroma_power, cp
  15113. @item alpha_radius, ar
  15114. @item alpha_power, ap
  15115. @end table
  15116. A description of the accepted options follows.
  15117. @table @option
  15118. @item luma_radius, lr
  15119. @item chroma_radius, cr
  15120. @item alpha_radius, ar
  15121. Set an expression for the box radius in pixels used for blurring the
  15122. corresponding input plane.
  15123. The radius value must be a non-negative number, and must not be
  15124. greater than the value of the expression @code{min(w,h)/2} for the
  15125. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  15126. planes.
  15127. Default value for @option{luma_radius} is "2". If not specified,
  15128. @option{chroma_radius} and @option{alpha_radius} default to the
  15129. corresponding value set for @option{luma_radius}.
  15130. The expressions can contain the following constants:
  15131. @table @option
  15132. @item w
  15133. @item h
  15134. The input width and height in pixels.
  15135. @item cw
  15136. @item ch
  15137. The input chroma image width and height in pixels.
  15138. @item hsub
  15139. @item vsub
  15140. The horizontal and vertical chroma subsample values. For example, for the
  15141. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  15142. @end table
  15143. @item luma_power, lp
  15144. @item chroma_power, cp
  15145. @item alpha_power, ap
  15146. Specify how many times the boxblur filter is applied to the
  15147. corresponding plane.
  15148. Default value for @option{luma_power} is 2. If not specified,
  15149. @option{chroma_power} and @option{alpha_power} default to the
  15150. corresponding value set for @option{luma_power}.
  15151. A value of 0 will disable the effect.
  15152. @end table
  15153. @subsection Examples
  15154. 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.
  15155. @itemize
  15156. @item
  15157. Apply a boxblur filter with the luma, chroma, and alpha radius
  15158. 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.
  15159. @example
  15160. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  15161. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  15162. @end example
  15163. @item
  15164. 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.
  15165. For the luma plane, a 2x2 box radius will be run once.
  15166. For the chroma plane, a 4x4 box radius will be run 5 times.
  15167. For the alpha plane, a 3x3 box radius will be run 7 times.
  15168. @example
  15169. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  15170. @end example
  15171. @end itemize
  15172. @section convolution_opencl
  15173. Apply convolution of 3x3, 5x5, 7x7 matrix.
  15174. The filter accepts the following options:
  15175. @table @option
  15176. @item 0m
  15177. @item 1m
  15178. @item 2m
  15179. @item 3m
  15180. Set matrix for each plane.
  15181. Matrix is sequence of 9, 25 or 49 signed numbers.
  15182. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  15183. @item 0rdiv
  15184. @item 1rdiv
  15185. @item 2rdiv
  15186. @item 3rdiv
  15187. Set multiplier for calculated value for each plane.
  15188. If unset or 0, it will be sum of all matrix elements.
  15189. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  15190. @item 0bias
  15191. @item 1bias
  15192. @item 2bias
  15193. @item 3bias
  15194. Set bias for each plane. This value is added to the result of the multiplication.
  15195. Useful for making the overall image brighter or darker.
  15196. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  15197. @end table
  15198. @subsection Examples
  15199. @itemize
  15200. @item
  15201. Apply sharpen:
  15202. @example
  15203. -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
  15204. @end example
  15205. @item
  15206. Apply blur:
  15207. @example
  15208. -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
  15209. @end example
  15210. @item
  15211. Apply edge enhance:
  15212. @example
  15213. -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
  15214. @end example
  15215. @item
  15216. Apply edge detect:
  15217. @example
  15218. -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
  15219. @end example
  15220. @item
  15221. Apply laplacian edge detector which includes diagonals:
  15222. @example
  15223. -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
  15224. @end example
  15225. @item
  15226. Apply emboss:
  15227. @example
  15228. -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
  15229. @end example
  15230. @end itemize
  15231. @section dilation_opencl
  15232. Apply dilation effect to the video.
  15233. This filter replaces the pixel by the local(3x3) maximum.
  15234. It accepts the following options:
  15235. @table @option
  15236. @item threshold0
  15237. @item threshold1
  15238. @item threshold2
  15239. @item threshold3
  15240. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  15241. If @code{0}, plane will remain unchanged.
  15242. @item coordinates
  15243. Flag which specifies the pixel to refer to.
  15244. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  15245. Flags to local 3x3 coordinates region centered on @code{x}:
  15246. 1 2 3
  15247. 4 x 5
  15248. 6 7 8
  15249. @end table
  15250. @subsection Example
  15251. @itemize
  15252. @item
  15253. 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.
  15254. @example
  15255. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  15256. @end example
  15257. @end itemize
  15258. @section erosion_opencl
  15259. Apply erosion effect to the video.
  15260. This filter replaces the pixel by the local(3x3) minimum.
  15261. It accepts the following options:
  15262. @table @option
  15263. @item threshold0
  15264. @item threshold1
  15265. @item threshold2
  15266. @item threshold3
  15267. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  15268. If @code{0}, plane will remain unchanged.
  15269. @item coordinates
  15270. Flag which specifies the pixel to refer to.
  15271. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  15272. Flags to local 3x3 coordinates region centered on @code{x}:
  15273. 1 2 3
  15274. 4 x 5
  15275. 6 7 8
  15276. @end table
  15277. @subsection Example
  15278. @itemize
  15279. @item
  15280. 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.
  15281. @example
  15282. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  15283. @end example
  15284. @end itemize
  15285. @section colorkey_opencl
  15286. RGB colorspace color keying.
  15287. The filter accepts the following options:
  15288. @table @option
  15289. @item color
  15290. The color which will be replaced with transparency.
  15291. @item similarity
  15292. Similarity percentage with the key color.
  15293. 0.01 matches only the exact key color, while 1.0 matches everything.
  15294. @item blend
  15295. Blend percentage.
  15296. 0.0 makes pixels either fully transparent, or not transparent at all.
  15297. Higher values result in semi-transparent pixels, with a higher transparency
  15298. the more similar the pixels color is to the key color.
  15299. @end table
  15300. @subsection Examples
  15301. @itemize
  15302. @item
  15303. Make every semi-green pixel in the input transparent with some slight blending:
  15304. @example
  15305. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  15306. @end example
  15307. @end itemize
  15308. @section deshake_opencl
  15309. Feature-point based video stabilization filter.
  15310. The filter accepts the following options:
  15311. @table @option
  15312. @item tripod
  15313. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  15314. @item debug
  15315. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  15316. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  15317. Viewing point matches in the output video is only supported for RGB input.
  15318. Defaults to @code{0}.
  15319. @item adaptive_crop
  15320. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  15321. Defaults to @code{1}.
  15322. @item refine_features
  15323. Whether or not feature points should be refined at a sub-pixel level.
  15324. This can be turned off for a slight performance gain at the cost of precision.
  15325. Defaults to @code{1}.
  15326. @item smooth_strength
  15327. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  15328. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  15329. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  15330. Defaults to @code{0.0}.
  15331. @item smooth_window_multiplier
  15332. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  15333. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  15334. Acceptable values range from @code{0.1} to @code{10.0}.
  15335. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  15336. potentially improving smoothness, but also increase latency and memory usage.
  15337. Defaults to @code{2.0}.
  15338. @end table
  15339. @subsection Examples
  15340. @itemize
  15341. @item
  15342. Stabilize a video with a fixed, medium smoothing strength:
  15343. @example
  15344. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  15345. @end example
  15346. @item
  15347. Stabilize a video with debugging (both in console and in rendered video):
  15348. @example
  15349. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  15350. @end example
  15351. @end itemize
  15352. @section nlmeans_opencl
  15353. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  15354. @section overlay_opencl
  15355. Overlay one video on top of another.
  15356. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  15357. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  15358. The filter accepts the following options:
  15359. @table @option
  15360. @item x
  15361. Set the x coordinate of the overlaid video on the main video.
  15362. Default value is @code{0}.
  15363. @item y
  15364. Set the x coordinate of the overlaid video on the main video.
  15365. Default value is @code{0}.
  15366. @end table
  15367. @subsection Examples
  15368. @itemize
  15369. @item
  15370. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  15371. @example
  15372. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  15373. @end example
  15374. @item
  15375. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  15376. @example
  15377. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  15378. @end example
  15379. @end itemize
  15380. @section prewitt_opencl
  15381. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  15382. The filter accepts the following option:
  15383. @table @option
  15384. @item planes
  15385. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15386. @item scale
  15387. Set value which will be multiplied with filtered result.
  15388. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15389. @item delta
  15390. Set value which will be added to filtered result.
  15391. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15392. @end table
  15393. @subsection Example
  15394. @itemize
  15395. @item
  15396. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  15397. @example
  15398. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15399. @end example
  15400. @end itemize
  15401. @section roberts_opencl
  15402. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  15403. The filter accepts the following option:
  15404. @table @option
  15405. @item planes
  15406. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15407. @item scale
  15408. Set value which will be multiplied with filtered result.
  15409. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15410. @item delta
  15411. Set value which will be added to filtered result.
  15412. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15413. @end table
  15414. @subsection Example
  15415. @itemize
  15416. @item
  15417. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  15418. @example
  15419. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15420. @end example
  15421. @end itemize
  15422. @section sobel_opencl
  15423. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  15424. The filter accepts the following option:
  15425. @table @option
  15426. @item planes
  15427. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15428. @item scale
  15429. Set value which will be multiplied with filtered result.
  15430. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15431. @item delta
  15432. Set value which will be added to filtered result.
  15433. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15434. @end table
  15435. @subsection Example
  15436. @itemize
  15437. @item
  15438. Apply sobel operator with scale set to 2 and delta set to 10
  15439. @example
  15440. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15441. @end example
  15442. @end itemize
  15443. @section tonemap_opencl
  15444. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  15445. It accepts the following parameters:
  15446. @table @option
  15447. @item tonemap
  15448. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  15449. @item param
  15450. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  15451. @item desat
  15452. Apply desaturation for highlights that exceed this level of brightness. The
  15453. higher the parameter, the more color information will be preserved. This
  15454. setting helps prevent unnaturally blown-out colors for super-highlights, by
  15455. (smoothly) turning into white instead. This makes images feel more natural,
  15456. at the cost of reducing information about out-of-range colors.
  15457. The default value is 0.5, and the algorithm here is a little different from
  15458. the cpu version tonemap currently. A setting of 0.0 disables this option.
  15459. @item threshold
  15460. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  15461. is used to detect whether the scene has changed or not. If the distance between
  15462. the current frame average brightness and the current running average exceeds
  15463. a threshold value, we would re-calculate scene average and peak brightness.
  15464. The default value is 0.2.
  15465. @item format
  15466. Specify the output pixel format.
  15467. Currently supported formats are:
  15468. @table @var
  15469. @item p010
  15470. @item nv12
  15471. @end table
  15472. @item range, r
  15473. Set the output color range.
  15474. Possible values are:
  15475. @table @var
  15476. @item tv/mpeg
  15477. @item pc/jpeg
  15478. @end table
  15479. Default is same as input.
  15480. @item primaries, p
  15481. Set the output color primaries.
  15482. Possible values are:
  15483. @table @var
  15484. @item bt709
  15485. @item bt2020
  15486. @end table
  15487. Default is same as input.
  15488. @item transfer, t
  15489. Set the output transfer characteristics.
  15490. Possible values are:
  15491. @table @var
  15492. @item bt709
  15493. @item bt2020
  15494. @end table
  15495. Default is bt709.
  15496. @item matrix, m
  15497. Set the output colorspace matrix.
  15498. Possible value are:
  15499. @table @var
  15500. @item bt709
  15501. @item bt2020
  15502. @end table
  15503. Default is same as input.
  15504. @end table
  15505. @subsection Example
  15506. @itemize
  15507. @item
  15508. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  15509. @example
  15510. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  15511. @end example
  15512. @end itemize
  15513. @section unsharp_opencl
  15514. Sharpen or blur the input video.
  15515. It accepts the following parameters:
  15516. @table @option
  15517. @item luma_msize_x, lx
  15518. Set the luma matrix horizontal size.
  15519. Range is @code{[1, 23]} and default value is @code{5}.
  15520. @item luma_msize_y, ly
  15521. Set the luma matrix vertical size.
  15522. Range is @code{[1, 23]} and default value is @code{5}.
  15523. @item luma_amount, la
  15524. Set the luma effect strength.
  15525. Range is @code{[-10, 10]} and default value is @code{1.0}.
  15526. Negative values will blur the input video, while positive values will
  15527. sharpen it, a value of zero will disable the effect.
  15528. @item chroma_msize_x, cx
  15529. Set the chroma matrix horizontal size.
  15530. Range is @code{[1, 23]} and default value is @code{5}.
  15531. @item chroma_msize_y, cy
  15532. Set the chroma matrix vertical size.
  15533. Range is @code{[1, 23]} and default value is @code{5}.
  15534. @item chroma_amount, ca
  15535. Set the chroma effect strength.
  15536. Range is @code{[-10, 10]} and default value is @code{0.0}.
  15537. Negative values will blur the input video, while positive values will
  15538. sharpen it, a value of zero will disable the effect.
  15539. @end table
  15540. All parameters are optional and default to the equivalent of the
  15541. string '5:5:1.0:5:5:0.0'.
  15542. @subsection Examples
  15543. @itemize
  15544. @item
  15545. Apply strong luma sharpen effect:
  15546. @example
  15547. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  15548. @end example
  15549. @item
  15550. Apply a strong blur of both luma and chroma parameters:
  15551. @example
  15552. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  15553. @end example
  15554. @end itemize
  15555. @c man end OPENCL VIDEO FILTERS
  15556. @chapter Video Sources
  15557. @c man begin VIDEO SOURCES
  15558. Below is a description of the currently available video sources.
  15559. @section buffer
  15560. Buffer video frames, and make them available to the filter chain.
  15561. This source is mainly intended for a programmatic use, in particular
  15562. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  15563. It accepts the following parameters:
  15564. @table @option
  15565. @item video_size
  15566. Specify the size (width and height) of the buffered video frames. For the
  15567. syntax of this option, check the
  15568. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15569. @item width
  15570. The input video width.
  15571. @item height
  15572. The input video height.
  15573. @item pix_fmt
  15574. A string representing the pixel format of the buffered video frames.
  15575. It may be a number corresponding to a pixel format, or a pixel format
  15576. name.
  15577. @item time_base
  15578. Specify the timebase assumed by the timestamps of the buffered frames.
  15579. @item frame_rate
  15580. Specify the frame rate expected for the video stream.
  15581. @item pixel_aspect, sar
  15582. The sample (pixel) aspect ratio of the input video.
  15583. @item sws_param
  15584. Specify the optional parameters to be used for the scale filter which
  15585. is automatically inserted when an input change is detected in the
  15586. input size or format.
  15587. @item hw_frames_ctx
  15588. When using a hardware pixel format, this should be a reference to an
  15589. AVHWFramesContext describing input frames.
  15590. @end table
  15591. For example:
  15592. @example
  15593. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  15594. @end example
  15595. will instruct the source to accept video frames with size 320x240 and
  15596. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  15597. square pixels (1:1 sample aspect ratio).
  15598. Since the pixel format with name "yuv410p" corresponds to the number 6
  15599. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  15600. this example corresponds to:
  15601. @example
  15602. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  15603. @end example
  15604. Alternatively, the options can be specified as a flat string, but this
  15605. syntax is deprecated:
  15606. @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}]
  15607. @section cellauto
  15608. Create a pattern generated by an elementary cellular automaton.
  15609. The initial state of the cellular automaton can be defined through the
  15610. @option{filename} and @option{pattern} options. If such options are
  15611. not specified an initial state is created randomly.
  15612. At each new frame a new row in the video is filled with the result of
  15613. the cellular automaton next generation. The behavior when the whole
  15614. frame is filled is defined by the @option{scroll} option.
  15615. This source accepts the following options:
  15616. @table @option
  15617. @item filename, f
  15618. Read the initial cellular automaton state, i.e. the starting row, from
  15619. the specified file.
  15620. In the file, each non-whitespace character is considered an alive
  15621. cell, a newline will terminate the row, and further characters in the
  15622. file will be ignored.
  15623. @item pattern, p
  15624. Read the initial cellular automaton state, i.e. the starting row, from
  15625. the specified string.
  15626. Each non-whitespace character in the string is considered an alive
  15627. cell, a newline will terminate the row, and further characters in the
  15628. string will be ignored.
  15629. @item rate, r
  15630. Set the video rate, that is the number of frames generated per second.
  15631. Default is 25.
  15632. @item random_fill_ratio, ratio
  15633. Set the random fill ratio for the initial cellular automaton row. It
  15634. is a floating point number value ranging from 0 to 1, defaults to
  15635. 1/PHI.
  15636. This option is ignored when a file or a pattern is specified.
  15637. @item random_seed, seed
  15638. Set the seed for filling randomly the initial row, must be an integer
  15639. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15640. set to -1, the filter will try to use a good random seed on a best
  15641. effort basis.
  15642. @item rule
  15643. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  15644. Default value is 110.
  15645. @item size, s
  15646. Set the size of the output video. For the syntax of this option, check the
  15647. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15648. If @option{filename} or @option{pattern} is specified, the size is set
  15649. by default to the width of the specified initial state row, and the
  15650. height is set to @var{width} * PHI.
  15651. If @option{size} is set, it must contain the width of the specified
  15652. pattern string, and the specified pattern will be centered in the
  15653. larger row.
  15654. If a filename or a pattern string is not specified, the size value
  15655. defaults to "320x518" (used for a randomly generated initial state).
  15656. @item scroll
  15657. If set to 1, scroll the output upward when all the rows in the output
  15658. have been already filled. If set to 0, the new generated row will be
  15659. written over the top row just after the bottom row is filled.
  15660. Defaults to 1.
  15661. @item start_full, full
  15662. If set to 1, completely fill the output with generated rows before
  15663. outputting the first frame.
  15664. This is the default behavior, for disabling set the value to 0.
  15665. @item stitch
  15666. If set to 1, stitch the left and right row edges together.
  15667. This is the default behavior, for disabling set the value to 0.
  15668. @end table
  15669. @subsection Examples
  15670. @itemize
  15671. @item
  15672. Read the initial state from @file{pattern}, and specify an output of
  15673. size 200x400.
  15674. @example
  15675. cellauto=f=pattern:s=200x400
  15676. @end example
  15677. @item
  15678. Generate a random initial row with a width of 200 cells, with a fill
  15679. ratio of 2/3:
  15680. @example
  15681. cellauto=ratio=2/3:s=200x200
  15682. @end example
  15683. @item
  15684. Create a pattern generated by rule 18 starting by a single alive cell
  15685. centered on an initial row with width 100:
  15686. @example
  15687. cellauto=p=@@:s=100x400:full=0:rule=18
  15688. @end example
  15689. @item
  15690. Specify a more elaborated initial pattern:
  15691. @example
  15692. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  15693. @end example
  15694. @end itemize
  15695. @anchor{coreimagesrc}
  15696. @section coreimagesrc
  15697. Video source generated on GPU using Apple's CoreImage API on OSX.
  15698. This video source is a specialized version of the @ref{coreimage} video filter.
  15699. Use a core image generator at the beginning of the applied filterchain to
  15700. generate the content.
  15701. The coreimagesrc video source accepts the following options:
  15702. @table @option
  15703. @item list_generators
  15704. List all available generators along with all their respective options as well as
  15705. possible minimum and maximum values along with the default values.
  15706. @example
  15707. list_generators=true
  15708. @end example
  15709. @item size, s
  15710. Specify the size of the sourced video. For the syntax of this option, check the
  15711. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15712. The default value is @code{320x240}.
  15713. @item rate, r
  15714. Specify the frame rate of the sourced video, as the number of frames
  15715. generated per second. It has to be a string in the format
  15716. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15717. number or a valid video frame rate abbreviation. The default value is
  15718. "25".
  15719. @item sar
  15720. Set the sample aspect ratio of the sourced video.
  15721. @item duration, d
  15722. Set the duration of the sourced video. See
  15723. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15724. for the accepted syntax.
  15725. If not specified, or the expressed duration is negative, the video is
  15726. supposed to be generated forever.
  15727. @end table
  15728. Additionally, all options of the @ref{coreimage} video filter are accepted.
  15729. A complete filterchain can be used for further processing of the
  15730. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  15731. and examples for details.
  15732. @subsection Examples
  15733. @itemize
  15734. @item
  15735. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  15736. given as complete and escaped command-line for Apple's standard bash shell:
  15737. @example
  15738. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  15739. @end example
  15740. This example is equivalent to the QRCode example of @ref{coreimage} without the
  15741. need for a nullsrc video source.
  15742. @end itemize
  15743. @section mandelbrot
  15744. Generate a Mandelbrot set fractal, and progressively zoom towards the
  15745. point specified with @var{start_x} and @var{start_y}.
  15746. This source accepts the following options:
  15747. @table @option
  15748. @item end_pts
  15749. Set the terminal pts value. Default value is 400.
  15750. @item end_scale
  15751. Set the terminal scale value.
  15752. Must be a floating point value. Default value is 0.3.
  15753. @item inner
  15754. Set the inner coloring mode, that is the algorithm used to draw the
  15755. Mandelbrot fractal internal region.
  15756. It shall assume one of the following values:
  15757. @table @option
  15758. @item black
  15759. Set black mode.
  15760. @item convergence
  15761. Show time until convergence.
  15762. @item mincol
  15763. Set color based on point closest to the origin of the iterations.
  15764. @item period
  15765. Set period mode.
  15766. @end table
  15767. Default value is @var{mincol}.
  15768. @item bailout
  15769. Set the bailout value. Default value is 10.0.
  15770. @item maxiter
  15771. Set the maximum of iterations performed by the rendering
  15772. algorithm. Default value is 7189.
  15773. @item outer
  15774. Set outer coloring mode.
  15775. It shall assume one of following values:
  15776. @table @option
  15777. @item iteration_count
  15778. Set iteration count mode.
  15779. @item normalized_iteration_count
  15780. set normalized iteration count mode.
  15781. @end table
  15782. Default value is @var{normalized_iteration_count}.
  15783. @item rate, r
  15784. Set frame rate, expressed as number of frames per second. Default
  15785. value is "25".
  15786. @item size, s
  15787. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  15788. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  15789. @item start_scale
  15790. Set the initial scale value. Default value is 3.0.
  15791. @item start_x
  15792. Set the initial x position. Must be a floating point value between
  15793. -100 and 100. Default value is -0.743643887037158704752191506114774.
  15794. @item start_y
  15795. Set the initial y position. Must be a floating point value between
  15796. -100 and 100. Default value is -0.131825904205311970493132056385139.
  15797. @end table
  15798. @section mptestsrc
  15799. Generate various test patterns, as generated by the MPlayer test filter.
  15800. The size of the generated video is fixed, and is 256x256.
  15801. This source is useful in particular for testing encoding features.
  15802. This source accepts the following options:
  15803. @table @option
  15804. @item rate, r
  15805. Specify the frame rate of the sourced video, as the number of frames
  15806. generated per second. It has to be a string in the format
  15807. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15808. number or a valid video frame rate abbreviation. The default value is
  15809. "25".
  15810. @item duration, d
  15811. Set the duration of the sourced video. See
  15812. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15813. for the accepted syntax.
  15814. If not specified, or the expressed duration is negative, the video is
  15815. supposed to be generated forever.
  15816. @item test, t
  15817. Set the number or the name of the test to perform. Supported tests are:
  15818. @table @option
  15819. @item dc_luma
  15820. @item dc_chroma
  15821. @item freq_luma
  15822. @item freq_chroma
  15823. @item amp_luma
  15824. @item amp_chroma
  15825. @item cbp
  15826. @item mv
  15827. @item ring1
  15828. @item ring2
  15829. @item all
  15830. @end table
  15831. Default value is "all", which will cycle through the list of all tests.
  15832. @end table
  15833. Some examples:
  15834. @example
  15835. mptestsrc=t=dc_luma
  15836. @end example
  15837. will generate a "dc_luma" test pattern.
  15838. @section frei0r_src
  15839. Provide a frei0r source.
  15840. To enable compilation of this filter you need to install the frei0r
  15841. header and configure FFmpeg with @code{--enable-frei0r}.
  15842. This source accepts the following parameters:
  15843. @table @option
  15844. @item size
  15845. The size of the video to generate. For the syntax of this option, check the
  15846. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15847. @item framerate
  15848. The framerate of the generated video. It may be a string of the form
  15849. @var{num}/@var{den} or a frame rate abbreviation.
  15850. @item filter_name
  15851. The name to the frei0r source to load. For more information regarding frei0r and
  15852. how to set the parameters, read the @ref{frei0r} section in the video filters
  15853. documentation.
  15854. @item filter_params
  15855. A '|'-separated list of parameters to pass to the frei0r source.
  15856. @end table
  15857. For example, to generate a frei0r partik0l source with size 200x200
  15858. and frame rate 10 which is overlaid on the overlay filter main input:
  15859. @example
  15860. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  15861. @end example
  15862. @section life
  15863. Generate a life pattern.
  15864. This source is based on a generalization of John Conway's life game.
  15865. The sourced input represents a life grid, each pixel represents a cell
  15866. which can be in one of two possible states, alive or dead. Every cell
  15867. interacts with its eight neighbours, which are the cells that are
  15868. horizontally, vertically, or diagonally adjacent.
  15869. At each interaction the grid evolves according to the adopted rule,
  15870. which specifies the number of neighbor alive cells which will make a
  15871. cell stay alive or born. The @option{rule} option allows one to specify
  15872. the rule to adopt.
  15873. This source accepts the following options:
  15874. @table @option
  15875. @item filename, f
  15876. Set the file from which to read the initial grid state. In the file,
  15877. each non-whitespace character is considered an alive cell, and newline
  15878. is used to delimit the end of each row.
  15879. If this option is not specified, the initial grid is generated
  15880. randomly.
  15881. @item rate, r
  15882. Set the video rate, that is the number of frames generated per second.
  15883. Default is 25.
  15884. @item random_fill_ratio, ratio
  15885. Set the random fill ratio for the initial random grid. It is a
  15886. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  15887. It is ignored when a file is specified.
  15888. @item random_seed, seed
  15889. Set the seed for filling the initial random grid, must be an integer
  15890. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15891. set to -1, the filter will try to use a good random seed on a best
  15892. effort basis.
  15893. @item rule
  15894. Set the life rule.
  15895. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  15896. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  15897. @var{NS} specifies the number of alive neighbor cells which make a
  15898. live cell stay alive, and @var{NB} the number of alive neighbor cells
  15899. which make a dead cell to become alive (i.e. to "born").
  15900. "s" and "b" can be used in place of "S" and "B", respectively.
  15901. Alternatively a rule can be specified by an 18-bits integer. The 9
  15902. high order bits are used to encode the next cell state if it is alive
  15903. for each number of neighbor alive cells, the low order bits specify
  15904. the rule for "borning" new cells. Higher order bits encode for an
  15905. higher number of neighbor cells.
  15906. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  15907. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  15908. Default value is "S23/B3", which is the original Conway's game of life
  15909. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  15910. cells, and will born a new cell if there are three alive cells around
  15911. a dead cell.
  15912. @item size, s
  15913. Set the size of the output video. For the syntax of this option, check the
  15914. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15915. If @option{filename} is specified, the size is set by default to the
  15916. same size of the input file. If @option{size} is set, it must contain
  15917. the size specified in the input file, and the initial grid defined in
  15918. that file is centered in the larger resulting area.
  15919. If a filename is not specified, the size value defaults to "320x240"
  15920. (used for a randomly generated initial grid).
  15921. @item stitch
  15922. If set to 1, stitch the left and right grid edges together, and the
  15923. top and bottom edges also. Defaults to 1.
  15924. @item mold
  15925. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  15926. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  15927. value from 0 to 255.
  15928. @item life_color
  15929. Set the color of living (or new born) cells.
  15930. @item death_color
  15931. Set the color of dead cells. If @option{mold} is set, this is the first color
  15932. used to represent a dead cell.
  15933. @item mold_color
  15934. Set mold color, for definitely dead and moldy cells.
  15935. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  15936. ffmpeg-utils manual,ffmpeg-utils}.
  15937. @end table
  15938. @subsection Examples
  15939. @itemize
  15940. @item
  15941. Read a grid from @file{pattern}, and center it on a grid of size
  15942. 300x300 pixels:
  15943. @example
  15944. life=f=pattern:s=300x300
  15945. @end example
  15946. @item
  15947. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  15948. @example
  15949. life=ratio=2/3:s=200x200
  15950. @end example
  15951. @item
  15952. Specify a custom rule for evolving a randomly generated grid:
  15953. @example
  15954. life=rule=S14/B34
  15955. @end example
  15956. @item
  15957. Full example with slow death effect (mold) using @command{ffplay}:
  15958. @example
  15959. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  15960. @end example
  15961. @end itemize
  15962. @anchor{allrgb}
  15963. @anchor{allyuv}
  15964. @anchor{color}
  15965. @anchor{haldclutsrc}
  15966. @anchor{nullsrc}
  15967. @anchor{pal75bars}
  15968. @anchor{pal100bars}
  15969. @anchor{rgbtestsrc}
  15970. @anchor{smptebars}
  15971. @anchor{smptehdbars}
  15972. @anchor{testsrc}
  15973. @anchor{testsrc2}
  15974. @anchor{yuvtestsrc}
  15975. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  15976. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  15977. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  15978. The @code{color} source provides an uniformly colored input.
  15979. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  15980. @ref{haldclut} filter.
  15981. The @code{nullsrc} source returns unprocessed video frames. It is
  15982. mainly useful to be employed in analysis / debugging tools, or as the
  15983. source for filters which ignore the input data.
  15984. The @code{pal75bars} source generates a color bars pattern, based on
  15985. EBU PAL recommendations with 75% color levels.
  15986. The @code{pal100bars} source generates a color bars pattern, based on
  15987. EBU PAL recommendations with 100% color levels.
  15988. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  15989. detecting RGB vs BGR issues. You should see a red, green and blue
  15990. stripe from top to bottom.
  15991. The @code{smptebars} source generates a color bars pattern, based on
  15992. the SMPTE Engineering Guideline EG 1-1990.
  15993. The @code{smptehdbars} source generates a color bars pattern, based on
  15994. the SMPTE RP 219-2002.
  15995. The @code{testsrc} source generates a test video pattern, showing a
  15996. color pattern, a scrolling gradient and a timestamp. This is mainly
  15997. intended for testing purposes.
  15998. The @code{testsrc2} source is similar to testsrc, but supports more
  15999. pixel formats instead of just @code{rgb24}. This allows using it as an
  16000. input for other tests without requiring a format conversion.
  16001. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  16002. see a y, cb and cr stripe from top to bottom.
  16003. The sources accept the following parameters:
  16004. @table @option
  16005. @item level
  16006. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  16007. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  16008. pixels to be used as identity matrix for 3D lookup tables. Each component is
  16009. coded on a @code{1/(N*N)} scale.
  16010. @item color, c
  16011. Specify the color of the source, only available in the @code{color}
  16012. source. For the syntax of this option, check the
  16013. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16014. @item size, s
  16015. Specify the size of the sourced video. For the syntax of this option, check the
  16016. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16017. The default value is @code{320x240}.
  16018. This option is not available with the @code{allrgb}, @code{allyuv}, and
  16019. @code{haldclutsrc} filters.
  16020. @item rate, r
  16021. Specify the frame rate of the sourced video, as the number of frames
  16022. generated per second. It has to be a string in the format
  16023. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  16024. number or a valid video frame rate abbreviation. The default value is
  16025. "25".
  16026. @item duration, d
  16027. Set the duration of the sourced video. See
  16028. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16029. for the accepted syntax.
  16030. If not specified, or the expressed duration is negative, the video is
  16031. supposed to be generated forever.
  16032. @item sar
  16033. Set the sample aspect ratio of the sourced video.
  16034. @item alpha
  16035. Specify the alpha (opacity) of the background, only available in the
  16036. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  16037. 255 (fully opaque, the default).
  16038. @item decimals, n
  16039. Set the number of decimals to show in the timestamp, only available in the
  16040. @code{testsrc} source.
  16041. The displayed timestamp value will correspond to the original
  16042. timestamp value multiplied by the power of 10 of the specified
  16043. value. Default value is 0.
  16044. @end table
  16045. @subsection Examples
  16046. @itemize
  16047. @item
  16048. Generate a video with a duration of 5.3 seconds, with size
  16049. 176x144 and a frame rate of 10 frames per second:
  16050. @example
  16051. testsrc=duration=5.3:size=qcif:rate=10
  16052. @end example
  16053. @item
  16054. The following graph description will generate a red source
  16055. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  16056. frames per second:
  16057. @example
  16058. color=c=red@@0.2:s=qcif:r=10
  16059. @end example
  16060. @item
  16061. If the input content is to be ignored, @code{nullsrc} can be used. The
  16062. following command generates noise in the luminance plane by employing
  16063. the @code{geq} filter:
  16064. @example
  16065. nullsrc=s=256x256, geq=random(1)*255:128:128
  16066. @end example
  16067. @end itemize
  16068. @subsection Commands
  16069. The @code{color} source supports the following commands:
  16070. @table @option
  16071. @item c, color
  16072. Set the color of the created image. Accepts the same syntax of the
  16073. corresponding @option{color} option.
  16074. @end table
  16075. @section openclsrc
  16076. Generate video using an OpenCL program.
  16077. @table @option
  16078. @item source
  16079. OpenCL program source file.
  16080. @item kernel
  16081. Kernel name in program.
  16082. @item size, s
  16083. Size of frames to generate. This must be set.
  16084. @item format
  16085. Pixel format to use for the generated frames. This must be set.
  16086. @item rate, r
  16087. Number of frames generated every second. Default value is '25'.
  16088. @end table
  16089. For details of how the program loading works, see the @ref{program_opencl}
  16090. filter.
  16091. Example programs:
  16092. @itemize
  16093. @item
  16094. Generate a colour ramp by setting pixel values from the position of the pixel
  16095. in the output image. (Note that this will work with all pixel formats, but
  16096. the generated output will not be the same.)
  16097. @verbatim
  16098. __kernel void ramp(__write_only image2d_t dst,
  16099. unsigned int index)
  16100. {
  16101. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  16102. float4 val;
  16103. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  16104. write_imagef(dst, loc, val);
  16105. }
  16106. @end verbatim
  16107. @item
  16108. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  16109. @verbatim
  16110. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  16111. unsigned int index)
  16112. {
  16113. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  16114. float4 value = 0.0f;
  16115. int x = loc.x + index;
  16116. int y = loc.y + index;
  16117. while (x > 0 || y > 0) {
  16118. if (x % 3 == 1 && y % 3 == 1) {
  16119. value = 1.0f;
  16120. break;
  16121. }
  16122. x /= 3;
  16123. y /= 3;
  16124. }
  16125. write_imagef(dst, loc, value);
  16126. }
  16127. @end verbatim
  16128. @end itemize
  16129. @section sierpinski
  16130. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  16131. This source accepts the following options:
  16132. @table @option
  16133. @item size, s
  16134. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  16135. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  16136. @item rate, r
  16137. Set frame rate, expressed as number of frames per second. Default
  16138. value is "25".
  16139. @item seed
  16140. Set seed which is used for random panning.
  16141. @item jump
  16142. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  16143. @item type
  16144. Set fractal type, can be default @code{carpet} or @code{triangle}.
  16145. @end table
  16146. @c man end VIDEO SOURCES
  16147. @chapter Video Sinks
  16148. @c man begin VIDEO SINKS
  16149. Below is a description of the currently available video sinks.
  16150. @section buffersink
  16151. Buffer video frames, and make them available to the end of the filter
  16152. graph.
  16153. This sink is mainly intended for programmatic use, in particular
  16154. through the interface defined in @file{libavfilter/buffersink.h}
  16155. or the options system.
  16156. It accepts a pointer to an AVBufferSinkContext structure, which
  16157. defines the incoming buffers' formats, to be passed as the opaque
  16158. parameter to @code{avfilter_init_filter} for initialization.
  16159. @section nullsink
  16160. Null video sink: do absolutely nothing with the input video. It is
  16161. mainly useful as a template and for use in analysis / debugging
  16162. tools.
  16163. @c man end VIDEO SINKS
  16164. @chapter Multimedia Filters
  16165. @c man begin MULTIMEDIA FILTERS
  16166. Below is a description of the currently available multimedia filters.
  16167. @section abitscope
  16168. Convert input audio to a video output, displaying the audio bit scope.
  16169. The filter accepts the following options:
  16170. @table @option
  16171. @item rate, r
  16172. Set frame rate, expressed as number of frames per second. Default
  16173. value is "25".
  16174. @item size, s
  16175. Specify the video size for the output. For the syntax of this option, check the
  16176. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16177. Default value is @code{1024x256}.
  16178. @item colors
  16179. Specify list of colors separated by space or by '|' which will be used to
  16180. draw channels. Unrecognized or missing colors will be replaced
  16181. by white color.
  16182. @end table
  16183. @section ahistogram
  16184. Convert input audio to a video output, displaying the volume histogram.
  16185. The filter accepts the following options:
  16186. @table @option
  16187. @item dmode
  16188. Specify how histogram is calculated.
  16189. It accepts the following values:
  16190. @table @samp
  16191. @item single
  16192. Use single histogram for all channels.
  16193. @item separate
  16194. Use separate histogram for each channel.
  16195. @end table
  16196. Default is @code{single}.
  16197. @item rate, r
  16198. Set frame rate, expressed as number of frames per second. Default
  16199. value is "25".
  16200. @item size, s
  16201. Specify the video size for the output. For the syntax of this option, check the
  16202. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16203. Default value is @code{hd720}.
  16204. @item scale
  16205. Set display scale.
  16206. It accepts the following values:
  16207. @table @samp
  16208. @item log
  16209. logarithmic
  16210. @item sqrt
  16211. square root
  16212. @item cbrt
  16213. cubic root
  16214. @item lin
  16215. linear
  16216. @item rlog
  16217. reverse logarithmic
  16218. @end table
  16219. Default is @code{log}.
  16220. @item ascale
  16221. Set amplitude scale.
  16222. It accepts the following values:
  16223. @table @samp
  16224. @item log
  16225. logarithmic
  16226. @item lin
  16227. linear
  16228. @end table
  16229. Default is @code{log}.
  16230. @item acount
  16231. Set how much frames to accumulate in histogram.
  16232. Default is 1. Setting this to -1 accumulates all frames.
  16233. @item rheight
  16234. Set histogram ratio of window height.
  16235. @item slide
  16236. Set sonogram sliding.
  16237. It accepts the following values:
  16238. @table @samp
  16239. @item replace
  16240. replace old rows with new ones.
  16241. @item scroll
  16242. scroll from top to bottom.
  16243. @end table
  16244. Default is @code{replace}.
  16245. @end table
  16246. @section aphasemeter
  16247. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  16248. representing mean phase of current audio frame. A video output can also be produced and is
  16249. enabled by default. The audio is passed through as first output.
  16250. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  16251. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  16252. and @code{1} means channels are in phase.
  16253. The filter accepts the following options, all related to its video output:
  16254. @table @option
  16255. @item rate, r
  16256. Set the output frame rate. Default value is @code{25}.
  16257. @item size, s
  16258. Set the video size for the output. For the syntax of this option, check the
  16259. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16260. Default value is @code{800x400}.
  16261. @item rc
  16262. @item gc
  16263. @item bc
  16264. Specify the red, green, blue contrast. Default values are @code{2},
  16265. @code{7} and @code{1}.
  16266. Allowed range is @code{[0, 255]}.
  16267. @item mpc
  16268. Set color which will be used for drawing median phase. If color is
  16269. @code{none} which is default, no median phase value will be drawn.
  16270. @item video
  16271. Enable video output. Default is enabled.
  16272. @end table
  16273. @section avectorscope
  16274. Convert input audio to a video output, representing the audio vector
  16275. scope.
  16276. The filter is used to measure the difference between channels of stereo
  16277. audio stream. A monaural signal, consisting of identical left and right
  16278. signal, results in straight vertical line. Any stereo separation is visible
  16279. as a deviation from this line, creating a Lissajous figure.
  16280. If the straight (or deviation from it) but horizontal line appears this
  16281. indicates that the left and right channels are out of phase.
  16282. The filter accepts the following options:
  16283. @table @option
  16284. @item mode, m
  16285. Set the vectorscope mode.
  16286. Available values are:
  16287. @table @samp
  16288. @item lissajous
  16289. Lissajous rotated by 45 degrees.
  16290. @item lissajous_xy
  16291. Same as above but not rotated.
  16292. @item polar
  16293. Shape resembling half of circle.
  16294. @end table
  16295. Default value is @samp{lissajous}.
  16296. @item size, s
  16297. Set the video size for the output. For the syntax of this option, check the
  16298. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16299. Default value is @code{400x400}.
  16300. @item rate, r
  16301. Set the output frame rate. Default value is @code{25}.
  16302. @item rc
  16303. @item gc
  16304. @item bc
  16305. @item ac
  16306. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  16307. @code{160}, @code{80} and @code{255}.
  16308. Allowed range is @code{[0, 255]}.
  16309. @item rf
  16310. @item gf
  16311. @item bf
  16312. @item af
  16313. Specify the red, green, blue and alpha fade. Default values are @code{15},
  16314. @code{10}, @code{5} and @code{5}.
  16315. Allowed range is @code{[0, 255]}.
  16316. @item zoom
  16317. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  16318. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  16319. @item draw
  16320. Set the vectorscope drawing mode.
  16321. Available values are:
  16322. @table @samp
  16323. @item dot
  16324. Draw dot for each sample.
  16325. @item line
  16326. Draw line between previous and current sample.
  16327. @end table
  16328. Default value is @samp{dot}.
  16329. @item scale
  16330. Specify amplitude scale of audio samples.
  16331. Available values are:
  16332. @table @samp
  16333. @item lin
  16334. Linear.
  16335. @item sqrt
  16336. Square root.
  16337. @item cbrt
  16338. Cubic root.
  16339. @item log
  16340. Logarithmic.
  16341. @end table
  16342. @item swap
  16343. Swap left channel axis with right channel axis.
  16344. @item mirror
  16345. Mirror axis.
  16346. @table @samp
  16347. @item none
  16348. No mirror.
  16349. @item x
  16350. Mirror only x axis.
  16351. @item y
  16352. Mirror only y axis.
  16353. @item xy
  16354. Mirror both axis.
  16355. @end table
  16356. @end table
  16357. @subsection Examples
  16358. @itemize
  16359. @item
  16360. Complete example using @command{ffplay}:
  16361. @example
  16362. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  16363. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  16364. @end example
  16365. @end itemize
  16366. @section bench, abench
  16367. Benchmark part of a filtergraph.
  16368. The filter accepts the following options:
  16369. @table @option
  16370. @item action
  16371. Start or stop a timer.
  16372. Available values are:
  16373. @table @samp
  16374. @item start
  16375. Get the current time, set it as frame metadata (using the key
  16376. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  16377. @item stop
  16378. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  16379. the input frame metadata to get the time difference. Time difference, average,
  16380. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  16381. @code{min}) are then printed. The timestamps are expressed in seconds.
  16382. @end table
  16383. @end table
  16384. @subsection Examples
  16385. @itemize
  16386. @item
  16387. Benchmark @ref{selectivecolor} filter:
  16388. @example
  16389. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  16390. @end example
  16391. @end itemize
  16392. @section concat
  16393. Concatenate audio and video streams, joining them together one after the
  16394. other.
  16395. The filter works on segments of synchronized video and audio streams. All
  16396. segments must have the same number of streams of each type, and that will
  16397. also be the number of streams at output.
  16398. The filter accepts the following options:
  16399. @table @option
  16400. @item n
  16401. Set the number of segments. Default is 2.
  16402. @item v
  16403. Set the number of output video streams, that is also the number of video
  16404. streams in each segment. Default is 1.
  16405. @item a
  16406. Set the number of output audio streams, that is also the number of audio
  16407. streams in each segment. Default is 0.
  16408. @item unsafe
  16409. Activate unsafe mode: do not fail if segments have a different format.
  16410. @end table
  16411. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  16412. @var{a} audio outputs.
  16413. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  16414. segment, in the same order as the outputs, then the inputs for the second
  16415. segment, etc.
  16416. Related streams do not always have exactly the same duration, for various
  16417. reasons including codec frame size or sloppy authoring. For that reason,
  16418. related synchronized streams (e.g. a video and its audio track) should be
  16419. concatenated at once. The concat filter will use the duration of the longest
  16420. stream in each segment (except the last one), and if necessary pad shorter
  16421. audio streams with silence.
  16422. For this filter to work correctly, all segments must start at timestamp 0.
  16423. All corresponding streams must have the same parameters in all segments; the
  16424. filtering system will automatically select a common pixel format for video
  16425. streams, and a common sample format, sample rate and channel layout for
  16426. audio streams, but other settings, such as resolution, must be converted
  16427. explicitly by the user.
  16428. Different frame rates are acceptable but will result in variable frame rate
  16429. at output; be sure to configure the output file to handle it.
  16430. @subsection Examples
  16431. @itemize
  16432. @item
  16433. Concatenate an opening, an episode and an ending, all in bilingual version
  16434. (video in stream 0, audio in streams 1 and 2):
  16435. @example
  16436. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  16437. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  16438. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  16439. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  16440. @end example
  16441. @item
  16442. Concatenate two parts, handling audio and video separately, using the
  16443. (a)movie sources, and adjusting the resolution:
  16444. @example
  16445. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  16446. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  16447. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  16448. @end example
  16449. Note that a desync will happen at the stitch if the audio and video streams
  16450. do not have exactly the same duration in the first file.
  16451. @end itemize
  16452. @subsection Commands
  16453. This filter supports the following commands:
  16454. @table @option
  16455. @item next
  16456. Close the current segment and step to the next one
  16457. @end table
  16458. @section drawgraph, adrawgraph
  16459. Draw a graph using input video or audio metadata.
  16460. It accepts the following parameters:
  16461. @table @option
  16462. @item m1
  16463. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  16464. @item fg1
  16465. Set 1st foreground color expression.
  16466. @item m2
  16467. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  16468. @item fg2
  16469. Set 2nd foreground color expression.
  16470. @item m3
  16471. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  16472. @item fg3
  16473. Set 3rd foreground color expression.
  16474. @item m4
  16475. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  16476. @item fg4
  16477. Set 4th foreground color expression.
  16478. @item min
  16479. Set minimal value of metadata value.
  16480. @item max
  16481. Set maximal value of metadata value.
  16482. @item bg
  16483. Set graph background color. Default is white.
  16484. @item mode
  16485. Set graph mode.
  16486. Available values for mode is:
  16487. @table @samp
  16488. @item bar
  16489. @item dot
  16490. @item line
  16491. @end table
  16492. Default is @code{line}.
  16493. @item slide
  16494. Set slide mode.
  16495. Available values for slide is:
  16496. @table @samp
  16497. @item frame
  16498. Draw new frame when right border is reached.
  16499. @item replace
  16500. Replace old columns with new ones.
  16501. @item scroll
  16502. Scroll from right to left.
  16503. @item rscroll
  16504. Scroll from left to right.
  16505. @item picture
  16506. Draw single picture.
  16507. @end table
  16508. Default is @code{frame}.
  16509. @item size
  16510. Set size of graph video. For the syntax of this option, check the
  16511. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16512. The default value is @code{900x256}.
  16513. The foreground color expressions can use the following variables:
  16514. @table @option
  16515. @item MIN
  16516. Minimal value of metadata value.
  16517. @item MAX
  16518. Maximal value of metadata value.
  16519. @item VAL
  16520. Current metadata key value.
  16521. @end table
  16522. The color is defined as 0xAABBGGRR.
  16523. @end table
  16524. Example using metadata from @ref{signalstats} filter:
  16525. @example
  16526. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  16527. @end example
  16528. Example using metadata from @ref{ebur128} filter:
  16529. @example
  16530. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  16531. @end example
  16532. @anchor{ebur128}
  16533. @section ebur128
  16534. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  16535. level. By default, it logs a message at a frequency of 10Hz with the
  16536. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  16537. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  16538. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  16539. sample format is double-precision floating point. The input stream will be converted to
  16540. this specification, if needed. Users may need to insert aformat and/or aresample filters
  16541. after this filter to obtain the original parameters.
  16542. The filter also has a video output (see the @var{video} option) with a real
  16543. time graph to observe the loudness evolution. The graphic contains the logged
  16544. message mentioned above, so it is not printed anymore when this option is set,
  16545. unless the verbose logging is set. The main graphing area contains the
  16546. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  16547. the momentary loudness (400 milliseconds), but can optionally be configured
  16548. to instead display short-term loudness (see @var{gauge}).
  16549. The green area marks a +/- 1LU target range around the target loudness
  16550. (-23LUFS by default, unless modified through @var{target}).
  16551. More information about the Loudness Recommendation EBU R128 on
  16552. @url{http://tech.ebu.ch/loudness}.
  16553. The filter accepts the following options:
  16554. @table @option
  16555. @item video
  16556. Activate the video output. The audio stream is passed unchanged whether this
  16557. option is set or no. The video stream will be the first output stream if
  16558. activated. Default is @code{0}.
  16559. @item size
  16560. Set the video size. This option is for video only. For the syntax of this
  16561. option, check the
  16562. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16563. Default and minimum resolution is @code{640x480}.
  16564. @item meter
  16565. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  16566. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  16567. other integer value between this range is allowed.
  16568. @item metadata
  16569. Set metadata injection. If set to @code{1}, the audio input will be segmented
  16570. into 100ms output frames, each of them containing various loudness information
  16571. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  16572. Default is @code{0}.
  16573. @item framelog
  16574. Force the frame logging level.
  16575. Available values are:
  16576. @table @samp
  16577. @item info
  16578. information logging level
  16579. @item verbose
  16580. verbose logging level
  16581. @end table
  16582. By default, the logging level is set to @var{info}. If the @option{video} or
  16583. the @option{metadata} options are set, it switches to @var{verbose}.
  16584. @item peak
  16585. Set peak mode(s).
  16586. Available modes can be cumulated (the option is a @code{flag} type). Possible
  16587. values are:
  16588. @table @samp
  16589. @item none
  16590. Disable any peak mode (default).
  16591. @item sample
  16592. Enable sample-peak mode.
  16593. Simple peak mode looking for the higher sample value. It logs a message
  16594. for sample-peak (identified by @code{SPK}).
  16595. @item true
  16596. Enable true-peak mode.
  16597. If enabled, the peak lookup is done on an over-sampled version of the input
  16598. stream for better peak accuracy. It logs a message for true-peak.
  16599. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  16600. This mode requires a build with @code{libswresample}.
  16601. @end table
  16602. @item dualmono
  16603. Treat mono input files as "dual mono". If a mono file is intended for playback
  16604. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  16605. If set to @code{true}, this option will compensate for this effect.
  16606. Multi-channel input files are not affected by this option.
  16607. @item panlaw
  16608. Set a specific pan law to be used for the measurement of dual mono files.
  16609. This parameter is optional, and has a default value of -3.01dB.
  16610. @item target
  16611. Set a specific target level (in LUFS) used as relative zero in the visualization.
  16612. This parameter is optional and has a default value of -23LUFS as specified
  16613. by EBU R128. However, material published online may prefer a level of -16LUFS
  16614. (e.g. for use with podcasts or video platforms).
  16615. @item gauge
  16616. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  16617. @code{shortterm}. By default the momentary value will be used, but in certain
  16618. scenarios it may be more useful to observe the short term value instead (e.g.
  16619. live mixing).
  16620. @item scale
  16621. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  16622. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  16623. video output, not the summary or continuous log output.
  16624. @end table
  16625. @subsection Examples
  16626. @itemize
  16627. @item
  16628. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  16629. @example
  16630. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  16631. @end example
  16632. @item
  16633. Run an analysis with @command{ffmpeg}:
  16634. @example
  16635. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  16636. @end example
  16637. @end itemize
  16638. @section interleave, ainterleave
  16639. Temporally interleave frames from several inputs.
  16640. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  16641. These filters read frames from several inputs and send the oldest
  16642. queued frame to the output.
  16643. Input streams must have well defined, monotonically increasing frame
  16644. timestamp values.
  16645. In order to submit one frame to output, these filters need to enqueue
  16646. at least one frame for each input, so they cannot work in case one
  16647. input is not yet terminated and will not receive incoming frames.
  16648. For example consider the case when one input is a @code{select} filter
  16649. which always drops input frames. The @code{interleave} filter will keep
  16650. reading from that input, but it will never be able to send new frames
  16651. to output until the input sends an end-of-stream signal.
  16652. Also, depending on inputs synchronization, the filters will drop
  16653. frames in case one input receives more frames than the other ones, and
  16654. the queue is already filled.
  16655. These filters accept the following options:
  16656. @table @option
  16657. @item nb_inputs, n
  16658. Set the number of different inputs, it is 2 by default.
  16659. @end table
  16660. @subsection Examples
  16661. @itemize
  16662. @item
  16663. Interleave frames belonging to different streams using @command{ffmpeg}:
  16664. @example
  16665. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  16666. @end example
  16667. @item
  16668. Add flickering blur effect:
  16669. @example
  16670. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  16671. @end example
  16672. @end itemize
  16673. @section metadata, ametadata
  16674. Manipulate frame metadata.
  16675. This filter accepts the following options:
  16676. @table @option
  16677. @item mode
  16678. Set mode of operation of the filter.
  16679. Can be one of the following:
  16680. @table @samp
  16681. @item select
  16682. If both @code{value} and @code{key} is set, select frames
  16683. which have such metadata. If only @code{key} is set, select
  16684. every frame that has such key in metadata.
  16685. @item add
  16686. Add new metadata @code{key} and @code{value}. If key is already available
  16687. do nothing.
  16688. @item modify
  16689. Modify value of already present key.
  16690. @item delete
  16691. If @code{value} is set, delete only keys that have such value.
  16692. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  16693. the frame.
  16694. @item print
  16695. Print key and its value if metadata was found. If @code{key} is not set print all
  16696. metadata values available in frame.
  16697. @end table
  16698. @item key
  16699. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  16700. @item value
  16701. Set metadata value which will be used. This option is mandatory for
  16702. @code{modify} and @code{add} mode.
  16703. @item function
  16704. Which function to use when comparing metadata value and @code{value}.
  16705. Can be one of following:
  16706. @table @samp
  16707. @item same_str
  16708. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  16709. @item starts_with
  16710. Values are interpreted as strings, returns true if metadata value starts with
  16711. the @code{value} option string.
  16712. @item less
  16713. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  16714. @item equal
  16715. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  16716. @item greater
  16717. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  16718. @item expr
  16719. Values are interpreted as floats, returns true if expression from option @code{expr}
  16720. evaluates to true.
  16721. @item ends_with
  16722. Values are interpreted as strings, returns true if metadata value ends with
  16723. the @code{value} option string.
  16724. @end table
  16725. @item expr
  16726. Set expression which is used when @code{function} is set to @code{expr}.
  16727. The expression is evaluated through the eval API and can contain the following
  16728. constants:
  16729. @table @option
  16730. @item VALUE1
  16731. Float representation of @code{value} from metadata key.
  16732. @item VALUE2
  16733. Float representation of @code{value} as supplied by user in @code{value} option.
  16734. @end table
  16735. @item file
  16736. If specified in @code{print} mode, output is written to the named file. Instead of
  16737. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  16738. for standard output. If @code{file} option is not set, output is written to the log
  16739. with AV_LOG_INFO loglevel.
  16740. @end table
  16741. @subsection Examples
  16742. @itemize
  16743. @item
  16744. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  16745. between 0 and 1.
  16746. @example
  16747. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  16748. @end example
  16749. @item
  16750. Print silencedetect output to file @file{metadata.txt}.
  16751. @example
  16752. silencedetect,ametadata=mode=print:file=metadata.txt
  16753. @end example
  16754. @item
  16755. Direct all metadata to a pipe with file descriptor 4.
  16756. @example
  16757. metadata=mode=print:file='pipe\:4'
  16758. @end example
  16759. @end itemize
  16760. @section perms, aperms
  16761. Set read/write permissions for the output frames.
  16762. These filters are mainly aimed at developers to test direct path in the
  16763. following filter in the filtergraph.
  16764. The filters accept the following options:
  16765. @table @option
  16766. @item mode
  16767. Select the permissions mode.
  16768. It accepts the following values:
  16769. @table @samp
  16770. @item none
  16771. Do nothing. This is the default.
  16772. @item ro
  16773. Set all the output frames read-only.
  16774. @item rw
  16775. Set all the output frames directly writable.
  16776. @item toggle
  16777. Make the frame read-only if writable, and writable if read-only.
  16778. @item random
  16779. Set each output frame read-only or writable randomly.
  16780. @end table
  16781. @item seed
  16782. Set the seed for the @var{random} mode, must be an integer included between
  16783. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  16784. @code{-1}, the filter will try to use a good random seed on a best effort
  16785. basis.
  16786. @end table
  16787. Note: in case of auto-inserted filter between the permission filter and the
  16788. following one, the permission might not be received as expected in that
  16789. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  16790. perms/aperms filter can avoid this problem.
  16791. @section realtime, arealtime
  16792. Slow down filtering to match real time approximately.
  16793. These filters will pause the filtering for a variable amount of time to
  16794. match the output rate with the input timestamps.
  16795. They are similar to the @option{re} option to @code{ffmpeg}.
  16796. They accept the following options:
  16797. @table @option
  16798. @item limit
  16799. Time limit for the pauses. Any pause longer than that will be considered
  16800. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  16801. @item speed
  16802. Speed factor for processing. The value must be a float larger than zero.
  16803. Values larger than 1.0 will result in faster than realtime processing,
  16804. smaller will slow processing down. The @var{limit} is automatically adapted
  16805. accordingly. Default is 1.0.
  16806. A processing speed faster than what is possible without these filters cannot
  16807. be achieved.
  16808. @end table
  16809. @anchor{select}
  16810. @section select, aselect
  16811. Select frames to pass in output.
  16812. This filter accepts the following options:
  16813. @table @option
  16814. @item expr, e
  16815. Set expression, which is evaluated for each input frame.
  16816. If the expression is evaluated to zero, the frame is discarded.
  16817. If the evaluation result is negative or NaN, the frame is sent to the
  16818. first output; otherwise it is sent to the output with index
  16819. @code{ceil(val)-1}, assuming that the input index starts from 0.
  16820. For example a value of @code{1.2} corresponds to the output with index
  16821. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  16822. @item outputs, n
  16823. Set the number of outputs. The output to which to send the selected
  16824. frame is based on the result of the evaluation. Default value is 1.
  16825. @end table
  16826. The expression can contain the following constants:
  16827. @table @option
  16828. @item n
  16829. The (sequential) number of the filtered frame, starting from 0.
  16830. @item selected_n
  16831. The (sequential) number of the selected frame, starting from 0.
  16832. @item prev_selected_n
  16833. The sequential number of the last selected frame. It's NAN if undefined.
  16834. @item TB
  16835. The timebase of the input timestamps.
  16836. @item pts
  16837. The PTS (Presentation TimeStamp) of the filtered video frame,
  16838. expressed in @var{TB} units. It's NAN if undefined.
  16839. @item t
  16840. The PTS of the filtered video frame,
  16841. expressed in seconds. It's NAN if undefined.
  16842. @item prev_pts
  16843. The PTS of the previously filtered video frame. It's NAN if undefined.
  16844. @item prev_selected_pts
  16845. The PTS of the last previously filtered video frame. It's NAN if undefined.
  16846. @item prev_selected_t
  16847. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  16848. @item start_pts
  16849. The PTS of the first video frame in the video. It's NAN if undefined.
  16850. @item start_t
  16851. The time of the first video frame in the video. It's NAN if undefined.
  16852. @item pict_type @emph{(video only)}
  16853. The type of the filtered frame. It can assume one of the following
  16854. values:
  16855. @table @option
  16856. @item I
  16857. @item P
  16858. @item B
  16859. @item S
  16860. @item SI
  16861. @item SP
  16862. @item BI
  16863. @end table
  16864. @item interlace_type @emph{(video only)}
  16865. The frame interlace type. It can assume one of the following values:
  16866. @table @option
  16867. @item PROGRESSIVE
  16868. The frame is progressive (not interlaced).
  16869. @item TOPFIRST
  16870. The frame is top-field-first.
  16871. @item BOTTOMFIRST
  16872. The frame is bottom-field-first.
  16873. @end table
  16874. @item consumed_sample_n @emph{(audio only)}
  16875. the number of selected samples before the current frame
  16876. @item samples_n @emph{(audio only)}
  16877. the number of samples in the current frame
  16878. @item sample_rate @emph{(audio only)}
  16879. the input sample rate
  16880. @item key
  16881. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  16882. @item pos
  16883. the position in the file of the filtered frame, -1 if the information
  16884. is not available (e.g. for synthetic video)
  16885. @item scene @emph{(video only)}
  16886. value between 0 and 1 to indicate a new scene; a low value reflects a low
  16887. probability for the current frame to introduce a new scene, while a higher
  16888. value means the current frame is more likely to be one (see the example below)
  16889. @item concatdec_select
  16890. The concat demuxer can select only part of a concat input file by setting an
  16891. inpoint and an outpoint, but the output packets may not be entirely contained
  16892. in the selected interval. By using this variable, it is possible to skip frames
  16893. generated by the concat demuxer which are not exactly contained in the selected
  16894. interval.
  16895. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  16896. and the @var{lavf.concat.duration} packet metadata values which are also
  16897. present in the decoded frames.
  16898. The @var{concatdec_select} variable is -1 if the frame pts is at least
  16899. start_time and either the duration metadata is missing or the frame pts is less
  16900. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  16901. missing.
  16902. That basically means that an input frame is selected if its pts is within the
  16903. interval set by the concat demuxer.
  16904. @end table
  16905. The default value of the select expression is "1".
  16906. @subsection Examples
  16907. @itemize
  16908. @item
  16909. Select all frames in input:
  16910. @example
  16911. select
  16912. @end example
  16913. The example above is the same as:
  16914. @example
  16915. select=1
  16916. @end example
  16917. @item
  16918. Skip all frames:
  16919. @example
  16920. select=0
  16921. @end example
  16922. @item
  16923. Select only I-frames:
  16924. @example
  16925. select='eq(pict_type\,I)'
  16926. @end example
  16927. @item
  16928. Select one frame every 100:
  16929. @example
  16930. select='not(mod(n\,100))'
  16931. @end example
  16932. @item
  16933. Select only frames contained in the 10-20 time interval:
  16934. @example
  16935. select=between(t\,10\,20)
  16936. @end example
  16937. @item
  16938. Select only I-frames contained in the 10-20 time interval:
  16939. @example
  16940. select=between(t\,10\,20)*eq(pict_type\,I)
  16941. @end example
  16942. @item
  16943. Select frames with a minimum distance of 10 seconds:
  16944. @example
  16945. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  16946. @end example
  16947. @item
  16948. Use aselect to select only audio frames with samples number > 100:
  16949. @example
  16950. aselect='gt(samples_n\,100)'
  16951. @end example
  16952. @item
  16953. Create a mosaic of the first scenes:
  16954. @example
  16955. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  16956. @end example
  16957. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  16958. choice.
  16959. @item
  16960. Send even and odd frames to separate outputs, and compose them:
  16961. @example
  16962. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  16963. @end example
  16964. @item
  16965. Select useful frames from an ffconcat file which is using inpoints and
  16966. outpoints but where the source files are not intra frame only.
  16967. @example
  16968. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  16969. @end example
  16970. @end itemize
  16971. @section sendcmd, asendcmd
  16972. Send commands to filters in the filtergraph.
  16973. These filters read commands to be sent to other filters in the
  16974. filtergraph.
  16975. @code{sendcmd} must be inserted between two video filters,
  16976. @code{asendcmd} must be inserted between two audio filters, but apart
  16977. from that they act the same way.
  16978. The specification of commands can be provided in the filter arguments
  16979. with the @var{commands} option, or in a file specified by the
  16980. @var{filename} option.
  16981. These filters accept the following options:
  16982. @table @option
  16983. @item commands, c
  16984. Set the commands to be read and sent to the other filters.
  16985. @item filename, f
  16986. Set the filename of the commands to be read and sent to the other
  16987. filters.
  16988. @end table
  16989. @subsection Commands syntax
  16990. A commands description consists of a sequence of interval
  16991. specifications, comprising a list of commands to be executed when a
  16992. particular event related to that interval occurs. The occurring event
  16993. is typically the current frame time entering or leaving a given time
  16994. interval.
  16995. An interval is specified by the following syntax:
  16996. @example
  16997. @var{START}[-@var{END}] @var{COMMANDS};
  16998. @end example
  16999. The time interval is specified by the @var{START} and @var{END} times.
  17000. @var{END} is optional and defaults to the maximum time.
  17001. The current frame time is considered within the specified interval if
  17002. it is included in the interval [@var{START}, @var{END}), that is when
  17003. the time is greater or equal to @var{START} and is lesser than
  17004. @var{END}.
  17005. @var{COMMANDS} consists of a sequence of one or more command
  17006. specifications, separated by ",", relating to that interval. The
  17007. syntax of a command specification is given by:
  17008. @example
  17009. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  17010. @end example
  17011. @var{FLAGS} is optional and specifies the type of events relating to
  17012. the time interval which enable sending the specified command, and must
  17013. be a non-null sequence of identifier flags separated by "+" or "|" and
  17014. enclosed between "[" and "]".
  17015. The following flags are recognized:
  17016. @table @option
  17017. @item enter
  17018. The command is sent when the current frame timestamp enters the
  17019. specified interval. In other words, the command is sent when the
  17020. previous frame timestamp was not in the given interval, and the
  17021. current is.
  17022. @item leave
  17023. The command is sent when the current frame timestamp leaves the
  17024. specified interval. In other words, the command is sent when the
  17025. previous frame timestamp was in the given interval, and the
  17026. current is not.
  17027. @end table
  17028. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  17029. assumed.
  17030. @var{TARGET} specifies the target of the command, usually the name of
  17031. the filter class or a specific filter instance name.
  17032. @var{COMMAND} specifies the name of the command for the target filter.
  17033. @var{ARG} is optional and specifies the optional list of argument for
  17034. the given @var{COMMAND}.
  17035. Between one interval specification and another, whitespaces, or
  17036. sequences of characters starting with @code{#} until the end of line,
  17037. are ignored and can be used to annotate comments.
  17038. A simplified BNF description of the commands specification syntax
  17039. follows:
  17040. @example
  17041. @var{COMMAND_FLAG} ::= "enter" | "leave"
  17042. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  17043. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  17044. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  17045. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  17046. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  17047. @end example
  17048. @subsection Examples
  17049. @itemize
  17050. @item
  17051. Specify audio tempo change at second 4:
  17052. @example
  17053. asendcmd=c='4.0 atempo tempo 1.5',atempo
  17054. @end example
  17055. @item
  17056. Target a specific filter instance:
  17057. @example
  17058. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  17059. @end example
  17060. @item
  17061. Specify a list of drawtext and hue commands in a file.
  17062. @example
  17063. # show text in the interval 5-10
  17064. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  17065. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  17066. # desaturate the image in the interval 15-20
  17067. 15.0-20.0 [enter] hue s 0,
  17068. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  17069. [leave] hue s 1,
  17070. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  17071. # apply an exponential saturation fade-out effect, starting from time 25
  17072. 25 [enter] hue s exp(25-t)
  17073. @end example
  17074. A filtergraph allowing to read and process the above command list
  17075. stored in a file @file{test.cmd}, can be specified with:
  17076. @example
  17077. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  17078. @end example
  17079. @end itemize
  17080. @anchor{setpts}
  17081. @section setpts, asetpts
  17082. Change the PTS (presentation timestamp) of the input frames.
  17083. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  17084. This filter accepts the following options:
  17085. @table @option
  17086. @item expr
  17087. The expression which is evaluated for each frame to construct its timestamp.
  17088. @end table
  17089. The expression is evaluated through the eval API and can contain the following
  17090. constants:
  17091. @table @option
  17092. @item FRAME_RATE, FR
  17093. frame rate, only defined for constant frame-rate video
  17094. @item PTS
  17095. The presentation timestamp in input
  17096. @item N
  17097. The count of the input frame for video or the number of consumed samples,
  17098. not including the current frame for audio, starting from 0.
  17099. @item NB_CONSUMED_SAMPLES
  17100. The number of consumed samples, not including the current frame (only
  17101. audio)
  17102. @item NB_SAMPLES, S
  17103. The number of samples in the current frame (only audio)
  17104. @item SAMPLE_RATE, SR
  17105. The audio sample rate.
  17106. @item STARTPTS
  17107. The PTS of the first frame.
  17108. @item STARTT
  17109. the time in seconds of the first frame
  17110. @item INTERLACED
  17111. State whether the current frame is interlaced.
  17112. @item T
  17113. the time in seconds of the current frame
  17114. @item POS
  17115. original position in the file of the frame, or undefined if undefined
  17116. for the current frame
  17117. @item PREV_INPTS
  17118. The previous input PTS.
  17119. @item PREV_INT
  17120. previous input time in seconds
  17121. @item PREV_OUTPTS
  17122. The previous output PTS.
  17123. @item PREV_OUTT
  17124. previous output time in seconds
  17125. @item RTCTIME
  17126. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  17127. instead.
  17128. @item RTCSTART
  17129. The wallclock (RTC) time at the start of the movie in microseconds.
  17130. @item TB
  17131. The timebase of the input timestamps.
  17132. @end table
  17133. @subsection Examples
  17134. @itemize
  17135. @item
  17136. Start counting PTS from zero
  17137. @example
  17138. setpts=PTS-STARTPTS
  17139. @end example
  17140. @item
  17141. Apply fast motion effect:
  17142. @example
  17143. setpts=0.5*PTS
  17144. @end example
  17145. @item
  17146. Apply slow motion effect:
  17147. @example
  17148. setpts=2.0*PTS
  17149. @end example
  17150. @item
  17151. Set fixed rate of 25 frames per second:
  17152. @example
  17153. setpts=N/(25*TB)
  17154. @end example
  17155. @item
  17156. Set fixed rate 25 fps with some jitter:
  17157. @example
  17158. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  17159. @end example
  17160. @item
  17161. Apply an offset of 10 seconds to the input PTS:
  17162. @example
  17163. setpts=PTS+10/TB
  17164. @end example
  17165. @item
  17166. Generate timestamps from a "live source" and rebase onto the current timebase:
  17167. @example
  17168. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  17169. @end example
  17170. @item
  17171. Generate timestamps by counting samples:
  17172. @example
  17173. asetpts=N/SR/TB
  17174. @end example
  17175. @end itemize
  17176. @section setrange
  17177. Force color range for the output video frame.
  17178. The @code{setrange} filter marks the color range property for the
  17179. output frames. It does not change the input frame, but only sets the
  17180. corresponding property, which affects how the frame is treated by
  17181. following filters.
  17182. The filter accepts the following options:
  17183. @table @option
  17184. @item range
  17185. Available values are:
  17186. @table @samp
  17187. @item auto
  17188. Keep the same color range property.
  17189. @item unspecified, unknown
  17190. Set the color range as unspecified.
  17191. @item limited, tv, mpeg
  17192. Set the color range as limited.
  17193. @item full, pc, jpeg
  17194. Set the color range as full.
  17195. @end table
  17196. @end table
  17197. @section settb, asettb
  17198. Set the timebase to use for the output frames timestamps.
  17199. It is mainly useful for testing timebase configuration.
  17200. It accepts the following parameters:
  17201. @table @option
  17202. @item expr, tb
  17203. The expression which is evaluated into the output timebase.
  17204. @end table
  17205. The value for @option{tb} is an arithmetic expression representing a
  17206. rational. The expression can contain the constants "AVTB" (the default
  17207. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  17208. audio only). Default value is "intb".
  17209. @subsection Examples
  17210. @itemize
  17211. @item
  17212. Set the timebase to 1/25:
  17213. @example
  17214. settb=expr=1/25
  17215. @end example
  17216. @item
  17217. Set the timebase to 1/10:
  17218. @example
  17219. settb=expr=0.1
  17220. @end example
  17221. @item
  17222. Set the timebase to 1001/1000:
  17223. @example
  17224. settb=1+0.001
  17225. @end example
  17226. @item
  17227. Set the timebase to 2*intb:
  17228. @example
  17229. settb=2*intb
  17230. @end example
  17231. @item
  17232. Set the default timebase value:
  17233. @example
  17234. settb=AVTB
  17235. @end example
  17236. @end itemize
  17237. @section showcqt
  17238. Convert input audio to a video output representing frequency spectrum
  17239. logarithmically using Brown-Puckette constant Q transform algorithm with
  17240. direct frequency domain coefficient calculation (but the transform itself
  17241. is not really constant Q, instead the Q factor is actually variable/clamped),
  17242. with musical tone scale, from E0 to D#10.
  17243. The filter accepts the following options:
  17244. @table @option
  17245. @item size, s
  17246. Specify the video size for the output. It must be even. For the syntax of this option,
  17247. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17248. Default value is @code{1920x1080}.
  17249. @item fps, rate, r
  17250. Set the output frame rate. Default value is @code{25}.
  17251. @item bar_h
  17252. Set the bargraph height. It must be even. Default value is @code{-1} which
  17253. computes the bargraph height automatically.
  17254. @item axis_h
  17255. Set the axis height. It must be even. Default value is @code{-1} which computes
  17256. the axis height automatically.
  17257. @item sono_h
  17258. Set the sonogram height. It must be even. Default value is @code{-1} which
  17259. computes the sonogram height automatically.
  17260. @item fullhd
  17261. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  17262. instead. Default value is @code{1}.
  17263. @item sono_v, volume
  17264. Specify the sonogram volume expression. It can contain variables:
  17265. @table @option
  17266. @item bar_v
  17267. the @var{bar_v} evaluated expression
  17268. @item frequency, freq, f
  17269. the frequency where it is evaluated
  17270. @item timeclamp, tc
  17271. the value of @var{timeclamp} option
  17272. @end table
  17273. and functions:
  17274. @table @option
  17275. @item a_weighting(f)
  17276. A-weighting of equal loudness
  17277. @item b_weighting(f)
  17278. B-weighting of equal loudness
  17279. @item c_weighting(f)
  17280. C-weighting of equal loudness.
  17281. @end table
  17282. Default value is @code{16}.
  17283. @item bar_v, volume2
  17284. Specify the bargraph volume expression. It can contain variables:
  17285. @table @option
  17286. @item sono_v
  17287. the @var{sono_v} evaluated expression
  17288. @item frequency, freq, f
  17289. the frequency where it is evaluated
  17290. @item timeclamp, tc
  17291. the value of @var{timeclamp} option
  17292. @end table
  17293. and functions:
  17294. @table @option
  17295. @item a_weighting(f)
  17296. A-weighting of equal loudness
  17297. @item b_weighting(f)
  17298. B-weighting of equal loudness
  17299. @item c_weighting(f)
  17300. C-weighting of equal loudness.
  17301. @end table
  17302. Default value is @code{sono_v}.
  17303. @item sono_g, gamma
  17304. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  17305. higher gamma makes the spectrum having more range. Default value is @code{3}.
  17306. Acceptable range is @code{[1, 7]}.
  17307. @item bar_g, gamma2
  17308. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  17309. @code{[1, 7]}.
  17310. @item bar_t
  17311. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  17312. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  17313. @item timeclamp, tc
  17314. Specify the transform timeclamp. At low frequency, there is trade-off between
  17315. accuracy in time domain and frequency domain. If timeclamp is lower,
  17316. event in time domain is represented more accurately (such as fast bass drum),
  17317. otherwise event in frequency domain is represented more accurately
  17318. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  17319. @item attack
  17320. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  17321. limits future samples by applying asymmetric windowing in time domain, useful
  17322. when low latency is required. Accepted range is @code{[0, 1]}.
  17323. @item basefreq
  17324. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  17325. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  17326. @item endfreq
  17327. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  17328. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  17329. @item coeffclamp
  17330. This option is deprecated and ignored.
  17331. @item tlength
  17332. Specify the transform length in time domain. Use this option to control accuracy
  17333. trade-off between time domain and frequency domain at every frequency sample.
  17334. It can contain variables:
  17335. @table @option
  17336. @item frequency, freq, f
  17337. the frequency where it is evaluated
  17338. @item timeclamp, tc
  17339. the value of @var{timeclamp} option.
  17340. @end table
  17341. Default value is @code{384*tc/(384+tc*f)}.
  17342. @item count
  17343. Specify the transform count for every video frame. Default value is @code{6}.
  17344. Acceptable range is @code{[1, 30]}.
  17345. @item fcount
  17346. Specify the transform count for every single pixel. Default value is @code{0},
  17347. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  17348. @item fontfile
  17349. Specify font file for use with freetype to draw the axis. If not specified,
  17350. use embedded font. Note that drawing with font file or embedded font is not
  17351. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  17352. option instead.
  17353. @item font
  17354. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  17355. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  17356. escaping.
  17357. @item fontcolor
  17358. Specify font color expression. This is arithmetic expression that should return
  17359. integer value 0xRRGGBB. It can contain variables:
  17360. @table @option
  17361. @item frequency, freq, f
  17362. the frequency where it is evaluated
  17363. @item timeclamp, tc
  17364. the value of @var{timeclamp} option
  17365. @end table
  17366. and functions:
  17367. @table @option
  17368. @item midi(f)
  17369. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  17370. @item r(x), g(x), b(x)
  17371. red, green, and blue value of intensity x.
  17372. @end table
  17373. Default value is @code{st(0, (midi(f)-59.5)/12);
  17374. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  17375. r(1-ld(1)) + b(ld(1))}.
  17376. @item axisfile
  17377. Specify image file to draw the axis. This option override @var{fontfile} and
  17378. @var{fontcolor} option.
  17379. @item axis, text
  17380. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  17381. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  17382. Default value is @code{1}.
  17383. @item csp
  17384. Set colorspace. The accepted values are:
  17385. @table @samp
  17386. @item unspecified
  17387. Unspecified (default)
  17388. @item bt709
  17389. BT.709
  17390. @item fcc
  17391. FCC
  17392. @item bt470bg
  17393. BT.470BG or BT.601-6 625
  17394. @item smpte170m
  17395. SMPTE-170M or BT.601-6 525
  17396. @item smpte240m
  17397. SMPTE-240M
  17398. @item bt2020ncl
  17399. BT.2020 with non-constant luminance
  17400. @end table
  17401. @item cscheme
  17402. Set spectrogram color scheme. This is list of floating point values with format
  17403. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  17404. The default is @code{1|0.5|0|0|0.5|1}.
  17405. @end table
  17406. @subsection Examples
  17407. @itemize
  17408. @item
  17409. Playing audio while showing the spectrum:
  17410. @example
  17411. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  17412. @end example
  17413. @item
  17414. Same as above, but with frame rate 30 fps:
  17415. @example
  17416. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  17417. @end example
  17418. @item
  17419. Playing at 1280x720:
  17420. @example
  17421. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  17422. @end example
  17423. @item
  17424. Disable sonogram display:
  17425. @example
  17426. sono_h=0
  17427. @end example
  17428. @item
  17429. A1 and its harmonics: A1, A2, (near)E3, A3:
  17430. @example
  17431. 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),
  17432. asplit[a][out1]; [a] showcqt [out0]'
  17433. @end example
  17434. @item
  17435. Same as above, but with more accuracy in frequency domain:
  17436. @example
  17437. 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),
  17438. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  17439. @end example
  17440. @item
  17441. Custom volume:
  17442. @example
  17443. bar_v=10:sono_v=bar_v*a_weighting(f)
  17444. @end example
  17445. @item
  17446. Custom gamma, now spectrum is linear to the amplitude.
  17447. @example
  17448. bar_g=2:sono_g=2
  17449. @end example
  17450. @item
  17451. Custom tlength equation:
  17452. @example
  17453. 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)))'
  17454. @end example
  17455. @item
  17456. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  17457. @example
  17458. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  17459. @end example
  17460. @item
  17461. Custom font using fontconfig:
  17462. @example
  17463. font='Courier New,Monospace,mono|bold'
  17464. @end example
  17465. @item
  17466. Custom frequency range with custom axis using image file:
  17467. @example
  17468. axisfile=myaxis.png:basefreq=40:endfreq=10000
  17469. @end example
  17470. @end itemize
  17471. @section showfreqs
  17472. Convert input audio to video output representing the audio power spectrum.
  17473. Audio amplitude is on Y-axis while frequency is on X-axis.
  17474. The filter accepts the following options:
  17475. @table @option
  17476. @item size, s
  17477. Specify size of video. For the syntax of this option, check the
  17478. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17479. Default is @code{1024x512}.
  17480. @item mode
  17481. Set display mode.
  17482. This set how each frequency bin will be represented.
  17483. It accepts the following values:
  17484. @table @samp
  17485. @item line
  17486. @item bar
  17487. @item dot
  17488. @end table
  17489. Default is @code{bar}.
  17490. @item ascale
  17491. Set amplitude scale.
  17492. It accepts the following values:
  17493. @table @samp
  17494. @item lin
  17495. Linear scale.
  17496. @item sqrt
  17497. Square root scale.
  17498. @item cbrt
  17499. Cubic root scale.
  17500. @item log
  17501. Logarithmic scale.
  17502. @end table
  17503. Default is @code{log}.
  17504. @item fscale
  17505. Set frequency scale.
  17506. It accepts the following values:
  17507. @table @samp
  17508. @item lin
  17509. Linear scale.
  17510. @item log
  17511. Logarithmic scale.
  17512. @item rlog
  17513. Reverse logarithmic scale.
  17514. @end table
  17515. Default is @code{lin}.
  17516. @item win_size
  17517. Set window size. Allowed range is from 16 to 65536.
  17518. Default is @code{2048}
  17519. @item win_func
  17520. Set windowing function.
  17521. It accepts the following values:
  17522. @table @samp
  17523. @item rect
  17524. @item bartlett
  17525. @item hanning
  17526. @item hamming
  17527. @item blackman
  17528. @item welch
  17529. @item flattop
  17530. @item bharris
  17531. @item bnuttall
  17532. @item bhann
  17533. @item sine
  17534. @item nuttall
  17535. @item lanczos
  17536. @item gauss
  17537. @item tukey
  17538. @item dolph
  17539. @item cauchy
  17540. @item parzen
  17541. @item poisson
  17542. @item bohman
  17543. @end table
  17544. Default is @code{hanning}.
  17545. @item overlap
  17546. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17547. which means optimal overlap for selected window function will be picked.
  17548. @item averaging
  17549. Set time averaging. Setting this to 0 will display current maximal peaks.
  17550. Default is @code{1}, which means time averaging is disabled.
  17551. @item colors
  17552. Specify list of colors separated by space or by '|' which will be used to
  17553. draw channel frequencies. Unrecognized or missing colors will be replaced
  17554. by white color.
  17555. @item cmode
  17556. Set channel display mode.
  17557. It accepts the following values:
  17558. @table @samp
  17559. @item combined
  17560. @item separate
  17561. @end table
  17562. Default is @code{combined}.
  17563. @item minamp
  17564. Set minimum amplitude used in @code{log} amplitude scaler.
  17565. @end table
  17566. @section showspatial
  17567. Convert stereo input audio to a video output, representing the spatial relationship
  17568. between two channels.
  17569. The filter accepts the following options:
  17570. @table @option
  17571. @item size, s
  17572. Specify the video size for the output. For the syntax of this option, check the
  17573. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17574. Default value is @code{512x512}.
  17575. @item win_size
  17576. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  17577. @item win_func
  17578. Set window function.
  17579. It accepts the following values:
  17580. @table @samp
  17581. @item rect
  17582. @item bartlett
  17583. @item hann
  17584. @item hanning
  17585. @item hamming
  17586. @item blackman
  17587. @item welch
  17588. @item flattop
  17589. @item bharris
  17590. @item bnuttall
  17591. @item bhann
  17592. @item sine
  17593. @item nuttall
  17594. @item lanczos
  17595. @item gauss
  17596. @item tukey
  17597. @item dolph
  17598. @item cauchy
  17599. @item parzen
  17600. @item poisson
  17601. @item bohman
  17602. @end table
  17603. Default value is @code{hann}.
  17604. @item overlap
  17605. Set ratio of overlap window. Default value is @code{0.5}.
  17606. When value is @code{1} overlap is set to recommended size for specific
  17607. window function currently used.
  17608. @end table
  17609. @anchor{showspectrum}
  17610. @section showspectrum
  17611. Convert input audio to a video output, representing the audio frequency
  17612. spectrum.
  17613. The filter accepts the following options:
  17614. @table @option
  17615. @item size, s
  17616. Specify the video size for the output. For the syntax of this option, check the
  17617. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17618. Default value is @code{640x512}.
  17619. @item slide
  17620. Specify how the spectrum should slide along the window.
  17621. It accepts the following values:
  17622. @table @samp
  17623. @item replace
  17624. the samples start again on the left when they reach the right
  17625. @item scroll
  17626. the samples scroll from right to left
  17627. @item fullframe
  17628. frames are only produced when the samples reach the right
  17629. @item rscroll
  17630. the samples scroll from left to right
  17631. @end table
  17632. Default value is @code{replace}.
  17633. @item mode
  17634. Specify display mode.
  17635. It accepts the following values:
  17636. @table @samp
  17637. @item combined
  17638. all channels are displayed in the same row
  17639. @item separate
  17640. all channels are displayed in separate rows
  17641. @end table
  17642. Default value is @samp{combined}.
  17643. @item color
  17644. Specify display color mode.
  17645. It accepts the following values:
  17646. @table @samp
  17647. @item channel
  17648. each channel is displayed in a separate color
  17649. @item intensity
  17650. each channel is displayed using the same color scheme
  17651. @item rainbow
  17652. each channel is displayed using the rainbow color scheme
  17653. @item moreland
  17654. each channel is displayed using the moreland color scheme
  17655. @item nebulae
  17656. each channel is displayed using the nebulae color scheme
  17657. @item fire
  17658. each channel is displayed using the fire color scheme
  17659. @item fiery
  17660. each channel is displayed using the fiery color scheme
  17661. @item fruit
  17662. each channel is displayed using the fruit color scheme
  17663. @item cool
  17664. each channel is displayed using the cool color scheme
  17665. @item magma
  17666. each channel is displayed using the magma color scheme
  17667. @item green
  17668. each channel is displayed using the green color scheme
  17669. @item viridis
  17670. each channel is displayed using the viridis color scheme
  17671. @item plasma
  17672. each channel is displayed using the plasma color scheme
  17673. @item cividis
  17674. each channel is displayed using the cividis color scheme
  17675. @item terrain
  17676. each channel is displayed using the terrain color scheme
  17677. @end table
  17678. Default value is @samp{channel}.
  17679. @item scale
  17680. Specify scale used for calculating intensity color values.
  17681. It accepts the following values:
  17682. @table @samp
  17683. @item lin
  17684. linear
  17685. @item sqrt
  17686. square root, default
  17687. @item cbrt
  17688. cubic root
  17689. @item log
  17690. logarithmic
  17691. @item 4thrt
  17692. 4th root
  17693. @item 5thrt
  17694. 5th root
  17695. @end table
  17696. Default value is @samp{sqrt}.
  17697. @item fscale
  17698. Specify frequency scale.
  17699. It accepts the following values:
  17700. @table @samp
  17701. @item lin
  17702. linear
  17703. @item log
  17704. logarithmic
  17705. @end table
  17706. Default value is @samp{lin}.
  17707. @item saturation
  17708. Set saturation modifier for displayed colors. Negative values provide
  17709. alternative color scheme. @code{0} is no saturation at all.
  17710. Saturation must be in [-10.0, 10.0] range.
  17711. Default value is @code{1}.
  17712. @item win_func
  17713. Set window function.
  17714. It accepts the following values:
  17715. @table @samp
  17716. @item rect
  17717. @item bartlett
  17718. @item hann
  17719. @item hanning
  17720. @item hamming
  17721. @item blackman
  17722. @item welch
  17723. @item flattop
  17724. @item bharris
  17725. @item bnuttall
  17726. @item bhann
  17727. @item sine
  17728. @item nuttall
  17729. @item lanczos
  17730. @item gauss
  17731. @item tukey
  17732. @item dolph
  17733. @item cauchy
  17734. @item parzen
  17735. @item poisson
  17736. @item bohman
  17737. @end table
  17738. Default value is @code{hann}.
  17739. @item orientation
  17740. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17741. @code{horizontal}. Default is @code{vertical}.
  17742. @item overlap
  17743. Set ratio of overlap window. Default value is @code{0}.
  17744. When value is @code{1} overlap is set to recommended size for specific
  17745. window function currently used.
  17746. @item gain
  17747. Set scale gain for calculating intensity color values.
  17748. Default value is @code{1}.
  17749. @item data
  17750. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  17751. @item rotation
  17752. Set color rotation, must be in [-1.0, 1.0] range.
  17753. Default value is @code{0}.
  17754. @item start
  17755. Set start frequency from which to display spectrogram. Default is @code{0}.
  17756. @item stop
  17757. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17758. @item fps
  17759. Set upper frame rate limit. Default is @code{auto}, unlimited.
  17760. @item legend
  17761. Draw time and frequency axes and legends. Default is disabled.
  17762. @end table
  17763. The usage is very similar to the showwaves filter; see the examples in that
  17764. section.
  17765. @subsection Examples
  17766. @itemize
  17767. @item
  17768. Large window with logarithmic color scaling:
  17769. @example
  17770. showspectrum=s=1280x480:scale=log
  17771. @end example
  17772. @item
  17773. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  17774. @example
  17775. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  17776. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  17777. @end example
  17778. @end itemize
  17779. @section showspectrumpic
  17780. Convert input audio to a single video frame, representing the audio frequency
  17781. spectrum.
  17782. The filter accepts the following options:
  17783. @table @option
  17784. @item size, s
  17785. Specify the video size for the output. For the syntax of this option, check the
  17786. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17787. Default value is @code{4096x2048}.
  17788. @item mode
  17789. Specify display mode.
  17790. It accepts the following values:
  17791. @table @samp
  17792. @item combined
  17793. all channels are displayed in the same row
  17794. @item separate
  17795. all channels are displayed in separate rows
  17796. @end table
  17797. Default value is @samp{combined}.
  17798. @item color
  17799. Specify display color mode.
  17800. It accepts the following values:
  17801. @table @samp
  17802. @item channel
  17803. each channel is displayed in a separate color
  17804. @item intensity
  17805. each channel is displayed using the same color scheme
  17806. @item rainbow
  17807. each channel is displayed using the rainbow color scheme
  17808. @item moreland
  17809. each channel is displayed using the moreland color scheme
  17810. @item nebulae
  17811. each channel is displayed using the nebulae color scheme
  17812. @item fire
  17813. each channel is displayed using the fire color scheme
  17814. @item fiery
  17815. each channel is displayed using the fiery color scheme
  17816. @item fruit
  17817. each channel is displayed using the fruit color scheme
  17818. @item cool
  17819. each channel is displayed using the cool color scheme
  17820. @item magma
  17821. each channel is displayed using the magma color scheme
  17822. @item green
  17823. each channel is displayed using the green color scheme
  17824. @item viridis
  17825. each channel is displayed using the viridis color scheme
  17826. @item plasma
  17827. each channel is displayed using the plasma color scheme
  17828. @item cividis
  17829. each channel is displayed using the cividis color scheme
  17830. @item terrain
  17831. each channel is displayed using the terrain color scheme
  17832. @end table
  17833. Default value is @samp{intensity}.
  17834. @item scale
  17835. Specify scale used for calculating intensity color values.
  17836. It accepts the following values:
  17837. @table @samp
  17838. @item lin
  17839. linear
  17840. @item sqrt
  17841. square root, default
  17842. @item cbrt
  17843. cubic root
  17844. @item log
  17845. logarithmic
  17846. @item 4thrt
  17847. 4th root
  17848. @item 5thrt
  17849. 5th root
  17850. @end table
  17851. Default value is @samp{log}.
  17852. @item fscale
  17853. Specify frequency scale.
  17854. It accepts the following values:
  17855. @table @samp
  17856. @item lin
  17857. linear
  17858. @item log
  17859. logarithmic
  17860. @end table
  17861. Default value is @samp{lin}.
  17862. @item saturation
  17863. Set saturation modifier for displayed colors. Negative values provide
  17864. alternative color scheme. @code{0} is no saturation at all.
  17865. Saturation must be in [-10.0, 10.0] range.
  17866. Default value is @code{1}.
  17867. @item win_func
  17868. Set window function.
  17869. It accepts the following values:
  17870. @table @samp
  17871. @item rect
  17872. @item bartlett
  17873. @item hann
  17874. @item hanning
  17875. @item hamming
  17876. @item blackman
  17877. @item welch
  17878. @item flattop
  17879. @item bharris
  17880. @item bnuttall
  17881. @item bhann
  17882. @item sine
  17883. @item nuttall
  17884. @item lanczos
  17885. @item gauss
  17886. @item tukey
  17887. @item dolph
  17888. @item cauchy
  17889. @item parzen
  17890. @item poisson
  17891. @item bohman
  17892. @end table
  17893. Default value is @code{hann}.
  17894. @item orientation
  17895. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17896. @code{horizontal}. Default is @code{vertical}.
  17897. @item gain
  17898. Set scale gain for calculating intensity color values.
  17899. Default value is @code{1}.
  17900. @item legend
  17901. Draw time and frequency axes and legends. Default is enabled.
  17902. @item rotation
  17903. Set color rotation, must be in [-1.0, 1.0] range.
  17904. Default value is @code{0}.
  17905. @item start
  17906. Set start frequency from which to display spectrogram. Default is @code{0}.
  17907. @item stop
  17908. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17909. @end table
  17910. @subsection Examples
  17911. @itemize
  17912. @item
  17913. Extract an audio spectrogram of a whole audio track
  17914. in a 1024x1024 picture using @command{ffmpeg}:
  17915. @example
  17916. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  17917. @end example
  17918. @end itemize
  17919. @section showvolume
  17920. Convert input audio volume to a video output.
  17921. The filter accepts the following options:
  17922. @table @option
  17923. @item rate, r
  17924. Set video rate.
  17925. @item b
  17926. Set border width, allowed range is [0, 5]. Default is 1.
  17927. @item w
  17928. Set channel width, allowed range is [80, 8192]. Default is 400.
  17929. @item h
  17930. Set channel height, allowed range is [1, 900]. Default is 20.
  17931. @item f
  17932. Set fade, allowed range is [0, 1]. Default is 0.95.
  17933. @item c
  17934. Set volume color expression.
  17935. The expression can use the following variables:
  17936. @table @option
  17937. @item VOLUME
  17938. Current max volume of channel in dB.
  17939. @item PEAK
  17940. Current peak.
  17941. @item CHANNEL
  17942. Current channel number, starting from 0.
  17943. @end table
  17944. @item t
  17945. If set, displays channel names. Default is enabled.
  17946. @item v
  17947. If set, displays volume values. Default is enabled.
  17948. @item o
  17949. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  17950. default is @code{h}.
  17951. @item s
  17952. Set step size, allowed range is [0, 5]. Default is 0, which means
  17953. step is disabled.
  17954. @item p
  17955. Set background opacity, allowed range is [0, 1]. Default is 0.
  17956. @item m
  17957. Set metering mode, can be peak: @code{p} or rms: @code{r},
  17958. default is @code{p}.
  17959. @item ds
  17960. Set display scale, can be linear: @code{lin} or log: @code{log},
  17961. default is @code{lin}.
  17962. @item dm
  17963. In second.
  17964. If set to > 0., display a line for the max level
  17965. in the previous seconds.
  17966. default is disabled: @code{0.}
  17967. @item dmc
  17968. The color of the max line. Use when @code{dm} option is set to > 0.
  17969. default is: @code{orange}
  17970. @end table
  17971. @section showwaves
  17972. Convert input audio to a video output, representing the samples waves.
  17973. The filter accepts the following options:
  17974. @table @option
  17975. @item size, s
  17976. Specify the video size for the output. For the syntax of this option, check the
  17977. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17978. Default value is @code{600x240}.
  17979. @item mode
  17980. Set display mode.
  17981. Available values are:
  17982. @table @samp
  17983. @item point
  17984. Draw a point for each sample.
  17985. @item line
  17986. Draw a vertical line for each sample.
  17987. @item p2p
  17988. Draw a point for each sample and a line between them.
  17989. @item cline
  17990. Draw a centered vertical line for each sample.
  17991. @end table
  17992. Default value is @code{point}.
  17993. @item n
  17994. Set the number of samples which are printed on the same column. A
  17995. larger value will decrease the frame rate. Must be a positive
  17996. integer. This option can be set only if the value for @var{rate}
  17997. is not explicitly specified.
  17998. @item rate, r
  17999. Set the (approximate) output frame rate. This is done by setting the
  18000. option @var{n}. Default value is "25".
  18001. @item split_channels
  18002. Set if channels should be drawn separately or overlap. Default value is 0.
  18003. @item colors
  18004. Set colors separated by '|' which are going to be used for drawing of each channel.
  18005. @item scale
  18006. Set amplitude scale.
  18007. Available values are:
  18008. @table @samp
  18009. @item lin
  18010. Linear.
  18011. @item log
  18012. Logarithmic.
  18013. @item sqrt
  18014. Square root.
  18015. @item cbrt
  18016. Cubic root.
  18017. @end table
  18018. Default is linear.
  18019. @item draw
  18020. Set the draw mode. This is mostly useful to set for high @var{n}.
  18021. Available values are:
  18022. @table @samp
  18023. @item scale
  18024. Scale pixel values for each drawn sample.
  18025. @item full
  18026. Draw every sample directly.
  18027. @end table
  18028. Default value is @code{scale}.
  18029. @end table
  18030. @subsection Examples
  18031. @itemize
  18032. @item
  18033. Output the input file audio and the corresponding video representation
  18034. at the same time:
  18035. @example
  18036. amovie=a.mp3,asplit[out0],showwaves[out1]
  18037. @end example
  18038. @item
  18039. Create a synthetic signal and show it with showwaves, forcing a
  18040. frame rate of 30 frames per second:
  18041. @example
  18042. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  18043. @end example
  18044. @end itemize
  18045. @section showwavespic
  18046. Convert input audio to a single video frame, representing the samples waves.
  18047. The filter accepts the following options:
  18048. @table @option
  18049. @item size, s
  18050. Specify the video size for the output. For the syntax of this option, check the
  18051. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18052. Default value is @code{600x240}.
  18053. @item split_channels
  18054. Set if channels should be drawn separately or overlap. Default value is 0.
  18055. @item colors
  18056. Set colors separated by '|' which are going to be used for drawing of each channel.
  18057. @item scale
  18058. Set amplitude scale.
  18059. Available values are:
  18060. @table @samp
  18061. @item lin
  18062. Linear.
  18063. @item log
  18064. Logarithmic.
  18065. @item sqrt
  18066. Square root.
  18067. @item cbrt
  18068. Cubic root.
  18069. @end table
  18070. Default is linear.
  18071. @item draw
  18072. Set the draw mode.
  18073. Available values are:
  18074. @table @samp
  18075. @item scale
  18076. Scale pixel values for each drawn sample.
  18077. @item full
  18078. Draw every sample directly.
  18079. @end table
  18080. Default value is @code{scale}.
  18081. @end table
  18082. @subsection Examples
  18083. @itemize
  18084. @item
  18085. Extract a channel split representation of the wave form of a whole audio track
  18086. in a 1024x800 picture using @command{ffmpeg}:
  18087. @example
  18088. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  18089. @end example
  18090. @end itemize
  18091. @section sidedata, asidedata
  18092. Delete frame side data, or select frames based on it.
  18093. This filter accepts the following options:
  18094. @table @option
  18095. @item mode
  18096. Set mode of operation of the filter.
  18097. Can be one of the following:
  18098. @table @samp
  18099. @item select
  18100. Select every frame with side data of @code{type}.
  18101. @item delete
  18102. Delete side data of @code{type}. If @code{type} is not set, delete all side
  18103. data in the frame.
  18104. @end table
  18105. @item type
  18106. Set side data type used with all modes. Must be set for @code{select} mode. For
  18107. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  18108. in @file{libavutil/frame.h}. For example, to choose
  18109. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  18110. @end table
  18111. @section spectrumsynth
  18112. Synthesize audio from 2 input video spectrums, first input stream represents
  18113. magnitude across time and second represents phase across time.
  18114. The filter will transform from frequency domain as displayed in videos back
  18115. to time domain as presented in audio output.
  18116. This filter is primarily created for reversing processed @ref{showspectrum}
  18117. filter outputs, but can synthesize sound from other spectrograms too.
  18118. But in such case results are going to be poor if the phase data is not
  18119. available, because in such cases phase data need to be recreated, usually
  18120. it's just recreated from random noise.
  18121. For best results use gray only output (@code{channel} color mode in
  18122. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  18123. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  18124. @code{data} option. Inputs videos should generally use @code{fullframe}
  18125. slide mode as that saves resources needed for decoding video.
  18126. The filter accepts the following options:
  18127. @table @option
  18128. @item sample_rate
  18129. Specify sample rate of output audio, the sample rate of audio from which
  18130. spectrum was generated may differ.
  18131. @item channels
  18132. Set number of channels represented in input video spectrums.
  18133. @item scale
  18134. Set scale which was used when generating magnitude input spectrum.
  18135. Can be @code{lin} or @code{log}. Default is @code{log}.
  18136. @item slide
  18137. Set slide which was used when generating inputs spectrums.
  18138. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  18139. Default is @code{fullframe}.
  18140. @item win_func
  18141. Set window function used for resynthesis.
  18142. @item overlap
  18143. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  18144. which means optimal overlap for selected window function will be picked.
  18145. @item orientation
  18146. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  18147. Default is @code{vertical}.
  18148. @end table
  18149. @subsection Examples
  18150. @itemize
  18151. @item
  18152. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  18153. then resynthesize videos back to audio with spectrumsynth:
  18154. @example
  18155. 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
  18156. 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
  18157. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  18158. @end example
  18159. @end itemize
  18160. @section split, asplit
  18161. Split input into several identical outputs.
  18162. @code{asplit} works with audio input, @code{split} with video.
  18163. The filter accepts a single parameter which specifies the number of outputs. If
  18164. unspecified, it defaults to 2.
  18165. @subsection Examples
  18166. @itemize
  18167. @item
  18168. Create two separate outputs from the same input:
  18169. @example
  18170. [in] split [out0][out1]
  18171. @end example
  18172. @item
  18173. To create 3 or more outputs, you need to specify the number of
  18174. outputs, like in:
  18175. @example
  18176. [in] asplit=3 [out0][out1][out2]
  18177. @end example
  18178. @item
  18179. Create two separate outputs from the same input, one cropped and
  18180. one padded:
  18181. @example
  18182. [in] split [splitout1][splitout2];
  18183. [splitout1] crop=100:100:0:0 [cropout];
  18184. [splitout2] pad=200:200:100:100 [padout];
  18185. @end example
  18186. @item
  18187. Create 5 copies of the input audio with @command{ffmpeg}:
  18188. @example
  18189. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  18190. @end example
  18191. @end itemize
  18192. @section zmq, azmq
  18193. Receive commands sent through a libzmq client, and forward them to
  18194. filters in the filtergraph.
  18195. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  18196. must be inserted between two video filters, @code{azmq} between two
  18197. audio filters. Both are capable to send messages to any filter type.
  18198. To enable these filters you need to install the libzmq library and
  18199. headers and configure FFmpeg with @code{--enable-libzmq}.
  18200. For more information about libzmq see:
  18201. @url{http://www.zeromq.org/}
  18202. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  18203. receives messages sent through a network interface defined by the
  18204. @option{bind_address} (or the abbreviation "@option{b}") option.
  18205. Default value of this option is @file{tcp://localhost:5555}. You may
  18206. want to alter this value to your needs, but do not forget to escape any
  18207. ':' signs (see @ref{filtergraph escaping}).
  18208. The received message must be in the form:
  18209. @example
  18210. @var{TARGET} @var{COMMAND} [@var{ARG}]
  18211. @end example
  18212. @var{TARGET} specifies the target of the command, usually the name of
  18213. the filter class or a specific filter instance name. The default
  18214. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  18215. but you can override this by using the @samp{filter_name@@id} syntax
  18216. (see @ref{Filtergraph syntax}).
  18217. @var{COMMAND} specifies the name of the command for the target filter.
  18218. @var{ARG} is optional and specifies the optional argument list for the
  18219. given @var{COMMAND}.
  18220. Upon reception, the message is processed and the corresponding command
  18221. is injected into the filtergraph. Depending on the result, the filter
  18222. will send a reply to the client, adopting the format:
  18223. @example
  18224. @var{ERROR_CODE} @var{ERROR_REASON}
  18225. @var{MESSAGE}
  18226. @end example
  18227. @var{MESSAGE} is optional.
  18228. @subsection Examples
  18229. Look at @file{tools/zmqsend} for an example of a zmq client which can
  18230. be used to send commands processed by these filters.
  18231. Consider the following filtergraph generated by @command{ffplay}.
  18232. In this example the last overlay filter has an instance name. All other
  18233. filters will have default instance names.
  18234. @example
  18235. ffplay -dumpgraph 1 -f lavfi "
  18236. color=s=100x100:c=red [l];
  18237. color=s=100x100:c=blue [r];
  18238. nullsrc=s=200x100, zmq [bg];
  18239. [bg][l] overlay [bg+l];
  18240. [bg+l][r] overlay@@my=x=100 "
  18241. @end example
  18242. To change the color of the left side of the video, the following
  18243. command can be used:
  18244. @example
  18245. echo Parsed_color_0 c yellow | tools/zmqsend
  18246. @end example
  18247. To change the right side:
  18248. @example
  18249. echo Parsed_color_1 c pink | tools/zmqsend
  18250. @end example
  18251. To change the position of the right side:
  18252. @example
  18253. echo overlay@@my x 150 | tools/zmqsend
  18254. @end example
  18255. @c man end MULTIMEDIA FILTERS
  18256. @chapter Multimedia Sources
  18257. @c man begin MULTIMEDIA SOURCES
  18258. Below is a description of the currently available multimedia sources.
  18259. @section amovie
  18260. This is the same as @ref{movie} source, except it selects an audio
  18261. stream by default.
  18262. @anchor{movie}
  18263. @section movie
  18264. Read audio and/or video stream(s) from a movie container.
  18265. It accepts the following parameters:
  18266. @table @option
  18267. @item filename
  18268. The name of the resource to read (not necessarily a file; it can also be a
  18269. device or a stream accessed through some protocol).
  18270. @item format_name, f
  18271. Specifies the format assumed for the movie to read, and can be either
  18272. the name of a container or an input device. If not specified, the
  18273. format is guessed from @var{movie_name} or by probing.
  18274. @item seek_point, sp
  18275. Specifies the seek point in seconds. The frames will be output
  18276. starting from this seek point. The parameter is evaluated with
  18277. @code{av_strtod}, so the numerical value may be suffixed by an IS
  18278. postfix. The default value is "0".
  18279. @item streams, s
  18280. Specifies the streams to read. Several streams can be specified,
  18281. separated by "+". The source will then have as many outputs, in the
  18282. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  18283. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  18284. respectively the default (best suited) video and audio stream. Default
  18285. is "dv", or "da" if the filter is called as "amovie".
  18286. @item stream_index, si
  18287. Specifies the index of the video stream to read. If the value is -1,
  18288. the most suitable video stream will be automatically selected. The default
  18289. value is "-1". Deprecated. If the filter is called "amovie", it will select
  18290. audio instead of video.
  18291. @item loop
  18292. Specifies how many times to read the stream in sequence.
  18293. If the value is 0, the stream will be looped infinitely.
  18294. Default value is "1".
  18295. Note that when the movie is looped the source timestamps are not
  18296. changed, so it will generate non monotonically increasing timestamps.
  18297. @item discontinuity
  18298. Specifies the time difference between frames above which the point is
  18299. considered a timestamp discontinuity which is removed by adjusting the later
  18300. timestamps.
  18301. @end table
  18302. It allows overlaying a second video on top of the main input of
  18303. a filtergraph, as shown in this graph:
  18304. @example
  18305. input -----------> deltapts0 --> overlay --> output
  18306. ^
  18307. |
  18308. movie --> scale--> deltapts1 -------+
  18309. @end example
  18310. @subsection Examples
  18311. @itemize
  18312. @item
  18313. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  18314. on top of the input labelled "in":
  18315. @example
  18316. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  18317. [in] setpts=PTS-STARTPTS [main];
  18318. [main][over] overlay=16:16 [out]
  18319. @end example
  18320. @item
  18321. Read from a video4linux2 device, and overlay it on top of the input
  18322. labelled "in":
  18323. @example
  18324. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  18325. [in] setpts=PTS-STARTPTS [main];
  18326. [main][over] overlay=16:16 [out]
  18327. @end example
  18328. @item
  18329. Read the first video stream and the audio stream with id 0x81 from
  18330. dvd.vob; the video is connected to the pad named "video" and the audio is
  18331. connected to the pad named "audio":
  18332. @example
  18333. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  18334. @end example
  18335. @end itemize
  18336. @subsection Commands
  18337. Both movie and amovie support the following commands:
  18338. @table @option
  18339. @item seek
  18340. Perform seek using "av_seek_frame".
  18341. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  18342. @itemize
  18343. @item
  18344. @var{stream_index}: If stream_index is -1, a default
  18345. stream is selected, and @var{timestamp} is automatically converted
  18346. from AV_TIME_BASE units to the stream specific time_base.
  18347. @item
  18348. @var{timestamp}: Timestamp in AVStream.time_base units
  18349. or, if no stream is specified, in AV_TIME_BASE units.
  18350. @item
  18351. @var{flags}: Flags which select direction and seeking mode.
  18352. @end itemize
  18353. @item get_duration
  18354. Get movie duration in AV_TIME_BASE units.
  18355. @end table
  18356. @c man end MULTIMEDIA SOURCES