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.

25659 lines
683KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{commands}
  252. @chapter Changing options at runtime with a command
  253. Some options can be changed during the operation of the filter using
  254. a command. These options are marked 'T' on the output of
  255. @command{ffmpeg} @option{-h filter=<name of filter>}.
  256. The name of the command is the name of the option and the argument is
  257. the new value.
  258. @anchor{framesync}
  259. @chapter Options for filters with several inputs (framesync)
  260. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  261. Some filters with several inputs support a common set of options.
  262. These options can only be set by name, not with the short notation.
  263. @table @option
  264. @item eof_action
  265. The action to take when EOF is encountered on the secondary input; it accepts
  266. one of the following values:
  267. @table @option
  268. @item repeat
  269. Repeat the last frame (the default).
  270. @item endall
  271. End both streams.
  272. @item pass
  273. Pass the main input through.
  274. @end table
  275. @item shortest
  276. If set to 1, force the output to terminate when the shortest input
  277. terminates. Default value is 0.
  278. @item repeatlast
  279. If set to 1, force the filter to extend the last frame of secondary streams
  280. until the end of the primary stream. A value of 0 disables this behavior.
  281. Default value is 1.
  282. @end table
  283. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  284. @chapter Audio Filters
  285. @c man begin AUDIO FILTERS
  286. When you configure your FFmpeg build, you can disable any of the
  287. existing filters using @code{--disable-filters}.
  288. The configure output will show the audio filters included in your
  289. build.
  290. Below is a description of the currently available audio filters.
  291. @section acompressor
  292. A compressor is mainly used to reduce the dynamic range of a signal.
  293. Especially modern music is mostly compressed at a high ratio to
  294. improve the overall loudness. It's done to get the highest attention
  295. of a listener, "fatten" the sound and bring more "power" to the track.
  296. If a signal is compressed too much it may sound dull or "dead"
  297. afterwards or it may start to "pump" (which could be a powerful effect
  298. but can also destroy a track completely).
  299. The right compression is the key to reach a professional sound and is
  300. the high art of mixing and mastering. Because of its complex settings
  301. it may take a long time to get the right feeling for this kind of effect.
  302. Compression is done by detecting the volume above a chosen level
  303. @code{threshold} and dividing it by the factor set with @code{ratio}.
  304. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  305. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  306. the signal would cause distortion of the waveform the reduction can be
  307. levelled over the time. This is done by setting "Attack" and "Release".
  308. @code{attack} determines how long the signal has to rise above the threshold
  309. before any reduction will occur and @code{release} sets the time the signal
  310. has to fall below the threshold to reduce the reduction again. Shorter signals
  311. than the chosen attack time will be left untouched.
  312. The overall reduction of the signal can be made up afterwards with the
  313. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  314. raising the makeup to this level results in a signal twice as loud than the
  315. source. To gain a softer entry in the compression the @code{knee} flattens the
  316. hard edge at the threshold in the range of the chosen decibels.
  317. The filter accepts the following options:
  318. @table @option
  319. @item level_in
  320. Set input gain. Default is 1. Range is between 0.015625 and 64.
  321. @item mode
  322. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  323. Default is @code{downward}.
  324. @item threshold
  325. If a signal of stream rises above this level it will affect the gain
  326. reduction.
  327. By default it is 0.125. Range is between 0.00097563 and 1.
  328. @item ratio
  329. Set a ratio by which the signal is reduced. 1:2 means that if the level
  330. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  331. Default is 2. Range is between 1 and 20.
  332. @item attack
  333. Amount of milliseconds the signal has to rise above the threshold before gain
  334. reduction starts. Default is 20. Range is between 0.01 and 2000.
  335. @item release
  336. Amount of milliseconds the signal has to fall below the threshold before
  337. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  338. @item makeup
  339. Set the amount by how much signal will be amplified after processing.
  340. Default is 1. Range is from 1 to 64.
  341. @item knee
  342. Curve the sharp knee around the threshold to enter gain reduction more softly.
  343. Default is 2.82843. Range is between 1 and 8.
  344. @item link
  345. Choose if the @code{average} level between all channels of input stream
  346. or the louder(@code{maximum}) channel of input stream affects the
  347. reduction. Default is @code{average}.
  348. @item detection
  349. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  350. of @code{rms}. Default is @code{rms} which is mostly smoother.
  351. @item mix
  352. How much to use compressed signal in output. Default is 1.
  353. Range is between 0 and 1.
  354. @end table
  355. @subsection Commands
  356. This filter supports the all above options as @ref{commands}.
  357. @section acontrast
  358. Simple audio dynamic range compression/expansion filter.
  359. The filter accepts the following options:
  360. @table @option
  361. @item contrast
  362. Set contrast. Default is 33. Allowed range is between 0 and 100.
  363. @end table
  364. @section acopy
  365. Copy the input audio source unchanged to the output. This is mainly useful for
  366. testing purposes.
  367. @section acrossfade
  368. Apply cross fade from one input audio stream to another input audio stream.
  369. The cross fade is applied for specified duration near the end of first stream.
  370. The filter accepts the following options:
  371. @table @option
  372. @item nb_samples, ns
  373. Specify the number of samples for which the cross fade effect has to last.
  374. At the end of the cross fade effect the first input audio will be completely
  375. silent. Default is 44100.
  376. @item duration, d
  377. Specify the duration of the cross fade effect. See
  378. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  379. for the accepted syntax.
  380. By default the duration is determined by @var{nb_samples}.
  381. If set this option is used instead of @var{nb_samples}.
  382. @item overlap, o
  383. Should first stream end overlap with second stream start. Default is enabled.
  384. @item curve1
  385. Set curve for cross fade transition for first stream.
  386. @item curve2
  387. Set curve for cross fade transition for second stream.
  388. For description of available curve types see @ref{afade} filter description.
  389. @end table
  390. @subsection Examples
  391. @itemize
  392. @item
  393. Cross fade from one input to another:
  394. @example
  395. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  396. @end example
  397. @item
  398. Cross fade from one input to another but without overlapping:
  399. @example
  400. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  401. @end example
  402. @end itemize
  403. @section acrossover
  404. Split audio stream into several bands.
  405. This filter splits audio stream into two or more frequency ranges.
  406. Summing all streams back will give flat output.
  407. The filter accepts the following options:
  408. @table @option
  409. @item split
  410. Set split frequencies. Those must be positive and increasing.
  411. @item order
  412. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  413. Default is @var{4th}.
  414. @end table
  415. @section acrusher
  416. Reduce audio bit resolution.
  417. This filter is bit crusher with enhanced functionality. A bit crusher
  418. is used to audibly reduce number of bits an audio signal is sampled
  419. with. This doesn't change the bit depth at all, it just produces the
  420. effect. Material reduced in bit depth sounds more harsh and "digital".
  421. This filter is able to even round to continuous values instead of discrete
  422. bit depths.
  423. Additionally it has a D/C offset which results in different crushing of
  424. the lower and the upper half of the signal.
  425. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  426. Another feature of this filter is the logarithmic mode.
  427. This setting switches from linear distances between bits to logarithmic ones.
  428. The result is a much more "natural" sounding crusher which doesn't gate low
  429. signals for example. The human ear has a logarithmic perception,
  430. so this kind of crushing is much more pleasant.
  431. Logarithmic crushing is also able to get anti-aliased.
  432. The filter accepts the following options:
  433. @table @option
  434. @item level_in
  435. Set level in.
  436. @item level_out
  437. Set level out.
  438. @item bits
  439. Set bit reduction.
  440. @item mix
  441. Set mixing amount.
  442. @item mode
  443. Can be linear: @code{lin} or logarithmic: @code{log}.
  444. @item dc
  445. Set DC.
  446. @item aa
  447. Set anti-aliasing.
  448. @item samples
  449. Set sample reduction.
  450. @item lfo
  451. Enable LFO. By default disabled.
  452. @item lforange
  453. Set LFO range.
  454. @item lforate
  455. Set LFO rate.
  456. @end table
  457. @section acue
  458. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  459. filter.
  460. @section adeclick
  461. Remove impulsive noise from input audio.
  462. Samples detected as impulsive noise are replaced by interpolated samples using
  463. autoregressive modelling.
  464. @table @option
  465. @item w
  466. Set window size, in milliseconds. Allowed range is from @code{10} to
  467. @code{100}. Default value is @code{55} milliseconds.
  468. This sets size of window which will be processed at once.
  469. @item o
  470. Set window overlap, in percentage of window size. Allowed range is from
  471. @code{50} to @code{95}. Default value is @code{75} percent.
  472. Setting this to a very high value increases impulsive noise removal but makes
  473. whole process much slower.
  474. @item a
  475. Set autoregression order, in percentage of window size. Allowed range is from
  476. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  477. controls quality of interpolated samples using neighbour good samples.
  478. @item t
  479. Set threshold value. Allowed range is from @code{1} to @code{100}.
  480. Default value is @code{2}.
  481. This controls the strength of impulsive noise which is going to be removed.
  482. The lower value, the more samples will be detected as impulsive noise.
  483. @item b
  484. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  485. @code{10}. Default value is @code{2}.
  486. If any two samples detected as noise are spaced less than this value then any
  487. sample between those two samples will be also detected as noise.
  488. @item m
  489. Set overlap method.
  490. It accepts the following values:
  491. @table @option
  492. @item a
  493. Select overlap-add method. Even not interpolated samples are slightly
  494. changed with this method.
  495. @item s
  496. Select overlap-save method. Not interpolated samples remain unchanged.
  497. @end table
  498. Default value is @code{a}.
  499. @end table
  500. @section adeclip
  501. Remove clipped samples from input audio.
  502. Samples detected as clipped are replaced by interpolated samples using
  503. autoregressive modelling.
  504. @table @option
  505. @item w
  506. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  507. Default value is @code{55} milliseconds.
  508. This sets size of window which will be processed at once.
  509. @item o
  510. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  511. to @code{95}. Default value is @code{75} percent.
  512. @item a
  513. Set autoregression order, in percentage of window size. Allowed range is from
  514. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  515. quality of interpolated samples using neighbour good samples.
  516. @item t
  517. Set threshold value. Allowed range is from @code{1} to @code{100}.
  518. Default value is @code{10}. Higher values make clip detection less aggressive.
  519. @item n
  520. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  521. Default value is @code{1000}. Higher values make clip detection less aggressive.
  522. @item m
  523. Set overlap method.
  524. It accepts the following values:
  525. @table @option
  526. @item a
  527. Select overlap-add method. Even not interpolated samples are slightly changed
  528. with this method.
  529. @item s
  530. Select overlap-save method. Not interpolated samples remain unchanged.
  531. @end table
  532. Default value is @code{a}.
  533. @end table
  534. @section adelay
  535. Delay one or more audio channels.
  536. Samples in delayed channel are filled with silence.
  537. The filter accepts the following option:
  538. @table @option
  539. @item delays
  540. Set list of delays in milliseconds for each channel separated by '|'.
  541. Unused delays will be silently ignored. If number of given delays is
  542. smaller than number of channels all remaining channels will not be delayed.
  543. If you want to delay exact number of samples, append 'S' to number.
  544. If you want instead to delay in seconds, append 's' to number.
  545. @item all
  546. Use last set delay for all remaining channels. By default is disabled.
  547. This option if enabled changes how option @code{delays} is interpreted.
  548. @end table
  549. @subsection Examples
  550. @itemize
  551. @item
  552. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  553. the second channel (and any other channels that may be present) unchanged.
  554. @example
  555. adelay=1500|0|500
  556. @end example
  557. @item
  558. Delay second channel by 500 samples, the third channel by 700 samples and leave
  559. the first channel (and any other channels that may be present) unchanged.
  560. @example
  561. adelay=0|500S|700S
  562. @end example
  563. @item
  564. Delay all channels by same number of samples:
  565. @example
  566. adelay=delays=64S:all=1
  567. @end example
  568. @end itemize
  569. @section aderivative, aintegral
  570. Compute derivative/integral of audio stream.
  571. Applying both filters one after another produces original audio.
  572. @section aecho
  573. Apply echoing to the input audio.
  574. Echoes are reflected sound and can occur naturally amongst mountains
  575. (and sometimes large buildings) when talking or shouting; digital echo
  576. effects emulate this behaviour and are often used to help fill out the
  577. sound of a single instrument or vocal. The time difference between the
  578. original signal and the reflection is the @code{delay}, and the
  579. loudness of the reflected signal is the @code{decay}.
  580. Multiple echoes can have different delays and decays.
  581. A description of the accepted parameters follows.
  582. @table @option
  583. @item in_gain
  584. Set input gain of reflected signal. Default is @code{0.6}.
  585. @item out_gain
  586. Set output gain of reflected signal. Default is @code{0.3}.
  587. @item delays
  588. Set list of time intervals in milliseconds between original signal and reflections
  589. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  590. Default is @code{1000}.
  591. @item decays
  592. Set list of loudness of reflected signals separated by '|'.
  593. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  594. Default is @code{0.5}.
  595. @end table
  596. @subsection Examples
  597. @itemize
  598. @item
  599. Make it sound as if there are twice as many instruments as are actually playing:
  600. @example
  601. aecho=0.8:0.88:60:0.4
  602. @end example
  603. @item
  604. If delay is very short, then it sounds like a (metallic) robot playing music:
  605. @example
  606. aecho=0.8:0.88:6:0.4
  607. @end example
  608. @item
  609. A longer delay will sound like an open air concert in the mountains:
  610. @example
  611. aecho=0.8:0.9:1000:0.3
  612. @end example
  613. @item
  614. Same as above but with one more mountain:
  615. @example
  616. aecho=0.8:0.9:1000|1800:0.3|0.25
  617. @end example
  618. @end itemize
  619. @section aemphasis
  620. Audio emphasis filter creates or restores material directly taken from LPs or
  621. emphased CDs with different filter curves. E.g. to store music on vinyl the
  622. signal has to be altered by a filter first to even out the disadvantages of
  623. this recording medium.
  624. Once the material is played back the inverse filter has to be applied to
  625. restore the distortion of the frequency response.
  626. The filter accepts the following options:
  627. @table @option
  628. @item level_in
  629. Set input gain.
  630. @item level_out
  631. Set output gain.
  632. @item mode
  633. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  634. use @code{production} mode. Default is @code{reproduction} mode.
  635. @item type
  636. Set filter type. Selects medium. Can be one of the following:
  637. @table @option
  638. @item col
  639. select Columbia.
  640. @item emi
  641. select EMI.
  642. @item bsi
  643. select BSI (78RPM).
  644. @item riaa
  645. select RIAA.
  646. @item cd
  647. select Compact Disc (CD).
  648. @item 50fm
  649. select 50µs (FM).
  650. @item 75fm
  651. select 75µs (FM).
  652. @item 50kf
  653. select 50µs (FM-KF).
  654. @item 75kf
  655. select 75µs (FM-KF).
  656. @end table
  657. @end table
  658. @section aeval
  659. Modify an audio signal according to the specified expressions.
  660. This filter accepts one or more expressions (one for each channel),
  661. which are evaluated and used to modify a corresponding audio signal.
  662. It accepts the following parameters:
  663. @table @option
  664. @item exprs
  665. Set the '|'-separated expressions list for each separate channel. If
  666. the number of input channels is greater than the number of
  667. expressions, the last specified expression is used for the remaining
  668. output channels.
  669. @item channel_layout, c
  670. Set output channel layout. If not specified, the channel layout is
  671. specified by the number of expressions. If set to @samp{same}, it will
  672. use by default the same input channel layout.
  673. @end table
  674. Each expression in @var{exprs} can contain the following constants and functions:
  675. @table @option
  676. @item ch
  677. channel number of the current expression
  678. @item n
  679. number of the evaluated sample, starting from 0
  680. @item s
  681. sample rate
  682. @item t
  683. time of the evaluated sample expressed in seconds
  684. @item nb_in_channels
  685. @item nb_out_channels
  686. input and output number of channels
  687. @item val(CH)
  688. the value of input channel with number @var{CH}
  689. @end table
  690. Note: this filter is slow. For faster processing you should use a
  691. dedicated filter.
  692. @subsection Examples
  693. @itemize
  694. @item
  695. Half volume:
  696. @example
  697. aeval=val(ch)/2:c=same
  698. @end example
  699. @item
  700. Invert phase of the second channel:
  701. @example
  702. aeval=val(0)|-val(1)
  703. @end example
  704. @end itemize
  705. @anchor{afade}
  706. @section afade
  707. Apply fade-in/out effect to input audio.
  708. A description of the accepted parameters follows.
  709. @table @option
  710. @item type, t
  711. Specify the effect type, can be either @code{in} for fade-in, or
  712. @code{out} for a fade-out effect. Default is @code{in}.
  713. @item start_sample, ss
  714. Specify the number of the start sample for starting to apply the fade
  715. effect. Default is 0.
  716. @item nb_samples, ns
  717. Specify the number of samples for which the fade effect has to last. At
  718. the end of the fade-in effect the output audio will have the same
  719. volume as the input audio, at the end of the fade-out transition
  720. the output audio will be silence. Default is 44100.
  721. @item start_time, st
  722. Specify the start time of the fade effect. Default is 0.
  723. The value must be specified as a time duration; see
  724. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  725. for the accepted syntax.
  726. If set this option is used instead of @var{start_sample}.
  727. @item duration, d
  728. Specify the duration of the fade effect. See
  729. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  730. for the accepted syntax.
  731. At the end of the fade-in effect the output audio will have the same
  732. volume as the input audio, at the end of the fade-out transition
  733. the output audio will be silence.
  734. By default the duration is determined by @var{nb_samples}.
  735. If set this option is used instead of @var{nb_samples}.
  736. @item curve
  737. Set curve for fade transition.
  738. It accepts the following values:
  739. @table @option
  740. @item tri
  741. select triangular, linear slope (default)
  742. @item qsin
  743. select quarter of sine wave
  744. @item hsin
  745. select half of sine wave
  746. @item esin
  747. select exponential sine wave
  748. @item log
  749. select logarithmic
  750. @item ipar
  751. select inverted parabola
  752. @item qua
  753. select quadratic
  754. @item cub
  755. select cubic
  756. @item squ
  757. select square root
  758. @item cbr
  759. select cubic root
  760. @item par
  761. select parabola
  762. @item exp
  763. select exponential
  764. @item iqsin
  765. select inverted quarter of sine wave
  766. @item ihsin
  767. select inverted half of sine wave
  768. @item dese
  769. select double-exponential seat
  770. @item desi
  771. select double-exponential sigmoid
  772. @item losi
  773. select logistic sigmoid
  774. @item nofade
  775. no fade applied
  776. @end table
  777. @end table
  778. @subsection Examples
  779. @itemize
  780. @item
  781. Fade in first 15 seconds of audio:
  782. @example
  783. afade=t=in:ss=0:d=15
  784. @end example
  785. @item
  786. Fade out last 25 seconds of a 900 seconds audio:
  787. @example
  788. afade=t=out:st=875:d=25
  789. @end example
  790. @end itemize
  791. @section afftdn
  792. Denoise audio samples with FFT.
  793. A description of the accepted parameters follows.
  794. @table @option
  795. @item nr
  796. Set the noise reduction in dB, allowed range is 0.01 to 97.
  797. Default value is 12 dB.
  798. @item nf
  799. Set the noise floor in dB, allowed range is -80 to -20.
  800. Default value is -50 dB.
  801. @item nt
  802. Set the noise type.
  803. It accepts the following values:
  804. @table @option
  805. @item w
  806. Select white noise.
  807. @item v
  808. Select vinyl noise.
  809. @item s
  810. Select shellac noise.
  811. @item c
  812. Select custom noise, defined in @code{bn} option.
  813. Default value is white noise.
  814. @end table
  815. @item bn
  816. Set custom band noise for every one of 15 bands.
  817. Bands are separated by ' ' or '|'.
  818. @item rf
  819. Set the residual floor in dB, allowed range is -80 to -20.
  820. Default value is -38 dB.
  821. @item tn
  822. Enable noise tracking. By default is disabled.
  823. With this enabled, noise floor is automatically adjusted.
  824. @item tr
  825. Enable residual tracking. By default is disabled.
  826. @item om
  827. Set the output mode.
  828. It accepts the following values:
  829. @table @option
  830. @item i
  831. Pass input unchanged.
  832. @item o
  833. Pass noise filtered out.
  834. @item n
  835. Pass only noise.
  836. Default value is @var{o}.
  837. @end table
  838. @end table
  839. @subsection Commands
  840. This filter supports the following commands:
  841. @table @option
  842. @item sample_noise, sn
  843. Start or stop measuring noise profile.
  844. Syntax for the command is : "start" or "stop" string.
  845. After measuring noise profile is stopped it will be
  846. automatically applied in filtering.
  847. @item noise_reduction, nr
  848. Change noise reduction. Argument is single float number.
  849. Syntax for the command is : "@var{noise_reduction}"
  850. @item noise_floor, nf
  851. Change noise floor. Argument is single float number.
  852. Syntax for the command is : "@var{noise_floor}"
  853. @item output_mode, om
  854. Change output mode operation.
  855. Syntax for the command is : "i", "o" or "n" string.
  856. @end table
  857. @section afftfilt
  858. Apply arbitrary expressions to samples in frequency domain.
  859. @table @option
  860. @item real
  861. Set frequency domain real expression for each separate channel separated
  862. by '|'. Default is "re".
  863. If the number of input channels is greater than the number of
  864. expressions, the last specified expression is used for the remaining
  865. output channels.
  866. @item imag
  867. Set frequency domain imaginary expression for each separate channel
  868. separated by '|'. Default is "im".
  869. Each expression in @var{real} and @var{imag} can contain the following
  870. constants and functions:
  871. @table @option
  872. @item sr
  873. sample rate
  874. @item b
  875. current frequency bin number
  876. @item nb
  877. number of available bins
  878. @item ch
  879. channel number of the current expression
  880. @item chs
  881. number of channels
  882. @item pts
  883. current frame pts
  884. @item re
  885. current real part of frequency bin of current channel
  886. @item im
  887. current imaginary part of frequency bin of current channel
  888. @item real(b, ch)
  889. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  890. @item imag(b, ch)
  891. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  892. @end table
  893. @item win_size
  894. Set window size. Allowed range is from 16 to 131072.
  895. Default is @code{4096}
  896. @item win_func
  897. Set window function. Default is @code{hann}.
  898. @item overlap
  899. Set window overlap. If set to 1, the recommended overlap for selected
  900. window function will be picked. Default is @code{0.75}.
  901. @end table
  902. @subsection Examples
  903. @itemize
  904. @item
  905. Leave almost only low frequencies in audio:
  906. @example
  907. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  908. @end example
  909. @item
  910. Apply robotize effect:
  911. @example
  912. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  913. @end example
  914. @item
  915. Apply whisper effect:
  916. @example
  917. afftfilt="real='hypot(re,im)*cos((random(0)*2-1)*2*3.14)':imag='hypot(re,im)*sin((random(1)*2-1)*2*3.14)':win_size=128:overlap=0.8"
  918. @end example
  919. @end itemize
  920. @anchor{afir}
  921. @section afir
  922. Apply an arbitrary Finite Impulse Response filter.
  923. This filter is designed for applying long FIR filters,
  924. up to 60 seconds long.
  925. It can be used as component for digital crossover filters,
  926. room equalization, cross talk cancellation, wavefield synthesis,
  927. auralization, ambiophonics, ambisonics and spatialization.
  928. This filter uses the streams higher than first one as FIR coefficients.
  929. If the non-first stream holds a single channel, it will be used
  930. for all input channels in the first stream, otherwise
  931. the number of channels in the non-first stream must be same as
  932. the number of channels in the first stream.
  933. It accepts the following parameters:
  934. @table @option
  935. @item dry
  936. Set dry gain. This sets input gain.
  937. @item wet
  938. Set wet gain. This sets final output gain.
  939. @item length
  940. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  941. @item gtype
  942. Enable applying gain measured from power of IR.
  943. Set which approach to use for auto gain measurement.
  944. @table @option
  945. @item none
  946. Do not apply any gain.
  947. @item peak
  948. select peak gain, very conservative approach. This is default value.
  949. @item dc
  950. select DC gain, limited application.
  951. @item gn
  952. select gain to noise approach, this is most popular one.
  953. @end table
  954. @item irgain
  955. Set gain to be applied to IR coefficients before filtering.
  956. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  957. @item irfmt
  958. Set format of IR stream. Can be @code{mono} or @code{input}.
  959. Default is @code{input}.
  960. @item maxir
  961. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  962. Allowed range is 0.1 to 60 seconds.
  963. @item response
  964. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  965. By default it is disabled.
  966. @item channel
  967. Set for which IR channel to display frequency response. By default is first channel
  968. displayed. This option is used only when @var{response} is enabled.
  969. @item size
  970. Set video stream size. This option is used only when @var{response} is enabled.
  971. @item rate
  972. Set video stream frame rate. This option is used only when @var{response} is enabled.
  973. @item minp
  974. Set minimal partition size used for convolution. Default is @var{8192}.
  975. Allowed range is from @var{1} to @var{32768}.
  976. Lower values decreases latency at cost of higher CPU usage.
  977. @item maxp
  978. Set maximal partition size used for convolution. Default is @var{8192}.
  979. Allowed range is from @var{8} to @var{32768}.
  980. Lower values may increase CPU usage.
  981. @item nbirs
  982. Set number of input impulse responses streams which will be switchable at runtime.
  983. Allowed range is from @var{1} to @var{32}. Default is @var{1}.
  984. @item ir
  985. Set IR stream which will be used for convolution, starting from @var{0}, should always be
  986. lower than supplied value by @code{nbirs} option. Default is @var{0}.
  987. This option can be changed at runtime via @ref{commands}.
  988. @end table
  989. @subsection Examples
  990. @itemize
  991. @item
  992. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  993. @example
  994. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  995. @end example
  996. @end itemize
  997. @anchor{aformat}
  998. @section aformat
  999. Set output format constraints for the input audio. The framework will
  1000. negotiate the most appropriate format to minimize conversions.
  1001. It accepts the following parameters:
  1002. @table @option
  1003. @item sample_fmts, f
  1004. A '|'-separated list of requested sample formats.
  1005. @item sample_rates, r
  1006. A '|'-separated list of requested sample rates.
  1007. @item channel_layouts, cl
  1008. A '|'-separated list of requested channel layouts.
  1009. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1010. for the required syntax.
  1011. @end table
  1012. If a parameter is omitted, all values are allowed.
  1013. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1014. @example
  1015. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1016. @end example
  1017. @section agate
  1018. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1019. processing reduces disturbing noise between useful signals.
  1020. Gating is done by detecting the volume below a chosen level @var{threshold}
  1021. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1022. floor is set via @var{range}. Because an exact manipulation of the signal
  1023. would cause distortion of the waveform the reduction can be levelled over
  1024. time. This is done by setting @var{attack} and @var{release}.
  1025. @var{attack} determines how long the signal has to fall below the threshold
  1026. before any reduction will occur and @var{release} sets the time the signal
  1027. has to rise above the threshold to reduce the reduction again.
  1028. Shorter signals than the chosen attack time will be left untouched.
  1029. @table @option
  1030. @item level_in
  1031. Set input level before filtering.
  1032. Default is 1. Allowed range is from 0.015625 to 64.
  1033. @item mode
  1034. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1035. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1036. will be amplified, expanding dynamic range in upward direction.
  1037. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1038. @item range
  1039. Set the level of gain reduction when the signal is below the threshold.
  1040. Default is 0.06125. Allowed range is from 0 to 1.
  1041. Setting this to 0 disables reduction and then filter behaves like expander.
  1042. @item threshold
  1043. If a signal rises above this level the gain reduction is released.
  1044. Default is 0.125. Allowed range is from 0 to 1.
  1045. @item ratio
  1046. Set a ratio by which the signal is reduced.
  1047. Default is 2. Allowed range is from 1 to 9000.
  1048. @item attack
  1049. Amount of milliseconds the signal has to rise above the threshold before gain
  1050. reduction stops.
  1051. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1052. @item release
  1053. Amount of milliseconds the signal has to fall below the threshold before the
  1054. reduction is increased again. Default is 250 milliseconds.
  1055. Allowed range is from 0.01 to 9000.
  1056. @item makeup
  1057. Set amount of amplification of signal after processing.
  1058. Default is 1. Allowed range is from 1 to 64.
  1059. @item knee
  1060. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1061. Default is 2.828427125. Allowed range is from 1 to 8.
  1062. @item detection
  1063. Choose if exact signal should be taken for detection or an RMS like one.
  1064. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1065. @item link
  1066. Choose if the average level between all channels or the louder channel affects
  1067. the reduction.
  1068. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1069. @end table
  1070. @section aiir
  1071. Apply an arbitrary Infinite Impulse Response filter.
  1072. It accepts the following parameters:
  1073. @table @option
  1074. @item zeros, z
  1075. Set numerator/zeros coefficients.
  1076. @item poles, p
  1077. Set denominator/poles coefficients.
  1078. @item gains, k
  1079. Set channels gains.
  1080. @item dry_gain
  1081. Set input gain.
  1082. @item wet_gain
  1083. Set output gain.
  1084. @item format, f
  1085. Set coefficients format.
  1086. @table @samp
  1087. @item tf
  1088. transfer function
  1089. @item zp
  1090. Z-plane zeros/poles, cartesian (default)
  1091. @item pr
  1092. Z-plane zeros/poles, polar radians
  1093. @item pd
  1094. Z-plane zeros/poles, polar degrees
  1095. @end table
  1096. @item process, r
  1097. Set kind of processing.
  1098. Can be @code{d} - direct or @code{s} - serial cascading. Default is @code{s}.
  1099. @item precision, e
  1100. Set filtering precision.
  1101. @table @samp
  1102. @item dbl
  1103. double-precision floating-point (default)
  1104. @item flt
  1105. single-precision floating-point
  1106. @item i32
  1107. 32-bit integers
  1108. @item i16
  1109. 16-bit integers
  1110. @end table
  1111. @item normalize, n
  1112. Normalize filter coefficients, by default is enabled.
  1113. Enabling it will normalize magnitude response at DC to 0dB.
  1114. @item mix
  1115. How much to use filtered signal in output. Default is 1.
  1116. Range is between 0 and 1.
  1117. @item response
  1118. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1119. By default it is disabled.
  1120. @item channel
  1121. Set for which IR channel to display frequency response. By default is first channel
  1122. displayed. This option is used only when @var{response} is enabled.
  1123. @item size
  1124. Set video stream size. This option is used only when @var{response} is enabled.
  1125. @end table
  1126. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1127. order.
  1128. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1129. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1130. imaginary unit.
  1131. Different coefficients and gains can be provided for every channel, in such case
  1132. use '|' to separate coefficients or gains. Last provided coefficients will be
  1133. used for all remaining channels.
  1134. @subsection Examples
  1135. @itemize
  1136. @item
  1137. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1138. @example
  1139. 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
  1140. @end example
  1141. @item
  1142. Same as above but in @code{zp} format:
  1143. @example
  1144. 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
  1145. @end example
  1146. @end itemize
  1147. @section alimiter
  1148. The limiter prevents an input signal from rising over a desired threshold.
  1149. This limiter uses lookahead technology to prevent your signal from distorting.
  1150. It means that there is a small delay after the signal is processed. Keep in mind
  1151. that the delay it produces is the attack time you set.
  1152. The filter accepts the following options:
  1153. @table @option
  1154. @item level_in
  1155. Set input gain. Default is 1.
  1156. @item level_out
  1157. Set output gain. Default is 1.
  1158. @item limit
  1159. Don't let signals above this level pass the limiter. Default is 1.
  1160. @item attack
  1161. The limiter will reach its attenuation level in this amount of time in
  1162. milliseconds. Default is 5 milliseconds.
  1163. @item release
  1164. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1165. Default is 50 milliseconds.
  1166. @item asc
  1167. When gain reduction is always needed ASC takes care of releasing to an
  1168. average reduction level rather than reaching a reduction of 0 in the release
  1169. time.
  1170. @item asc_level
  1171. Select how much the release time is affected by ASC, 0 means nearly no changes
  1172. in release time while 1 produces higher release times.
  1173. @item level
  1174. Auto level output signal. Default is enabled.
  1175. This normalizes audio back to 0dB if enabled.
  1176. @end table
  1177. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1178. with @ref{aresample} before applying this filter.
  1179. @section allpass
  1180. Apply a two-pole all-pass filter with central frequency (in Hz)
  1181. @var{frequency}, and filter-width @var{width}.
  1182. An all-pass filter changes the audio's frequency to phase relationship
  1183. without changing its frequency to amplitude relationship.
  1184. The filter accepts the following options:
  1185. @table @option
  1186. @item frequency, f
  1187. Set frequency in Hz.
  1188. @item width_type, t
  1189. Set method to specify band-width of filter.
  1190. @table @option
  1191. @item h
  1192. Hz
  1193. @item q
  1194. Q-Factor
  1195. @item o
  1196. octave
  1197. @item s
  1198. slope
  1199. @item k
  1200. kHz
  1201. @end table
  1202. @item width, w
  1203. Specify the band-width of a filter in width_type units.
  1204. @item mix, m
  1205. How much to use filtered signal in output. Default is 1.
  1206. Range is between 0 and 1.
  1207. @item channels, c
  1208. Specify which channels to filter, by default all available are filtered.
  1209. @item normalize, n
  1210. Normalize biquad coefficients, by default is disabled.
  1211. Enabling it will normalize magnitude response at DC to 0dB.
  1212. @end table
  1213. @subsection Commands
  1214. This filter supports the following commands:
  1215. @table @option
  1216. @item frequency, f
  1217. Change allpass frequency.
  1218. Syntax for the command is : "@var{frequency}"
  1219. @item width_type, t
  1220. Change allpass width_type.
  1221. Syntax for the command is : "@var{width_type}"
  1222. @item width, w
  1223. Change allpass width.
  1224. Syntax for the command is : "@var{width}"
  1225. @item mix, m
  1226. Change allpass mix.
  1227. Syntax for the command is : "@var{mix}"
  1228. @end table
  1229. @section aloop
  1230. Loop audio samples.
  1231. The filter accepts the following options:
  1232. @table @option
  1233. @item loop
  1234. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1235. Default is 0.
  1236. @item size
  1237. Set maximal number of samples. Default is 0.
  1238. @item start
  1239. Set first sample of loop. Default is 0.
  1240. @end table
  1241. @anchor{amerge}
  1242. @section amerge
  1243. Merge two or more audio streams into a single multi-channel stream.
  1244. The filter accepts the following options:
  1245. @table @option
  1246. @item inputs
  1247. Set the number of inputs. Default is 2.
  1248. @end table
  1249. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1250. the channel layout of the output will be set accordingly and the channels
  1251. will be reordered as necessary. If the channel layouts of the inputs are not
  1252. disjoint, the output will have all the channels of the first input then all
  1253. the channels of the second input, in that order, and the channel layout of
  1254. the output will be the default value corresponding to the total number of
  1255. channels.
  1256. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1257. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1258. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1259. first input, b1 is the first channel of the second input).
  1260. On the other hand, if both input are in stereo, the output channels will be
  1261. in the default order: a1, a2, b1, b2, and the channel layout will be
  1262. arbitrarily set to 4.0, which may or may not be the expected value.
  1263. All inputs must have the same sample rate, and format.
  1264. If inputs do not have the same duration, the output will stop with the
  1265. shortest.
  1266. @subsection Examples
  1267. @itemize
  1268. @item
  1269. Merge two mono files into a stereo stream:
  1270. @example
  1271. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1272. @end example
  1273. @item
  1274. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1275. @example
  1276. 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
  1277. @end example
  1278. @end itemize
  1279. @section amix
  1280. Mixes multiple audio inputs into a single output.
  1281. Note that this filter only supports float samples (the @var{amerge}
  1282. and @var{pan} audio filters support many formats). If the @var{amix}
  1283. input has integer samples then @ref{aresample} will be automatically
  1284. inserted to perform the conversion to float samples.
  1285. For example
  1286. @example
  1287. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1288. @end example
  1289. will mix 3 input audio streams to a single output with the same duration as the
  1290. first input and a dropout transition time of 3 seconds.
  1291. It accepts the following parameters:
  1292. @table @option
  1293. @item inputs
  1294. The number of inputs. If unspecified, it defaults to 2.
  1295. @item duration
  1296. How to determine the end-of-stream.
  1297. @table @option
  1298. @item longest
  1299. The duration of the longest input. (default)
  1300. @item shortest
  1301. The duration of the shortest input.
  1302. @item first
  1303. The duration of the first input.
  1304. @end table
  1305. @item dropout_transition
  1306. The transition time, in seconds, for volume renormalization when an input
  1307. stream ends. The default value is 2 seconds.
  1308. @item weights
  1309. Specify weight of each input audio stream as sequence.
  1310. Each weight is separated by space. By default all inputs have same weight.
  1311. @end table
  1312. @subsection Commands
  1313. This filter supports the following commands:
  1314. @table @option
  1315. @item weights
  1316. Syntax is same as option with same name.
  1317. @end table
  1318. @section amultiply
  1319. Multiply first audio stream with second audio stream and store result
  1320. in output audio stream. Multiplication is done by multiplying each
  1321. sample from first stream with sample at same position from second stream.
  1322. With this element-wise multiplication one can create amplitude fades and
  1323. amplitude modulations.
  1324. @section anequalizer
  1325. High-order parametric multiband equalizer for each channel.
  1326. It accepts the following parameters:
  1327. @table @option
  1328. @item params
  1329. This option string is in format:
  1330. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1331. Each equalizer band is separated by '|'.
  1332. @table @option
  1333. @item chn
  1334. Set channel number to which equalization will be applied.
  1335. If input doesn't have that channel the entry is ignored.
  1336. @item f
  1337. Set central frequency for band.
  1338. If input doesn't have that frequency the entry is ignored.
  1339. @item w
  1340. Set band width in hertz.
  1341. @item g
  1342. Set band gain in dB.
  1343. @item t
  1344. Set filter type for band, optional, can be:
  1345. @table @samp
  1346. @item 0
  1347. Butterworth, this is default.
  1348. @item 1
  1349. Chebyshev type 1.
  1350. @item 2
  1351. Chebyshev type 2.
  1352. @end table
  1353. @end table
  1354. @item curves
  1355. With this option activated frequency response of anequalizer is displayed
  1356. in video stream.
  1357. @item size
  1358. Set video stream size. Only useful if curves option is activated.
  1359. @item mgain
  1360. Set max gain that will be displayed. Only useful if curves option is activated.
  1361. Setting this to a reasonable value makes it possible to display gain which is derived from
  1362. neighbour bands which are too close to each other and thus produce higher gain
  1363. when both are activated.
  1364. @item fscale
  1365. Set frequency scale used to draw frequency response in video output.
  1366. Can be linear or logarithmic. Default is logarithmic.
  1367. @item colors
  1368. Set color for each channel curve which is going to be displayed in video stream.
  1369. This is list of color names separated by space or by '|'.
  1370. Unrecognised or missing colors will be replaced by white color.
  1371. @end table
  1372. @subsection Examples
  1373. @itemize
  1374. @item
  1375. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1376. for first 2 channels using Chebyshev type 1 filter:
  1377. @example
  1378. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1379. @end example
  1380. @end itemize
  1381. @subsection Commands
  1382. This filter supports the following commands:
  1383. @table @option
  1384. @item change
  1385. Alter existing filter parameters.
  1386. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1387. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1388. error is returned.
  1389. @var{freq} set new frequency parameter.
  1390. @var{width} set new width parameter in herz.
  1391. @var{gain} set new gain parameter in dB.
  1392. Full filter invocation with asendcmd may look like this:
  1393. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1394. @end table
  1395. @section anlmdn
  1396. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1397. Each sample is adjusted by looking for other samples with similar contexts. This
  1398. context similarity is defined by comparing their surrounding patches of size
  1399. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1400. The filter accepts the following options:
  1401. @table @option
  1402. @item s
  1403. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1404. @item p
  1405. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1406. Default value is 2 milliseconds.
  1407. @item r
  1408. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1409. Default value is 6 milliseconds.
  1410. @item o
  1411. Set the output mode.
  1412. It accepts the following values:
  1413. @table @option
  1414. @item i
  1415. Pass input unchanged.
  1416. @item o
  1417. Pass noise filtered out.
  1418. @item n
  1419. Pass only noise.
  1420. Default value is @var{o}.
  1421. @end table
  1422. @item m
  1423. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1424. @end table
  1425. @subsection Commands
  1426. This filter supports the following commands:
  1427. @table @option
  1428. @item s
  1429. Change denoise strength. Argument is single float number.
  1430. Syntax for the command is : "@var{s}"
  1431. @item o
  1432. Change output mode.
  1433. Syntax for the command is : "i", "o" or "n" string.
  1434. @end table
  1435. @section anlms
  1436. Apply Normalized Least-Mean-Squares algorithm to the first audio stream using the second audio stream.
  1437. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1438. relate to producing the least mean square of the error signal (difference between the desired,
  1439. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1440. A description of the accepted options follows.
  1441. @table @option
  1442. @item order
  1443. Set filter order.
  1444. @item mu
  1445. Set filter mu.
  1446. @item eps
  1447. Set the filter eps.
  1448. @item leakage
  1449. Set the filter leakage.
  1450. @item out_mode
  1451. It accepts the following values:
  1452. @table @option
  1453. @item i
  1454. Pass the 1st input.
  1455. @item d
  1456. Pass the 2nd input.
  1457. @item o
  1458. Pass filtered samples.
  1459. @item n
  1460. Pass difference between desired and filtered samples.
  1461. Default value is @var{o}.
  1462. @end table
  1463. @end table
  1464. @subsection Examples
  1465. @itemize
  1466. @item
  1467. One of many usages of this filter is noise reduction, input audio is filtered
  1468. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1469. @example
  1470. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1471. @end example
  1472. @end itemize
  1473. @subsection Commands
  1474. This filter supports the same commands as options, excluding option @code{order}.
  1475. @section anull
  1476. Pass the audio source unchanged to the output.
  1477. @section apad
  1478. Pad the end of an audio stream with silence.
  1479. This can be used together with @command{ffmpeg} @option{-shortest} to
  1480. extend audio streams to the same length as the video stream.
  1481. A description of the accepted options follows.
  1482. @table @option
  1483. @item packet_size
  1484. Set silence packet size. Default value is 4096.
  1485. @item pad_len
  1486. Set the number of samples of silence to add to the end. After the
  1487. value is reached, the stream is terminated. This option is mutually
  1488. exclusive with @option{whole_len}.
  1489. @item whole_len
  1490. Set the minimum total number of samples in the output audio stream. If
  1491. the value is longer than the input audio length, silence is added to
  1492. the end, until the value is reached. This option is mutually exclusive
  1493. with @option{pad_len}.
  1494. @item pad_dur
  1495. Specify the duration of samples of silence to add. See
  1496. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1497. for the accepted syntax. Used only if set to non-zero value.
  1498. @item whole_dur
  1499. Specify the minimum total duration in the output audio stream. See
  1500. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1501. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1502. the input audio length, silence is added to the end, until the value is reached.
  1503. This option is mutually exclusive with @option{pad_dur}
  1504. @end table
  1505. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1506. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1507. the input stream indefinitely.
  1508. @subsection Examples
  1509. @itemize
  1510. @item
  1511. Add 1024 samples of silence to the end of the input:
  1512. @example
  1513. apad=pad_len=1024
  1514. @end example
  1515. @item
  1516. Make sure the audio output will contain at least 10000 samples, pad
  1517. the input with silence if required:
  1518. @example
  1519. apad=whole_len=10000
  1520. @end example
  1521. @item
  1522. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1523. video stream will always result the shortest and will be converted
  1524. until the end in the output file when using the @option{shortest}
  1525. option:
  1526. @example
  1527. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1528. @end example
  1529. @end itemize
  1530. @section aphaser
  1531. Add a phasing effect to the input audio.
  1532. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1533. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1534. A description of the accepted parameters follows.
  1535. @table @option
  1536. @item in_gain
  1537. Set input gain. Default is 0.4.
  1538. @item out_gain
  1539. Set output gain. Default is 0.74
  1540. @item delay
  1541. Set delay in milliseconds. Default is 3.0.
  1542. @item decay
  1543. Set decay. Default is 0.4.
  1544. @item speed
  1545. Set modulation speed in Hz. Default is 0.5.
  1546. @item type
  1547. Set modulation type. Default is triangular.
  1548. It accepts the following values:
  1549. @table @samp
  1550. @item triangular, t
  1551. @item sinusoidal, s
  1552. @end table
  1553. @end table
  1554. @section apulsator
  1555. Audio pulsator is something between an autopanner and a tremolo.
  1556. But it can produce funny stereo effects as well. Pulsator changes the volume
  1557. of the left and right channel based on a LFO (low frequency oscillator) with
  1558. different waveforms and shifted phases.
  1559. This filter have the ability to define an offset between left and right
  1560. channel. An offset of 0 means that both LFO shapes match each other.
  1561. The left and right channel are altered equally - a conventional tremolo.
  1562. An offset of 50% means that the shape of the right channel is exactly shifted
  1563. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1564. an autopanner. At 1 both curves match again. Every setting in between moves the
  1565. phase shift gapless between all stages and produces some "bypassing" sounds with
  1566. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1567. the 0.5) the faster the signal passes from the left to the right speaker.
  1568. The filter accepts the following options:
  1569. @table @option
  1570. @item level_in
  1571. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1572. @item level_out
  1573. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1574. @item mode
  1575. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1576. sawup or sawdown. Default is sine.
  1577. @item amount
  1578. Set modulation. Define how much of original signal is affected by the LFO.
  1579. @item offset_l
  1580. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1581. @item offset_r
  1582. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1583. @item width
  1584. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1585. @item timing
  1586. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1587. @item bpm
  1588. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1589. is set to bpm.
  1590. @item ms
  1591. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1592. is set to ms.
  1593. @item hz
  1594. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1595. if timing is set to hz.
  1596. @end table
  1597. @anchor{aresample}
  1598. @section aresample
  1599. Resample the input audio to the specified parameters, using the
  1600. libswresample library. If none are specified then the filter will
  1601. automatically convert between its input and output.
  1602. This filter is also able to stretch/squeeze the audio data to make it match
  1603. the timestamps or to inject silence / cut out audio to make it match the
  1604. timestamps, do a combination of both or do neither.
  1605. The filter accepts the syntax
  1606. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1607. expresses a sample rate and @var{resampler_options} is a list of
  1608. @var{key}=@var{value} pairs, separated by ":". See the
  1609. @ref{Resampler Options,,"Resampler Options" section in the
  1610. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1611. for the complete list of supported options.
  1612. @subsection Examples
  1613. @itemize
  1614. @item
  1615. Resample the input audio to 44100Hz:
  1616. @example
  1617. aresample=44100
  1618. @end example
  1619. @item
  1620. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1621. samples per second compensation:
  1622. @example
  1623. aresample=async=1000
  1624. @end example
  1625. @end itemize
  1626. @section areverse
  1627. Reverse an audio clip.
  1628. Warning: This filter requires memory to buffer the entire clip, so trimming
  1629. is suggested.
  1630. @subsection Examples
  1631. @itemize
  1632. @item
  1633. Take the first 5 seconds of a clip, and reverse it.
  1634. @example
  1635. atrim=end=5,areverse
  1636. @end example
  1637. @end itemize
  1638. @section arnndn
  1639. Reduce noise from speech using Recurrent Neural Networks.
  1640. This filter accepts the following options:
  1641. @table @option
  1642. @item model, m
  1643. Set train model file to load. This option is always required.
  1644. @end table
  1645. @section asetnsamples
  1646. Set the number of samples per each output audio frame.
  1647. The last output packet may contain a different number of samples, as
  1648. the filter will flush all the remaining samples when the input audio
  1649. signals its end.
  1650. The filter accepts the following options:
  1651. @table @option
  1652. @item nb_out_samples, n
  1653. Set the number of frames per each output audio frame. The number is
  1654. intended as the number of samples @emph{per each channel}.
  1655. Default value is 1024.
  1656. @item pad, p
  1657. If set to 1, the filter will pad the last audio frame with zeroes, so
  1658. that the last frame will contain the same number of samples as the
  1659. previous ones. Default value is 1.
  1660. @end table
  1661. For example, to set the number of per-frame samples to 1234 and
  1662. disable padding for the last frame, use:
  1663. @example
  1664. asetnsamples=n=1234:p=0
  1665. @end example
  1666. @section asetrate
  1667. Set the sample rate without altering the PCM data.
  1668. This will result in a change of speed and pitch.
  1669. The filter accepts the following options:
  1670. @table @option
  1671. @item sample_rate, r
  1672. Set the output sample rate. Default is 44100 Hz.
  1673. @end table
  1674. @section ashowinfo
  1675. Show a line containing various information for each input audio frame.
  1676. The input audio is not modified.
  1677. The shown line contains a sequence of key/value pairs of the form
  1678. @var{key}:@var{value}.
  1679. The following values are shown in the output:
  1680. @table @option
  1681. @item n
  1682. The (sequential) number of the input frame, starting from 0.
  1683. @item pts
  1684. The presentation timestamp of the input frame, in time base units; the time base
  1685. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1686. @item pts_time
  1687. The presentation timestamp of the input frame in seconds.
  1688. @item pos
  1689. position of the frame in the input stream, -1 if this information in
  1690. unavailable and/or meaningless (for example in case of synthetic audio)
  1691. @item fmt
  1692. The sample format.
  1693. @item chlayout
  1694. The channel layout.
  1695. @item rate
  1696. The sample rate for the audio frame.
  1697. @item nb_samples
  1698. The number of samples (per channel) in the frame.
  1699. @item checksum
  1700. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1701. audio, the data is treated as if all the planes were concatenated.
  1702. @item plane_checksums
  1703. A list of Adler-32 checksums for each data plane.
  1704. @end table
  1705. @section asoftclip
  1706. Apply audio soft clipping.
  1707. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1708. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1709. This filter accepts the following options:
  1710. @table @option
  1711. @item type
  1712. Set type of soft-clipping.
  1713. It accepts the following values:
  1714. @table @option
  1715. @item tanh
  1716. @item atan
  1717. @item cubic
  1718. @item exp
  1719. @item alg
  1720. @item quintic
  1721. @item sin
  1722. @end table
  1723. @item param
  1724. Set additional parameter which controls sigmoid function.
  1725. @end table
  1726. @subsection Commands
  1727. This filter supports the all above options as @ref{commands}.
  1728. @section asr
  1729. Automatic Speech Recognition
  1730. This filter uses PocketSphinx for speech recognition. To enable
  1731. compilation of this filter, you need to configure FFmpeg with
  1732. @code{--enable-pocketsphinx}.
  1733. It accepts the following options:
  1734. @table @option
  1735. @item rate
  1736. Set sampling rate of input audio. Defaults is @code{16000}.
  1737. This need to match speech models, otherwise one will get poor results.
  1738. @item hmm
  1739. Set dictionary containing acoustic model files.
  1740. @item dict
  1741. Set pronunciation dictionary.
  1742. @item lm
  1743. Set language model file.
  1744. @item lmctl
  1745. Set language model set.
  1746. @item lmname
  1747. Set which language model to use.
  1748. @item logfn
  1749. Set output for log messages.
  1750. @end table
  1751. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1752. @anchor{astats}
  1753. @section astats
  1754. Display time domain statistical information about the audio channels.
  1755. Statistics are calculated and displayed for each audio channel and,
  1756. where applicable, an overall figure is also given.
  1757. It accepts the following option:
  1758. @table @option
  1759. @item length
  1760. Short window length in seconds, used for peak and trough RMS measurement.
  1761. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1762. @item metadata
  1763. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1764. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1765. disabled.
  1766. Available keys for each channel are:
  1767. DC_offset
  1768. Min_level
  1769. Max_level
  1770. Min_difference
  1771. Max_difference
  1772. Mean_difference
  1773. RMS_difference
  1774. Peak_level
  1775. RMS_peak
  1776. RMS_trough
  1777. Crest_factor
  1778. Flat_factor
  1779. Peak_count
  1780. Noise_floor
  1781. Noise_floor_count
  1782. Bit_depth
  1783. Dynamic_range
  1784. Zero_crossings
  1785. Zero_crossings_rate
  1786. Number_of_NaNs
  1787. Number_of_Infs
  1788. Number_of_denormals
  1789. and for Overall:
  1790. DC_offset
  1791. Min_level
  1792. Max_level
  1793. Min_difference
  1794. Max_difference
  1795. Mean_difference
  1796. RMS_difference
  1797. Peak_level
  1798. RMS_level
  1799. RMS_peak
  1800. RMS_trough
  1801. Flat_factor
  1802. Peak_count
  1803. Noise_floor
  1804. Noise_floor_count
  1805. Bit_depth
  1806. Number_of_samples
  1807. Number_of_NaNs
  1808. Number_of_Infs
  1809. Number_of_denormals
  1810. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1811. this @code{lavfi.astats.Overall.Peak_count}.
  1812. For description what each key means read below.
  1813. @item reset
  1814. Set number of frame after which stats are going to be recalculated.
  1815. Default is disabled.
  1816. @item measure_perchannel
  1817. Select the entries which need to be measured per channel. The metadata keys can
  1818. be used as flags, default is @option{all} which measures everything.
  1819. @option{none} disables all per channel measurement.
  1820. @item measure_overall
  1821. Select the entries which need to be measured overall. The metadata keys can
  1822. be used as flags, default is @option{all} which measures everything.
  1823. @option{none} disables all overall measurement.
  1824. @end table
  1825. A description of each shown parameter follows:
  1826. @table @option
  1827. @item DC offset
  1828. Mean amplitude displacement from zero.
  1829. @item Min level
  1830. Minimal sample level.
  1831. @item Max level
  1832. Maximal sample level.
  1833. @item Min difference
  1834. Minimal difference between two consecutive samples.
  1835. @item Max difference
  1836. Maximal difference between two consecutive samples.
  1837. @item Mean difference
  1838. Mean difference between two consecutive samples.
  1839. The average of each difference between two consecutive samples.
  1840. @item RMS difference
  1841. Root Mean Square difference between two consecutive samples.
  1842. @item Peak level dB
  1843. @item RMS level dB
  1844. Standard peak and RMS level measured in dBFS.
  1845. @item RMS peak dB
  1846. @item RMS trough dB
  1847. Peak and trough values for RMS level measured over a short window.
  1848. @item Crest factor
  1849. Standard ratio of peak to RMS level (note: not in dB).
  1850. @item Flat factor
  1851. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1852. (i.e. either @var{Min level} or @var{Max level}).
  1853. @item Peak count
  1854. Number of occasions (not the number of samples) that the signal attained either
  1855. @var{Min level} or @var{Max level}.
  1856. @item Noise floor dB
  1857. Minimum local peak measured in dBFS over a short window.
  1858. @item Noise floor count
  1859. Number of occasions (not the number of samples) that the signal attained
  1860. @var{Noise floor}.
  1861. @item Bit depth
  1862. Overall bit depth of audio. Number of bits used for each sample.
  1863. @item Dynamic range
  1864. Measured dynamic range of audio in dB.
  1865. @item Zero crossings
  1866. Number of points where the waveform crosses the zero level axis.
  1867. @item Zero crossings rate
  1868. Rate of Zero crossings and number of audio samples.
  1869. @end table
  1870. @section asubboost
  1871. Boost subwoofer frequencies.
  1872. The filter accepts the following options:
  1873. @table @option
  1874. @item dry
  1875. Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
  1876. Default value is 0.5.
  1877. @item wet
  1878. Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
  1879. Default value is 0.8.
  1880. @item decay
  1881. Set delay line decay gain value. Allowed range is from 0 to 1.
  1882. Default value is 0.7.
  1883. @item feedback
  1884. Set delay line feedback gain value. Allowed range is from 0 to 1.
  1885. Default value is 0.5.
  1886. @item cutoff
  1887. Set cutoff frequency in herz. Allowed range is 50 to 900.
  1888. Default value is 100.
  1889. @item slope
  1890. Set slope amount for cutoff frequency. Allowed range is 0.0001 to 1.
  1891. Default value is 0.5.
  1892. @item delay
  1893. Set delay. Allowed range is from 1 to 100.
  1894. Default value is 20.
  1895. @end table
  1896. @subsection Commands
  1897. This filter supports the all above options as @ref{commands}.
  1898. @section atempo
  1899. Adjust audio tempo.
  1900. The filter accepts exactly one parameter, the audio tempo. If not
  1901. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1902. be in the [0.5, 100.0] range.
  1903. Note that tempo greater than 2 will skip some samples rather than
  1904. blend them in. If for any reason this is a concern it is always
  1905. possible to daisy-chain several instances of atempo to achieve the
  1906. desired product tempo.
  1907. @subsection Examples
  1908. @itemize
  1909. @item
  1910. Slow down audio to 80% tempo:
  1911. @example
  1912. atempo=0.8
  1913. @end example
  1914. @item
  1915. To speed up audio to 300% tempo:
  1916. @example
  1917. atempo=3
  1918. @end example
  1919. @item
  1920. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1921. @example
  1922. atempo=sqrt(3),atempo=sqrt(3)
  1923. @end example
  1924. @end itemize
  1925. @subsection Commands
  1926. This filter supports the following commands:
  1927. @table @option
  1928. @item tempo
  1929. Change filter tempo scale factor.
  1930. Syntax for the command is : "@var{tempo}"
  1931. @end table
  1932. @section atrim
  1933. Trim the input so that the output contains one continuous subpart of the input.
  1934. It accepts the following parameters:
  1935. @table @option
  1936. @item start
  1937. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1938. sample with the timestamp @var{start} will be the first sample in the output.
  1939. @item end
  1940. Specify time of the first audio sample that will be dropped, i.e. the
  1941. audio sample immediately preceding the one with the timestamp @var{end} will be
  1942. the last sample in the output.
  1943. @item start_pts
  1944. Same as @var{start}, except this option sets the start timestamp in samples
  1945. instead of seconds.
  1946. @item end_pts
  1947. Same as @var{end}, except this option sets the end timestamp in samples instead
  1948. of seconds.
  1949. @item duration
  1950. The maximum duration of the output in seconds.
  1951. @item start_sample
  1952. The number of the first sample that should be output.
  1953. @item end_sample
  1954. The number of the first sample that should be dropped.
  1955. @end table
  1956. @option{start}, @option{end}, and @option{duration} are expressed as time
  1957. duration specifications; see
  1958. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1959. Note that the first two sets of the start/end options and the @option{duration}
  1960. option look at the frame timestamp, while the _sample options simply count the
  1961. samples that pass through the filter. So start/end_pts and start/end_sample will
  1962. give different results when the timestamps are wrong, inexact or do not start at
  1963. zero. Also note that this filter does not modify the timestamps. If you wish
  1964. to have the output timestamps start at zero, insert the asetpts filter after the
  1965. atrim filter.
  1966. If multiple start or end options are set, this filter tries to be greedy and
  1967. keep all samples that match at least one of the specified constraints. To keep
  1968. only the part that matches all the constraints at once, chain multiple atrim
  1969. filters.
  1970. The defaults are such that all the input is kept. So it is possible to set e.g.
  1971. just the end values to keep everything before the specified time.
  1972. Examples:
  1973. @itemize
  1974. @item
  1975. Drop everything except the second minute of input:
  1976. @example
  1977. ffmpeg -i INPUT -af atrim=60:120
  1978. @end example
  1979. @item
  1980. Keep only the first 1000 samples:
  1981. @example
  1982. ffmpeg -i INPUT -af atrim=end_sample=1000
  1983. @end example
  1984. @end itemize
  1985. @section axcorrelate
  1986. Calculate normalized cross-correlation between two input audio streams.
  1987. Resulted samples are always between -1 and 1 inclusive.
  1988. If result is 1 it means two input samples are highly correlated in that selected segment.
  1989. Result 0 means they are not correlated at all.
  1990. If result is -1 it means two input samples are out of phase, which means they cancel each
  1991. other.
  1992. The filter accepts the following options:
  1993. @table @option
  1994. @item size
  1995. Set size of segment over which cross-correlation is calculated.
  1996. Default is 256. Allowed range is from 2 to 131072.
  1997. @item algo
  1998. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  1999. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  2000. are always zero and thus need much less calculations to make.
  2001. This is generally not true, but is valid for typical audio streams.
  2002. @end table
  2003. @subsection Examples
  2004. @itemize
  2005. @item
  2006. Calculate correlation between channels in stereo audio stream:
  2007. @example
  2008. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  2009. @end example
  2010. @end itemize
  2011. @section bandpass
  2012. Apply a two-pole Butterworth band-pass filter with central
  2013. frequency @var{frequency}, and (3dB-point) band-width width.
  2014. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  2015. instead of the default: constant 0dB peak gain.
  2016. The filter roll off at 6dB per octave (20dB per decade).
  2017. The filter accepts the following options:
  2018. @table @option
  2019. @item frequency, f
  2020. Set the filter's central frequency. Default is @code{3000}.
  2021. @item csg
  2022. Constant skirt gain if set to 1. Defaults to 0.
  2023. @item width_type, t
  2024. Set method to specify band-width of filter.
  2025. @table @option
  2026. @item h
  2027. Hz
  2028. @item q
  2029. Q-Factor
  2030. @item o
  2031. octave
  2032. @item s
  2033. slope
  2034. @item k
  2035. kHz
  2036. @end table
  2037. @item width, w
  2038. Specify the band-width of a filter in width_type units.
  2039. @item mix, m
  2040. How much to use filtered signal in output. Default is 1.
  2041. Range is between 0 and 1.
  2042. @item channels, c
  2043. Specify which channels to filter, by default all available are filtered.
  2044. @item normalize, n
  2045. Normalize biquad coefficients, by default is disabled.
  2046. Enabling it will normalize magnitude response at DC to 0dB.
  2047. @end table
  2048. @subsection Commands
  2049. This filter supports the following commands:
  2050. @table @option
  2051. @item frequency, f
  2052. Change bandpass frequency.
  2053. Syntax for the command is : "@var{frequency}"
  2054. @item width_type, t
  2055. Change bandpass width_type.
  2056. Syntax for the command is : "@var{width_type}"
  2057. @item width, w
  2058. Change bandpass width.
  2059. Syntax for the command is : "@var{width}"
  2060. @item mix, m
  2061. Change bandpass mix.
  2062. Syntax for the command is : "@var{mix}"
  2063. @end table
  2064. @section bandreject
  2065. Apply a two-pole Butterworth band-reject filter with central
  2066. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2067. The filter roll off at 6dB per octave (20dB per decade).
  2068. The filter accepts the following options:
  2069. @table @option
  2070. @item frequency, f
  2071. Set the filter's central frequency. Default is @code{3000}.
  2072. @item width_type, t
  2073. Set method to specify band-width of filter.
  2074. @table @option
  2075. @item h
  2076. Hz
  2077. @item q
  2078. Q-Factor
  2079. @item o
  2080. octave
  2081. @item s
  2082. slope
  2083. @item k
  2084. kHz
  2085. @end table
  2086. @item width, w
  2087. Specify the band-width of a filter in width_type units.
  2088. @item mix, m
  2089. How much to use filtered signal in output. Default is 1.
  2090. Range is between 0 and 1.
  2091. @item channels, c
  2092. Specify which channels to filter, by default all available are filtered.
  2093. @item normalize, n
  2094. Normalize biquad coefficients, by default is disabled.
  2095. Enabling it will normalize magnitude response at DC to 0dB.
  2096. @end table
  2097. @subsection Commands
  2098. This filter supports the following commands:
  2099. @table @option
  2100. @item frequency, f
  2101. Change bandreject frequency.
  2102. Syntax for the command is : "@var{frequency}"
  2103. @item width_type, t
  2104. Change bandreject width_type.
  2105. Syntax for the command is : "@var{width_type}"
  2106. @item width, w
  2107. Change bandreject width.
  2108. Syntax for the command is : "@var{width}"
  2109. @item mix, m
  2110. Change bandreject mix.
  2111. Syntax for the command is : "@var{mix}"
  2112. @end table
  2113. @section bass, lowshelf
  2114. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2115. shelving filter with a response similar to that of a standard
  2116. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2117. The filter accepts the following options:
  2118. @table @option
  2119. @item gain, g
  2120. Give the gain at 0 Hz. Its useful range is about -20
  2121. (for a large cut) to +20 (for a large boost).
  2122. Beware of clipping when using a positive gain.
  2123. @item frequency, f
  2124. Set the filter's central frequency and so can be used
  2125. to extend or reduce the frequency range to be boosted or cut.
  2126. The default value is @code{100} Hz.
  2127. @item width_type, t
  2128. Set method to specify band-width of filter.
  2129. @table @option
  2130. @item h
  2131. Hz
  2132. @item q
  2133. Q-Factor
  2134. @item o
  2135. octave
  2136. @item s
  2137. slope
  2138. @item k
  2139. kHz
  2140. @end table
  2141. @item width, w
  2142. Determine how steep is the filter's shelf transition.
  2143. @item mix, m
  2144. How much to use filtered signal in output. Default is 1.
  2145. Range is between 0 and 1.
  2146. @item channels, c
  2147. Specify which channels to filter, by default all available are filtered.
  2148. @item normalize, n
  2149. Normalize biquad coefficients, by default is disabled.
  2150. Enabling it will normalize magnitude response at DC to 0dB.
  2151. @end table
  2152. @subsection Commands
  2153. This filter supports the following commands:
  2154. @table @option
  2155. @item frequency, f
  2156. Change bass frequency.
  2157. Syntax for the command is : "@var{frequency}"
  2158. @item width_type, t
  2159. Change bass width_type.
  2160. Syntax for the command is : "@var{width_type}"
  2161. @item width, w
  2162. Change bass width.
  2163. Syntax for the command is : "@var{width}"
  2164. @item gain, g
  2165. Change bass gain.
  2166. Syntax for the command is : "@var{gain}"
  2167. @item mix, m
  2168. Change bass mix.
  2169. Syntax for the command is : "@var{mix}"
  2170. @end table
  2171. @section biquad
  2172. Apply a biquad IIR filter with the given coefficients.
  2173. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2174. are the numerator and denominator coefficients respectively.
  2175. and @var{channels}, @var{c} specify which channels to filter, by default all
  2176. available are filtered.
  2177. @subsection Commands
  2178. This filter supports the following commands:
  2179. @table @option
  2180. @item a0
  2181. @item a1
  2182. @item a2
  2183. @item b0
  2184. @item b1
  2185. @item b2
  2186. Change biquad parameter.
  2187. Syntax for the command is : "@var{value}"
  2188. @item mix, m
  2189. How much to use filtered signal in output. Default is 1.
  2190. Range is between 0 and 1.
  2191. @item channels, c
  2192. Specify which channels to filter, by default all available are filtered.
  2193. @item normalize, n
  2194. Normalize biquad coefficients, by default is disabled.
  2195. Enabling it will normalize magnitude response at DC to 0dB.
  2196. @end table
  2197. @section bs2b
  2198. Bauer stereo to binaural transformation, which improves headphone listening of
  2199. stereo audio records.
  2200. To enable compilation of this filter you need to configure FFmpeg with
  2201. @code{--enable-libbs2b}.
  2202. It accepts the following parameters:
  2203. @table @option
  2204. @item profile
  2205. Pre-defined crossfeed level.
  2206. @table @option
  2207. @item default
  2208. Default level (fcut=700, feed=50).
  2209. @item cmoy
  2210. Chu Moy circuit (fcut=700, feed=60).
  2211. @item jmeier
  2212. Jan Meier circuit (fcut=650, feed=95).
  2213. @end table
  2214. @item fcut
  2215. Cut frequency (in Hz).
  2216. @item feed
  2217. Feed level (in Hz).
  2218. @end table
  2219. @section channelmap
  2220. Remap input channels to new locations.
  2221. It accepts the following parameters:
  2222. @table @option
  2223. @item map
  2224. Map channels from input to output. The argument is a '|'-separated list of
  2225. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2226. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2227. channel (e.g. FL for front left) or its index in the input channel layout.
  2228. @var{out_channel} is the name of the output channel or its index in the output
  2229. channel layout. If @var{out_channel} is not given then it is implicitly an
  2230. index, starting with zero and increasing by one for each mapping.
  2231. @item channel_layout
  2232. The channel layout of the output stream.
  2233. @end table
  2234. If no mapping is present, the filter will implicitly map input channels to
  2235. output channels, preserving indices.
  2236. @subsection Examples
  2237. @itemize
  2238. @item
  2239. For example, assuming a 5.1+downmix input MOV file,
  2240. @example
  2241. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2242. @end example
  2243. will create an output WAV file tagged as stereo from the downmix channels of
  2244. the input.
  2245. @item
  2246. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2247. @example
  2248. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2249. @end example
  2250. @end itemize
  2251. @section channelsplit
  2252. Split each channel from an input audio stream into a separate output stream.
  2253. It accepts the following parameters:
  2254. @table @option
  2255. @item channel_layout
  2256. The channel layout of the input stream. The default is "stereo".
  2257. @item channels
  2258. A channel layout describing the channels to be extracted as separate output streams
  2259. or "all" to extract each input channel as a separate stream. The default is "all".
  2260. Choosing channels not present in channel layout in the input will result in an error.
  2261. @end table
  2262. @subsection Examples
  2263. @itemize
  2264. @item
  2265. For example, assuming a stereo input MP3 file,
  2266. @example
  2267. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2268. @end example
  2269. will create an output Matroska file with two audio streams, one containing only
  2270. the left channel and the other the right channel.
  2271. @item
  2272. Split a 5.1 WAV file into per-channel files:
  2273. @example
  2274. ffmpeg -i in.wav -filter_complex
  2275. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2276. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2277. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2278. side_right.wav
  2279. @end example
  2280. @item
  2281. Extract only LFE from a 5.1 WAV file:
  2282. @example
  2283. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2284. -map '[LFE]' lfe.wav
  2285. @end example
  2286. @end itemize
  2287. @section chorus
  2288. Add a chorus effect to the audio.
  2289. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2290. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2291. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2292. The modulation depth defines the range the modulated delay is played before or after
  2293. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2294. sound tuned around the original one, like in a chorus where some vocals are slightly
  2295. off key.
  2296. It accepts the following parameters:
  2297. @table @option
  2298. @item in_gain
  2299. Set input gain. Default is 0.4.
  2300. @item out_gain
  2301. Set output gain. Default is 0.4.
  2302. @item delays
  2303. Set delays. A typical delay is around 40ms to 60ms.
  2304. @item decays
  2305. Set decays.
  2306. @item speeds
  2307. Set speeds.
  2308. @item depths
  2309. Set depths.
  2310. @end table
  2311. @subsection Examples
  2312. @itemize
  2313. @item
  2314. A single delay:
  2315. @example
  2316. chorus=0.7:0.9:55:0.4:0.25:2
  2317. @end example
  2318. @item
  2319. Two delays:
  2320. @example
  2321. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2322. @end example
  2323. @item
  2324. Fuller sounding chorus with three delays:
  2325. @example
  2326. 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
  2327. @end example
  2328. @end itemize
  2329. @section compand
  2330. Compress or expand the audio's dynamic range.
  2331. It accepts the following parameters:
  2332. @table @option
  2333. @item attacks
  2334. @item decays
  2335. A list of times in seconds for each channel over which the instantaneous level
  2336. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2337. increase of volume and @var{decays} refers to decrease of volume. For most
  2338. situations, the attack time (response to the audio getting louder) should be
  2339. shorter than the decay time, because the human ear is more sensitive to sudden
  2340. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2341. a typical value for decay is 0.8 seconds.
  2342. If specified number of attacks & decays is lower than number of channels, the last
  2343. set attack/decay will be used for all remaining channels.
  2344. @item points
  2345. A list of points for the transfer function, specified in dB relative to the
  2346. maximum possible signal amplitude. Each key points list must be defined using
  2347. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2348. @code{x0/y0 x1/y1 x2/y2 ....}
  2349. The input values must be in strictly increasing order but the transfer function
  2350. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2351. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2352. function are @code{-70/-70|-60/-20|1/0}.
  2353. @item soft-knee
  2354. Set the curve radius in dB for all joints. It defaults to 0.01.
  2355. @item gain
  2356. Set the additional gain in dB to be applied at all points on the transfer
  2357. function. This allows for easy adjustment of the overall gain.
  2358. It defaults to 0.
  2359. @item volume
  2360. Set an initial volume, in dB, to be assumed for each channel when filtering
  2361. starts. This permits the user to supply a nominal level initially, so that, for
  2362. example, a very large gain is not applied to initial signal levels before the
  2363. companding has begun to operate. A typical value for audio which is initially
  2364. quiet is -90 dB. It defaults to 0.
  2365. @item delay
  2366. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2367. delayed before being fed to the volume adjuster. Specifying a delay
  2368. approximately equal to the attack/decay times allows the filter to effectively
  2369. operate in predictive rather than reactive mode. It defaults to 0.
  2370. @end table
  2371. @subsection Examples
  2372. @itemize
  2373. @item
  2374. Make music with both quiet and loud passages suitable for listening to in a
  2375. noisy environment:
  2376. @example
  2377. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2378. @end example
  2379. Another example for audio with whisper and explosion parts:
  2380. @example
  2381. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2382. @end example
  2383. @item
  2384. A noise gate for when the noise is at a lower level than the signal:
  2385. @example
  2386. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2387. @end example
  2388. @item
  2389. Here is another noise gate, this time for when the noise is at a higher level
  2390. than the signal (making it, in some ways, similar to squelch):
  2391. @example
  2392. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2393. @end example
  2394. @item
  2395. 2:1 compression starting at -6dB:
  2396. @example
  2397. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2398. @end example
  2399. @item
  2400. 2:1 compression starting at -9dB:
  2401. @example
  2402. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2403. @end example
  2404. @item
  2405. 2:1 compression starting at -12dB:
  2406. @example
  2407. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2408. @end example
  2409. @item
  2410. 2:1 compression starting at -18dB:
  2411. @example
  2412. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2413. @end example
  2414. @item
  2415. 3:1 compression starting at -15dB:
  2416. @example
  2417. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2418. @end example
  2419. @item
  2420. Compressor/Gate:
  2421. @example
  2422. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2423. @end example
  2424. @item
  2425. Expander:
  2426. @example
  2427. 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
  2428. @end example
  2429. @item
  2430. Hard limiter at -6dB:
  2431. @example
  2432. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2433. @end example
  2434. @item
  2435. Hard limiter at -12dB:
  2436. @example
  2437. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2438. @end example
  2439. @item
  2440. Hard noise gate at -35 dB:
  2441. @example
  2442. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2443. @end example
  2444. @item
  2445. Soft limiter:
  2446. @example
  2447. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2448. @end example
  2449. @end itemize
  2450. @section compensationdelay
  2451. Compensation Delay Line is a metric based delay to compensate differing
  2452. positions of microphones or speakers.
  2453. For example, you have recorded guitar with two microphones placed in
  2454. different locations. Because the front of sound wave has fixed speed in
  2455. normal conditions, the phasing of microphones can vary and depends on
  2456. their location and interposition. The best sound mix can be achieved when
  2457. these microphones are in phase (synchronized). Note that a distance of
  2458. ~30 cm between microphones makes one microphone capture the signal in
  2459. antiphase to the other microphone. That makes the final mix sound moody.
  2460. This filter helps to solve phasing problems by adding different delays
  2461. to each microphone track and make them synchronized.
  2462. The best result can be reached when you take one track as base and
  2463. synchronize other tracks one by one with it.
  2464. Remember that synchronization/delay tolerance depends on sample rate, too.
  2465. Higher sample rates will give more tolerance.
  2466. The filter accepts the following parameters:
  2467. @table @option
  2468. @item mm
  2469. Set millimeters distance. This is compensation distance for fine tuning.
  2470. Default is 0.
  2471. @item cm
  2472. Set cm distance. This is compensation distance for tightening distance setup.
  2473. Default is 0.
  2474. @item m
  2475. Set meters distance. This is compensation distance for hard distance setup.
  2476. Default is 0.
  2477. @item dry
  2478. Set dry amount. Amount of unprocessed (dry) signal.
  2479. Default is 0.
  2480. @item wet
  2481. Set wet amount. Amount of processed (wet) signal.
  2482. Default is 1.
  2483. @item temp
  2484. Set temperature in degrees Celsius. This is the temperature of the environment.
  2485. Default is 20.
  2486. @end table
  2487. @section crossfeed
  2488. Apply headphone crossfeed filter.
  2489. Crossfeed is the process of blending the left and right channels of stereo
  2490. audio recording.
  2491. It is mainly used to reduce extreme stereo separation of low frequencies.
  2492. The intent is to produce more speaker like sound to the listener.
  2493. The filter accepts the following options:
  2494. @table @option
  2495. @item strength
  2496. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2497. This sets gain of low shelf filter for side part of stereo image.
  2498. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2499. @item range
  2500. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2501. This sets cut off frequency of low shelf filter. Default is cut off near
  2502. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2503. @item slope
  2504. Set curve slope of low shelf filter. Default is 0.5.
  2505. Allowed range is from 0.01 to 1.
  2506. @item level_in
  2507. Set input gain. Default is 0.9.
  2508. @item level_out
  2509. Set output gain. Default is 1.
  2510. @end table
  2511. @subsection Commands
  2512. This filter supports the all above options as @ref{commands}.
  2513. @section crystalizer
  2514. Simple algorithm to expand audio dynamic range.
  2515. The filter accepts the following options:
  2516. @table @option
  2517. @item i
  2518. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2519. (unchanged sound) to 10.0 (maximum effect).
  2520. @item c
  2521. Enable clipping. By default is enabled.
  2522. @end table
  2523. @subsection Commands
  2524. This filter supports the all above options as @ref{commands}.
  2525. @section dcshift
  2526. Apply a DC shift to the audio.
  2527. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2528. in the recording chain) from the audio. The effect of a DC offset is reduced
  2529. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2530. a signal has a DC offset.
  2531. @table @option
  2532. @item shift
  2533. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2534. the audio.
  2535. @item limitergain
  2536. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2537. used to prevent clipping.
  2538. @end table
  2539. @section deesser
  2540. Apply de-essing to the audio samples.
  2541. @table @option
  2542. @item i
  2543. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2544. Default is 0.
  2545. @item m
  2546. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2547. Default is 0.5.
  2548. @item f
  2549. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2550. Default is 0.5.
  2551. @item s
  2552. Set the output mode.
  2553. It accepts the following values:
  2554. @table @option
  2555. @item i
  2556. Pass input unchanged.
  2557. @item o
  2558. Pass ess filtered out.
  2559. @item e
  2560. Pass only ess.
  2561. Default value is @var{o}.
  2562. @end table
  2563. @end table
  2564. @section drmeter
  2565. Measure audio dynamic range.
  2566. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2567. is found in transition material. And anything less that 8 have very poor dynamics
  2568. and is very compressed.
  2569. The filter accepts the following options:
  2570. @table @option
  2571. @item length
  2572. Set window length in seconds used to split audio into segments of equal length.
  2573. Default is 3 seconds.
  2574. @end table
  2575. @section dynaudnorm
  2576. Dynamic Audio Normalizer.
  2577. This filter applies a certain amount of gain to the input audio in order
  2578. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2579. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2580. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2581. This allows for applying extra gain to the "quiet" sections of the audio
  2582. while avoiding distortions or clipping the "loud" sections. In other words:
  2583. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2584. sections, in the sense that the volume of each section is brought to the
  2585. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2586. this goal *without* applying "dynamic range compressing". It will retain 100%
  2587. of the dynamic range *within* each section of the audio file.
  2588. @table @option
  2589. @item framelen, f
  2590. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2591. Default is 500 milliseconds.
  2592. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2593. referred to as frames. This is required, because a peak magnitude has no
  2594. meaning for just a single sample value. Instead, we need to determine the
  2595. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2596. normalizer would simply use the peak magnitude of the complete file, the
  2597. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2598. frame. The length of a frame is specified in milliseconds. By default, the
  2599. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2600. been found to give good results with most files.
  2601. Note that the exact frame length, in number of samples, will be determined
  2602. automatically, based on the sampling rate of the individual input audio file.
  2603. @item gausssize, g
  2604. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2605. number. Default is 31.
  2606. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2607. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2608. is specified in frames, centered around the current frame. For the sake of
  2609. simplicity, this must be an odd number. Consequently, the default value of 31
  2610. takes into account the current frame, as well as the 15 preceding frames and
  2611. the 15 subsequent frames. Using a larger window results in a stronger
  2612. smoothing effect and thus in less gain variation, i.e. slower gain
  2613. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2614. effect and thus in more gain variation, i.e. faster gain adaptation.
  2615. In other words, the more you increase this value, the more the Dynamic Audio
  2616. Normalizer will behave like a "traditional" normalization filter. On the
  2617. contrary, the more you decrease this value, the more the Dynamic Audio
  2618. Normalizer will behave like a dynamic range compressor.
  2619. @item peak, p
  2620. Set the target peak value. This specifies the highest permissible magnitude
  2621. level for the normalized audio input. This filter will try to approach the
  2622. target peak magnitude as closely as possible, but at the same time it also
  2623. makes sure that the normalized signal will never exceed the peak magnitude.
  2624. A frame's maximum local gain factor is imposed directly by the target peak
  2625. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2626. It is not recommended to go above this value.
  2627. @item maxgain, m
  2628. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2629. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2630. factor for each input frame, i.e. the maximum gain factor that does not
  2631. result in clipping or distortion. The maximum gain factor is determined by
  2632. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2633. additionally bounds the frame's maximum gain factor by a predetermined
  2634. (global) maximum gain factor. This is done in order to avoid excessive gain
  2635. factors in "silent" or almost silent frames. By default, the maximum gain
  2636. factor is 10.0, For most inputs the default value should be sufficient and
  2637. it usually is not recommended to increase this value. Though, for input
  2638. with an extremely low overall volume level, it may be necessary to allow even
  2639. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2640. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2641. Instead, a "sigmoid" threshold function will be applied. This way, the
  2642. gain factors will smoothly approach the threshold value, but never exceed that
  2643. value.
  2644. @item targetrms, r
  2645. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2646. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2647. This means that the maximum local gain factor for each frame is defined
  2648. (only) by the frame's highest magnitude sample. This way, the samples can
  2649. be amplified as much as possible without exceeding the maximum signal
  2650. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2651. Normalizer can also take into account the frame's root mean square,
  2652. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2653. determine the power of a time-varying signal. It is therefore considered
  2654. that the RMS is a better approximation of the "perceived loudness" than
  2655. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2656. frames to a constant RMS value, a uniform "perceived loudness" can be
  2657. established. If a target RMS value has been specified, a frame's local gain
  2658. factor is defined as the factor that would result in exactly that RMS value.
  2659. Note, however, that the maximum local gain factor is still restricted by the
  2660. frame's highest magnitude sample, in order to prevent clipping.
  2661. @item coupling, n
  2662. Enable channels coupling. By default is enabled.
  2663. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2664. amount. This means the same gain factor will be applied to all channels, i.e.
  2665. the maximum possible gain factor is determined by the "loudest" channel.
  2666. However, in some recordings, it may happen that the volume of the different
  2667. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2668. In this case, this option can be used to disable the channel coupling. This way,
  2669. the gain factor will be determined independently for each channel, depending
  2670. only on the individual channel's highest magnitude sample. This allows for
  2671. harmonizing the volume of the different channels.
  2672. @item correctdc, c
  2673. Enable DC bias correction. By default is disabled.
  2674. An audio signal (in the time domain) is a sequence of sample values.
  2675. In the Dynamic Audio Normalizer these sample values are represented in the
  2676. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2677. audio signal, or "waveform", should be centered around the zero point.
  2678. That means if we calculate the mean value of all samples in a file, or in a
  2679. single frame, then the result should be 0.0 or at least very close to that
  2680. value. If, however, there is a significant deviation of the mean value from
  2681. 0.0, in either positive or negative direction, this is referred to as a
  2682. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2683. Audio Normalizer provides optional DC bias correction.
  2684. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2685. the mean value, or "DC correction" offset, of each input frame and subtract
  2686. that value from all of the frame's sample values which ensures those samples
  2687. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2688. boundaries, the DC correction offset values will be interpolated smoothly
  2689. between neighbouring frames.
  2690. @item altboundary, b
  2691. Enable alternative boundary mode. By default is disabled.
  2692. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2693. around each frame. This includes the preceding frames as well as the
  2694. subsequent frames. However, for the "boundary" frames, located at the very
  2695. beginning and at the very end of the audio file, not all neighbouring
  2696. frames are available. In particular, for the first few frames in the audio
  2697. file, the preceding frames are not known. And, similarly, for the last few
  2698. frames in the audio file, the subsequent frames are not known. Thus, the
  2699. question arises which gain factors should be assumed for the missing frames
  2700. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2701. to deal with this situation. The default boundary mode assumes a gain factor
  2702. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2703. "fade out" at the beginning and at the end of the input, respectively.
  2704. @item compress, s
  2705. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2706. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2707. compression. This means that signal peaks will not be pruned and thus the
  2708. full dynamic range will be retained within each local neighbourhood. However,
  2709. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2710. normalization algorithm with a more "traditional" compression.
  2711. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2712. (thresholding) function. If (and only if) the compression feature is enabled,
  2713. all input frames will be processed by a soft knee thresholding function prior
  2714. to the actual normalization process. Put simply, the thresholding function is
  2715. going to prune all samples whose magnitude exceeds a certain threshold value.
  2716. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2717. value. Instead, the threshold value will be adjusted for each individual
  2718. frame.
  2719. In general, smaller parameters result in stronger compression, and vice versa.
  2720. Values below 3.0 are not recommended, because audible distortion may appear.
  2721. @item threshold, t
  2722. Set the target threshold value. This specifies the lowest permissible
  2723. magnitude level for the audio input which will be normalized.
  2724. If input frame volume is above this value frame will be normalized.
  2725. Otherwise frame may not be normalized at all. The default value is set
  2726. to 0, which means all input frames will be normalized.
  2727. This option is mostly useful if digital noise is not wanted to be amplified.
  2728. @end table
  2729. @subsection Commands
  2730. This filter supports the all above options as @ref{commands}.
  2731. @section earwax
  2732. Make audio easier to listen to on headphones.
  2733. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2734. so that when listened to on headphones the stereo image is moved from
  2735. inside your head (standard for headphones) to outside and in front of
  2736. the listener (standard for speakers).
  2737. Ported from SoX.
  2738. @section equalizer
  2739. Apply a two-pole peaking equalisation (EQ) filter. With this
  2740. filter, the signal-level at and around a selected frequency can
  2741. be increased or decreased, whilst (unlike bandpass and bandreject
  2742. filters) that at all other frequencies is unchanged.
  2743. In order to produce complex equalisation curves, this filter can
  2744. be given several times, each with a different central frequency.
  2745. The filter accepts the following options:
  2746. @table @option
  2747. @item frequency, f
  2748. Set the filter's central frequency in Hz.
  2749. @item width_type, t
  2750. Set method to specify band-width of filter.
  2751. @table @option
  2752. @item h
  2753. Hz
  2754. @item q
  2755. Q-Factor
  2756. @item o
  2757. octave
  2758. @item s
  2759. slope
  2760. @item k
  2761. kHz
  2762. @end table
  2763. @item width, w
  2764. Specify the band-width of a filter in width_type units.
  2765. @item gain, g
  2766. Set the required gain or attenuation in dB.
  2767. Beware of clipping when using a positive gain.
  2768. @item mix, m
  2769. How much to use filtered signal in output. Default is 1.
  2770. Range is between 0 and 1.
  2771. @item channels, c
  2772. Specify which channels to filter, by default all available are filtered.
  2773. @item normalize, n
  2774. Normalize biquad coefficients, by default is disabled.
  2775. Enabling it will normalize magnitude response at DC to 0dB.
  2776. @end table
  2777. @subsection Examples
  2778. @itemize
  2779. @item
  2780. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2781. @example
  2782. equalizer=f=1000:t=h:width=200:g=-10
  2783. @end example
  2784. @item
  2785. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2786. @example
  2787. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2788. @end example
  2789. @end itemize
  2790. @subsection Commands
  2791. This filter supports the following commands:
  2792. @table @option
  2793. @item frequency, f
  2794. Change equalizer frequency.
  2795. Syntax for the command is : "@var{frequency}"
  2796. @item width_type, t
  2797. Change equalizer width_type.
  2798. Syntax for the command is : "@var{width_type}"
  2799. @item width, w
  2800. Change equalizer width.
  2801. Syntax for the command is : "@var{width}"
  2802. @item gain, g
  2803. Change equalizer gain.
  2804. Syntax for the command is : "@var{gain}"
  2805. @item mix, m
  2806. Change equalizer mix.
  2807. Syntax for the command is : "@var{mix}"
  2808. @end table
  2809. @section extrastereo
  2810. Linearly increases the difference between left and right channels which
  2811. adds some sort of "live" effect to playback.
  2812. The filter accepts the following options:
  2813. @table @option
  2814. @item m
  2815. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2816. (average of both channels), with 1.0 sound will be unchanged, with
  2817. -1.0 left and right channels will be swapped.
  2818. @item c
  2819. Enable clipping. By default is enabled.
  2820. @end table
  2821. @subsection Commands
  2822. This filter supports the all above options as @ref{commands}.
  2823. @section firequalizer
  2824. Apply FIR Equalization using arbitrary frequency response.
  2825. The filter accepts the following option:
  2826. @table @option
  2827. @item gain
  2828. Set gain curve equation (in dB). The expression can contain variables:
  2829. @table @option
  2830. @item f
  2831. the evaluated frequency
  2832. @item sr
  2833. sample rate
  2834. @item ch
  2835. channel number, set to 0 when multichannels evaluation is disabled
  2836. @item chid
  2837. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2838. multichannels evaluation is disabled
  2839. @item chs
  2840. number of channels
  2841. @item chlayout
  2842. channel_layout, see libavutil/channel_layout.h
  2843. @end table
  2844. and functions:
  2845. @table @option
  2846. @item gain_interpolate(f)
  2847. interpolate gain on frequency f based on gain_entry
  2848. @item cubic_interpolate(f)
  2849. same as gain_interpolate, but smoother
  2850. @end table
  2851. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2852. @item gain_entry
  2853. Set gain entry for gain_interpolate function. The expression can
  2854. contain functions:
  2855. @table @option
  2856. @item entry(f, g)
  2857. store gain entry at frequency f with value g
  2858. @end table
  2859. This option is also available as command.
  2860. @item delay
  2861. Set filter delay in seconds. Higher value means more accurate.
  2862. Default is @code{0.01}.
  2863. @item accuracy
  2864. Set filter accuracy in Hz. Lower value means more accurate.
  2865. Default is @code{5}.
  2866. @item wfunc
  2867. Set window function. Acceptable values are:
  2868. @table @option
  2869. @item rectangular
  2870. rectangular window, useful when gain curve is already smooth
  2871. @item hann
  2872. hann window (default)
  2873. @item hamming
  2874. hamming window
  2875. @item blackman
  2876. blackman window
  2877. @item nuttall3
  2878. 3-terms continuous 1st derivative nuttall window
  2879. @item mnuttall3
  2880. minimum 3-terms discontinuous nuttall window
  2881. @item nuttall
  2882. 4-terms continuous 1st derivative nuttall window
  2883. @item bnuttall
  2884. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2885. @item bharris
  2886. blackman-harris window
  2887. @item tukey
  2888. tukey window
  2889. @end table
  2890. @item fixed
  2891. If enabled, use fixed number of audio samples. This improves speed when
  2892. filtering with large delay. Default is disabled.
  2893. @item multi
  2894. Enable multichannels evaluation on gain. Default is disabled.
  2895. @item zero_phase
  2896. Enable zero phase mode by subtracting timestamp to compensate delay.
  2897. Default is disabled.
  2898. @item scale
  2899. Set scale used by gain. Acceptable values are:
  2900. @table @option
  2901. @item linlin
  2902. linear frequency, linear gain
  2903. @item linlog
  2904. linear frequency, logarithmic (in dB) gain (default)
  2905. @item loglin
  2906. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2907. @item loglog
  2908. logarithmic frequency, logarithmic gain
  2909. @end table
  2910. @item dumpfile
  2911. Set file for dumping, suitable for gnuplot.
  2912. @item dumpscale
  2913. Set scale for dumpfile. Acceptable values are same with scale option.
  2914. Default is linlog.
  2915. @item fft2
  2916. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2917. Default is disabled.
  2918. @item min_phase
  2919. Enable minimum phase impulse response. Default is disabled.
  2920. @end table
  2921. @subsection Examples
  2922. @itemize
  2923. @item
  2924. lowpass at 1000 Hz:
  2925. @example
  2926. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2927. @end example
  2928. @item
  2929. lowpass at 1000 Hz with gain_entry:
  2930. @example
  2931. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2932. @end example
  2933. @item
  2934. custom equalization:
  2935. @example
  2936. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2937. @end example
  2938. @item
  2939. higher delay with zero phase to compensate delay:
  2940. @example
  2941. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2942. @end example
  2943. @item
  2944. lowpass on left channel, highpass on right channel:
  2945. @example
  2946. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2947. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2948. @end example
  2949. @end itemize
  2950. @section flanger
  2951. Apply a flanging effect to the audio.
  2952. The filter accepts the following options:
  2953. @table @option
  2954. @item delay
  2955. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2956. @item depth
  2957. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2958. @item regen
  2959. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2960. Default value is 0.
  2961. @item width
  2962. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2963. Default value is 71.
  2964. @item speed
  2965. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2966. @item shape
  2967. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2968. Default value is @var{sinusoidal}.
  2969. @item phase
  2970. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2971. Default value is 25.
  2972. @item interp
  2973. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2974. Default is @var{linear}.
  2975. @end table
  2976. @section haas
  2977. Apply Haas effect to audio.
  2978. Note that this makes most sense to apply on mono signals.
  2979. With this filter applied to mono signals it give some directionality and
  2980. stretches its stereo image.
  2981. The filter accepts the following options:
  2982. @table @option
  2983. @item level_in
  2984. Set input level. By default is @var{1}, or 0dB
  2985. @item level_out
  2986. Set output level. By default is @var{1}, or 0dB.
  2987. @item side_gain
  2988. Set gain applied to side part of signal. By default is @var{1}.
  2989. @item middle_source
  2990. Set kind of middle source. Can be one of the following:
  2991. @table @samp
  2992. @item left
  2993. Pick left channel.
  2994. @item right
  2995. Pick right channel.
  2996. @item mid
  2997. Pick middle part signal of stereo image.
  2998. @item side
  2999. Pick side part signal of stereo image.
  3000. @end table
  3001. @item middle_phase
  3002. Change middle phase. By default is disabled.
  3003. @item left_delay
  3004. Set left channel delay. By default is @var{2.05} milliseconds.
  3005. @item left_balance
  3006. Set left channel balance. By default is @var{-1}.
  3007. @item left_gain
  3008. Set left channel gain. By default is @var{1}.
  3009. @item left_phase
  3010. Change left phase. By default is disabled.
  3011. @item right_delay
  3012. Set right channel delay. By defaults is @var{2.12} milliseconds.
  3013. @item right_balance
  3014. Set right channel balance. By default is @var{1}.
  3015. @item right_gain
  3016. Set right channel gain. By default is @var{1}.
  3017. @item right_phase
  3018. Change right phase. By default is enabled.
  3019. @end table
  3020. @section hdcd
  3021. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  3022. embedded HDCD codes is expanded into a 20-bit PCM stream.
  3023. The filter supports the Peak Extend and Low-level Gain Adjustment features
  3024. of HDCD, and detects the Transient Filter flag.
  3025. @example
  3026. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  3027. @end example
  3028. When using the filter with wav, note the default encoding for wav is 16-bit,
  3029. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  3030. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  3031. @example
  3032. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  3033. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  3034. @end example
  3035. The filter accepts the following options:
  3036. @table @option
  3037. @item disable_autoconvert
  3038. Disable any automatic format conversion or resampling in the filter graph.
  3039. @item process_stereo
  3040. Process the stereo channels together. If target_gain does not match between
  3041. channels, consider it invalid and use the last valid target_gain.
  3042. @item cdt_ms
  3043. Set the code detect timer period in ms.
  3044. @item force_pe
  3045. Always extend peaks above -3dBFS even if PE isn't signaled.
  3046. @item analyze_mode
  3047. Replace audio with a solid tone and adjust the amplitude to signal some
  3048. specific aspect of the decoding process. The output file can be loaded in
  3049. an audio editor alongside the original to aid analysis.
  3050. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  3051. Modes are:
  3052. @table @samp
  3053. @item 0, off
  3054. Disabled
  3055. @item 1, lle
  3056. Gain adjustment level at each sample
  3057. @item 2, pe
  3058. Samples where peak extend occurs
  3059. @item 3, cdt
  3060. Samples where the code detect timer is active
  3061. @item 4, tgm
  3062. Samples where the target gain does not match between channels
  3063. @end table
  3064. @end table
  3065. @section headphone
  3066. Apply head-related transfer functions (HRTFs) to create virtual
  3067. loudspeakers around the user for binaural listening via headphones.
  3068. The HRIRs are provided via additional streams, for each channel
  3069. one stereo input stream is needed.
  3070. The filter accepts the following options:
  3071. @table @option
  3072. @item map
  3073. Set mapping of input streams for convolution.
  3074. The argument is a '|'-separated list of channel names in order as they
  3075. are given as additional stream inputs for filter.
  3076. This also specify number of input streams. Number of input streams
  3077. must be not less than number of channels in first stream plus one.
  3078. @item gain
  3079. Set gain applied to audio. Value is in dB. Default is 0.
  3080. @item type
  3081. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3082. processing audio in time domain which is slow.
  3083. @var{freq} is processing audio in frequency domain which is fast.
  3084. Default is @var{freq}.
  3085. @item lfe
  3086. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3087. @item size
  3088. Set size of frame in number of samples which will be processed at once.
  3089. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  3090. @item hrir
  3091. Set format of hrir stream.
  3092. Default value is @var{stereo}. Alternative value is @var{multich}.
  3093. If value is set to @var{stereo}, number of additional streams should
  3094. be greater or equal to number of input channels in first input stream.
  3095. Also each additional stream should have stereo number of channels.
  3096. If value is set to @var{multich}, number of additional streams should
  3097. be exactly one. Also number of input channels of additional stream
  3098. should be equal or greater than twice number of channels of first input
  3099. stream.
  3100. @end table
  3101. @subsection Examples
  3102. @itemize
  3103. @item
  3104. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3105. each amovie filter use stereo file with IR coefficients as input.
  3106. The files give coefficients for each position of virtual loudspeaker:
  3107. @example
  3108. ffmpeg -i input.wav
  3109. -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"
  3110. output.wav
  3111. @end example
  3112. @item
  3113. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3114. but now in @var{multich} @var{hrir} format.
  3115. @example
  3116. 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"
  3117. output.wav
  3118. @end example
  3119. @end itemize
  3120. @section highpass
  3121. Apply a high-pass filter with 3dB point frequency.
  3122. The filter can be either single-pole, or double-pole (the default).
  3123. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3124. The filter accepts the following options:
  3125. @table @option
  3126. @item frequency, f
  3127. Set frequency in Hz. Default is 3000.
  3128. @item poles, p
  3129. Set number of poles. Default is 2.
  3130. @item width_type, t
  3131. Set method to specify band-width of filter.
  3132. @table @option
  3133. @item h
  3134. Hz
  3135. @item q
  3136. Q-Factor
  3137. @item o
  3138. octave
  3139. @item s
  3140. slope
  3141. @item k
  3142. kHz
  3143. @end table
  3144. @item width, w
  3145. Specify the band-width of a filter in width_type units.
  3146. Applies only to double-pole filter.
  3147. The default is 0.707q and gives a Butterworth response.
  3148. @item mix, m
  3149. How much to use filtered signal in output. Default is 1.
  3150. Range is between 0 and 1.
  3151. @item channels, c
  3152. Specify which channels to filter, by default all available are filtered.
  3153. @item normalize, n
  3154. Normalize biquad coefficients, by default is disabled.
  3155. Enabling it will normalize magnitude response at DC to 0dB.
  3156. @end table
  3157. @subsection Commands
  3158. This filter supports the following commands:
  3159. @table @option
  3160. @item frequency, f
  3161. Change highpass frequency.
  3162. Syntax for the command is : "@var{frequency}"
  3163. @item width_type, t
  3164. Change highpass width_type.
  3165. Syntax for the command is : "@var{width_type}"
  3166. @item width, w
  3167. Change highpass width.
  3168. Syntax for the command is : "@var{width}"
  3169. @item mix, m
  3170. Change highpass mix.
  3171. Syntax for the command is : "@var{mix}"
  3172. @end table
  3173. @section join
  3174. Join multiple input streams into one multi-channel stream.
  3175. It accepts the following parameters:
  3176. @table @option
  3177. @item inputs
  3178. The number of input streams. It defaults to 2.
  3179. @item channel_layout
  3180. The desired output channel layout. It defaults to stereo.
  3181. @item map
  3182. Map channels from inputs to output. The argument is a '|'-separated list of
  3183. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3184. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3185. can be either the name of the input channel (e.g. FL for front left) or its
  3186. index in the specified input stream. @var{out_channel} is the name of the output
  3187. channel.
  3188. @end table
  3189. The filter will attempt to guess the mappings when they are not specified
  3190. explicitly. It does so by first trying to find an unused matching input channel
  3191. and if that fails it picks the first unused input channel.
  3192. Join 3 inputs (with properly set channel layouts):
  3193. @example
  3194. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3195. @end example
  3196. Build a 5.1 output from 6 single-channel streams:
  3197. @example
  3198. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3199. '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'
  3200. out
  3201. @end example
  3202. @section ladspa
  3203. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3204. To enable compilation of this filter you need to configure FFmpeg with
  3205. @code{--enable-ladspa}.
  3206. @table @option
  3207. @item file, f
  3208. Specifies the name of LADSPA plugin library to load. If the environment
  3209. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3210. each one of the directories specified by the colon separated list in
  3211. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3212. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3213. @file{/usr/lib/ladspa/}.
  3214. @item plugin, p
  3215. Specifies the plugin within the library. Some libraries contain only
  3216. one plugin, but others contain many of them. If this is not set filter
  3217. will list all available plugins within the specified library.
  3218. @item controls, c
  3219. Set the '|' separated list of controls which are zero or more floating point
  3220. values that determine the behavior of the loaded plugin (for example delay,
  3221. threshold or gain).
  3222. Controls need to be defined using the following syntax:
  3223. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3224. @var{valuei} is the value set on the @var{i}-th control.
  3225. Alternatively they can be also defined using the following syntax:
  3226. @var{value0}|@var{value1}|@var{value2}|..., where
  3227. @var{valuei} is the value set on the @var{i}-th control.
  3228. If @option{controls} is set to @code{help}, all available controls and
  3229. their valid ranges are printed.
  3230. @item sample_rate, s
  3231. Specify the sample rate, default to 44100. Only used if plugin have
  3232. zero inputs.
  3233. @item nb_samples, n
  3234. Set the number of samples per channel per each output frame, default
  3235. is 1024. Only used if plugin have zero inputs.
  3236. @item duration, d
  3237. Set the minimum duration of the sourced audio. See
  3238. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3239. for the accepted syntax.
  3240. Note that the resulting duration may be greater than the specified duration,
  3241. as the generated audio is always cut at the end of a complete frame.
  3242. If not specified, or the expressed duration is negative, the audio is
  3243. supposed to be generated forever.
  3244. Only used if plugin have zero inputs.
  3245. @end table
  3246. @subsection Examples
  3247. @itemize
  3248. @item
  3249. List all available plugins within amp (LADSPA example plugin) library:
  3250. @example
  3251. ladspa=file=amp
  3252. @end example
  3253. @item
  3254. List all available controls and their valid ranges for @code{vcf_notch}
  3255. plugin from @code{VCF} library:
  3256. @example
  3257. ladspa=f=vcf:p=vcf_notch:c=help
  3258. @end example
  3259. @item
  3260. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3261. plugin library:
  3262. @example
  3263. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3264. @end example
  3265. @item
  3266. Add reverberation to the audio using TAP-plugins
  3267. (Tom's Audio Processing plugins):
  3268. @example
  3269. ladspa=file=tap_reverb:tap_reverb
  3270. @end example
  3271. @item
  3272. Generate white noise, with 0.2 amplitude:
  3273. @example
  3274. ladspa=file=cmt:noise_source_white:c=c0=.2
  3275. @end example
  3276. @item
  3277. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3278. @code{C* Audio Plugin Suite} (CAPS) library:
  3279. @example
  3280. ladspa=file=caps:Click:c=c1=20'
  3281. @end example
  3282. @item
  3283. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3284. @example
  3285. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3286. @end example
  3287. @item
  3288. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3289. @code{SWH Plugins} collection:
  3290. @example
  3291. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3292. @end example
  3293. @item
  3294. Attenuate low frequencies using Multiband EQ from Steve Harris
  3295. @code{SWH Plugins} collection:
  3296. @example
  3297. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3298. @end example
  3299. @item
  3300. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3301. (CAPS) library:
  3302. @example
  3303. ladspa=caps:Narrower
  3304. @end example
  3305. @item
  3306. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3307. @example
  3308. ladspa=caps:White:.2
  3309. @end example
  3310. @item
  3311. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3312. @example
  3313. ladspa=caps:Fractal:c=c1=1
  3314. @end example
  3315. @item
  3316. Dynamic volume normalization using @code{VLevel} plugin:
  3317. @example
  3318. ladspa=vlevel-ladspa:vlevel_mono
  3319. @end example
  3320. @end itemize
  3321. @subsection Commands
  3322. This filter supports the following commands:
  3323. @table @option
  3324. @item cN
  3325. Modify the @var{N}-th control value.
  3326. If the specified value is not valid, it is ignored and prior one is kept.
  3327. @end table
  3328. @section loudnorm
  3329. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3330. Support for both single pass (livestreams, files) and double pass (files) modes.
  3331. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  3332. detect true peaks, the audio stream will be upsampled to 192 kHz.
  3333. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3334. The filter accepts the following options:
  3335. @table @option
  3336. @item I, i
  3337. Set integrated loudness target.
  3338. Range is -70.0 - -5.0. Default value is -24.0.
  3339. @item LRA, lra
  3340. Set loudness range target.
  3341. Range is 1.0 - 20.0. Default value is 7.0.
  3342. @item TP, tp
  3343. Set maximum true peak.
  3344. Range is -9.0 - +0.0. Default value is -2.0.
  3345. @item measured_I, measured_i
  3346. Measured IL of input file.
  3347. Range is -99.0 - +0.0.
  3348. @item measured_LRA, measured_lra
  3349. Measured LRA of input file.
  3350. Range is 0.0 - 99.0.
  3351. @item measured_TP, measured_tp
  3352. Measured true peak of input file.
  3353. Range is -99.0 - +99.0.
  3354. @item measured_thresh
  3355. Measured threshold of input file.
  3356. Range is -99.0 - +0.0.
  3357. @item offset
  3358. Set offset gain. Gain is applied before the true-peak limiter.
  3359. Range is -99.0 - +99.0. Default is +0.0.
  3360. @item linear
  3361. Normalize by linearly scaling the source audio.
  3362. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  3363. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  3364. be lower than source LRA and the change in integrated loudness shouldn't
  3365. result in a true peak which exceeds the target TP. If any of these
  3366. conditions aren't met, normalization mode will revert to @var{dynamic}.
  3367. Options are @code{true} or @code{false}. Default is @code{true}.
  3368. @item dual_mono
  3369. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3370. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3371. If set to @code{true}, this option will compensate for this effect.
  3372. Multi-channel input files are not affected by this option.
  3373. Options are true or false. Default is false.
  3374. @item print_format
  3375. Set print format for stats. Options are summary, json, or none.
  3376. Default value is none.
  3377. @end table
  3378. @section lowpass
  3379. Apply a low-pass filter with 3dB point frequency.
  3380. The filter can be either single-pole or double-pole (the default).
  3381. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3382. The filter accepts the following options:
  3383. @table @option
  3384. @item frequency, f
  3385. Set frequency in Hz. Default is 500.
  3386. @item poles, p
  3387. Set number of poles. Default is 2.
  3388. @item width_type, t
  3389. Set method to specify band-width of filter.
  3390. @table @option
  3391. @item h
  3392. Hz
  3393. @item q
  3394. Q-Factor
  3395. @item o
  3396. octave
  3397. @item s
  3398. slope
  3399. @item k
  3400. kHz
  3401. @end table
  3402. @item width, w
  3403. Specify the band-width of a filter in width_type units.
  3404. Applies only to double-pole filter.
  3405. The default is 0.707q and gives a Butterworth response.
  3406. @item mix, m
  3407. How much to use filtered signal in output. Default is 1.
  3408. Range is between 0 and 1.
  3409. @item channels, c
  3410. Specify which channels to filter, by default all available are filtered.
  3411. @item normalize, n
  3412. Normalize biquad coefficients, by default is disabled.
  3413. Enabling it will normalize magnitude response at DC to 0dB.
  3414. @end table
  3415. @subsection Examples
  3416. @itemize
  3417. @item
  3418. Lowpass only LFE channel, it LFE is not present it does nothing:
  3419. @example
  3420. lowpass=c=LFE
  3421. @end example
  3422. @end itemize
  3423. @subsection Commands
  3424. This filter supports the following commands:
  3425. @table @option
  3426. @item frequency, f
  3427. Change lowpass frequency.
  3428. Syntax for the command is : "@var{frequency}"
  3429. @item width_type, t
  3430. Change lowpass width_type.
  3431. Syntax for the command is : "@var{width_type}"
  3432. @item width, w
  3433. Change lowpass width.
  3434. Syntax for the command is : "@var{width}"
  3435. @item mix, m
  3436. Change lowpass mix.
  3437. Syntax for the command is : "@var{mix}"
  3438. @end table
  3439. @section lv2
  3440. Load a LV2 (LADSPA Version 2) plugin.
  3441. To enable compilation of this filter you need to configure FFmpeg with
  3442. @code{--enable-lv2}.
  3443. @table @option
  3444. @item plugin, p
  3445. Specifies the plugin URI. You may need to escape ':'.
  3446. @item controls, c
  3447. Set the '|' separated list of controls which are zero or more floating point
  3448. values that determine the behavior of the loaded plugin (for example delay,
  3449. threshold or gain).
  3450. If @option{controls} is set to @code{help}, all available controls and
  3451. their valid ranges are printed.
  3452. @item sample_rate, s
  3453. Specify the sample rate, default to 44100. Only used if plugin have
  3454. zero inputs.
  3455. @item nb_samples, n
  3456. Set the number of samples per channel per each output frame, default
  3457. is 1024. Only used if plugin have zero inputs.
  3458. @item duration, d
  3459. Set the minimum duration of the sourced audio. See
  3460. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3461. for the accepted syntax.
  3462. Note that the resulting duration may be greater than the specified duration,
  3463. as the generated audio is always cut at the end of a complete frame.
  3464. If not specified, or the expressed duration is negative, the audio is
  3465. supposed to be generated forever.
  3466. Only used if plugin have zero inputs.
  3467. @end table
  3468. @subsection Examples
  3469. @itemize
  3470. @item
  3471. Apply bass enhancer plugin from Calf:
  3472. @example
  3473. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3474. @end example
  3475. @item
  3476. Apply vinyl plugin from Calf:
  3477. @example
  3478. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3479. @end example
  3480. @item
  3481. Apply bit crusher plugin from ArtyFX:
  3482. @example
  3483. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3484. @end example
  3485. @end itemize
  3486. @section mcompand
  3487. Multiband Compress or expand the audio's dynamic range.
  3488. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3489. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3490. response when absent compander action.
  3491. It accepts the following parameters:
  3492. @table @option
  3493. @item args
  3494. This option syntax is:
  3495. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3496. For explanation of each item refer to compand filter documentation.
  3497. @end table
  3498. @anchor{pan}
  3499. @section pan
  3500. Mix channels with specific gain levels. The filter accepts the output
  3501. channel layout followed by a set of channels definitions.
  3502. This filter is also designed to efficiently remap the channels of an audio
  3503. stream.
  3504. The filter accepts parameters of the form:
  3505. "@var{l}|@var{outdef}|@var{outdef}|..."
  3506. @table @option
  3507. @item l
  3508. output channel layout or number of channels
  3509. @item outdef
  3510. output channel specification, of the form:
  3511. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3512. @item out_name
  3513. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3514. number (c0, c1, etc.)
  3515. @item gain
  3516. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3517. @item in_name
  3518. input channel to use, see out_name for details; it is not possible to mix
  3519. named and numbered input channels
  3520. @end table
  3521. If the `=' in a channel specification is replaced by `<', then the gains for
  3522. that specification will be renormalized so that the total is 1, thus
  3523. avoiding clipping noise.
  3524. @subsection Mixing examples
  3525. For example, if you want to down-mix from stereo to mono, but with a bigger
  3526. factor for the left channel:
  3527. @example
  3528. pan=1c|c0=0.9*c0+0.1*c1
  3529. @end example
  3530. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3531. 7-channels surround:
  3532. @example
  3533. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3534. @end example
  3535. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3536. that should be preferred (see "-ac" option) unless you have very specific
  3537. needs.
  3538. @subsection Remapping examples
  3539. The channel remapping will be effective if, and only if:
  3540. @itemize
  3541. @item gain coefficients are zeroes or ones,
  3542. @item only one input per channel output,
  3543. @end itemize
  3544. If all these conditions are satisfied, the filter will notify the user ("Pure
  3545. channel mapping detected"), and use an optimized and lossless method to do the
  3546. remapping.
  3547. For example, if you have a 5.1 source and want a stereo audio stream by
  3548. dropping the extra channels:
  3549. @example
  3550. pan="stereo| c0=FL | c1=FR"
  3551. @end example
  3552. Given the same source, you can also switch front left and front right channels
  3553. and keep the input channel layout:
  3554. @example
  3555. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3556. @end example
  3557. If the input is a stereo audio stream, you can mute the front left channel (and
  3558. still keep the stereo channel layout) with:
  3559. @example
  3560. pan="stereo|c1=c1"
  3561. @end example
  3562. Still with a stereo audio stream input, you can copy the right channel in both
  3563. front left and right:
  3564. @example
  3565. pan="stereo| c0=FR | c1=FR"
  3566. @end example
  3567. @section replaygain
  3568. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3569. outputs it unchanged.
  3570. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3571. @section resample
  3572. Convert the audio sample format, sample rate and channel layout. It is
  3573. not meant to be used directly.
  3574. @section rubberband
  3575. Apply time-stretching and pitch-shifting with librubberband.
  3576. To enable compilation of this filter, you need to configure FFmpeg with
  3577. @code{--enable-librubberband}.
  3578. The filter accepts the following options:
  3579. @table @option
  3580. @item tempo
  3581. Set tempo scale factor.
  3582. @item pitch
  3583. Set pitch scale factor.
  3584. @item transients
  3585. Set transients detector.
  3586. Possible values are:
  3587. @table @var
  3588. @item crisp
  3589. @item mixed
  3590. @item smooth
  3591. @end table
  3592. @item detector
  3593. Set detector.
  3594. Possible values are:
  3595. @table @var
  3596. @item compound
  3597. @item percussive
  3598. @item soft
  3599. @end table
  3600. @item phase
  3601. Set phase.
  3602. Possible values are:
  3603. @table @var
  3604. @item laminar
  3605. @item independent
  3606. @end table
  3607. @item window
  3608. Set processing window size.
  3609. Possible values are:
  3610. @table @var
  3611. @item standard
  3612. @item short
  3613. @item long
  3614. @end table
  3615. @item smoothing
  3616. Set smoothing.
  3617. Possible values are:
  3618. @table @var
  3619. @item off
  3620. @item on
  3621. @end table
  3622. @item formant
  3623. Enable formant preservation when shift pitching.
  3624. Possible values are:
  3625. @table @var
  3626. @item shifted
  3627. @item preserved
  3628. @end table
  3629. @item pitchq
  3630. Set pitch quality.
  3631. Possible values are:
  3632. @table @var
  3633. @item quality
  3634. @item speed
  3635. @item consistency
  3636. @end table
  3637. @item channels
  3638. Set channels.
  3639. Possible values are:
  3640. @table @var
  3641. @item apart
  3642. @item together
  3643. @end table
  3644. @end table
  3645. @subsection Commands
  3646. This filter supports the following commands:
  3647. @table @option
  3648. @item tempo
  3649. Change filter tempo scale factor.
  3650. Syntax for the command is : "@var{tempo}"
  3651. @item pitch
  3652. Change filter pitch scale factor.
  3653. Syntax for the command is : "@var{pitch}"
  3654. @end table
  3655. @section sidechaincompress
  3656. This filter acts like normal compressor but has the ability to compress
  3657. detected signal using second input signal.
  3658. It needs two input streams and returns one output stream.
  3659. First input stream will be processed depending on second stream signal.
  3660. The filtered signal then can be filtered with other filters in later stages of
  3661. processing. See @ref{pan} and @ref{amerge} filter.
  3662. The filter accepts the following options:
  3663. @table @option
  3664. @item level_in
  3665. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3666. @item mode
  3667. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3668. Default is @code{downward}.
  3669. @item threshold
  3670. If a signal of second stream raises above this level it will affect the gain
  3671. reduction of first stream.
  3672. By default is 0.125. Range is between 0.00097563 and 1.
  3673. @item ratio
  3674. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3675. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3676. Default is 2. Range is between 1 and 20.
  3677. @item attack
  3678. Amount of milliseconds the signal has to rise above the threshold before gain
  3679. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3680. @item release
  3681. Amount of milliseconds the signal has to fall below the threshold before
  3682. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3683. @item makeup
  3684. Set the amount by how much signal will be amplified after processing.
  3685. Default is 1. Range is from 1 to 64.
  3686. @item knee
  3687. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3688. Default is 2.82843. Range is between 1 and 8.
  3689. @item link
  3690. Choose if the @code{average} level between all channels of side-chain stream
  3691. or the louder(@code{maximum}) channel of side-chain stream affects the
  3692. reduction. Default is @code{average}.
  3693. @item detection
  3694. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3695. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3696. @item level_sc
  3697. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3698. @item mix
  3699. How much to use compressed signal in output. Default is 1.
  3700. Range is between 0 and 1.
  3701. @end table
  3702. @subsection Commands
  3703. This filter supports the all above options as @ref{commands}.
  3704. @subsection Examples
  3705. @itemize
  3706. @item
  3707. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3708. depending on the signal of 2nd input and later compressed signal to be
  3709. merged with 2nd input:
  3710. @example
  3711. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3712. @end example
  3713. @end itemize
  3714. @section sidechaingate
  3715. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3716. filter the detected signal before sending it to the gain reduction stage.
  3717. Normally a gate uses the full range signal to detect a level above the
  3718. threshold.
  3719. For example: If you cut all lower frequencies from your sidechain signal
  3720. the gate will decrease the volume of your track only if not enough highs
  3721. appear. With this technique you are able to reduce the resonation of a
  3722. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3723. guitar.
  3724. It needs two input streams and returns one output stream.
  3725. First input stream will be processed depending on second stream signal.
  3726. The filter accepts the following options:
  3727. @table @option
  3728. @item level_in
  3729. Set input level before filtering.
  3730. Default is 1. Allowed range is from 0.015625 to 64.
  3731. @item mode
  3732. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3733. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3734. will be amplified, expanding dynamic range in upward direction.
  3735. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3736. @item range
  3737. Set the level of gain reduction when the signal is below the threshold.
  3738. Default is 0.06125. Allowed range is from 0 to 1.
  3739. Setting this to 0 disables reduction and then filter behaves like expander.
  3740. @item threshold
  3741. If a signal rises above this level the gain reduction is released.
  3742. Default is 0.125. Allowed range is from 0 to 1.
  3743. @item ratio
  3744. Set a ratio about which the signal is reduced.
  3745. Default is 2. Allowed range is from 1 to 9000.
  3746. @item attack
  3747. Amount of milliseconds the signal has to rise above the threshold before gain
  3748. reduction stops.
  3749. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3750. @item release
  3751. Amount of milliseconds the signal has to fall below the threshold before the
  3752. reduction is increased again. Default is 250 milliseconds.
  3753. Allowed range is from 0.01 to 9000.
  3754. @item makeup
  3755. Set amount of amplification of signal after processing.
  3756. Default is 1. Allowed range is from 1 to 64.
  3757. @item knee
  3758. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3759. Default is 2.828427125. Allowed range is from 1 to 8.
  3760. @item detection
  3761. Choose if exact signal should be taken for detection or an RMS like one.
  3762. Default is rms. Can be peak or rms.
  3763. @item link
  3764. Choose if the average level between all channels or the louder channel affects
  3765. the reduction.
  3766. Default is average. Can be average or maximum.
  3767. @item level_sc
  3768. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3769. @end table
  3770. @section silencedetect
  3771. Detect silence in an audio stream.
  3772. This filter logs a message when it detects that the input audio volume is less
  3773. or equal to a noise tolerance value for a duration greater or equal to the
  3774. minimum detected noise duration.
  3775. The printed times and duration are expressed in seconds. The
  3776. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  3777. is set on the first frame whose timestamp equals or exceeds the detection
  3778. duration and it contains the timestamp of the first frame of the silence.
  3779. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  3780. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  3781. keys are set on the first frame after the silence. If @option{mono} is
  3782. enabled, and each channel is evaluated separately, the @code{.X}
  3783. suffixed keys are used, and @code{X} corresponds to the channel number.
  3784. The filter accepts the following options:
  3785. @table @option
  3786. @item noise, n
  3787. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3788. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3789. @item duration, d
  3790. Set silence duration until notification (default is 2 seconds). See
  3791. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3792. for the accepted syntax.
  3793. @item mono, m
  3794. Process each channel separately, instead of combined. By default is disabled.
  3795. @end table
  3796. @subsection Examples
  3797. @itemize
  3798. @item
  3799. Detect 5 seconds of silence with -50dB noise tolerance:
  3800. @example
  3801. silencedetect=n=-50dB:d=5
  3802. @end example
  3803. @item
  3804. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3805. tolerance in @file{silence.mp3}:
  3806. @example
  3807. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3808. @end example
  3809. @end itemize
  3810. @section silenceremove
  3811. Remove silence from the beginning, middle or end of the audio.
  3812. The filter accepts the following options:
  3813. @table @option
  3814. @item start_periods
  3815. This value is used to indicate if audio should be trimmed at beginning of
  3816. the audio. A value of zero indicates no silence should be trimmed from the
  3817. beginning. When specifying a non-zero value, it trims audio up until it
  3818. finds non-silence. Normally, when trimming silence from beginning of audio
  3819. the @var{start_periods} will be @code{1} but it can be increased to higher
  3820. values to trim all audio up to specific count of non-silence periods.
  3821. Default value is @code{0}.
  3822. @item start_duration
  3823. Specify the amount of time that non-silence must be detected before it stops
  3824. trimming audio. By increasing the duration, bursts of noises can be treated
  3825. as silence and trimmed off. Default value is @code{0}.
  3826. @item start_threshold
  3827. This indicates what sample value should be treated as silence. For digital
  3828. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3829. you may wish to increase the value to account for background noise.
  3830. Can be specified in dB (in case "dB" is appended to the specified value)
  3831. or amplitude ratio. Default value is @code{0}.
  3832. @item start_silence
  3833. Specify max duration of silence at beginning that will be kept after
  3834. trimming. Default is 0, which is equal to trimming all samples detected
  3835. as silence.
  3836. @item start_mode
  3837. Specify mode of detection of silence end in start of multi-channel audio.
  3838. Can be @var{any} or @var{all}. Default is @var{any}.
  3839. With @var{any}, any sample that is detected as non-silence will cause
  3840. stopped trimming of silence.
  3841. With @var{all}, only if all channels are detected as non-silence will cause
  3842. stopped trimming of silence.
  3843. @item stop_periods
  3844. Set the count for trimming silence from the end of audio.
  3845. To remove silence from the middle of a file, specify a @var{stop_periods}
  3846. that is negative. This value is then treated as a positive value and is
  3847. used to indicate the effect should restart processing as specified by
  3848. @var{start_periods}, making it suitable for removing periods of silence
  3849. in the middle of the audio.
  3850. Default value is @code{0}.
  3851. @item stop_duration
  3852. Specify a duration of silence that must exist before audio is not copied any
  3853. more. By specifying a higher duration, silence that is wanted can be left in
  3854. the audio.
  3855. Default value is @code{0}.
  3856. @item stop_threshold
  3857. This is the same as @option{start_threshold} but for trimming silence from
  3858. the end of audio.
  3859. Can be specified in dB (in case "dB" is appended to the specified value)
  3860. or amplitude ratio. Default value is @code{0}.
  3861. @item stop_silence
  3862. Specify max duration of silence at end that will be kept after
  3863. trimming. Default is 0, which is equal to trimming all samples detected
  3864. as silence.
  3865. @item stop_mode
  3866. Specify mode of detection of silence start in end of multi-channel audio.
  3867. Can be @var{any} or @var{all}. Default is @var{any}.
  3868. With @var{any}, any sample that is detected as non-silence will cause
  3869. stopped trimming of silence.
  3870. With @var{all}, only if all channels are detected as non-silence will cause
  3871. stopped trimming of silence.
  3872. @item detection
  3873. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3874. and works better with digital silence which is exactly 0.
  3875. Default value is @code{rms}.
  3876. @item window
  3877. Set duration in number of seconds used to calculate size of window in number
  3878. of samples for detecting silence.
  3879. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3880. @end table
  3881. @subsection Examples
  3882. @itemize
  3883. @item
  3884. The following example shows how this filter can be used to start a recording
  3885. that does not contain the delay at the start which usually occurs between
  3886. pressing the record button and the start of the performance:
  3887. @example
  3888. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3889. @end example
  3890. @item
  3891. Trim all silence encountered from beginning to end where there is more than 1
  3892. second of silence in audio:
  3893. @example
  3894. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3895. @end example
  3896. @item
  3897. Trim all digital silence samples, using peak detection, from beginning to end
  3898. where there is more than 0 samples of digital silence in audio and digital
  3899. silence is detected in all channels at same positions in stream:
  3900. @example
  3901. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  3902. @end example
  3903. @end itemize
  3904. @section sofalizer
  3905. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3906. loudspeakers around the user for binaural listening via headphones (audio
  3907. formats up to 9 channels supported).
  3908. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3909. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3910. Austrian Academy of Sciences.
  3911. To enable compilation of this filter you need to configure FFmpeg with
  3912. @code{--enable-libmysofa}.
  3913. The filter accepts the following options:
  3914. @table @option
  3915. @item sofa
  3916. Set the SOFA file used for rendering.
  3917. @item gain
  3918. Set gain applied to audio. Value is in dB. Default is 0.
  3919. @item rotation
  3920. Set rotation of virtual loudspeakers in deg. Default is 0.
  3921. @item elevation
  3922. Set elevation of virtual speakers in deg. Default is 0.
  3923. @item radius
  3924. Set distance in meters between loudspeakers and the listener with near-field
  3925. HRTFs. Default is 1.
  3926. @item type
  3927. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3928. processing audio in time domain which is slow.
  3929. @var{freq} is processing audio in frequency domain which is fast.
  3930. Default is @var{freq}.
  3931. @item speakers
  3932. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3933. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3934. Each virtual loudspeaker is described with short channel name following with
  3935. azimuth and elevation in degrees.
  3936. Each virtual loudspeaker description is separated by '|'.
  3937. For example to override front left and front right channel positions use:
  3938. 'speakers=FL 45 15|FR 345 15'.
  3939. Descriptions with unrecognised channel names are ignored.
  3940. @item lfegain
  3941. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3942. @item framesize
  3943. Set custom frame size in number of samples. Default is 1024.
  3944. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3945. is set to @var{freq}.
  3946. @item normalize
  3947. Should all IRs be normalized upon importing SOFA file.
  3948. By default is enabled.
  3949. @item interpolate
  3950. Should nearest IRs be interpolated with neighbor IRs if exact position
  3951. does not match. By default is disabled.
  3952. @item minphase
  3953. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3954. @item anglestep
  3955. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3956. @item radstep
  3957. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3958. @end table
  3959. @subsection Examples
  3960. @itemize
  3961. @item
  3962. Using ClubFritz6 sofa file:
  3963. @example
  3964. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3965. @end example
  3966. @item
  3967. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3968. @example
  3969. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3970. @end example
  3971. @item
  3972. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3973. and also with custom gain:
  3974. @example
  3975. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3976. @end example
  3977. @end itemize
  3978. @section stereotools
  3979. This filter has some handy utilities to manage stereo signals, for converting
  3980. M/S stereo recordings to L/R signal while having control over the parameters
  3981. or spreading the stereo image of master track.
  3982. The filter accepts the following options:
  3983. @table @option
  3984. @item level_in
  3985. Set input level before filtering for both channels. Defaults is 1.
  3986. Allowed range is from 0.015625 to 64.
  3987. @item level_out
  3988. Set output level after filtering for both channels. Defaults is 1.
  3989. Allowed range is from 0.015625 to 64.
  3990. @item balance_in
  3991. Set input balance between both channels. Default is 0.
  3992. Allowed range is from -1 to 1.
  3993. @item balance_out
  3994. Set output balance between both channels. Default is 0.
  3995. Allowed range is from -1 to 1.
  3996. @item softclip
  3997. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3998. clipping. Disabled by default.
  3999. @item mutel
  4000. Mute the left channel. Disabled by default.
  4001. @item muter
  4002. Mute the right channel. Disabled by default.
  4003. @item phasel
  4004. Change the phase of the left channel. Disabled by default.
  4005. @item phaser
  4006. Change the phase of the right channel. Disabled by default.
  4007. @item mode
  4008. Set stereo mode. Available values are:
  4009. @table @samp
  4010. @item lr>lr
  4011. Left/Right to Left/Right, this is default.
  4012. @item lr>ms
  4013. Left/Right to Mid/Side.
  4014. @item ms>lr
  4015. Mid/Side to Left/Right.
  4016. @item lr>ll
  4017. Left/Right to Left/Left.
  4018. @item lr>rr
  4019. Left/Right to Right/Right.
  4020. @item lr>l+r
  4021. Left/Right to Left + Right.
  4022. @item lr>rl
  4023. Left/Right to Right/Left.
  4024. @item ms>ll
  4025. Mid/Side to Left/Left.
  4026. @item ms>rr
  4027. Mid/Side to Right/Right.
  4028. @end table
  4029. @item slev
  4030. Set level of side signal. Default is 1.
  4031. Allowed range is from 0.015625 to 64.
  4032. @item sbal
  4033. Set balance of side signal. Default is 0.
  4034. Allowed range is from -1 to 1.
  4035. @item mlev
  4036. Set level of the middle signal. Default is 1.
  4037. Allowed range is from 0.015625 to 64.
  4038. @item mpan
  4039. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  4040. @item base
  4041. Set stereo base between mono and inversed channels. Default is 0.
  4042. Allowed range is from -1 to 1.
  4043. @item delay
  4044. Set delay in milliseconds how much to delay left from right channel and
  4045. vice versa. Default is 0. Allowed range is from -20 to 20.
  4046. @item sclevel
  4047. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  4048. @item phase
  4049. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  4050. @item bmode_in, bmode_out
  4051. Set balance mode for balance_in/balance_out option.
  4052. Can be one of the following:
  4053. @table @samp
  4054. @item balance
  4055. Classic balance mode. Attenuate one channel at time.
  4056. Gain is raised up to 1.
  4057. @item amplitude
  4058. Similar as classic mode above but gain is raised up to 2.
  4059. @item power
  4060. Equal power distribution, from -6dB to +6dB range.
  4061. @end table
  4062. @end table
  4063. @subsection Examples
  4064. @itemize
  4065. @item
  4066. Apply karaoke like effect:
  4067. @example
  4068. stereotools=mlev=0.015625
  4069. @end example
  4070. @item
  4071. Convert M/S signal to L/R:
  4072. @example
  4073. "stereotools=mode=ms>lr"
  4074. @end example
  4075. @end itemize
  4076. @section stereowiden
  4077. This filter enhance the stereo effect by suppressing signal common to both
  4078. channels and by delaying the signal of left into right and vice versa,
  4079. thereby widening the stereo effect.
  4080. The filter accepts the following options:
  4081. @table @option
  4082. @item delay
  4083. Time in milliseconds of the delay of left signal into right and vice versa.
  4084. Default is 20 milliseconds.
  4085. @item feedback
  4086. Amount of gain in delayed signal into right and vice versa. Gives a delay
  4087. effect of left signal in right output and vice versa which gives widening
  4088. effect. Default is 0.3.
  4089. @item crossfeed
  4090. Cross feed of left into right with inverted phase. This helps in suppressing
  4091. the mono. If the value is 1 it will cancel all the signal common to both
  4092. channels. Default is 0.3.
  4093. @item drymix
  4094. Set level of input signal of original channel. Default is 0.8.
  4095. @end table
  4096. @subsection Commands
  4097. This filter supports the all above options except @code{delay} as @ref{commands}.
  4098. @section superequalizer
  4099. Apply 18 band equalizer.
  4100. The filter accepts the following options:
  4101. @table @option
  4102. @item 1b
  4103. Set 65Hz band gain.
  4104. @item 2b
  4105. Set 92Hz band gain.
  4106. @item 3b
  4107. Set 131Hz band gain.
  4108. @item 4b
  4109. Set 185Hz band gain.
  4110. @item 5b
  4111. Set 262Hz band gain.
  4112. @item 6b
  4113. Set 370Hz band gain.
  4114. @item 7b
  4115. Set 523Hz band gain.
  4116. @item 8b
  4117. Set 740Hz band gain.
  4118. @item 9b
  4119. Set 1047Hz band gain.
  4120. @item 10b
  4121. Set 1480Hz band gain.
  4122. @item 11b
  4123. Set 2093Hz band gain.
  4124. @item 12b
  4125. Set 2960Hz band gain.
  4126. @item 13b
  4127. Set 4186Hz band gain.
  4128. @item 14b
  4129. Set 5920Hz band gain.
  4130. @item 15b
  4131. Set 8372Hz band gain.
  4132. @item 16b
  4133. Set 11840Hz band gain.
  4134. @item 17b
  4135. Set 16744Hz band gain.
  4136. @item 18b
  4137. Set 20000Hz band gain.
  4138. @end table
  4139. @section surround
  4140. Apply audio surround upmix filter.
  4141. This filter allows to produce multichannel output from audio stream.
  4142. The filter accepts the following options:
  4143. @table @option
  4144. @item chl_out
  4145. Set output channel layout. By default, this is @var{5.1}.
  4146. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4147. for the required syntax.
  4148. @item chl_in
  4149. Set input channel layout. By default, this is @var{stereo}.
  4150. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4151. for the required syntax.
  4152. @item level_in
  4153. Set input volume level. By default, this is @var{1}.
  4154. @item level_out
  4155. Set output volume level. By default, this is @var{1}.
  4156. @item lfe
  4157. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  4158. @item lfe_low
  4159. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  4160. @item lfe_high
  4161. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  4162. @item lfe_mode
  4163. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  4164. In @var{add} mode, LFE channel is created from input audio and added to output.
  4165. In @var{sub} mode, LFE channel is created from input audio and added to output but
  4166. also all non-LFE output channels are subtracted with output LFE channel.
  4167. @item angle
  4168. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  4169. Default is @var{90}.
  4170. @item fc_in
  4171. Set front center input volume. By default, this is @var{1}.
  4172. @item fc_out
  4173. Set front center output volume. By default, this is @var{1}.
  4174. @item fl_in
  4175. Set front left input volume. By default, this is @var{1}.
  4176. @item fl_out
  4177. Set front left output volume. By default, this is @var{1}.
  4178. @item fr_in
  4179. Set front right input volume. By default, this is @var{1}.
  4180. @item fr_out
  4181. Set front right output volume. By default, this is @var{1}.
  4182. @item sl_in
  4183. Set side left input volume. By default, this is @var{1}.
  4184. @item sl_out
  4185. Set side left output volume. By default, this is @var{1}.
  4186. @item sr_in
  4187. Set side right input volume. By default, this is @var{1}.
  4188. @item sr_out
  4189. Set side right output volume. By default, this is @var{1}.
  4190. @item bl_in
  4191. Set back left input volume. By default, this is @var{1}.
  4192. @item bl_out
  4193. Set back left output volume. By default, this is @var{1}.
  4194. @item br_in
  4195. Set back right input volume. By default, this is @var{1}.
  4196. @item br_out
  4197. Set back right output volume. By default, this is @var{1}.
  4198. @item bc_in
  4199. Set back center input volume. By default, this is @var{1}.
  4200. @item bc_out
  4201. Set back center output volume. By default, this is @var{1}.
  4202. @item lfe_in
  4203. Set LFE input volume. By default, this is @var{1}.
  4204. @item lfe_out
  4205. Set LFE output volume. By default, this is @var{1}.
  4206. @item allx
  4207. Set spread usage of stereo image across X axis for all channels.
  4208. @item ally
  4209. Set spread usage of stereo image across Y axis for all channels.
  4210. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4211. Set spread usage of stereo image across X axis for each channel.
  4212. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4213. Set spread usage of stereo image across Y axis for each channel.
  4214. @item win_size
  4215. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4216. @item win_func
  4217. Set window function.
  4218. It accepts the following values:
  4219. @table @samp
  4220. @item rect
  4221. @item bartlett
  4222. @item hann, hanning
  4223. @item hamming
  4224. @item blackman
  4225. @item welch
  4226. @item flattop
  4227. @item bharris
  4228. @item bnuttall
  4229. @item bhann
  4230. @item sine
  4231. @item nuttall
  4232. @item lanczos
  4233. @item gauss
  4234. @item tukey
  4235. @item dolph
  4236. @item cauchy
  4237. @item parzen
  4238. @item poisson
  4239. @item bohman
  4240. @end table
  4241. Default is @code{hann}.
  4242. @item overlap
  4243. Set window overlap. If set to 1, the recommended overlap for selected
  4244. window function will be picked. Default is @code{0.5}.
  4245. @end table
  4246. @section treble, highshelf
  4247. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4248. shelving filter with a response similar to that of a standard
  4249. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4250. The filter accepts the following options:
  4251. @table @option
  4252. @item gain, g
  4253. Give the gain at whichever is the lower of ~22 kHz and the
  4254. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4255. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4256. @item frequency, f
  4257. Set the filter's central frequency and so can be used
  4258. to extend or reduce the frequency range to be boosted or cut.
  4259. The default value is @code{3000} Hz.
  4260. @item width_type, t
  4261. Set method to specify band-width of filter.
  4262. @table @option
  4263. @item h
  4264. Hz
  4265. @item q
  4266. Q-Factor
  4267. @item o
  4268. octave
  4269. @item s
  4270. slope
  4271. @item k
  4272. kHz
  4273. @end table
  4274. @item width, w
  4275. Determine how steep is the filter's shelf transition.
  4276. @item mix, m
  4277. How much to use filtered signal in output. Default is 1.
  4278. Range is between 0 and 1.
  4279. @item channels, c
  4280. Specify which channels to filter, by default all available are filtered.
  4281. @item normalize, n
  4282. Normalize biquad coefficients, by default is disabled.
  4283. Enabling it will normalize magnitude response at DC to 0dB.
  4284. @end table
  4285. @subsection Commands
  4286. This filter supports the following commands:
  4287. @table @option
  4288. @item frequency, f
  4289. Change treble frequency.
  4290. Syntax for the command is : "@var{frequency}"
  4291. @item width_type, t
  4292. Change treble width_type.
  4293. Syntax for the command is : "@var{width_type}"
  4294. @item width, w
  4295. Change treble width.
  4296. Syntax for the command is : "@var{width}"
  4297. @item gain, g
  4298. Change treble gain.
  4299. Syntax for the command is : "@var{gain}"
  4300. @item mix, m
  4301. Change treble mix.
  4302. Syntax for the command is : "@var{mix}"
  4303. @end table
  4304. @section tremolo
  4305. Sinusoidal amplitude modulation.
  4306. The filter accepts the following options:
  4307. @table @option
  4308. @item f
  4309. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4310. (20 Hz or lower) will result in a tremolo effect.
  4311. This filter may also be used as a ring modulator by specifying
  4312. a modulation frequency higher than 20 Hz.
  4313. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4314. @item d
  4315. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4316. Default value is 0.5.
  4317. @end table
  4318. @section vibrato
  4319. Sinusoidal phase modulation.
  4320. The filter accepts the following options:
  4321. @table @option
  4322. @item f
  4323. Modulation frequency in Hertz.
  4324. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4325. @item d
  4326. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4327. Default value is 0.5.
  4328. @end table
  4329. @section volume
  4330. Adjust the input audio volume.
  4331. It accepts the following parameters:
  4332. @table @option
  4333. @item volume
  4334. Set audio volume expression.
  4335. Output values are clipped to the maximum value.
  4336. The output audio volume is given by the relation:
  4337. @example
  4338. @var{output_volume} = @var{volume} * @var{input_volume}
  4339. @end example
  4340. The default value for @var{volume} is "1.0".
  4341. @item precision
  4342. This parameter represents the mathematical precision.
  4343. It determines which input sample formats will be allowed, which affects the
  4344. precision of the volume scaling.
  4345. @table @option
  4346. @item fixed
  4347. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4348. @item float
  4349. 32-bit floating-point; this limits input sample format to FLT. (default)
  4350. @item double
  4351. 64-bit floating-point; this limits input sample format to DBL.
  4352. @end table
  4353. @item replaygain
  4354. Choose the behaviour on encountering ReplayGain side data in input frames.
  4355. @table @option
  4356. @item drop
  4357. Remove ReplayGain side data, ignoring its contents (the default).
  4358. @item ignore
  4359. Ignore ReplayGain side data, but leave it in the frame.
  4360. @item track
  4361. Prefer the track gain, if present.
  4362. @item album
  4363. Prefer the album gain, if present.
  4364. @end table
  4365. @item replaygain_preamp
  4366. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4367. Default value for @var{replaygain_preamp} is 0.0.
  4368. @item replaygain_noclip
  4369. Prevent clipping by limiting the gain applied.
  4370. Default value for @var{replaygain_noclip} is 1.
  4371. @item eval
  4372. Set when the volume expression is evaluated.
  4373. It accepts the following values:
  4374. @table @samp
  4375. @item once
  4376. only evaluate expression once during the filter initialization, or
  4377. when the @samp{volume} command is sent
  4378. @item frame
  4379. evaluate expression for each incoming frame
  4380. @end table
  4381. Default value is @samp{once}.
  4382. @end table
  4383. The volume expression can contain the following parameters.
  4384. @table @option
  4385. @item n
  4386. frame number (starting at zero)
  4387. @item nb_channels
  4388. number of channels
  4389. @item nb_consumed_samples
  4390. number of samples consumed by the filter
  4391. @item nb_samples
  4392. number of samples in the current frame
  4393. @item pos
  4394. original frame position in the file
  4395. @item pts
  4396. frame PTS
  4397. @item sample_rate
  4398. sample rate
  4399. @item startpts
  4400. PTS at start of stream
  4401. @item startt
  4402. time at start of stream
  4403. @item t
  4404. frame time
  4405. @item tb
  4406. timestamp timebase
  4407. @item volume
  4408. last set volume value
  4409. @end table
  4410. Note that when @option{eval} is set to @samp{once} only the
  4411. @var{sample_rate} and @var{tb} variables are available, all other
  4412. variables will evaluate to NAN.
  4413. @subsection Commands
  4414. This filter supports the following commands:
  4415. @table @option
  4416. @item volume
  4417. Modify the volume expression.
  4418. The command accepts the same syntax of the corresponding option.
  4419. If the specified expression is not valid, it is kept at its current
  4420. value.
  4421. @end table
  4422. @subsection Examples
  4423. @itemize
  4424. @item
  4425. Halve the input audio volume:
  4426. @example
  4427. volume=volume=0.5
  4428. volume=volume=1/2
  4429. volume=volume=-6.0206dB
  4430. @end example
  4431. In all the above example the named key for @option{volume} can be
  4432. omitted, for example like in:
  4433. @example
  4434. volume=0.5
  4435. @end example
  4436. @item
  4437. Increase input audio power by 6 decibels using fixed-point precision:
  4438. @example
  4439. volume=volume=6dB:precision=fixed
  4440. @end example
  4441. @item
  4442. Fade volume after time 10 with an annihilation period of 5 seconds:
  4443. @example
  4444. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4445. @end example
  4446. @end itemize
  4447. @section volumedetect
  4448. Detect the volume of the input video.
  4449. The filter has no parameters. The input is not modified. Statistics about
  4450. the volume will be printed in the log when the input stream end is reached.
  4451. In particular it will show the mean volume (root mean square), maximum
  4452. volume (on a per-sample basis), and the beginning of a histogram of the
  4453. registered volume values (from the maximum value to a cumulated 1/1000 of
  4454. the samples).
  4455. All volumes are in decibels relative to the maximum PCM value.
  4456. @subsection Examples
  4457. Here is an excerpt of the output:
  4458. @example
  4459. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4460. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4461. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4462. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4463. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4464. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4465. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4466. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4467. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4468. @end example
  4469. It means that:
  4470. @itemize
  4471. @item
  4472. The mean square energy is approximately -27 dB, or 10^-2.7.
  4473. @item
  4474. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4475. @item
  4476. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4477. @end itemize
  4478. In other words, raising the volume by +4 dB does not cause any clipping,
  4479. raising it by +5 dB causes clipping for 6 samples, etc.
  4480. @c man end AUDIO FILTERS
  4481. @chapter Audio Sources
  4482. @c man begin AUDIO SOURCES
  4483. Below is a description of the currently available audio sources.
  4484. @section abuffer
  4485. Buffer audio frames, and make them available to the filter chain.
  4486. This source is mainly intended for a programmatic use, in particular
  4487. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4488. It accepts the following parameters:
  4489. @table @option
  4490. @item time_base
  4491. The timebase which will be used for timestamps of submitted frames. It must be
  4492. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4493. @item sample_rate
  4494. The sample rate of the incoming audio buffers.
  4495. @item sample_fmt
  4496. The sample format of the incoming audio buffers.
  4497. Either a sample format name or its corresponding integer representation from
  4498. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4499. @item channel_layout
  4500. The channel layout of the incoming audio buffers.
  4501. Either a channel layout name from channel_layout_map in
  4502. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4503. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4504. @item channels
  4505. The number of channels of the incoming audio buffers.
  4506. If both @var{channels} and @var{channel_layout} are specified, then they
  4507. must be consistent.
  4508. @end table
  4509. @subsection Examples
  4510. @example
  4511. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4512. @end example
  4513. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4514. Since the sample format with name "s16p" corresponds to the number
  4515. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4516. equivalent to:
  4517. @example
  4518. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4519. @end example
  4520. @section aevalsrc
  4521. Generate an audio signal specified by an expression.
  4522. This source accepts in input one or more expressions (one for each
  4523. channel), which are evaluated and used to generate a corresponding
  4524. audio signal.
  4525. This source accepts the following options:
  4526. @table @option
  4527. @item exprs
  4528. Set the '|'-separated expressions list for each separate channel. In case the
  4529. @option{channel_layout} option is not specified, the selected channel layout
  4530. depends on the number of provided expressions. Otherwise the last
  4531. specified expression is applied to the remaining output channels.
  4532. @item channel_layout, c
  4533. Set the channel layout. The number of channels in the specified layout
  4534. must be equal to the number of specified expressions.
  4535. @item duration, d
  4536. Set the minimum duration of the sourced audio. See
  4537. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4538. for the accepted syntax.
  4539. Note that the resulting duration may be greater than the specified
  4540. duration, as the generated audio is always cut at the end of a
  4541. complete frame.
  4542. If not specified, or the expressed duration is negative, the audio is
  4543. supposed to be generated forever.
  4544. @item nb_samples, n
  4545. Set the number of samples per channel per each output frame,
  4546. default to 1024.
  4547. @item sample_rate, s
  4548. Specify the sample rate, default to 44100.
  4549. @end table
  4550. Each expression in @var{exprs} can contain the following constants:
  4551. @table @option
  4552. @item n
  4553. number of the evaluated sample, starting from 0
  4554. @item t
  4555. time of the evaluated sample expressed in seconds, starting from 0
  4556. @item s
  4557. sample rate
  4558. @end table
  4559. @subsection Examples
  4560. @itemize
  4561. @item
  4562. Generate silence:
  4563. @example
  4564. aevalsrc=0
  4565. @end example
  4566. @item
  4567. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4568. 8000 Hz:
  4569. @example
  4570. aevalsrc="sin(440*2*PI*t):s=8000"
  4571. @end example
  4572. @item
  4573. Generate a two channels signal, specify the channel layout (Front
  4574. Center + Back Center) explicitly:
  4575. @example
  4576. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4577. @end example
  4578. @item
  4579. Generate white noise:
  4580. @example
  4581. aevalsrc="-2+random(0)"
  4582. @end example
  4583. @item
  4584. Generate an amplitude modulated signal:
  4585. @example
  4586. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4587. @end example
  4588. @item
  4589. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4590. @example
  4591. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4592. @end example
  4593. @end itemize
  4594. @section afirsrc
  4595. Generate a FIR coefficients using frequency sampling method.
  4596. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4597. The filter accepts the following options:
  4598. @table @option
  4599. @item taps, t
  4600. Set number of filter coefficents in output audio stream.
  4601. Default value is 1025.
  4602. @item frequency, f
  4603. Set frequency points from where magnitude and phase are set.
  4604. This must be in non decreasing order, and first element must be 0, while last element
  4605. must be 1. Elements are separated by white spaces.
  4606. @item magnitude, m
  4607. Set magnitude value for every frequency point set by @option{frequency}.
  4608. Number of values must be same as number of frequency points.
  4609. Values are separated by white spaces.
  4610. @item phase, p
  4611. Set phase value for every frequency point set by @option{frequency}.
  4612. Number of values must be same as number of frequency points.
  4613. Values are separated by white spaces.
  4614. @item sample_rate, r
  4615. Set sample rate, default is 44100.
  4616. @item nb_samples, n
  4617. Set number of samples per each frame. Default is 1024.
  4618. @item win_func, w
  4619. Set window function. Default is blackman.
  4620. @end table
  4621. @section anullsrc
  4622. The null audio source, return unprocessed audio frames. It is mainly useful
  4623. as a template and to be employed in analysis / debugging tools, or as
  4624. the source for filters which ignore the input data (for example the sox
  4625. synth filter).
  4626. This source accepts the following options:
  4627. @table @option
  4628. @item channel_layout, cl
  4629. Specifies the channel layout, and can be either an integer or a string
  4630. representing a channel layout. The default value of @var{channel_layout}
  4631. is "stereo".
  4632. Check the channel_layout_map definition in
  4633. @file{libavutil/channel_layout.c} for the mapping between strings and
  4634. channel layout values.
  4635. @item sample_rate, r
  4636. Specifies the sample rate, and defaults to 44100.
  4637. @item nb_samples, n
  4638. Set the number of samples per requested frames.
  4639. @end table
  4640. @subsection Examples
  4641. @itemize
  4642. @item
  4643. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4644. @example
  4645. anullsrc=r=48000:cl=4
  4646. @end example
  4647. @item
  4648. Do the same operation with a more obvious syntax:
  4649. @example
  4650. anullsrc=r=48000:cl=mono
  4651. @end example
  4652. @end itemize
  4653. All the parameters need to be explicitly defined.
  4654. @section flite
  4655. Synthesize a voice utterance using the libflite library.
  4656. To enable compilation of this filter you need to configure FFmpeg with
  4657. @code{--enable-libflite}.
  4658. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4659. The filter accepts the following options:
  4660. @table @option
  4661. @item list_voices
  4662. If set to 1, list the names of the available voices and exit
  4663. immediately. Default value is 0.
  4664. @item nb_samples, n
  4665. Set the maximum number of samples per frame. Default value is 512.
  4666. @item textfile
  4667. Set the filename containing the text to speak.
  4668. @item text
  4669. Set the text to speak.
  4670. @item voice, v
  4671. Set the voice to use for the speech synthesis. Default value is
  4672. @code{kal}. See also the @var{list_voices} option.
  4673. @end table
  4674. @subsection Examples
  4675. @itemize
  4676. @item
  4677. Read from file @file{speech.txt}, and synthesize the text using the
  4678. standard flite voice:
  4679. @example
  4680. flite=textfile=speech.txt
  4681. @end example
  4682. @item
  4683. Read the specified text selecting the @code{slt} voice:
  4684. @example
  4685. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4686. @end example
  4687. @item
  4688. Input text to ffmpeg:
  4689. @example
  4690. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4691. @end example
  4692. @item
  4693. Make @file{ffplay} speak the specified text, using @code{flite} and
  4694. the @code{lavfi} device:
  4695. @example
  4696. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4697. @end example
  4698. @end itemize
  4699. For more information about libflite, check:
  4700. @url{http://www.festvox.org/flite/}
  4701. @section anoisesrc
  4702. Generate a noise audio signal.
  4703. The filter accepts the following options:
  4704. @table @option
  4705. @item sample_rate, r
  4706. Specify the sample rate. Default value is 48000 Hz.
  4707. @item amplitude, a
  4708. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4709. is 1.0.
  4710. @item duration, d
  4711. Specify the duration of the generated audio stream. Not specifying this option
  4712. results in noise with an infinite length.
  4713. @item color, colour, c
  4714. Specify the color of noise. Available noise colors are white, pink, brown,
  4715. blue, violet and velvet. Default color is white.
  4716. @item seed, s
  4717. Specify a value used to seed the PRNG.
  4718. @item nb_samples, n
  4719. Set the number of samples per each output frame, default is 1024.
  4720. @end table
  4721. @subsection Examples
  4722. @itemize
  4723. @item
  4724. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4725. @example
  4726. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4727. @end example
  4728. @end itemize
  4729. @section hilbert
  4730. Generate odd-tap Hilbert transform FIR coefficients.
  4731. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4732. the signal by 90 degrees.
  4733. This is used in many matrix coding schemes and for analytic signal generation.
  4734. The process is often written as a multiplication by i (or j), the imaginary unit.
  4735. The filter accepts the following options:
  4736. @table @option
  4737. @item sample_rate, s
  4738. Set sample rate, default is 44100.
  4739. @item taps, t
  4740. Set length of FIR filter, default is 22051.
  4741. @item nb_samples, n
  4742. Set number of samples per each frame.
  4743. @item win_func, w
  4744. Set window function to be used when generating FIR coefficients.
  4745. @end table
  4746. @section sinc
  4747. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4748. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4749. The filter accepts the following options:
  4750. @table @option
  4751. @item sample_rate, r
  4752. Set sample rate, default is 44100.
  4753. @item nb_samples, n
  4754. Set number of samples per each frame. Default is 1024.
  4755. @item hp
  4756. Set high-pass frequency. Default is 0.
  4757. @item lp
  4758. Set low-pass frequency. Default is 0.
  4759. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4760. is higher than 0 then filter will create band-pass filter coefficients,
  4761. otherwise band-reject filter coefficients.
  4762. @item phase
  4763. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4764. @item beta
  4765. Set Kaiser window beta.
  4766. @item att
  4767. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4768. @item round
  4769. Enable rounding, by default is disabled.
  4770. @item hptaps
  4771. Set number of taps for high-pass filter.
  4772. @item lptaps
  4773. Set number of taps for low-pass filter.
  4774. @end table
  4775. @section sine
  4776. Generate an audio signal made of a sine wave with amplitude 1/8.
  4777. The audio signal is bit-exact.
  4778. The filter accepts the following options:
  4779. @table @option
  4780. @item frequency, f
  4781. Set the carrier frequency. Default is 440 Hz.
  4782. @item beep_factor, b
  4783. Enable a periodic beep every second with frequency @var{beep_factor} times
  4784. the carrier frequency. Default is 0, meaning the beep is disabled.
  4785. @item sample_rate, r
  4786. Specify the sample rate, default is 44100.
  4787. @item duration, d
  4788. Specify the duration of the generated audio stream.
  4789. @item samples_per_frame
  4790. Set the number of samples per output frame.
  4791. The expression can contain the following constants:
  4792. @table @option
  4793. @item n
  4794. The (sequential) number of the output audio frame, starting from 0.
  4795. @item pts
  4796. The PTS (Presentation TimeStamp) of the output audio frame,
  4797. expressed in @var{TB} units.
  4798. @item t
  4799. The PTS of the output audio frame, expressed in seconds.
  4800. @item TB
  4801. The timebase of the output audio frames.
  4802. @end table
  4803. Default is @code{1024}.
  4804. @end table
  4805. @subsection Examples
  4806. @itemize
  4807. @item
  4808. Generate a simple 440 Hz sine wave:
  4809. @example
  4810. sine
  4811. @end example
  4812. @item
  4813. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4814. @example
  4815. sine=220:4:d=5
  4816. sine=f=220:b=4:d=5
  4817. sine=frequency=220:beep_factor=4:duration=5
  4818. @end example
  4819. @item
  4820. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4821. pattern:
  4822. @example
  4823. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4824. @end example
  4825. @end itemize
  4826. @c man end AUDIO SOURCES
  4827. @chapter Audio Sinks
  4828. @c man begin AUDIO SINKS
  4829. Below is a description of the currently available audio sinks.
  4830. @section abuffersink
  4831. Buffer audio frames, and make them available to the end of filter chain.
  4832. This sink is mainly intended for programmatic use, in particular
  4833. through the interface defined in @file{libavfilter/buffersink.h}
  4834. or the options system.
  4835. It accepts a pointer to an AVABufferSinkContext structure, which
  4836. defines the incoming buffers' formats, to be passed as the opaque
  4837. parameter to @code{avfilter_init_filter} for initialization.
  4838. @section anullsink
  4839. Null audio sink; do absolutely nothing with the input audio. It is
  4840. mainly useful as a template and for use in analysis / debugging
  4841. tools.
  4842. @c man end AUDIO SINKS
  4843. @chapter Video Filters
  4844. @c man begin VIDEO FILTERS
  4845. When you configure your FFmpeg build, you can disable any of the
  4846. existing filters using @code{--disable-filters}.
  4847. The configure output will show the video filters included in your
  4848. build.
  4849. Below is a description of the currently available video filters.
  4850. @section addroi
  4851. Mark a region of interest in a video frame.
  4852. The frame data is passed through unchanged, but metadata is attached
  4853. to the frame indicating regions of interest which can affect the
  4854. behaviour of later encoding. Multiple regions can be marked by
  4855. applying the filter multiple times.
  4856. @table @option
  4857. @item x
  4858. Region distance in pixels from the left edge of the frame.
  4859. @item y
  4860. Region distance in pixels from the top edge of the frame.
  4861. @item w
  4862. Region width in pixels.
  4863. @item h
  4864. Region height in pixels.
  4865. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  4866. and may contain the following variables:
  4867. @table @option
  4868. @item iw
  4869. Width of the input frame.
  4870. @item ih
  4871. Height of the input frame.
  4872. @end table
  4873. @item qoffset
  4874. Quantisation offset to apply within the region.
  4875. This must be a real value in the range -1 to +1. A value of zero
  4876. indicates no quality change. A negative value asks for better quality
  4877. (less quantisation), while a positive value asks for worse quality
  4878. (greater quantisation).
  4879. The range is calibrated so that the extreme values indicate the
  4880. largest possible offset - if the rest of the frame is encoded with the
  4881. worst possible quality, an offset of -1 indicates that this region
  4882. should be encoded with the best possible quality anyway. Intermediate
  4883. values are then interpolated in some codec-dependent way.
  4884. For example, in 10-bit H.264 the quantisation parameter varies between
  4885. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  4886. this region should be encoded with a QP around one-tenth of the full
  4887. range better than the rest of the frame. So, if most of the frame
  4888. were to be encoded with a QP of around 30, this region would get a QP
  4889. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  4890. An extreme value of -1 would indicate that this region should be
  4891. encoded with the best possible quality regardless of the treatment of
  4892. the rest of the frame - that is, should be encoded at a QP of -12.
  4893. @item clear
  4894. If set to true, remove any existing regions of interest marked on the
  4895. frame before adding the new one.
  4896. @end table
  4897. @subsection Examples
  4898. @itemize
  4899. @item
  4900. Mark the centre quarter of the frame as interesting.
  4901. @example
  4902. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  4903. @end example
  4904. @item
  4905. Mark the 100-pixel-wide region on the left edge of the frame as very
  4906. uninteresting (to be encoded at much lower quality than the rest of
  4907. the frame).
  4908. @example
  4909. addroi=0:0:100:ih:+1/5
  4910. @end example
  4911. @end itemize
  4912. @section alphaextract
  4913. Extract the alpha component from the input as a grayscale video. This
  4914. is especially useful with the @var{alphamerge} filter.
  4915. @section alphamerge
  4916. Add or replace the alpha component of the primary input with the
  4917. grayscale value of a second input. This is intended for use with
  4918. @var{alphaextract} to allow the transmission or storage of frame
  4919. sequences that have alpha in a format that doesn't support an alpha
  4920. channel.
  4921. For example, to reconstruct full frames from a normal YUV-encoded video
  4922. and a separate video created with @var{alphaextract}, you might use:
  4923. @example
  4924. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4925. @end example
  4926. Since this filter is designed for reconstruction, it operates on frame
  4927. sequences without considering timestamps, and terminates when either
  4928. input reaches end of stream. This will cause problems if your encoding
  4929. pipeline drops frames. If you're trying to apply an image as an
  4930. overlay to a video stream, consider the @var{overlay} filter instead.
  4931. @section amplify
  4932. Amplify differences between current pixel and pixels of adjacent frames in
  4933. same pixel location.
  4934. This filter accepts the following options:
  4935. @table @option
  4936. @item radius
  4937. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4938. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4939. @item factor
  4940. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4941. @item threshold
  4942. Set threshold for difference amplification. Any difference greater or equal to
  4943. this value will not alter source pixel. Default is 10.
  4944. Allowed range is from 0 to 65535.
  4945. @item tolerance
  4946. Set tolerance for difference amplification. Any difference lower to
  4947. this value will not alter source pixel. Default is 0.
  4948. Allowed range is from 0 to 65535.
  4949. @item low
  4950. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4951. This option controls maximum possible value that will decrease source pixel value.
  4952. @item high
  4953. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4954. This option controls maximum possible value that will increase source pixel value.
  4955. @item planes
  4956. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4957. @end table
  4958. @subsection Commands
  4959. This filter supports the following @ref{commands} that corresponds to option of same name:
  4960. @table @option
  4961. @item factor
  4962. @item threshold
  4963. @item tolerance
  4964. @item low
  4965. @item high
  4966. @item planes
  4967. @end table
  4968. @section ass
  4969. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4970. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4971. Substation Alpha) subtitles files.
  4972. This filter accepts the following option in addition to the common options from
  4973. the @ref{subtitles} filter:
  4974. @table @option
  4975. @item shaping
  4976. Set the shaping engine
  4977. Available values are:
  4978. @table @samp
  4979. @item auto
  4980. The default libass shaping engine, which is the best available.
  4981. @item simple
  4982. Fast, font-agnostic shaper that can do only substitutions
  4983. @item complex
  4984. Slower shaper using OpenType for substitutions and positioning
  4985. @end table
  4986. The default is @code{auto}.
  4987. @end table
  4988. @section atadenoise
  4989. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4990. The filter accepts the following options:
  4991. @table @option
  4992. @item 0a
  4993. Set threshold A for 1st plane. Default is 0.02.
  4994. Valid range is 0 to 0.3.
  4995. @item 0b
  4996. Set threshold B for 1st plane. Default is 0.04.
  4997. Valid range is 0 to 5.
  4998. @item 1a
  4999. Set threshold A for 2nd plane. Default is 0.02.
  5000. Valid range is 0 to 0.3.
  5001. @item 1b
  5002. Set threshold B for 2nd plane. Default is 0.04.
  5003. Valid range is 0 to 5.
  5004. @item 2a
  5005. Set threshold A for 3rd plane. Default is 0.02.
  5006. Valid range is 0 to 0.3.
  5007. @item 2b
  5008. Set threshold B for 3rd plane. Default is 0.04.
  5009. Valid range is 0 to 5.
  5010. Threshold A is designed to react on abrupt changes in the input signal and
  5011. threshold B is designed to react on continuous changes in the input signal.
  5012. @item s
  5013. Set number of frames filter will use for averaging. Default is 9. Must be odd
  5014. number in range [5, 129].
  5015. @item p
  5016. Set what planes of frame filter will use for averaging. Default is all.
  5017. @item a
  5018. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  5019. Alternatively can be set to @code{s} serial.
  5020. Parallel can be faster then serial, while other way around is never true.
  5021. Parallel will abort early on first change being greater then thresholds, while serial
  5022. will continue processing other side of frames if they are equal or bellow thresholds.
  5023. @end table
  5024. @subsection Commands
  5025. This filter supports same @ref{commands} as options except option @code{s}.
  5026. The command accepts the same syntax of the corresponding option.
  5027. @section avgblur
  5028. Apply average blur filter.
  5029. The filter accepts the following options:
  5030. @table @option
  5031. @item sizeX
  5032. Set horizontal radius size.
  5033. @item planes
  5034. Set which planes to filter. By default all planes are filtered.
  5035. @item sizeY
  5036. Set vertical radius size, if zero it will be same as @code{sizeX}.
  5037. Default is @code{0}.
  5038. @end table
  5039. @subsection Commands
  5040. This filter supports same commands as options.
  5041. The command accepts the same syntax of the corresponding option.
  5042. If the specified expression is not valid, it is kept at its current
  5043. value.
  5044. @section bbox
  5045. Compute the bounding box for the non-black pixels in the input frame
  5046. luminance plane.
  5047. This filter computes the bounding box containing all the pixels with a
  5048. luminance value greater than the minimum allowed value.
  5049. The parameters describing the bounding box are printed on the filter
  5050. log.
  5051. The filter accepts the following option:
  5052. @table @option
  5053. @item min_val
  5054. Set the minimal luminance value. Default is @code{16}.
  5055. @end table
  5056. @section bilateral
  5057. Apply bilateral filter, spatial smoothing while preserving edges.
  5058. The filter accepts the following options:
  5059. @table @option
  5060. @item sigmaS
  5061. Set sigma of gaussian function to calculate spatial weight.
  5062. Allowed range is 0 to 10. Default is 0.1.
  5063. @item sigmaR
  5064. Set sigma of gaussian function to calculate range weight.
  5065. Allowed range is 0 to 1. Default is 0.1.
  5066. @item planes
  5067. Set planes to filter. Default is first only.
  5068. @end table
  5069. @section bitplanenoise
  5070. Show and measure bit plane noise.
  5071. The filter accepts the following options:
  5072. @table @option
  5073. @item bitplane
  5074. Set which plane to analyze. Default is @code{1}.
  5075. @item filter
  5076. Filter out noisy pixels from @code{bitplane} set above.
  5077. Default is disabled.
  5078. @end table
  5079. @section blackdetect
  5080. Detect video intervals that are (almost) completely black. Can be
  5081. useful to detect chapter transitions, commercials, or invalid
  5082. recordings.
  5083. The filter outputs its detection analysis to both the log as well as
  5084. frame metadata. If a black segment of at least the specified minimum
  5085. duration is found, a line with the start and end timestamps as well
  5086. as duration is printed to the log with level @code{info}. In addition,
  5087. a log line with level @code{debug} is printed per frame showing the
  5088. black amount detected for that frame.
  5089. The filter also attaches metadata to the first frame of a black
  5090. segment with key @code{lavfi.black_start} and to the first frame
  5091. after the black segment ends with key @code{lavfi.black_end}. The
  5092. value is the frame's timestamp. This metadata is added regardless
  5093. of the minimum duration specified.
  5094. The filter accepts the following options:
  5095. @table @option
  5096. @item black_min_duration, d
  5097. Set the minimum detected black duration expressed in seconds. It must
  5098. be a non-negative floating point number.
  5099. Default value is 2.0.
  5100. @item picture_black_ratio_th, pic_th
  5101. Set the threshold for considering a picture "black".
  5102. Express the minimum value for the ratio:
  5103. @example
  5104. @var{nb_black_pixels} / @var{nb_pixels}
  5105. @end example
  5106. for which a picture is considered black.
  5107. Default value is 0.98.
  5108. @item pixel_black_th, pix_th
  5109. Set the threshold for considering a pixel "black".
  5110. The threshold expresses the maximum pixel luminance value for which a
  5111. pixel is considered "black". The provided value is scaled according to
  5112. the following equation:
  5113. @example
  5114. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  5115. @end example
  5116. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  5117. the input video format, the range is [0-255] for YUV full-range
  5118. formats and [16-235] for YUV non full-range formats.
  5119. Default value is 0.10.
  5120. @end table
  5121. The following example sets the maximum pixel threshold to the minimum
  5122. value, and detects only black intervals of 2 or more seconds:
  5123. @example
  5124. blackdetect=d=2:pix_th=0.00
  5125. @end example
  5126. @section blackframe
  5127. Detect frames that are (almost) completely black. Can be useful to
  5128. detect chapter transitions or commercials. Output lines consist of
  5129. the frame number of the detected frame, the percentage of blackness,
  5130. the position in the file if known or -1 and the timestamp in seconds.
  5131. In order to display the output lines, you need to set the loglevel at
  5132. least to the AV_LOG_INFO value.
  5133. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  5134. The value represents the percentage of pixels in the picture that
  5135. are below the threshold value.
  5136. It accepts the following parameters:
  5137. @table @option
  5138. @item amount
  5139. The percentage of the pixels that have to be below the threshold; it defaults to
  5140. @code{98}.
  5141. @item threshold, thresh
  5142. The threshold below which a pixel value is considered black; it defaults to
  5143. @code{32}.
  5144. @end table
  5145. @anchor{blend}
  5146. @section blend
  5147. Blend two video frames into each other.
  5148. The @code{blend} filter takes two input streams and outputs one
  5149. stream, the first input is the "top" layer and second input is
  5150. "bottom" layer. By default, the output terminates when the longest input terminates.
  5151. The @code{tblend} (time blend) filter takes two consecutive frames
  5152. from one single stream, and outputs the result obtained by blending
  5153. the new frame on top of the old frame.
  5154. A description of the accepted options follows.
  5155. @table @option
  5156. @item c0_mode
  5157. @item c1_mode
  5158. @item c2_mode
  5159. @item c3_mode
  5160. @item all_mode
  5161. Set blend mode for specific pixel component or all pixel components in case
  5162. of @var{all_mode}. Default value is @code{normal}.
  5163. Available values for component modes are:
  5164. @table @samp
  5165. @item addition
  5166. @item grainmerge
  5167. @item and
  5168. @item average
  5169. @item burn
  5170. @item darken
  5171. @item difference
  5172. @item grainextract
  5173. @item divide
  5174. @item dodge
  5175. @item freeze
  5176. @item exclusion
  5177. @item extremity
  5178. @item glow
  5179. @item hardlight
  5180. @item hardmix
  5181. @item heat
  5182. @item lighten
  5183. @item linearlight
  5184. @item multiply
  5185. @item multiply128
  5186. @item negation
  5187. @item normal
  5188. @item or
  5189. @item overlay
  5190. @item phoenix
  5191. @item pinlight
  5192. @item reflect
  5193. @item screen
  5194. @item softlight
  5195. @item subtract
  5196. @item vividlight
  5197. @item xor
  5198. @end table
  5199. @item c0_opacity
  5200. @item c1_opacity
  5201. @item c2_opacity
  5202. @item c3_opacity
  5203. @item all_opacity
  5204. Set blend opacity for specific pixel component or all pixel components in case
  5205. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  5206. @item c0_expr
  5207. @item c1_expr
  5208. @item c2_expr
  5209. @item c3_expr
  5210. @item all_expr
  5211. Set blend expression for specific pixel component or all pixel components in case
  5212. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  5213. The expressions can use the following variables:
  5214. @table @option
  5215. @item N
  5216. The sequential number of the filtered frame, starting from @code{0}.
  5217. @item X
  5218. @item Y
  5219. the coordinates of the current sample
  5220. @item W
  5221. @item H
  5222. the width and height of currently filtered plane
  5223. @item SW
  5224. @item SH
  5225. Width and height scale for the plane being filtered. It is the
  5226. ratio between the dimensions of the current plane to the luma plane,
  5227. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  5228. the luma plane and @code{0.5,0.5} for the chroma planes.
  5229. @item T
  5230. Time of the current frame, expressed in seconds.
  5231. @item TOP, A
  5232. Value of pixel component at current location for first video frame (top layer).
  5233. @item BOTTOM, B
  5234. Value of pixel component at current location for second video frame (bottom layer).
  5235. @end table
  5236. @end table
  5237. The @code{blend} filter also supports the @ref{framesync} options.
  5238. @subsection Examples
  5239. @itemize
  5240. @item
  5241. Apply transition from bottom layer to top layer in first 10 seconds:
  5242. @example
  5243. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  5244. @end example
  5245. @item
  5246. Apply linear horizontal transition from top layer to bottom layer:
  5247. @example
  5248. blend=all_expr='A*(X/W)+B*(1-X/W)'
  5249. @end example
  5250. @item
  5251. Apply 1x1 checkerboard effect:
  5252. @example
  5253. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  5254. @end example
  5255. @item
  5256. Apply uncover left effect:
  5257. @example
  5258. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  5259. @end example
  5260. @item
  5261. Apply uncover down effect:
  5262. @example
  5263. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  5264. @end example
  5265. @item
  5266. Apply uncover up-left effect:
  5267. @example
  5268. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5269. @end example
  5270. @item
  5271. Split diagonally video and shows top and bottom layer on each side:
  5272. @example
  5273. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5274. @end example
  5275. @item
  5276. Display differences between the current and the previous frame:
  5277. @example
  5278. tblend=all_mode=grainextract
  5279. @end example
  5280. @end itemize
  5281. @section bm3d
  5282. Denoise frames using Block-Matching 3D algorithm.
  5283. The filter accepts the following options.
  5284. @table @option
  5285. @item sigma
  5286. Set denoising strength. Default value is 1.
  5287. Allowed range is from 0 to 999.9.
  5288. The denoising algorithm is very sensitive to sigma, so adjust it
  5289. according to the source.
  5290. @item block
  5291. Set local patch size. This sets dimensions in 2D.
  5292. @item bstep
  5293. Set sliding step for processing blocks. Default value is 4.
  5294. Allowed range is from 1 to 64.
  5295. Smaller values allows processing more reference blocks and is slower.
  5296. @item group
  5297. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5298. When set to 1, no block matching is done. Larger values allows more blocks
  5299. in single group.
  5300. Allowed range is from 1 to 256.
  5301. @item range
  5302. Set radius for search block matching. Default is 9.
  5303. Allowed range is from 1 to INT32_MAX.
  5304. @item mstep
  5305. Set step between two search locations for block matching. Default is 1.
  5306. Allowed range is from 1 to 64. Smaller is slower.
  5307. @item thmse
  5308. Set threshold of mean square error for block matching. Valid range is 0 to
  5309. INT32_MAX.
  5310. @item hdthr
  5311. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5312. Larger values results in stronger hard-thresholding filtering in frequency
  5313. domain.
  5314. @item estim
  5315. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5316. Default is @code{basic}.
  5317. @item ref
  5318. If enabled, filter will use 2nd stream for block matching.
  5319. Default is disabled for @code{basic} value of @var{estim} option,
  5320. and always enabled if value of @var{estim} is @code{final}.
  5321. @item planes
  5322. Set planes to filter. Default is all available except alpha.
  5323. @end table
  5324. @subsection Examples
  5325. @itemize
  5326. @item
  5327. Basic filtering with bm3d:
  5328. @example
  5329. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5330. @end example
  5331. @item
  5332. Same as above, but filtering only luma:
  5333. @example
  5334. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5335. @end example
  5336. @item
  5337. Same as above, but with both estimation modes:
  5338. @example
  5339. 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
  5340. @end example
  5341. @item
  5342. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5343. @example
  5344. 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
  5345. @end example
  5346. @end itemize
  5347. @section boxblur
  5348. Apply a boxblur algorithm to the input video.
  5349. It accepts the following parameters:
  5350. @table @option
  5351. @item luma_radius, lr
  5352. @item luma_power, lp
  5353. @item chroma_radius, cr
  5354. @item chroma_power, cp
  5355. @item alpha_radius, ar
  5356. @item alpha_power, ap
  5357. @end table
  5358. A description of the accepted options follows.
  5359. @table @option
  5360. @item luma_radius, lr
  5361. @item chroma_radius, cr
  5362. @item alpha_radius, ar
  5363. Set an expression for the box radius in pixels used for blurring the
  5364. corresponding input plane.
  5365. The radius value must be a non-negative number, and must not be
  5366. greater than the value of the expression @code{min(w,h)/2} for the
  5367. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5368. planes.
  5369. Default value for @option{luma_radius} is "2". If not specified,
  5370. @option{chroma_radius} and @option{alpha_radius} default to the
  5371. corresponding value set for @option{luma_radius}.
  5372. The expressions can contain the following constants:
  5373. @table @option
  5374. @item w
  5375. @item h
  5376. The input width and height in pixels.
  5377. @item cw
  5378. @item ch
  5379. The input chroma image width and height in pixels.
  5380. @item hsub
  5381. @item vsub
  5382. The horizontal and vertical chroma subsample values. For example, for the
  5383. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5384. @end table
  5385. @item luma_power, lp
  5386. @item chroma_power, cp
  5387. @item alpha_power, ap
  5388. Specify how many times the boxblur filter is applied to the
  5389. corresponding plane.
  5390. Default value for @option{luma_power} is 2. If not specified,
  5391. @option{chroma_power} and @option{alpha_power} default to the
  5392. corresponding value set for @option{luma_power}.
  5393. A value of 0 will disable the effect.
  5394. @end table
  5395. @subsection Examples
  5396. @itemize
  5397. @item
  5398. Apply a boxblur filter with the luma, chroma, and alpha radii
  5399. set to 2:
  5400. @example
  5401. boxblur=luma_radius=2:luma_power=1
  5402. boxblur=2:1
  5403. @end example
  5404. @item
  5405. Set the luma radius to 2, and alpha and chroma radius to 0:
  5406. @example
  5407. boxblur=2:1:cr=0:ar=0
  5408. @end example
  5409. @item
  5410. Set the luma and chroma radii to a fraction of the video dimension:
  5411. @example
  5412. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5413. @end example
  5414. @end itemize
  5415. @section bwdif
  5416. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5417. Deinterlacing Filter").
  5418. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5419. interpolation algorithms.
  5420. It accepts the following parameters:
  5421. @table @option
  5422. @item mode
  5423. The interlacing mode to adopt. It accepts one of the following values:
  5424. @table @option
  5425. @item 0, send_frame
  5426. Output one frame for each frame.
  5427. @item 1, send_field
  5428. Output one frame for each field.
  5429. @end table
  5430. The default value is @code{send_field}.
  5431. @item parity
  5432. The picture field parity assumed for the input interlaced video. It accepts one
  5433. of the following values:
  5434. @table @option
  5435. @item 0, tff
  5436. Assume the top field is first.
  5437. @item 1, bff
  5438. Assume the bottom field is first.
  5439. @item -1, auto
  5440. Enable automatic detection of field parity.
  5441. @end table
  5442. The default value is @code{auto}.
  5443. If the interlacing is unknown or the decoder does not export this information,
  5444. top field first will be assumed.
  5445. @item deint
  5446. Specify which frames to deinterlace. Accepts one of the following
  5447. values:
  5448. @table @option
  5449. @item 0, all
  5450. Deinterlace all frames.
  5451. @item 1, interlaced
  5452. Only deinterlace frames marked as interlaced.
  5453. @end table
  5454. The default value is @code{all}.
  5455. @end table
  5456. @section cas
  5457. Apply Contrast Adaptive Sharpen filter to video stream.
  5458. The filter accepts the following options:
  5459. @table @option
  5460. @item strength
  5461. Set the sharpening strength. Default value is 0.
  5462. @item planes
  5463. Set planes to filter. Default value is to filter all
  5464. planes except alpha plane.
  5465. @end table
  5466. @section chromahold
  5467. Remove all color information for all colors except for certain one.
  5468. The filter accepts the following options:
  5469. @table @option
  5470. @item color
  5471. The color which will not be replaced with neutral chroma.
  5472. @item similarity
  5473. Similarity percentage with the above color.
  5474. 0.01 matches only the exact key color, while 1.0 matches everything.
  5475. @item blend
  5476. Blend percentage.
  5477. 0.0 makes pixels either fully gray, or not gray at all.
  5478. Higher values result in more preserved color.
  5479. @item yuv
  5480. Signals that the color passed is already in YUV instead of RGB.
  5481. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5482. This can be used to pass exact YUV values as hexadecimal numbers.
  5483. @end table
  5484. @subsection Commands
  5485. This filter supports same @ref{commands} as options.
  5486. The command accepts the same syntax of the corresponding option.
  5487. If the specified expression is not valid, it is kept at its current
  5488. value.
  5489. @section chromakey
  5490. YUV colorspace color/chroma keying.
  5491. The filter accepts the following options:
  5492. @table @option
  5493. @item color
  5494. The color which will be replaced with transparency.
  5495. @item similarity
  5496. Similarity percentage with the key color.
  5497. 0.01 matches only the exact key color, while 1.0 matches everything.
  5498. @item blend
  5499. Blend percentage.
  5500. 0.0 makes pixels either fully transparent, or not transparent at all.
  5501. Higher values result in semi-transparent pixels, with a higher transparency
  5502. the more similar the pixels color is to the key color.
  5503. @item yuv
  5504. Signals that the color passed is already in YUV instead of RGB.
  5505. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5506. This can be used to pass exact YUV values as hexadecimal numbers.
  5507. @end table
  5508. @subsection Commands
  5509. This filter supports same @ref{commands} as options.
  5510. The command accepts the same syntax of the corresponding option.
  5511. If the specified expression is not valid, it is kept at its current
  5512. value.
  5513. @subsection Examples
  5514. @itemize
  5515. @item
  5516. Make every green pixel in the input image transparent:
  5517. @example
  5518. ffmpeg -i input.png -vf chromakey=green out.png
  5519. @end example
  5520. @item
  5521. Overlay a greenscreen-video on top of a static black background.
  5522. @example
  5523. 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
  5524. @end example
  5525. @end itemize
  5526. @section chromashift
  5527. Shift chroma pixels horizontally and/or vertically.
  5528. The filter accepts the following options:
  5529. @table @option
  5530. @item cbh
  5531. Set amount to shift chroma-blue horizontally.
  5532. @item cbv
  5533. Set amount to shift chroma-blue vertically.
  5534. @item crh
  5535. Set amount to shift chroma-red horizontally.
  5536. @item crv
  5537. Set amount to shift chroma-red vertically.
  5538. @item edge
  5539. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5540. @end table
  5541. @subsection Commands
  5542. This filter supports the all above options as @ref{commands}.
  5543. @section ciescope
  5544. Display CIE color diagram with pixels overlaid onto it.
  5545. The filter accepts the following options:
  5546. @table @option
  5547. @item system
  5548. Set color system.
  5549. @table @samp
  5550. @item ntsc, 470m
  5551. @item ebu, 470bg
  5552. @item smpte
  5553. @item 240m
  5554. @item apple
  5555. @item widergb
  5556. @item cie1931
  5557. @item rec709, hdtv
  5558. @item uhdtv, rec2020
  5559. @item dcip3
  5560. @end table
  5561. @item cie
  5562. Set CIE system.
  5563. @table @samp
  5564. @item xyy
  5565. @item ucs
  5566. @item luv
  5567. @end table
  5568. @item gamuts
  5569. Set what gamuts to draw.
  5570. See @code{system} option for available values.
  5571. @item size, s
  5572. Set ciescope size, by default set to 512.
  5573. @item intensity, i
  5574. Set intensity used to map input pixel values to CIE diagram.
  5575. @item contrast
  5576. Set contrast used to draw tongue colors that are out of active color system gamut.
  5577. @item corrgamma
  5578. Correct gamma displayed on scope, by default enabled.
  5579. @item showwhite
  5580. Show white point on CIE diagram, by default disabled.
  5581. @item gamma
  5582. Set input gamma. Used only with XYZ input color space.
  5583. @end table
  5584. @section codecview
  5585. Visualize information exported by some codecs.
  5586. Some codecs can export information through frames using side-data or other
  5587. means. For example, some MPEG based codecs export motion vectors through the
  5588. @var{export_mvs} flag in the codec @option{flags2} option.
  5589. The filter accepts the following option:
  5590. @table @option
  5591. @item mv
  5592. Set motion vectors to visualize.
  5593. Available flags for @var{mv} are:
  5594. @table @samp
  5595. @item pf
  5596. forward predicted MVs of P-frames
  5597. @item bf
  5598. forward predicted MVs of B-frames
  5599. @item bb
  5600. backward predicted MVs of B-frames
  5601. @end table
  5602. @item qp
  5603. Display quantization parameters using the chroma planes.
  5604. @item mv_type, mvt
  5605. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5606. Available flags for @var{mv_type} are:
  5607. @table @samp
  5608. @item fp
  5609. forward predicted MVs
  5610. @item bp
  5611. backward predicted MVs
  5612. @end table
  5613. @item frame_type, ft
  5614. Set frame type to visualize motion vectors of.
  5615. Available flags for @var{frame_type} are:
  5616. @table @samp
  5617. @item if
  5618. intra-coded frames (I-frames)
  5619. @item pf
  5620. predicted frames (P-frames)
  5621. @item bf
  5622. bi-directionally predicted frames (B-frames)
  5623. @end table
  5624. @end table
  5625. @subsection Examples
  5626. @itemize
  5627. @item
  5628. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5629. @example
  5630. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5631. @end example
  5632. @item
  5633. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5634. @example
  5635. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5636. @end example
  5637. @end itemize
  5638. @section colorbalance
  5639. Modify intensity of primary colors (red, green and blue) of input frames.
  5640. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5641. regions for the red-cyan, green-magenta or blue-yellow balance.
  5642. A positive adjustment value shifts the balance towards the primary color, a negative
  5643. value towards the complementary color.
  5644. The filter accepts the following options:
  5645. @table @option
  5646. @item rs
  5647. @item gs
  5648. @item bs
  5649. Adjust red, green and blue shadows (darkest pixels).
  5650. @item rm
  5651. @item gm
  5652. @item bm
  5653. Adjust red, green and blue midtones (medium pixels).
  5654. @item rh
  5655. @item gh
  5656. @item bh
  5657. Adjust red, green and blue highlights (brightest pixels).
  5658. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5659. @item pl
  5660. Preserve lightness when changing color balance. Default is disabled.
  5661. @end table
  5662. @subsection Examples
  5663. @itemize
  5664. @item
  5665. Add red color cast to shadows:
  5666. @example
  5667. colorbalance=rs=.3
  5668. @end example
  5669. @end itemize
  5670. @subsection Commands
  5671. This filter supports the all above options as @ref{commands}.
  5672. @section colorchannelmixer
  5673. Adjust video input frames by re-mixing color channels.
  5674. This filter modifies a color channel by adding the values associated to
  5675. the other channels of the same pixels. For example if the value to
  5676. modify is red, the output value will be:
  5677. @example
  5678. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5679. @end example
  5680. The filter accepts the following options:
  5681. @table @option
  5682. @item rr
  5683. @item rg
  5684. @item rb
  5685. @item ra
  5686. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5687. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5688. @item gr
  5689. @item gg
  5690. @item gb
  5691. @item ga
  5692. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5693. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5694. @item br
  5695. @item bg
  5696. @item bb
  5697. @item ba
  5698. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5699. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5700. @item ar
  5701. @item ag
  5702. @item ab
  5703. @item aa
  5704. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5705. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5706. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5707. @end table
  5708. @subsection Examples
  5709. @itemize
  5710. @item
  5711. Convert source to grayscale:
  5712. @example
  5713. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5714. @end example
  5715. @item
  5716. Simulate sepia tones:
  5717. @example
  5718. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5719. @end example
  5720. @end itemize
  5721. @subsection Commands
  5722. This filter supports the all above options as @ref{commands}.
  5723. @section colorkey
  5724. RGB colorspace color keying.
  5725. The filter accepts the following options:
  5726. @table @option
  5727. @item color
  5728. The color which will be replaced with transparency.
  5729. @item similarity
  5730. Similarity percentage with the key color.
  5731. 0.01 matches only the exact key color, while 1.0 matches everything.
  5732. @item blend
  5733. Blend percentage.
  5734. 0.0 makes pixels either fully transparent, or not transparent at all.
  5735. Higher values result in semi-transparent pixels, with a higher transparency
  5736. the more similar the pixels color is to the key color.
  5737. @end table
  5738. @subsection Examples
  5739. @itemize
  5740. @item
  5741. Make every green pixel in the input image transparent:
  5742. @example
  5743. ffmpeg -i input.png -vf colorkey=green out.png
  5744. @end example
  5745. @item
  5746. Overlay a greenscreen-video on top of a static background image.
  5747. @example
  5748. 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
  5749. @end example
  5750. @end itemize
  5751. @subsection Commands
  5752. This filter supports same @ref{commands} as options.
  5753. The command accepts the same syntax of the corresponding option.
  5754. If the specified expression is not valid, it is kept at its current
  5755. value.
  5756. @section colorhold
  5757. Remove all color information for all RGB colors except for certain one.
  5758. The filter accepts the following options:
  5759. @table @option
  5760. @item color
  5761. The color which will not be replaced with neutral gray.
  5762. @item similarity
  5763. Similarity percentage with the above color.
  5764. 0.01 matches only the exact key color, while 1.0 matches everything.
  5765. @item blend
  5766. Blend percentage. 0.0 makes pixels fully gray.
  5767. Higher values result in more preserved color.
  5768. @end table
  5769. @subsection Commands
  5770. This filter supports same @ref{commands} as options.
  5771. The command accepts the same syntax of the corresponding option.
  5772. If the specified expression is not valid, it is kept at its current
  5773. value.
  5774. @section colorlevels
  5775. Adjust video input frames using levels.
  5776. The filter accepts the following options:
  5777. @table @option
  5778. @item rimin
  5779. @item gimin
  5780. @item bimin
  5781. @item aimin
  5782. Adjust red, green, blue and alpha input black point.
  5783. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5784. @item rimax
  5785. @item gimax
  5786. @item bimax
  5787. @item aimax
  5788. Adjust red, green, blue and alpha input white point.
  5789. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5790. Input levels are used to lighten highlights (bright tones), darken shadows
  5791. (dark tones), change the balance of bright and dark tones.
  5792. @item romin
  5793. @item gomin
  5794. @item bomin
  5795. @item aomin
  5796. Adjust red, green, blue and alpha output black point.
  5797. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5798. @item romax
  5799. @item gomax
  5800. @item bomax
  5801. @item aomax
  5802. Adjust red, green, blue and alpha output white point.
  5803. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5804. Output levels allows manual selection of a constrained output level range.
  5805. @end table
  5806. @subsection Examples
  5807. @itemize
  5808. @item
  5809. Make video output darker:
  5810. @example
  5811. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5812. @end example
  5813. @item
  5814. Increase contrast:
  5815. @example
  5816. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5817. @end example
  5818. @item
  5819. Make video output lighter:
  5820. @example
  5821. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5822. @end example
  5823. @item
  5824. Increase brightness:
  5825. @example
  5826. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5827. @end example
  5828. @end itemize
  5829. @subsection Commands
  5830. This filter supports the all above options as @ref{commands}.
  5831. @section colormatrix
  5832. Convert color matrix.
  5833. The filter accepts the following options:
  5834. @table @option
  5835. @item src
  5836. @item dst
  5837. Specify the source and destination color matrix. Both values must be
  5838. specified.
  5839. The accepted values are:
  5840. @table @samp
  5841. @item bt709
  5842. BT.709
  5843. @item fcc
  5844. FCC
  5845. @item bt601
  5846. BT.601
  5847. @item bt470
  5848. BT.470
  5849. @item bt470bg
  5850. BT.470BG
  5851. @item smpte170m
  5852. SMPTE-170M
  5853. @item smpte240m
  5854. SMPTE-240M
  5855. @item bt2020
  5856. BT.2020
  5857. @end table
  5858. @end table
  5859. For example to convert from BT.601 to SMPTE-240M, use the command:
  5860. @example
  5861. colormatrix=bt601:smpte240m
  5862. @end example
  5863. @section colorspace
  5864. Convert colorspace, transfer characteristics or color primaries.
  5865. Input video needs to have an even size.
  5866. The filter accepts the following options:
  5867. @table @option
  5868. @anchor{all}
  5869. @item all
  5870. Specify all color properties at once.
  5871. The accepted values are:
  5872. @table @samp
  5873. @item bt470m
  5874. BT.470M
  5875. @item bt470bg
  5876. BT.470BG
  5877. @item bt601-6-525
  5878. BT.601-6 525
  5879. @item bt601-6-625
  5880. BT.601-6 625
  5881. @item bt709
  5882. BT.709
  5883. @item smpte170m
  5884. SMPTE-170M
  5885. @item smpte240m
  5886. SMPTE-240M
  5887. @item bt2020
  5888. BT.2020
  5889. @end table
  5890. @anchor{space}
  5891. @item space
  5892. Specify output colorspace.
  5893. The accepted values are:
  5894. @table @samp
  5895. @item bt709
  5896. BT.709
  5897. @item fcc
  5898. FCC
  5899. @item bt470bg
  5900. BT.470BG or BT.601-6 625
  5901. @item smpte170m
  5902. SMPTE-170M or BT.601-6 525
  5903. @item smpte240m
  5904. SMPTE-240M
  5905. @item ycgco
  5906. YCgCo
  5907. @item bt2020ncl
  5908. BT.2020 with non-constant luminance
  5909. @end table
  5910. @anchor{trc}
  5911. @item trc
  5912. Specify output transfer characteristics.
  5913. The accepted values are:
  5914. @table @samp
  5915. @item bt709
  5916. BT.709
  5917. @item bt470m
  5918. BT.470M
  5919. @item bt470bg
  5920. BT.470BG
  5921. @item gamma22
  5922. Constant gamma of 2.2
  5923. @item gamma28
  5924. Constant gamma of 2.8
  5925. @item smpte170m
  5926. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5927. @item smpte240m
  5928. SMPTE-240M
  5929. @item srgb
  5930. SRGB
  5931. @item iec61966-2-1
  5932. iec61966-2-1
  5933. @item iec61966-2-4
  5934. iec61966-2-4
  5935. @item xvycc
  5936. xvycc
  5937. @item bt2020-10
  5938. BT.2020 for 10-bits content
  5939. @item bt2020-12
  5940. BT.2020 for 12-bits content
  5941. @end table
  5942. @anchor{primaries}
  5943. @item primaries
  5944. Specify output color primaries.
  5945. The accepted values are:
  5946. @table @samp
  5947. @item bt709
  5948. BT.709
  5949. @item bt470m
  5950. BT.470M
  5951. @item bt470bg
  5952. BT.470BG or BT.601-6 625
  5953. @item smpte170m
  5954. SMPTE-170M or BT.601-6 525
  5955. @item smpte240m
  5956. SMPTE-240M
  5957. @item film
  5958. film
  5959. @item smpte431
  5960. SMPTE-431
  5961. @item smpte432
  5962. SMPTE-432
  5963. @item bt2020
  5964. BT.2020
  5965. @item jedec-p22
  5966. JEDEC P22 phosphors
  5967. @end table
  5968. @anchor{range}
  5969. @item range
  5970. Specify output color range.
  5971. The accepted values are:
  5972. @table @samp
  5973. @item tv
  5974. TV (restricted) range
  5975. @item mpeg
  5976. MPEG (restricted) range
  5977. @item pc
  5978. PC (full) range
  5979. @item jpeg
  5980. JPEG (full) range
  5981. @end table
  5982. @item format
  5983. Specify output color format.
  5984. The accepted values are:
  5985. @table @samp
  5986. @item yuv420p
  5987. YUV 4:2:0 planar 8-bits
  5988. @item yuv420p10
  5989. YUV 4:2:0 planar 10-bits
  5990. @item yuv420p12
  5991. YUV 4:2:0 planar 12-bits
  5992. @item yuv422p
  5993. YUV 4:2:2 planar 8-bits
  5994. @item yuv422p10
  5995. YUV 4:2:2 planar 10-bits
  5996. @item yuv422p12
  5997. YUV 4:2:2 planar 12-bits
  5998. @item yuv444p
  5999. YUV 4:4:4 planar 8-bits
  6000. @item yuv444p10
  6001. YUV 4:4:4 planar 10-bits
  6002. @item yuv444p12
  6003. YUV 4:4:4 planar 12-bits
  6004. @end table
  6005. @item fast
  6006. Do a fast conversion, which skips gamma/primary correction. This will take
  6007. significantly less CPU, but will be mathematically incorrect. To get output
  6008. compatible with that produced by the colormatrix filter, use fast=1.
  6009. @item dither
  6010. Specify dithering mode.
  6011. The accepted values are:
  6012. @table @samp
  6013. @item none
  6014. No dithering
  6015. @item fsb
  6016. Floyd-Steinberg dithering
  6017. @end table
  6018. @item wpadapt
  6019. Whitepoint adaptation mode.
  6020. The accepted values are:
  6021. @table @samp
  6022. @item bradford
  6023. Bradford whitepoint adaptation
  6024. @item vonkries
  6025. von Kries whitepoint adaptation
  6026. @item identity
  6027. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  6028. @end table
  6029. @item iall
  6030. Override all input properties at once. Same accepted values as @ref{all}.
  6031. @item ispace
  6032. Override input colorspace. Same accepted values as @ref{space}.
  6033. @item iprimaries
  6034. Override input color primaries. Same accepted values as @ref{primaries}.
  6035. @item itrc
  6036. Override input transfer characteristics. Same accepted values as @ref{trc}.
  6037. @item irange
  6038. Override input color range. Same accepted values as @ref{range}.
  6039. @end table
  6040. The filter converts the transfer characteristics, color space and color
  6041. primaries to the specified user values. The output value, if not specified,
  6042. is set to a default value based on the "all" property. If that property is
  6043. also not specified, the filter will log an error. The output color range and
  6044. format default to the same value as the input color range and format. The
  6045. input transfer characteristics, color space, color primaries and color range
  6046. should be set on the input data. If any of these are missing, the filter will
  6047. log an error and no conversion will take place.
  6048. For example to convert the input to SMPTE-240M, use the command:
  6049. @example
  6050. colorspace=smpte240m
  6051. @end example
  6052. @section convolution
  6053. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  6054. The filter accepts the following options:
  6055. @table @option
  6056. @item 0m
  6057. @item 1m
  6058. @item 2m
  6059. @item 3m
  6060. Set matrix for each plane.
  6061. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  6062. and from 1 to 49 odd number of signed integers in @var{row} mode.
  6063. @item 0rdiv
  6064. @item 1rdiv
  6065. @item 2rdiv
  6066. @item 3rdiv
  6067. Set multiplier for calculated value for each plane.
  6068. If unset or 0, it will be sum of all matrix elements.
  6069. @item 0bias
  6070. @item 1bias
  6071. @item 2bias
  6072. @item 3bias
  6073. Set bias for each plane. This value is added to the result of the multiplication.
  6074. Useful for making the overall image brighter or darker. Default is 0.0.
  6075. @item 0mode
  6076. @item 1mode
  6077. @item 2mode
  6078. @item 3mode
  6079. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  6080. Default is @var{square}.
  6081. @end table
  6082. @subsection Examples
  6083. @itemize
  6084. @item
  6085. Apply sharpen:
  6086. @example
  6087. 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"
  6088. @end example
  6089. @item
  6090. Apply blur:
  6091. @example
  6092. 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"
  6093. @end example
  6094. @item
  6095. Apply edge enhance:
  6096. @example
  6097. 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"
  6098. @end example
  6099. @item
  6100. Apply edge detect:
  6101. @example
  6102. 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"
  6103. @end example
  6104. @item
  6105. Apply laplacian edge detector which includes diagonals:
  6106. @example
  6107. 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"
  6108. @end example
  6109. @item
  6110. Apply emboss:
  6111. @example
  6112. 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"
  6113. @end example
  6114. @end itemize
  6115. @section convolve
  6116. Apply 2D convolution of video stream in frequency domain using second stream
  6117. as impulse.
  6118. The filter accepts the following options:
  6119. @table @option
  6120. @item planes
  6121. Set which planes to process.
  6122. @item impulse
  6123. Set which impulse video frames will be processed, can be @var{first}
  6124. or @var{all}. Default is @var{all}.
  6125. @end table
  6126. The @code{convolve} filter also supports the @ref{framesync} options.
  6127. @section copy
  6128. Copy the input video source unchanged to the output. This is mainly useful for
  6129. testing purposes.
  6130. @anchor{coreimage}
  6131. @section coreimage
  6132. Video filtering on GPU using Apple's CoreImage API on OSX.
  6133. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  6134. processed by video hardware. However, software-based OpenGL implementations
  6135. exist which means there is no guarantee for hardware processing. It depends on
  6136. the respective OSX.
  6137. There are many filters and image generators provided by Apple that come with a
  6138. large variety of options. The filter has to be referenced by its name along
  6139. with its options.
  6140. The coreimage filter accepts the following options:
  6141. @table @option
  6142. @item list_filters
  6143. List all available filters and generators along with all their respective
  6144. options as well as possible minimum and maximum values along with the default
  6145. values.
  6146. @example
  6147. list_filters=true
  6148. @end example
  6149. @item filter
  6150. Specify all filters by their respective name and options.
  6151. Use @var{list_filters} to determine all valid filter names and options.
  6152. Numerical options are specified by a float value and are automatically clamped
  6153. to their respective value range. Vector and color options have to be specified
  6154. by a list of space separated float values. Character escaping has to be done.
  6155. A special option name @code{default} is available to use default options for a
  6156. filter.
  6157. It is required to specify either @code{default} or at least one of the filter options.
  6158. All omitted options are used with their default values.
  6159. The syntax of the filter string is as follows:
  6160. @example
  6161. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  6162. @end example
  6163. @item output_rect
  6164. Specify a rectangle where the output of the filter chain is copied into the
  6165. input image. It is given by a list of space separated float values:
  6166. @example
  6167. output_rect=x\ y\ width\ height
  6168. @end example
  6169. If not given, the output rectangle equals the dimensions of the input image.
  6170. The output rectangle is automatically cropped at the borders of the input
  6171. image. Negative values are valid for each component.
  6172. @example
  6173. output_rect=25\ 25\ 100\ 100
  6174. @end example
  6175. @end table
  6176. Several filters can be chained for successive processing without GPU-HOST
  6177. transfers allowing for fast processing of complex filter chains.
  6178. Currently, only filters with zero (generators) or exactly one (filters) input
  6179. image and one output image are supported. Also, transition filters are not yet
  6180. usable as intended.
  6181. Some filters generate output images with additional padding depending on the
  6182. respective filter kernel. The padding is automatically removed to ensure the
  6183. filter output has the same size as the input image.
  6184. For image generators, the size of the output image is determined by the
  6185. previous output image of the filter chain or the input image of the whole
  6186. filterchain, respectively. The generators do not use the pixel information of
  6187. this image to generate their output. However, the generated output is
  6188. blended onto this image, resulting in partial or complete coverage of the
  6189. output image.
  6190. The @ref{coreimagesrc} video source can be used for generating input images
  6191. which are directly fed into the filter chain. By using it, providing input
  6192. images by another video source or an input video is not required.
  6193. @subsection Examples
  6194. @itemize
  6195. @item
  6196. List all filters available:
  6197. @example
  6198. coreimage=list_filters=true
  6199. @end example
  6200. @item
  6201. Use the CIBoxBlur filter with default options to blur an image:
  6202. @example
  6203. coreimage=filter=CIBoxBlur@@default
  6204. @end example
  6205. @item
  6206. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  6207. its center at 100x100 and a radius of 50 pixels:
  6208. @example
  6209. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  6210. @end example
  6211. @item
  6212. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  6213. given as complete and escaped command-line for Apple's standard bash shell:
  6214. @example
  6215. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  6216. @end example
  6217. @end itemize
  6218. @section cover_rect
  6219. Cover a rectangular object
  6220. It accepts the following options:
  6221. @table @option
  6222. @item cover
  6223. Filepath of the optional cover image, needs to be in yuv420.
  6224. @item mode
  6225. Set covering mode.
  6226. It accepts the following values:
  6227. @table @samp
  6228. @item cover
  6229. cover it by the supplied image
  6230. @item blur
  6231. cover it by interpolating the surrounding pixels
  6232. @end table
  6233. Default value is @var{blur}.
  6234. @end table
  6235. @subsection Examples
  6236. @itemize
  6237. @item
  6238. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  6239. @example
  6240. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6241. @end example
  6242. @end itemize
  6243. @section crop
  6244. Crop the input video to given dimensions.
  6245. It accepts the following parameters:
  6246. @table @option
  6247. @item w, out_w
  6248. The width of the output video. It defaults to @code{iw}.
  6249. This expression is evaluated only once during the filter
  6250. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  6251. @item h, out_h
  6252. The height of the output video. It defaults to @code{ih}.
  6253. This expression is evaluated only once during the filter
  6254. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  6255. @item x
  6256. The horizontal position, in the input video, of the left edge of the output
  6257. video. It defaults to @code{(in_w-out_w)/2}.
  6258. This expression is evaluated per-frame.
  6259. @item y
  6260. The vertical position, in the input video, of the top edge of the output video.
  6261. It defaults to @code{(in_h-out_h)/2}.
  6262. This expression is evaluated per-frame.
  6263. @item keep_aspect
  6264. If set to 1 will force the output display aspect ratio
  6265. to be the same of the input, by changing the output sample aspect
  6266. ratio. It defaults to 0.
  6267. @item exact
  6268. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  6269. width/height/x/y as specified and will not be rounded to nearest smaller value.
  6270. It defaults to 0.
  6271. @end table
  6272. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  6273. expressions containing the following constants:
  6274. @table @option
  6275. @item x
  6276. @item y
  6277. The computed values for @var{x} and @var{y}. They are evaluated for
  6278. each new frame.
  6279. @item in_w
  6280. @item in_h
  6281. The input width and height.
  6282. @item iw
  6283. @item ih
  6284. These are the same as @var{in_w} and @var{in_h}.
  6285. @item out_w
  6286. @item out_h
  6287. The output (cropped) width and height.
  6288. @item ow
  6289. @item oh
  6290. These are the same as @var{out_w} and @var{out_h}.
  6291. @item a
  6292. same as @var{iw} / @var{ih}
  6293. @item sar
  6294. input sample aspect ratio
  6295. @item dar
  6296. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6297. @item hsub
  6298. @item vsub
  6299. horizontal and vertical chroma subsample values. For example for the
  6300. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6301. @item n
  6302. The number of the input frame, starting from 0.
  6303. @item pos
  6304. the position in the file of the input frame, NAN if unknown
  6305. @item t
  6306. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6307. @end table
  6308. The expression for @var{out_w} may depend on the value of @var{out_h},
  6309. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6310. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6311. evaluated after @var{out_w} and @var{out_h}.
  6312. The @var{x} and @var{y} parameters specify the expressions for the
  6313. position of the top-left corner of the output (non-cropped) area. They
  6314. are evaluated for each frame. If the evaluated value is not valid, it
  6315. is approximated to the nearest valid value.
  6316. The expression for @var{x} may depend on @var{y}, and the expression
  6317. for @var{y} may depend on @var{x}.
  6318. @subsection Examples
  6319. @itemize
  6320. @item
  6321. Crop area with size 100x100 at position (12,34).
  6322. @example
  6323. crop=100:100:12:34
  6324. @end example
  6325. Using named options, the example above becomes:
  6326. @example
  6327. crop=w=100:h=100:x=12:y=34
  6328. @end example
  6329. @item
  6330. Crop the central input area with size 100x100:
  6331. @example
  6332. crop=100:100
  6333. @end example
  6334. @item
  6335. Crop the central input area with size 2/3 of the input video:
  6336. @example
  6337. crop=2/3*in_w:2/3*in_h
  6338. @end example
  6339. @item
  6340. Crop the input video central square:
  6341. @example
  6342. crop=out_w=in_h
  6343. crop=in_h
  6344. @end example
  6345. @item
  6346. Delimit the rectangle with the top-left corner placed at position
  6347. 100:100 and the right-bottom corner corresponding to the right-bottom
  6348. corner of the input image.
  6349. @example
  6350. crop=in_w-100:in_h-100:100:100
  6351. @end example
  6352. @item
  6353. Crop 10 pixels from the left and right borders, and 20 pixels from
  6354. the top and bottom borders
  6355. @example
  6356. crop=in_w-2*10:in_h-2*20
  6357. @end example
  6358. @item
  6359. Keep only the bottom right quarter of the input image:
  6360. @example
  6361. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6362. @end example
  6363. @item
  6364. Crop height for getting Greek harmony:
  6365. @example
  6366. crop=in_w:1/PHI*in_w
  6367. @end example
  6368. @item
  6369. Apply trembling effect:
  6370. @example
  6371. 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)
  6372. @end example
  6373. @item
  6374. Apply erratic camera effect depending on timestamp:
  6375. @example
  6376. 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)"
  6377. @end example
  6378. @item
  6379. Set x depending on the value of y:
  6380. @example
  6381. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6382. @end example
  6383. @end itemize
  6384. @subsection Commands
  6385. This filter supports the following commands:
  6386. @table @option
  6387. @item w, out_w
  6388. @item h, out_h
  6389. @item x
  6390. @item y
  6391. Set width/height of the output video and the horizontal/vertical position
  6392. in the input video.
  6393. The command accepts the same syntax of the corresponding option.
  6394. If the specified expression is not valid, it is kept at its current
  6395. value.
  6396. @end table
  6397. @section cropdetect
  6398. Auto-detect the crop size.
  6399. It calculates the necessary cropping parameters and prints the
  6400. recommended parameters via the logging system. The detected dimensions
  6401. correspond to the non-black area of the input video.
  6402. It accepts the following parameters:
  6403. @table @option
  6404. @item limit
  6405. Set higher black value threshold, which can be optionally specified
  6406. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6407. value greater to the set value is considered non-black. It defaults to 24.
  6408. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6409. on the bitdepth of the pixel format.
  6410. @item round
  6411. The value which the width/height should be divisible by. It defaults to
  6412. 16. The offset is automatically adjusted to center the video. Use 2 to
  6413. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6414. encoding to most video codecs.
  6415. @item reset_count, reset
  6416. Set the counter that determines after how many frames cropdetect will
  6417. reset the previously detected largest video area and start over to
  6418. detect the current optimal crop area. Default value is 0.
  6419. This can be useful when channel logos distort the video area. 0
  6420. indicates 'never reset', and returns the largest area encountered during
  6421. playback.
  6422. @end table
  6423. @anchor{cue}
  6424. @section cue
  6425. Delay video filtering until a given wallclock timestamp. The filter first
  6426. passes on @option{preroll} amount of frames, then it buffers at most
  6427. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6428. it forwards the buffered frames and also any subsequent frames coming in its
  6429. input.
  6430. The filter can be used synchronize the output of multiple ffmpeg processes for
  6431. realtime output devices like decklink. By putting the delay in the filtering
  6432. chain and pre-buffering frames the process can pass on data to output almost
  6433. immediately after the target wallclock timestamp is reached.
  6434. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6435. some use cases.
  6436. @table @option
  6437. @item cue
  6438. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6439. @item preroll
  6440. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6441. @item buffer
  6442. The maximum duration of content to buffer before waiting for the cue expressed
  6443. in seconds. Default is 0.
  6444. @end table
  6445. @anchor{curves}
  6446. @section curves
  6447. Apply color adjustments using curves.
  6448. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6449. component (red, green and blue) has its values defined by @var{N} key points
  6450. tied from each other using a smooth curve. The x-axis represents the pixel
  6451. values from the input frame, and the y-axis the new pixel values to be set for
  6452. the output frame.
  6453. By default, a component curve is defined by the two points @var{(0;0)} and
  6454. @var{(1;1)}. This creates a straight line where each original pixel value is
  6455. "adjusted" to its own value, which means no change to the image.
  6456. The filter allows you to redefine these two points and add some more. A new
  6457. curve (using a natural cubic spline interpolation) will be define to pass
  6458. smoothly through all these new coordinates. The new defined points needs to be
  6459. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6460. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6461. the vector spaces, the values will be clipped accordingly.
  6462. The filter accepts the following options:
  6463. @table @option
  6464. @item preset
  6465. Select one of the available color presets. This option can be used in addition
  6466. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6467. options takes priority on the preset values.
  6468. Available presets are:
  6469. @table @samp
  6470. @item none
  6471. @item color_negative
  6472. @item cross_process
  6473. @item darker
  6474. @item increase_contrast
  6475. @item lighter
  6476. @item linear_contrast
  6477. @item medium_contrast
  6478. @item negative
  6479. @item strong_contrast
  6480. @item vintage
  6481. @end table
  6482. Default is @code{none}.
  6483. @item master, m
  6484. Set the master key points. These points will define a second pass mapping. It
  6485. is sometimes called a "luminance" or "value" mapping. It can be used with
  6486. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6487. post-processing LUT.
  6488. @item red, r
  6489. Set the key points for the red component.
  6490. @item green, g
  6491. Set the key points for the green component.
  6492. @item blue, b
  6493. Set the key points for the blue component.
  6494. @item all
  6495. Set the key points for all components (not including master).
  6496. Can be used in addition to the other key points component
  6497. options. In this case, the unset component(s) will fallback on this
  6498. @option{all} setting.
  6499. @item psfile
  6500. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6501. @item plot
  6502. Save Gnuplot script of the curves in specified file.
  6503. @end table
  6504. To avoid some filtergraph syntax conflicts, each key points list need to be
  6505. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6506. @subsection Examples
  6507. @itemize
  6508. @item
  6509. Increase slightly the middle level of blue:
  6510. @example
  6511. curves=blue='0/0 0.5/0.58 1/1'
  6512. @end example
  6513. @item
  6514. Vintage effect:
  6515. @example
  6516. 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'
  6517. @end example
  6518. Here we obtain the following coordinates for each components:
  6519. @table @var
  6520. @item red
  6521. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6522. @item green
  6523. @code{(0;0) (0.50;0.48) (1;1)}
  6524. @item blue
  6525. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6526. @end table
  6527. @item
  6528. The previous example can also be achieved with the associated built-in preset:
  6529. @example
  6530. curves=preset=vintage
  6531. @end example
  6532. @item
  6533. Or simply:
  6534. @example
  6535. curves=vintage
  6536. @end example
  6537. @item
  6538. Use a Photoshop preset and redefine the points of the green component:
  6539. @example
  6540. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6541. @end example
  6542. @item
  6543. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6544. and @command{gnuplot}:
  6545. @example
  6546. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6547. gnuplot -p /tmp/curves.plt
  6548. @end example
  6549. @end itemize
  6550. @section datascope
  6551. Video data analysis filter.
  6552. This filter shows hexadecimal pixel values of part of video.
  6553. The filter accepts the following options:
  6554. @table @option
  6555. @item size, s
  6556. Set output video size.
  6557. @item x
  6558. Set x offset from where to pick pixels.
  6559. @item y
  6560. Set y offset from where to pick pixels.
  6561. @item mode
  6562. Set scope mode, can be one of the following:
  6563. @table @samp
  6564. @item mono
  6565. Draw hexadecimal pixel values with white color on black background.
  6566. @item color
  6567. Draw hexadecimal pixel values with input video pixel color on black
  6568. background.
  6569. @item color2
  6570. Draw hexadecimal pixel values on color background picked from input video,
  6571. the text color is picked in such way so its always visible.
  6572. @end table
  6573. @item axis
  6574. Draw rows and columns numbers on left and top of video.
  6575. @item opacity
  6576. Set background opacity.
  6577. @item format
  6578. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  6579. @end table
  6580. @section dctdnoiz
  6581. Denoise frames using 2D DCT (frequency domain filtering).
  6582. This filter is not designed for real time.
  6583. The filter accepts the following options:
  6584. @table @option
  6585. @item sigma, s
  6586. Set the noise sigma constant.
  6587. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6588. coefficient (absolute value) below this threshold with be dropped.
  6589. If you need a more advanced filtering, see @option{expr}.
  6590. Default is @code{0}.
  6591. @item overlap
  6592. Set number overlapping pixels for each block. Since the filter can be slow, you
  6593. may want to reduce this value, at the cost of a less effective filter and the
  6594. risk of various artefacts.
  6595. If the overlapping value doesn't permit processing the whole input width or
  6596. height, a warning will be displayed and according borders won't be denoised.
  6597. Default value is @var{blocksize}-1, which is the best possible setting.
  6598. @item expr, e
  6599. Set the coefficient factor expression.
  6600. For each coefficient of a DCT block, this expression will be evaluated as a
  6601. multiplier value for the coefficient.
  6602. If this is option is set, the @option{sigma} option will be ignored.
  6603. The absolute value of the coefficient can be accessed through the @var{c}
  6604. variable.
  6605. @item n
  6606. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6607. @var{blocksize}, which is the width and height of the processed blocks.
  6608. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6609. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6610. on the speed processing. Also, a larger block size does not necessarily means a
  6611. better de-noising.
  6612. @end table
  6613. @subsection Examples
  6614. Apply a denoise with a @option{sigma} of @code{4.5}:
  6615. @example
  6616. dctdnoiz=4.5
  6617. @end example
  6618. The same operation can be achieved using the expression system:
  6619. @example
  6620. dctdnoiz=e='gte(c, 4.5*3)'
  6621. @end example
  6622. Violent denoise using a block size of @code{16x16}:
  6623. @example
  6624. dctdnoiz=15:n=4
  6625. @end example
  6626. @section deband
  6627. Remove banding artifacts from input video.
  6628. It works by replacing banded pixels with average value of referenced pixels.
  6629. The filter accepts the following options:
  6630. @table @option
  6631. @item 1thr
  6632. @item 2thr
  6633. @item 3thr
  6634. @item 4thr
  6635. Set banding detection threshold for each plane. Default is 0.02.
  6636. Valid range is 0.00003 to 0.5.
  6637. If difference between current pixel and reference pixel is less than threshold,
  6638. it will be considered as banded.
  6639. @item range, r
  6640. Banding detection range in pixels. Default is 16. If positive, random number
  6641. in range 0 to set value will be used. If negative, exact absolute value
  6642. will be used.
  6643. The range defines square of four pixels around current pixel.
  6644. @item direction, d
  6645. Set direction in radians from which four pixel will be compared. If positive,
  6646. random direction from 0 to set direction will be picked. If negative, exact of
  6647. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6648. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6649. column.
  6650. @item blur, b
  6651. If enabled, current pixel is compared with average value of all four
  6652. surrounding pixels. The default is enabled. If disabled current pixel is
  6653. compared with all four surrounding pixels. The pixel is considered banded
  6654. if only all four differences with surrounding pixels are less than threshold.
  6655. @item coupling, c
  6656. If enabled, current pixel is changed if and only if all pixel components are banded,
  6657. e.g. banding detection threshold is triggered for all color components.
  6658. The default is disabled.
  6659. @end table
  6660. @section deblock
  6661. Remove blocking artifacts from input video.
  6662. The filter accepts the following options:
  6663. @table @option
  6664. @item filter
  6665. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6666. This controls what kind of deblocking is applied.
  6667. @item block
  6668. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6669. @item alpha
  6670. @item beta
  6671. @item gamma
  6672. @item delta
  6673. Set blocking detection thresholds. Allowed range is 0 to 1.
  6674. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6675. Using higher threshold gives more deblocking strength.
  6676. Setting @var{alpha} controls threshold detection at exact edge of block.
  6677. Remaining options controls threshold detection near the edge. Each one for
  6678. below/above or left/right. Setting any of those to @var{0} disables
  6679. deblocking.
  6680. @item planes
  6681. Set planes to filter. Default is to filter all available planes.
  6682. @end table
  6683. @subsection Examples
  6684. @itemize
  6685. @item
  6686. Deblock using weak filter and block size of 4 pixels.
  6687. @example
  6688. deblock=filter=weak:block=4
  6689. @end example
  6690. @item
  6691. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6692. deblocking more edges.
  6693. @example
  6694. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6695. @end example
  6696. @item
  6697. Similar as above, but filter only first plane.
  6698. @example
  6699. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6700. @end example
  6701. @item
  6702. Similar as above, but filter only second and third plane.
  6703. @example
  6704. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6705. @end example
  6706. @end itemize
  6707. @anchor{decimate}
  6708. @section decimate
  6709. Drop duplicated frames at regular intervals.
  6710. The filter accepts the following options:
  6711. @table @option
  6712. @item cycle
  6713. Set the number of frames from which one will be dropped. Setting this to
  6714. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6715. Default is @code{5}.
  6716. @item dupthresh
  6717. Set the threshold for duplicate detection. If the difference metric for a frame
  6718. is less than or equal to this value, then it is declared as duplicate. Default
  6719. is @code{1.1}
  6720. @item scthresh
  6721. Set scene change threshold. Default is @code{15}.
  6722. @item blockx
  6723. @item blocky
  6724. Set the size of the x and y-axis blocks used during metric calculations.
  6725. Larger blocks give better noise suppression, but also give worse detection of
  6726. small movements. Must be a power of two. Default is @code{32}.
  6727. @item ppsrc
  6728. Mark main input as a pre-processed input and activate clean source input
  6729. stream. This allows the input to be pre-processed with various filters to help
  6730. the metrics calculation while keeping the frame selection lossless. When set to
  6731. @code{1}, the first stream is for the pre-processed input, and the second
  6732. stream is the clean source from where the kept frames are chosen. Default is
  6733. @code{0}.
  6734. @item chroma
  6735. Set whether or not chroma is considered in the metric calculations. Default is
  6736. @code{1}.
  6737. @end table
  6738. @section deconvolve
  6739. Apply 2D deconvolution of video stream in frequency domain using second stream
  6740. as impulse.
  6741. The filter accepts the following options:
  6742. @table @option
  6743. @item planes
  6744. Set which planes to process.
  6745. @item impulse
  6746. Set which impulse video frames will be processed, can be @var{first}
  6747. or @var{all}. Default is @var{all}.
  6748. @item noise
  6749. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6750. and height are not same and not power of 2 or if stream prior to convolving
  6751. had noise.
  6752. @end table
  6753. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6754. @section dedot
  6755. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6756. It accepts the following options:
  6757. @table @option
  6758. @item m
  6759. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6760. @var{rainbows} for cross-color reduction.
  6761. @item lt
  6762. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6763. @item tl
  6764. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6765. @item tc
  6766. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6767. @item ct
  6768. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6769. @end table
  6770. @section deflate
  6771. Apply deflate effect to the video.
  6772. This filter replaces the pixel by the local(3x3) average by taking into account
  6773. only values lower than the pixel.
  6774. It accepts the following options:
  6775. @table @option
  6776. @item threshold0
  6777. @item threshold1
  6778. @item threshold2
  6779. @item threshold3
  6780. Limit the maximum change for each plane, default is 65535.
  6781. If 0, plane will remain unchanged.
  6782. @end table
  6783. @subsection Commands
  6784. This filter supports the all above options as @ref{commands}.
  6785. @section deflicker
  6786. Remove temporal frame luminance variations.
  6787. It accepts the following options:
  6788. @table @option
  6789. @item size, s
  6790. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6791. @item mode, m
  6792. Set averaging mode to smooth temporal luminance variations.
  6793. Available values are:
  6794. @table @samp
  6795. @item am
  6796. Arithmetic mean
  6797. @item gm
  6798. Geometric mean
  6799. @item hm
  6800. Harmonic mean
  6801. @item qm
  6802. Quadratic mean
  6803. @item cm
  6804. Cubic mean
  6805. @item pm
  6806. Power mean
  6807. @item median
  6808. Median
  6809. @end table
  6810. @item bypass
  6811. Do not actually modify frame. Useful when one only wants metadata.
  6812. @end table
  6813. @section dejudder
  6814. Remove judder produced by partially interlaced telecined content.
  6815. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6816. source was partially telecined content then the output of @code{pullup,dejudder}
  6817. will have a variable frame rate. May change the recorded frame rate of the
  6818. container. Aside from that change, this filter will not affect constant frame
  6819. rate video.
  6820. The option available in this filter is:
  6821. @table @option
  6822. @item cycle
  6823. Specify the length of the window over which the judder repeats.
  6824. Accepts any integer greater than 1. Useful values are:
  6825. @table @samp
  6826. @item 4
  6827. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6828. @item 5
  6829. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6830. @item 20
  6831. If a mixture of the two.
  6832. @end table
  6833. The default is @samp{4}.
  6834. @end table
  6835. @section delogo
  6836. Suppress a TV station logo by a simple interpolation of the surrounding
  6837. pixels. Just set a rectangle covering the logo and watch it disappear
  6838. (and sometimes something even uglier appear - your mileage may vary).
  6839. It accepts the following parameters:
  6840. @table @option
  6841. @item x
  6842. @item y
  6843. Specify the top left corner coordinates of the logo. They must be
  6844. specified.
  6845. @item w
  6846. @item h
  6847. Specify the width and height of the logo to clear. They must be
  6848. specified.
  6849. @item band, t
  6850. Specify the thickness of the fuzzy edge of the rectangle (added to
  6851. @var{w} and @var{h}). The default value is 1. This option is
  6852. deprecated, setting higher values should no longer be necessary and
  6853. is not recommended.
  6854. @item show
  6855. When set to 1, a green rectangle is drawn on the screen to simplify
  6856. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6857. The default value is 0.
  6858. The rectangle is drawn on the outermost pixels which will be (partly)
  6859. replaced with interpolated values. The values of the next pixels
  6860. immediately outside this rectangle in each direction will be used to
  6861. compute the interpolated pixel values inside the rectangle.
  6862. @end table
  6863. @subsection Examples
  6864. @itemize
  6865. @item
  6866. Set a rectangle covering the area with top left corner coordinates 0,0
  6867. and size 100x77, and a band of size 10:
  6868. @example
  6869. delogo=x=0:y=0:w=100:h=77:band=10
  6870. @end example
  6871. @end itemize
  6872. @anchor{derain}
  6873. @section derain
  6874. Remove the rain in the input image/video by applying the derain methods based on
  6875. convolutional neural networks. Supported models:
  6876. @itemize
  6877. @item
  6878. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  6879. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  6880. @end itemize
  6881. Training as well as model generation scripts are provided in
  6882. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  6883. Native model files (.model) can be generated from TensorFlow model
  6884. files (.pb) by using tools/python/convert.py
  6885. The filter accepts the following options:
  6886. @table @option
  6887. @item filter_type
  6888. Specify which filter to use. This option accepts the following values:
  6889. @table @samp
  6890. @item derain
  6891. Derain filter. To conduct derain filter, you need to use a derain model.
  6892. @item dehaze
  6893. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  6894. @end table
  6895. Default value is @samp{derain}.
  6896. @item dnn_backend
  6897. Specify which DNN backend to use for model loading and execution. This option accepts
  6898. the following values:
  6899. @table @samp
  6900. @item native
  6901. Native implementation of DNN loading and execution.
  6902. @item tensorflow
  6903. TensorFlow backend. To enable this backend you
  6904. need to install the TensorFlow for C library (see
  6905. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  6906. @code{--enable-libtensorflow}
  6907. @end table
  6908. Default value is @samp{native}.
  6909. @item model
  6910. Set path to model file specifying network architecture and its parameters.
  6911. Note that different backends use different file formats. TensorFlow and native
  6912. backend can load files for only its format.
  6913. @end table
  6914. It can also be finished with @ref{dnn_processing} filter.
  6915. @section deshake
  6916. Attempt to fix small changes in horizontal and/or vertical shift. This
  6917. filter helps remove camera shake from hand-holding a camera, bumping a
  6918. tripod, moving on a vehicle, etc.
  6919. The filter accepts the following options:
  6920. @table @option
  6921. @item x
  6922. @item y
  6923. @item w
  6924. @item h
  6925. Specify a rectangular area where to limit the search for motion
  6926. vectors.
  6927. If desired the search for motion vectors can be limited to a
  6928. rectangular area of the frame defined by its top left corner, width
  6929. and height. These parameters have the same meaning as the drawbox
  6930. filter which can be used to visualise the position of the bounding
  6931. box.
  6932. This is useful when simultaneous movement of subjects within the frame
  6933. might be confused for camera motion by the motion vector search.
  6934. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6935. then the full frame is used. This allows later options to be set
  6936. without specifying the bounding box for the motion vector search.
  6937. Default - search the whole frame.
  6938. @item rx
  6939. @item ry
  6940. Specify the maximum extent of movement in x and y directions in the
  6941. range 0-64 pixels. Default 16.
  6942. @item edge
  6943. Specify how to generate pixels to fill blanks at the edge of the
  6944. frame. Available values are:
  6945. @table @samp
  6946. @item blank, 0
  6947. Fill zeroes at blank locations
  6948. @item original, 1
  6949. Original image at blank locations
  6950. @item clamp, 2
  6951. Extruded edge value at blank locations
  6952. @item mirror, 3
  6953. Mirrored edge at blank locations
  6954. @end table
  6955. Default value is @samp{mirror}.
  6956. @item blocksize
  6957. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6958. default 8.
  6959. @item contrast
  6960. Specify the contrast threshold for blocks. Only blocks with more than
  6961. the specified contrast (difference between darkest and lightest
  6962. pixels) will be considered. Range 1-255, default 125.
  6963. @item search
  6964. Specify the search strategy. Available values are:
  6965. @table @samp
  6966. @item exhaustive, 0
  6967. Set exhaustive search
  6968. @item less, 1
  6969. Set less exhaustive search.
  6970. @end table
  6971. Default value is @samp{exhaustive}.
  6972. @item filename
  6973. If set then a detailed log of the motion search is written to the
  6974. specified file.
  6975. @end table
  6976. @section despill
  6977. Remove unwanted contamination of foreground colors, caused by reflected color of
  6978. greenscreen or bluescreen.
  6979. This filter accepts the following options:
  6980. @table @option
  6981. @item type
  6982. Set what type of despill to use.
  6983. @item mix
  6984. Set how spillmap will be generated.
  6985. @item expand
  6986. Set how much to get rid of still remaining spill.
  6987. @item red
  6988. Controls amount of red in spill area.
  6989. @item green
  6990. Controls amount of green in spill area.
  6991. Should be -1 for greenscreen.
  6992. @item blue
  6993. Controls amount of blue in spill area.
  6994. Should be -1 for bluescreen.
  6995. @item brightness
  6996. Controls brightness of spill area, preserving colors.
  6997. @item alpha
  6998. Modify alpha from generated spillmap.
  6999. @end table
  7000. @section detelecine
  7001. Apply an exact inverse of the telecine operation. It requires a predefined
  7002. pattern specified using the pattern option which must be the same as that passed
  7003. to the telecine filter.
  7004. This filter accepts the following options:
  7005. @table @option
  7006. @item first_field
  7007. @table @samp
  7008. @item top, t
  7009. top field first
  7010. @item bottom, b
  7011. bottom field first
  7012. The default value is @code{top}.
  7013. @end table
  7014. @item pattern
  7015. A string of numbers representing the pulldown pattern you wish to apply.
  7016. The default value is @code{23}.
  7017. @item start_frame
  7018. A number representing position of the first frame with respect to the telecine
  7019. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  7020. @end table
  7021. @section dilation
  7022. Apply dilation effect to the video.
  7023. This filter replaces the pixel by the local(3x3) maximum.
  7024. It accepts the following options:
  7025. @table @option
  7026. @item threshold0
  7027. @item threshold1
  7028. @item threshold2
  7029. @item threshold3
  7030. Limit the maximum change for each plane, default is 65535.
  7031. If 0, plane will remain unchanged.
  7032. @item coordinates
  7033. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7034. pixels are used.
  7035. Flags to local 3x3 coordinates maps like this:
  7036. 1 2 3
  7037. 4 5
  7038. 6 7 8
  7039. @end table
  7040. @subsection Commands
  7041. This filter supports the all above options as @ref{commands}.
  7042. @section displace
  7043. Displace pixels as indicated by second and third input stream.
  7044. It takes three input streams and outputs one stream, the first input is the
  7045. source, and second and third input are displacement maps.
  7046. The second input specifies how much to displace pixels along the
  7047. x-axis, while the third input specifies how much to displace pixels
  7048. along the y-axis.
  7049. If one of displacement map streams terminates, last frame from that
  7050. displacement map will be used.
  7051. Note that once generated, displacements maps can be reused over and over again.
  7052. A description of the accepted options follows.
  7053. @table @option
  7054. @item edge
  7055. Set displace behavior for pixels that are out of range.
  7056. Available values are:
  7057. @table @samp
  7058. @item blank
  7059. Missing pixels are replaced by black pixels.
  7060. @item smear
  7061. Adjacent pixels will spread out to replace missing pixels.
  7062. @item wrap
  7063. Out of range pixels are wrapped so they point to pixels of other side.
  7064. @item mirror
  7065. Out of range pixels will be replaced with mirrored pixels.
  7066. @end table
  7067. Default is @samp{smear}.
  7068. @end table
  7069. @subsection Examples
  7070. @itemize
  7071. @item
  7072. Add ripple effect to rgb input of video size hd720:
  7073. @example
  7074. 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
  7075. @end example
  7076. @item
  7077. Add wave effect to rgb input of video size hd720:
  7078. @example
  7079. 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
  7080. @end example
  7081. @end itemize
  7082. @anchor{dnn_processing}
  7083. @section dnn_processing
  7084. Do image processing with deep neural networks. It works together with another filter
  7085. which converts the pixel format of the Frame to what the dnn network requires.
  7086. The filter accepts the following options:
  7087. @table @option
  7088. @item dnn_backend
  7089. Specify which DNN backend to use for model loading and execution. This option accepts
  7090. the following values:
  7091. @table @samp
  7092. @item native
  7093. Native implementation of DNN loading and execution.
  7094. @item tensorflow
  7095. TensorFlow backend. To enable this backend you
  7096. need to install the TensorFlow for C library (see
  7097. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7098. @code{--enable-libtensorflow}
  7099. @end table
  7100. Default value is @samp{native}.
  7101. @item model
  7102. Set path to model file specifying network architecture and its parameters.
  7103. Note that different backends use different file formats. TensorFlow and native
  7104. backend can load files for only its format.
  7105. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  7106. @item input
  7107. Set the input name of the dnn network.
  7108. @item output
  7109. Set the output name of the dnn network.
  7110. @end table
  7111. @subsection Examples
  7112. @itemize
  7113. @item
  7114. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  7115. @example
  7116. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  7117. @end example
  7118. @item
  7119. Halve the pixel value of the frame with format gray32f:
  7120. @example
  7121. ffmpeg -i input.jpg -vf format=grayf32,dnn_processing=model=halve_gray_float.model:input=dnn_in:output=dnn_out:dnn_backend=native -y out.native.png
  7122. @end example
  7123. @item
  7124. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  7125. @example
  7126. ./ffmpeg -i 480p.jpg -vf format=yuv420p,scale=w=iw*2:h=ih*2,dnn_processing=dnn_backend=tensorflow:model=srcnn.pb:input=x:output=y -y srcnn.jpg
  7127. @end example
  7128. @item
  7129. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported):
  7130. @example
  7131. ./ffmpeg -i 480p.jpg -vf format=yuv420p,dnn_processing=dnn_backend=tensorflow:model=espcn.pb:input=x:output=y -y tmp.espcn.jpg
  7132. @end example
  7133. @end itemize
  7134. @section drawbox
  7135. Draw a colored box on the input image.
  7136. It accepts the following parameters:
  7137. @table @option
  7138. @item x
  7139. @item y
  7140. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  7141. @item width, w
  7142. @item height, h
  7143. The expressions which specify the width and height of the box; if 0 they are interpreted as
  7144. the input width and height. It defaults to 0.
  7145. @item color, c
  7146. Specify the color of the box to write. For the general syntax of this option,
  7147. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7148. value @code{invert} is used, the box edge color is the same as the
  7149. video with inverted luma.
  7150. @item thickness, t
  7151. The expression which sets the thickness of the box edge.
  7152. A value of @code{fill} will create a filled box. Default value is @code{3}.
  7153. See below for the list of accepted constants.
  7154. @item replace
  7155. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  7156. will overwrite the video's color and alpha pixels.
  7157. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  7158. @end table
  7159. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7160. following constants:
  7161. @table @option
  7162. @item dar
  7163. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7164. @item hsub
  7165. @item vsub
  7166. horizontal and vertical chroma subsample values. For example for the
  7167. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7168. @item in_h, ih
  7169. @item in_w, iw
  7170. The input width and height.
  7171. @item sar
  7172. The input sample aspect ratio.
  7173. @item x
  7174. @item y
  7175. The x and y offset coordinates where the box is drawn.
  7176. @item w
  7177. @item h
  7178. The width and height of the drawn box.
  7179. @item t
  7180. The thickness of the drawn box.
  7181. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7182. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7183. @end table
  7184. @subsection Examples
  7185. @itemize
  7186. @item
  7187. Draw a black box around the edge of the input image:
  7188. @example
  7189. drawbox
  7190. @end example
  7191. @item
  7192. Draw a box with color red and an opacity of 50%:
  7193. @example
  7194. drawbox=10:20:200:60:red@@0.5
  7195. @end example
  7196. The previous example can be specified as:
  7197. @example
  7198. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  7199. @end example
  7200. @item
  7201. Fill the box with pink color:
  7202. @example
  7203. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  7204. @end example
  7205. @item
  7206. Draw a 2-pixel red 2.40:1 mask:
  7207. @example
  7208. 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
  7209. @end example
  7210. @end itemize
  7211. @subsection Commands
  7212. This filter supports same commands as options.
  7213. The command accepts the same syntax of the corresponding option.
  7214. If the specified expression is not valid, it is kept at its current
  7215. value.
  7216. @anchor{drawgraph}
  7217. @section drawgraph
  7218. Draw a graph using input video metadata.
  7219. It accepts the following parameters:
  7220. @table @option
  7221. @item m1
  7222. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  7223. @item fg1
  7224. Set 1st foreground color expression.
  7225. @item m2
  7226. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  7227. @item fg2
  7228. Set 2nd foreground color expression.
  7229. @item m3
  7230. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  7231. @item fg3
  7232. Set 3rd foreground color expression.
  7233. @item m4
  7234. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  7235. @item fg4
  7236. Set 4th foreground color expression.
  7237. @item min
  7238. Set minimal value of metadata value.
  7239. @item max
  7240. Set maximal value of metadata value.
  7241. @item bg
  7242. Set graph background color. Default is white.
  7243. @item mode
  7244. Set graph mode.
  7245. Available values for mode is:
  7246. @table @samp
  7247. @item bar
  7248. @item dot
  7249. @item line
  7250. @end table
  7251. Default is @code{line}.
  7252. @item slide
  7253. Set slide mode.
  7254. Available values for slide is:
  7255. @table @samp
  7256. @item frame
  7257. Draw new frame when right border is reached.
  7258. @item replace
  7259. Replace old columns with new ones.
  7260. @item scroll
  7261. Scroll from right to left.
  7262. @item rscroll
  7263. Scroll from left to right.
  7264. @item picture
  7265. Draw single picture.
  7266. @end table
  7267. Default is @code{frame}.
  7268. @item size
  7269. Set size of graph video. For the syntax of this option, check the
  7270. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7271. The default value is @code{900x256}.
  7272. @item rate, r
  7273. Set the output frame rate. Default value is @code{25}.
  7274. The foreground color expressions can use the following variables:
  7275. @table @option
  7276. @item MIN
  7277. Minimal value of metadata value.
  7278. @item MAX
  7279. Maximal value of metadata value.
  7280. @item VAL
  7281. Current metadata key value.
  7282. @end table
  7283. The color is defined as 0xAABBGGRR.
  7284. @end table
  7285. Example using metadata from @ref{signalstats} filter:
  7286. @example
  7287. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  7288. @end example
  7289. Example using metadata from @ref{ebur128} filter:
  7290. @example
  7291. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  7292. @end example
  7293. @section drawgrid
  7294. Draw a grid on the input image.
  7295. It accepts the following parameters:
  7296. @table @option
  7297. @item x
  7298. @item y
  7299. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  7300. @item width, w
  7301. @item height, h
  7302. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  7303. input width and height, respectively, minus @code{thickness}, so image gets
  7304. framed. Default to 0.
  7305. @item color, c
  7306. Specify the color of the grid. For the general syntax of this option,
  7307. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7308. value @code{invert} is used, the grid color is the same as the
  7309. video with inverted luma.
  7310. @item thickness, t
  7311. The expression which sets the thickness of the grid line. Default value is @code{1}.
  7312. See below for the list of accepted constants.
  7313. @item replace
  7314. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  7315. will overwrite the video's color and alpha pixels.
  7316. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  7317. @end table
  7318. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7319. following constants:
  7320. @table @option
  7321. @item dar
  7322. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7323. @item hsub
  7324. @item vsub
  7325. horizontal and vertical chroma subsample values. For example for the
  7326. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7327. @item in_h, ih
  7328. @item in_w, iw
  7329. The input grid cell width and height.
  7330. @item sar
  7331. The input sample aspect ratio.
  7332. @item x
  7333. @item y
  7334. The x and y coordinates of some point of grid intersection (meant to configure offset).
  7335. @item w
  7336. @item h
  7337. The width and height of the drawn cell.
  7338. @item t
  7339. The thickness of the drawn cell.
  7340. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7341. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7342. @end table
  7343. @subsection Examples
  7344. @itemize
  7345. @item
  7346. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  7347. @example
  7348. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  7349. @end example
  7350. @item
  7351. Draw a white 3x3 grid with an opacity of 50%:
  7352. @example
  7353. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  7354. @end example
  7355. @end itemize
  7356. @subsection Commands
  7357. This filter supports same commands as options.
  7358. The command accepts the same syntax of the corresponding option.
  7359. If the specified expression is not valid, it is kept at its current
  7360. value.
  7361. @anchor{drawtext}
  7362. @section drawtext
  7363. Draw a text string or text from a specified file on top of a video, using the
  7364. libfreetype library.
  7365. To enable compilation of this filter, you need to configure FFmpeg with
  7366. @code{--enable-libfreetype}.
  7367. To enable default font fallback and the @var{font} option you need to
  7368. configure FFmpeg with @code{--enable-libfontconfig}.
  7369. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  7370. @code{--enable-libfribidi}.
  7371. @subsection Syntax
  7372. It accepts the following parameters:
  7373. @table @option
  7374. @item box
  7375. Used to draw a box around text using the background color.
  7376. The value must be either 1 (enable) or 0 (disable).
  7377. The default value of @var{box} is 0.
  7378. @item boxborderw
  7379. Set the width of the border to be drawn around the box using @var{boxcolor}.
  7380. The default value of @var{boxborderw} is 0.
  7381. @item boxcolor
  7382. The color to be used for drawing box around text. For the syntax of this
  7383. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7384. The default value of @var{boxcolor} is "white".
  7385. @item line_spacing
  7386. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  7387. The default value of @var{line_spacing} is 0.
  7388. @item borderw
  7389. Set the width of the border to be drawn around the text using @var{bordercolor}.
  7390. The default value of @var{borderw} is 0.
  7391. @item bordercolor
  7392. Set the color to be used for drawing border around text. For the syntax of this
  7393. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7394. The default value of @var{bordercolor} is "black".
  7395. @item expansion
  7396. Select how the @var{text} is expanded. Can be either @code{none},
  7397. @code{strftime} (deprecated) or
  7398. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  7399. below for details.
  7400. @item basetime
  7401. Set a start time for the count. Value is in microseconds. Only applied
  7402. in the deprecated strftime expansion mode. To emulate in normal expansion
  7403. mode use the @code{pts} function, supplying the start time (in seconds)
  7404. as the second argument.
  7405. @item fix_bounds
  7406. If true, check and fix text coords to avoid clipping.
  7407. @item fontcolor
  7408. The color to be used for drawing fonts. For the syntax of this option, check
  7409. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7410. The default value of @var{fontcolor} is "black".
  7411. @item fontcolor_expr
  7412. String which is expanded the same way as @var{text} to obtain dynamic
  7413. @var{fontcolor} value. By default this option has empty value and is not
  7414. processed. When this option is set, it overrides @var{fontcolor} option.
  7415. @item font
  7416. The font family to be used for drawing text. By default Sans.
  7417. @item fontfile
  7418. The font file to be used for drawing text. The path must be included.
  7419. This parameter is mandatory if the fontconfig support is disabled.
  7420. @item alpha
  7421. Draw the text applying alpha blending. The value can
  7422. be a number between 0.0 and 1.0.
  7423. The expression accepts the same variables @var{x, y} as well.
  7424. The default value is 1.
  7425. Please see @var{fontcolor_expr}.
  7426. @item fontsize
  7427. The font size to be used for drawing text.
  7428. The default value of @var{fontsize} is 16.
  7429. @item text_shaping
  7430. If set to 1, attempt to shape the text (for example, reverse the order of
  7431. right-to-left text and join Arabic characters) before drawing it.
  7432. Otherwise, just draw the text exactly as given.
  7433. By default 1 (if supported).
  7434. @item ft_load_flags
  7435. The flags to be used for loading the fonts.
  7436. The flags map the corresponding flags supported by libfreetype, and are
  7437. a combination of the following values:
  7438. @table @var
  7439. @item default
  7440. @item no_scale
  7441. @item no_hinting
  7442. @item render
  7443. @item no_bitmap
  7444. @item vertical_layout
  7445. @item force_autohint
  7446. @item crop_bitmap
  7447. @item pedantic
  7448. @item ignore_global_advance_width
  7449. @item no_recurse
  7450. @item ignore_transform
  7451. @item monochrome
  7452. @item linear_design
  7453. @item no_autohint
  7454. @end table
  7455. Default value is "default".
  7456. For more information consult the documentation for the FT_LOAD_*
  7457. libfreetype flags.
  7458. @item shadowcolor
  7459. The color to be used for drawing a shadow behind the drawn text. For the
  7460. syntax of this option, check the @ref{color syntax,,"Color" section in the
  7461. ffmpeg-utils manual,ffmpeg-utils}.
  7462. The default value of @var{shadowcolor} is "black".
  7463. @item shadowx
  7464. @item shadowy
  7465. The x and y offsets for the text shadow position with respect to the
  7466. position of the text. They can be either positive or negative
  7467. values. The default value for both is "0".
  7468. @item start_number
  7469. The starting frame number for the n/frame_num variable. The default value
  7470. is "0".
  7471. @item tabsize
  7472. The size in number of spaces to use for rendering the tab.
  7473. Default value is 4.
  7474. @item timecode
  7475. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  7476. format. It can be used with or without text parameter. @var{timecode_rate}
  7477. option must be specified.
  7478. @item timecode_rate, rate, r
  7479. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  7480. integer. Minimum value is "1".
  7481. Drop-frame timecode is supported for frame rates 30 & 60.
  7482. @item tc24hmax
  7483. If set to 1, the output of the timecode option will wrap around at 24 hours.
  7484. Default is 0 (disabled).
  7485. @item text
  7486. The text string to be drawn. The text must be a sequence of UTF-8
  7487. encoded characters.
  7488. This parameter is mandatory if no file is specified with the parameter
  7489. @var{textfile}.
  7490. @item textfile
  7491. A text file containing text to be drawn. The text must be a sequence
  7492. of UTF-8 encoded characters.
  7493. This parameter is mandatory if no text string is specified with the
  7494. parameter @var{text}.
  7495. If both @var{text} and @var{textfile} are specified, an error is thrown.
  7496. @item reload
  7497. If set to 1, the @var{textfile} will be reloaded before each frame.
  7498. Be sure to update it atomically, or it may be read partially, or even fail.
  7499. @item x
  7500. @item y
  7501. The expressions which specify the offsets where text will be drawn
  7502. within the video frame. They are relative to the top/left border of the
  7503. output image.
  7504. The default value of @var{x} and @var{y} is "0".
  7505. See below for the list of accepted constants and functions.
  7506. @end table
  7507. The parameters for @var{x} and @var{y} are expressions containing the
  7508. following constants and functions:
  7509. @table @option
  7510. @item dar
  7511. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  7512. @item hsub
  7513. @item vsub
  7514. horizontal and vertical chroma subsample values. For example for the
  7515. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7516. @item line_h, lh
  7517. the height of each text line
  7518. @item main_h, h, H
  7519. the input height
  7520. @item main_w, w, W
  7521. the input width
  7522. @item max_glyph_a, ascent
  7523. the maximum distance from the baseline to the highest/upper grid
  7524. coordinate used to place a glyph outline point, for all the rendered
  7525. glyphs.
  7526. It is a positive value, due to the grid's orientation with the Y axis
  7527. upwards.
  7528. @item max_glyph_d, descent
  7529. the maximum distance from the baseline to the lowest grid coordinate
  7530. used to place a glyph outline point, for all the rendered glyphs.
  7531. This is a negative value, due to the grid's orientation, with the Y axis
  7532. upwards.
  7533. @item max_glyph_h
  7534. maximum glyph height, that is the maximum height for all the glyphs
  7535. contained in the rendered text, it is equivalent to @var{ascent} -
  7536. @var{descent}.
  7537. @item max_glyph_w
  7538. maximum glyph width, that is the maximum width for all the glyphs
  7539. contained in the rendered text
  7540. @item n
  7541. the number of input frame, starting from 0
  7542. @item rand(min, max)
  7543. return a random number included between @var{min} and @var{max}
  7544. @item sar
  7545. The input sample aspect ratio.
  7546. @item t
  7547. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7548. @item text_h, th
  7549. the height of the rendered text
  7550. @item text_w, tw
  7551. the width of the rendered text
  7552. @item x
  7553. @item y
  7554. the x and y offset coordinates where the text is drawn.
  7555. These parameters allow the @var{x} and @var{y} expressions to refer
  7556. to each other, so you can for example specify @code{y=x/dar}.
  7557. @item pict_type
  7558. A one character description of the current frame's picture type.
  7559. @item pkt_pos
  7560. The current packet's position in the input file or stream
  7561. (in bytes, from the start of the input). A value of -1 indicates
  7562. this info is not available.
  7563. @item pkt_duration
  7564. The current packet's duration, in seconds.
  7565. @item pkt_size
  7566. The current packet's size (in bytes).
  7567. @end table
  7568. @anchor{drawtext_expansion}
  7569. @subsection Text expansion
  7570. If @option{expansion} is set to @code{strftime},
  7571. the filter recognizes strftime() sequences in the provided text and
  7572. expands them accordingly. Check the documentation of strftime(). This
  7573. feature is deprecated.
  7574. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  7575. If @option{expansion} is set to @code{normal} (which is the default),
  7576. the following expansion mechanism is used.
  7577. The backslash character @samp{\}, followed by any character, always expands to
  7578. the second character.
  7579. Sequences of the form @code{%@{...@}} are expanded. The text between the
  7580. braces is a function name, possibly followed by arguments separated by ':'.
  7581. If the arguments contain special characters or delimiters (':' or '@}'),
  7582. they should be escaped.
  7583. Note that they probably must also be escaped as the value for the
  7584. @option{text} option in the filter argument string and as the filter
  7585. argument in the filtergraph description, and possibly also for the shell,
  7586. that makes up to four levels of escaping; using a text file avoids these
  7587. problems.
  7588. The following functions are available:
  7589. @table @command
  7590. @item expr, e
  7591. The expression evaluation result.
  7592. It must take one argument specifying the expression to be evaluated,
  7593. which accepts the same constants and functions as the @var{x} and
  7594. @var{y} values. Note that not all constants should be used, for
  7595. example the text size is not known when evaluating the expression, so
  7596. the constants @var{text_w} and @var{text_h} will have an undefined
  7597. value.
  7598. @item expr_int_format, eif
  7599. Evaluate the expression's value and output as formatted integer.
  7600. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  7601. The second argument specifies the output format. Allowed values are @samp{x},
  7602. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  7603. @code{printf} function.
  7604. The third parameter is optional and sets the number of positions taken by the output.
  7605. It can be used to add padding with zeros from the left.
  7606. @item gmtime
  7607. The time at which the filter is running, expressed in UTC.
  7608. It can accept an argument: a strftime() format string.
  7609. @item localtime
  7610. The time at which the filter is running, expressed in the local time zone.
  7611. It can accept an argument: a strftime() format string.
  7612. @item metadata
  7613. Frame metadata. Takes one or two arguments.
  7614. The first argument is mandatory and specifies the metadata key.
  7615. The second argument is optional and specifies a default value, used when the
  7616. metadata key is not found or empty.
  7617. Available metadata can be identified by inspecting entries
  7618. starting with TAG included within each frame section
  7619. printed by running @code{ffprobe -show_frames}.
  7620. String metadata generated in filters leading to
  7621. the drawtext filter are also available.
  7622. @item n, frame_num
  7623. The frame number, starting from 0.
  7624. @item pict_type
  7625. A one character description of the current picture type.
  7626. @item pts
  7627. The timestamp of the current frame.
  7628. It can take up to three arguments.
  7629. The first argument is the format of the timestamp; it defaults to @code{flt}
  7630. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  7631. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  7632. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  7633. @code{localtime} stands for the timestamp of the frame formatted as
  7634. local time zone time.
  7635. The second argument is an offset added to the timestamp.
  7636. If the format is set to @code{hms}, a third argument @code{24HH} may be
  7637. supplied to present the hour part of the formatted timestamp in 24h format
  7638. (00-23).
  7639. If the format is set to @code{localtime} or @code{gmtime},
  7640. a third argument may be supplied: a strftime() format string.
  7641. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  7642. @end table
  7643. @subsection Commands
  7644. This filter supports altering parameters via commands:
  7645. @table @option
  7646. @item reinit
  7647. Alter existing filter parameters.
  7648. Syntax for the argument is the same as for filter invocation, e.g.
  7649. @example
  7650. fontsize=56:fontcolor=green:text='Hello World'
  7651. @end example
  7652. Full filter invocation with sendcmd would look like this:
  7653. @example
  7654. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7655. @end example
  7656. @end table
  7657. If the entire argument can't be parsed or applied as valid values then the filter will
  7658. continue with its existing parameters.
  7659. @subsection Examples
  7660. @itemize
  7661. @item
  7662. Draw "Test Text" with font FreeSerif, using the default values for the
  7663. optional parameters.
  7664. @example
  7665. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7666. @end example
  7667. @item
  7668. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7669. and y=50 (counting from the top-left corner of the screen), text is
  7670. yellow with a red box around it. Both the text and the box have an
  7671. opacity of 20%.
  7672. @example
  7673. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7674. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7675. @end example
  7676. Note that the double quotes are not necessary if spaces are not used
  7677. within the parameter list.
  7678. @item
  7679. Show the text at the center of the video frame:
  7680. @example
  7681. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7682. @end example
  7683. @item
  7684. Show the text at a random position, switching to a new position every 30 seconds:
  7685. @example
  7686. 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)"
  7687. @end example
  7688. @item
  7689. Show a text line sliding from right to left in the last row of the video
  7690. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7691. with no newlines.
  7692. @example
  7693. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7694. @end example
  7695. @item
  7696. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7697. @example
  7698. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7699. @end example
  7700. @item
  7701. Draw a single green letter "g", at the center of the input video.
  7702. The glyph baseline is placed at half screen height.
  7703. @example
  7704. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7705. @end example
  7706. @item
  7707. Show text for 1 second every 3 seconds:
  7708. @example
  7709. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7710. @end example
  7711. @item
  7712. Use fontconfig to set the font. Note that the colons need to be escaped.
  7713. @example
  7714. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7715. @end example
  7716. @item
  7717. Print the date of a real-time encoding (see strftime(3)):
  7718. @example
  7719. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7720. @end example
  7721. @item
  7722. Show text fading in and out (appearing/disappearing):
  7723. @example
  7724. #!/bin/sh
  7725. DS=1.0 # display start
  7726. DE=10.0 # display end
  7727. FID=1.5 # fade in duration
  7728. FOD=5 # fade out duration
  7729. 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 @}"
  7730. @end example
  7731. @item
  7732. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7733. and the @option{fontsize} value are included in the @option{y} offset.
  7734. @example
  7735. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7736. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7737. @end example
  7738. @item
  7739. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  7740. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  7741. must have option @option{-export_path_metadata 1} for the special metadata fields
  7742. to be available for filters.
  7743. @example
  7744. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  7745. @end example
  7746. @end itemize
  7747. For more information about libfreetype, check:
  7748. @url{http://www.freetype.org/}.
  7749. For more information about fontconfig, check:
  7750. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7751. For more information about libfribidi, check:
  7752. @url{http://fribidi.org/}.
  7753. @section edgedetect
  7754. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7755. The filter accepts the following options:
  7756. @table @option
  7757. @item low
  7758. @item high
  7759. Set low and high threshold values used by the Canny thresholding
  7760. algorithm.
  7761. The high threshold selects the "strong" edge pixels, which are then
  7762. connected through 8-connectivity with the "weak" edge pixels selected
  7763. by the low threshold.
  7764. @var{low} and @var{high} threshold values must be chosen in the range
  7765. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7766. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  7767. is @code{50/255}.
  7768. @item mode
  7769. Define the drawing mode.
  7770. @table @samp
  7771. @item wires
  7772. Draw white/gray wires on black background.
  7773. @item colormix
  7774. Mix the colors to create a paint/cartoon effect.
  7775. @item canny
  7776. Apply Canny edge detector on all selected planes.
  7777. @end table
  7778. Default value is @var{wires}.
  7779. @item planes
  7780. Select planes for filtering. By default all available planes are filtered.
  7781. @end table
  7782. @subsection Examples
  7783. @itemize
  7784. @item
  7785. Standard edge detection with custom values for the hysteresis thresholding:
  7786. @example
  7787. edgedetect=low=0.1:high=0.4
  7788. @end example
  7789. @item
  7790. Painting effect without thresholding:
  7791. @example
  7792. edgedetect=mode=colormix:high=0
  7793. @end example
  7794. @end itemize
  7795. @section elbg
  7796. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7797. For each input image, the filter will compute the optimal mapping from
  7798. the input to the output given the codebook length, that is the number
  7799. of distinct output colors.
  7800. This filter accepts the following options.
  7801. @table @option
  7802. @item codebook_length, l
  7803. Set codebook length. The value must be a positive integer, and
  7804. represents the number of distinct output colors. Default value is 256.
  7805. @item nb_steps, n
  7806. Set the maximum number of iterations to apply for computing the optimal
  7807. mapping. The higher the value the better the result and the higher the
  7808. computation time. Default value is 1.
  7809. @item seed, s
  7810. Set a random seed, must be an integer included between 0 and
  7811. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7812. will try to use a good random seed on a best effort basis.
  7813. @item pal8
  7814. Set pal8 output pixel format. This option does not work with codebook
  7815. length greater than 256.
  7816. @end table
  7817. @section entropy
  7818. Measure graylevel entropy in histogram of color channels of video frames.
  7819. It accepts the following parameters:
  7820. @table @option
  7821. @item mode
  7822. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7823. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7824. between neighbour histogram values.
  7825. @end table
  7826. @section eq
  7827. Set brightness, contrast, saturation and approximate gamma adjustment.
  7828. The filter accepts the following options:
  7829. @table @option
  7830. @item contrast
  7831. Set the contrast expression. The value must be a float value in range
  7832. @code{-1000.0} to @code{1000.0}. The default value is "1".
  7833. @item brightness
  7834. Set the brightness expression. The value must be a float value in
  7835. range @code{-1.0} to @code{1.0}. The default value is "0".
  7836. @item saturation
  7837. Set the saturation expression. The value must be a float in
  7838. range @code{0.0} to @code{3.0}. The default value is "1".
  7839. @item gamma
  7840. Set the gamma expression. The value must be a float in range
  7841. @code{0.1} to @code{10.0}. The default value is "1".
  7842. @item gamma_r
  7843. Set the gamma expression for red. The value must be a float in
  7844. range @code{0.1} to @code{10.0}. The default value is "1".
  7845. @item gamma_g
  7846. Set the gamma expression for green. The value must be a float in range
  7847. @code{0.1} to @code{10.0}. The default value is "1".
  7848. @item gamma_b
  7849. Set the gamma expression for blue. The value must be a float in range
  7850. @code{0.1} to @code{10.0}. The default value is "1".
  7851. @item gamma_weight
  7852. Set the gamma weight expression. It can be used to reduce the effect
  7853. of a high gamma value on bright image areas, e.g. keep them from
  7854. getting overamplified and just plain white. The value must be a float
  7855. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7856. gamma correction all the way down while @code{1.0} leaves it at its
  7857. full strength. Default is "1".
  7858. @item eval
  7859. Set when the expressions for brightness, contrast, saturation and
  7860. gamma expressions are evaluated.
  7861. It accepts the following values:
  7862. @table @samp
  7863. @item init
  7864. only evaluate expressions once during the filter initialization or
  7865. when a command is processed
  7866. @item frame
  7867. evaluate expressions for each incoming frame
  7868. @end table
  7869. Default value is @samp{init}.
  7870. @end table
  7871. The expressions accept the following parameters:
  7872. @table @option
  7873. @item n
  7874. frame count of the input frame starting from 0
  7875. @item pos
  7876. byte position of the corresponding packet in the input file, NAN if
  7877. unspecified
  7878. @item r
  7879. frame rate of the input video, NAN if the input frame rate is unknown
  7880. @item t
  7881. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7882. @end table
  7883. @subsection Commands
  7884. The filter supports the following commands:
  7885. @table @option
  7886. @item contrast
  7887. Set the contrast expression.
  7888. @item brightness
  7889. Set the brightness expression.
  7890. @item saturation
  7891. Set the saturation expression.
  7892. @item gamma
  7893. Set the gamma expression.
  7894. @item gamma_r
  7895. Set the gamma_r expression.
  7896. @item gamma_g
  7897. Set gamma_g expression.
  7898. @item gamma_b
  7899. Set gamma_b expression.
  7900. @item gamma_weight
  7901. Set gamma_weight expression.
  7902. The command accepts the same syntax of the corresponding option.
  7903. If the specified expression is not valid, it is kept at its current
  7904. value.
  7905. @end table
  7906. @section erosion
  7907. Apply erosion effect to the video.
  7908. This filter replaces the pixel by the local(3x3) minimum.
  7909. It accepts the following options:
  7910. @table @option
  7911. @item threshold0
  7912. @item threshold1
  7913. @item threshold2
  7914. @item threshold3
  7915. Limit the maximum change for each plane, default is 65535.
  7916. If 0, plane will remain unchanged.
  7917. @item coordinates
  7918. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7919. pixels are used.
  7920. Flags to local 3x3 coordinates maps like this:
  7921. 1 2 3
  7922. 4 5
  7923. 6 7 8
  7924. @end table
  7925. @subsection Commands
  7926. This filter supports the all above options as @ref{commands}.
  7927. @section extractplanes
  7928. Extract color channel components from input video stream into
  7929. separate grayscale video streams.
  7930. The filter accepts the following option:
  7931. @table @option
  7932. @item planes
  7933. Set plane(s) to extract.
  7934. Available values for planes are:
  7935. @table @samp
  7936. @item y
  7937. @item u
  7938. @item v
  7939. @item a
  7940. @item r
  7941. @item g
  7942. @item b
  7943. @end table
  7944. Choosing planes not available in the input will result in an error.
  7945. That means you cannot select @code{r}, @code{g}, @code{b} planes
  7946. with @code{y}, @code{u}, @code{v} planes at same time.
  7947. @end table
  7948. @subsection Examples
  7949. @itemize
  7950. @item
  7951. Extract luma, u and v color channel component from input video frame
  7952. into 3 grayscale outputs:
  7953. @example
  7954. 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
  7955. @end example
  7956. @end itemize
  7957. @section fade
  7958. Apply a fade-in/out effect to the input video.
  7959. It accepts the following parameters:
  7960. @table @option
  7961. @item type, t
  7962. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7963. effect.
  7964. Default is @code{in}.
  7965. @item start_frame, s
  7966. Specify the number of the frame to start applying the fade
  7967. effect at. Default is 0.
  7968. @item nb_frames, n
  7969. The number of frames that the fade effect lasts. At the end of the
  7970. fade-in effect, the output video will have the same intensity as the input video.
  7971. At the end of the fade-out transition, the output video will be filled with the
  7972. selected @option{color}.
  7973. Default is 25.
  7974. @item alpha
  7975. If set to 1, fade only alpha channel, if one exists on the input.
  7976. Default value is 0.
  7977. @item start_time, st
  7978. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7979. effect. If both start_frame and start_time are specified, the fade will start at
  7980. whichever comes last. Default is 0.
  7981. @item duration, d
  7982. The number of seconds for which the fade effect has to last. At the end of the
  7983. fade-in effect the output video will have the same intensity as the input video,
  7984. at the end of the fade-out transition the output video will be filled with the
  7985. selected @option{color}.
  7986. If both duration and nb_frames are specified, duration is used. Default is 0
  7987. (nb_frames is used by default).
  7988. @item color, c
  7989. Specify the color of the fade. Default is "black".
  7990. @end table
  7991. @subsection Examples
  7992. @itemize
  7993. @item
  7994. Fade in the first 30 frames of video:
  7995. @example
  7996. fade=in:0:30
  7997. @end example
  7998. The command above is equivalent to:
  7999. @example
  8000. fade=t=in:s=0:n=30
  8001. @end example
  8002. @item
  8003. Fade out the last 45 frames of a 200-frame video:
  8004. @example
  8005. fade=out:155:45
  8006. fade=type=out:start_frame=155:nb_frames=45
  8007. @end example
  8008. @item
  8009. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  8010. @example
  8011. fade=in:0:25, fade=out:975:25
  8012. @end example
  8013. @item
  8014. Make the first 5 frames yellow, then fade in from frame 5-24:
  8015. @example
  8016. fade=in:5:20:color=yellow
  8017. @end example
  8018. @item
  8019. Fade in alpha over first 25 frames of video:
  8020. @example
  8021. fade=in:0:25:alpha=1
  8022. @end example
  8023. @item
  8024. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  8025. @example
  8026. fade=t=in:st=5.5:d=0.5
  8027. @end example
  8028. @end itemize
  8029. @section fftdnoiz
  8030. Denoise frames using 3D FFT (frequency domain filtering).
  8031. The filter accepts the following options:
  8032. @table @option
  8033. @item sigma
  8034. Set the noise sigma constant. This sets denoising strength.
  8035. Default value is 1. Allowed range is from 0 to 30.
  8036. Using very high sigma with low overlap may give blocking artifacts.
  8037. @item amount
  8038. Set amount of denoising. By default all detected noise is reduced.
  8039. Default value is 1. Allowed range is from 0 to 1.
  8040. @item block
  8041. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  8042. Actual size of block in pixels is 2 to power of @var{block}, so by default
  8043. block size in pixels is 2^4 which is 16.
  8044. @item overlap
  8045. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  8046. @item prev
  8047. Set number of previous frames to use for denoising. By default is set to 0.
  8048. @item next
  8049. Set number of next frames to to use for denoising. By default is set to 0.
  8050. @item planes
  8051. Set planes which will be filtered, by default are all available filtered
  8052. except alpha.
  8053. @end table
  8054. @section fftfilt
  8055. Apply arbitrary expressions to samples in frequency domain
  8056. @table @option
  8057. @item dc_Y
  8058. Adjust the dc value (gain) of the luma plane of the image. The filter
  8059. accepts an integer value in range @code{0} to @code{1000}. The default
  8060. value is set to @code{0}.
  8061. @item dc_U
  8062. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  8063. filter accepts an integer value in range @code{0} to @code{1000}. The
  8064. default value is set to @code{0}.
  8065. @item dc_V
  8066. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  8067. filter accepts an integer value in range @code{0} to @code{1000}. The
  8068. default value is set to @code{0}.
  8069. @item weight_Y
  8070. Set the frequency domain weight expression for the luma plane.
  8071. @item weight_U
  8072. Set the frequency domain weight expression for the 1st chroma plane.
  8073. @item weight_V
  8074. Set the frequency domain weight expression for the 2nd chroma plane.
  8075. @item eval
  8076. Set when the expressions are evaluated.
  8077. It accepts the following values:
  8078. @table @samp
  8079. @item init
  8080. Only evaluate expressions once during the filter initialization.
  8081. @item frame
  8082. Evaluate expressions for each incoming frame.
  8083. @end table
  8084. Default value is @samp{init}.
  8085. The filter accepts the following variables:
  8086. @item X
  8087. @item Y
  8088. The coordinates of the current sample.
  8089. @item W
  8090. @item H
  8091. The width and height of the image.
  8092. @item N
  8093. The number of input frame, starting from 0.
  8094. @end table
  8095. @subsection Examples
  8096. @itemize
  8097. @item
  8098. High-pass:
  8099. @example
  8100. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  8101. @end example
  8102. @item
  8103. Low-pass:
  8104. @example
  8105. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  8106. @end example
  8107. @item
  8108. Sharpen:
  8109. @example
  8110. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  8111. @end example
  8112. @item
  8113. Blur:
  8114. @example
  8115. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  8116. @end example
  8117. @end itemize
  8118. @section field
  8119. Extract a single field from an interlaced image using stride
  8120. arithmetic to avoid wasting CPU time. The output frames are marked as
  8121. non-interlaced.
  8122. The filter accepts the following options:
  8123. @table @option
  8124. @item type
  8125. Specify whether to extract the top (if the value is @code{0} or
  8126. @code{top}) or the bottom field (if the value is @code{1} or
  8127. @code{bottom}).
  8128. @end table
  8129. @section fieldhint
  8130. Create new frames by copying the top and bottom fields from surrounding frames
  8131. supplied as numbers by the hint file.
  8132. @table @option
  8133. @item hint
  8134. Set file containing hints: absolute/relative frame numbers.
  8135. There must be one line for each frame in a clip. Each line must contain two
  8136. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  8137. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  8138. is current frame number for @code{absolute} mode or out of [-1, 1] range
  8139. for @code{relative} mode. First number tells from which frame to pick up top
  8140. field and second number tells from which frame to pick up bottom field.
  8141. If optionally followed by @code{+} output frame will be marked as interlaced,
  8142. else if followed by @code{-} output frame will be marked as progressive, else
  8143. it will be marked same as input frame.
  8144. If optionally followed by @code{t} output frame will use only top field, or in
  8145. case of @code{b} it will use only bottom field.
  8146. If line starts with @code{#} or @code{;} that line is skipped.
  8147. @item mode
  8148. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  8149. @end table
  8150. Example of first several lines of @code{hint} file for @code{relative} mode:
  8151. @example
  8152. 0,0 - # first frame
  8153. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  8154. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  8155. 1,0 -
  8156. 0,0 -
  8157. 0,0 -
  8158. 1,0 -
  8159. 1,0 -
  8160. 1,0 -
  8161. 0,0 -
  8162. 0,0 -
  8163. 1,0 -
  8164. 1,0 -
  8165. 1,0 -
  8166. 0,0 -
  8167. @end example
  8168. @section fieldmatch
  8169. Field matching filter for inverse telecine. It is meant to reconstruct the
  8170. progressive frames from a telecined stream. The filter does not drop duplicated
  8171. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  8172. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  8173. The separation of the field matching and the decimation is notably motivated by
  8174. the possibility of inserting a de-interlacing filter fallback between the two.
  8175. If the source has mixed telecined and real interlaced content,
  8176. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  8177. But these remaining combed frames will be marked as interlaced, and thus can be
  8178. de-interlaced by a later filter such as @ref{yadif} before decimation.
  8179. In addition to the various configuration options, @code{fieldmatch} can take an
  8180. optional second stream, activated through the @option{ppsrc} option. If
  8181. enabled, the frames reconstruction will be based on the fields and frames from
  8182. this second stream. This allows the first input to be pre-processed in order to
  8183. help the various algorithms of the filter, while keeping the output lossless
  8184. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  8185. or brightness/contrast adjustments can help.
  8186. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  8187. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  8188. which @code{fieldmatch} is based on. While the semantic and usage are very
  8189. close, some behaviour and options names can differ.
  8190. The @ref{decimate} filter currently only works for constant frame rate input.
  8191. If your input has mixed telecined (30fps) and progressive content with a lower
  8192. framerate like 24fps use the following filterchain to produce the necessary cfr
  8193. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  8194. The filter accepts the following options:
  8195. @table @option
  8196. @item order
  8197. Specify the assumed field order of the input stream. Available values are:
  8198. @table @samp
  8199. @item auto
  8200. Auto detect parity (use FFmpeg's internal parity value).
  8201. @item bff
  8202. Assume bottom field first.
  8203. @item tff
  8204. Assume top field first.
  8205. @end table
  8206. Note that it is sometimes recommended not to trust the parity announced by the
  8207. stream.
  8208. Default value is @var{auto}.
  8209. @item mode
  8210. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  8211. sense that it won't risk creating jerkiness due to duplicate frames when
  8212. possible, but if there are bad edits or blended fields it will end up
  8213. outputting combed frames when a good match might actually exist. On the other
  8214. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  8215. but will almost always find a good frame if there is one. The other values are
  8216. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  8217. jerkiness and creating duplicate frames versus finding good matches in sections
  8218. with bad edits, orphaned fields, blended fields, etc.
  8219. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  8220. Available values are:
  8221. @table @samp
  8222. @item pc
  8223. 2-way matching (p/c)
  8224. @item pc_n
  8225. 2-way matching, and trying 3rd match if still combed (p/c + n)
  8226. @item pc_u
  8227. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  8228. @item pc_n_ub
  8229. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  8230. still combed (p/c + n + u/b)
  8231. @item pcn
  8232. 3-way matching (p/c/n)
  8233. @item pcn_ub
  8234. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  8235. detected as combed (p/c/n + u/b)
  8236. @end table
  8237. The parenthesis at the end indicate the matches that would be used for that
  8238. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  8239. @var{top}).
  8240. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  8241. the slowest.
  8242. Default value is @var{pc_n}.
  8243. @item ppsrc
  8244. Mark the main input stream as a pre-processed input, and enable the secondary
  8245. input stream as the clean source to pick the fields from. See the filter
  8246. introduction for more details. It is similar to the @option{clip2} feature from
  8247. VFM/TFM.
  8248. Default value is @code{0} (disabled).
  8249. @item field
  8250. Set the field to match from. It is recommended to set this to the same value as
  8251. @option{order} unless you experience matching failures with that setting. In
  8252. certain circumstances changing the field that is used to match from can have a
  8253. large impact on matching performance. Available values are:
  8254. @table @samp
  8255. @item auto
  8256. Automatic (same value as @option{order}).
  8257. @item bottom
  8258. Match from the bottom field.
  8259. @item top
  8260. Match from the top field.
  8261. @end table
  8262. Default value is @var{auto}.
  8263. @item mchroma
  8264. Set whether or not chroma is included during the match comparisons. In most
  8265. cases it is recommended to leave this enabled. You should set this to @code{0}
  8266. only if your clip has bad chroma problems such as heavy rainbowing or other
  8267. artifacts. Setting this to @code{0} could also be used to speed things up at
  8268. the cost of some accuracy.
  8269. Default value is @code{1}.
  8270. @item y0
  8271. @item y1
  8272. These define an exclusion band which excludes the lines between @option{y0} and
  8273. @option{y1} from being included in the field matching decision. An exclusion
  8274. band can be used to ignore subtitles, a logo, or other things that may
  8275. interfere with the matching. @option{y0} sets the starting scan line and
  8276. @option{y1} sets the ending line; all lines in between @option{y0} and
  8277. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  8278. @option{y0} and @option{y1} to the same value will disable the feature.
  8279. @option{y0} and @option{y1} defaults to @code{0}.
  8280. @item scthresh
  8281. Set the scene change detection threshold as a percentage of maximum change on
  8282. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  8283. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  8284. @option{scthresh} is @code{[0.0, 100.0]}.
  8285. Default value is @code{12.0}.
  8286. @item combmatch
  8287. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  8288. account the combed scores of matches when deciding what match to use as the
  8289. final match. Available values are:
  8290. @table @samp
  8291. @item none
  8292. No final matching based on combed scores.
  8293. @item sc
  8294. Combed scores are only used when a scene change is detected.
  8295. @item full
  8296. Use combed scores all the time.
  8297. @end table
  8298. Default is @var{sc}.
  8299. @item combdbg
  8300. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  8301. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  8302. Available values are:
  8303. @table @samp
  8304. @item none
  8305. No forced calculation.
  8306. @item pcn
  8307. Force p/c/n calculations.
  8308. @item pcnub
  8309. Force p/c/n/u/b calculations.
  8310. @end table
  8311. Default value is @var{none}.
  8312. @item cthresh
  8313. This is the area combing threshold used for combed frame detection. This
  8314. essentially controls how "strong" or "visible" combing must be to be detected.
  8315. Larger values mean combing must be more visible and smaller values mean combing
  8316. can be less visible or strong and still be detected. Valid settings are from
  8317. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  8318. be detected as combed). This is basically a pixel difference value. A good
  8319. range is @code{[8, 12]}.
  8320. Default value is @code{9}.
  8321. @item chroma
  8322. Sets whether or not chroma is considered in the combed frame decision. Only
  8323. disable this if your source has chroma problems (rainbowing, etc.) that are
  8324. causing problems for the combed frame detection with chroma enabled. Actually,
  8325. using @option{chroma}=@var{0} is usually more reliable, except for the case
  8326. where there is chroma only combing in the source.
  8327. Default value is @code{0}.
  8328. @item blockx
  8329. @item blocky
  8330. Respectively set the x-axis and y-axis size of the window used during combed
  8331. frame detection. This has to do with the size of the area in which
  8332. @option{combpel} pixels are required to be detected as combed for a frame to be
  8333. declared combed. See the @option{combpel} parameter description for more info.
  8334. Possible values are any number that is a power of 2 starting at 4 and going up
  8335. to 512.
  8336. Default value is @code{16}.
  8337. @item combpel
  8338. The number of combed pixels inside any of the @option{blocky} by
  8339. @option{blockx} size blocks on the frame for the frame to be detected as
  8340. combed. While @option{cthresh} controls how "visible" the combing must be, this
  8341. setting controls "how much" combing there must be in any localized area (a
  8342. window defined by the @option{blockx} and @option{blocky} settings) on the
  8343. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  8344. which point no frames will ever be detected as combed). This setting is known
  8345. as @option{MI} in TFM/VFM vocabulary.
  8346. Default value is @code{80}.
  8347. @end table
  8348. @anchor{p/c/n/u/b meaning}
  8349. @subsection p/c/n/u/b meaning
  8350. @subsubsection p/c/n
  8351. We assume the following telecined stream:
  8352. @example
  8353. Top fields: 1 2 2 3 4
  8354. Bottom fields: 1 2 3 4 4
  8355. @end example
  8356. The numbers correspond to the progressive frame the fields relate to. Here, the
  8357. first two frames are progressive, the 3rd and 4th are combed, and so on.
  8358. When @code{fieldmatch} is configured to run a matching from bottom
  8359. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  8360. @example
  8361. Input stream:
  8362. T 1 2 2 3 4
  8363. B 1 2 3 4 4 <-- matching reference
  8364. Matches: c c n n c
  8365. Output stream:
  8366. T 1 2 3 4 4
  8367. B 1 2 3 4 4
  8368. @end example
  8369. As a result of the field matching, we can see that some frames get duplicated.
  8370. To perform a complete inverse telecine, you need to rely on a decimation filter
  8371. after this operation. See for instance the @ref{decimate} filter.
  8372. The same operation now matching from top fields (@option{field}=@var{top})
  8373. looks like this:
  8374. @example
  8375. Input stream:
  8376. T 1 2 2 3 4 <-- matching reference
  8377. B 1 2 3 4 4
  8378. Matches: c c p p c
  8379. Output stream:
  8380. T 1 2 2 3 4
  8381. B 1 2 2 3 4
  8382. @end example
  8383. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  8384. basically, they refer to the frame and field of the opposite parity:
  8385. @itemize
  8386. @item @var{p} matches the field of the opposite parity in the previous frame
  8387. @item @var{c} matches the field of the opposite parity in the current frame
  8388. @item @var{n} matches the field of the opposite parity in the next frame
  8389. @end itemize
  8390. @subsubsection u/b
  8391. The @var{u} and @var{b} matching are a bit special in the sense that they match
  8392. from the opposite parity flag. In the following examples, we assume that we are
  8393. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  8394. 'x' is placed above and below each matched fields.
  8395. With bottom matching (@option{field}=@var{bottom}):
  8396. @example
  8397. Match: c p n b u
  8398. x x x x x
  8399. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8400. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8401. x x x x x
  8402. Output frames:
  8403. 2 1 2 2 2
  8404. 2 2 2 1 3
  8405. @end example
  8406. With top matching (@option{field}=@var{top}):
  8407. @example
  8408. Match: c p n b u
  8409. x x x x x
  8410. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8411. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8412. x x x x x
  8413. Output frames:
  8414. 2 2 2 1 2
  8415. 2 1 3 2 2
  8416. @end example
  8417. @subsection Examples
  8418. Simple IVTC of a top field first telecined stream:
  8419. @example
  8420. fieldmatch=order=tff:combmatch=none, decimate
  8421. @end example
  8422. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  8423. @example
  8424. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  8425. @end example
  8426. @section fieldorder
  8427. Transform the field order of the input video.
  8428. It accepts the following parameters:
  8429. @table @option
  8430. @item order
  8431. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  8432. for bottom field first.
  8433. @end table
  8434. The default value is @samp{tff}.
  8435. The transformation is done by shifting the picture content up or down
  8436. by one line, and filling the remaining line with appropriate picture content.
  8437. This method is consistent with most broadcast field order converters.
  8438. If the input video is not flagged as being interlaced, or it is already
  8439. flagged as being of the required output field order, then this filter does
  8440. not alter the incoming video.
  8441. It is very useful when converting to or from PAL DV material,
  8442. which is bottom field first.
  8443. For example:
  8444. @example
  8445. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  8446. @end example
  8447. @section fifo, afifo
  8448. Buffer input images and send them when they are requested.
  8449. It is mainly useful when auto-inserted by the libavfilter
  8450. framework.
  8451. It does not take parameters.
  8452. @section fillborders
  8453. Fill borders of the input video, without changing video stream dimensions.
  8454. Sometimes video can have garbage at the four edges and you may not want to
  8455. crop video input to keep size multiple of some number.
  8456. This filter accepts the following options:
  8457. @table @option
  8458. @item left
  8459. Number of pixels to fill from left border.
  8460. @item right
  8461. Number of pixels to fill from right border.
  8462. @item top
  8463. Number of pixels to fill from top border.
  8464. @item bottom
  8465. Number of pixels to fill from bottom border.
  8466. @item mode
  8467. Set fill mode.
  8468. It accepts the following values:
  8469. @table @samp
  8470. @item smear
  8471. fill pixels using outermost pixels
  8472. @item mirror
  8473. fill pixels using mirroring
  8474. @item fixed
  8475. fill pixels with constant value
  8476. @end table
  8477. Default is @var{smear}.
  8478. @item color
  8479. Set color for pixels in fixed mode. Default is @var{black}.
  8480. @end table
  8481. @subsection Commands
  8482. This filter supports same @ref{commands} as options.
  8483. The command accepts the same syntax of the corresponding option.
  8484. If the specified expression is not valid, it is kept at its current
  8485. value.
  8486. @section find_rect
  8487. Find a rectangular object
  8488. It accepts the following options:
  8489. @table @option
  8490. @item object
  8491. Filepath of the object image, needs to be in gray8.
  8492. @item threshold
  8493. Detection threshold, default is 0.5.
  8494. @item mipmaps
  8495. Number of mipmaps, default is 3.
  8496. @item xmin, ymin, xmax, ymax
  8497. Specifies the rectangle in which to search.
  8498. @end table
  8499. @subsection Examples
  8500. @itemize
  8501. @item
  8502. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8503. @example
  8504. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8505. @end example
  8506. @end itemize
  8507. @section floodfill
  8508. Flood area with values of same pixel components with another values.
  8509. It accepts the following options:
  8510. @table @option
  8511. @item x
  8512. Set pixel x coordinate.
  8513. @item y
  8514. Set pixel y coordinate.
  8515. @item s0
  8516. Set source #0 component value.
  8517. @item s1
  8518. Set source #1 component value.
  8519. @item s2
  8520. Set source #2 component value.
  8521. @item s3
  8522. Set source #3 component value.
  8523. @item d0
  8524. Set destination #0 component value.
  8525. @item d1
  8526. Set destination #1 component value.
  8527. @item d2
  8528. Set destination #2 component value.
  8529. @item d3
  8530. Set destination #3 component value.
  8531. @end table
  8532. @anchor{format}
  8533. @section format
  8534. Convert the input video to one of the specified pixel formats.
  8535. Libavfilter will try to pick one that is suitable as input to
  8536. the next filter.
  8537. It accepts the following parameters:
  8538. @table @option
  8539. @item pix_fmts
  8540. A '|'-separated list of pixel format names, such as
  8541. "pix_fmts=yuv420p|monow|rgb24".
  8542. @end table
  8543. @subsection Examples
  8544. @itemize
  8545. @item
  8546. Convert the input video to the @var{yuv420p} format
  8547. @example
  8548. format=pix_fmts=yuv420p
  8549. @end example
  8550. Convert the input video to any of the formats in the list
  8551. @example
  8552. format=pix_fmts=yuv420p|yuv444p|yuv410p
  8553. @end example
  8554. @end itemize
  8555. @anchor{fps}
  8556. @section fps
  8557. Convert the video to specified constant frame rate by duplicating or dropping
  8558. frames as necessary.
  8559. It accepts the following parameters:
  8560. @table @option
  8561. @item fps
  8562. The desired output frame rate. The default is @code{25}.
  8563. @item start_time
  8564. Assume the first PTS should be the given value, in seconds. This allows for
  8565. padding/trimming at the start of stream. By default, no assumption is made
  8566. about the first frame's expected PTS, so no padding or trimming is done.
  8567. For example, this could be set to 0 to pad the beginning with duplicates of
  8568. the first frame if a video stream starts after the audio stream or to trim any
  8569. frames with a negative PTS.
  8570. @item round
  8571. Timestamp (PTS) rounding method.
  8572. Possible values are:
  8573. @table @option
  8574. @item zero
  8575. round towards 0
  8576. @item inf
  8577. round away from 0
  8578. @item down
  8579. round towards -infinity
  8580. @item up
  8581. round towards +infinity
  8582. @item near
  8583. round to nearest
  8584. @end table
  8585. The default is @code{near}.
  8586. @item eof_action
  8587. Action performed when reading the last frame.
  8588. Possible values are:
  8589. @table @option
  8590. @item round
  8591. Use same timestamp rounding method as used for other frames.
  8592. @item pass
  8593. Pass through last frame if input duration has not been reached yet.
  8594. @end table
  8595. The default is @code{round}.
  8596. @end table
  8597. Alternatively, the options can be specified as a flat string:
  8598. @var{fps}[:@var{start_time}[:@var{round}]].
  8599. See also the @ref{setpts} filter.
  8600. @subsection Examples
  8601. @itemize
  8602. @item
  8603. A typical usage in order to set the fps to 25:
  8604. @example
  8605. fps=fps=25
  8606. @end example
  8607. @item
  8608. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  8609. @example
  8610. fps=fps=film:round=near
  8611. @end example
  8612. @end itemize
  8613. @section framepack
  8614. Pack two different video streams into a stereoscopic video, setting proper
  8615. metadata on supported codecs. The two views should have the same size and
  8616. framerate and processing will stop when the shorter video ends. Please note
  8617. that you may conveniently adjust view properties with the @ref{scale} and
  8618. @ref{fps} filters.
  8619. It accepts the following parameters:
  8620. @table @option
  8621. @item format
  8622. The desired packing format. Supported values are:
  8623. @table @option
  8624. @item sbs
  8625. The views are next to each other (default).
  8626. @item tab
  8627. The views are on top of each other.
  8628. @item lines
  8629. The views are packed by line.
  8630. @item columns
  8631. The views are packed by column.
  8632. @item frameseq
  8633. The views are temporally interleaved.
  8634. @end table
  8635. @end table
  8636. Some examples:
  8637. @example
  8638. # Convert left and right views into a frame-sequential video
  8639. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8640. # Convert views into a side-by-side video with the same output resolution as the input
  8641. 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
  8642. @end example
  8643. @section framerate
  8644. Change the frame rate by interpolating new video output frames from the source
  8645. frames.
  8646. This filter is not designed to function correctly with interlaced media. If
  8647. you wish to change the frame rate of interlaced media then you are required
  8648. to deinterlace before this filter and re-interlace after this filter.
  8649. A description of the accepted options follows.
  8650. @table @option
  8651. @item fps
  8652. Specify the output frames per second. This option can also be specified
  8653. as a value alone. The default is @code{50}.
  8654. @item interp_start
  8655. Specify the start of a range where the output frame will be created as a
  8656. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8657. the default is @code{15}.
  8658. @item interp_end
  8659. Specify the end of a range where the output frame will be created as a
  8660. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8661. the default is @code{240}.
  8662. @item scene
  8663. Specify the level at which a scene change is detected as a value between
  8664. 0 and 100 to indicate a new scene; a low value reflects a low
  8665. probability for the current frame to introduce a new scene, while a higher
  8666. value means the current frame is more likely to be one.
  8667. The default is @code{8.2}.
  8668. @item flags
  8669. Specify flags influencing the filter process.
  8670. Available value for @var{flags} is:
  8671. @table @option
  8672. @item scene_change_detect, scd
  8673. Enable scene change detection using the value of the option @var{scene}.
  8674. This flag is enabled by default.
  8675. @end table
  8676. @end table
  8677. @section framestep
  8678. Select one frame every N-th frame.
  8679. This filter accepts the following option:
  8680. @table @option
  8681. @item step
  8682. Select frame after every @code{step} frames.
  8683. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8684. @end table
  8685. @section freezedetect
  8686. Detect frozen video.
  8687. This filter logs a message and sets frame metadata when it detects that the
  8688. input video has no significant change in content during a specified duration.
  8689. Video freeze detection calculates the mean average absolute difference of all
  8690. the components of video frames and compares it to a noise floor.
  8691. The printed times and duration are expressed in seconds. The
  8692. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8693. whose timestamp equals or exceeds the detection duration and it contains the
  8694. timestamp of the first frame of the freeze. The
  8695. @code{lavfi.freezedetect.freeze_duration} and
  8696. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8697. after the freeze.
  8698. The filter accepts the following options:
  8699. @table @option
  8700. @item noise, n
  8701. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8702. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8703. 0.001.
  8704. @item duration, d
  8705. Set freeze duration until notification (default is 2 seconds).
  8706. @end table
  8707. @section freezeframes
  8708. Freeze video frames.
  8709. This filter freezes video frames using frame from 2nd input.
  8710. The filter accepts the following options:
  8711. @table @option
  8712. @item first
  8713. Set number of first frame from which to start freeze.
  8714. @item last
  8715. Set number of last frame from which to end freeze.
  8716. @item replace
  8717. Set number of frame from 2nd input which will be used instead of replaced frames.
  8718. @end table
  8719. @anchor{frei0r}
  8720. @section frei0r
  8721. Apply a frei0r effect to the input video.
  8722. To enable the compilation of this filter, you need to install the frei0r
  8723. header and configure FFmpeg with @code{--enable-frei0r}.
  8724. It accepts the following parameters:
  8725. @table @option
  8726. @item filter_name
  8727. The name of the frei0r effect to load. If the environment variable
  8728. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8729. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8730. Otherwise, the standard frei0r paths are searched, in this order:
  8731. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8732. @file{/usr/lib/frei0r-1/}.
  8733. @item filter_params
  8734. A '|'-separated list of parameters to pass to the frei0r effect.
  8735. @end table
  8736. A frei0r effect parameter can be a boolean (its value is either
  8737. "y" or "n"), a double, a color (specified as
  8738. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8739. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8740. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8741. a position (specified as @var{X}/@var{Y}, where
  8742. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8743. The number and types of parameters depend on the loaded effect. If an
  8744. effect parameter is not specified, the default value is set.
  8745. @subsection Examples
  8746. @itemize
  8747. @item
  8748. Apply the distort0r effect, setting the first two double parameters:
  8749. @example
  8750. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8751. @end example
  8752. @item
  8753. Apply the colordistance effect, taking a color as the first parameter:
  8754. @example
  8755. frei0r=colordistance:0.2/0.3/0.4
  8756. frei0r=colordistance:violet
  8757. frei0r=colordistance:0x112233
  8758. @end example
  8759. @item
  8760. Apply the perspective effect, specifying the top left and top right image
  8761. positions:
  8762. @example
  8763. frei0r=perspective:0.2/0.2|0.8/0.2
  8764. @end example
  8765. @end itemize
  8766. For more information, see
  8767. @url{http://frei0r.dyne.org}
  8768. @section fspp
  8769. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8770. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8771. processing filter, one of them is performed once per block, not per pixel.
  8772. This allows for much higher speed.
  8773. The filter accepts the following options:
  8774. @table @option
  8775. @item quality
  8776. Set quality. This option defines the number of levels for averaging. It accepts
  8777. an integer in the range 4-5. Default value is @code{4}.
  8778. @item qp
  8779. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8780. If not set, the filter will use the QP from the video stream (if available).
  8781. @item strength
  8782. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8783. more details but also more artifacts, while higher values make the image smoother
  8784. but also blurrier. Default value is @code{0} − PSNR optimal.
  8785. @item use_bframe_qp
  8786. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8787. option may cause flicker since the B-Frames have often larger QP. Default is
  8788. @code{0} (not enabled).
  8789. @end table
  8790. @section gblur
  8791. Apply Gaussian blur filter.
  8792. The filter accepts the following options:
  8793. @table @option
  8794. @item sigma
  8795. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8796. @item steps
  8797. Set number of steps for Gaussian approximation. Default is @code{1}.
  8798. @item planes
  8799. Set which planes to filter. By default all planes are filtered.
  8800. @item sigmaV
  8801. Set vertical sigma, if negative it will be same as @code{sigma}.
  8802. Default is @code{-1}.
  8803. @end table
  8804. @subsection Commands
  8805. This filter supports same commands as options.
  8806. The command accepts the same syntax of the corresponding option.
  8807. If the specified expression is not valid, it is kept at its current
  8808. value.
  8809. @section geq
  8810. Apply generic equation to each pixel.
  8811. The filter accepts the following options:
  8812. @table @option
  8813. @item lum_expr, lum
  8814. Set the luminance expression.
  8815. @item cb_expr, cb
  8816. Set the chrominance blue expression.
  8817. @item cr_expr, cr
  8818. Set the chrominance red expression.
  8819. @item alpha_expr, a
  8820. Set the alpha expression.
  8821. @item red_expr, r
  8822. Set the red expression.
  8823. @item green_expr, g
  8824. Set the green expression.
  8825. @item blue_expr, b
  8826. Set the blue expression.
  8827. @end table
  8828. The colorspace is selected according to the specified options. If one
  8829. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8830. options is specified, the filter will automatically select a YCbCr
  8831. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8832. @option{blue_expr} options is specified, it will select an RGB
  8833. colorspace.
  8834. If one of the chrominance expression is not defined, it falls back on the other
  8835. one. If no alpha expression is specified it will evaluate to opaque value.
  8836. If none of chrominance expressions are specified, they will evaluate
  8837. to the luminance expression.
  8838. The expressions can use the following variables and functions:
  8839. @table @option
  8840. @item N
  8841. The sequential number of the filtered frame, starting from @code{0}.
  8842. @item X
  8843. @item Y
  8844. The coordinates of the current sample.
  8845. @item W
  8846. @item H
  8847. The width and height of the image.
  8848. @item SW
  8849. @item SH
  8850. Width and height scale depending on the currently filtered plane. It is the
  8851. ratio between the corresponding luma plane number of pixels and the current
  8852. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8853. @code{0.5,0.5} for chroma planes.
  8854. @item T
  8855. Time of the current frame, expressed in seconds.
  8856. @item p(x, y)
  8857. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8858. plane.
  8859. @item lum(x, y)
  8860. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8861. plane.
  8862. @item cb(x, y)
  8863. Return the value of the pixel at location (@var{x},@var{y}) of the
  8864. blue-difference chroma plane. Return 0 if there is no such plane.
  8865. @item cr(x, y)
  8866. Return the value of the pixel at location (@var{x},@var{y}) of the
  8867. red-difference chroma plane. Return 0 if there is no such plane.
  8868. @item r(x, y)
  8869. @item g(x, y)
  8870. @item b(x, y)
  8871. Return the value of the pixel at location (@var{x},@var{y}) of the
  8872. red/green/blue component. Return 0 if there is no such component.
  8873. @item alpha(x, y)
  8874. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8875. plane. Return 0 if there is no such plane.
  8876. @item psum(x,y), lumsum(x, y), cbsum(x,y), crsum(x,y), rsum(x,y), gsum(x,y), bsum(x,y), alphasum(x,y)
  8877. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  8878. sums of samples within a rectangle. See the functions without the sum postfix.
  8879. @item interpolation
  8880. Set one of interpolation methods:
  8881. @table @option
  8882. @item nearest, n
  8883. @item bilinear, b
  8884. @end table
  8885. Default is bilinear.
  8886. @end table
  8887. For functions, if @var{x} and @var{y} are outside the area, the value will be
  8888. automatically clipped to the closer edge.
  8889. Please note that this filter can use multiple threads in which case each slice
  8890. will have its own expression state. If you want to use only a single expression
  8891. state because your expressions depend on previous state then you should limit
  8892. the number of filter threads to 1.
  8893. @subsection Examples
  8894. @itemize
  8895. @item
  8896. Flip the image horizontally:
  8897. @example
  8898. geq=p(W-X\,Y)
  8899. @end example
  8900. @item
  8901. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  8902. wavelength of 100 pixels:
  8903. @example
  8904. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  8905. @end example
  8906. @item
  8907. Generate a fancy enigmatic moving light:
  8908. @example
  8909. 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
  8910. @end example
  8911. @item
  8912. Generate a quick emboss effect:
  8913. @example
  8914. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  8915. @end example
  8916. @item
  8917. Modify RGB components depending on pixel position:
  8918. @example
  8919. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  8920. @end example
  8921. @item
  8922. Create a radial gradient that is the same size as the input (also see
  8923. the @ref{vignette} filter):
  8924. @example
  8925. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8926. @end example
  8927. @end itemize
  8928. @section gradfun
  8929. Fix the banding artifacts that are sometimes introduced into nearly flat
  8930. regions by truncation to 8-bit color depth.
  8931. Interpolate the gradients that should go where the bands are, and
  8932. dither them.
  8933. It is designed for playback only. Do not use it prior to
  8934. lossy compression, because compression tends to lose the dither and
  8935. bring back the bands.
  8936. It accepts the following parameters:
  8937. @table @option
  8938. @item strength
  8939. The maximum amount by which the filter will change any one pixel. This is also
  8940. the threshold for detecting nearly flat regions. Acceptable values range from
  8941. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8942. valid range.
  8943. @item radius
  8944. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8945. gradients, but also prevents the filter from modifying the pixels near detailed
  8946. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8947. values will be clipped to the valid range.
  8948. @end table
  8949. Alternatively, the options can be specified as a flat string:
  8950. @var{strength}[:@var{radius}]
  8951. @subsection Examples
  8952. @itemize
  8953. @item
  8954. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8955. @example
  8956. gradfun=3.5:8
  8957. @end example
  8958. @item
  8959. Specify radius, omitting the strength (which will fall-back to the default
  8960. value):
  8961. @example
  8962. gradfun=radius=8
  8963. @end example
  8964. @end itemize
  8965. @anchor{graphmonitor}
  8966. @section graphmonitor
  8967. Show various filtergraph stats.
  8968. With this filter one can debug complete filtergraph.
  8969. Especially issues with links filling with queued frames.
  8970. The filter accepts the following options:
  8971. @table @option
  8972. @item size, s
  8973. Set video output size. Default is @var{hd720}.
  8974. @item opacity, o
  8975. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8976. @item mode, m
  8977. Set output mode, can be @var{fulll} or @var{compact}.
  8978. In @var{compact} mode only filters with some queued frames have displayed stats.
  8979. @item flags, f
  8980. Set flags which enable which stats are shown in video.
  8981. Available values for flags are:
  8982. @table @samp
  8983. @item queue
  8984. Display number of queued frames in each link.
  8985. @item frame_count_in
  8986. Display number of frames taken from filter.
  8987. @item frame_count_out
  8988. Display number of frames given out from filter.
  8989. @item pts
  8990. Display current filtered frame pts.
  8991. @item time
  8992. Display current filtered frame time.
  8993. @item timebase
  8994. Display time base for filter link.
  8995. @item format
  8996. Display used format for filter link.
  8997. @item size
  8998. Display video size or number of audio channels in case of audio used by filter link.
  8999. @item rate
  9000. Display video frame rate or sample rate in case of audio used by filter link.
  9001. @end table
  9002. @item rate, r
  9003. Set upper limit for video rate of output stream, Default value is @var{25}.
  9004. This guarantee that output video frame rate will not be higher than this value.
  9005. @end table
  9006. @section greyedge
  9007. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  9008. and corrects the scene colors accordingly.
  9009. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  9010. The filter accepts the following options:
  9011. @table @option
  9012. @item difford
  9013. The order of differentiation to be applied on the scene. Must be chosen in the range
  9014. [0,2] and default value is 1.
  9015. @item minknorm
  9016. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  9017. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  9018. max value instead of calculating Minkowski distance.
  9019. @item sigma
  9020. The standard deviation of Gaussian blur to be applied on the scene. Must be
  9021. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  9022. can't be equal to 0 if @var{difford} is greater than 0.
  9023. @end table
  9024. @subsection Examples
  9025. @itemize
  9026. @item
  9027. Grey Edge:
  9028. @example
  9029. greyedge=difford=1:minknorm=5:sigma=2
  9030. @end example
  9031. @item
  9032. Max Edge:
  9033. @example
  9034. greyedge=difford=1:minknorm=0:sigma=2
  9035. @end example
  9036. @end itemize
  9037. @anchor{haldclut}
  9038. @section haldclut
  9039. Apply a Hald CLUT to a video stream.
  9040. First input is the video stream to process, and second one is the Hald CLUT.
  9041. The Hald CLUT input can be a simple picture or a complete video stream.
  9042. The filter accepts the following options:
  9043. @table @option
  9044. @item shortest
  9045. Force termination when the shortest input terminates. Default is @code{0}.
  9046. @item repeatlast
  9047. Continue applying the last CLUT after the end of the stream. A value of
  9048. @code{0} disable the filter after the last frame of the CLUT is reached.
  9049. Default is @code{1}.
  9050. @end table
  9051. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  9052. filters share the same internals).
  9053. This filter also supports the @ref{framesync} options.
  9054. More information about the Hald CLUT can be found on Eskil Steenberg's website
  9055. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  9056. @subsection Workflow examples
  9057. @subsubsection Hald CLUT video stream
  9058. Generate an identity Hald CLUT stream altered with various effects:
  9059. @example
  9060. 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
  9061. @end example
  9062. Note: make sure you use a lossless codec.
  9063. Then use it with @code{haldclut} to apply it on some random stream:
  9064. @example
  9065. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  9066. @end example
  9067. The Hald CLUT will be applied to the 10 first seconds (duration of
  9068. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  9069. to the remaining frames of the @code{mandelbrot} stream.
  9070. @subsubsection Hald CLUT with preview
  9071. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  9072. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  9073. biggest possible square starting at the top left of the picture. The remaining
  9074. padding pixels (bottom or right) will be ignored. This area can be used to add
  9075. a preview of the Hald CLUT.
  9076. Typically, the following generated Hald CLUT will be supported by the
  9077. @code{haldclut} filter:
  9078. @example
  9079. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  9080. pad=iw+320 [padded_clut];
  9081. smptebars=s=320x256, split [a][b];
  9082. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  9083. [main][b] overlay=W-320" -frames:v 1 clut.png
  9084. @end example
  9085. It contains the original and a preview of the effect of the CLUT: SMPTE color
  9086. bars are displayed on the right-top, and below the same color bars processed by
  9087. the color changes.
  9088. Then, the effect of this Hald CLUT can be visualized with:
  9089. @example
  9090. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  9091. @end example
  9092. @section hflip
  9093. Flip the input video horizontally.
  9094. For example, to horizontally flip the input video with @command{ffmpeg}:
  9095. @example
  9096. ffmpeg -i in.avi -vf "hflip" out.avi
  9097. @end example
  9098. @section histeq
  9099. This filter applies a global color histogram equalization on a
  9100. per-frame basis.
  9101. It can be used to correct video that has a compressed range of pixel
  9102. intensities. The filter redistributes the pixel intensities to
  9103. equalize their distribution across the intensity range. It may be
  9104. viewed as an "automatically adjusting contrast filter". This filter is
  9105. useful only for correcting degraded or poorly captured source
  9106. video.
  9107. The filter accepts the following options:
  9108. @table @option
  9109. @item strength
  9110. Determine the amount of equalization to be applied. As the strength
  9111. is reduced, the distribution of pixel intensities more-and-more
  9112. approaches that of the input frame. The value must be a float number
  9113. in the range [0,1] and defaults to 0.200.
  9114. @item intensity
  9115. Set the maximum intensity that can generated and scale the output
  9116. values appropriately. The strength should be set as desired and then
  9117. the intensity can be limited if needed to avoid washing-out. The value
  9118. must be a float number in the range [0,1] and defaults to 0.210.
  9119. @item antibanding
  9120. Set the antibanding level. If enabled the filter will randomly vary
  9121. the luminance of output pixels by a small amount to avoid banding of
  9122. the histogram. Possible values are @code{none}, @code{weak} or
  9123. @code{strong}. It defaults to @code{none}.
  9124. @end table
  9125. @anchor{histogram}
  9126. @section histogram
  9127. Compute and draw a color distribution histogram for the input video.
  9128. The computed histogram is a representation of the color component
  9129. distribution in an image.
  9130. Standard histogram displays the color components distribution in an image.
  9131. Displays color graph for each color component. Shows distribution of
  9132. the Y, U, V, A or R, G, B components, depending on input format, in the
  9133. current frame. Below each graph a color component scale meter is shown.
  9134. The filter accepts the following options:
  9135. @table @option
  9136. @item level_height
  9137. Set height of level. Default value is @code{200}.
  9138. Allowed range is [50, 2048].
  9139. @item scale_height
  9140. Set height of color scale. Default value is @code{12}.
  9141. Allowed range is [0, 40].
  9142. @item display_mode
  9143. Set display mode.
  9144. It accepts the following values:
  9145. @table @samp
  9146. @item stack
  9147. Per color component graphs are placed below each other.
  9148. @item parade
  9149. Per color component graphs are placed side by side.
  9150. @item overlay
  9151. Presents information identical to that in the @code{parade}, except
  9152. that the graphs representing color components are superimposed directly
  9153. over one another.
  9154. @end table
  9155. Default is @code{stack}.
  9156. @item levels_mode
  9157. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  9158. Default is @code{linear}.
  9159. @item components
  9160. Set what color components to display.
  9161. Default is @code{7}.
  9162. @item fgopacity
  9163. Set foreground opacity. Default is @code{0.7}.
  9164. @item bgopacity
  9165. Set background opacity. Default is @code{0.5}.
  9166. @end table
  9167. @subsection Examples
  9168. @itemize
  9169. @item
  9170. Calculate and draw histogram:
  9171. @example
  9172. ffplay -i input -vf histogram
  9173. @end example
  9174. @end itemize
  9175. @anchor{hqdn3d}
  9176. @section hqdn3d
  9177. This is a high precision/quality 3d denoise filter. It aims to reduce
  9178. image noise, producing smooth images and making still images really
  9179. still. It should enhance compressibility.
  9180. It accepts the following optional parameters:
  9181. @table @option
  9182. @item luma_spatial
  9183. A non-negative floating point number which specifies spatial luma strength.
  9184. It defaults to 4.0.
  9185. @item chroma_spatial
  9186. A non-negative floating point number which specifies spatial chroma strength.
  9187. It defaults to 3.0*@var{luma_spatial}/4.0.
  9188. @item luma_tmp
  9189. A floating point number which specifies luma temporal strength. It defaults to
  9190. 6.0*@var{luma_spatial}/4.0.
  9191. @item chroma_tmp
  9192. A floating point number which specifies chroma temporal strength. It defaults to
  9193. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  9194. @end table
  9195. @subsection Commands
  9196. This filter supports same @ref{commands} as options.
  9197. The command accepts the same syntax of the corresponding option.
  9198. If the specified expression is not valid, it is kept at its current
  9199. value.
  9200. @anchor{hwdownload}
  9201. @section hwdownload
  9202. Download hardware frames to system memory.
  9203. The input must be in hardware frames, and the output a non-hardware format.
  9204. Not all formats will be supported on the output - it may be necessary to insert
  9205. an additional @option{format} filter immediately following in the graph to get
  9206. the output in a supported format.
  9207. @section hwmap
  9208. Map hardware frames to system memory or to another device.
  9209. This filter has several different modes of operation; which one is used depends
  9210. on the input and output formats:
  9211. @itemize
  9212. @item
  9213. Hardware frame input, normal frame output
  9214. Map the input frames to system memory and pass them to the output. If the
  9215. original hardware frame is later required (for example, after overlaying
  9216. something else on part of it), the @option{hwmap} filter can be used again
  9217. in the next mode to retrieve it.
  9218. @item
  9219. Normal frame input, hardware frame output
  9220. If the input is actually a software-mapped hardware frame, then unmap it -
  9221. that is, return the original hardware frame.
  9222. Otherwise, a device must be provided. Create new hardware surfaces on that
  9223. device for the output, then map them back to the software format at the input
  9224. and give those frames to the preceding filter. This will then act like the
  9225. @option{hwupload} filter, but may be able to avoid an additional copy when
  9226. the input is already in a compatible format.
  9227. @item
  9228. Hardware frame input and output
  9229. A device must be supplied for the output, either directly or with the
  9230. @option{derive_device} option. The input and output devices must be of
  9231. different types and compatible - the exact meaning of this is
  9232. system-dependent, but typically it means that they must refer to the same
  9233. underlying hardware context (for example, refer to the same graphics card).
  9234. If the input frames were originally created on the output device, then unmap
  9235. to retrieve the original frames.
  9236. Otherwise, map the frames to the output device - create new hardware frames
  9237. on the output corresponding to the frames on the input.
  9238. @end itemize
  9239. The following additional parameters are accepted:
  9240. @table @option
  9241. @item mode
  9242. Set the frame mapping mode. Some combination of:
  9243. @table @var
  9244. @item read
  9245. The mapped frame should be readable.
  9246. @item write
  9247. The mapped frame should be writeable.
  9248. @item overwrite
  9249. The mapping will always overwrite the entire frame.
  9250. This may improve performance in some cases, as the original contents of the
  9251. frame need not be loaded.
  9252. @item direct
  9253. The mapping must not involve any copying.
  9254. Indirect mappings to copies of frames are created in some cases where either
  9255. direct mapping is not possible or it would have unexpected properties.
  9256. Setting this flag ensures that the mapping is direct and will fail if that is
  9257. not possible.
  9258. @end table
  9259. Defaults to @var{read+write} if not specified.
  9260. @item derive_device @var{type}
  9261. Rather than using the device supplied at initialisation, instead derive a new
  9262. device of type @var{type} from the device the input frames exist on.
  9263. @item reverse
  9264. In a hardware to hardware mapping, map in reverse - create frames in the sink
  9265. and map them back to the source. This may be necessary in some cases where
  9266. a mapping in one direction is required but only the opposite direction is
  9267. supported by the devices being used.
  9268. This option is dangerous - it may break the preceding filter in undefined
  9269. ways if there are any additional constraints on that filter's output.
  9270. Do not use it without fully understanding the implications of its use.
  9271. @end table
  9272. @anchor{hwupload}
  9273. @section hwupload
  9274. Upload system memory frames to hardware surfaces.
  9275. The device to upload to must be supplied when the filter is initialised. If
  9276. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  9277. option or with the @option{derive_device} option. The input and output devices
  9278. must be of different types and compatible - the exact meaning of this is
  9279. system-dependent, but typically it means that they must refer to the same
  9280. underlying hardware context (for example, refer to the same graphics card).
  9281. The following additional parameters are accepted:
  9282. @table @option
  9283. @item derive_device @var{type}
  9284. Rather than using the device supplied at initialisation, instead derive a new
  9285. device of type @var{type} from the device the input frames exist on.
  9286. @end table
  9287. @anchor{hwupload_cuda}
  9288. @section hwupload_cuda
  9289. Upload system memory frames to a CUDA device.
  9290. It accepts the following optional parameters:
  9291. @table @option
  9292. @item device
  9293. The number of the CUDA device to use
  9294. @end table
  9295. @section hqx
  9296. Apply a high-quality magnification filter designed for pixel art. This filter
  9297. was originally created by Maxim Stepin.
  9298. It accepts the following option:
  9299. @table @option
  9300. @item n
  9301. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  9302. @code{hq3x} and @code{4} for @code{hq4x}.
  9303. Default is @code{3}.
  9304. @end table
  9305. @section hstack
  9306. Stack input videos horizontally.
  9307. All streams must be of same pixel format and of same height.
  9308. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  9309. to create same output.
  9310. The filter accepts the following option:
  9311. @table @option
  9312. @item inputs
  9313. Set number of input streams. Default is 2.
  9314. @item shortest
  9315. If set to 1, force the output to terminate when the shortest input
  9316. terminates. Default value is 0.
  9317. @end table
  9318. @section hue
  9319. Modify the hue and/or the saturation of the input.
  9320. It accepts the following parameters:
  9321. @table @option
  9322. @item h
  9323. Specify the hue angle as a number of degrees. It accepts an expression,
  9324. and defaults to "0".
  9325. @item s
  9326. Specify the saturation in the [-10,10] range. It accepts an expression and
  9327. defaults to "1".
  9328. @item H
  9329. Specify the hue angle as a number of radians. It accepts an
  9330. expression, and defaults to "0".
  9331. @item b
  9332. Specify the brightness in the [-10,10] range. It accepts an expression and
  9333. defaults to "0".
  9334. @end table
  9335. @option{h} and @option{H} are mutually exclusive, and can't be
  9336. specified at the same time.
  9337. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  9338. expressions containing the following constants:
  9339. @table @option
  9340. @item n
  9341. frame count of the input frame starting from 0
  9342. @item pts
  9343. presentation timestamp of the input frame expressed in time base units
  9344. @item r
  9345. frame rate of the input video, NAN if the input frame rate is unknown
  9346. @item t
  9347. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9348. @item tb
  9349. time base of the input video
  9350. @end table
  9351. @subsection Examples
  9352. @itemize
  9353. @item
  9354. Set the hue to 90 degrees and the saturation to 1.0:
  9355. @example
  9356. hue=h=90:s=1
  9357. @end example
  9358. @item
  9359. Same command but expressing the hue in radians:
  9360. @example
  9361. hue=H=PI/2:s=1
  9362. @end example
  9363. @item
  9364. Rotate hue and make the saturation swing between 0
  9365. and 2 over a period of 1 second:
  9366. @example
  9367. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  9368. @end example
  9369. @item
  9370. Apply a 3 seconds saturation fade-in effect starting at 0:
  9371. @example
  9372. hue="s=min(t/3\,1)"
  9373. @end example
  9374. The general fade-in expression can be written as:
  9375. @example
  9376. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  9377. @end example
  9378. @item
  9379. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  9380. @example
  9381. hue="s=max(0\, min(1\, (8-t)/3))"
  9382. @end example
  9383. The general fade-out expression can be written as:
  9384. @example
  9385. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  9386. @end example
  9387. @end itemize
  9388. @subsection Commands
  9389. This filter supports the following commands:
  9390. @table @option
  9391. @item b
  9392. @item s
  9393. @item h
  9394. @item H
  9395. Modify the hue and/or the saturation and/or brightness of the input video.
  9396. The command accepts the same syntax of the corresponding option.
  9397. If the specified expression is not valid, it is kept at its current
  9398. value.
  9399. @end table
  9400. @section hysteresis
  9401. Grow first stream into second stream by connecting components.
  9402. This makes it possible to build more robust edge masks.
  9403. This filter accepts the following options:
  9404. @table @option
  9405. @item planes
  9406. Set which planes will be processed as bitmap, unprocessed planes will be
  9407. copied from first stream.
  9408. By default value 0xf, all planes will be processed.
  9409. @item threshold
  9410. Set threshold which is used in filtering. If pixel component value is higher than
  9411. this value filter algorithm for connecting components is activated.
  9412. By default value is 0.
  9413. @end table
  9414. The @code{hysteresis} filter also supports the @ref{framesync} options.
  9415. @section idet
  9416. Detect video interlacing type.
  9417. This filter tries to detect if the input frames are interlaced, progressive,
  9418. top or bottom field first. It will also try to detect fields that are
  9419. repeated between adjacent frames (a sign of telecine).
  9420. Single frame detection considers only immediately adjacent frames when classifying each frame.
  9421. Multiple frame detection incorporates the classification history of previous frames.
  9422. The filter will log these metadata values:
  9423. @table @option
  9424. @item single.current_frame
  9425. Detected type of current frame using single-frame detection. One of:
  9426. ``tff'' (top field first), ``bff'' (bottom field first),
  9427. ``progressive'', or ``undetermined''
  9428. @item single.tff
  9429. Cumulative number of frames detected as top field first using single-frame detection.
  9430. @item multiple.tff
  9431. Cumulative number of frames detected as top field first using multiple-frame detection.
  9432. @item single.bff
  9433. Cumulative number of frames detected as bottom field first using single-frame detection.
  9434. @item multiple.current_frame
  9435. Detected type of current frame using multiple-frame detection. One of:
  9436. ``tff'' (top field first), ``bff'' (bottom field first),
  9437. ``progressive'', or ``undetermined''
  9438. @item multiple.bff
  9439. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  9440. @item single.progressive
  9441. Cumulative number of frames detected as progressive using single-frame detection.
  9442. @item multiple.progressive
  9443. Cumulative number of frames detected as progressive using multiple-frame detection.
  9444. @item single.undetermined
  9445. Cumulative number of frames that could not be classified using single-frame detection.
  9446. @item multiple.undetermined
  9447. Cumulative number of frames that could not be classified using multiple-frame detection.
  9448. @item repeated.current_frame
  9449. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  9450. @item repeated.neither
  9451. Cumulative number of frames with no repeated field.
  9452. @item repeated.top
  9453. Cumulative number of frames with the top field repeated from the previous frame's top field.
  9454. @item repeated.bottom
  9455. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  9456. @end table
  9457. The filter accepts the following options:
  9458. @table @option
  9459. @item intl_thres
  9460. Set interlacing threshold.
  9461. @item prog_thres
  9462. Set progressive threshold.
  9463. @item rep_thres
  9464. Threshold for repeated field detection.
  9465. @item half_life
  9466. Number of frames after which a given frame's contribution to the
  9467. statistics is halved (i.e., it contributes only 0.5 to its
  9468. classification). The default of 0 means that all frames seen are given
  9469. full weight of 1.0 forever.
  9470. @item analyze_interlaced_flag
  9471. When this is not 0 then idet will use the specified number of frames to determine
  9472. if the interlaced flag is accurate, it will not count undetermined frames.
  9473. If the flag is found to be accurate it will be used without any further
  9474. computations, if it is found to be inaccurate it will be cleared without any
  9475. further computations. This allows inserting the idet filter as a low computational
  9476. method to clean up the interlaced flag
  9477. @end table
  9478. @section il
  9479. Deinterleave or interleave fields.
  9480. This filter allows one to process interlaced images fields without
  9481. deinterlacing them. Deinterleaving splits the input frame into 2
  9482. fields (so called half pictures). Odd lines are moved to the top
  9483. half of the output image, even lines to the bottom half.
  9484. You can process (filter) them independently and then re-interleave them.
  9485. The filter accepts the following options:
  9486. @table @option
  9487. @item luma_mode, l
  9488. @item chroma_mode, c
  9489. @item alpha_mode, a
  9490. Available values for @var{luma_mode}, @var{chroma_mode} and
  9491. @var{alpha_mode} are:
  9492. @table @samp
  9493. @item none
  9494. Do nothing.
  9495. @item deinterleave, d
  9496. Deinterleave fields, placing one above the other.
  9497. @item interleave, i
  9498. Interleave fields. Reverse the effect of deinterleaving.
  9499. @end table
  9500. Default value is @code{none}.
  9501. @item luma_swap, ls
  9502. @item chroma_swap, cs
  9503. @item alpha_swap, as
  9504. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  9505. @end table
  9506. @subsection Commands
  9507. This filter supports the all above options as @ref{commands}.
  9508. @section inflate
  9509. Apply inflate effect to the video.
  9510. This filter replaces the pixel by the local(3x3) average by taking into account
  9511. only values higher than the pixel.
  9512. It accepts the following options:
  9513. @table @option
  9514. @item threshold0
  9515. @item threshold1
  9516. @item threshold2
  9517. @item threshold3
  9518. Limit the maximum change for each plane, default is 65535.
  9519. If 0, plane will remain unchanged.
  9520. @end table
  9521. @subsection Commands
  9522. This filter supports the all above options as @ref{commands}.
  9523. @section interlace
  9524. Simple interlacing filter from progressive contents. This interleaves upper (or
  9525. lower) lines from odd frames with lower (or upper) lines from even frames,
  9526. halving the frame rate and preserving image height.
  9527. @example
  9528. Original Original New Frame
  9529. Frame 'j' Frame 'j+1' (tff)
  9530. ========== =========== ==================
  9531. Line 0 --------------------> Frame 'j' Line 0
  9532. Line 1 Line 1 ----> Frame 'j+1' Line 1
  9533. Line 2 ---------------------> Frame 'j' Line 2
  9534. Line 3 Line 3 ----> Frame 'j+1' Line 3
  9535. ... ... ...
  9536. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  9537. @end example
  9538. It accepts the following optional parameters:
  9539. @table @option
  9540. @item scan
  9541. This determines whether the interlaced frame is taken from the even
  9542. (tff - default) or odd (bff) lines of the progressive frame.
  9543. @item lowpass
  9544. Vertical lowpass filter to avoid twitter interlacing and
  9545. reduce moire patterns.
  9546. @table @samp
  9547. @item 0, off
  9548. Disable vertical lowpass filter
  9549. @item 1, linear
  9550. Enable linear filter (default)
  9551. @item 2, complex
  9552. Enable complex filter. This will slightly less reduce twitter and moire
  9553. but better retain detail and subjective sharpness impression.
  9554. @end table
  9555. @end table
  9556. @section kerndeint
  9557. Deinterlace input video by applying Donald Graft's adaptive kernel
  9558. deinterling. Work on interlaced parts of a video to produce
  9559. progressive frames.
  9560. The description of the accepted parameters follows.
  9561. @table @option
  9562. @item thresh
  9563. Set the threshold which affects the filter's tolerance when
  9564. determining if a pixel line must be processed. It must be an integer
  9565. in the range [0,255] and defaults to 10. A value of 0 will result in
  9566. applying the process on every pixels.
  9567. @item map
  9568. Paint pixels exceeding the threshold value to white if set to 1.
  9569. Default is 0.
  9570. @item order
  9571. Set the fields order. Swap fields if set to 1, leave fields alone if
  9572. 0. Default is 0.
  9573. @item sharp
  9574. Enable additional sharpening if set to 1. Default is 0.
  9575. @item twoway
  9576. Enable twoway sharpening if set to 1. Default is 0.
  9577. @end table
  9578. @subsection Examples
  9579. @itemize
  9580. @item
  9581. Apply default values:
  9582. @example
  9583. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  9584. @end example
  9585. @item
  9586. Enable additional sharpening:
  9587. @example
  9588. kerndeint=sharp=1
  9589. @end example
  9590. @item
  9591. Paint processed pixels in white:
  9592. @example
  9593. kerndeint=map=1
  9594. @end example
  9595. @end itemize
  9596. @section lagfun
  9597. Slowly update darker pixels.
  9598. This filter makes short flashes of light appear longer.
  9599. This filter accepts the following options:
  9600. @table @option
  9601. @item decay
  9602. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  9603. @item planes
  9604. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  9605. @end table
  9606. @section lenscorrection
  9607. Correct radial lens distortion
  9608. This filter can be used to correct for radial distortion as can result from the use
  9609. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  9610. one can use tools available for example as part of opencv or simply trial-and-error.
  9611. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  9612. and extract the k1 and k2 coefficients from the resulting matrix.
  9613. Note that effectively the same filter is available in the open-source tools Krita and
  9614. Digikam from the KDE project.
  9615. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  9616. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  9617. brightness distribution, so you may want to use both filters together in certain
  9618. cases, though you will have to take care of ordering, i.e. whether vignetting should
  9619. be applied before or after lens correction.
  9620. @subsection Options
  9621. The filter accepts the following options:
  9622. @table @option
  9623. @item cx
  9624. Relative x-coordinate of the focal point of the image, and thereby the center of the
  9625. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9626. width. Default is 0.5.
  9627. @item cy
  9628. Relative y-coordinate of the focal point of the image, and thereby the center of the
  9629. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9630. height. Default is 0.5.
  9631. @item k1
  9632. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  9633. no correction. Default is 0.
  9634. @item k2
  9635. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  9636. 0 means no correction. Default is 0.
  9637. @end table
  9638. The formula that generates the correction is:
  9639. @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)
  9640. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  9641. distances from the focal point in the source and target images, respectively.
  9642. @section lensfun
  9643. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  9644. The @code{lensfun} filter requires the camera make, camera model, and lens model
  9645. to apply the lens correction. The filter will load the lensfun database and
  9646. query it to find the corresponding camera and lens entries in the database. As
  9647. long as these entries can be found with the given options, the filter can
  9648. perform corrections on frames. Note that incomplete strings will result in the
  9649. filter choosing the best match with the given options, and the filter will
  9650. output the chosen camera and lens models (logged with level "info"). You must
  9651. provide the make, camera model, and lens model as they are required.
  9652. The filter accepts the following options:
  9653. @table @option
  9654. @item make
  9655. The make of the camera (for example, "Canon"). This option is required.
  9656. @item model
  9657. The model of the camera (for example, "Canon EOS 100D"). This option is
  9658. required.
  9659. @item lens_model
  9660. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  9661. option is required.
  9662. @item mode
  9663. The type of correction to apply. The following values are valid options:
  9664. @table @samp
  9665. @item vignetting
  9666. Enables fixing lens vignetting.
  9667. @item geometry
  9668. Enables fixing lens geometry. This is the default.
  9669. @item subpixel
  9670. Enables fixing chromatic aberrations.
  9671. @item vig_geo
  9672. Enables fixing lens vignetting and lens geometry.
  9673. @item vig_subpixel
  9674. Enables fixing lens vignetting and chromatic aberrations.
  9675. @item distortion
  9676. Enables fixing both lens geometry and chromatic aberrations.
  9677. @item all
  9678. Enables all possible corrections.
  9679. @end table
  9680. @item focal_length
  9681. The focal length of the image/video (zoom; expected constant for video). For
  9682. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  9683. range should be chosen when using that lens. Default 18.
  9684. @item aperture
  9685. The aperture of the image/video (expected constant for video). Note that
  9686. aperture is only used for vignetting correction. Default 3.5.
  9687. @item focus_distance
  9688. The focus distance of the image/video (expected constant for video). Note that
  9689. focus distance is only used for vignetting and only slightly affects the
  9690. vignetting correction process. If unknown, leave it at the default value (which
  9691. is 1000).
  9692. @item scale
  9693. The scale factor which is applied after transformation. After correction the
  9694. video is no longer necessarily rectangular. This parameter controls how much of
  9695. the resulting image is visible. The value 0 means that a value will be chosen
  9696. automatically such that there is little or no unmapped area in the output
  9697. image. 1.0 means that no additional scaling is done. Lower values may result
  9698. in more of the corrected image being visible, while higher values may avoid
  9699. unmapped areas in the output.
  9700. @item target_geometry
  9701. The target geometry of the output image/video. The following values are valid
  9702. options:
  9703. @table @samp
  9704. @item rectilinear (default)
  9705. @item fisheye
  9706. @item panoramic
  9707. @item equirectangular
  9708. @item fisheye_orthographic
  9709. @item fisheye_stereographic
  9710. @item fisheye_equisolid
  9711. @item fisheye_thoby
  9712. @end table
  9713. @item reverse
  9714. Apply the reverse of image correction (instead of correcting distortion, apply
  9715. it).
  9716. @item interpolation
  9717. The type of interpolation used when correcting distortion. The following values
  9718. are valid options:
  9719. @table @samp
  9720. @item nearest
  9721. @item linear (default)
  9722. @item lanczos
  9723. @end table
  9724. @end table
  9725. @subsection Examples
  9726. @itemize
  9727. @item
  9728. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9729. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9730. aperture of "8.0".
  9731. @example
  9732. 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
  9733. @end example
  9734. @item
  9735. Apply the same as before, but only for the first 5 seconds of video.
  9736. @example
  9737. 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
  9738. @end example
  9739. @end itemize
  9740. @section libvmaf
  9741. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9742. score between two input videos.
  9743. The obtained VMAF score is printed through the logging system.
  9744. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9745. After installing the library it can be enabled using:
  9746. @code{./configure --enable-libvmaf --enable-version3}.
  9747. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9748. The filter has following options:
  9749. @table @option
  9750. @item model_path
  9751. Set the model path which is to be used for SVM.
  9752. Default value: @code{"/usr/local/share/model/vmaf_v0.6.1.pkl"}
  9753. @item log_path
  9754. Set the file path to be used to store logs.
  9755. @item log_fmt
  9756. Set the format of the log file (xml or json).
  9757. @item enable_transform
  9758. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  9759. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  9760. Default value: @code{false}
  9761. @item phone_model
  9762. Invokes the phone model which will generate VMAF scores higher than in the
  9763. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  9764. Default value: @code{false}
  9765. @item psnr
  9766. Enables computing psnr along with vmaf.
  9767. Default value: @code{false}
  9768. @item ssim
  9769. Enables computing ssim along with vmaf.
  9770. Default value: @code{false}
  9771. @item ms_ssim
  9772. Enables computing ms_ssim along with vmaf.
  9773. Default value: @code{false}
  9774. @item pool
  9775. Set the pool method to be used for computing vmaf.
  9776. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  9777. @item n_threads
  9778. Set number of threads to be used when computing vmaf.
  9779. Default value: @code{0}, which makes use of all available logical processors.
  9780. @item n_subsample
  9781. Set interval for frame subsampling used when computing vmaf.
  9782. Default value: @code{1}
  9783. @item enable_conf_interval
  9784. Enables confidence interval.
  9785. Default value: @code{false}
  9786. @end table
  9787. This filter also supports the @ref{framesync} options.
  9788. @subsection Examples
  9789. @itemize
  9790. @item
  9791. On the below examples the input file @file{main.mpg} being processed is
  9792. compared with the reference file @file{ref.mpg}.
  9793. @example
  9794. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  9795. @end example
  9796. @item
  9797. Example with options:
  9798. @example
  9799. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  9800. @end example
  9801. @item
  9802. Example with options and different containers:
  9803. @example
  9804. ffmpeg -i main.mpg -i ref.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[main][ref]libvmaf=psnr=1:log_fmt=json" -f null -
  9805. @end example
  9806. @end itemize
  9807. @section limiter
  9808. Limits the pixel components values to the specified range [min, max].
  9809. The filter accepts the following options:
  9810. @table @option
  9811. @item min
  9812. Lower bound. Defaults to the lowest allowed value for the input.
  9813. @item max
  9814. Upper bound. Defaults to the highest allowed value for the input.
  9815. @item planes
  9816. Specify which planes will be processed. Defaults to all available.
  9817. @end table
  9818. @section loop
  9819. Loop video frames.
  9820. The filter accepts the following options:
  9821. @table @option
  9822. @item loop
  9823. Set the number of loops. Setting this value to -1 will result in infinite loops.
  9824. Default is 0.
  9825. @item size
  9826. Set maximal size in number of frames. Default is 0.
  9827. @item start
  9828. Set first frame of loop. Default is 0.
  9829. @end table
  9830. @subsection Examples
  9831. @itemize
  9832. @item
  9833. Loop single first frame infinitely:
  9834. @example
  9835. loop=loop=-1:size=1:start=0
  9836. @end example
  9837. @item
  9838. Loop single first frame 10 times:
  9839. @example
  9840. loop=loop=10:size=1:start=0
  9841. @end example
  9842. @item
  9843. Loop 10 first frames 5 times:
  9844. @example
  9845. loop=loop=5:size=10:start=0
  9846. @end example
  9847. @end itemize
  9848. @section lut1d
  9849. Apply a 1D LUT to an input video.
  9850. The filter accepts the following options:
  9851. @table @option
  9852. @item file
  9853. Set the 1D LUT file name.
  9854. Currently supported formats:
  9855. @table @samp
  9856. @item cube
  9857. Iridas
  9858. @item csp
  9859. cineSpace
  9860. @end table
  9861. @item interp
  9862. Select interpolation mode.
  9863. Available values are:
  9864. @table @samp
  9865. @item nearest
  9866. Use values from the nearest defined point.
  9867. @item linear
  9868. Interpolate values using the linear interpolation.
  9869. @item cosine
  9870. Interpolate values using the cosine interpolation.
  9871. @item cubic
  9872. Interpolate values using the cubic interpolation.
  9873. @item spline
  9874. Interpolate values using the spline interpolation.
  9875. @end table
  9876. @end table
  9877. @anchor{lut3d}
  9878. @section lut3d
  9879. Apply a 3D LUT to an input video.
  9880. The filter accepts the following options:
  9881. @table @option
  9882. @item file
  9883. Set the 3D LUT file name.
  9884. Currently supported formats:
  9885. @table @samp
  9886. @item 3dl
  9887. AfterEffects
  9888. @item cube
  9889. Iridas
  9890. @item dat
  9891. DaVinci
  9892. @item m3d
  9893. Pandora
  9894. @item csp
  9895. cineSpace
  9896. @end table
  9897. @item interp
  9898. Select interpolation mode.
  9899. Available values are:
  9900. @table @samp
  9901. @item nearest
  9902. Use values from the nearest defined point.
  9903. @item trilinear
  9904. Interpolate values using the 8 points defining a cube.
  9905. @item tetrahedral
  9906. Interpolate values using a tetrahedron.
  9907. @end table
  9908. @end table
  9909. @section lumakey
  9910. Turn certain luma values into transparency.
  9911. The filter accepts the following options:
  9912. @table @option
  9913. @item threshold
  9914. Set the luma which will be used as base for transparency.
  9915. Default value is @code{0}.
  9916. @item tolerance
  9917. Set the range of luma values to be keyed out.
  9918. Default value is @code{0.01}.
  9919. @item softness
  9920. Set the range of softness. Default value is @code{0}.
  9921. Use this to control gradual transition from zero to full transparency.
  9922. @end table
  9923. @subsection Commands
  9924. This filter supports same @ref{commands} as options.
  9925. The command accepts the same syntax of the corresponding option.
  9926. If the specified expression is not valid, it is kept at its current
  9927. value.
  9928. @section lut, lutrgb, lutyuv
  9929. Compute a look-up table for binding each pixel component input value
  9930. to an output value, and apply it to the input video.
  9931. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  9932. to an RGB input video.
  9933. These filters accept the following parameters:
  9934. @table @option
  9935. @item c0
  9936. set first pixel component expression
  9937. @item c1
  9938. set second pixel component expression
  9939. @item c2
  9940. set third pixel component expression
  9941. @item c3
  9942. set fourth pixel component expression, corresponds to the alpha component
  9943. @item r
  9944. set red component expression
  9945. @item g
  9946. set green component expression
  9947. @item b
  9948. set blue component expression
  9949. @item a
  9950. alpha component expression
  9951. @item y
  9952. set Y/luminance component expression
  9953. @item u
  9954. set U/Cb component expression
  9955. @item v
  9956. set V/Cr component expression
  9957. @end table
  9958. Each of them specifies the expression to use for computing the lookup table for
  9959. the corresponding pixel component values.
  9960. The exact component associated to each of the @var{c*} options depends on the
  9961. format in input.
  9962. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  9963. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  9964. The expressions can contain the following constants and functions:
  9965. @table @option
  9966. @item w
  9967. @item h
  9968. The input width and height.
  9969. @item val
  9970. The input value for the pixel component.
  9971. @item clipval
  9972. The input value, clipped to the @var{minval}-@var{maxval} range.
  9973. @item maxval
  9974. The maximum value for the pixel component.
  9975. @item minval
  9976. The minimum value for the pixel component.
  9977. @item negval
  9978. The negated value for the pixel component value, clipped to the
  9979. @var{minval}-@var{maxval} range; it corresponds to the expression
  9980. "maxval-clipval+minval".
  9981. @item clip(val)
  9982. The computed value in @var{val}, clipped to the
  9983. @var{minval}-@var{maxval} range.
  9984. @item gammaval(gamma)
  9985. The computed gamma correction value of the pixel component value,
  9986. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  9987. expression
  9988. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  9989. @end table
  9990. All expressions default to "val".
  9991. @subsection Examples
  9992. @itemize
  9993. @item
  9994. Negate input video:
  9995. @example
  9996. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  9997. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  9998. @end example
  9999. The above is the same as:
  10000. @example
  10001. lutrgb="r=negval:g=negval:b=negval"
  10002. lutyuv="y=negval:u=negval:v=negval"
  10003. @end example
  10004. @item
  10005. Negate luminance:
  10006. @example
  10007. lutyuv=y=negval
  10008. @end example
  10009. @item
  10010. Remove chroma components, turning the video into a graytone image:
  10011. @example
  10012. lutyuv="u=128:v=128"
  10013. @end example
  10014. @item
  10015. Apply a luma burning effect:
  10016. @example
  10017. lutyuv="y=2*val"
  10018. @end example
  10019. @item
  10020. Remove green and blue components:
  10021. @example
  10022. lutrgb="g=0:b=0"
  10023. @end example
  10024. @item
  10025. Set a constant alpha channel value on input:
  10026. @example
  10027. format=rgba,lutrgb=a="maxval-minval/2"
  10028. @end example
  10029. @item
  10030. Correct luminance gamma by a factor of 0.5:
  10031. @example
  10032. lutyuv=y=gammaval(0.5)
  10033. @end example
  10034. @item
  10035. Discard least significant bits of luma:
  10036. @example
  10037. lutyuv=y='bitand(val, 128+64+32)'
  10038. @end example
  10039. @item
  10040. Technicolor like effect:
  10041. @example
  10042. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  10043. @end example
  10044. @end itemize
  10045. @section lut2, tlut2
  10046. The @code{lut2} filter takes two input streams and outputs one
  10047. stream.
  10048. The @code{tlut2} (time lut2) filter takes two consecutive frames
  10049. from one single stream.
  10050. This filter accepts the following parameters:
  10051. @table @option
  10052. @item c0
  10053. set first pixel component expression
  10054. @item c1
  10055. set second pixel component expression
  10056. @item c2
  10057. set third pixel component expression
  10058. @item c3
  10059. set fourth pixel component expression, corresponds to the alpha component
  10060. @item d
  10061. set output bit depth, only available for @code{lut2} filter. By default is 0,
  10062. which means bit depth is automatically picked from first input format.
  10063. @end table
  10064. The @code{lut2} filter also supports the @ref{framesync} options.
  10065. Each of them specifies the expression to use for computing the lookup table for
  10066. the corresponding pixel component values.
  10067. The exact component associated to each of the @var{c*} options depends on the
  10068. format in inputs.
  10069. The expressions can contain the following constants:
  10070. @table @option
  10071. @item w
  10072. @item h
  10073. The input width and height.
  10074. @item x
  10075. The first input value for the pixel component.
  10076. @item y
  10077. The second input value for the pixel component.
  10078. @item bdx
  10079. The first input video bit depth.
  10080. @item bdy
  10081. The second input video bit depth.
  10082. @end table
  10083. All expressions default to "x".
  10084. @subsection Examples
  10085. @itemize
  10086. @item
  10087. Highlight differences between two RGB video streams:
  10088. @example
  10089. 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)'
  10090. @end example
  10091. @item
  10092. Highlight differences between two YUV video streams:
  10093. @example
  10094. 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)'
  10095. @end example
  10096. @item
  10097. Show max difference between two video streams:
  10098. @example
  10099. 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)))'
  10100. @end example
  10101. @end itemize
  10102. @section maskedclamp
  10103. Clamp the first input stream with the second input and third input stream.
  10104. Returns the value of first stream to be between second input
  10105. stream - @code{undershoot} and third input stream + @code{overshoot}.
  10106. This filter accepts the following options:
  10107. @table @option
  10108. @item undershoot
  10109. Default value is @code{0}.
  10110. @item overshoot
  10111. Default value is @code{0}.
  10112. @item planes
  10113. Set which planes will be processed as bitmap, unprocessed planes will be
  10114. copied from first stream.
  10115. By default value 0xf, all planes will be processed.
  10116. @end table
  10117. @section maskedmax
  10118. Merge the second and third input stream into output stream using absolute differences
  10119. between second input stream and first input stream and absolute difference between
  10120. third input stream and first input stream. The picked value will be from second input
  10121. stream if second absolute difference is greater than first one or from third input stream
  10122. otherwise.
  10123. This filter accepts the following options:
  10124. @table @option
  10125. @item planes
  10126. Set which planes will be processed as bitmap, unprocessed planes will be
  10127. copied from first stream.
  10128. By default value 0xf, all planes will be processed.
  10129. @end table
  10130. @section maskedmerge
  10131. Merge the first input stream with the second input stream using per pixel
  10132. weights in the third input stream.
  10133. A value of 0 in the third stream pixel component means that pixel component
  10134. from first stream is returned unchanged, while maximum value (eg. 255 for
  10135. 8-bit videos) means that pixel component from second stream is returned
  10136. unchanged. Intermediate values define the amount of merging between both
  10137. input stream's pixel components.
  10138. This filter accepts the following options:
  10139. @table @option
  10140. @item planes
  10141. Set which planes will be processed as bitmap, unprocessed planes will be
  10142. copied from first stream.
  10143. By default value 0xf, all planes will be processed.
  10144. @end table
  10145. @section maskedmin
  10146. Merge the second and third input stream into output stream using absolute differences
  10147. between second input stream and first input stream and absolute difference between
  10148. third input stream and first input stream. The picked value will be from second input
  10149. stream if second absolute difference is less than first one or from third input stream
  10150. otherwise.
  10151. This filter accepts the following options:
  10152. @table @option
  10153. @item planes
  10154. Set which planes will be processed as bitmap, unprocessed planes will be
  10155. copied from first stream.
  10156. By default value 0xf, all planes will be processed.
  10157. @end table
  10158. @section maskedthreshold
  10159. Pick pixels comparing absolute difference of two video streams with fixed
  10160. threshold.
  10161. If absolute difference between pixel component of first and second video
  10162. stream is equal or lower than user supplied threshold than pixel component
  10163. from first video stream is picked, otherwise pixel component from second
  10164. video stream is picked.
  10165. This filter accepts the following options:
  10166. @table @option
  10167. @item threshold
  10168. Set threshold used when picking pixels from absolute difference from two input
  10169. video streams.
  10170. @item planes
  10171. Set which planes will be processed as bitmap, unprocessed planes will be
  10172. copied from second stream.
  10173. By default value 0xf, all planes will be processed.
  10174. @end table
  10175. @section maskfun
  10176. Create mask from input video.
  10177. For example it is useful to create motion masks after @code{tblend} filter.
  10178. This filter accepts the following options:
  10179. @table @option
  10180. @item low
  10181. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  10182. @item high
  10183. Set high threshold. Any pixel component higher than this value will be set to max value
  10184. allowed for current pixel format.
  10185. @item planes
  10186. Set planes to filter, by default all available planes are filtered.
  10187. @item fill
  10188. Fill all frame pixels with this value.
  10189. @item sum
  10190. Set max average pixel value for frame. If sum of all pixel components is higher that this
  10191. average, output frame will be completely filled with value set by @var{fill} option.
  10192. Typically useful for scene changes when used in combination with @code{tblend} filter.
  10193. @end table
  10194. @section mcdeint
  10195. Apply motion-compensation deinterlacing.
  10196. It needs one field per frame as input and must thus be used together
  10197. with yadif=1/3 or equivalent.
  10198. This filter accepts the following options:
  10199. @table @option
  10200. @item mode
  10201. Set the deinterlacing mode.
  10202. It accepts one of the following values:
  10203. @table @samp
  10204. @item fast
  10205. @item medium
  10206. @item slow
  10207. use iterative motion estimation
  10208. @item extra_slow
  10209. like @samp{slow}, but use multiple reference frames.
  10210. @end table
  10211. Default value is @samp{fast}.
  10212. @item parity
  10213. Set the picture field parity assumed for the input video. It must be
  10214. one of the following values:
  10215. @table @samp
  10216. @item 0, tff
  10217. assume top field first
  10218. @item 1, bff
  10219. assume bottom field first
  10220. @end table
  10221. Default value is @samp{bff}.
  10222. @item qp
  10223. Set per-block quantization parameter (QP) used by the internal
  10224. encoder.
  10225. Higher values should result in a smoother motion vector field but less
  10226. optimal individual vectors. Default value is 1.
  10227. @end table
  10228. @section median
  10229. Pick median pixel from certain rectangle defined by radius.
  10230. This filter accepts the following options:
  10231. @table @option
  10232. @item radius
  10233. Set horizontal radius size. Default value is @code{1}.
  10234. Allowed range is integer from 1 to 127.
  10235. @item planes
  10236. Set which planes to process. Default is @code{15}, which is all available planes.
  10237. @item radiusV
  10238. Set vertical radius size. Default value is @code{0}.
  10239. Allowed range is integer from 0 to 127.
  10240. If it is 0, value will be picked from horizontal @code{radius} option.
  10241. @item percentile
  10242. Set median percentile. Default value is @code{0.5}.
  10243. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  10244. minimum values, and @code{1} maximum values.
  10245. @end table
  10246. @subsection Commands
  10247. This filter supports same @ref{commands} as options.
  10248. The command accepts the same syntax of the corresponding option.
  10249. If the specified expression is not valid, it is kept at its current
  10250. value.
  10251. @section mergeplanes
  10252. Merge color channel components from several video streams.
  10253. The filter accepts up to 4 input streams, and merge selected input
  10254. planes to the output video.
  10255. This filter accepts the following options:
  10256. @table @option
  10257. @item mapping
  10258. Set input to output plane mapping. Default is @code{0}.
  10259. The mappings is specified as a bitmap. It should be specified as a
  10260. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  10261. mapping for the first plane of the output stream. 'A' sets the number of
  10262. the input stream to use (from 0 to 3), and 'a' the plane number of the
  10263. corresponding input to use (from 0 to 3). The rest of the mappings is
  10264. similar, 'Bb' describes the mapping for the output stream second
  10265. plane, 'Cc' describes the mapping for the output stream third plane and
  10266. 'Dd' describes the mapping for the output stream fourth plane.
  10267. @item format
  10268. Set output pixel format. Default is @code{yuva444p}.
  10269. @end table
  10270. @subsection Examples
  10271. @itemize
  10272. @item
  10273. Merge three gray video streams of same width and height into single video stream:
  10274. @example
  10275. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  10276. @end example
  10277. @item
  10278. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  10279. @example
  10280. [a0][a1]mergeplanes=0x00010210:yuva444p
  10281. @end example
  10282. @item
  10283. Swap Y and A plane in yuva444p stream:
  10284. @example
  10285. format=yuva444p,mergeplanes=0x03010200:yuva444p
  10286. @end example
  10287. @item
  10288. Swap U and V plane in yuv420p stream:
  10289. @example
  10290. format=yuv420p,mergeplanes=0x000201:yuv420p
  10291. @end example
  10292. @item
  10293. Cast a rgb24 clip to yuv444p:
  10294. @example
  10295. format=rgb24,mergeplanes=0x000102:yuv444p
  10296. @end example
  10297. @end itemize
  10298. @section mestimate
  10299. Estimate and export motion vectors using block matching algorithms.
  10300. Motion vectors are stored in frame side data to be used by other filters.
  10301. This filter accepts the following options:
  10302. @table @option
  10303. @item method
  10304. Specify the motion estimation method. Accepts one of the following values:
  10305. @table @samp
  10306. @item esa
  10307. Exhaustive search algorithm.
  10308. @item tss
  10309. Three step search algorithm.
  10310. @item tdls
  10311. Two dimensional logarithmic search algorithm.
  10312. @item ntss
  10313. New three step search algorithm.
  10314. @item fss
  10315. Four step search algorithm.
  10316. @item ds
  10317. Diamond search algorithm.
  10318. @item hexbs
  10319. Hexagon-based search algorithm.
  10320. @item epzs
  10321. Enhanced predictive zonal search algorithm.
  10322. @item umh
  10323. Uneven multi-hexagon search algorithm.
  10324. @end table
  10325. Default value is @samp{esa}.
  10326. @item mb_size
  10327. Macroblock size. Default @code{16}.
  10328. @item search_param
  10329. Search parameter. Default @code{7}.
  10330. @end table
  10331. @section midequalizer
  10332. Apply Midway Image Equalization effect using two video streams.
  10333. Midway Image Equalization adjusts a pair of images to have the same
  10334. histogram, while maintaining their dynamics as much as possible. It's
  10335. useful for e.g. matching exposures from a pair of stereo cameras.
  10336. This filter has two inputs and one output, which must be of same pixel format, but
  10337. may be of different sizes. The output of filter is first input adjusted with
  10338. midway histogram of both inputs.
  10339. This filter accepts the following option:
  10340. @table @option
  10341. @item planes
  10342. Set which planes to process. Default is @code{15}, which is all available planes.
  10343. @end table
  10344. @section minterpolate
  10345. Convert the video to specified frame rate using motion interpolation.
  10346. This filter accepts the following options:
  10347. @table @option
  10348. @item fps
  10349. 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}.
  10350. @item mi_mode
  10351. Motion interpolation mode. Following values are accepted:
  10352. @table @samp
  10353. @item dup
  10354. Duplicate previous or next frame for interpolating new ones.
  10355. @item blend
  10356. Blend source frames. Interpolated frame is mean of previous and next frames.
  10357. @item mci
  10358. Motion compensated interpolation. Following options are effective when this mode is selected:
  10359. @table @samp
  10360. @item mc_mode
  10361. Motion compensation mode. Following values are accepted:
  10362. @table @samp
  10363. @item obmc
  10364. Overlapped block motion compensation.
  10365. @item aobmc
  10366. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  10367. @end table
  10368. Default mode is @samp{obmc}.
  10369. @item me_mode
  10370. Motion estimation mode. Following values are accepted:
  10371. @table @samp
  10372. @item bidir
  10373. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  10374. @item bilat
  10375. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  10376. @end table
  10377. Default mode is @samp{bilat}.
  10378. @item me
  10379. The algorithm to be used for motion estimation. Following values are accepted:
  10380. @table @samp
  10381. @item esa
  10382. Exhaustive search algorithm.
  10383. @item tss
  10384. Three step search algorithm.
  10385. @item tdls
  10386. Two dimensional logarithmic search algorithm.
  10387. @item ntss
  10388. New three step search algorithm.
  10389. @item fss
  10390. Four step search algorithm.
  10391. @item ds
  10392. Diamond search algorithm.
  10393. @item hexbs
  10394. Hexagon-based search algorithm.
  10395. @item epzs
  10396. Enhanced predictive zonal search algorithm.
  10397. @item umh
  10398. Uneven multi-hexagon search algorithm.
  10399. @end table
  10400. Default algorithm is @samp{epzs}.
  10401. @item mb_size
  10402. Macroblock size. Default @code{16}.
  10403. @item search_param
  10404. Motion estimation search parameter. Default @code{32}.
  10405. @item vsbmc
  10406. 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).
  10407. @end table
  10408. @end table
  10409. @item scd
  10410. 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:
  10411. @table @samp
  10412. @item none
  10413. Disable scene change detection.
  10414. @item fdiff
  10415. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  10416. @end table
  10417. Default method is @samp{fdiff}.
  10418. @item scd_threshold
  10419. Scene change detection threshold. Default is @code{10.}.
  10420. @end table
  10421. @section mix
  10422. Mix several video input streams into one video stream.
  10423. A description of the accepted options follows.
  10424. @table @option
  10425. @item nb_inputs
  10426. The number of inputs. If unspecified, it defaults to 2.
  10427. @item weights
  10428. Specify weight of each input video stream as sequence.
  10429. Each weight is separated by space. If number of weights
  10430. is smaller than number of @var{frames} last specified
  10431. weight will be used for all remaining unset weights.
  10432. @item scale
  10433. Specify scale, if it is set it will be multiplied with sum
  10434. of each weight multiplied with pixel values to give final destination
  10435. pixel value. By default @var{scale} is auto scaled to sum of weights.
  10436. @item duration
  10437. Specify how end of stream is determined.
  10438. @table @samp
  10439. @item longest
  10440. The duration of the longest input. (default)
  10441. @item shortest
  10442. The duration of the shortest input.
  10443. @item first
  10444. The duration of the first input.
  10445. @end table
  10446. @end table
  10447. @section mpdecimate
  10448. Drop frames that do not differ greatly from the previous frame in
  10449. order to reduce frame rate.
  10450. The main use of this filter is for very-low-bitrate encoding
  10451. (e.g. streaming over dialup modem), but it could in theory be used for
  10452. fixing movies that were inverse-telecined incorrectly.
  10453. A description of the accepted options follows.
  10454. @table @option
  10455. @item max
  10456. Set the maximum number of consecutive frames which can be dropped (if
  10457. positive), or the minimum interval between dropped frames (if
  10458. negative). If the value is 0, the frame is dropped disregarding the
  10459. number of previous sequentially dropped frames.
  10460. Default value is 0.
  10461. @item hi
  10462. @item lo
  10463. @item frac
  10464. Set the dropping threshold values.
  10465. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  10466. represent actual pixel value differences, so a threshold of 64
  10467. corresponds to 1 unit of difference for each pixel, or the same spread
  10468. out differently over the block.
  10469. A frame is a candidate for dropping if no 8x8 blocks differ by more
  10470. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  10471. meaning the whole image) differ by more than a threshold of @option{lo}.
  10472. Default value for @option{hi} is 64*12, default value for @option{lo} is
  10473. 64*5, and default value for @option{frac} is 0.33.
  10474. @end table
  10475. @section negate
  10476. Negate (invert) the input video.
  10477. It accepts the following option:
  10478. @table @option
  10479. @item negate_alpha
  10480. With value 1, it negates the alpha component, if present. Default value is 0.
  10481. @end table
  10482. @anchor{nlmeans}
  10483. @section nlmeans
  10484. Denoise frames using Non-Local Means algorithm.
  10485. Each pixel is adjusted by looking for other pixels with similar contexts. This
  10486. context similarity is defined by comparing their surrounding patches of size
  10487. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  10488. around the pixel.
  10489. Note that the research area defines centers for patches, which means some
  10490. patches will be made of pixels outside that research area.
  10491. The filter accepts the following options.
  10492. @table @option
  10493. @item s
  10494. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  10495. @item p
  10496. Set patch size. Default is 7. Must be odd number in range [0, 99].
  10497. @item pc
  10498. Same as @option{p} but for chroma planes.
  10499. The default value is @var{0} and means automatic.
  10500. @item r
  10501. Set research size. Default is 15. Must be odd number in range [0, 99].
  10502. @item rc
  10503. Same as @option{r} but for chroma planes.
  10504. The default value is @var{0} and means automatic.
  10505. @end table
  10506. @section nnedi
  10507. Deinterlace video using neural network edge directed interpolation.
  10508. This filter accepts the following options:
  10509. @table @option
  10510. @item weights
  10511. Mandatory option, without binary file filter can not work.
  10512. Currently file can be found here:
  10513. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  10514. @item deint
  10515. Set which frames to deinterlace, by default it is @code{all}.
  10516. Can be @code{all} or @code{interlaced}.
  10517. @item field
  10518. Set mode of operation.
  10519. Can be one of the following:
  10520. @table @samp
  10521. @item af
  10522. Use frame flags, both fields.
  10523. @item a
  10524. Use frame flags, single field.
  10525. @item t
  10526. Use top field only.
  10527. @item b
  10528. Use bottom field only.
  10529. @item tf
  10530. Use both fields, top first.
  10531. @item bf
  10532. Use both fields, bottom first.
  10533. @end table
  10534. @item planes
  10535. Set which planes to process, by default filter process all frames.
  10536. @item nsize
  10537. Set size of local neighborhood around each pixel, used by the predictor neural
  10538. network.
  10539. Can be one of the following:
  10540. @table @samp
  10541. @item s8x6
  10542. @item s16x6
  10543. @item s32x6
  10544. @item s48x6
  10545. @item s8x4
  10546. @item s16x4
  10547. @item s32x4
  10548. @end table
  10549. @item nns
  10550. Set the number of neurons in predictor neural network.
  10551. Can be one of the following:
  10552. @table @samp
  10553. @item n16
  10554. @item n32
  10555. @item n64
  10556. @item n128
  10557. @item n256
  10558. @end table
  10559. @item qual
  10560. Controls the number of different neural network predictions that are blended
  10561. together to compute the final output value. Can be @code{fast}, default or
  10562. @code{slow}.
  10563. @item etype
  10564. Set which set of weights to use in the predictor.
  10565. Can be one of the following:
  10566. @table @samp
  10567. @item a
  10568. weights trained to minimize absolute error
  10569. @item s
  10570. weights trained to minimize squared error
  10571. @end table
  10572. @item pscrn
  10573. Controls whether or not the prescreener neural network is used to decide
  10574. which pixels should be processed by the predictor neural network and which
  10575. can be handled by simple cubic interpolation.
  10576. The prescreener is trained to know whether cubic interpolation will be
  10577. sufficient for a pixel or whether it should be predicted by the predictor nn.
  10578. The computational complexity of the prescreener nn is much less than that of
  10579. the predictor nn. Since most pixels can be handled by cubic interpolation,
  10580. using the prescreener generally results in much faster processing.
  10581. The prescreener is pretty accurate, so the difference between using it and not
  10582. using it is almost always unnoticeable.
  10583. Can be one of the following:
  10584. @table @samp
  10585. @item none
  10586. @item original
  10587. @item new
  10588. @end table
  10589. Default is @code{new}.
  10590. @item fapprox
  10591. Set various debugging flags.
  10592. @end table
  10593. @section noformat
  10594. Force libavfilter not to use any of the specified pixel formats for the
  10595. input to the next filter.
  10596. It accepts the following parameters:
  10597. @table @option
  10598. @item pix_fmts
  10599. A '|'-separated list of pixel format names, such as
  10600. pix_fmts=yuv420p|monow|rgb24".
  10601. @end table
  10602. @subsection Examples
  10603. @itemize
  10604. @item
  10605. Force libavfilter to use a format different from @var{yuv420p} for the
  10606. input to the vflip filter:
  10607. @example
  10608. noformat=pix_fmts=yuv420p,vflip
  10609. @end example
  10610. @item
  10611. Convert the input video to any of the formats not contained in the list:
  10612. @example
  10613. noformat=yuv420p|yuv444p|yuv410p
  10614. @end example
  10615. @end itemize
  10616. @section noise
  10617. Add noise on video input frame.
  10618. The filter accepts the following options:
  10619. @table @option
  10620. @item all_seed
  10621. @item c0_seed
  10622. @item c1_seed
  10623. @item c2_seed
  10624. @item c3_seed
  10625. Set noise seed for specific pixel component or all pixel components in case
  10626. of @var{all_seed}. Default value is @code{123457}.
  10627. @item all_strength, alls
  10628. @item c0_strength, c0s
  10629. @item c1_strength, c1s
  10630. @item c2_strength, c2s
  10631. @item c3_strength, c3s
  10632. Set noise strength for specific pixel component or all pixel components in case
  10633. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  10634. @item all_flags, allf
  10635. @item c0_flags, c0f
  10636. @item c1_flags, c1f
  10637. @item c2_flags, c2f
  10638. @item c3_flags, c3f
  10639. Set pixel component flags or set flags for all components if @var{all_flags}.
  10640. Available values for component flags are:
  10641. @table @samp
  10642. @item a
  10643. averaged temporal noise (smoother)
  10644. @item p
  10645. mix random noise with a (semi)regular pattern
  10646. @item t
  10647. temporal noise (noise pattern changes between frames)
  10648. @item u
  10649. uniform noise (gaussian otherwise)
  10650. @end table
  10651. @end table
  10652. @subsection Examples
  10653. Add temporal and uniform noise to input video:
  10654. @example
  10655. noise=alls=20:allf=t+u
  10656. @end example
  10657. @section normalize
  10658. Normalize RGB video (aka histogram stretching, contrast stretching).
  10659. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  10660. For each channel of each frame, the filter computes the input range and maps
  10661. it linearly to the user-specified output range. The output range defaults
  10662. to the full dynamic range from pure black to pure white.
  10663. Temporal smoothing can be used on the input range to reduce flickering (rapid
  10664. changes in brightness) caused when small dark or bright objects enter or leave
  10665. the scene. This is similar to the auto-exposure (automatic gain control) on a
  10666. video camera, and, like a video camera, it may cause a period of over- or
  10667. under-exposure of the video.
  10668. The R,G,B channels can be normalized independently, which may cause some
  10669. color shifting, or linked together as a single channel, which prevents
  10670. color shifting. Linked normalization preserves hue. Independent normalization
  10671. does not, so it can be used to remove some color casts. Independent and linked
  10672. normalization can be combined in any ratio.
  10673. The normalize filter accepts the following options:
  10674. @table @option
  10675. @item blackpt
  10676. @item whitept
  10677. Colors which define the output range. The minimum input value is mapped to
  10678. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  10679. The defaults are black and white respectively. Specifying white for
  10680. @var{blackpt} and black for @var{whitept} will give color-inverted,
  10681. normalized video. Shades of grey can be used to reduce the dynamic range
  10682. (contrast). Specifying saturated colors here can create some interesting
  10683. effects.
  10684. @item smoothing
  10685. The number of previous frames to use for temporal smoothing. The input range
  10686. of each channel is smoothed using a rolling average over the current frame
  10687. and the @var{smoothing} previous frames. The default is 0 (no temporal
  10688. smoothing).
  10689. @item independence
  10690. Controls the ratio of independent (color shifting) channel normalization to
  10691. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  10692. independent. Defaults to 1.0 (fully independent).
  10693. @item strength
  10694. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  10695. expensive no-op. Defaults to 1.0 (full strength).
  10696. @end table
  10697. @subsection Commands
  10698. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  10699. The command accepts the same syntax of the corresponding option.
  10700. If the specified expression is not valid, it is kept at its current
  10701. value.
  10702. @subsection Examples
  10703. Stretch video contrast to use the full dynamic range, with no temporal
  10704. smoothing; may flicker depending on the source content:
  10705. @example
  10706. normalize=blackpt=black:whitept=white:smoothing=0
  10707. @end example
  10708. As above, but with 50 frames of temporal smoothing; flicker should be
  10709. reduced, depending on the source content:
  10710. @example
  10711. normalize=blackpt=black:whitept=white:smoothing=50
  10712. @end example
  10713. As above, but with hue-preserving linked channel normalization:
  10714. @example
  10715. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  10716. @end example
  10717. As above, but with half strength:
  10718. @example
  10719. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  10720. @end example
  10721. Map the darkest input color to red, the brightest input color to cyan:
  10722. @example
  10723. normalize=blackpt=red:whitept=cyan
  10724. @end example
  10725. @section null
  10726. Pass the video source unchanged to the output.
  10727. @section ocr
  10728. Optical Character Recognition
  10729. This filter uses Tesseract for optical character recognition. To enable
  10730. compilation of this filter, you need to configure FFmpeg with
  10731. @code{--enable-libtesseract}.
  10732. It accepts the following options:
  10733. @table @option
  10734. @item datapath
  10735. Set datapath to tesseract data. Default is to use whatever was
  10736. set at installation.
  10737. @item language
  10738. Set language, default is "eng".
  10739. @item whitelist
  10740. Set character whitelist.
  10741. @item blacklist
  10742. Set character blacklist.
  10743. @end table
  10744. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  10745. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  10746. @section ocv
  10747. Apply a video transform using libopencv.
  10748. To enable this filter, install the libopencv library and headers and
  10749. configure FFmpeg with @code{--enable-libopencv}.
  10750. It accepts the following parameters:
  10751. @table @option
  10752. @item filter_name
  10753. The name of the libopencv filter to apply.
  10754. @item filter_params
  10755. The parameters to pass to the libopencv filter. If not specified, the default
  10756. values are assumed.
  10757. @end table
  10758. Refer to the official libopencv documentation for more precise
  10759. information:
  10760. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  10761. Several libopencv filters are supported; see the following subsections.
  10762. @anchor{dilate}
  10763. @subsection dilate
  10764. Dilate an image by using a specific structuring element.
  10765. It corresponds to the libopencv function @code{cvDilate}.
  10766. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  10767. @var{struct_el} represents a structuring element, and has the syntax:
  10768. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  10769. @var{cols} and @var{rows} represent the number of columns and rows of
  10770. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  10771. point, and @var{shape} the shape for the structuring element. @var{shape}
  10772. must be "rect", "cross", "ellipse", or "custom".
  10773. If the value for @var{shape} is "custom", it must be followed by a
  10774. string of the form "=@var{filename}". The file with name
  10775. @var{filename} is assumed to represent a binary image, with each
  10776. printable character corresponding to a bright pixel. When a custom
  10777. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  10778. or columns and rows of the read file are assumed instead.
  10779. The default value for @var{struct_el} is "3x3+0x0/rect".
  10780. @var{nb_iterations} specifies the number of times the transform is
  10781. applied to the image, and defaults to 1.
  10782. Some examples:
  10783. @example
  10784. # Use the default values
  10785. ocv=dilate
  10786. # Dilate using a structuring element with a 5x5 cross, iterating two times
  10787. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  10788. # Read the shape from the file diamond.shape, iterating two times.
  10789. # The file diamond.shape may contain a pattern of characters like this
  10790. # *
  10791. # ***
  10792. # *****
  10793. # ***
  10794. # *
  10795. # The specified columns and rows are ignored
  10796. # but the anchor point coordinates are not
  10797. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  10798. @end example
  10799. @subsection erode
  10800. Erode an image by using a specific structuring element.
  10801. It corresponds to the libopencv function @code{cvErode}.
  10802. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  10803. with the same syntax and semantics as the @ref{dilate} filter.
  10804. @subsection smooth
  10805. Smooth the input video.
  10806. The filter takes the following parameters:
  10807. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  10808. @var{type} is the type of smooth filter to apply, and must be one of
  10809. the following values: "blur", "blur_no_scale", "median", "gaussian",
  10810. or "bilateral". The default value is "gaussian".
  10811. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  10812. depends on the smooth type. @var{param1} and
  10813. @var{param2} accept integer positive values or 0. @var{param3} and
  10814. @var{param4} accept floating point values.
  10815. The default value for @var{param1} is 3. The default value for the
  10816. other parameters is 0.
  10817. These parameters correspond to the parameters assigned to the
  10818. libopencv function @code{cvSmooth}.
  10819. @section oscilloscope
  10820. 2D Video Oscilloscope.
  10821. Useful to measure spatial impulse, step responses, chroma delays, etc.
  10822. It accepts the following parameters:
  10823. @table @option
  10824. @item x
  10825. Set scope center x position.
  10826. @item y
  10827. Set scope center y position.
  10828. @item s
  10829. Set scope size, relative to frame diagonal.
  10830. @item t
  10831. Set scope tilt/rotation.
  10832. @item o
  10833. Set trace opacity.
  10834. @item tx
  10835. Set trace center x position.
  10836. @item ty
  10837. Set trace center y position.
  10838. @item tw
  10839. Set trace width, relative to width of frame.
  10840. @item th
  10841. Set trace height, relative to height of frame.
  10842. @item c
  10843. Set which components to trace. By default it traces first three components.
  10844. @item g
  10845. Draw trace grid. By default is enabled.
  10846. @item st
  10847. Draw some statistics. By default is enabled.
  10848. @item sc
  10849. Draw scope. By default is enabled.
  10850. @end table
  10851. @subsection Commands
  10852. This filter supports same @ref{commands} as options.
  10853. The command accepts the same syntax of the corresponding option.
  10854. If the specified expression is not valid, it is kept at its current
  10855. value.
  10856. @subsection Examples
  10857. @itemize
  10858. @item
  10859. Inspect full first row of video frame.
  10860. @example
  10861. oscilloscope=x=0.5:y=0:s=1
  10862. @end example
  10863. @item
  10864. Inspect full last row of video frame.
  10865. @example
  10866. oscilloscope=x=0.5:y=1:s=1
  10867. @end example
  10868. @item
  10869. Inspect full 5th line of video frame of height 1080.
  10870. @example
  10871. oscilloscope=x=0.5:y=5/1080:s=1
  10872. @end example
  10873. @item
  10874. Inspect full last column of video frame.
  10875. @example
  10876. oscilloscope=x=1:y=0.5:s=1:t=1
  10877. @end example
  10878. @end itemize
  10879. @anchor{overlay}
  10880. @section overlay
  10881. Overlay one video on top of another.
  10882. It takes two inputs and has one output. The first input is the "main"
  10883. video on which the second input is overlaid.
  10884. It accepts the following parameters:
  10885. A description of the accepted options follows.
  10886. @table @option
  10887. @item x
  10888. @item y
  10889. Set the expression for the x and y coordinates of the overlaid video
  10890. on the main video. Default value is "0" for both expressions. In case
  10891. the expression is invalid, it is set to a huge value (meaning that the
  10892. overlay will not be displayed within the output visible area).
  10893. @item eof_action
  10894. See @ref{framesync}.
  10895. @item eval
  10896. Set when the expressions for @option{x}, and @option{y} are evaluated.
  10897. It accepts the following values:
  10898. @table @samp
  10899. @item init
  10900. only evaluate expressions once during the filter initialization or
  10901. when a command is processed
  10902. @item frame
  10903. evaluate expressions for each incoming frame
  10904. @end table
  10905. Default value is @samp{frame}.
  10906. @item shortest
  10907. See @ref{framesync}.
  10908. @item format
  10909. Set the format for the output video.
  10910. It accepts the following values:
  10911. @table @samp
  10912. @item yuv420
  10913. force YUV420 output
  10914. @item yuv422
  10915. force YUV422 output
  10916. @item yuv444
  10917. force YUV444 output
  10918. @item rgb
  10919. force packed RGB output
  10920. @item gbrp
  10921. force planar RGB output
  10922. @item auto
  10923. automatically pick format
  10924. @end table
  10925. Default value is @samp{yuv420}.
  10926. @item repeatlast
  10927. See @ref{framesync}.
  10928. @item alpha
  10929. Set format of alpha of the overlaid video, it can be @var{straight} or
  10930. @var{premultiplied}. Default is @var{straight}.
  10931. @end table
  10932. The @option{x}, and @option{y} expressions can contain the following
  10933. parameters.
  10934. @table @option
  10935. @item main_w, W
  10936. @item main_h, H
  10937. The main input width and height.
  10938. @item overlay_w, w
  10939. @item overlay_h, h
  10940. The overlay input width and height.
  10941. @item x
  10942. @item y
  10943. The computed values for @var{x} and @var{y}. They are evaluated for
  10944. each new frame.
  10945. @item hsub
  10946. @item vsub
  10947. horizontal and vertical chroma subsample values of the output
  10948. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  10949. @var{vsub} is 1.
  10950. @item n
  10951. the number of input frame, starting from 0
  10952. @item pos
  10953. the position in the file of the input frame, NAN if unknown
  10954. @item t
  10955. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  10956. @end table
  10957. This filter also supports the @ref{framesync} options.
  10958. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  10959. when evaluation is done @emph{per frame}, and will evaluate to NAN
  10960. when @option{eval} is set to @samp{init}.
  10961. Be aware that frames are taken from each input video in timestamp
  10962. order, hence, if their initial timestamps differ, it is a good idea
  10963. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  10964. have them begin in the same zero timestamp, as the example for
  10965. the @var{movie} filter does.
  10966. You can chain together more overlays but you should test the
  10967. efficiency of such approach.
  10968. @subsection Commands
  10969. This filter supports the following commands:
  10970. @table @option
  10971. @item x
  10972. @item y
  10973. Modify the x and y of the overlay input.
  10974. The command accepts the same syntax of the corresponding option.
  10975. If the specified expression is not valid, it is kept at its current
  10976. value.
  10977. @end table
  10978. @subsection Examples
  10979. @itemize
  10980. @item
  10981. Draw the overlay at 10 pixels from the bottom right corner of the main
  10982. video:
  10983. @example
  10984. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  10985. @end example
  10986. Using named options the example above becomes:
  10987. @example
  10988. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  10989. @end example
  10990. @item
  10991. Insert a transparent PNG logo in the bottom left corner of the input,
  10992. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  10993. @example
  10994. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  10995. @end example
  10996. @item
  10997. Insert 2 different transparent PNG logos (second logo on bottom
  10998. right corner) using the @command{ffmpeg} tool:
  10999. @example
  11000. 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
  11001. @end example
  11002. @item
  11003. Add a transparent color layer on top of the main video; @code{WxH}
  11004. must specify the size of the main input to the overlay filter:
  11005. @example
  11006. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  11007. @end example
  11008. @item
  11009. Play an original video and a filtered version (here with the deshake
  11010. filter) side by side using the @command{ffplay} tool:
  11011. @example
  11012. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  11013. @end example
  11014. The above command is the same as:
  11015. @example
  11016. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  11017. @end example
  11018. @item
  11019. Make a sliding overlay appearing from the left to the right top part of the
  11020. screen starting since time 2:
  11021. @example
  11022. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  11023. @end example
  11024. @item
  11025. Compose output by putting two input videos side to side:
  11026. @example
  11027. ffmpeg -i left.avi -i right.avi -filter_complex "
  11028. nullsrc=size=200x100 [background];
  11029. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  11030. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  11031. [background][left] overlay=shortest=1 [background+left];
  11032. [background+left][right] overlay=shortest=1:x=100 [left+right]
  11033. "
  11034. @end example
  11035. @item
  11036. Mask 10-20 seconds of a video by applying the delogo filter to a section
  11037. @example
  11038. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  11039. -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]'
  11040. masked.avi
  11041. @end example
  11042. @item
  11043. Chain several overlays in cascade:
  11044. @example
  11045. nullsrc=s=200x200 [bg];
  11046. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  11047. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  11048. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  11049. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  11050. [in3] null, [mid2] overlay=100:100 [out0]
  11051. @end example
  11052. @end itemize
  11053. @anchor{overlay_cuda}
  11054. @section overlay_cuda
  11055. Overlay one video on top of another.
  11056. This is the CUDA cariant of the @ref{overlay} filter.
  11057. It only accepts CUDA frames. The underlying input pixel formats have to match.
  11058. It takes two inputs and has one output. The first input is the "main"
  11059. video on which the second input is overlaid.
  11060. It accepts the following parameters:
  11061. @table @option
  11062. @item x
  11063. @item y
  11064. Set the x and y coordinates of the overlaid video on the main video.
  11065. Default value is "0" for both expressions.
  11066. @item eof_action
  11067. See @ref{framesync}.
  11068. @item shortest
  11069. See @ref{framesync}.
  11070. @item repeatlast
  11071. See @ref{framesync}.
  11072. @end table
  11073. This filter also supports the @ref{framesync} options.
  11074. @section owdenoise
  11075. Apply Overcomplete Wavelet denoiser.
  11076. The filter accepts the following options:
  11077. @table @option
  11078. @item depth
  11079. Set depth.
  11080. Larger depth values will denoise lower frequency components more, but
  11081. slow down filtering.
  11082. Must be an int in the range 8-16, default is @code{8}.
  11083. @item luma_strength, ls
  11084. Set luma strength.
  11085. Must be a double value in the range 0-1000, default is @code{1.0}.
  11086. @item chroma_strength, cs
  11087. Set chroma strength.
  11088. Must be a double value in the range 0-1000, default is @code{1.0}.
  11089. @end table
  11090. @anchor{pad}
  11091. @section pad
  11092. Add paddings to the input image, and place the original input at the
  11093. provided @var{x}, @var{y} coordinates.
  11094. It accepts the following parameters:
  11095. @table @option
  11096. @item width, w
  11097. @item height, h
  11098. Specify an expression for the size of the output image with the
  11099. paddings added. If the value for @var{width} or @var{height} is 0, the
  11100. corresponding input size is used for the output.
  11101. The @var{width} expression can reference the value set by the
  11102. @var{height} expression, and vice versa.
  11103. The default value of @var{width} and @var{height} is 0.
  11104. @item x
  11105. @item y
  11106. Specify the offsets to place the input image at within the padded area,
  11107. with respect to the top/left border of the output image.
  11108. The @var{x} expression can reference the value set by the @var{y}
  11109. expression, and vice versa.
  11110. The default value of @var{x} and @var{y} is 0.
  11111. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  11112. so the input image is centered on the padded area.
  11113. @item color
  11114. Specify the color of the padded area. For the syntax of this option,
  11115. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11116. manual,ffmpeg-utils}.
  11117. The default value of @var{color} is "black".
  11118. @item eval
  11119. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  11120. It accepts the following values:
  11121. @table @samp
  11122. @item init
  11123. Only evaluate expressions once during the filter initialization or when
  11124. a command is processed.
  11125. @item frame
  11126. Evaluate expressions for each incoming frame.
  11127. @end table
  11128. Default value is @samp{init}.
  11129. @item aspect
  11130. Pad to aspect instead to a resolution.
  11131. @end table
  11132. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  11133. options are expressions containing the following constants:
  11134. @table @option
  11135. @item in_w
  11136. @item in_h
  11137. The input video width and height.
  11138. @item iw
  11139. @item ih
  11140. These are the same as @var{in_w} and @var{in_h}.
  11141. @item out_w
  11142. @item out_h
  11143. The output width and height (the size of the padded area), as
  11144. specified by the @var{width} and @var{height} expressions.
  11145. @item ow
  11146. @item oh
  11147. These are the same as @var{out_w} and @var{out_h}.
  11148. @item x
  11149. @item y
  11150. The x and y offsets as specified by the @var{x} and @var{y}
  11151. expressions, or NAN if not yet specified.
  11152. @item a
  11153. same as @var{iw} / @var{ih}
  11154. @item sar
  11155. input sample aspect ratio
  11156. @item dar
  11157. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  11158. @item hsub
  11159. @item vsub
  11160. The horizontal and vertical chroma subsample values. For example for the
  11161. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11162. @end table
  11163. @subsection Examples
  11164. @itemize
  11165. @item
  11166. Add paddings with the color "violet" to the input video. The output video
  11167. size is 640x480, and the top-left corner of the input video is placed at
  11168. column 0, row 40
  11169. @example
  11170. pad=640:480:0:40:violet
  11171. @end example
  11172. The example above is equivalent to the following command:
  11173. @example
  11174. pad=width=640:height=480:x=0:y=40:color=violet
  11175. @end example
  11176. @item
  11177. Pad the input to get an output with dimensions increased by 3/2,
  11178. and put the input video at the center of the padded area:
  11179. @example
  11180. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  11181. @end example
  11182. @item
  11183. Pad the input to get a squared output with size equal to the maximum
  11184. value between the input width and height, and put the input video at
  11185. the center of the padded area:
  11186. @example
  11187. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  11188. @end example
  11189. @item
  11190. Pad the input to get a final w/h ratio of 16:9:
  11191. @example
  11192. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  11193. @end example
  11194. @item
  11195. In case of anamorphic video, in order to set the output display aspect
  11196. correctly, it is necessary to use @var{sar} in the expression,
  11197. according to the relation:
  11198. @example
  11199. (ih * X / ih) * sar = output_dar
  11200. X = output_dar / sar
  11201. @end example
  11202. Thus the previous example needs to be modified to:
  11203. @example
  11204. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  11205. @end example
  11206. @item
  11207. Double the output size and put the input video in the bottom-right
  11208. corner of the output padded area:
  11209. @example
  11210. pad="2*iw:2*ih:ow-iw:oh-ih"
  11211. @end example
  11212. @end itemize
  11213. @anchor{palettegen}
  11214. @section palettegen
  11215. Generate one palette for a whole video stream.
  11216. It accepts the following options:
  11217. @table @option
  11218. @item max_colors
  11219. Set the maximum number of colors to quantize in the palette.
  11220. Note: the palette will still contain 256 colors; the unused palette entries
  11221. will be black.
  11222. @item reserve_transparent
  11223. Create a palette of 255 colors maximum and reserve the last one for
  11224. transparency. Reserving the transparency color is useful for GIF optimization.
  11225. If not set, the maximum of colors in the palette will be 256. You probably want
  11226. to disable this option for a standalone image.
  11227. Set by default.
  11228. @item transparency_color
  11229. Set the color that will be used as background for transparency.
  11230. @item stats_mode
  11231. Set statistics mode.
  11232. It accepts the following values:
  11233. @table @samp
  11234. @item full
  11235. Compute full frame histograms.
  11236. @item diff
  11237. Compute histograms only for the part that differs from previous frame. This
  11238. might be relevant to give more importance to the moving part of your input if
  11239. the background is static.
  11240. @item single
  11241. Compute new histogram for each frame.
  11242. @end table
  11243. Default value is @var{full}.
  11244. @end table
  11245. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  11246. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  11247. color quantization of the palette. This information is also visible at
  11248. @var{info} logging level.
  11249. @subsection Examples
  11250. @itemize
  11251. @item
  11252. Generate a representative palette of a given video using @command{ffmpeg}:
  11253. @example
  11254. ffmpeg -i input.mkv -vf palettegen palette.png
  11255. @end example
  11256. @end itemize
  11257. @section paletteuse
  11258. Use a palette to downsample an input video stream.
  11259. The filter takes two inputs: one video stream and a palette. The palette must
  11260. be a 256 pixels image.
  11261. It accepts the following options:
  11262. @table @option
  11263. @item dither
  11264. Select dithering mode. Available algorithms are:
  11265. @table @samp
  11266. @item bayer
  11267. Ordered 8x8 bayer dithering (deterministic)
  11268. @item heckbert
  11269. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  11270. Note: this dithering is sometimes considered "wrong" and is included as a
  11271. reference.
  11272. @item floyd_steinberg
  11273. Floyd and Steingberg dithering (error diffusion)
  11274. @item sierra2
  11275. Frankie Sierra dithering v2 (error diffusion)
  11276. @item sierra2_4a
  11277. Frankie Sierra dithering v2 "Lite" (error diffusion)
  11278. @end table
  11279. Default is @var{sierra2_4a}.
  11280. @item bayer_scale
  11281. When @var{bayer} dithering is selected, this option defines the scale of the
  11282. pattern (how much the crosshatch pattern is visible). A low value means more
  11283. visible pattern for less banding, and higher value means less visible pattern
  11284. at the cost of more banding.
  11285. The option must be an integer value in the range [0,5]. Default is @var{2}.
  11286. @item diff_mode
  11287. If set, define the zone to process
  11288. @table @samp
  11289. @item rectangle
  11290. Only the changing rectangle will be reprocessed. This is similar to GIF
  11291. cropping/offsetting compression mechanism. This option can be useful for speed
  11292. if only a part of the image is changing, and has use cases such as limiting the
  11293. scope of the error diffusal @option{dither} to the rectangle that bounds the
  11294. moving scene (it leads to more deterministic output if the scene doesn't change
  11295. much, and as a result less moving noise and better GIF compression).
  11296. @end table
  11297. Default is @var{none}.
  11298. @item new
  11299. Take new palette for each output frame.
  11300. @item alpha_threshold
  11301. Sets the alpha threshold for transparency. Alpha values above this threshold
  11302. will be treated as completely opaque, and values below this threshold will be
  11303. treated as completely transparent.
  11304. The option must be an integer value in the range [0,255]. Default is @var{128}.
  11305. @end table
  11306. @subsection Examples
  11307. @itemize
  11308. @item
  11309. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  11310. using @command{ffmpeg}:
  11311. @example
  11312. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  11313. @end example
  11314. @end itemize
  11315. @section perspective
  11316. Correct perspective of video not recorded perpendicular to the screen.
  11317. A description of the accepted parameters follows.
  11318. @table @option
  11319. @item x0
  11320. @item y0
  11321. @item x1
  11322. @item y1
  11323. @item x2
  11324. @item y2
  11325. @item x3
  11326. @item y3
  11327. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  11328. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  11329. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  11330. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  11331. then the corners of the source will be sent to the specified coordinates.
  11332. The expressions can use the following variables:
  11333. @table @option
  11334. @item W
  11335. @item H
  11336. the width and height of video frame.
  11337. @item in
  11338. Input frame count.
  11339. @item on
  11340. Output frame count.
  11341. @end table
  11342. @item interpolation
  11343. Set interpolation for perspective correction.
  11344. It accepts the following values:
  11345. @table @samp
  11346. @item linear
  11347. @item cubic
  11348. @end table
  11349. Default value is @samp{linear}.
  11350. @item sense
  11351. Set interpretation of coordinate options.
  11352. It accepts the following values:
  11353. @table @samp
  11354. @item 0, source
  11355. Send point in the source specified by the given coordinates to
  11356. the corners of the destination.
  11357. @item 1, destination
  11358. Send the corners of the source to the point in the destination specified
  11359. by the given coordinates.
  11360. Default value is @samp{source}.
  11361. @end table
  11362. @item eval
  11363. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  11364. It accepts the following values:
  11365. @table @samp
  11366. @item init
  11367. only evaluate expressions once during the filter initialization or
  11368. when a command is processed
  11369. @item frame
  11370. evaluate expressions for each incoming frame
  11371. @end table
  11372. Default value is @samp{init}.
  11373. @end table
  11374. @section phase
  11375. Delay interlaced video by one field time so that the field order changes.
  11376. The intended use is to fix PAL movies that have been captured with the
  11377. opposite field order to the film-to-video transfer.
  11378. A description of the accepted parameters follows.
  11379. @table @option
  11380. @item mode
  11381. Set phase mode.
  11382. It accepts the following values:
  11383. @table @samp
  11384. @item t
  11385. Capture field order top-first, transfer bottom-first.
  11386. Filter will delay the bottom field.
  11387. @item b
  11388. Capture field order bottom-first, transfer top-first.
  11389. Filter will delay the top field.
  11390. @item p
  11391. Capture and transfer with the same field order. This mode only exists
  11392. for the documentation of the other options to refer to, but if you
  11393. actually select it, the filter will faithfully do nothing.
  11394. @item a
  11395. Capture field order determined automatically by field flags, transfer
  11396. opposite.
  11397. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  11398. basis using field flags. If no field information is available,
  11399. then this works just like @samp{u}.
  11400. @item u
  11401. Capture unknown or varying, transfer opposite.
  11402. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  11403. analyzing the images and selecting the alternative that produces best
  11404. match between the fields.
  11405. @item T
  11406. Capture top-first, transfer unknown or varying.
  11407. Filter selects among @samp{t} and @samp{p} using image analysis.
  11408. @item B
  11409. Capture bottom-first, transfer unknown or varying.
  11410. Filter selects among @samp{b} and @samp{p} using image analysis.
  11411. @item A
  11412. Capture determined by field flags, transfer unknown or varying.
  11413. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  11414. image analysis. If no field information is available, then this works just
  11415. like @samp{U}. This is the default mode.
  11416. @item U
  11417. Both capture and transfer unknown or varying.
  11418. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  11419. @end table
  11420. @end table
  11421. @section photosensitivity
  11422. Reduce various flashes in video, so to help users with epilepsy.
  11423. It accepts the following options:
  11424. @table @option
  11425. @item frames, f
  11426. Set how many frames to use when filtering. Default is 30.
  11427. @item threshold, t
  11428. Set detection threshold factor. Default is 1.
  11429. Lower is stricter.
  11430. @item skip
  11431. Set how many pixels to skip when sampling frames. Default is 1.
  11432. Allowed range is from 1 to 1024.
  11433. @item bypass
  11434. Leave frames unchanged. Default is disabled.
  11435. @end table
  11436. @section pixdesctest
  11437. Pixel format descriptor test filter, mainly useful for internal
  11438. testing. The output video should be equal to the input video.
  11439. For example:
  11440. @example
  11441. format=monow, pixdesctest
  11442. @end example
  11443. can be used to test the monowhite pixel format descriptor definition.
  11444. @section pixscope
  11445. Display sample values of color channels. Mainly useful for checking color
  11446. and levels. Minimum supported resolution is 640x480.
  11447. The filters accept the following options:
  11448. @table @option
  11449. @item x
  11450. Set scope X position, relative offset on X axis.
  11451. @item y
  11452. Set scope Y position, relative offset on Y axis.
  11453. @item w
  11454. Set scope width.
  11455. @item h
  11456. Set scope height.
  11457. @item o
  11458. Set window opacity. This window also holds statistics about pixel area.
  11459. @item wx
  11460. Set window X position, relative offset on X axis.
  11461. @item wy
  11462. Set window Y position, relative offset on Y axis.
  11463. @end table
  11464. @section pp
  11465. Enable the specified chain of postprocessing subfilters using libpostproc. This
  11466. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  11467. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  11468. Each subfilter and some options have a short and a long name that can be used
  11469. interchangeably, i.e. dr/dering are the same.
  11470. The filters accept the following options:
  11471. @table @option
  11472. @item subfilters
  11473. Set postprocessing subfilters string.
  11474. @end table
  11475. All subfilters share common options to determine their scope:
  11476. @table @option
  11477. @item a/autoq
  11478. Honor the quality commands for this subfilter.
  11479. @item c/chrom
  11480. Do chrominance filtering, too (default).
  11481. @item y/nochrom
  11482. Do luminance filtering only (no chrominance).
  11483. @item n/noluma
  11484. Do chrominance filtering only (no luminance).
  11485. @end table
  11486. These options can be appended after the subfilter name, separated by a '|'.
  11487. Available subfilters are:
  11488. @table @option
  11489. @item hb/hdeblock[|difference[|flatness]]
  11490. Horizontal deblocking filter
  11491. @table @option
  11492. @item difference
  11493. Difference factor where higher values mean more deblocking (default: @code{32}).
  11494. @item flatness
  11495. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11496. @end table
  11497. @item vb/vdeblock[|difference[|flatness]]
  11498. Vertical deblocking filter
  11499. @table @option
  11500. @item difference
  11501. Difference factor where higher values mean more deblocking (default: @code{32}).
  11502. @item flatness
  11503. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11504. @end table
  11505. @item ha/hadeblock[|difference[|flatness]]
  11506. Accurate horizontal deblocking filter
  11507. @table @option
  11508. @item difference
  11509. Difference factor where higher values mean more deblocking (default: @code{32}).
  11510. @item flatness
  11511. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11512. @end table
  11513. @item va/vadeblock[|difference[|flatness]]
  11514. Accurate vertical deblocking filter
  11515. @table @option
  11516. @item difference
  11517. Difference factor where higher values mean more deblocking (default: @code{32}).
  11518. @item flatness
  11519. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11520. @end table
  11521. @end table
  11522. The horizontal and vertical deblocking filters share the difference and
  11523. flatness values so you cannot set different horizontal and vertical
  11524. thresholds.
  11525. @table @option
  11526. @item h1/x1hdeblock
  11527. Experimental horizontal deblocking filter
  11528. @item v1/x1vdeblock
  11529. Experimental vertical deblocking filter
  11530. @item dr/dering
  11531. Deringing filter
  11532. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  11533. @table @option
  11534. @item threshold1
  11535. larger -> stronger filtering
  11536. @item threshold2
  11537. larger -> stronger filtering
  11538. @item threshold3
  11539. larger -> stronger filtering
  11540. @end table
  11541. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  11542. @table @option
  11543. @item f/fullyrange
  11544. Stretch luminance to @code{0-255}.
  11545. @end table
  11546. @item lb/linblenddeint
  11547. Linear blend deinterlacing filter that deinterlaces the given block by
  11548. filtering all lines with a @code{(1 2 1)} filter.
  11549. @item li/linipoldeint
  11550. Linear interpolating deinterlacing filter that deinterlaces the given block by
  11551. linearly interpolating every second line.
  11552. @item ci/cubicipoldeint
  11553. Cubic interpolating deinterlacing filter deinterlaces the given block by
  11554. cubically interpolating every second line.
  11555. @item md/mediandeint
  11556. Median deinterlacing filter that deinterlaces the given block by applying a
  11557. median filter to every second line.
  11558. @item fd/ffmpegdeint
  11559. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  11560. second line with a @code{(-1 4 2 4 -1)} filter.
  11561. @item l5/lowpass5
  11562. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  11563. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  11564. @item fq/forceQuant[|quantizer]
  11565. Overrides the quantizer table from the input with the constant quantizer you
  11566. specify.
  11567. @table @option
  11568. @item quantizer
  11569. Quantizer to use
  11570. @end table
  11571. @item de/default
  11572. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  11573. @item fa/fast
  11574. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  11575. @item ac
  11576. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  11577. @end table
  11578. @subsection Examples
  11579. @itemize
  11580. @item
  11581. Apply horizontal and vertical deblocking, deringing and automatic
  11582. brightness/contrast:
  11583. @example
  11584. pp=hb/vb/dr/al
  11585. @end example
  11586. @item
  11587. Apply default filters without brightness/contrast correction:
  11588. @example
  11589. pp=de/-al
  11590. @end example
  11591. @item
  11592. Apply default filters and temporal denoiser:
  11593. @example
  11594. pp=default/tmpnoise|1|2|3
  11595. @end example
  11596. @item
  11597. Apply deblocking on luminance only, and switch vertical deblocking on or off
  11598. automatically depending on available CPU time:
  11599. @example
  11600. pp=hb|y/vb|a
  11601. @end example
  11602. @end itemize
  11603. @section pp7
  11604. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  11605. similar to spp = 6 with 7 point DCT, where only the center sample is
  11606. used after IDCT.
  11607. The filter accepts the following options:
  11608. @table @option
  11609. @item qp
  11610. Force a constant quantization parameter. It accepts an integer in range
  11611. 0 to 63. If not set, the filter will use the QP from the video stream
  11612. (if available).
  11613. @item mode
  11614. Set thresholding mode. Available modes are:
  11615. @table @samp
  11616. @item hard
  11617. Set hard thresholding.
  11618. @item soft
  11619. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11620. @item medium
  11621. Set medium thresholding (good results, default).
  11622. @end table
  11623. @end table
  11624. @section premultiply
  11625. Apply alpha premultiply effect to input video stream using first plane
  11626. of second stream as alpha.
  11627. Both streams must have same dimensions and same pixel format.
  11628. The filter accepts the following option:
  11629. @table @option
  11630. @item planes
  11631. Set which planes will be processed, unprocessed planes will be copied.
  11632. By default value 0xf, all planes will be processed.
  11633. @item inplace
  11634. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11635. @end table
  11636. @section prewitt
  11637. Apply prewitt operator to input video stream.
  11638. The filter accepts the following option:
  11639. @table @option
  11640. @item planes
  11641. Set which planes will be processed, unprocessed planes will be copied.
  11642. By default value 0xf, all planes will be processed.
  11643. @item scale
  11644. Set value which will be multiplied with filtered result.
  11645. @item delta
  11646. Set value which will be added to filtered result.
  11647. @end table
  11648. @section pseudocolor
  11649. Alter frame colors in video with pseudocolors.
  11650. This filter accepts the following options:
  11651. @table @option
  11652. @item c0
  11653. set pixel first component expression
  11654. @item c1
  11655. set pixel second component expression
  11656. @item c2
  11657. set pixel third component expression
  11658. @item c3
  11659. set pixel fourth component expression, corresponds to the alpha component
  11660. @item i
  11661. set component to use as base for altering colors
  11662. @end table
  11663. Each of them specifies the expression to use for computing the lookup table for
  11664. the corresponding pixel component values.
  11665. The expressions can contain the following constants and functions:
  11666. @table @option
  11667. @item w
  11668. @item h
  11669. The input width and height.
  11670. @item val
  11671. The input value for the pixel component.
  11672. @item ymin, umin, vmin, amin
  11673. The minimum allowed component value.
  11674. @item ymax, umax, vmax, amax
  11675. The maximum allowed component value.
  11676. @end table
  11677. All expressions default to "val".
  11678. @subsection Examples
  11679. @itemize
  11680. @item
  11681. Change too high luma values to gradient:
  11682. @example
  11683. 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'"
  11684. @end example
  11685. @end itemize
  11686. @section psnr
  11687. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  11688. Ratio) between two input videos.
  11689. This filter takes in input two input videos, the first input is
  11690. considered the "main" source and is passed unchanged to the
  11691. output. The second input is used as a "reference" video for computing
  11692. the PSNR.
  11693. Both video inputs must have the same resolution and pixel format for
  11694. this filter to work correctly. Also it assumes that both inputs
  11695. have the same number of frames, which are compared one by one.
  11696. The obtained average PSNR is printed through the logging system.
  11697. The filter stores the accumulated MSE (mean squared error) of each
  11698. frame, and at the end of the processing it is averaged across all frames
  11699. equally, and the following formula is applied to obtain the PSNR:
  11700. @example
  11701. PSNR = 10*log10(MAX^2/MSE)
  11702. @end example
  11703. Where MAX is the average of the maximum values of each component of the
  11704. image.
  11705. The description of the accepted parameters follows.
  11706. @table @option
  11707. @item stats_file, f
  11708. If specified the filter will use the named file to save the PSNR of
  11709. each individual frame. When filename equals "-" the data is sent to
  11710. standard output.
  11711. @item stats_version
  11712. Specifies which version of the stats file format to use. Details of
  11713. each format are written below.
  11714. Default value is 1.
  11715. @item stats_add_max
  11716. Determines whether the max value is output to the stats log.
  11717. Default value is 0.
  11718. Requires stats_version >= 2. If this is set and stats_version < 2,
  11719. the filter will return an error.
  11720. @end table
  11721. This filter also supports the @ref{framesync} options.
  11722. The file printed if @var{stats_file} is selected, contains a sequence of
  11723. key/value pairs of the form @var{key}:@var{value} for each compared
  11724. couple of frames.
  11725. If a @var{stats_version} greater than 1 is specified, a header line precedes
  11726. the list of per-frame-pair stats, with key value pairs following the frame
  11727. format with the following parameters:
  11728. @table @option
  11729. @item psnr_log_version
  11730. The version of the log file format. Will match @var{stats_version}.
  11731. @item fields
  11732. A comma separated list of the per-frame-pair parameters included in
  11733. the log.
  11734. @end table
  11735. A description of each shown per-frame-pair parameter follows:
  11736. @table @option
  11737. @item n
  11738. sequential number of the input frame, starting from 1
  11739. @item mse_avg
  11740. Mean Square Error pixel-by-pixel average difference of the compared
  11741. frames, averaged over all the image components.
  11742. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  11743. Mean Square Error pixel-by-pixel average difference of the compared
  11744. frames for the component specified by the suffix.
  11745. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  11746. Peak Signal to Noise ratio of the compared frames for the component
  11747. specified by the suffix.
  11748. @item max_avg, max_y, max_u, max_v
  11749. Maximum allowed value for each channel, and average over all
  11750. channels.
  11751. @end table
  11752. @subsection Examples
  11753. @itemize
  11754. @item
  11755. For example:
  11756. @example
  11757. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11758. [main][ref] psnr="stats_file=stats.log" [out]
  11759. @end example
  11760. On this example the input file being processed is compared with the
  11761. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  11762. is stored in @file{stats.log}.
  11763. @item
  11764. Another example with different containers:
  11765. @example
  11766. ffmpeg -i main.mpg -i ref.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[main][ref]psnr" -f null -
  11767. @end example
  11768. @end itemize
  11769. @anchor{pullup}
  11770. @section pullup
  11771. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  11772. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  11773. content.
  11774. The pullup filter is designed to take advantage of future context in making
  11775. its decisions. This filter is stateless in the sense that it does not lock
  11776. onto a pattern to follow, but it instead looks forward to the following
  11777. fields in order to identify matches and rebuild progressive frames.
  11778. To produce content with an even framerate, insert the fps filter after
  11779. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  11780. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  11781. The filter accepts the following options:
  11782. @table @option
  11783. @item jl
  11784. @item jr
  11785. @item jt
  11786. @item jb
  11787. These options set the amount of "junk" to ignore at the left, right, top, and
  11788. bottom of the image, respectively. Left and right are in units of 8 pixels,
  11789. while top and bottom are in units of 2 lines.
  11790. The default is 8 pixels on each side.
  11791. @item sb
  11792. Set the strict breaks. Setting this option to 1 will reduce the chances of
  11793. filter generating an occasional mismatched frame, but it may also cause an
  11794. excessive number of frames to be dropped during high motion sequences.
  11795. Conversely, setting it to -1 will make filter match fields more easily.
  11796. This may help processing of video where there is slight blurring between
  11797. the fields, but may also cause there to be interlaced frames in the output.
  11798. Default value is @code{0}.
  11799. @item mp
  11800. Set the metric plane to use. It accepts the following values:
  11801. @table @samp
  11802. @item l
  11803. Use luma plane.
  11804. @item u
  11805. Use chroma blue plane.
  11806. @item v
  11807. Use chroma red plane.
  11808. @end table
  11809. This option may be set to use chroma plane instead of the default luma plane
  11810. for doing filter's computations. This may improve accuracy on very clean
  11811. source material, but more likely will decrease accuracy, especially if there
  11812. is chroma noise (rainbow effect) or any grayscale video.
  11813. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  11814. load and make pullup usable in realtime on slow machines.
  11815. @end table
  11816. For best results (without duplicated frames in the output file) it is
  11817. necessary to change the output frame rate. For example, to inverse
  11818. telecine NTSC input:
  11819. @example
  11820. ffmpeg -i input -vf pullup -r 24000/1001 ...
  11821. @end example
  11822. @section qp
  11823. Change video quantization parameters (QP).
  11824. The filter accepts the following option:
  11825. @table @option
  11826. @item qp
  11827. Set expression for quantization parameter.
  11828. @end table
  11829. The expression is evaluated through the eval API and can contain, among others,
  11830. the following constants:
  11831. @table @var
  11832. @item known
  11833. 1 if index is not 129, 0 otherwise.
  11834. @item qp
  11835. Sequential index starting from -129 to 128.
  11836. @end table
  11837. @subsection Examples
  11838. @itemize
  11839. @item
  11840. Some equation like:
  11841. @example
  11842. qp=2+2*sin(PI*qp)
  11843. @end example
  11844. @end itemize
  11845. @section random
  11846. Flush video frames from internal cache of frames into a random order.
  11847. No frame is discarded.
  11848. Inspired by @ref{frei0r} nervous filter.
  11849. @table @option
  11850. @item frames
  11851. Set size in number of frames of internal cache, in range from @code{2} to
  11852. @code{512}. Default is @code{30}.
  11853. @item seed
  11854. Set seed for random number generator, must be an integer included between
  11855. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11856. less than @code{0}, the filter will try to use a good random seed on a
  11857. best effort basis.
  11858. @end table
  11859. @section readeia608
  11860. Read closed captioning (EIA-608) information from the top lines of a video frame.
  11861. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  11862. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  11863. with EIA-608 data (starting from 0). A description of each metadata value follows:
  11864. @table @option
  11865. @item lavfi.readeia608.X.cc
  11866. The two bytes stored as EIA-608 data (printed in hexadecimal).
  11867. @item lavfi.readeia608.X.line
  11868. The number of the line on which the EIA-608 data was identified and read.
  11869. @end table
  11870. This filter accepts the following options:
  11871. @table @option
  11872. @item scan_min
  11873. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  11874. @item scan_max
  11875. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  11876. @item spw
  11877. Set the ratio of width reserved for sync code detection.
  11878. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  11879. @item chp
  11880. Enable checking the parity bit. In the event of a parity error, the filter will output
  11881. @code{0x00} for that character. Default is false.
  11882. @item lp
  11883. Lowpass lines prior to further processing. Default is enabled.
  11884. @end table
  11885. @subsection Examples
  11886. @itemize
  11887. @item
  11888. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  11889. @example
  11890. 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
  11891. @end example
  11892. @end itemize
  11893. @section readvitc
  11894. Read vertical interval timecode (VITC) information from the top lines of a
  11895. video frame.
  11896. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  11897. timecode value, if a valid timecode has been detected. Further metadata key
  11898. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  11899. timecode data has been found or not.
  11900. This filter accepts the following options:
  11901. @table @option
  11902. @item scan_max
  11903. Set the maximum number of lines to scan for VITC data. If the value is set to
  11904. @code{-1} the full video frame is scanned. Default is @code{45}.
  11905. @item thr_b
  11906. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  11907. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  11908. @item thr_w
  11909. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  11910. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  11911. @end table
  11912. @subsection Examples
  11913. @itemize
  11914. @item
  11915. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  11916. draw @code{--:--:--:--} as a placeholder:
  11917. @example
  11918. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  11919. @end example
  11920. @end itemize
  11921. @section remap
  11922. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  11923. Destination pixel at position (X, Y) will be picked from source (x, y) position
  11924. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  11925. value for pixel will be used for destination pixel.
  11926. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  11927. will have Xmap/Ymap video stream dimensions.
  11928. Xmap and Ymap input video streams are 16bit depth, single channel.
  11929. @table @option
  11930. @item format
  11931. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  11932. Default is @code{color}.
  11933. @item fill
  11934. Specify the color of the unmapped pixels. For the syntax of this option,
  11935. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11936. manual,ffmpeg-utils}. Default color is @code{black}.
  11937. @end table
  11938. @section removegrain
  11939. The removegrain filter is a spatial denoiser for progressive video.
  11940. @table @option
  11941. @item m0
  11942. Set mode for the first plane.
  11943. @item m1
  11944. Set mode for the second plane.
  11945. @item m2
  11946. Set mode for the third plane.
  11947. @item m3
  11948. Set mode for the fourth plane.
  11949. @end table
  11950. Range of mode is from 0 to 24. Description of each mode follows:
  11951. @table @var
  11952. @item 0
  11953. Leave input plane unchanged. Default.
  11954. @item 1
  11955. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  11956. @item 2
  11957. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  11958. @item 3
  11959. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  11960. @item 4
  11961. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  11962. This is equivalent to a median filter.
  11963. @item 5
  11964. Line-sensitive clipping giving the minimal change.
  11965. @item 6
  11966. Line-sensitive clipping, intermediate.
  11967. @item 7
  11968. Line-sensitive clipping, intermediate.
  11969. @item 8
  11970. Line-sensitive clipping, intermediate.
  11971. @item 9
  11972. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  11973. @item 10
  11974. Replaces the target pixel with the closest neighbour.
  11975. @item 11
  11976. [1 2 1] horizontal and vertical kernel blur.
  11977. @item 12
  11978. Same as mode 11.
  11979. @item 13
  11980. Bob mode, interpolates top field from the line where the neighbours
  11981. pixels are the closest.
  11982. @item 14
  11983. Bob mode, interpolates bottom field from the line where the neighbours
  11984. pixels are the closest.
  11985. @item 15
  11986. Bob mode, interpolates top field. Same as 13 but with a more complicated
  11987. interpolation formula.
  11988. @item 16
  11989. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  11990. interpolation formula.
  11991. @item 17
  11992. Clips the pixel with the minimum and maximum of respectively the maximum and
  11993. minimum of each pair of opposite neighbour pixels.
  11994. @item 18
  11995. Line-sensitive clipping using opposite neighbours whose greatest distance from
  11996. the current pixel is minimal.
  11997. @item 19
  11998. Replaces the pixel with the average of its 8 neighbours.
  11999. @item 20
  12000. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  12001. @item 21
  12002. Clips pixels using the averages of opposite neighbour.
  12003. @item 22
  12004. Same as mode 21 but simpler and faster.
  12005. @item 23
  12006. Small edge and halo removal, but reputed useless.
  12007. @item 24
  12008. Similar as 23.
  12009. @end table
  12010. @section removelogo
  12011. Suppress a TV station logo, using an image file to determine which
  12012. pixels comprise the logo. It works by filling in the pixels that
  12013. comprise the logo with neighboring pixels.
  12014. The filter accepts the following options:
  12015. @table @option
  12016. @item filename, f
  12017. Set the filter bitmap file, which can be any image format supported by
  12018. libavformat. The width and height of the image file must match those of the
  12019. video stream being processed.
  12020. @end table
  12021. Pixels in the provided bitmap image with a value of zero are not
  12022. considered part of the logo, non-zero pixels are considered part of
  12023. the logo. If you use white (255) for the logo and black (0) for the
  12024. rest, you will be safe. For making the filter bitmap, it is
  12025. recommended to take a screen capture of a black frame with the logo
  12026. visible, and then using a threshold filter followed by the erode
  12027. filter once or twice.
  12028. If needed, little splotches can be fixed manually. Remember that if
  12029. logo pixels are not covered, the filter quality will be much
  12030. reduced. Marking too many pixels as part of the logo does not hurt as
  12031. much, but it will increase the amount of blurring needed to cover over
  12032. the image and will destroy more information than necessary, and extra
  12033. pixels will slow things down on a large logo.
  12034. @section repeatfields
  12035. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  12036. fields based on its value.
  12037. @section reverse
  12038. Reverse a video clip.
  12039. Warning: This filter requires memory to buffer the entire clip, so trimming
  12040. is suggested.
  12041. @subsection Examples
  12042. @itemize
  12043. @item
  12044. Take the first 5 seconds of a clip, and reverse it.
  12045. @example
  12046. trim=end=5,reverse
  12047. @end example
  12048. @end itemize
  12049. @section rgbashift
  12050. Shift R/G/B/A pixels horizontally and/or vertically.
  12051. The filter accepts the following options:
  12052. @table @option
  12053. @item rh
  12054. Set amount to shift red horizontally.
  12055. @item rv
  12056. Set amount to shift red vertically.
  12057. @item gh
  12058. Set amount to shift green horizontally.
  12059. @item gv
  12060. Set amount to shift green vertically.
  12061. @item bh
  12062. Set amount to shift blue horizontally.
  12063. @item bv
  12064. Set amount to shift blue vertically.
  12065. @item ah
  12066. Set amount to shift alpha horizontally.
  12067. @item av
  12068. Set amount to shift alpha vertically.
  12069. @item edge
  12070. Set edge mode, can be @var{smear}, default, or @var{warp}.
  12071. @end table
  12072. @subsection Commands
  12073. This filter supports the all above options as @ref{commands}.
  12074. @section roberts
  12075. Apply roberts cross operator to input video stream.
  12076. The filter accepts the following option:
  12077. @table @option
  12078. @item planes
  12079. Set which planes will be processed, unprocessed planes will be copied.
  12080. By default value 0xf, all planes will be processed.
  12081. @item scale
  12082. Set value which will be multiplied with filtered result.
  12083. @item delta
  12084. Set value which will be added to filtered result.
  12085. @end table
  12086. @section rotate
  12087. Rotate video by an arbitrary angle expressed in radians.
  12088. The filter accepts the following options:
  12089. A description of the optional parameters follows.
  12090. @table @option
  12091. @item angle, a
  12092. Set an expression for the angle by which to rotate the input video
  12093. clockwise, expressed as a number of radians. A negative value will
  12094. result in a counter-clockwise rotation. By default it is set to "0".
  12095. This expression is evaluated for each frame.
  12096. @item out_w, ow
  12097. Set the output width expression, default value is "iw".
  12098. This expression is evaluated just once during configuration.
  12099. @item out_h, oh
  12100. Set the output height expression, default value is "ih".
  12101. This expression is evaluated just once during configuration.
  12102. @item bilinear
  12103. Enable bilinear interpolation if set to 1, a value of 0 disables
  12104. it. Default value is 1.
  12105. @item fillcolor, c
  12106. Set the color used to fill the output area not covered by the rotated
  12107. image. For the general syntax of this option, check the
  12108. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12109. If the special value "none" is selected then no
  12110. background is printed (useful for example if the background is never shown).
  12111. Default value is "black".
  12112. @end table
  12113. The expressions for the angle and the output size can contain the
  12114. following constants and functions:
  12115. @table @option
  12116. @item n
  12117. sequential number of the input frame, starting from 0. It is always NAN
  12118. before the first frame is filtered.
  12119. @item t
  12120. time in seconds of the input frame, it is set to 0 when the filter is
  12121. configured. It is always NAN before the first frame is filtered.
  12122. @item hsub
  12123. @item vsub
  12124. horizontal and vertical chroma subsample values. For example for the
  12125. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12126. @item in_w, iw
  12127. @item in_h, ih
  12128. the input video width and height
  12129. @item out_w, ow
  12130. @item out_h, oh
  12131. the output width and height, that is the size of the padded area as
  12132. specified by the @var{width} and @var{height} expressions
  12133. @item rotw(a)
  12134. @item roth(a)
  12135. the minimal width/height required for completely containing the input
  12136. video rotated by @var{a} radians.
  12137. These are only available when computing the @option{out_w} and
  12138. @option{out_h} expressions.
  12139. @end table
  12140. @subsection Examples
  12141. @itemize
  12142. @item
  12143. Rotate the input by PI/6 radians clockwise:
  12144. @example
  12145. rotate=PI/6
  12146. @end example
  12147. @item
  12148. Rotate the input by PI/6 radians counter-clockwise:
  12149. @example
  12150. rotate=-PI/6
  12151. @end example
  12152. @item
  12153. Rotate the input by 45 degrees clockwise:
  12154. @example
  12155. rotate=45*PI/180
  12156. @end example
  12157. @item
  12158. Apply a constant rotation with period T, starting from an angle of PI/3:
  12159. @example
  12160. rotate=PI/3+2*PI*t/T
  12161. @end example
  12162. @item
  12163. Make the input video rotation oscillating with a period of T
  12164. seconds and an amplitude of A radians:
  12165. @example
  12166. rotate=A*sin(2*PI/T*t)
  12167. @end example
  12168. @item
  12169. Rotate the video, output size is chosen so that the whole rotating
  12170. input video is always completely contained in the output:
  12171. @example
  12172. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  12173. @end example
  12174. @item
  12175. Rotate the video, reduce the output size so that no background is ever
  12176. shown:
  12177. @example
  12178. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  12179. @end example
  12180. @end itemize
  12181. @subsection Commands
  12182. The filter supports the following commands:
  12183. @table @option
  12184. @item a, angle
  12185. Set the angle expression.
  12186. The command accepts the same syntax of the corresponding option.
  12187. If the specified expression is not valid, it is kept at its current
  12188. value.
  12189. @end table
  12190. @section sab
  12191. Apply Shape Adaptive Blur.
  12192. The filter accepts the following options:
  12193. @table @option
  12194. @item luma_radius, lr
  12195. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  12196. value is 1.0. A greater value will result in a more blurred image, and
  12197. in slower processing.
  12198. @item luma_pre_filter_radius, lpfr
  12199. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  12200. value is 1.0.
  12201. @item luma_strength, ls
  12202. Set luma maximum difference between pixels to still be considered, must
  12203. be a value in the 0.1-100.0 range, default value is 1.0.
  12204. @item chroma_radius, cr
  12205. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  12206. greater value will result in a more blurred image, and in slower
  12207. processing.
  12208. @item chroma_pre_filter_radius, cpfr
  12209. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  12210. @item chroma_strength, cs
  12211. Set chroma maximum difference between pixels to still be considered,
  12212. must be a value in the -0.9-100.0 range.
  12213. @end table
  12214. Each chroma option value, if not explicitly specified, is set to the
  12215. corresponding luma option value.
  12216. @anchor{scale}
  12217. @section scale
  12218. Scale (resize) the input video, using the libswscale library.
  12219. The scale filter forces the output display aspect ratio to be the same
  12220. of the input, by changing the output sample aspect ratio.
  12221. If the input image format is different from the format requested by
  12222. the next filter, the scale filter will convert the input to the
  12223. requested format.
  12224. @subsection Options
  12225. The filter accepts the following options, or any of the options
  12226. supported by the libswscale scaler.
  12227. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  12228. the complete list of scaler options.
  12229. @table @option
  12230. @item width, w
  12231. @item height, h
  12232. Set the output video dimension expression. Default value is the input
  12233. dimension.
  12234. If the @var{width} or @var{w} value is 0, the input width is used for
  12235. the output. If the @var{height} or @var{h} value is 0, the input height
  12236. is used for the output.
  12237. If one and only one of the values is -n with n >= 1, the scale filter
  12238. will use a value that maintains the aspect ratio of the input image,
  12239. calculated from the other specified dimension. After that it will,
  12240. however, make sure that the calculated dimension is divisible by n and
  12241. adjust the value if necessary.
  12242. If both values are -n with n >= 1, the behavior will be identical to
  12243. both values being set to 0 as previously detailed.
  12244. See below for the list of accepted constants for use in the dimension
  12245. expression.
  12246. @item eval
  12247. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  12248. @table @samp
  12249. @item init
  12250. Only evaluate expressions once during the filter initialization or when a command is processed.
  12251. @item frame
  12252. Evaluate expressions for each incoming frame.
  12253. @end table
  12254. Default value is @samp{init}.
  12255. @item interl
  12256. Set the interlacing mode. It accepts the following values:
  12257. @table @samp
  12258. @item 1
  12259. Force interlaced aware scaling.
  12260. @item 0
  12261. Do not apply interlaced scaling.
  12262. @item -1
  12263. Select interlaced aware scaling depending on whether the source frames
  12264. are flagged as interlaced or not.
  12265. @end table
  12266. Default value is @samp{0}.
  12267. @item flags
  12268. Set libswscale scaling flags. See
  12269. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12270. complete list of values. If not explicitly specified the filter applies
  12271. the default flags.
  12272. @item param0, param1
  12273. Set libswscale input parameters for scaling algorithms that need them. See
  12274. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12275. complete documentation. If not explicitly specified the filter applies
  12276. empty parameters.
  12277. @item size, s
  12278. Set the video size. For the syntax of this option, check the
  12279. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12280. @item in_color_matrix
  12281. @item out_color_matrix
  12282. Set in/output YCbCr color space type.
  12283. This allows the autodetected value to be overridden as well as allows forcing
  12284. a specific value used for the output and encoder.
  12285. If not specified, the color space type depends on the pixel format.
  12286. Possible values:
  12287. @table @samp
  12288. @item auto
  12289. Choose automatically.
  12290. @item bt709
  12291. Format conforming to International Telecommunication Union (ITU)
  12292. Recommendation BT.709.
  12293. @item fcc
  12294. Set color space conforming to the United States Federal Communications
  12295. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  12296. @item bt601
  12297. @item bt470
  12298. @item smpte170m
  12299. Set color space conforming to:
  12300. @itemize
  12301. @item
  12302. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  12303. @item
  12304. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  12305. @item
  12306. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  12307. @end itemize
  12308. @item smpte240m
  12309. Set color space conforming to SMPTE ST 240:1999.
  12310. @item bt2020
  12311. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  12312. @end table
  12313. @item in_range
  12314. @item out_range
  12315. Set in/output YCbCr sample range.
  12316. This allows the autodetected value to be overridden as well as allows forcing
  12317. a specific value used for the output and encoder. If not specified, the
  12318. range depends on the pixel format. Possible values:
  12319. @table @samp
  12320. @item auto/unknown
  12321. Choose automatically.
  12322. @item jpeg/full/pc
  12323. Set full range (0-255 in case of 8-bit luma).
  12324. @item mpeg/limited/tv
  12325. Set "MPEG" range (16-235 in case of 8-bit luma).
  12326. @end table
  12327. @item force_original_aspect_ratio
  12328. Enable decreasing or increasing output video width or height if necessary to
  12329. keep the original aspect ratio. Possible values:
  12330. @table @samp
  12331. @item disable
  12332. Scale the video as specified and disable this feature.
  12333. @item decrease
  12334. The output video dimensions will automatically be decreased if needed.
  12335. @item increase
  12336. The output video dimensions will automatically be increased if needed.
  12337. @end table
  12338. One useful instance of this option is that when you know a specific device's
  12339. maximum allowed resolution, you can use this to limit the output video to
  12340. that, while retaining the aspect ratio. For example, device A allows
  12341. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12342. decrease) and specifying 1280x720 to the command line makes the output
  12343. 1280x533.
  12344. Please note that this is a different thing than specifying -1 for @option{w}
  12345. or @option{h}, you still need to specify the output resolution for this option
  12346. to work.
  12347. @item force_divisible_by
  12348. Ensures that both the output dimensions, width and height, are divisible by the
  12349. given integer when used together with @option{force_original_aspect_ratio}. This
  12350. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12351. This option respects the value set for @option{force_original_aspect_ratio},
  12352. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12353. may be slightly modified.
  12354. This option can be handy if you need to have a video fit within or exceed
  12355. a defined resolution using @option{force_original_aspect_ratio} but also have
  12356. encoder restrictions on width or height divisibility.
  12357. @end table
  12358. The values of the @option{w} and @option{h} options are expressions
  12359. containing the following constants:
  12360. @table @var
  12361. @item in_w
  12362. @item in_h
  12363. The input width and height
  12364. @item iw
  12365. @item ih
  12366. These are the same as @var{in_w} and @var{in_h}.
  12367. @item out_w
  12368. @item out_h
  12369. The output (scaled) width and height
  12370. @item ow
  12371. @item oh
  12372. These are the same as @var{out_w} and @var{out_h}
  12373. @item a
  12374. The same as @var{iw} / @var{ih}
  12375. @item sar
  12376. input sample aspect ratio
  12377. @item dar
  12378. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12379. @item hsub
  12380. @item vsub
  12381. horizontal and vertical input chroma subsample values. For example for the
  12382. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12383. @item ohsub
  12384. @item ovsub
  12385. horizontal and vertical output chroma subsample values. For example for the
  12386. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12387. @item n
  12388. The (sequential) number of the input frame, starting from 0.
  12389. Only available with @code{eval=frame}.
  12390. @item t
  12391. The presentation timestamp of the input frame, expressed as a number of
  12392. seconds. Only available with @code{eval=frame}.
  12393. @item pos
  12394. The position (byte offset) of the frame in the input stream, or NaN if
  12395. this information is unavailable and/or meaningless (for example in case of synthetic video).
  12396. Only available with @code{eval=frame}.
  12397. @end table
  12398. @subsection Examples
  12399. @itemize
  12400. @item
  12401. Scale the input video to a size of 200x100
  12402. @example
  12403. scale=w=200:h=100
  12404. @end example
  12405. This is equivalent to:
  12406. @example
  12407. scale=200:100
  12408. @end example
  12409. or:
  12410. @example
  12411. scale=200x100
  12412. @end example
  12413. @item
  12414. Specify a size abbreviation for the output size:
  12415. @example
  12416. scale=qcif
  12417. @end example
  12418. which can also be written as:
  12419. @example
  12420. scale=size=qcif
  12421. @end example
  12422. @item
  12423. Scale the input to 2x:
  12424. @example
  12425. scale=w=2*iw:h=2*ih
  12426. @end example
  12427. @item
  12428. The above is the same as:
  12429. @example
  12430. scale=2*in_w:2*in_h
  12431. @end example
  12432. @item
  12433. Scale the input to 2x with forced interlaced scaling:
  12434. @example
  12435. scale=2*iw:2*ih:interl=1
  12436. @end example
  12437. @item
  12438. Scale the input to half size:
  12439. @example
  12440. scale=w=iw/2:h=ih/2
  12441. @end example
  12442. @item
  12443. Increase the width, and set the height to the same size:
  12444. @example
  12445. scale=3/2*iw:ow
  12446. @end example
  12447. @item
  12448. Seek Greek harmony:
  12449. @example
  12450. scale=iw:1/PHI*iw
  12451. scale=ih*PHI:ih
  12452. @end example
  12453. @item
  12454. Increase the height, and set the width to 3/2 of the height:
  12455. @example
  12456. scale=w=3/2*oh:h=3/5*ih
  12457. @end example
  12458. @item
  12459. Increase the size, making the size a multiple of the chroma
  12460. subsample values:
  12461. @example
  12462. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  12463. @end example
  12464. @item
  12465. Increase the width to a maximum of 500 pixels,
  12466. keeping the same aspect ratio as the input:
  12467. @example
  12468. scale=w='min(500\, iw*3/2):h=-1'
  12469. @end example
  12470. @item
  12471. Make pixels square by combining scale and setsar:
  12472. @example
  12473. scale='trunc(ih*dar):ih',setsar=1/1
  12474. @end example
  12475. @item
  12476. Make pixels square by combining scale and setsar,
  12477. making sure the resulting resolution is even (required by some codecs):
  12478. @example
  12479. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  12480. @end example
  12481. @end itemize
  12482. @subsection Commands
  12483. This filter supports the following commands:
  12484. @table @option
  12485. @item width, w
  12486. @item height, h
  12487. Set the output video dimension expression.
  12488. The command accepts the same syntax of the corresponding option.
  12489. If the specified expression is not valid, it is kept at its current
  12490. value.
  12491. @end table
  12492. @section scale_npp
  12493. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  12494. format conversion on CUDA video frames. Setting the output width and height
  12495. works in the same way as for the @var{scale} filter.
  12496. The following additional options are accepted:
  12497. @table @option
  12498. @item format
  12499. The pixel format of the output CUDA frames. If set to the string "same" (the
  12500. default), the input format will be kept. Note that automatic format negotiation
  12501. and conversion is not yet supported for hardware frames
  12502. @item interp_algo
  12503. The interpolation algorithm used for resizing. One of the following:
  12504. @table @option
  12505. @item nn
  12506. Nearest neighbour.
  12507. @item linear
  12508. @item cubic
  12509. @item cubic2p_bspline
  12510. 2-parameter cubic (B=1, C=0)
  12511. @item cubic2p_catmullrom
  12512. 2-parameter cubic (B=0, C=1/2)
  12513. @item cubic2p_b05c03
  12514. 2-parameter cubic (B=1/2, C=3/10)
  12515. @item super
  12516. Supersampling
  12517. @item lanczos
  12518. @end table
  12519. @item force_original_aspect_ratio
  12520. Enable decreasing or increasing output video width or height if necessary to
  12521. keep the original aspect ratio. Possible values:
  12522. @table @samp
  12523. @item disable
  12524. Scale the video as specified and disable this feature.
  12525. @item decrease
  12526. The output video dimensions will automatically be decreased if needed.
  12527. @item increase
  12528. The output video dimensions will automatically be increased if needed.
  12529. @end table
  12530. One useful instance of this option is that when you know a specific device's
  12531. maximum allowed resolution, you can use this to limit the output video to
  12532. that, while retaining the aspect ratio. For example, device A allows
  12533. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12534. decrease) and specifying 1280x720 to the command line makes the output
  12535. 1280x533.
  12536. Please note that this is a different thing than specifying -1 for @option{w}
  12537. or @option{h}, you still need to specify the output resolution for this option
  12538. to work.
  12539. @item force_divisible_by
  12540. Ensures that both the output dimensions, width and height, are divisible by the
  12541. given integer when used together with @option{force_original_aspect_ratio}. This
  12542. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12543. This option respects the value set for @option{force_original_aspect_ratio},
  12544. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12545. may be slightly modified.
  12546. This option can be handy if you need to have a video fit within or exceed
  12547. a defined resolution using @option{force_original_aspect_ratio} but also have
  12548. encoder restrictions on width or height divisibility.
  12549. @end table
  12550. @section scale2ref
  12551. Scale (resize) the input video, based on a reference video.
  12552. See the scale filter for available options, scale2ref supports the same but
  12553. uses the reference video instead of the main input as basis. scale2ref also
  12554. supports the following additional constants for the @option{w} and
  12555. @option{h} options:
  12556. @table @var
  12557. @item main_w
  12558. @item main_h
  12559. The main input video's width and height
  12560. @item main_a
  12561. The same as @var{main_w} / @var{main_h}
  12562. @item main_sar
  12563. The main input video's sample aspect ratio
  12564. @item main_dar, mdar
  12565. The main input video's display aspect ratio. Calculated from
  12566. @code{(main_w / main_h) * main_sar}.
  12567. @item main_hsub
  12568. @item main_vsub
  12569. The main input video's horizontal and vertical chroma subsample values.
  12570. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  12571. is 1.
  12572. @item main_n
  12573. The (sequential) number of the main input frame, starting from 0.
  12574. Only available with @code{eval=frame}.
  12575. @item main_t
  12576. The presentation timestamp of the main input frame, expressed as a number of
  12577. seconds. Only available with @code{eval=frame}.
  12578. @item main_pos
  12579. The position (byte offset) of the frame in the main input stream, or NaN if
  12580. this information is unavailable and/or meaningless (for example in case of synthetic video).
  12581. Only available with @code{eval=frame}.
  12582. @end table
  12583. @subsection Examples
  12584. @itemize
  12585. @item
  12586. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  12587. @example
  12588. 'scale2ref[b][a];[a][b]overlay'
  12589. @end example
  12590. @item
  12591. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  12592. @example
  12593. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  12594. @end example
  12595. @end itemize
  12596. @subsection Commands
  12597. This filter supports the following commands:
  12598. @table @option
  12599. @item width, w
  12600. @item height, h
  12601. Set the output video dimension expression.
  12602. The command accepts the same syntax of the corresponding option.
  12603. If the specified expression is not valid, it is kept at its current
  12604. value.
  12605. @end table
  12606. @section scroll
  12607. Scroll input video horizontally and/or vertically by constant speed.
  12608. The filter accepts the following options:
  12609. @table @option
  12610. @item horizontal, h
  12611. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12612. Negative values changes scrolling direction.
  12613. @item vertical, v
  12614. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12615. Negative values changes scrolling direction.
  12616. @item hpos
  12617. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  12618. @item vpos
  12619. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  12620. @end table
  12621. @subsection Commands
  12622. This filter supports the following @ref{commands}:
  12623. @table @option
  12624. @item horizontal, h
  12625. Set the horizontal scrolling speed.
  12626. @item vertical, v
  12627. Set the vertical scrolling speed.
  12628. @end table
  12629. @anchor{scdet}
  12630. @section scdet
  12631. Detect video scene change.
  12632. This filter sets frame metadata with mafd between frame, the scene score, and
  12633. forward the frame to the next filter, so they can use these metadata to detect
  12634. scene change or others.
  12635. In addition, this filter logs a message and sets frame metadata when it detects
  12636. a scene change by @option{threshold}.
  12637. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  12638. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  12639. to detect scene change.
  12640. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  12641. detect scene change with @option{threshold}.
  12642. The filter accepts the following options:
  12643. @table @option
  12644. @item threshold, t
  12645. Set the scene change detection threshold as a percentage of maximum change. Good
  12646. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  12647. @code{[0., 100.]}.
  12648. Default value is @code{10.}.
  12649. @item sc_pass, s
  12650. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  12651. You can enable it if you want to get snapshot of scene change frames only.
  12652. @end table
  12653. @anchor{selectivecolor}
  12654. @section selectivecolor
  12655. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  12656. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  12657. by the "purity" of the color (that is, how saturated it already is).
  12658. This filter is similar to the Adobe Photoshop Selective Color tool.
  12659. The filter accepts the following options:
  12660. @table @option
  12661. @item correction_method
  12662. Select color correction method.
  12663. Available values are:
  12664. @table @samp
  12665. @item absolute
  12666. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  12667. component value).
  12668. @item relative
  12669. Specified adjustments are relative to the original component value.
  12670. @end table
  12671. Default is @code{absolute}.
  12672. @item reds
  12673. Adjustments for red pixels (pixels where the red component is the maximum)
  12674. @item yellows
  12675. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  12676. @item greens
  12677. Adjustments for green pixels (pixels where the green component is the maximum)
  12678. @item cyans
  12679. Adjustments for cyan pixels (pixels where the red component is the minimum)
  12680. @item blues
  12681. Adjustments for blue pixels (pixels where the blue component is the maximum)
  12682. @item magentas
  12683. Adjustments for magenta pixels (pixels where the green component is the minimum)
  12684. @item whites
  12685. Adjustments for white pixels (pixels where all components are greater than 128)
  12686. @item neutrals
  12687. Adjustments for all pixels except pure black and pure white
  12688. @item blacks
  12689. Adjustments for black pixels (pixels where all components are lesser than 128)
  12690. @item psfile
  12691. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  12692. @end table
  12693. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  12694. 4 space separated floating point adjustment values in the [-1,1] range,
  12695. respectively to adjust the amount of cyan, magenta, yellow and black for the
  12696. pixels of its range.
  12697. @subsection Examples
  12698. @itemize
  12699. @item
  12700. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  12701. increase magenta by 27% in blue areas:
  12702. @example
  12703. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  12704. @end example
  12705. @item
  12706. Use a Photoshop selective color preset:
  12707. @example
  12708. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  12709. @end example
  12710. @end itemize
  12711. @anchor{separatefields}
  12712. @section separatefields
  12713. The @code{separatefields} takes a frame-based video input and splits
  12714. each frame into its components fields, producing a new half height clip
  12715. with twice the frame rate and twice the frame count.
  12716. This filter use field-dominance information in frame to decide which
  12717. of each pair of fields to place first in the output.
  12718. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  12719. @section setdar, setsar
  12720. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  12721. output video.
  12722. This is done by changing the specified Sample (aka Pixel) Aspect
  12723. Ratio, according to the following equation:
  12724. @example
  12725. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  12726. @end example
  12727. Keep in mind that the @code{setdar} filter does not modify the pixel
  12728. dimensions of the video frame. Also, the display aspect ratio set by
  12729. this filter may be changed by later filters in the filterchain,
  12730. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  12731. applied.
  12732. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  12733. the filter output video.
  12734. Note that as a consequence of the application of this filter, the
  12735. output display aspect ratio will change according to the equation
  12736. above.
  12737. Keep in mind that the sample aspect ratio set by the @code{setsar}
  12738. filter may be changed by later filters in the filterchain, e.g. if
  12739. another "setsar" or a "setdar" filter is applied.
  12740. It accepts the following parameters:
  12741. @table @option
  12742. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  12743. Set the aspect ratio used by the filter.
  12744. The parameter can be a floating point number string, an expression, or
  12745. a string of the form @var{num}:@var{den}, where @var{num} and
  12746. @var{den} are the numerator and denominator of the aspect ratio. If
  12747. the parameter is not specified, it is assumed the value "0".
  12748. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  12749. should be escaped.
  12750. @item max
  12751. Set the maximum integer value to use for expressing numerator and
  12752. denominator when reducing the expressed aspect ratio to a rational.
  12753. Default value is @code{100}.
  12754. @end table
  12755. The parameter @var{sar} is an expression containing
  12756. the following constants:
  12757. @table @option
  12758. @item E, PI, PHI
  12759. These are approximated values for the mathematical constants e
  12760. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  12761. @item w, h
  12762. The input width and height.
  12763. @item a
  12764. These are the same as @var{w} / @var{h}.
  12765. @item sar
  12766. The input sample aspect ratio.
  12767. @item dar
  12768. The input display aspect ratio. It is the same as
  12769. (@var{w} / @var{h}) * @var{sar}.
  12770. @item hsub, vsub
  12771. Horizontal and vertical chroma subsample values. For example, for the
  12772. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12773. @end table
  12774. @subsection Examples
  12775. @itemize
  12776. @item
  12777. To change the display aspect ratio to 16:9, specify one of the following:
  12778. @example
  12779. setdar=dar=1.77777
  12780. setdar=dar=16/9
  12781. @end example
  12782. @item
  12783. To change the sample aspect ratio to 10:11, specify:
  12784. @example
  12785. setsar=sar=10/11
  12786. @end example
  12787. @item
  12788. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  12789. 1000 in the aspect ratio reduction, use the command:
  12790. @example
  12791. setdar=ratio=16/9:max=1000
  12792. @end example
  12793. @end itemize
  12794. @anchor{setfield}
  12795. @section setfield
  12796. Force field for the output video frame.
  12797. The @code{setfield} filter marks the interlace type field for the
  12798. output frames. It does not change the input frame, but only sets the
  12799. corresponding property, which affects how the frame is treated by
  12800. following filters (e.g. @code{fieldorder} or @code{yadif}).
  12801. The filter accepts the following options:
  12802. @table @option
  12803. @item mode
  12804. Available values are:
  12805. @table @samp
  12806. @item auto
  12807. Keep the same field property.
  12808. @item bff
  12809. Mark the frame as bottom-field-first.
  12810. @item tff
  12811. Mark the frame as top-field-first.
  12812. @item prog
  12813. Mark the frame as progressive.
  12814. @end table
  12815. @end table
  12816. @anchor{setparams}
  12817. @section setparams
  12818. Force frame parameter for the output video frame.
  12819. The @code{setparams} filter marks interlace and color range for the
  12820. output frames. It does not change the input frame, but only sets the
  12821. corresponding property, which affects how the frame is treated by
  12822. filters/encoders.
  12823. @table @option
  12824. @item field_mode
  12825. Available values are:
  12826. @table @samp
  12827. @item auto
  12828. Keep the same field property (default).
  12829. @item bff
  12830. Mark the frame as bottom-field-first.
  12831. @item tff
  12832. Mark the frame as top-field-first.
  12833. @item prog
  12834. Mark the frame as progressive.
  12835. @end table
  12836. @item range
  12837. Available values are:
  12838. @table @samp
  12839. @item auto
  12840. Keep the same color range property (default).
  12841. @item unspecified, unknown
  12842. Mark the frame as unspecified color range.
  12843. @item limited, tv, mpeg
  12844. Mark the frame as limited range.
  12845. @item full, pc, jpeg
  12846. Mark the frame as full range.
  12847. @end table
  12848. @item color_primaries
  12849. Set the color primaries.
  12850. Available values are:
  12851. @table @samp
  12852. @item auto
  12853. Keep the same color primaries property (default).
  12854. @item bt709
  12855. @item unknown
  12856. @item bt470m
  12857. @item bt470bg
  12858. @item smpte170m
  12859. @item smpte240m
  12860. @item film
  12861. @item bt2020
  12862. @item smpte428
  12863. @item smpte431
  12864. @item smpte432
  12865. @item jedec-p22
  12866. @end table
  12867. @item color_trc
  12868. Set the color transfer.
  12869. Available values are:
  12870. @table @samp
  12871. @item auto
  12872. Keep the same color trc property (default).
  12873. @item bt709
  12874. @item unknown
  12875. @item bt470m
  12876. @item bt470bg
  12877. @item smpte170m
  12878. @item smpte240m
  12879. @item linear
  12880. @item log100
  12881. @item log316
  12882. @item iec61966-2-4
  12883. @item bt1361e
  12884. @item iec61966-2-1
  12885. @item bt2020-10
  12886. @item bt2020-12
  12887. @item smpte2084
  12888. @item smpte428
  12889. @item arib-std-b67
  12890. @end table
  12891. @item colorspace
  12892. Set the colorspace.
  12893. Available values are:
  12894. @table @samp
  12895. @item auto
  12896. Keep the same colorspace property (default).
  12897. @item gbr
  12898. @item bt709
  12899. @item unknown
  12900. @item fcc
  12901. @item bt470bg
  12902. @item smpte170m
  12903. @item smpte240m
  12904. @item ycgco
  12905. @item bt2020nc
  12906. @item bt2020c
  12907. @item smpte2085
  12908. @item chroma-derived-nc
  12909. @item chroma-derived-c
  12910. @item ictcp
  12911. @end table
  12912. @end table
  12913. @section showinfo
  12914. Show a line containing various information for each input video frame.
  12915. The input video is not modified.
  12916. This filter supports the following options:
  12917. @table @option
  12918. @item checksum
  12919. Calculate checksums of each plane. By default enabled.
  12920. @end table
  12921. The shown line contains a sequence of key/value pairs of the form
  12922. @var{key}:@var{value}.
  12923. The following values are shown in the output:
  12924. @table @option
  12925. @item n
  12926. The (sequential) number of the input frame, starting from 0.
  12927. @item pts
  12928. The Presentation TimeStamp of the input frame, expressed as a number of
  12929. time base units. The time base unit depends on the filter input pad.
  12930. @item pts_time
  12931. The Presentation TimeStamp of the input frame, expressed as a number of
  12932. seconds.
  12933. @item pos
  12934. The position of the frame in the input stream, or -1 if this information is
  12935. unavailable and/or meaningless (for example in case of synthetic video).
  12936. @item fmt
  12937. The pixel format name.
  12938. @item sar
  12939. The sample aspect ratio of the input frame, expressed in the form
  12940. @var{num}/@var{den}.
  12941. @item s
  12942. The size of the input frame. For the syntax of this option, check the
  12943. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12944. @item i
  12945. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  12946. for bottom field first).
  12947. @item iskey
  12948. This is 1 if the frame is a key frame, 0 otherwise.
  12949. @item type
  12950. The picture type of the input frame ("I" for an I-frame, "P" for a
  12951. P-frame, "B" for a B-frame, or "?" for an unknown type).
  12952. Also refer to the documentation of the @code{AVPictureType} enum and of
  12953. the @code{av_get_picture_type_char} function defined in
  12954. @file{libavutil/avutil.h}.
  12955. @item checksum
  12956. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  12957. @item plane_checksum
  12958. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  12959. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  12960. @item mean
  12961. The mean value of pixels in each plane of the input frame, expressed in the form
  12962. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  12963. @item stdev
  12964. The standard deviation of pixel values in each plane of the input frame, expressed
  12965. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  12966. @end table
  12967. @section showpalette
  12968. Displays the 256 colors palette of each frame. This filter is only relevant for
  12969. @var{pal8} pixel format frames.
  12970. It accepts the following option:
  12971. @table @option
  12972. @item s
  12973. Set the size of the box used to represent one palette color entry. Default is
  12974. @code{30} (for a @code{30x30} pixel box).
  12975. @end table
  12976. @section shuffleframes
  12977. Reorder and/or duplicate and/or drop video frames.
  12978. It accepts the following parameters:
  12979. @table @option
  12980. @item mapping
  12981. Set the destination indexes of input frames.
  12982. This is space or '|' separated list of indexes that maps input frames to output
  12983. frames. Number of indexes also sets maximal value that each index may have.
  12984. '-1' index have special meaning and that is to drop frame.
  12985. @end table
  12986. The first frame has the index 0. The default is to keep the input unchanged.
  12987. @subsection Examples
  12988. @itemize
  12989. @item
  12990. Swap second and third frame of every three frames of the input:
  12991. @example
  12992. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  12993. @end example
  12994. @item
  12995. Swap 10th and 1st frame of every ten frames of the input:
  12996. @example
  12997. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  12998. @end example
  12999. @end itemize
  13000. @section shuffleplanes
  13001. Reorder and/or duplicate video planes.
  13002. It accepts the following parameters:
  13003. @table @option
  13004. @item map0
  13005. The index of the input plane to be used as the first output plane.
  13006. @item map1
  13007. The index of the input plane to be used as the second output plane.
  13008. @item map2
  13009. The index of the input plane to be used as the third output plane.
  13010. @item map3
  13011. The index of the input plane to be used as the fourth output plane.
  13012. @end table
  13013. The first plane has the index 0. The default is to keep the input unchanged.
  13014. @subsection Examples
  13015. @itemize
  13016. @item
  13017. Swap the second and third planes of the input:
  13018. @example
  13019. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  13020. @end example
  13021. @end itemize
  13022. @anchor{signalstats}
  13023. @section signalstats
  13024. Evaluate various visual metrics that assist in determining issues associated
  13025. with the digitization of analog video media.
  13026. By default the filter will log these metadata values:
  13027. @table @option
  13028. @item YMIN
  13029. Display the minimal Y value contained within the input frame. Expressed in
  13030. range of [0-255].
  13031. @item YLOW
  13032. Display the Y value at the 10% percentile within the input frame. Expressed in
  13033. range of [0-255].
  13034. @item YAVG
  13035. Display the average Y value within the input frame. Expressed in range of
  13036. [0-255].
  13037. @item YHIGH
  13038. Display the Y value at the 90% percentile within the input frame. Expressed in
  13039. range of [0-255].
  13040. @item YMAX
  13041. Display the maximum Y value contained within the input frame. Expressed in
  13042. range of [0-255].
  13043. @item UMIN
  13044. Display the minimal U value contained within the input frame. Expressed in
  13045. range of [0-255].
  13046. @item ULOW
  13047. Display the U value at the 10% percentile within the input frame. Expressed in
  13048. range of [0-255].
  13049. @item UAVG
  13050. Display the average U value within the input frame. Expressed in range of
  13051. [0-255].
  13052. @item UHIGH
  13053. Display the U value at the 90% percentile within the input frame. Expressed in
  13054. range of [0-255].
  13055. @item UMAX
  13056. Display the maximum U value contained within the input frame. Expressed in
  13057. range of [0-255].
  13058. @item VMIN
  13059. Display the minimal V value contained within the input frame. Expressed in
  13060. range of [0-255].
  13061. @item VLOW
  13062. Display the V value at the 10% percentile within the input frame. Expressed in
  13063. range of [0-255].
  13064. @item VAVG
  13065. Display the average V value within the input frame. Expressed in range of
  13066. [0-255].
  13067. @item VHIGH
  13068. Display the V value at the 90% percentile within the input frame. Expressed in
  13069. range of [0-255].
  13070. @item VMAX
  13071. Display the maximum V value contained within the input frame. Expressed in
  13072. range of [0-255].
  13073. @item SATMIN
  13074. Display the minimal saturation value contained within the input frame.
  13075. Expressed in range of [0-~181.02].
  13076. @item SATLOW
  13077. Display the saturation value at the 10% percentile within the input frame.
  13078. Expressed in range of [0-~181.02].
  13079. @item SATAVG
  13080. Display the average saturation value within the input frame. Expressed in range
  13081. of [0-~181.02].
  13082. @item SATHIGH
  13083. Display the saturation value at the 90% percentile within the input frame.
  13084. Expressed in range of [0-~181.02].
  13085. @item SATMAX
  13086. Display the maximum saturation value contained within the input frame.
  13087. Expressed in range of [0-~181.02].
  13088. @item HUEMED
  13089. Display the median value for hue within the input frame. Expressed in range of
  13090. [0-360].
  13091. @item HUEAVG
  13092. Display the average value for hue within the input frame. Expressed in range of
  13093. [0-360].
  13094. @item YDIF
  13095. Display the average of sample value difference between all values of the Y
  13096. plane in the current frame and corresponding values of the previous input frame.
  13097. Expressed in range of [0-255].
  13098. @item UDIF
  13099. Display the average of sample value difference between all values of the U
  13100. plane in the current frame and corresponding values of the previous input frame.
  13101. Expressed in range of [0-255].
  13102. @item VDIF
  13103. Display the average of sample value difference between all values of the V
  13104. plane in the current frame and corresponding values of the previous input frame.
  13105. Expressed in range of [0-255].
  13106. @item YBITDEPTH
  13107. Display bit depth of Y plane in current frame.
  13108. Expressed in range of [0-16].
  13109. @item UBITDEPTH
  13110. Display bit depth of U plane in current frame.
  13111. Expressed in range of [0-16].
  13112. @item VBITDEPTH
  13113. Display bit depth of V plane in current frame.
  13114. Expressed in range of [0-16].
  13115. @end table
  13116. The filter accepts the following options:
  13117. @table @option
  13118. @item stat
  13119. @item out
  13120. @option{stat} specify an additional form of image analysis.
  13121. @option{out} output video with the specified type of pixel highlighted.
  13122. Both options accept the following values:
  13123. @table @samp
  13124. @item tout
  13125. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  13126. unlike the neighboring pixels of the same field. Examples of temporal outliers
  13127. include the results of video dropouts, head clogs, or tape tracking issues.
  13128. @item vrep
  13129. Identify @var{vertical line repetition}. Vertical line repetition includes
  13130. similar rows of pixels within a frame. In born-digital video vertical line
  13131. repetition is common, but this pattern is uncommon in video digitized from an
  13132. analog source. When it occurs in video that results from the digitization of an
  13133. analog source it can indicate concealment from a dropout compensator.
  13134. @item brng
  13135. Identify pixels that fall outside of legal broadcast range.
  13136. @end table
  13137. @item color, c
  13138. Set the highlight color for the @option{out} option. The default color is
  13139. yellow.
  13140. @end table
  13141. @subsection Examples
  13142. @itemize
  13143. @item
  13144. Output data of various video metrics:
  13145. @example
  13146. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  13147. @end example
  13148. @item
  13149. Output specific data about the minimum and maximum values of the Y plane per frame:
  13150. @example
  13151. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  13152. @end example
  13153. @item
  13154. Playback video while highlighting pixels that are outside of broadcast range in red.
  13155. @example
  13156. ffplay example.mov -vf signalstats="out=brng:color=red"
  13157. @end example
  13158. @item
  13159. Playback video with signalstats metadata drawn over the frame.
  13160. @example
  13161. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  13162. @end example
  13163. The contents of signalstat_drawtext.txt used in the command are:
  13164. @example
  13165. time %@{pts:hms@}
  13166. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  13167. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  13168. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  13169. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  13170. @end example
  13171. @end itemize
  13172. @anchor{signature}
  13173. @section signature
  13174. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  13175. input. In this case the matching between the inputs can be calculated additionally.
  13176. The filter always passes through the first input. The signature of each stream can
  13177. be written into a file.
  13178. It accepts the following options:
  13179. @table @option
  13180. @item detectmode
  13181. Enable or disable the matching process.
  13182. Available values are:
  13183. @table @samp
  13184. @item off
  13185. Disable the calculation of a matching (default).
  13186. @item full
  13187. Calculate the matching for the whole video and output whether the whole video
  13188. matches or only parts.
  13189. @item fast
  13190. Calculate only until a matching is found or the video ends. Should be faster in
  13191. some cases.
  13192. @end table
  13193. @item nb_inputs
  13194. Set the number of inputs. The option value must be a non negative integer.
  13195. Default value is 1.
  13196. @item filename
  13197. Set the path to which the output is written. If there is more than one input,
  13198. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  13199. integer), that will be replaced with the input number. If no filename is
  13200. specified, no output will be written. This is the default.
  13201. @item format
  13202. Choose the output format.
  13203. Available values are:
  13204. @table @samp
  13205. @item binary
  13206. Use the specified binary representation (default).
  13207. @item xml
  13208. Use the specified xml representation.
  13209. @end table
  13210. @item th_d
  13211. Set threshold to detect one word as similar. The option value must be an integer
  13212. greater than zero. The default value is 9000.
  13213. @item th_dc
  13214. Set threshold to detect all words as similar. The option value must be an integer
  13215. greater than zero. The default value is 60000.
  13216. @item th_xh
  13217. Set threshold to detect frames as similar. The option value must be an integer
  13218. greater than zero. The default value is 116.
  13219. @item th_di
  13220. Set the minimum length of a sequence in frames to recognize it as matching
  13221. sequence. The option value must be a non negative integer value.
  13222. The default value is 0.
  13223. @item th_it
  13224. Set the minimum relation, that matching frames to all frames must have.
  13225. The option value must be a double value between 0 and 1. The default value is 0.5.
  13226. @end table
  13227. @subsection Examples
  13228. @itemize
  13229. @item
  13230. To calculate the signature of an input video and store it in signature.bin:
  13231. @example
  13232. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  13233. @end example
  13234. @item
  13235. To detect whether two videos match and store the signatures in XML format in
  13236. signature0.xml and signature1.xml:
  13237. @example
  13238. 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 -
  13239. @end example
  13240. @end itemize
  13241. @anchor{smartblur}
  13242. @section smartblur
  13243. Blur the input video without impacting the outlines.
  13244. It accepts the following options:
  13245. @table @option
  13246. @item luma_radius, lr
  13247. Set the luma radius. The option value must be a float number in
  13248. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13249. used to blur the image (slower if larger). Default value is 1.0.
  13250. @item luma_strength, ls
  13251. Set the luma strength. The option value must be a float number
  13252. in the range [-1.0,1.0] that configures the blurring. A value included
  13253. in [0.0,1.0] will blur the image whereas a value included in
  13254. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  13255. @item luma_threshold, lt
  13256. Set the luma threshold used as a coefficient to determine
  13257. whether a pixel should be blurred or not. The option value must be an
  13258. integer in the range [-30,30]. A value of 0 will filter all the image,
  13259. a value included in [0,30] will filter flat areas and a value included
  13260. in [-30,0] will filter edges. Default value is 0.
  13261. @item chroma_radius, cr
  13262. Set the chroma radius. The option value must be a float number in
  13263. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13264. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  13265. @item chroma_strength, cs
  13266. Set the chroma strength. The option value must be a float number
  13267. in the range [-1.0,1.0] that configures the blurring. A value included
  13268. in [0.0,1.0] will blur the image whereas a value included in
  13269. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  13270. @item chroma_threshold, ct
  13271. Set the chroma threshold used as a coefficient to determine
  13272. whether a pixel should be blurred or not. The option value must be an
  13273. integer in the range [-30,30]. A value of 0 will filter all the image,
  13274. a value included in [0,30] will filter flat areas and a value included
  13275. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  13276. @end table
  13277. If a chroma option is not explicitly set, the corresponding luma value
  13278. is set.
  13279. @section sobel
  13280. Apply sobel operator to input video stream.
  13281. The filter accepts the following option:
  13282. @table @option
  13283. @item planes
  13284. Set which planes will be processed, unprocessed planes will be copied.
  13285. By default value 0xf, all planes will be processed.
  13286. @item scale
  13287. Set value which will be multiplied with filtered result.
  13288. @item delta
  13289. Set value which will be added to filtered result.
  13290. @end table
  13291. @anchor{spp}
  13292. @section spp
  13293. Apply a simple postprocessing filter that compresses and decompresses the image
  13294. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  13295. and average the results.
  13296. The filter accepts the following options:
  13297. @table @option
  13298. @item quality
  13299. Set quality. This option defines the number of levels for averaging. It accepts
  13300. an integer in the range 0-6. If set to @code{0}, the filter will have no
  13301. effect. A value of @code{6} means the higher quality. For each increment of
  13302. that value the speed drops by a factor of approximately 2. Default value is
  13303. @code{3}.
  13304. @item qp
  13305. Force a constant quantization parameter. If not set, the filter will use the QP
  13306. from the video stream (if available).
  13307. @item mode
  13308. Set thresholding mode. Available modes are:
  13309. @table @samp
  13310. @item hard
  13311. Set hard thresholding (default).
  13312. @item soft
  13313. Set soft thresholding (better de-ringing effect, but likely blurrier).
  13314. @end table
  13315. @item use_bframe_qp
  13316. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  13317. option may cause flicker since the B-Frames have often larger QP. Default is
  13318. @code{0} (not enabled).
  13319. @end table
  13320. @subsection Commands
  13321. This filter supports the following commands:
  13322. @table @option
  13323. @item quality, level
  13324. Set quality level. The value @code{max} can be used to set the maximum level,
  13325. currently @code{6}.
  13326. @end table
  13327. @anchor{sr}
  13328. @section sr
  13329. Scale the input by applying one of the super-resolution methods based on
  13330. convolutional neural networks. Supported models:
  13331. @itemize
  13332. @item
  13333. Super-Resolution Convolutional Neural Network model (SRCNN).
  13334. See @url{https://arxiv.org/abs/1501.00092}.
  13335. @item
  13336. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  13337. See @url{https://arxiv.org/abs/1609.05158}.
  13338. @end itemize
  13339. Training scripts as well as scripts for model file (.pb) saving can be found at
  13340. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  13341. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  13342. Native model files (.model) can be generated from TensorFlow model
  13343. files (.pb) by using tools/python/convert.py
  13344. The filter accepts the following options:
  13345. @table @option
  13346. @item dnn_backend
  13347. Specify which DNN backend to use for model loading and execution. This option accepts
  13348. the following values:
  13349. @table @samp
  13350. @item native
  13351. Native implementation of DNN loading and execution.
  13352. @item tensorflow
  13353. TensorFlow backend. To enable this backend you
  13354. need to install the TensorFlow for C library (see
  13355. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  13356. @code{--enable-libtensorflow}
  13357. @end table
  13358. Default value is @samp{native}.
  13359. @item model
  13360. Set path to model file specifying network architecture and its parameters.
  13361. Note that different backends use different file formats. TensorFlow backend
  13362. can load files for both formats, while native backend can load files for only
  13363. its format.
  13364. @item scale_factor
  13365. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  13366. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  13367. input upscaled using bicubic upscaling with proper scale factor.
  13368. @end table
  13369. This feature can also be finished with @ref{dnn_processing} filter.
  13370. @section ssim
  13371. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  13372. This filter takes in input two input videos, the first input is
  13373. considered the "main" source and is passed unchanged to the
  13374. output. The second input is used as a "reference" video for computing
  13375. the SSIM.
  13376. Both video inputs must have the same resolution and pixel format for
  13377. this filter to work correctly. Also it assumes that both inputs
  13378. have the same number of frames, which are compared one by one.
  13379. The filter stores the calculated SSIM of each frame.
  13380. The description of the accepted parameters follows.
  13381. @table @option
  13382. @item stats_file, f
  13383. If specified the filter will use the named file to save the SSIM of
  13384. each individual frame. When filename equals "-" the data is sent to
  13385. standard output.
  13386. @end table
  13387. The file printed if @var{stats_file} is selected, contains a sequence of
  13388. key/value pairs of the form @var{key}:@var{value} for each compared
  13389. couple of frames.
  13390. A description of each shown parameter follows:
  13391. @table @option
  13392. @item n
  13393. sequential number of the input frame, starting from 1
  13394. @item Y, U, V, R, G, B
  13395. SSIM of the compared frames for the component specified by the suffix.
  13396. @item All
  13397. SSIM of the compared frames for the whole frame.
  13398. @item dB
  13399. Same as above but in dB representation.
  13400. @end table
  13401. This filter also supports the @ref{framesync} options.
  13402. @subsection Examples
  13403. @itemize
  13404. @item
  13405. For example:
  13406. @example
  13407. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  13408. [main][ref] ssim="stats_file=stats.log" [out]
  13409. @end example
  13410. On this example the input file being processed is compared with the
  13411. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  13412. is stored in @file{stats.log}.
  13413. @item
  13414. Another example with both psnr and ssim at same time:
  13415. @example
  13416. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  13417. @end example
  13418. @item
  13419. Another example with different containers:
  13420. @example
  13421. ffmpeg -i main.mpg -i ref.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[main][ref]ssim" -f null -
  13422. @end example
  13423. @end itemize
  13424. @section stereo3d
  13425. Convert between different stereoscopic image formats.
  13426. The filters accept the following options:
  13427. @table @option
  13428. @item in
  13429. Set stereoscopic image format of input.
  13430. Available values for input image formats are:
  13431. @table @samp
  13432. @item sbsl
  13433. side by side parallel (left eye left, right eye right)
  13434. @item sbsr
  13435. side by side crosseye (right eye left, left eye right)
  13436. @item sbs2l
  13437. side by side parallel with half width resolution
  13438. (left eye left, right eye right)
  13439. @item sbs2r
  13440. side by side crosseye with half width resolution
  13441. (right eye left, left eye right)
  13442. @item abl
  13443. @item tbl
  13444. above-below (left eye above, right eye below)
  13445. @item abr
  13446. @item tbr
  13447. above-below (right eye above, left eye below)
  13448. @item ab2l
  13449. @item tb2l
  13450. above-below with half height resolution
  13451. (left eye above, right eye below)
  13452. @item ab2r
  13453. @item tb2r
  13454. above-below with half height resolution
  13455. (right eye above, left eye below)
  13456. @item al
  13457. alternating frames (left eye first, right eye second)
  13458. @item ar
  13459. alternating frames (right eye first, left eye second)
  13460. @item irl
  13461. interleaved rows (left eye has top row, right eye starts on next row)
  13462. @item irr
  13463. interleaved rows (right eye has top row, left eye starts on next row)
  13464. @item icl
  13465. interleaved columns, left eye first
  13466. @item icr
  13467. interleaved columns, right eye first
  13468. Default value is @samp{sbsl}.
  13469. @end table
  13470. @item out
  13471. Set stereoscopic image format of output.
  13472. @table @samp
  13473. @item sbsl
  13474. side by side parallel (left eye left, right eye right)
  13475. @item sbsr
  13476. side by side crosseye (right eye left, left eye right)
  13477. @item sbs2l
  13478. side by side parallel with half width resolution
  13479. (left eye left, right eye right)
  13480. @item sbs2r
  13481. side by side crosseye with half width resolution
  13482. (right eye left, left eye right)
  13483. @item abl
  13484. @item tbl
  13485. above-below (left eye above, right eye below)
  13486. @item abr
  13487. @item tbr
  13488. above-below (right eye above, left eye below)
  13489. @item ab2l
  13490. @item tb2l
  13491. above-below with half height resolution
  13492. (left eye above, right eye below)
  13493. @item ab2r
  13494. @item tb2r
  13495. above-below with half height resolution
  13496. (right eye above, left eye below)
  13497. @item al
  13498. alternating frames (left eye first, right eye second)
  13499. @item ar
  13500. alternating frames (right eye first, left eye second)
  13501. @item irl
  13502. interleaved rows (left eye has top row, right eye starts on next row)
  13503. @item irr
  13504. interleaved rows (right eye has top row, left eye starts on next row)
  13505. @item arbg
  13506. anaglyph red/blue gray
  13507. (red filter on left eye, blue filter on right eye)
  13508. @item argg
  13509. anaglyph red/green gray
  13510. (red filter on left eye, green filter on right eye)
  13511. @item arcg
  13512. anaglyph red/cyan gray
  13513. (red filter on left eye, cyan filter on right eye)
  13514. @item arch
  13515. anaglyph red/cyan half colored
  13516. (red filter on left eye, cyan filter on right eye)
  13517. @item arcc
  13518. anaglyph red/cyan color
  13519. (red filter on left eye, cyan filter on right eye)
  13520. @item arcd
  13521. anaglyph red/cyan color optimized with the least squares projection of dubois
  13522. (red filter on left eye, cyan filter on right eye)
  13523. @item agmg
  13524. anaglyph green/magenta gray
  13525. (green filter on left eye, magenta filter on right eye)
  13526. @item agmh
  13527. anaglyph green/magenta half colored
  13528. (green filter on left eye, magenta filter on right eye)
  13529. @item agmc
  13530. anaglyph green/magenta colored
  13531. (green filter on left eye, magenta filter on right eye)
  13532. @item agmd
  13533. anaglyph green/magenta color optimized with the least squares projection of dubois
  13534. (green filter on left eye, magenta filter on right eye)
  13535. @item aybg
  13536. anaglyph yellow/blue gray
  13537. (yellow filter on left eye, blue filter on right eye)
  13538. @item aybh
  13539. anaglyph yellow/blue half colored
  13540. (yellow filter on left eye, blue filter on right eye)
  13541. @item aybc
  13542. anaglyph yellow/blue colored
  13543. (yellow filter on left eye, blue filter on right eye)
  13544. @item aybd
  13545. anaglyph yellow/blue color optimized with the least squares projection of dubois
  13546. (yellow filter on left eye, blue filter on right eye)
  13547. @item ml
  13548. mono output (left eye only)
  13549. @item mr
  13550. mono output (right eye only)
  13551. @item chl
  13552. checkerboard, left eye first
  13553. @item chr
  13554. checkerboard, right eye first
  13555. @item icl
  13556. interleaved columns, left eye first
  13557. @item icr
  13558. interleaved columns, right eye first
  13559. @item hdmi
  13560. HDMI frame pack
  13561. @end table
  13562. Default value is @samp{arcd}.
  13563. @end table
  13564. @subsection Examples
  13565. @itemize
  13566. @item
  13567. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  13568. @example
  13569. stereo3d=sbsl:aybd
  13570. @end example
  13571. @item
  13572. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  13573. @example
  13574. stereo3d=abl:sbsr
  13575. @end example
  13576. @end itemize
  13577. @section streamselect, astreamselect
  13578. Select video or audio streams.
  13579. The filter accepts the following options:
  13580. @table @option
  13581. @item inputs
  13582. Set number of inputs. Default is 2.
  13583. @item map
  13584. Set input indexes to remap to outputs.
  13585. @end table
  13586. @subsection Commands
  13587. The @code{streamselect} and @code{astreamselect} filter supports the following
  13588. commands:
  13589. @table @option
  13590. @item map
  13591. Set input indexes to remap to outputs.
  13592. @end table
  13593. @subsection Examples
  13594. @itemize
  13595. @item
  13596. Select first 5 seconds 1st stream and rest of time 2nd stream:
  13597. @example
  13598. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  13599. @end example
  13600. @item
  13601. Same as above, but for audio:
  13602. @example
  13603. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  13604. @end example
  13605. @end itemize
  13606. @anchor{subtitles}
  13607. @section subtitles
  13608. Draw subtitles on top of input video using the libass library.
  13609. To enable compilation of this filter you need to configure FFmpeg with
  13610. @code{--enable-libass}. This filter also requires a build with libavcodec and
  13611. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  13612. Alpha) subtitles format.
  13613. The filter accepts the following options:
  13614. @table @option
  13615. @item filename, f
  13616. Set the filename of the subtitle file to read. It must be specified.
  13617. @item original_size
  13618. Specify the size of the original video, the video for which the ASS file
  13619. was composed. For the syntax of this option, check the
  13620. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13621. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  13622. correctly scale the fonts if the aspect ratio has been changed.
  13623. @item fontsdir
  13624. Set a directory path containing fonts that can be used by the filter.
  13625. These fonts will be used in addition to whatever the font provider uses.
  13626. @item alpha
  13627. Process alpha channel, by default alpha channel is untouched.
  13628. @item charenc
  13629. Set subtitles input character encoding. @code{subtitles} filter only. Only
  13630. useful if not UTF-8.
  13631. @item stream_index, si
  13632. Set subtitles stream index. @code{subtitles} filter only.
  13633. @item force_style
  13634. Override default style or script info parameters of the subtitles. It accepts a
  13635. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  13636. @end table
  13637. If the first key is not specified, it is assumed that the first value
  13638. specifies the @option{filename}.
  13639. For example, to render the file @file{sub.srt} on top of the input
  13640. video, use the command:
  13641. @example
  13642. subtitles=sub.srt
  13643. @end example
  13644. which is equivalent to:
  13645. @example
  13646. subtitles=filename=sub.srt
  13647. @end example
  13648. To render the default subtitles stream from file @file{video.mkv}, use:
  13649. @example
  13650. subtitles=video.mkv
  13651. @end example
  13652. To render the second subtitles stream from that file, use:
  13653. @example
  13654. subtitles=video.mkv:si=1
  13655. @end example
  13656. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  13657. @code{DejaVu Serif}, use:
  13658. @example
  13659. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  13660. @end example
  13661. @section super2xsai
  13662. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  13663. Interpolate) pixel art scaling algorithm.
  13664. Useful for enlarging pixel art images without reducing sharpness.
  13665. @section swaprect
  13666. Swap two rectangular objects in video.
  13667. This filter accepts the following options:
  13668. @table @option
  13669. @item w
  13670. Set object width.
  13671. @item h
  13672. Set object height.
  13673. @item x1
  13674. Set 1st rect x coordinate.
  13675. @item y1
  13676. Set 1st rect y coordinate.
  13677. @item x2
  13678. Set 2nd rect x coordinate.
  13679. @item y2
  13680. Set 2nd rect y coordinate.
  13681. All expressions are evaluated once for each frame.
  13682. @end table
  13683. The all options are expressions containing the following constants:
  13684. @table @option
  13685. @item w
  13686. @item h
  13687. The input width and height.
  13688. @item a
  13689. same as @var{w} / @var{h}
  13690. @item sar
  13691. input sample aspect ratio
  13692. @item dar
  13693. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  13694. @item n
  13695. The number of the input frame, starting from 0.
  13696. @item t
  13697. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  13698. @item pos
  13699. the position in the file of the input frame, NAN if unknown
  13700. @end table
  13701. @section swapuv
  13702. Swap U & V plane.
  13703. @section tblend
  13704. Blend successive video frames.
  13705. See @ref{blend}
  13706. @section telecine
  13707. Apply telecine process to the video.
  13708. This filter accepts the following options:
  13709. @table @option
  13710. @item first_field
  13711. @table @samp
  13712. @item top, t
  13713. top field first
  13714. @item bottom, b
  13715. bottom field first
  13716. The default value is @code{top}.
  13717. @end table
  13718. @item pattern
  13719. A string of numbers representing the pulldown pattern you wish to apply.
  13720. The default value is @code{23}.
  13721. @end table
  13722. @example
  13723. Some typical patterns:
  13724. NTSC output (30i):
  13725. 27.5p: 32222
  13726. 24p: 23 (classic)
  13727. 24p: 2332 (preferred)
  13728. 20p: 33
  13729. 18p: 334
  13730. 16p: 3444
  13731. PAL output (25i):
  13732. 27.5p: 12222
  13733. 24p: 222222222223 ("Euro pulldown")
  13734. 16.67p: 33
  13735. 16p: 33333334
  13736. @end example
  13737. @section thistogram
  13738. Compute and draw a color distribution histogram for the input video across time.
  13739. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  13740. at certain time, this filter shows also past histograms of number of frames defined
  13741. by @code{width} option.
  13742. The computed histogram is a representation of the color component
  13743. distribution in an image.
  13744. The filter accepts the following options:
  13745. @table @option
  13746. @item width, w
  13747. Set width of single color component output. Default value is @code{0}.
  13748. Value of @code{0} means width will be picked from input video.
  13749. This also set number of passed histograms to keep.
  13750. Allowed range is [0, 8192].
  13751. @item display_mode, d
  13752. Set display mode.
  13753. It accepts the following values:
  13754. @table @samp
  13755. @item stack
  13756. Per color component graphs are placed below each other.
  13757. @item parade
  13758. Per color component graphs are placed side by side.
  13759. @item overlay
  13760. Presents information identical to that in the @code{parade}, except
  13761. that the graphs representing color components are superimposed directly
  13762. over one another.
  13763. @end table
  13764. Default is @code{stack}.
  13765. @item levels_mode, m
  13766. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  13767. Default is @code{linear}.
  13768. @item components, c
  13769. Set what color components to display.
  13770. Default is @code{7}.
  13771. @item bgopacity, b
  13772. Set background opacity. Default is @code{0.9}.
  13773. @item envelope, e
  13774. Show envelope. Default is disabled.
  13775. @item ecolor, ec
  13776. Set envelope color. Default is @code{gold}.
  13777. @end table
  13778. @section threshold
  13779. Apply threshold effect to video stream.
  13780. This filter needs four video streams to perform thresholding.
  13781. First stream is stream we are filtering.
  13782. Second stream is holding threshold values, third stream is holding min values,
  13783. and last, fourth stream is holding max values.
  13784. The filter accepts the following option:
  13785. @table @option
  13786. @item planes
  13787. Set which planes will be processed, unprocessed planes will be copied.
  13788. By default value 0xf, all planes will be processed.
  13789. @end table
  13790. For example if first stream pixel's component value is less then threshold value
  13791. of pixel component from 2nd threshold stream, third stream value will picked,
  13792. otherwise fourth stream pixel component value will be picked.
  13793. Using color source filter one can perform various types of thresholding:
  13794. @subsection Examples
  13795. @itemize
  13796. @item
  13797. Binary threshold, using gray color as threshold:
  13798. @example
  13799. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  13800. @end example
  13801. @item
  13802. Inverted binary threshold, using gray color as threshold:
  13803. @example
  13804. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  13805. @end example
  13806. @item
  13807. Truncate binary threshold, using gray color as threshold:
  13808. @example
  13809. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  13810. @end example
  13811. @item
  13812. Threshold to zero, using gray color as threshold:
  13813. @example
  13814. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  13815. @end example
  13816. @item
  13817. Inverted threshold to zero, using gray color as threshold:
  13818. @example
  13819. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  13820. @end example
  13821. @end itemize
  13822. @section thumbnail
  13823. Select the most representative frame in a given sequence of consecutive frames.
  13824. The filter accepts the following options:
  13825. @table @option
  13826. @item n
  13827. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  13828. will pick one of them, and then handle the next batch of @var{n} frames until
  13829. the end. Default is @code{100}.
  13830. @end table
  13831. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  13832. value will result in a higher memory usage, so a high value is not recommended.
  13833. @subsection Examples
  13834. @itemize
  13835. @item
  13836. Extract one picture each 50 frames:
  13837. @example
  13838. thumbnail=50
  13839. @end example
  13840. @item
  13841. Complete example of a thumbnail creation with @command{ffmpeg}:
  13842. @example
  13843. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  13844. @end example
  13845. @end itemize
  13846. @section tile
  13847. Tile several successive frames together.
  13848. The filter accepts the following options:
  13849. @table @option
  13850. @item layout
  13851. Set the grid size (i.e. the number of lines and columns). For the syntax of
  13852. this option, check the
  13853. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13854. @item nb_frames
  13855. Set the maximum number of frames to render in the given area. It must be less
  13856. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  13857. the area will be used.
  13858. @item margin
  13859. Set the outer border margin in pixels.
  13860. @item padding
  13861. Set the inner border thickness (i.e. the number of pixels between frames). For
  13862. more advanced padding options (such as having different values for the edges),
  13863. refer to the pad video filter.
  13864. @item color
  13865. Specify the color of the unused area. For the syntax of this option, check the
  13866. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13867. The default value of @var{color} is "black".
  13868. @item overlap
  13869. Set the number of frames to overlap when tiling several successive frames together.
  13870. The value must be between @code{0} and @var{nb_frames - 1}.
  13871. @item init_padding
  13872. Set the number of frames to initially be empty before displaying first output frame.
  13873. This controls how soon will one get first output frame.
  13874. The value must be between @code{0} and @var{nb_frames - 1}.
  13875. @end table
  13876. @subsection Examples
  13877. @itemize
  13878. @item
  13879. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  13880. @example
  13881. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  13882. @end example
  13883. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  13884. duplicating each output frame to accommodate the originally detected frame
  13885. rate.
  13886. @item
  13887. Display @code{5} pictures in an area of @code{3x2} frames,
  13888. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  13889. mixed flat and named options:
  13890. @example
  13891. tile=3x2:nb_frames=5:padding=7:margin=2
  13892. @end example
  13893. @end itemize
  13894. @section tinterlace
  13895. Perform various types of temporal field interlacing.
  13896. Frames are counted starting from 1, so the first input frame is
  13897. considered odd.
  13898. The filter accepts the following options:
  13899. @table @option
  13900. @item mode
  13901. Specify the mode of the interlacing. This option can also be specified
  13902. as a value alone. See below for a list of values for this option.
  13903. Available values are:
  13904. @table @samp
  13905. @item merge, 0
  13906. Move odd frames into the upper field, even into the lower field,
  13907. generating a double height frame at half frame rate.
  13908. @example
  13909. ------> time
  13910. Input:
  13911. Frame 1 Frame 2 Frame 3 Frame 4
  13912. 11111 22222 33333 44444
  13913. 11111 22222 33333 44444
  13914. 11111 22222 33333 44444
  13915. 11111 22222 33333 44444
  13916. Output:
  13917. 11111 33333
  13918. 22222 44444
  13919. 11111 33333
  13920. 22222 44444
  13921. 11111 33333
  13922. 22222 44444
  13923. 11111 33333
  13924. 22222 44444
  13925. @end example
  13926. @item drop_even, 1
  13927. Only output odd frames, even frames are dropped, generating a frame with
  13928. unchanged height at half frame rate.
  13929. @example
  13930. ------> time
  13931. Input:
  13932. Frame 1 Frame 2 Frame 3 Frame 4
  13933. 11111 22222 33333 44444
  13934. 11111 22222 33333 44444
  13935. 11111 22222 33333 44444
  13936. 11111 22222 33333 44444
  13937. Output:
  13938. 11111 33333
  13939. 11111 33333
  13940. 11111 33333
  13941. 11111 33333
  13942. @end example
  13943. @item drop_odd, 2
  13944. Only output even frames, odd frames are dropped, generating a frame with
  13945. unchanged height at half frame rate.
  13946. @example
  13947. ------> time
  13948. Input:
  13949. Frame 1 Frame 2 Frame 3 Frame 4
  13950. 11111 22222 33333 44444
  13951. 11111 22222 33333 44444
  13952. 11111 22222 33333 44444
  13953. 11111 22222 33333 44444
  13954. Output:
  13955. 22222 44444
  13956. 22222 44444
  13957. 22222 44444
  13958. 22222 44444
  13959. @end example
  13960. @item pad, 3
  13961. Expand each frame to full height, but pad alternate lines with black,
  13962. generating a frame with double height at the same input frame rate.
  13963. @example
  13964. ------> time
  13965. Input:
  13966. Frame 1 Frame 2 Frame 3 Frame 4
  13967. 11111 22222 33333 44444
  13968. 11111 22222 33333 44444
  13969. 11111 22222 33333 44444
  13970. 11111 22222 33333 44444
  13971. Output:
  13972. 11111 ..... 33333 .....
  13973. ..... 22222 ..... 44444
  13974. 11111 ..... 33333 .....
  13975. ..... 22222 ..... 44444
  13976. 11111 ..... 33333 .....
  13977. ..... 22222 ..... 44444
  13978. 11111 ..... 33333 .....
  13979. ..... 22222 ..... 44444
  13980. @end example
  13981. @item interleave_top, 4
  13982. Interleave the upper field from odd frames with the lower field from
  13983. even frames, generating a frame with unchanged height at half frame rate.
  13984. @example
  13985. ------> time
  13986. Input:
  13987. Frame 1 Frame 2 Frame 3 Frame 4
  13988. 11111<- 22222 33333<- 44444
  13989. 11111 22222<- 33333 44444<-
  13990. 11111<- 22222 33333<- 44444
  13991. 11111 22222<- 33333 44444<-
  13992. Output:
  13993. 11111 33333
  13994. 22222 44444
  13995. 11111 33333
  13996. 22222 44444
  13997. @end example
  13998. @item interleave_bottom, 5
  13999. Interleave the lower field from odd frames with the upper field from
  14000. even frames, generating a frame with unchanged height at half frame rate.
  14001. @example
  14002. ------> time
  14003. Input:
  14004. Frame 1 Frame 2 Frame 3 Frame 4
  14005. 11111 22222<- 33333 44444<-
  14006. 11111<- 22222 33333<- 44444
  14007. 11111 22222<- 33333 44444<-
  14008. 11111<- 22222 33333<- 44444
  14009. Output:
  14010. 22222 44444
  14011. 11111 33333
  14012. 22222 44444
  14013. 11111 33333
  14014. @end example
  14015. @item interlacex2, 6
  14016. Double frame rate with unchanged height. Frames are inserted each
  14017. containing the second temporal field from the previous input frame and
  14018. the first temporal field from the next input frame. This mode relies on
  14019. the top_field_first flag. Useful for interlaced video displays with no
  14020. field synchronisation.
  14021. @example
  14022. ------> time
  14023. Input:
  14024. Frame 1 Frame 2 Frame 3 Frame 4
  14025. 11111 22222 33333 44444
  14026. 11111 22222 33333 44444
  14027. 11111 22222 33333 44444
  14028. 11111 22222 33333 44444
  14029. Output:
  14030. 11111 22222 22222 33333 33333 44444 44444
  14031. 11111 11111 22222 22222 33333 33333 44444
  14032. 11111 22222 22222 33333 33333 44444 44444
  14033. 11111 11111 22222 22222 33333 33333 44444
  14034. @end example
  14035. @item mergex2, 7
  14036. Move odd frames into the upper field, even into the lower field,
  14037. generating a double height frame at same frame rate.
  14038. @example
  14039. ------> time
  14040. Input:
  14041. Frame 1 Frame 2 Frame 3 Frame 4
  14042. 11111 22222 33333 44444
  14043. 11111 22222 33333 44444
  14044. 11111 22222 33333 44444
  14045. 11111 22222 33333 44444
  14046. Output:
  14047. 11111 33333 33333 55555
  14048. 22222 22222 44444 44444
  14049. 11111 33333 33333 55555
  14050. 22222 22222 44444 44444
  14051. 11111 33333 33333 55555
  14052. 22222 22222 44444 44444
  14053. 11111 33333 33333 55555
  14054. 22222 22222 44444 44444
  14055. @end example
  14056. @end table
  14057. Numeric values are deprecated but are accepted for backward
  14058. compatibility reasons.
  14059. Default mode is @code{merge}.
  14060. @item flags
  14061. Specify flags influencing the filter process.
  14062. Available value for @var{flags} is:
  14063. @table @option
  14064. @item low_pass_filter, vlpf
  14065. Enable linear vertical low-pass filtering in the filter.
  14066. Vertical low-pass filtering is required when creating an interlaced
  14067. destination from a progressive source which contains high-frequency
  14068. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  14069. patterning.
  14070. @item complex_filter, cvlpf
  14071. Enable complex vertical low-pass filtering.
  14072. This will slightly less reduce interlace 'twitter' and Moire
  14073. patterning but better retain detail and subjective sharpness impression.
  14074. @item bypass_il
  14075. Bypass already interlaced frames, only adjust the frame rate.
  14076. @end table
  14077. Vertical low-pass filtering and bypassing already interlaced frames can only be
  14078. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  14079. @end table
  14080. @section tmedian
  14081. Pick median pixels from several successive input video frames.
  14082. The filter accepts the following options:
  14083. @table @option
  14084. @item radius
  14085. Set radius of median filter.
  14086. Default is 1. Allowed range is from 1 to 127.
  14087. @item planes
  14088. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14089. @item percentile
  14090. Set median percentile. Default value is @code{0.5}.
  14091. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  14092. minimum values, and @code{1} maximum values.
  14093. @end table
  14094. @section tmix
  14095. Mix successive video frames.
  14096. A description of the accepted options follows.
  14097. @table @option
  14098. @item frames
  14099. The number of successive frames to mix. If unspecified, it defaults to 3.
  14100. @item weights
  14101. Specify weight of each input video frame.
  14102. Each weight is separated by space. If number of weights is smaller than
  14103. number of @var{frames} last specified weight will be used for all remaining
  14104. unset weights.
  14105. @item scale
  14106. Specify scale, if it is set it will be multiplied with sum
  14107. of each weight multiplied with pixel values to give final destination
  14108. pixel value. By default @var{scale} is auto scaled to sum of weights.
  14109. @end table
  14110. @subsection Examples
  14111. @itemize
  14112. @item
  14113. Average 7 successive frames:
  14114. @example
  14115. tmix=frames=7:weights="1 1 1 1 1 1 1"
  14116. @end example
  14117. @item
  14118. Apply simple temporal convolution:
  14119. @example
  14120. tmix=frames=3:weights="-1 3 -1"
  14121. @end example
  14122. @item
  14123. Similar as above but only showing temporal differences:
  14124. @example
  14125. tmix=frames=3:weights="-1 2 -1":scale=1
  14126. @end example
  14127. @end itemize
  14128. @anchor{tonemap}
  14129. @section tonemap
  14130. Tone map colors from different dynamic ranges.
  14131. This filter expects data in single precision floating point, as it needs to
  14132. operate on (and can output) out-of-range values. Another filter, such as
  14133. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  14134. The tonemapping algorithms implemented only work on linear light, so input
  14135. data should be linearized beforehand (and possibly correctly tagged).
  14136. @example
  14137. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  14138. @end example
  14139. @subsection Options
  14140. The filter accepts the following options.
  14141. @table @option
  14142. @item tonemap
  14143. Set the tone map algorithm to use.
  14144. Possible values are:
  14145. @table @var
  14146. @item none
  14147. Do not apply any tone map, only desaturate overbright pixels.
  14148. @item clip
  14149. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  14150. in-range values, while distorting out-of-range values.
  14151. @item linear
  14152. Stretch the entire reference gamut to a linear multiple of the display.
  14153. @item gamma
  14154. Fit a logarithmic transfer between the tone curves.
  14155. @item reinhard
  14156. Preserve overall image brightness with a simple curve, using nonlinear
  14157. contrast, which results in flattening details and degrading color accuracy.
  14158. @item hable
  14159. Preserve both dark and bright details better than @var{reinhard}, at the cost
  14160. of slightly darkening everything. Use it when detail preservation is more
  14161. important than color and brightness accuracy.
  14162. @item mobius
  14163. Smoothly map out-of-range values, while retaining contrast and colors for
  14164. in-range material as much as possible. Use it when color accuracy is more
  14165. important than detail preservation.
  14166. @end table
  14167. Default is none.
  14168. @item param
  14169. Tune the tone mapping algorithm.
  14170. This affects the following algorithms:
  14171. @table @var
  14172. @item none
  14173. Ignored.
  14174. @item linear
  14175. Specifies the scale factor to use while stretching.
  14176. Default to 1.0.
  14177. @item gamma
  14178. Specifies the exponent of the function.
  14179. Default to 1.8.
  14180. @item clip
  14181. Specify an extra linear coefficient to multiply into the signal before clipping.
  14182. Default to 1.0.
  14183. @item reinhard
  14184. Specify the local contrast coefficient at the display peak.
  14185. Default to 0.5, which means that in-gamut values will be about half as bright
  14186. as when clipping.
  14187. @item hable
  14188. Ignored.
  14189. @item mobius
  14190. Specify the transition point from linear to mobius transform. Every value
  14191. below this point is guaranteed to be mapped 1:1. The higher the value, the
  14192. more accurate the result will be, at the cost of losing bright details.
  14193. Default to 0.3, which due to the steep initial slope still preserves in-range
  14194. colors fairly accurately.
  14195. @end table
  14196. @item desat
  14197. Apply desaturation for highlights that exceed this level of brightness. The
  14198. higher the parameter, the more color information will be preserved. This
  14199. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14200. (smoothly) turning into white instead. This makes images feel more natural,
  14201. at the cost of reducing information about out-of-range colors.
  14202. The default of 2.0 is somewhat conservative and will mostly just apply to
  14203. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  14204. This option works only if the input frame has a supported color tag.
  14205. @item peak
  14206. Override signal/nominal/reference peak with this value. Useful when the
  14207. embedded peak information in display metadata is not reliable or when tone
  14208. mapping from a lower range to a higher range.
  14209. @end table
  14210. @section tpad
  14211. Temporarily pad video frames.
  14212. The filter accepts the following options:
  14213. @table @option
  14214. @item start
  14215. Specify number of delay frames before input video stream. Default is 0.
  14216. @item stop
  14217. Specify number of padding frames after input video stream.
  14218. Set to -1 to pad indefinitely. Default is 0.
  14219. @item start_mode
  14220. Set kind of frames added to beginning of stream.
  14221. Can be either @var{add} or @var{clone}.
  14222. With @var{add} frames of solid-color are added.
  14223. With @var{clone} frames are clones of first frame.
  14224. Default is @var{add}.
  14225. @item stop_mode
  14226. Set kind of frames added to end of stream.
  14227. Can be either @var{add} or @var{clone}.
  14228. With @var{add} frames of solid-color are added.
  14229. With @var{clone} frames are clones of last frame.
  14230. Default is @var{add}.
  14231. @item start_duration, stop_duration
  14232. Specify the duration of the start/stop delay. See
  14233. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14234. for the accepted syntax.
  14235. These options override @var{start} and @var{stop}. Default is 0.
  14236. @item color
  14237. Specify the color of the padded area. For the syntax of this option,
  14238. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14239. manual,ffmpeg-utils}.
  14240. The default value of @var{color} is "black".
  14241. @end table
  14242. @anchor{transpose}
  14243. @section transpose
  14244. Transpose rows with columns in the input video and optionally flip it.
  14245. It accepts the following parameters:
  14246. @table @option
  14247. @item dir
  14248. Specify the transposition direction.
  14249. Can assume the following values:
  14250. @table @samp
  14251. @item 0, 4, cclock_flip
  14252. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  14253. @example
  14254. L.R L.l
  14255. . . -> . .
  14256. l.r R.r
  14257. @end example
  14258. @item 1, 5, clock
  14259. Rotate by 90 degrees clockwise, that is:
  14260. @example
  14261. L.R l.L
  14262. . . -> . .
  14263. l.r r.R
  14264. @end example
  14265. @item 2, 6, cclock
  14266. Rotate by 90 degrees counterclockwise, that is:
  14267. @example
  14268. L.R R.r
  14269. . . -> . .
  14270. l.r L.l
  14271. @end example
  14272. @item 3, 7, clock_flip
  14273. Rotate by 90 degrees clockwise and vertically flip, that is:
  14274. @example
  14275. L.R r.R
  14276. . . -> . .
  14277. l.r l.L
  14278. @end example
  14279. @end table
  14280. For values between 4-7, the transposition is only done if the input
  14281. video geometry is portrait and not landscape. These values are
  14282. deprecated, the @code{passthrough} option should be used instead.
  14283. Numerical values are deprecated, and should be dropped in favor of
  14284. symbolic constants.
  14285. @item passthrough
  14286. Do not apply the transposition if the input geometry matches the one
  14287. specified by the specified value. It accepts the following values:
  14288. @table @samp
  14289. @item none
  14290. Always apply transposition.
  14291. @item portrait
  14292. Preserve portrait geometry (when @var{height} >= @var{width}).
  14293. @item landscape
  14294. Preserve landscape geometry (when @var{width} >= @var{height}).
  14295. @end table
  14296. Default value is @code{none}.
  14297. @end table
  14298. For example to rotate by 90 degrees clockwise and preserve portrait
  14299. layout:
  14300. @example
  14301. transpose=dir=1:passthrough=portrait
  14302. @end example
  14303. The command above can also be specified as:
  14304. @example
  14305. transpose=1:portrait
  14306. @end example
  14307. @section transpose_npp
  14308. Transpose rows with columns in the input video and optionally flip it.
  14309. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  14310. It accepts the following parameters:
  14311. @table @option
  14312. @item dir
  14313. Specify the transposition direction.
  14314. Can assume the following values:
  14315. @table @samp
  14316. @item cclock_flip
  14317. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  14318. @item clock
  14319. Rotate by 90 degrees clockwise.
  14320. @item cclock
  14321. Rotate by 90 degrees counterclockwise.
  14322. @item clock_flip
  14323. Rotate by 90 degrees clockwise and vertically flip.
  14324. @end table
  14325. @item passthrough
  14326. Do not apply the transposition if the input geometry matches the one
  14327. specified by the specified value. It accepts the following values:
  14328. @table @samp
  14329. @item none
  14330. Always apply transposition. (default)
  14331. @item portrait
  14332. Preserve portrait geometry (when @var{height} >= @var{width}).
  14333. @item landscape
  14334. Preserve landscape geometry (when @var{width} >= @var{height}).
  14335. @end table
  14336. @end table
  14337. @section trim
  14338. Trim the input so that the output contains one continuous subpart of the input.
  14339. It accepts the following parameters:
  14340. @table @option
  14341. @item start
  14342. Specify the time of the start of the kept section, i.e. the frame with the
  14343. timestamp @var{start} will be the first frame in the output.
  14344. @item end
  14345. Specify the time of the first frame that will be dropped, i.e. the frame
  14346. immediately preceding the one with the timestamp @var{end} will be the last
  14347. frame in the output.
  14348. @item start_pts
  14349. This is the same as @var{start}, except this option sets the start timestamp
  14350. in timebase units instead of seconds.
  14351. @item end_pts
  14352. This is the same as @var{end}, except this option sets the end timestamp
  14353. in timebase units instead of seconds.
  14354. @item duration
  14355. The maximum duration of the output in seconds.
  14356. @item start_frame
  14357. The number of the first frame that should be passed to the output.
  14358. @item end_frame
  14359. The number of the first frame that should be dropped.
  14360. @end table
  14361. @option{start}, @option{end}, and @option{duration} are expressed as time
  14362. duration specifications; see
  14363. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14364. for the accepted syntax.
  14365. Note that the first two sets of the start/end options and the @option{duration}
  14366. option look at the frame timestamp, while the _frame variants simply count the
  14367. frames that pass through the filter. Also note that this filter does not modify
  14368. the timestamps. If you wish for the output timestamps to start at zero, insert a
  14369. setpts filter after the trim filter.
  14370. If multiple start or end options are set, this filter tries to be greedy and
  14371. keep all the frames that match at least one of the specified constraints. To keep
  14372. only the part that matches all the constraints at once, chain multiple trim
  14373. filters.
  14374. The defaults are such that all the input is kept. So it is possible to set e.g.
  14375. just the end values to keep everything before the specified time.
  14376. Examples:
  14377. @itemize
  14378. @item
  14379. Drop everything except the second minute of input:
  14380. @example
  14381. ffmpeg -i INPUT -vf trim=60:120
  14382. @end example
  14383. @item
  14384. Keep only the first second:
  14385. @example
  14386. ffmpeg -i INPUT -vf trim=duration=1
  14387. @end example
  14388. @end itemize
  14389. @section unpremultiply
  14390. Apply alpha unpremultiply effect to input video stream using first plane
  14391. of second stream as alpha.
  14392. Both streams must have same dimensions and same pixel format.
  14393. The filter accepts the following option:
  14394. @table @option
  14395. @item planes
  14396. Set which planes will be processed, unprocessed planes will be copied.
  14397. By default value 0xf, all planes will be processed.
  14398. If the format has 1 or 2 components, then luma is bit 0.
  14399. If the format has 3 or 4 components:
  14400. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  14401. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  14402. If present, the alpha channel is always the last bit.
  14403. @item inplace
  14404. Do not require 2nd input for processing, instead use alpha plane from input stream.
  14405. @end table
  14406. @anchor{unsharp}
  14407. @section unsharp
  14408. Sharpen or blur the input video.
  14409. It accepts the following parameters:
  14410. @table @option
  14411. @item luma_msize_x, lx
  14412. Set the luma matrix horizontal size. It must be an odd integer between
  14413. 3 and 23. The default value is 5.
  14414. @item luma_msize_y, ly
  14415. Set the luma matrix vertical size. It must be an odd integer between 3
  14416. and 23. The default value is 5.
  14417. @item luma_amount, la
  14418. Set the luma effect strength. It must be a floating point number, reasonable
  14419. values lay between -1.5 and 1.5.
  14420. Negative values will blur the input video, while positive values will
  14421. sharpen it, a value of zero will disable the effect.
  14422. Default value is 1.0.
  14423. @item chroma_msize_x, cx
  14424. Set the chroma matrix horizontal size. It must be an odd integer
  14425. between 3 and 23. The default value is 5.
  14426. @item chroma_msize_y, cy
  14427. Set the chroma matrix vertical size. It must be an odd integer
  14428. between 3 and 23. The default value is 5.
  14429. @item chroma_amount, ca
  14430. Set the chroma effect strength. It must be a floating point number, reasonable
  14431. values lay between -1.5 and 1.5.
  14432. Negative values will blur the input video, while positive values will
  14433. sharpen it, a value of zero will disable the effect.
  14434. Default value is 0.0.
  14435. @end table
  14436. All parameters are optional and default to the equivalent of the
  14437. string '5:5:1.0:5:5:0.0'.
  14438. @subsection Examples
  14439. @itemize
  14440. @item
  14441. Apply strong luma sharpen effect:
  14442. @example
  14443. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  14444. @end example
  14445. @item
  14446. Apply a strong blur of both luma and chroma parameters:
  14447. @example
  14448. unsharp=7:7:-2:7:7:-2
  14449. @end example
  14450. @end itemize
  14451. @section uspp
  14452. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  14453. the image at several (or - in the case of @option{quality} level @code{8} - all)
  14454. shifts and average the results.
  14455. The way this differs from the behavior of spp is that uspp actually encodes &
  14456. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  14457. DCT similar to MJPEG.
  14458. The filter accepts the following options:
  14459. @table @option
  14460. @item quality
  14461. Set quality. This option defines the number of levels for averaging. It accepts
  14462. an integer in the range 0-8. If set to @code{0}, the filter will have no
  14463. effect. A value of @code{8} means the higher quality. For each increment of
  14464. that value the speed drops by a factor of approximately 2. Default value is
  14465. @code{3}.
  14466. @item qp
  14467. Force a constant quantization parameter. If not set, the filter will use the QP
  14468. from the video stream (if available).
  14469. @end table
  14470. @section v360
  14471. Convert 360 videos between various formats.
  14472. The filter accepts the following options:
  14473. @table @option
  14474. @item input
  14475. @item output
  14476. Set format of the input/output video.
  14477. Available formats:
  14478. @table @samp
  14479. @item e
  14480. @item equirect
  14481. Equirectangular projection.
  14482. @item c3x2
  14483. @item c6x1
  14484. @item c1x6
  14485. Cubemap with 3x2/6x1/1x6 layout.
  14486. Format specific options:
  14487. @table @option
  14488. @item in_pad
  14489. @item out_pad
  14490. Set padding proportion for the input/output cubemap. Values in decimals.
  14491. Example values:
  14492. @table @samp
  14493. @item 0
  14494. No padding.
  14495. @item 0.01
  14496. 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)
  14497. @end table
  14498. Default value is @b{@samp{0}}.
  14499. Maximum value is @b{@samp{0.1}}.
  14500. @item fin_pad
  14501. @item fout_pad
  14502. Set fixed padding for the input/output cubemap. Values in pixels.
  14503. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  14504. @item in_forder
  14505. @item out_forder
  14506. Set order of faces for the input/output cubemap. Choose one direction for each position.
  14507. Designation of directions:
  14508. @table @samp
  14509. @item r
  14510. right
  14511. @item l
  14512. left
  14513. @item u
  14514. up
  14515. @item d
  14516. down
  14517. @item f
  14518. forward
  14519. @item b
  14520. back
  14521. @end table
  14522. Default value is @b{@samp{rludfb}}.
  14523. @item in_frot
  14524. @item out_frot
  14525. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  14526. Designation of angles:
  14527. @table @samp
  14528. @item 0
  14529. 0 degrees clockwise
  14530. @item 1
  14531. 90 degrees clockwise
  14532. @item 2
  14533. 180 degrees clockwise
  14534. @item 3
  14535. 270 degrees clockwise
  14536. @end table
  14537. Default value is @b{@samp{000000}}.
  14538. @end table
  14539. @item eac
  14540. Equi-Angular Cubemap.
  14541. @item flat
  14542. @item gnomonic
  14543. @item rectilinear
  14544. Regular video.
  14545. Format specific options:
  14546. @table @option
  14547. @item h_fov
  14548. @item v_fov
  14549. @item d_fov
  14550. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14551. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14552. @item ih_fov
  14553. @item iv_fov
  14554. @item id_fov
  14555. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14556. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14557. @end table
  14558. @item dfisheye
  14559. Dual fisheye.
  14560. Format specific options:
  14561. @table @option
  14562. @item h_fov
  14563. @item v_fov
  14564. @item d_fov
  14565. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14566. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14567. @item ih_fov
  14568. @item iv_fov
  14569. @item id_fov
  14570. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14571. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14572. @end table
  14573. @item barrel
  14574. @item fb
  14575. @item barrelsplit
  14576. Facebook's 360 formats.
  14577. @item sg
  14578. Stereographic format.
  14579. Format specific options:
  14580. @table @option
  14581. @item h_fov
  14582. @item v_fov
  14583. @item d_fov
  14584. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14585. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14586. @item ih_fov
  14587. @item iv_fov
  14588. @item id_fov
  14589. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14590. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14591. @end table
  14592. @item mercator
  14593. Mercator format.
  14594. @item ball
  14595. Ball format, gives significant distortion toward the back.
  14596. @item hammer
  14597. Hammer-Aitoff map projection format.
  14598. @item sinusoidal
  14599. Sinusoidal map projection format.
  14600. @item fisheye
  14601. Fisheye projection.
  14602. Format specific options:
  14603. @table @option
  14604. @item h_fov
  14605. @item v_fov
  14606. @item d_fov
  14607. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14608. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14609. @item ih_fov
  14610. @item iv_fov
  14611. @item id_fov
  14612. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14613. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14614. @end table
  14615. @item pannini
  14616. Pannini projection.
  14617. Format specific options:
  14618. @table @option
  14619. @item h_fov
  14620. Set output pannini parameter.
  14621. @item ih_fov
  14622. Set input pannini parameter.
  14623. @end table
  14624. @item cylindrical
  14625. Cylindrical projection.
  14626. Format specific options:
  14627. @table @option
  14628. @item h_fov
  14629. @item v_fov
  14630. @item d_fov
  14631. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14632. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14633. @item ih_fov
  14634. @item iv_fov
  14635. @item id_fov
  14636. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14637. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14638. @end table
  14639. @item perspective
  14640. Perspective projection. @i{(output only)}
  14641. Format specific options:
  14642. @table @option
  14643. @item v_fov
  14644. Set perspective parameter.
  14645. @end table
  14646. @item tetrahedron
  14647. Tetrahedron projection.
  14648. @item tsp
  14649. Truncated square pyramid projection.
  14650. @item he
  14651. @item hequirect
  14652. Half equirectangular projection.
  14653. @end table
  14654. @item interp
  14655. Set interpolation method.@*
  14656. @i{Note: more complex interpolation methods require much more memory to run.}
  14657. Available methods:
  14658. @table @samp
  14659. @item near
  14660. @item nearest
  14661. Nearest neighbour.
  14662. @item line
  14663. @item linear
  14664. Bilinear interpolation.
  14665. @item lagrange9
  14666. Lagrange9 interpolation.
  14667. @item cube
  14668. @item cubic
  14669. Bicubic interpolation.
  14670. @item lanc
  14671. @item lanczos
  14672. Lanczos interpolation.
  14673. @item sp16
  14674. @item spline16
  14675. Spline16 interpolation.
  14676. @item gauss
  14677. @item gaussian
  14678. Gaussian interpolation.
  14679. @end table
  14680. Default value is @b{@samp{line}}.
  14681. @item w
  14682. @item h
  14683. Set the output video resolution.
  14684. Default resolution depends on formats.
  14685. @item in_stereo
  14686. @item out_stereo
  14687. Set the input/output stereo format.
  14688. @table @samp
  14689. @item 2d
  14690. 2D mono
  14691. @item sbs
  14692. Side by side
  14693. @item tb
  14694. Top bottom
  14695. @end table
  14696. Default value is @b{@samp{2d}} for input and output format.
  14697. @item yaw
  14698. @item pitch
  14699. @item roll
  14700. Set rotation for the output video. Values in degrees.
  14701. @item rorder
  14702. Set rotation order for the output video. Choose one item for each position.
  14703. @table @samp
  14704. @item y, Y
  14705. yaw
  14706. @item p, P
  14707. pitch
  14708. @item r, R
  14709. roll
  14710. @end table
  14711. Default value is @b{@samp{ypr}}.
  14712. @item h_flip
  14713. @item v_flip
  14714. @item d_flip
  14715. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  14716. @item ih_flip
  14717. @item iv_flip
  14718. Set if input video is flipped horizontally/vertically. Boolean values.
  14719. @item in_trans
  14720. Set if input video is transposed. Boolean value, by default disabled.
  14721. @item out_trans
  14722. Set if output video needs to be transposed. Boolean value, by default disabled.
  14723. @item alpha_mask
  14724. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  14725. @end table
  14726. @subsection Examples
  14727. @itemize
  14728. @item
  14729. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  14730. @example
  14731. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  14732. @end example
  14733. @item
  14734. Extract back view of Equi-Angular Cubemap:
  14735. @example
  14736. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  14737. @end example
  14738. @item
  14739. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  14740. @example
  14741. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  14742. @end example
  14743. @end itemize
  14744. @subsection Commands
  14745. This filter supports subset of above options as @ref{commands}.
  14746. @section vaguedenoiser
  14747. Apply a wavelet based denoiser.
  14748. It transforms each frame from the video input into the wavelet domain,
  14749. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  14750. the obtained coefficients. It does an inverse wavelet transform after.
  14751. Due to wavelet properties, it should give a nice smoothed result, and
  14752. reduced noise, without blurring picture features.
  14753. This filter accepts the following options:
  14754. @table @option
  14755. @item threshold
  14756. The filtering strength. The higher, the more filtered the video will be.
  14757. Hard thresholding can use a higher threshold than soft thresholding
  14758. before the video looks overfiltered. Default value is 2.
  14759. @item method
  14760. The filtering method the filter will use.
  14761. It accepts the following values:
  14762. @table @samp
  14763. @item hard
  14764. All values under the threshold will be zeroed.
  14765. @item soft
  14766. All values under the threshold will be zeroed. All values above will be
  14767. reduced by the threshold.
  14768. @item garrote
  14769. Scales or nullifies coefficients - intermediary between (more) soft and
  14770. (less) hard thresholding.
  14771. @end table
  14772. Default is garrote.
  14773. @item nsteps
  14774. Number of times, the wavelet will decompose the picture. Picture can't
  14775. be decomposed beyond a particular point (typically, 8 for a 640x480
  14776. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  14777. @item percent
  14778. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  14779. @item planes
  14780. A list of the planes to process. By default all planes are processed.
  14781. @end table
  14782. @section vectorscope
  14783. Display 2 color component values in the two dimensional graph (which is called
  14784. a vectorscope).
  14785. This filter accepts the following options:
  14786. @table @option
  14787. @item mode, m
  14788. Set vectorscope mode.
  14789. It accepts the following values:
  14790. @table @samp
  14791. @item gray
  14792. @item tint
  14793. Gray values are displayed on graph, higher brightness means more pixels have
  14794. same component color value on location in graph. This is the default mode.
  14795. @item color
  14796. Gray values are displayed on graph. Surrounding pixels values which are not
  14797. present in video frame are drawn in gradient of 2 color components which are
  14798. set by option @code{x} and @code{y}. The 3rd color component is static.
  14799. @item color2
  14800. Actual color components values present in video frame are displayed on graph.
  14801. @item color3
  14802. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  14803. on graph increases value of another color component, which is luminance by
  14804. default values of @code{x} and @code{y}.
  14805. @item color4
  14806. Actual colors present in video frame are displayed on graph. If two different
  14807. colors map to same position on graph then color with higher value of component
  14808. not present in graph is picked.
  14809. @item color5
  14810. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  14811. component picked from radial gradient.
  14812. @end table
  14813. @item x
  14814. Set which color component will be represented on X-axis. Default is @code{1}.
  14815. @item y
  14816. Set which color component will be represented on Y-axis. Default is @code{2}.
  14817. @item intensity, i
  14818. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  14819. of color component which represents frequency of (X, Y) location in graph.
  14820. @item envelope, e
  14821. @table @samp
  14822. @item none
  14823. No envelope, this is default.
  14824. @item instant
  14825. Instant envelope, even darkest single pixel will be clearly highlighted.
  14826. @item peak
  14827. Hold maximum and minimum values presented in graph over time. This way you
  14828. can still spot out of range values without constantly looking at vectorscope.
  14829. @item peak+instant
  14830. Peak and instant envelope combined together.
  14831. @end table
  14832. @item graticule, g
  14833. Set what kind of graticule to draw.
  14834. @table @samp
  14835. @item none
  14836. @item green
  14837. @item color
  14838. @item invert
  14839. @end table
  14840. @item opacity, o
  14841. Set graticule opacity.
  14842. @item flags, f
  14843. Set graticule flags.
  14844. @table @samp
  14845. @item white
  14846. Draw graticule for white point.
  14847. @item black
  14848. Draw graticule for black point.
  14849. @item name
  14850. Draw color points short names.
  14851. @end table
  14852. @item bgopacity, b
  14853. Set background opacity.
  14854. @item lthreshold, l
  14855. Set low threshold for color component not represented on X or Y axis.
  14856. Values lower than this value will be ignored. Default is 0.
  14857. Note this value is multiplied with actual max possible value one pixel component
  14858. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  14859. is 0.1 * 255 = 25.
  14860. @item hthreshold, h
  14861. Set high threshold for color component not represented on X or Y axis.
  14862. Values higher than this value will be ignored. Default is 1.
  14863. Note this value is multiplied with actual max possible value one pixel component
  14864. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  14865. is 0.9 * 255 = 230.
  14866. @item colorspace, c
  14867. Set what kind of colorspace to use when drawing graticule.
  14868. @table @samp
  14869. @item auto
  14870. @item 601
  14871. @item 709
  14872. @end table
  14873. Default is auto.
  14874. @item tint0, t0
  14875. @item tint1, t1
  14876. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  14877. This means no tint, and output will remain gray.
  14878. @end table
  14879. @anchor{vidstabdetect}
  14880. @section vidstabdetect
  14881. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  14882. @ref{vidstabtransform} for pass 2.
  14883. This filter generates a file with relative translation and rotation
  14884. transform information about subsequent frames, which is then used by
  14885. the @ref{vidstabtransform} filter.
  14886. To enable compilation of this filter you need to configure FFmpeg with
  14887. @code{--enable-libvidstab}.
  14888. This filter accepts the following options:
  14889. @table @option
  14890. @item result
  14891. Set the path to the file used to write the transforms information.
  14892. Default value is @file{transforms.trf}.
  14893. @item shakiness
  14894. Set how shaky the video is and how quick the camera is. It accepts an
  14895. integer in the range 1-10, a value of 1 means little shakiness, a
  14896. value of 10 means strong shakiness. Default value is 5.
  14897. @item accuracy
  14898. Set the accuracy of the detection process. It must be a value in the
  14899. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  14900. accuracy. Default value is 15.
  14901. @item stepsize
  14902. Set stepsize of the search process. The region around minimum is
  14903. scanned with 1 pixel resolution. Default value is 6.
  14904. @item mincontrast
  14905. Set minimum contrast. Below this value a local measurement field is
  14906. discarded. Must be a floating point value in the range 0-1. Default
  14907. value is 0.3.
  14908. @item tripod
  14909. Set reference frame number for tripod mode.
  14910. If enabled, the motion of the frames is compared to a reference frame
  14911. in the filtered stream, identified by the specified number. The idea
  14912. is to compensate all movements in a more-or-less static scene and keep
  14913. the camera view absolutely still.
  14914. If set to 0, it is disabled. The frames are counted starting from 1.
  14915. @item show
  14916. Show fields and transforms in the resulting frames. It accepts an
  14917. integer in the range 0-2. Default value is 0, which disables any
  14918. visualization.
  14919. @end table
  14920. @subsection Examples
  14921. @itemize
  14922. @item
  14923. Use default values:
  14924. @example
  14925. vidstabdetect
  14926. @end example
  14927. @item
  14928. Analyze strongly shaky movie and put the results in file
  14929. @file{mytransforms.trf}:
  14930. @example
  14931. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  14932. @end example
  14933. @item
  14934. Visualize the result of internal transformations in the resulting
  14935. video:
  14936. @example
  14937. vidstabdetect=show=1
  14938. @end example
  14939. @item
  14940. Analyze a video with medium shakiness using @command{ffmpeg}:
  14941. @example
  14942. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  14943. @end example
  14944. @end itemize
  14945. @anchor{vidstabtransform}
  14946. @section vidstabtransform
  14947. Video stabilization/deshaking: pass 2 of 2,
  14948. see @ref{vidstabdetect} for pass 1.
  14949. Read a file with transform information for each frame and
  14950. apply/compensate them. Together with the @ref{vidstabdetect}
  14951. filter this can be used to deshake videos. See also
  14952. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  14953. the @ref{unsharp} filter, see below.
  14954. To enable compilation of this filter you need to configure FFmpeg with
  14955. @code{--enable-libvidstab}.
  14956. @subsection Options
  14957. @table @option
  14958. @item input
  14959. Set path to the file used to read the transforms. Default value is
  14960. @file{transforms.trf}.
  14961. @item smoothing
  14962. Set the number of frames (value*2 + 1) used for lowpass filtering the
  14963. camera movements. Default value is 10.
  14964. For example a number of 10 means that 21 frames are used (10 in the
  14965. past and 10 in the future) to smoothen the motion in the video. A
  14966. larger value leads to a smoother video, but limits the acceleration of
  14967. the camera (pan/tilt movements). 0 is a special case where a static
  14968. camera is simulated.
  14969. @item optalgo
  14970. Set the camera path optimization algorithm.
  14971. Accepted values are:
  14972. @table @samp
  14973. @item gauss
  14974. gaussian kernel low-pass filter on camera motion (default)
  14975. @item avg
  14976. averaging on transformations
  14977. @end table
  14978. @item maxshift
  14979. Set maximal number of pixels to translate frames. Default value is -1,
  14980. meaning no limit.
  14981. @item maxangle
  14982. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  14983. value is -1, meaning no limit.
  14984. @item crop
  14985. Specify how to deal with borders that may be visible due to movement
  14986. compensation.
  14987. Available values are:
  14988. @table @samp
  14989. @item keep
  14990. keep image information from previous frame (default)
  14991. @item black
  14992. fill the border black
  14993. @end table
  14994. @item invert
  14995. Invert transforms if set to 1. Default value is 0.
  14996. @item relative
  14997. Consider transforms as relative to previous frame if set to 1,
  14998. absolute if set to 0. Default value is 0.
  14999. @item zoom
  15000. Set percentage to zoom. A positive value will result in a zoom-in
  15001. effect, a negative value in a zoom-out effect. Default value is 0 (no
  15002. zoom).
  15003. @item optzoom
  15004. Set optimal zooming to avoid borders.
  15005. Accepted values are:
  15006. @table @samp
  15007. @item 0
  15008. disabled
  15009. @item 1
  15010. optimal static zoom value is determined (only very strong movements
  15011. will lead to visible borders) (default)
  15012. @item 2
  15013. optimal adaptive zoom value is determined (no borders will be
  15014. visible), see @option{zoomspeed}
  15015. @end table
  15016. Note that the value given at zoom is added to the one calculated here.
  15017. @item zoomspeed
  15018. Set percent to zoom maximally each frame (enabled when
  15019. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  15020. 0.25.
  15021. @item interpol
  15022. Specify type of interpolation.
  15023. Available values are:
  15024. @table @samp
  15025. @item no
  15026. no interpolation
  15027. @item linear
  15028. linear only horizontal
  15029. @item bilinear
  15030. linear in both directions (default)
  15031. @item bicubic
  15032. cubic in both directions (slow)
  15033. @end table
  15034. @item tripod
  15035. Enable virtual tripod mode if set to 1, which is equivalent to
  15036. @code{relative=0:smoothing=0}. Default value is 0.
  15037. Use also @code{tripod} option of @ref{vidstabdetect}.
  15038. @item debug
  15039. Increase log verbosity if set to 1. Also the detected global motions
  15040. are written to the temporary file @file{global_motions.trf}. Default
  15041. value is 0.
  15042. @end table
  15043. @subsection Examples
  15044. @itemize
  15045. @item
  15046. Use @command{ffmpeg} for a typical stabilization with default values:
  15047. @example
  15048. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  15049. @end example
  15050. Note the use of the @ref{unsharp} filter which is always recommended.
  15051. @item
  15052. Zoom in a bit more and load transform data from a given file:
  15053. @example
  15054. vidstabtransform=zoom=5:input="mytransforms.trf"
  15055. @end example
  15056. @item
  15057. Smoothen the video even more:
  15058. @example
  15059. vidstabtransform=smoothing=30
  15060. @end example
  15061. @end itemize
  15062. @section vflip
  15063. Flip the input video vertically.
  15064. For example, to vertically flip a video with @command{ffmpeg}:
  15065. @example
  15066. ffmpeg -i in.avi -vf "vflip" out.avi
  15067. @end example
  15068. @section vfrdet
  15069. Detect variable frame rate video.
  15070. This filter tries to detect if the input is variable or constant frame rate.
  15071. At end it will output number of frames detected as having variable delta pts,
  15072. and ones with constant delta pts.
  15073. If there was frames with variable delta, than it will also show min, max and
  15074. average delta encountered.
  15075. @section vibrance
  15076. Boost or alter saturation.
  15077. The filter accepts the following options:
  15078. @table @option
  15079. @item intensity
  15080. Set strength of boost if positive value or strength of alter if negative value.
  15081. Default is 0. Allowed range is from -2 to 2.
  15082. @item rbal
  15083. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  15084. @item gbal
  15085. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  15086. @item bbal
  15087. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  15088. @item rlum
  15089. Set the red luma coefficient.
  15090. @item glum
  15091. Set the green luma coefficient.
  15092. @item blum
  15093. Set the blue luma coefficient.
  15094. @item alternate
  15095. If @code{intensity} is negative and this is set to 1, colors will change,
  15096. otherwise colors will be less saturated, more towards gray.
  15097. @end table
  15098. @subsection Commands
  15099. This filter supports the all above options as @ref{commands}.
  15100. @anchor{vignette}
  15101. @section vignette
  15102. Make or reverse a natural vignetting effect.
  15103. The filter accepts the following options:
  15104. @table @option
  15105. @item angle, a
  15106. Set lens angle expression as a number of radians.
  15107. The value is clipped in the @code{[0,PI/2]} range.
  15108. Default value: @code{"PI/5"}
  15109. @item x0
  15110. @item y0
  15111. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  15112. by default.
  15113. @item mode
  15114. Set forward/backward mode.
  15115. Available modes are:
  15116. @table @samp
  15117. @item forward
  15118. The larger the distance from the central point, the darker the image becomes.
  15119. @item backward
  15120. The larger the distance from the central point, the brighter the image becomes.
  15121. This can be used to reverse a vignette effect, though there is no automatic
  15122. detection to extract the lens @option{angle} and other settings (yet). It can
  15123. also be used to create a burning effect.
  15124. @end table
  15125. Default value is @samp{forward}.
  15126. @item eval
  15127. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  15128. It accepts the following values:
  15129. @table @samp
  15130. @item init
  15131. Evaluate expressions only once during the filter initialization.
  15132. @item frame
  15133. Evaluate expressions for each incoming frame. This is way slower than the
  15134. @samp{init} mode since it requires all the scalers to be re-computed, but it
  15135. allows advanced dynamic expressions.
  15136. @end table
  15137. Default value is @samp{init}.
  15138. @item dither
  15139. Set dithering to reduce the circular banding effects. Default is @code{1}
  15140. (enabled).
  15141. @item aspect
  15142. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  15143. Setting this value to the SAR of the input will make a rectangular vignetting
  15144. following the dimensions of the video.
  15145. Default is @code{1/1}.
  15146. @end table
  15147. @subsection Expressions
  15148. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  15149. following parameters.
  15150. @table @option
  15151. @item w
  15152. @item h
  15153. input width and height
  15154. @item n
  15155. the number of input frame, starting from 0
  15156. @item pts
  15157. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  15158. @var{TB} units, NAN if undefined
  15159. @item r
  15160. frame rate of the input video, NAN if the input frame rate is unknown
  15161. @item t
  15162. the PTS (Presentation TimeStamp) of the filtered video frame,
  15163. expressed in seconds, NAN if undefined
  15164. @item tb
  15165. time base of the input video
  15166. @end table
  15167. @subsection Examples
  15168. @itemize
  15169. @item
  15170. Apply simple strong vignetting effect:
  15171. @example
  15172. vignette=PI/4
  15173. @end example
  15174. @item
  15175. Make a flickering vignetting:
  15176. @example
  15177. vignette='PI/4+random(1)*PI/50':eval=frame
  15178. @end example
  15179. @end itemize
  15180. @section vmafmotion
  15181. Obtain the average VMAF motion score of a video.
  15182. It is one of the component metrics of VMAF.
  15183. The obtained average motion score is printed through the logging system.
  15184. The filter accepts the following options:
  15185. @table @option
  15186. @item stats_file
  15187. If specified, the filter will use the named file to save the motion score of
  15188. each frame with respect to the previous frame.
  15189. When filename equals "-" the data is sent to standard output.
  15190. @end table
  15191. Example:
  15192. @example
  15193. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  15194. @end example
  15195. @section vstack
  15196. Stack input videos vertically.
  15197. All streams must be of same pixel format and of same width.
  15198. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  15199. to create same output.
  15200. The filter accepts the following options:
  15201. @table @option
  15202. @item inputs
  15203. Set number of input streams. Default is 2.
  15204. @item shortest
  15205. If set to 1, force the output to terminate when the shortest input
  15206. terminates. Default value is 0.
  15207. @end table
  15208. @section w3fdif
  15209. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  15210. Deinterlacing Filter").
  15211. Based on the process described by Martin Weston for BBC R&D, and
  15212. implemented based on the de-interlace algorithm written by Jim
  15213. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  15214. uses filter coefficients calculated by BBC R&D.
  15215. This filter uses field-dominance information in frame to decide which
  15216. of each pair of fields to place first in the output.
  15217. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  15218. There are two sets of filter coefficients, so called "simple"
  15219. and "complex". Which set of filter coefficients is used can
  15220. be set by passing an optional parameter:
  15221. @table @option
  15222. @item filter
  15223. Set the interlacing filter coefficients. Accepts one of the following values:
  15224. @table @samp
  15225. @item simple
  15226. Simple filter coefficient set.
  15227. @item complex
  15228. More-complex filter coefficient set.
  15229. @end table
  15230. Default value is @samp{complex}.
  15231. @item deint
  15232. Specify which frames to deinterlace. Accepts one of the following values:
  15233. @table @samp
  15234. @item all
  15235. Deinterlace all frames,
  15236. @item interlaced
  15237. Only deinterlace frames marked as interlaced.
  15238. @end table
  15239. Default value is @samp{all}.
  15240. @end table
  15241. @section waveform
  15242. Video waveform monitor.
  15243. The waveform monitor plots color component intensity. By default luminance
  15244. only. Each column of the waveform corresponds to a column of pixels in the
  15245. source video.
  15246. It accepts the following options:
  15247. @table @option
  15248. @item mode, m
  15249. Can be either @code{row}, or @code{column}. Default is @code{column}.
  15250. In row mode, the graph on the left side represents color component value 0 and
  15251. the right side represents value = 255. In column mode, the top side represents
  15252. color component value = 0 and bottom side represents value = 255.
  15253. @item intensity, i
  15254. Set intensity. Smaller values are useful to find out how many values of the same
  15255. luminance are distributed across input rows/columns.
  15256. Default value is @code{0.04}. Allowed range is [0, 1].
  15257. @item mirror, r
  15258. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  15259. In mirrored mode, higher values will be represented on the left
  15260. side for @code{row} mode and at the top for @code{column} mode. Default is
  15261. @code{1} (mirrored).
  15262. @item display, d
  15263. Set display mode.
  15264. It accepts the following values:
  15265. @table @samp
  15266. @item overlay
  15267. Presents information identical to that in the @code{parade}, except
  15268. that the graphs representing color components are superimposed directly
  15269. over one another.
  15270. This display mode makes it easier to spot relative differences or similarities
  15271. in overlapping areas of the color components that are supposed to be identical,
  15272. such as neutral whites, grays, or blacks.
  15273. @item stack
  15274. Display separate graph for the color components side by side in
  15275. @code{row} mode or one below the other in @code{column} mode.
  15276. @item parade
  15277. Display separate graph for the color components side by side in
  15278. @code{column} mode or one below the other in @code{row} mode.
  15279. Using this display mode makes it easy to spot color casts in the highlights
  15280. and shadows of an image, by comparing the contours of the top and the bottom
  15281. graphs of each waveform. Since whites, grays, and blacks are characterized
  15282. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  15283. should display three waveforms of roughly equal width/height. If not, the
  15284. correction is easy to perform by making level adjustments the three waveforms.
  15285. @end table
  15286. Default is @code{stack}.
  15287. @item components, c
  15288. Set which color components to display. Default is 1, which means only luminance
  15289. or red color component if input is in RGB colorspace. If is set for example to
  15290. 7 it will display all 3 (if) available color components.
  15291. @item envelope, e
  15292. @table @samp
  15293. @item none
  15294. No envelope, this is default.
  15295. @item instant
  15296. Instant envelope, minimum and maximum values presented in graph will be easily
  15297. visible even with small @code{step} value.
  15298. @item peak
  15299. Hold minimum and maximum values presented in graph across time. This way you
  15300. can still spot out of range values without constantly looking at waveforms.
  15301. @item peak+instant
  15302. Peak and instant envelope combined together.
  15303. @end table
  15304. @item filter, f
  15305. @table @samp
  15306. @item lowpass
  15307. No filtering, this is default.
  15308. @item flat
  15309. Luma and chroma combined together.
  15310. @item aflat
  15311. Similar as above, but shows difference between blue and red chroma.
  15312. @item xflat
  15313. Similar as above, but use different colors.
  15314. @item yflat
  15315. Similar as above, but again with different colors.
  15316. @item chroma
  15317. Displays only chroma.
  15318. @item color
  15319. Displays actual color value on waveform.
  15320. @item acolor
  15321. Similar as above, but with luma showing frequency of chroma values.
  15322. @end table
  15323. @item graticule, g
  15324. Set which graticule to display.
  15325. @table @samp
  15326. @item none
  15327. Do not display graticule.
  15328. @item green
  15329. Display green graticule showing legal broadcast ranges.
  15330. @item orange
  15331. Display orange graticule showing legal broadcast ranges.
  15332. @item invert
  15333. Display invert graticule showing legal broadcast ranges.
  15334. @end table
  15335. @item opacity, o
  15336. Set graticule opacity.
  15337. @item flags, fl
  15338. Set graticule flags.
  15339. @table @samp
  15340. @item numbers
  15341. Draw numbers above lines. By default enabled.
  15342. @item dots
  15343. Draw dots instead of lines.
  15344. @end table
  15345. @item scale, s
  15346. Set scale used for displaying graticule.
  15347. @table @samp
  15348. @item digital
  15349. @item millivolts
  15350. @item ire
  15351. @end table
  15352. Default is digital.
  15353. @item bgopacity, b
  15354. Set background opacity.
  15355. @item tint0, t0
  15356. @item tint1, t1
  15357. Set tint for output.
  15358. Only used with lowpass filter and when display is not overlay and input
  15359. pixel formats are not RGB.
  15360. @end table
  15361. @section weave, doubleweave
  15362. The @code{weave} takes a field-based video input and join
  15363. each two sequential fields into single frame, producing a new double
  15364. height clip with half the frame rate and half the frame count.
  15365. The @code{doubleweave} works same as @code{weave} but without
  15366. halving frame rate and frame count.
  15367. It accepts the following option:
  15368. @table @option
  15369. @item first_field
  15370. Set first field. Available values are:
  15371. @table @samp
  15372. @item top, t
  15373. Set the frame as top-field-first.
  15374. @item bottom, b
  15375. Set the frame as bottom-field-first.
  15376. @end table
  15377. @end table
  15378. @subsection Examples
  15379. @itemize
  15380. @item
  15381. Interlace video using @ref{select} and @ref{separatefields} filter:
  15382. @example
  15383. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  15384. @end example
  15385. @end itemize
  15386. @section xbr
  15387. Apply the xBR high-quality magnification filter which is designed for pixel
  15388. art. It follows a set of edge-detection rules, see
  15389. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  15390. It accepts the following option:
  15391. @table @option
  15392. @item n
  15393. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  15394. @code{3xBR} and @code{4} for @code{4xBR}.
  15395. Default is @code{3}.
  15396. @end table
  15397. @section xfade
  15398. Apply cross fade from one input video stream to another input video stream.
  15399. The cross fade is applied for specified duration.
  15400. The filter accepts the following options:
  15401. @table @option
  15402. @item transition
  15403. Set one of available transition effects:
  15404. @table @samp
  15405. @item custom
  15406. @item fade
  15407. @item wipeleft
  15408. @item wiperight
  15409. @item wipeup
  15410. @item wipedown
  15411. @item slideleft
  15412. @item slideright
  15413. @item slideup
  15414. @item slidedown
  15415. @item circlecrop
  15416. @item rectcrop
  15417. @item distance
  15418. @item fadeblack
  15419. @item fadewhite
  15420. @item radial
  15421. @item smoothleft
  15422. @item smoothright
  15423. @item smoothup
  15424. @item smoothdown
  15425. @item circleopen
  15426. @item circleclose
  15427. @item vertopen
  15428. @item vertclose
  15429. @item horzopen
  15430. @item horzclose
  15431. @item dissolve
  15432. @item pixelize
  15433. @item diagtl
  15434. @item diagtr
  15435. @item diagbl
  15436. @item diagbr
  15437. @item hlslice
  15438. @item hrslice
  15439. @item vuslice
  15440. @item vdslice
  15441. @end table
  15442. Default transition effect is fade.
  15443. @item duration
  15444. Set cross fade duration in seconds.
  15445. Default duration is 1 second.
  15446. @item offset
  15447. Set cross fade start relative to first input stream in seconds.
  15448. Default offset is 0.
  15449. @item expr
  15450. Set expression for custom transition effect.
  15451. The expressions can use the following variables and functions:
  15452. @table @option
  15453. @item X
  15454. @item Y
  15455. The coordinates of the current sample.
  15456. @item W
  15457. @item H
  15458. The width and height of the image.
  15459. @item P
  15460. Progress of transition effect.
  15461. @item PLANE
  15462. Currently processed plane.
  15463. @item A
  15464. Return value of first input at current location and plane.
  15465. @item B
  15466. Return value of second input at current location and plane.
  15467. @item a0(x, y)
  15468. @item a1(x, y)
  15469. @item a2(x, y)
  15470. @item a3(x, y)
  15471. Return the value of the pixel at location (@var{x},@var{y}) of the
  15472. first/second/third/fourth component of first input.
  15473. @item b0(x, y)
  15474. @item b1(x, y)
  15475. @item b2(x, y)
  15476. @item b3(x, y)
  15477. Return the value of the pixel at location (@var{x},@var{y}) of the
  15478. first/second/third/fourth component of second input.
  15479. @end table
  15480. @end table
  15481. @subsection Examples
  15482. @itemize
  15483. @item
  15484. Cross fade from one input video to another input video, with fade transition and duration of transition
  15485. of 2 seconds starting at offset of 5 seconds:
  15486. @example
  15487. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  15488. @end example
  15489. @end itemize
  15490. @section xmedian
  15491. Pick median pixels from several input videos.
  15492. The filter accepts the following options:
  15493. @table @option
  15494. @item inputs
  15495. Set number of inputs.
  15496. Default is 3. Allowed range is from 3 to 255.
  15497. If number of inputs is even number, than result will be mean value between two median values.
  15498. @item planes
  15499. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  15500. @item percentile
  15501. Set median percentile. Default value is @code{0.5}.
  15502. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  15503. minimum values, and @code{1} maximum values.
  15504. @end table
  15505. @section xstack
  15506. Stack video inputs into custom layout.
  15507. All streams must be of same pixel format.
  15508. The filter accepts the following options:
  15509. @table @option
  15510. @item inputs
  15511. Set number of input streams. Default is 2.
  15512. @item layout
  15513. Specify layout of inputs.
  15514. This option requires the desired layout configuration to be explicitly set by the user.
  15515. This sets position of each video input in output. Each input
  15516. is separated by '|'.
  15517. The first number represents the column, and the second number represents the row.
  15518. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  15519. where X is video input from which to take width or height.
  15520. Multiple values can be used when separated by '+'. In such
  15521. case values are summed together.
  15522. Note that if inputs are of different sizes gaps may appear, as not all of
  15523. the output video frame will be filled. Similarly, videos can overlap each
  15524. other if their position doesn't leave enough space for the full frame of
  15525. adjoining videos.
  15526. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  15527. a layout must be set by the user.
  15528. @item shortest
  15529. If set to 1, force the output to terminate when the shortest input
  15530. terminates. Default value is 0.
  15531. @item fill
  15532. If set to valid color, all unused pixels will be filled with that color.
  15533. By default fill is set to none, so it is disabled.
  15534. @end table
  15535. @subsection Examples
  15536. @itemize
  15537. @item
  15538. Display 4 inputs into 2x2 grid.
  15539. Layout:
  15540. @example
  15541. input1(0, 0) | input3(w0, 0)
  15542. input2(0, h0) | input4(w0, h0)
  15543. @end example
  15544. @example
  15545. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  15546. @end example
  15547. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15548. @item
  15549. Display 4 inputs into 1x4 grid.
  15550. Layout:
  15551. @example
  15552. input1(0, 0)
  15553. input2(0, h0)
  15554. input3(0, h0+h1)
  15555. input4(0, h0+h1+h2)
  15556. @end example
  15557. @example
  15558. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  15559. @end example
  15560. Note that if inputs are of different widths, unused space will appear.
  15561. @item
  15562. Display 9 inputs into 3x3 grid.
  15563. Layout:
  15564. @example
  15565. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  15566. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  15567. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  15568. @end example
  15569. @example
  15570. 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
  15571. @end example
  15572. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15573. @item
  15574. Display 16 inputs into 4x4 grid.
  15575. Layout:
  15576. @example
  15577. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  15578. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  15579. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  15580. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  15581. @end example
  15582. @example
  15583. 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|
  15584. 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
  15585. @end example
  15586. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15587. @end itemize
  15588. @anchor{yadif}
  15589. @section yadif
  15590. Deinterlace the input video ("yadif" means "yet another deinterlacing
  15591. filter").
  15592. It accepts the following parameters:
  15593. @table @option
  15594. @item mode
  15595. The interlacing mode to adopt. It accepts one of the following values:
  15596. @table @option
  15597. @item 0, send_frame
  15598. Output one frame for each frame.
  15599. @item 1, send_field
  15600. Output one frame for each field.
  15601. @item 2, send_frame_nospatial
  15602. Like @code{send_frame}, but it skips the spatial interlacing check.
  15603. @item 3, send_field_nospatial
  15604. Like @code{send_field}, but it skips the spatial interlacing check.
  15605. @end table
  15606. The default value is @code{send_frame}.
  15607. @item parity
  15608. The picture field parity assumed for the input interlaced video. It accepts one
  15609. of the following values:
  15610. @table @option
  15611. @item 0, tff
  15612. Assume the top field is first.
  15613. @item 1, bff
  15614. Assume the bottom field is first.
  15615. @item -1, auto
  15616. Enable automatic detection of field parity.
  15617. @end table
  15618. The default value is @code{auto}.
  15619. If the interlacing is unknown or the decoder does not export this information,
  15620. top field first will be assumed.
  15621. @item deint
  15622. Specify which frames to deinterlace. Accepts one of the following
  15623. values:
  15624. @table @option
  15625. @item 0, all
  15626. Deinterlace all frames.
  15627. @item 1, interlaced
  15628. Only deinterlace frames marked as interlaced.
  15629. @end table
  15630. The default value is @code{all}.
  15631. @end table
  15632. @section yadif_cuda
  15633. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  15634. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  15635. and/or nvenc.
  15636. It accepts the following parameters:
  15637. @table @option
  15638. @item mode
  15639. The interlacing mode to adopt. It accepts one of the following values:
  15640. @table @option
  15641. @item 0, send_frame
  15642. Output one frame for each frame.
  15643. @item 1, send_field
  15644. Output one frame for each field.
  15645. @item 2, send_frame_nospatial
  15646. Like @code{send_frame}, but it skips the spatial interlacing check.
  15647. @item 3, send_field_nospatial
  15648. Like @code{send_field}, but it skips the spatial interlacing check.
  15649. @end table
  15650. The default value is @code{send_frame}.
  15651. @item parity
  15652. The picture field parity assumed for the input interlaced video. It accepts one
  15653. of the following values:
  15654. @table @option
  15655. @item 0, tff
  15656. Assume the top field is first.
  15657. @item 1, bff
  15658. Assume the bottom field is first.
  15659. @item -1, auto
  15660. Enable automatic detection of field parity.
  15661. @end table
  15662. The default value is @code{auto}.
  15663. If the interlacing is unknown or the decoder does not export this information,
  15664. top field first will be assumed.
  15665. @item deint
  15666. Specify which frames to deinterlace. Accepts one of the following
  15667. values:
  15668. @table @option
  15669. @item 0, all
  15670. Deinterlace all frames.
  15671. @item 1, interlaced
  15672. Only deinterlace frames marked as interlaced.
  15673. @end table
  15674. The default value is @code{all}.
  15675. @end table
  15676. @section yaepblur
  15677. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  15678. The algorithm is described in
  15679. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  15680. It accepts the following parameters:
  15681. @table @option
  15682. @item radius, r
  15683. Set the window radius. Default value is 3.
  15684. @item planes, p
  15685. Set which planes to filter. Default is only the first plane.
  15686. @item sigma, s
  15687. Set blur strength. Default value is 128.
  15688. @end table
  15689. @subsection Commands
  15690. This filter supports same @ref{commands} as options.
  15691. @section zoompan
  15692. Apply Zoom & Pan effect.
  15693. This filter accepts the following options:
  15694. @table @option
  15695. @item zoom, z
  15696. Set the zoom expression. Range is 1-10. Default is 1.
  15697. @item x
  15698. @item y
  15699. Set the x and y expression. Default is 0.
  15700. @item d
  15701. Set the duration expression in number of frames.
  15702. This sets for how many number of frames effect will last for
  15703. single input image.
  15704. @item s
  15705. Set the output image size, default is 'hd720'.
  15706. @item fps
  15707. Set the output frame rate, default is '25'.
  15708. @end table
  15709. Each expression can contain the following constants:
  15710. @table @option
  15711. @item in_w, iw
  15712. Input width.
  15713. @item in_h, ih
  15714. Input height.
  15715. @item out_w, ow
  15716. Output width.
  15717. @item out_h, oh
  15718. Output height.
  15719. @item in
  15720. Input frame count.
  15721. @item on
  15722. Output frame count.
  15723. @item x
  15724. @item y
  15725. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  15726. for current input frame.
  15727. @item px
  15728. @item py
  15729. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  15730. not yet such frame (first input frame).
  15731. @item zoom
  15732. Last calculated zoom from 'z' expression for current input frame.
  15733. @item pzoom
  15734. Last calculated zoom of last output frame of previous input frame.
  15735. @item duration
  15736. Number of output frames for current input frame. Calculated from 'd' expression
  15737. for each input frame.
  15738. @item pduration
  15739. number of output frames created for previous input frame
  15740. @item a
  15741. Rational number: input width / input height
  15742. @item sar
  15743. sample aspect ratio
  15744. @item dar
  15745. display aspect ratio
  15746. @end table
  15747. @subsection Examples
  15748. @itemize
  15749. @item
  15750. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  15751. @example
  15752. 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
  15753. @end example
  15754. @item
  15755. Zoom-in up to 1.5 and pan always at center of picture:
  15756. @example
  15757. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  15758. @end example
  15759. @item
  15760. Same as above but without pausing:
  15761. @example
  15762. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  15763. @end example
  15764. @end itemize
  15765. @anchor{zscale}
  15766. @section zscale
  15767. Scale (resize) the input video, using the z.lib library:
  15768. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  15769. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  15770. The zscale filter forces the output display aspect ratio to be the same
  15771. as the input, by changing the output sample aspect ratio.
  15772. If the input image format is different from the format requested by
  15773. the next filter, the zscale filter will convert the input to the
  15774. requested format.
  15775. @subsection Options
  15776. The filter accepts the following options.
  15777. @table @option
  15778. @item width, w
  15779. @item height, h
  15780. Set the output video dimension expression. Default value is the input
  15781. dimension.
  15782. If the @var{width} or @var{w} value is 0, the input width is used for
  15783. the output. If the @var{height} or @var{h} value is 0, the input height
  15784. is used for the output.
  15785. If one and only one of the values is -n with n >= 1, the zscale filter
  15786. will use a value that maintains the aspect ratio of the input image,
  15787. calculated from the other specified dimension. After that it will,
  15788. however, make sure that the calculated dimension is divisible by n and
  15789. adjust the value if necessary.
  15790. If both values are -n with n >= 1, the behavior will be identical to
  15791. both values being set to 0 as previously detailed.
  15792. See below for the list of accepted constants for use in the dimension
  15793. expression.
  15794. @item size, s
  15795. Set the video size. For the syntax of this option, check the
  15796. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15797. @item dither, d
  15798. Set the dither type.
  15799. Possible values are:
  15800. @table @var
  15801. @item none
  15802. @item ordered
  15803. @item random
  15804. @item error_diffusion
  15805. @end table
  15806. Default is none.
  15807. @item filter, f
  15808. Set the resize filter type.
  15809. Possible values are:
  15810. @table @var
  15811. @item point
  15812. @item bilinear
  15813. @item bicubic
  15814. @item spline16
  15815. @item spline36
  15816. @item lanczos
  15817. @end table
  15818. Default is bilinear.
  15819. @item range, r
  15820. Set the color range.
  15821. Possible values are:
  15822. @table @var
  15823. @item input
  15824. @item limited
  15825. @item full
  15826. @end table
  15827. Default is same as input.
  15828. @item primaries, p
  15829. Set the color primaries.
  15830. Possible values are:
  15831. @table @var
  15832. @item input
  15833. @item 709
  15834. @item unspecified
  15835. @item 170m
  15836. @item 240m
  15837. @item 2020
  15838. @end table
  15839. Default is same as input.
  15840. @item transfer, t
  15841. Set the transfer characteristics.
  15842. Possible values are:
  15843. @table @var
  15844. @item input
  15845. @item 709
  15846. @item unspecified
  15847. @item 601
  15848. @item linear
  15849. @item 2020_10
  15850. @item 2020_12
  15851. @item smpte2084
  15852. @item iec61966-2-1
  15853. @item arib-std-b67
  15854. @end table
  15855. Default is same as input.
  15856. @item matrix, m
  15857. Set the colorspace matrix.
  15858. Possible value are:
  15859. @table @var
  15860. @item input
  15861. @item 709
  15862. @item unspecified
  15863. @item 470bg
  15864. @item 170m
  15865. @item 2020_ncl
  15866. @item 2020_cl
  15867. @end table
  15868. Default is same as input.
  15869. @item rangein, rin
  15870. Set the input color range.
  15871. Possible values are:
  15872. @table @var
  15873. @item input
  15874. @item limited
  15875. @item full
  15876. @end table
  15877. Default is same as input.
  15878. @item primariesin, pin
  15879. Set the input color primaries.
  15880. Possible values are:
  15881. @table @var
  15882. @item input
  15883. @item 709
  15884. @item unspecified
  15885. @item 170m
  15886. @item 240m
  15887. @item 2020
  15888. @end table
  15889. Default is same as input.
  15890. @item transferin, tin
  15891. Set the input transfer characteristics.
  15892. Possible values are:
  15893. @table @var
  15894. @item input
  15895. @item 709
  15896. @item unspecified
  15897. @item 601
  15898. @item linear
  15899. @item 2020_10
  15900. @item 2020_12
  15901. @end table
  15902. Default is same as input.
  15903. @item matrixin, min
  15904. Set the input colorspace matrix.
  15905. Possible value are:
  15906. @table @var
  15907. @item input
  15908. @item 709
  15909. @item unspecified
  15910. @item 470bg
  15911. @item 170m
  15912. @item 2020_ncl
  15913. @item 2020_cl
  15914. @end table
  15915. @item chromal, c
  15916. Set the output chroma location.
  15917. Possible values are:
  15918. @table @var
  15919. @item input
  15920. @item left
  15921. @item center
  15922. @item topleft
  15923. @item top
  15924. @item bottomleft
  15925. @item bottom
  15926. @end table
  15927. @item chromalin, cin
  15928. Set the input chroma location.
  15929. Possible values are:
  15930. @table @var
  15931. @item input
  15932. @item left
  15933. @item center
  15934. @item topleft
  15935. @item top
  15936. @item bottomleft
  15937. @item bottom
  15938. @end table
  15939. @item npl
  15940. Set the nominal peak luminance.
  15941. @end table
  15942. The values of the @option{w} and @option{h} options are expressions
  15943. containing the following constants:
  15944. @table @var
  15945. @item in_w
  15946. @item in_h
  15947. The input width and height
  15948. @item iw
  15949. @item ih
  15950. These are the same as @var{in_w} and @var{in_h}.
  15951. @item out_w
  15952. @item out_h
  15953. The output (scaled) width and height
  15954. @item ow
  15955. @item oh
  15956. These are the same as @var{out_w} and @var{out_h}
  15957. @item a
  15958. The same as @var{iw} / @var{ih}
  15959. @item sar
  15960. input sample aspect ratio
  15961. @item dar
  15962. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  15963. @item hsub
  15964. @item vsub
  15965. horizontal and vertical input chroma subsample values. For example for the
  15966. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15967. @item ohsub
  15968. @item ovsub
  15969. horizontal and vertical output chroma subsample values. For example for the
  15970. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15971. @end table
  15972. @subsection Commands
  15973. This filter supports the following commands:
  15974. @table @option
  15975. @item width, w
  15976. @item height, h
  15977. Set the output video dimension expression.
  15978. The command accepts the same syntax of the corresponding option.
  15979. If the specified expression is not valid, it is kept at its current
  15980. value.
  15981. @end table
  15982. @c man end VIDEO FILTERS
  15983. @chapter OpenCL Video Filters
  15984. @c man begin OPENCL VIDEO FILTERS
  15985. Below is a description of the currently available OpenCL video filters.
  15986. To enable compilation of these filters you need to configure FFmpeg with
  15987. @code{--enable-opencl}.
  15988. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  15989. @table @option
  15990. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  15991. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  15992. given device parameters.
  15993. @item -filter_hw_device @var{name}
  15994. Pass the hardware device called @var{name} to all filters in any filter graph.
  15995. @end table
  15996. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  15997. @itemize
  15998. @item
  15999. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  16000. @example
  16001. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  16002. @end example
  16003. @end itemize
  16004. 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.
  16005. @section avgblur_opencl
  16006. Apply average blur filter.
  16007. The filter accepts the following options:
  16008. @table @option
  16009. @item sizeX
  16010. Set horizontal radius size.
  16011. Range is @code{[1, 1024]} and default value is @code{1}.
  16012. @item planes
  16013. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16014. @item sizeY
  16015. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  16016. @end table
  16017. @subsection Example
  16018. @itemize
  16019. @item
  16020. 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.
  16021. @example
  16022. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  16023. @end example
  16024. @end itemize
  16025. @section boxblur_opencl
  16026. Apply a boxblur algorithm to the input video.
  16027. It accepts the following parameters:
  16028. @table @option
  16029. @item luma_radius, lr
  16030. @item luma_power, lp
  16031. @item chroma_radius, cr
  16032. @item chroma_power, cp
  16033. @item alpha_radius, ar
  16034. @item alpha_power, ap
  16035. @end table
  16036. A description of the accepted options follows.
  16037. @table @option
  16038. @item luma_radius, lr
  16039. @item chroma_radius, cr
  16040. @item alpha_radius, ar
  16041. Set an expression for the box radius in pixels used for blurring the
  16042. corresponding input plane.
  16043. The radius value must be a non-negative number, and must not be
  16044. greater than the value of the expression @code{min(w,h)/2} for the
  16045. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  16046. planes.
  16047. Default value for @option{luma_radius} is "2". If not specified,
  16048. @option{chroma_radius} and @option{alpha_radius} default to the
  16049. corresponding value set for @option{luma_radius}.
  16050. The expressions can contain the following constants:
  16051. @table @option
  16052. @item w
  16053. @item h
  16054. The input width and height in pixels.
  16055. @item cw
  16056. @item ch
  16057. The input chroma image width and height in pixels.
  16058. @item hsub
  16059. @item vsub
  16060. The horizontal and vertical chroma subsample values. For example, for the
  16061. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  16062. @end table
  16063. @item luma_power, lp
  16064. @item chroma_power, cp
  16065. @item alpha_power, ap
  16066. Specify how many times the boxblur filter is applied to the
  16067. corresponding plane.
  16068. Default value for @option{luma_power} is 2. If not specified,
  16069. @option{chroma_power} and @option{alpha_power} default to the
  16070. corresponding value set for @option{luma_power}.
  16071. A value of 0 will disable the effect.
  16072. @end table
  16073. @subsection Examples
  16074. 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.
  16075. @itemize
  16076. @item
  16077. Apply a boxblur filter with the luma, chroma, and alpha radius
  16078. 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.
  16079. @example
  16080. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  16081. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  16082. @end example
  16083. @item
  16084. 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.
  16085. For the luma plane, a 2x2 box radius will be run once.
  16086. For the chroma plane, a 4x4 box radius will be run 5 times.
  16087. For the alpha plane, a 3x3 box radius will be run 7 times.
  16088. @example
  16089. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  16090. @end example
  16091. @end itemize
  16092. @section colorkey_opencl
  16093. RGB colorspace color keying.
  16094. The filter accepts the following options:
  16095. @table @option
  16096. @item color
  16097. The color which will be replaced with transparency.
  16098. @item similarity
  16099. Similarity percentage with the key color.
  16100. 0.01 matches only the exact key color, while 1.0 matches everything.
  16101. @item blend
  16102. Blend percentage.
  16103. 0.0 makes pixels either fully transparent, or not transparent at all.
  16104. Higher values result in semi-transparent pixels, with a higher transparency
  16105. the more similar the pixels color is to the key color.
  16106. @end table
  16107. @subsection Examples
  16108. @itemize
  16109. @item
  16110. Make every semi-green pixel in the input transparent with some slight blending:
  16111. @example
  16112. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  16113. @end example
  16114. @end itemize
  16115. @section convolution_opencl
  16116. Apply convolution of 3x3, 5x5, 7x7 matrix.
  16117. The filter accepts the following options:
  16118. @table @option
  16119. @item 0m
  16120. @item 1m
  16121. @item 2m
  16122. @item 3m
  16123. Set matrix for each plane.
  16124. Matrix is sequence of 9, 25 or 49 signed numbers.
  16125. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  16126. @item 0rdiv
  16127. @item 1rdiv
  16128. @item 2rdiv
  16129. @item 3rdiv
  16130. Set multiplier for calculated value for each plane.
  16131. If unset or 0, it will be sum of all matrix elements.
  16132. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  16133. @item 0bias
  16134. @item 1bias
  16135. @item 2bias
  16136. @item 3bias
  16137. Set bias for each plane. This value is added to the result of the multiplication.
  16138. Useful for making the overall image brighter or darker.
  16139. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  16140. @end table
  16141. @subsection Examples
  16142. @itemize
  16143. @item
  16144. Apply sharpen:
  16145. @example
  16146. -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
  16147. @end example
  16148. @item
  16149. Apply blur:
  16150. @example
  16151. -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
  16152. @end example
  16153. @item
  16154. Apply edge enhance:
  16155. @example
  16156. -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
  16157. @end example
  16158. @item
  16159. Apply edge detect:
  16160. @example
  16161. -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
  16162. @end example
  16163. @item
  16164. Apply laplacian edge detector which includes diagonals:
  16165. @example
  16166. -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
  16167. @end example
  16168. @item
  16169. Apply emboss:
  16170. @example
  16171. -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
  16172. @end example
  16173. @end itemize
  16174. @section erosion_opencl
  16175. Apply erosion effect to the video.
  16176. This filter replaces the pixel by the local(3x3) minimum.
  16177. It accepts the following options:
  16178. @table @option
  16179. @item threshold0
  16180. @item threshold1
  16181. @item threshold2
  16182. @item threshold3
  16183. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16184. If @code{0}, plane will remain unchanged.
  16185. @item coordinates
  16186. Flag which specifies the pixel to refer to.
  16187. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16188. Flags to local 3x3 coordinates region centered on @code{x}:
  16189. 1 2 3
  16190. 4 x 5
  16191. 6 7 8
  16192. @end table
  16193. @subsection Example
  16194. @itemize
  16195. @item
  16196. 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.
  16197. @example
  16198. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16199. @end example
  16200. @end itemize
  16201. @section deshake_opencl
  16202. Feature-point based video stabilization filter.
  16203. The filter accepts the following options:
  16204. @table @option
  16205. @item tripod
  16206. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  16207. @item debug
  16208. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  16209. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  16210. Viewing point matches in the output video is only supported for RGB input.
  16211. Defaults to @code{0}.
  16212. @item adaptive_crop
  16213. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  16214. Defaults to @code{1}.
  16215. @item refine_features
  16216. Whether or not feature points should be refined at a sub-pixel level.
  16217. This can be turned off for a slight performance gain at the cost of precision.
  16218. Defaults to @code{1}.
  16219. @item smooth_strength
  16220. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  16221. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  16222. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  16223. Defaults to @code{0.0}.
  16224. @item smooth_window_multiplier
  16225. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  16226. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  16227. Acceptable values range from @code{0.1} to @code{10.0}.
  16228. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  16229. potentially improving smoothness, but also increase latency and memory usage.
  16230. Defaults to @code{2.0}.
  16231. @end table
  16232. @subsection Examples
  16233. @itemize
  16234. @item
  16235. Stabilize a video with a fixed, medium smoothing strength:
  16236. @example
  16237. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  16238. @end example
  16239. @item
  16240. Stabilize a video with debugging (both in console and in rendered video):
  16241. @example
  16242. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  16243. @end example
  16244. @end itemize
  16245. @section dilation_opencl
  16246. Apply dilation effect to the video.
  16247. This filter replaces the pixel by the local(3x3) maximum.
  16248. It accepts the following options:
  16249. @table @option
  16250. @item threshold0
  16251. @item threshold1
  16252. @item threshold2
  16253. @item threshold3
  16254. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16255. If @code{0}, plane will remain unchanged.
  16256. @item coordinates
  16257. Flag which specifies the pixel to refer to.
  16258. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16259. Flags to local 3x3 coordinates region centered on @code{x}:
  16260. 1 2 3
  16261. 4 x 5
  16262. 6 7 8
  16263. @end table
  16264. @subsection Example
  16265. @itemize
  16266. @item
  16267. 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.
  16268. @example
  16269. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16270. @end example
  16271. @end itemize
  16272. @section nlmeans_opencl
  16273. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  16274. @section overlay_opencl
  16275. Overlay one video on top of another.
  16276. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  16277. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  16278. The filter accepts the following options:
  16279. @table @option
  16280. @item x
  16281. Set the x coordinate of the overlaid video on the main video.
  16282. Default value is @code{0}.
  16283. @item y
  16284. Set the y coordinate of the overlaid video on the main video.
  16285. Default value is @code{0}.
  16286. @end table
  16287. @subsection Examples
  16288. @itemize
  16289. @item
  16290. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  16291. @example
  16292. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16293. @end example
  16294. @item
  16295. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  16296. @example
  16297. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16298. @end example
  16299. @end itemize
  16300. @section pad_opencl
  16301. Add paddings to the input image, and place the original input at the
  16302. provided @var{x}, @var{y} coordinates.
  16303. It accepts the following options:
  16304. @table @option
  16305. @item width, w
  16306. @item height, h
  16307. Specify an expression for the size of the output image with the
  16308. paddings added. If the value for @var{width} or @var{height} is 0, the
  16309. corresponding input size is used for the output.
  16310. The @var{width} expression can reference the value set by the
  16311. @var{height} expression, and vice versa.
  16312. The default value of @var{width} and @var{height} is 0.
  16313. @item x
  16314. @item y
  16315. Specify the offsets to place the input image at within the padded area,
  16316. with respect to the top/left border of the output image.
  16317. The @var{x} expression can reference the value set by the @var{y}
  16318. expression, and vice versa.
  16319. The default value of @var{x} and @var{y} is 0.
  16320. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  16321. so the input image is centered on the padded area.
  16322. @item color
  16323. Specify the color of the padded area. For the syntax of this option,
  16324. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  16325. manual,ffmpeg-utils}.
  16326. @item aspect
  16327. Pad to an aspect instead to a resolution.
  16328. @end table
  16329. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  16330. options are expressions containing the following constants:
  16331. @table @option
  16332. @item in_w
  16333. @item in_h
  16334. The input video width and height.
  16335. @item iw
  16336. @item ih
  16337. These are the same as @var{in_w} and @var{in_h}.
  16338. @item out_w
  16339. @item out_h
  16340. The output width and height (the size of the padded area), as
  16341. specified by the @var{width} and @var{height} expressions.
  16342. @item ow
  16343. @item oh
  16344. These are the same as @var{out_w} and @var{out_h}.
  16345. @item x
  16346. @item y
  16347. The x and y offsets as specified by the @var{x} and @var{y}
  16348. expressions, or NAN if not yet specified.
  16349. @item a
  16350. same as @var{iw} / @var{ih}
  16351. @item sar
  16352. input sample aspect ratio
  16353. @item dar
  16354. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  16355. @end table
  16356. @section prewitt_opencl
  16357. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  16358. The filter accepts the following option:
  16359. @table @option
  16360. @item planes
  16361. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16362. @item scale
  16363. Set value which will be multiplied with filtered result.
  16364. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16365. @item delta
  16366. Set value which will be added to filtered result.
  16367. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16368. @end table
  16369. @subsection Example
  16370. @itemize
  16371. @item
  16372. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  16373. @example
  16374. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16375. @end example
  16376. @end itemize
  16377. @anchor{program_opencl}
  16378. @section program_opencl
  16379. Filter video using an OpenCL program.
  16380. @table @option
  16381. @item source
  16382. OpenCL program source file.
  16383. @item kernel
  16384. Kernel name in program.
  16385. @item inputs
  16386. Number of inputs to the filter. Defaults to 1.
  16387. @item size, s
  16388. Size of output frames. Defaults to the same as the first input.
  16389. @end table
  16390. The @code{program_opencl} filter also supports the @ref{framesync} options.
  16391. The program source file must contain a kernel function with the given name,
  16392. which will be run once for each plane of the output. Each run on a plane
  16393. gets enqueued as a separate 2D global NDRange with one work-item for each
  16394. pixel to be generated. The global ID offset for each work-item is therefore
  16395. the coordinates of a pixel in the destination image.
  16396. The kernel function needs to take the following arguments:
  16397. @itemize
  16398. @item
  16399. Destination image, @var{__write_only image2d_t}.
  16400. This image will become the output; the kernel should write all of it.
  16401. @item
  16402. Frame index, @var{unsigned int}.
  16403. This is a counter starting from zero and increasing by one for each frame.
  16404. @item
  16405. Source images, @var{__read_only image2d_t}.
  16406. These are the most recent images on each input. The kernel may read from
  16407. them to generate the output, but they can't be written to.
  16408. @end itemize
  16409. Example programs:
  16410. @itemize
  16411. @item
  16412. Copy the input to the output (output must be the same size as the input).
  16413. @verbatim
  16414. __kernel void copy(__write_only image2d_t destination,
  16415. unsigned int index,
  16416. __read_only image2d_t source)
  16417. {
  16418. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  16419. int2 location = (int2)(get_global_id(0), get_global_id(1));
  16420. float4 value = read_imagef(source, sampler, location);
  16421. write_imagef(destination, location, value);
  16422. }
  16423. @end verbatim
  16424. @item
  16425. Apply a simple transformation, rotating the input by an amount increasing
  16426. with the index counter. Pixel values are linearly interpolated by the
  16427. sampler, and the output need not have the same dimensions as the input.
  16428. @verbatim
  16429. __kernel void rotate_image(__write_only image2d_t dst,
  16430. unsigned int index,
  16431. __read_only image2d_t src)
  16432. {
  16433. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16434. CLK_FILTER_LINEAR);
  16435. float angle = (float)index / 100.0f;
  16436. float2 dst_dim = convert_float2(get_image_dim(dst));
  16437. float2 src_dim = convert_float2(get_image_dim(src));
  16438. float2 dst_cen = dst_dim / 2.0f;
  16439. float2 src_cen = src_dim / 2.0f;
  16440. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  16441. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  16442. float2 src_pos = {
  16443. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  16444. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  16445. };
  16446. src_pos = src_pos * src_dim / dst_dim;
  16447. float2 src_loc = src_pos + src_cen;
  16448. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  16449. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  16450. write_imagef(dst, dst_loc, 0.5f);
  16451. else
  16452. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  16453. }
  16454. @end verbatim
  16455. @item
  16456. Blend two inputs together, with the amount of each input used varying
  16457. with the index counter.
  16458. @verbatim
  16459. __kernel void blend_images(__write_only image2d_t dst,
  16460. unsigned int index,
  16461. __read_only image2d_t src1,
  16462. __read_only image2d_t src2)
  16463. {
  16464. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16465. CLK_FILTER_LINEAR);
  16466. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  16467. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  16468. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  16469. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  16470. float4 val1 = read_imagef(src1, sampler, src1_loc);
  16471. float4 val2 = read_imagef(src2, sampler, src2_loc);
  16472. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  16473. }
  16474. @end verbatim
  16475. @end itemize
  16476. @section roberts_opencl
  16477. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  16478. The filter accepts the following option:
  16479. @table @option
  16480. @item planes
  16481. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16482. @item scale
  16483. Set value which will be multiplied with filtered result.
  16484. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16485. @item delta
  16486. Set value which will be added to filtered result.
  16487. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16488. @end table
  16489. @subsection Example
  16490. @itemize
  16491. @item
  16492. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  16493. @example
  16494. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16495. @end example
  16496. @end itemize
  16497. @section sobel_opencl
  16498. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  16499. The filter accepts the following option:
  16500. @table @option
  16501. @item planes
  16502. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16503. @item scale
  16504. Set value which will be multiplied with filtered result.
  16505. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16506. @item delta
  16507. Set value which will be added to filtered result.
  16508. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16509. @end table
  16510. @subsection Example
  16511. @itemize
  16512. @item
  16513. Apply sobel operator with scale set to 2 and delta set to 10
  16514. @example
  16515. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16516. @end example
  16517. @end itemize
  16518. @section tonemap_opencl
  16519. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  16520. It accepts the following parameters:
  16521. @table @option
  16522. @item tonemap
  16523. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  16524. @item param
  16525. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  16526. @item desat
  16527. Apply desaturation for highlights that exceed this level of brightness. The
  16528. higher the parameter, the more color information will be preserved. This
  16529. setting helps prevent unnaturally blown-out colors for super-highlights, by
  16530. (smoothly) turning into white instead. This makes images feel more natural,
  16531. at the cost of reducing information about out-of-range colors.
  16532. The default value is 0.5, and the algorithm here is a little different from
  16533. the cpu version tonemap currently. A setting of 0.0 disables this option.
  16534. @item threshold
  16535. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  16536. is used to detect whether the scene has changed or not. If the distance between
  16537. the current frame average brightness and the current running average exceeds
  16538. a threshold value, we would re-calculate scene average and peak brightness.
  16539. The default value is 0.2.
  16540. @item format
  16541. Specify the output pixel format.
  16542. Currently supported formats are:
  16543. @table @var
  16544. @item p010
  16545. @item nv12
  16546. @end table
  16547. @item range, r
  16548. Set the output color range.
  16549. Possible values are:
  16550. @table @var
  16551. @item tv/mpeg
  16552. @item pc/jpeg
  16553. @end table
  16554. Default is same as input.
  16555. @item primaries, p
  16556. Set the output color primaries.
  16557. Possible values are:
  16558. @table @var
  16559. @item bt709
  16560. @item bt2020
  16561. @end table
  16562. Default is same as input.
  16563. @item transfer, t
  16564. Set the output transfer characteristics.
  16565. Possible values are:
  16566. @table @var
  16567. @item bt709
  16568. @item bt2020
  16569. @end table
  16570. Default is bt709.
  16571. @item matrix, m
  16572. Set the output colorspace matrix.
  16573. Possible value are:
  16574. @table @var
  16575. @item bt709
  16576. @item bt2020
  16577. @end table
  16578. Default is same as input.
  16579. @end table
  16580. @subsection Example
  16581. @itemize
  16582. @item
  16583. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  16584. @example
  16585. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  16586. @end example
  16587. @end itemize
  16588. @section unsharp_opencl
  16589. Sharpen or blur the input video.
  16590. It accepts the following parameters:
  16591. @table @option
  16592. @item luma_msize_x, lx
  16593. Set the luma matrix horizontal size.
  16594. Range is @code{[1, 23]} and default value is @code{5}.
  16595. @item luma_msize_y, ly
  16596. Set the luma matrix vertical size.
  16597. Range is @code{[1, 23]} and default value is @code{5}.
  16598. @item luma_amount, la
  16599. Set the luma effect strength.
  16600. Range is @code{[-10, 10]} and default value is @code{1.0}.
  16601. Negative values will blur the input video, while positive values will
  16602. sharpen it, a value of zero will disable the effect.
  16603. @item chroma_msize_x, cx
  16604. Set the chroma matrix horizontal size.
  16605. Range is @code{[1, 23]} and default value is @code{5}.
  16606. @item chroma_msize_y, cy
  16607. Set the chroma matrix vertical size.
  16608. Range is @code{[1, 23]} and default value is @code{5}.
  16609. @item chroma_amount, ca
  16610. Set the chroma effect strength.
  16611. Range is @code{[-10, 10]} and default value is @code{0.0}.
  16612. Negative values will blur the input video, while positive values will
  16613. sharpen it, a value of zero will disable the effect.
  16614. @end table
  16615. All parameters are optional and default to the equivalent of the
  16616. string '5:5:1.0:5:5:0.0'.
  16617. @subsection Examples
  16618. @itemize
  16619. @item
  16620. Apply strong luma sharpen effect:
  16621. @example
  16622. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  16623. @end example
  16624. @item
  16625. Apply a strong blur of both luma and chroma parameters:
  16626. @example
  16627. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  16628. @end example
  16629. @end itemize
  16630. @section xfade_opencl
  16631. Cross fade two videos with custom transition effect by using OpenCL.
  16632. It accepts the following options:
  16633. @table @option
  16634. @item transition
  16635. Set one of possible transition effects.
  16636. @table @option
  16637. @item custom
  16638. Select custom transition effect, the actual transition description
  16639. will be picked from source and kernel options.
  16640. @item fade
  16641. @item wipeleft
  16642. @item wiperight
  16643. @item wipeup
  16644. @item wipedown
  16645. @item slideleft
  16646. @item slideright
  16647. @item slideup
  16648. @item slidedown
  16649. Default transition is fade.
  16650. @end table
  16651. @item source
  16652. OpenCL program source file for custom transition.
  16653. @item kernel
  16654. Set name of kernel to use for custom transition from program source file.
  16655. @item duration
  16656. Set duration of video transition.
  16657. @item offset
  16658. Set time of start of transition relative to first video.
  16659. @end table
  16660. The program source file must contain a kernel function with the given name,
  16661. which will be run once for each plane of the output. Each run on a plane
  16662. gets enqueued as a separate 2D global NDRange with one work-item for each
  16663. pixel to be generated. The global ID offset for each work-item is therefore
  16664. the coordinates of a pixel in the destination image.
  16665. The kernel function needs to take the following arguments:
  16666. @itemize
  16667. @item
  16668. Destination image, @var{__write_only image2d_t}.
  16669. This image will become the output; the kernel should write all of it.
  16670. @item
  16671. First Source image, @var{__read_only image2d_t}.
  16672. Second Source image, @var{__read_only image2d_t}.
  16673. These are the most recent images on each input. The kernel may read from
  16674. them to generate the output, but they can't be written to.
  16675. @item
  16676. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  16677. @end itemize
  16678. Example programs:
  16679. @itemize
  16680. @item
  16681. Apply dots curtain transition effect:
  16682. @verbatim
  16683. __kernel void blend_images(__write_only image2d_t dst,
  16684. __read_only image2d_t src1,
  16685. __read_only image2d_t src2,
  16686. float progress)
  16687. {
  16688. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16689. CLK_FILTER_LINEAR);
  16690. int2 p = (int2)(get_global_id(0), get_global_id(1));
  16691. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  16692. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  16693. rp = rp / dim;
  16694. float2 dots = (float2)(20.0, 20.0);
  16695. float2 center = (float2)(0,0);
  16696. float2 unused;
  16697. float4 val1 = read_imagef(src1, sampler, p);
  16698. float4 val2 = read_imagef(src2, sampler, p);
  16699. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  16700. write_imagef(dst, p, next ? val1 : val2);
  16701. }
  16702. @end verbatim
  16703. @end itemize
  16704. @c man end OPENCL VIDEO FILTERS
  16705. @chapter VAAPI Video Filters
  16706. @c man begin VAAPI VIDEO FILTERS
  16707. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  16708. To enable compilation of these filters you need to configure FFmpeg with
  16709. @code{--enable-vaapi}.
  16710. To use vaapi filters, you need to setup the vaapi device correctly. For more information, please read @url{https://trac.ffmpeg.org/wiki/Hardware/VAAPI}
  16711. @section tonemap_vaapi
  16712. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  16713. It maps the dynamic range of HDR10 content to the SDR content.
  16714. It currently only accepts HDR10 as input.
  16715. It accepts the following parameters:
  16716. @table @option
  16717. @item format
  16718. Specify the output pixel format.
  16719. Currently supported formats are:
  16720. @table @var
  16721. @item p010
  16722. @item nv12
  16723. @end table
  16724. Default is nv12.
  16725. @item primaries, p
  16726. Set the output color primaries.
  16727. Default is same as input.
  16728. @item transfer, t
  16729. Set the output transfer characteristics.
  16730. Default is bt709.
  16731. @item matrix, m
  16732. Set the output colorspace matrix.
  16733. Default is same as input.
  16734. @end table
  16735. @subsection Example
  16736. @itemize
  16737. @item
  16738. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  16739. @example
  16740. tonemap_vaapi=format=p010:t=bt2020-10
  16741. @end example
  16742. @end itemize
  16743. @c man end VAAPI VIDEO FILTERS
  16744. @chapter Video Sources
  16745. @c man begin VIDEO SOURCES
  16746. Below is a description of the currently available video sources.
  16747. @section buffer
  16748. Buffer video frames, and make them available to the filter chain.
  16749. This source is mainly intended for a programmatic use, in particular
  16750. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  16751. It accepts the following parameters:
  16752. @table @option
  16753. @item video_size
  16754. Specify the size (width and height) of the buffered video frames. For the
  16755. syntax of this option, check the
  16756. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16757. @item width
  16758. The input video width.
  16759. @item height
  16760. The input video height.
  16761. @item pix_fmt
  16762. A string representing the pixel format of the buffered video frames.
  16763. It may be a number corresponding to a pixel format, or a pixel format
  16764. name.
  16765. @item time_base
  16766. Specify the timebase assumed by the timestamps of the buffered frames.
  16767. @item frame_rate
  16768. Specify the frame rate expected for the video stream.
  16769. @item pixel_aspect, sar
  16770. The sample (pixel) aspect ratio of the input video.
  16771. @item sws_param
  16772. This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
  16773. to the filtergraph description to specify swscale flags for automatically
  16774. inserted scalers. See @ref{Filtergraph syntax}.
  16775. @item hw_frames_ctx
  16776. When using a hardware pixel format, this should be a reference to an
  16777. AVHWFramesContext describing input frames.
  16778. @end table
  16779. For example:
  16780. @example
  16781. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  16782. @end example
  16783. will instruct the source to accept video frames with size 320x240 and
  16784. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  16785. square pixels (1:1 sample aspect ratio).
  16786. Since the pixel format with name "yuv410p" corresponds to the number 6
  16787. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  16788. this example corresponds to:
  16789. @example
  16790. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  16791. @end example
  16792. Alternatively, the options can be specified as a flat string, but this
  16793. syntax is deprecated:
  16794. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  16795. @section cellauto
  16796. Create a pattern generated by an elementary cellular automaton.
  16797. The initial state of the cellular automaton can be defined through the
  16798. @option{filename} and @option{pattern} options. If such options are
  16799. not specified an initial state is created randomly.
  16800. At each new frame a new row in the video is filled with the result of
  16801. the cellular automaton next generation. The behavior when the whole
  16802. frame is filled is defined by the @option{scroll} option.
  16803. This source accepts the following options:
  16804. @table @option
  16805. @item filename, f
  16806. Read the initial cellular automaton state, i.e. the starting row, from
  16807. the specified file.
  16808. In the file, each non-whitespace character is considered an alive
  16809. cell, a newline will terminate the row, and further characters in the
  16810. file will be ignored.
  16811. @item pattern, p
  16812. Read the initial cellular automaton state, i.e. the starting row, from
  16813. the specified string.
  16814. Each non-whitespace character in the string is considered an alive
  16815. cell, a newline will terminate the row, and further characters in the
  16816. string will be ignored.
  16817. @item rate, r
  16818. Set the video rate, that is the number of frames generated per second.
  16819. Default is 25.
  16820. @item random_fill_ratio, ratio
  16821. Set the random fill ratio for the initial cellular automaton row. It
  16822. is a floating point number value ranging from 0 to 1, defaults to
  16823. 1/PHI.
  16824. This option is ignored when a file or a pattern is specified.
  16825. @item random_seed, seed
  16826. Set the seed for filling randomly the initial row, must be an integer
  16827. included between 0 and UINT32_MAX. If not specified, or if explicitly
  16828. set to -1, the filter will try to use a good random seed on a best
  16829. effort basis.
  16830. @item rule
  16831. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  16832. Default value is 110.
  16833. @item size, s
  16834. Set the size of the output video. For the syntax of this option, check the
  16835. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16836. If @option{filename} or @option{pattern} is specified, the size is set
  16837. by default to the width of the specified initial state row, and the
  16838. height is set to @var{width} * PHI.
  16839. If @option{size} is set, it must contain the width of the specified
  16840. pattern string, and the specified pattern will be centered in the
  16841. larger row.
  16842. If a filename or a pattern string is not specified, the size value
  16843. defaults to "320x518" (used for a randomly generated initial state).
  16844. @item scroll
  16845. If set to 1, scroll the output upward when all the rows in the output
  16846. have been already filled. If set to 0, the new generated row will be
  16847. written over the top row just after the bottom row is filled.
  16848. Defaults to 1.
  16849. @item start_full, full
  16850. If set to 1, completely fill the output with generated rows before
  16851. outputting the first frame.
  16852. This is the default behavior, for disabling set the value to 0.
  16853. @item stitch
  16854. If set to 1, stitch the left and right row edges together.
  16855. This is the default behavior, for disabling set the value to 0.
  16856. @end table
  16857. @subsection Examples
  16858. @itemize
  16859. @item
  16860. Read the initial state from @file{pattern}, and specify an output of
  16861. size 200x400.
  16862. @example
  16863. cellauto=f=pattern:s=200x400
  16864. @end example
  16865. @item
  16866. Generate a random initial row with a width of 200 cells, with a fill
  16867. ratio of 2/3:
  16868. @example
  16869. cellauto=ratio=2/3:s=200x200
  16870. @end example
  16871. @item
  16872. Create a pattern generated by rule 18 starting by a single alive cell
  16873. centered on an initial row with width 100:
  16874. @example
  16875. cellauto=p=@@:s=100x400:full=0:rule=18
  16876. @end example
  16877. @item
  16878. Specify a more elaborated initial pattern:
  16879. @example
  16880. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  16881. @end example
  16882. @end itemize
  16883. @anchor{coreimagesrc}
  16884. @section coreimagesrc
  16885. Video source generated on GPU using Apple's CoreImage API on OSX.
  16886. This video source is a specialized version of the @ref{coreimage} video filter.
  16887. Use a core image generator at the beginning of the applied filterchain to
  16888. generate the content.
  16889. The coreimagesrc video source accepts the following options:
  16890. @table @option
  16891. @item list_generators
  16892. List all available generators along with all their respective options as well as
  16893. possible minimum and maximum values along with the default values.
  16894. @example
  16895. list_generators=true
  16896. @end example
  16897. @item size, s
  16898. Specify the size of the sourced video. For the syntax of this option, check the
  16899. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16900. The default value is @code{320x240}.
  16901. @item rate, r
  16902. Specify the frame rate of the sourced video, as the number of frames
  16903. generated per second. It has to be a string in the format
  16904. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  16905. number or a valid video frame rate abbreviation. The default value is
  16906. "25".
  16907. @item sar
  16908. Set the sample aspect ratio of the sourced video.
  16909. @item duration, d
  16910. Set the duration of the sourced video. See
  16911. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16912. for the accepted syntax.
  16913. If not specified, or the expressed duration is negative, the video is
  16914. supposed to be generated forever.
  16915. @end table
  16916. Additionally, all options of the @ref{coreimage} video filter are accepted.
  16917. A complete filterchain can be used for further processing of the
  16918. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  16919. and examples for details.
  16920. @subsection Examples
  16921. @itemize
  16922. @item
  16923. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  16924. given as complete and escaped command-line for Apple's standard bash shell:
  16925. @example
  16926. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  16927. @end example
  16928. This example is equivalent to the QRCode example of @ref{coreimage} without the
  16929. need for a nullsrc video source.
  16930. @end itemize
  16931. @section gradients
  16932. Generate several gradients.
  16933. @table @option
  16934. @item size, s
  16935. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  16936. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  16937. @item rate, r
  16938. Set frame rate, expressed as number of frames per second. Default
  16939. value is "25".
  16940. @item c0, c1, c2, c3, c4, c5, c6, c7
  16941. Set 8 colors. Default values for colors is to pick random one.
  16942. @item x0, y0, y0, y1
  16943. Set gradient line source and destination points. If negative or out of range, random ones
  16944. are picked.
  16945. @item nb_colors, n
  16946. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  16947. @item seed
  16948. Set seed for picking gradient line points.
  16949. @end table
  16950. @section mandelbrot
  16951. Generate a Mandelbrot set fractal, and progressively zoom towards the
  16952. point specified with @var{start_x} and @var{start_y}.
  16953. This source accepts the following options:
  16954. @table @option
  16955. @item end_pts
  16956. Set the terminal pts value. Default value is 400.
  16957. @item end_scale
  16958. Set the terminal scale value.
  16959. Must be a floating point value. Default value is 0.3.
  16960. @item inner
  16961. Set the inner coloring mode, that is the algorithm used to draw the
  16962. Mandelbrot fractal internal region.
  16963. It shall assume one of the following values:
  16964. @table @option
  16965. @item black
  16966. Set black mode.
  16967. @item convergence
  16968. Show time until convergence.
  16969. @item mincol
  16970. Set color based on point closest to the origin of the iterations.
  16971. @item period
  16972. Set period mode.
  16973. @end table
  16974. Default value is @var{mincol}.
  16975. @item bailout
  16976. Set the bailout value. Default value is 10.0.
  16977. @item maxiter
  16978. Set the maximum of iterations performed by the rendering
  16979. algorithm. Default value is 7189.
  16980. @item outer
  16981. Set outer coloring mode.
  16982. It shall assume one of following values:
  16983. @table @option
  16984. @item iteration_count
  16985. Set iteration count mode.
  16986. @item normalized_iteration_count
  16987. set normalized iteration count mode.
  16988. @end table
  16989. Default value is @var{normalized_iteration_count}.
  16990. @item rate, r
  16991. Set frame rate, expressed as number of frames per second. Default
  16992. value is "25".
  16993. @item size, s
  16994. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  16995. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  16996. @item start_scale
  16997. Set the initial scale value. Default value is 3.0.
  16998. @item start_x
  16999. Set the initial x position. Must be a floating point value between
  17000. -100 and 100. Default value is -0.743643887037158704752191506114774.
  17001. @item start_y
  17002. Set the initial y position. Must be a floating point value between
  17003. -100 and 100. Default value is -0.131825904205311970493132056385139.
  17004. @end table
  17005. @section mptestsrc
  17006. Generate various test patterns, as generated by the MPlayer test filter.
  17007. The size of the generated video is fixed, and is 256x256.
  17008. This source is useful in particular for testing encoding features.
  17009. This source accepts the following options:
  17010. @table @option
  17011. @item rate, r
  17012. Specify the frame rate of the sourced video, as the number of frames
  17013. generated per second. It has to be a string in the format
  17014. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17015. number or a valid video frame rate abbreviation. The default value is
  17016. "25".
  17017. @item duration, d
  17018. Set the duration of the sourced video. See
  17019. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17020. for the accepted syntax.
  17021. If not specified, or the expressed duration is negative, the video is
  17022. supposed to be generated forever.
  17023. @item test, t
  17024. Set the number or the name of the test to perform. Supported tests are:
  17025. @table @option
  17026. @item dc_luma
  17027. @item dc_chroma
  17028. @item freq_luma
  17029. @item freq_chroma
  17030. @item amp_luma
  17031. @item amp_chroma
  17032. @item cbp
  17033. @item mv
  17034. @item ring1
  17035. @item ring2
  17036. @item all
  17037. @item max_frames, m
  17038. Set the maximum number of frames generated for each test, default value is 30.
  17039. @end table
  17040. Default value is "all", which will cycle through the list of all tests.
  17041. @end table
  17042. Some examples:
  17043. @example
  17044. mptestsrc=t=dc_luma
  17045. @end example
  17046. will generate a "dc_luma" test pattern.
  17047. @section frei0r_src
  17048. Provide a frei0r source.
  17049. To enable compilation of this filter you need to install the frei0r
  17050. header and configure FFmpeg with @code{--enable-frei0r}.
  17051. This source accepts the following parameters:
  17052. @table @option
  17053. @item size
  17054. The size of the video to generate. For the syntax of this option, check the
  17055. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17056. @item framerate
  17057. The framerate of the generated video. It may be a string of the form
  17058. @var{num}/@var{den} or a frame rate abbreviation.
  17059. @item filter_name
  17060. The name to the frei0r source to load. For more information regarding frei0r and
  17061. how to set the parameters, read the @ref{frei0r} section in the video filters
  17062. documentation.
  17063. @item filter_params
  17064. A '|'-separated list of parameters to pass to the frei0r source.
  17065. @end table
  17066. For example, to generate a frei0r partik0l source with size 200x200
  17067. and frame rate 10 which is overlaid on the overlay filter main input:
  17068. @example
  17069. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  17070. @end example
  17071. @section life
  17072. Generate a life pattern.
  17073. This source is based on a generalization of John Conway's life game.
  17074. The sourced input represents a life grid, each pixel represents a cell
  17075. which can be in one of two possible states, alive or dead. Every cell
  17076. interacts with its eight neighbours, which are the cells that are
  17077. horizontally, vertically, or diagonally adjacent.
  17078. At each interaction the grid evolves according to the adopted rule,
  17079. which specifies the number of neighbor alive cells which will make a
  17080. cell stay alive or born. The @option{rule} option allows one to specify
  17081. the rule to adopt.
  17082. This source accepts the following options:
  17083. @table @option
  17084. @item filename, f
  17085. Set the file from which to read the initial grid state. In the file,
  17086. each non-whitespace character is considered an alive cell, and newline
  17087. is used to delimit the end of each row.
  17088. If this option is not specified, the initial grid is generated
  17089. randomly.
  17090. @item rate, r
  17091. Set the video rate, that is the number of frames generated per second.
  17092. Default is 25.
  17093. @item random_fill_ratio, ratio
  17094. Set the random fill ratio for the initial random grid. It is a
  17095. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  17096. It is ignored when a file is specified.
  17097. @item random_seed, seed
  17098. Set the seed for filling the initial random grid, must be an integer
  17099. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17100. set to -1, the filter will try to use a good random seed on a best
  17101. effort basis.
  17102. @item rule
  17103. Set the life rule.
  17104. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  17105. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  17106. @var{NS} specifies the number of alive neighbor cells which make a
  17107. live cell stay alive, and @var{NB} the number of alive neighbor cells
  17108. which make a dead cell to become alive (i.e. to "born").
  17109. "s" and "b" can be used in place of "S" and "B", respectively.
  17110. Alternatively a rule can be specified by an 18-bits integer. The 9
  17111. high order bits are used to encode the next cell state if it is alive
  17112. for each number of neighbor alive cells, the low order bits specify
  17113. the rule for "borning" new cells. Higher order bits encode for an
  17114. higher number of neighbor cells.
  17115. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  17116. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  17117. Default value is "S23/B3", which is the original Conway's game of life
  17118. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  17119. cells, and will born a new cell if there are three alive cells around
  17120. a dead cell.
  17121. @item size, s
  17122. Set the size of the output video. For the syntax of this option, check the
  17123. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17124. If @option{filename} is specified, the size is set by default to the
  17125. same size of the input file. If @option{size} is set, it must contain
  17126. the size specified in the input file, and the initial grid defined in
  17127. that file is centered in the larger resulting area.
  17128. If a filename is not specified, the size value defaults to "320x240"
  17129. (used for a randomly generated initial grid).
  17130. @item stitch
  17131. If set to 1, stitch the left and right grid edges together, and the
  17132. top and bottom edges also. Defaults to 1.
  17133. @item mold
  17134. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  17135. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  17136. value from 0 to 255.
  17137. @item life_color
  17138. Set the color of living (or new born) cells.
  17139. @item death_color
  17140. Set the color of dead cells. If @option{mold} is set, this is the first color
  17141. used to represent a dead cell.
  17142. @item mold_color
  17143. Set mold color, for definitely dead and moldy cells.
  17144. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  17145. ffmpeg-utils manual,ffmpeg-utils}.
  17146. @end table
  17147. @subsection Examples
  17148. @itemize
  17149. @item
  17150. Read a grid from @file{pattern}, and center it on a grid of size
  17151. 300x300 pixels:
  17152. @example
  17153. life=f=pattern:s=300x300
  17154. @end example
  17155. @item
  17156. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  17157. @example
  17158. life=ratio=2/3:s=200x200
  17159. @end example
  17160. @item
  17161. Specify a custom rule for evolving a randomly generated grid:
  17162. @example
  17163. life=rule=S14/B34
  17164. @end example
  17165. @item
  17166. Full example with slow death effect (mold) using @command{ffplay}:
  17167. @example
  17168. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  17169. @end example
  17170. @end itemize
  17171. @anchor{allrgb}
  17172. @anchor{allyuv}
  17173. @anchor{color}
  17174. @anchor{haldclutsrc}
  17175. @anchor{nullsrc}
  17176. @anchor{pal75bars}
  17177. @anchor{pal100bars}
  17178. @anchor{rgbtestsrc}
  17179. @anchor{smptebars}
  17180. @anchor{smptehdbars}
  17181. @anchor{testsrc}
  17182. @anchor{testsrc2}
  17183. @anchor{yuvtestsrc}
  17184. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  17185. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  17186. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  17187. The @code{color} source provides an uniformly colored input.
  17188. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  17189. @ref{haldclut} filter.
  17190. The @code{nullsrc} source returns unprocessed video frames. It is
  17191. mainly useful to be employed in analysis / debugging tools, or as the
  17192. source for filters which ignore the input data.
  17193. The @code{pal75bars} source generates a color bars pattern, based on
  17194. EBU PAL recommendations with 75% color levels.
  17195. The @code{pal100bars} source generates a color bars pattern, based on
  17196. EBU PAL recommendations with 100% color levels.
  17197. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  17198. detecting RGB vs BGR issues. You should see a red, green and blue
  17199. stripe from top to bottom.
  17200. The @code{smptebars} source generates a color bars pattern, based on
  17201. the SMPTE Engineering Guideline EG 1-1990.
  17202. The @code{smptehdbars} source generates a color bars pattern, based on
  17203. the SMPTE RP 219-2002.
  17204. The @code{testsrc} source generates a test video pattern, showing a
  17205. color pattern, a scrolling gradient and a timestamp. This is mainly
  17206. intended for testing purposes.
  17207. The @code{testsrc2} source is similar to testsrc, but supports more
  17208. pixel formats instead of just @code{rgb24}. This allows using it as an
  17209. input for other tests without requiring a format conversion.
  17210. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  17211. see a y, cb and cr stripe from top to bottom.
  17212. The sources accept the following parameters:
  17213. @table @option
  17214. @item level
  17215. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  17216. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  17217. pixels to be used as identity matrix for 3D lookup tables. Each component is
  17218. coded on a @code{1/(N*N)} scale.
  17219. @item color, c
  17220. Specify the color of the source, only available in the @code{color}
  17221. source. For the syntax of this option, check the
  17222. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17223. @item size, s
  17224. Specify the size of the sourced video. For the syntax of this option, check the
  17225. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17226. The default value is @code{320x240}.
  17227. This option is not available with the @code{allrgb}, @code{allyuv}, and
  17228. @code{haldclutsrc} filters.
  17229. @item rate, r
  17230. Specify the frame rate of the sourced video, as the number of frames
  17231. generated per second. It has to be a string in the format
  17232. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17233. number or a valid video frame rate abbreviation. The default value is
  17234. "25".
  17235. @item duration, d
  17236. Set the duration of the sourced video. See
  17237. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17238. for the accepted syntax.
  17239. If not specified, or the expressed duration is negative, the video is
  17240. supposed to be generated forever.
  17241. @item sar
  17242. Set the sample aspect ratio of the sourced video.
  17243. @item alpha
  17244. Specify the alpha (opacity) of the background, only available in the
  17245. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  17246. 255 (fully opaque, the default).
  17247. @item decimals, n
  17248. Set the number of decimals to show in the timestamp, only available in the
  17249. @code{testsrc} source.
  17250. The displayed timestamp value will correspond to the original
  17251. timestamp value multiplied by the power of 10 of the specified
  17252. value. Default value is 0.
  17253. @end table
  17254. @subsection Examples
  17255. @itemize
  17256. @item
  17257. Generate a video with a duration of 5.3 seconds, with size
  17258. 176x144 and a frame rate of 10 frames per second:
  17259. @example
  17260. testsrc=duration=5.3:size=qcif:rate=10
  17261. @end example
  17262. @item
  17263. The following graph description will generate a red source
  17264. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  17265. frames per second:
  17266. @example
  17267. color=c=red@@0.2:s=qcif:r=10
  17268. @end example
  17269. @item
  17270. If the input content is to be ignored, @code{nullsrc} can be used. The
  17271. following command generates noise in the luminance plane by employing
  17272. the @code{geq} filter:
  17273. @example
  17274. nullsrc=s=256x256, geq=random(1)*255:128:128
  17275. @end example
  17276. @end itemize
  17277. @subsection Commands
  17278. The @code{color} source supports the following commands:
  17279. @table @option
  17280. @item c, color
  17281. Set the color of the created image. Accepts the same syntax of the
  17282. corresponding @option{color} option.
  17283. @end table
  17284. @section openclsrc
  17285. Generate video using an OpenCL program.
  17286. @table @option
  17287. @item source
  17288. OpenCL program source file.
  17289. @item kernel
  17290. Kernel name in program.
  17291. @item size, s
  17292. Size of frames to generate. This must be set.
  17293. @item format
  17294. Pixel format to use for the generated frames. This must be set.
  17295. @item rate, r
  17296. Number of frames generated every second. Default value is '25'.
  17297. @end table
  17298. For details of how the program loading works, see the @ref{program_opencl}
  17299. filter.
  17300. Example programs:
  17301. @itemize
  17302. @item
  17303. Generate a colour ramp by setting pixel values from the position of the pixel
  17304. in the output image. (Note that this will work with all pixel formats, but
  17305. the generated output will not be the same.)
  17306. @verbatim
  17307. __kernel void ramp(__write_only image2d_t dst,
  17308. unsigned int index)
  17309. {
  17310. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17311. float4 val;
  17312. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  17313. write_imagef(dst, loc, val);
  17314. }
  17315. @end verbatim
  17316. @item
  17317. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  17318. @verbatim
  17319. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  17320. unsigned int index)
  17321. {
  17322. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17323. float4 value = 0.0f;
  17324. int x = loc.x + index;
  17325. int y = loc.y + index;
  17326. while (x > 0 || y > 0) {
  17327. if (x % 3 == 1 && y % 3 == 1) {
  17328. value = 1.0f;
  17329. break;
  17330. }
  17331. x /= 3;
  17332. y /= 3;
  17333. }
  17334. write_imagef(dst, loc, value);
  17335. }
  17336. @end verbatim
  17337. @end itemize
  17338. @section sierpinski
  17339. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  17340. This source accepts the following options:
  17341. @table @option
  17342. @item size, s
  17343. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17344. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17345. @item rate, r
  17346. Set frame rate, expressed as number of frames per second. Default
  17347. value is "25".
  17348. @item seed
  17349. Set seed which is used for random panning.
  17350. @item jump
  17351. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  17352. @item type
  17353. Set fractal type, can be default @code{carpet} or @code{triangle}.
  17354. @end table
  17355. @c man end VIDEO SOURCES
  17356. @chapter Video Sinks
  17357. @c man begin VIDEO SINKS
  17358. Below is a description of the currently available video sinks.
  17359. @section buffersink
  17360. Buffer video frames, and make them available to the end of the filter
  17361. graph.
  17362. This sink is mainly intended for programmatic use, in particular
  17363. through the interface defined in @file{libavfilter/buffersink.h}
  17364. or the options system.
  17365. It accepts a pointer to an AVBufferSinkContext structure, which
  17366. defines the incoming buffers' formats, to be passed as the opaque
  17367. parameter to @code{avfilter_init_filter} for initialization.
  17368. @section nullsink
  17369. Null video sink: do absolutely nothing with the input video. It is
  17370. mainly useful as a template and for use in analysis / debugging
  17371. tools.
  17372. @c man end VIDEO SINKS
  17373. @chapter Multimedia Filters
  17374. @c man begin MULTIMEDIA FILTERS
  17375. Below is a description of the currently available multimedia filters.
  17376. @section abitscope
  17377. Convert input audio to a video output, displaying the audio bit scope.
  17378. The filter accepts the following options:
  17379. @table @option
  17380. @item rate, r
  17381. Set frame rate, expressed as number of frames per second. Default
  17382. value is "25".
  17383. @item size, s
  17384. Specify the video size for the output. For the syntax of this option, check the
  17385. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17386. Default value is @code{1024x256}.
  17387. @item colors
  17388. Specify list of colors separated by space or by '|' which will be used to
  17389. draw channels. Unrecognized or missing colors will be replaced
  17390. by white color.
  17391. @end table
  17392. @section adrawgraph
  17393. Draw a graph using input audio metadata.
  17394. See @ref{drawgraph}
  17395. @section agraphmonitor
  17396. See @ref{graphmonitor}.
  17397. @section ahistogram
  17398. Convert input audio to a video output, displaying the volume histogram.
  17399. The filter accepts the following options:
  17400. @table @option
  17401. @item dmode
  17402. Specify how histogram is calculated.
  17403. It accepts the following values:
  17404. @table @samp
  17405. @item single
  17406. Use single histogram for all channels.
  17407. @item separate
  17408. Use separate histogram for each channel.
  17409. @end table
  17410. Default is @code{single}.
  17411. @item rate, r
  17412. Set frame rate, expressed as number of frames per second. Default
  17413. value is "25".
  17414. @item size, s
  17415. Specify the video size for the output. For the syntax of this option, check the
  17416. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17417. Default value is @code{hd720}.
  17418. @item scale
  17419. Set display scale.
  17420. It accepts the following values:
  17421. @table @samp
  17422. @item log
  17423. logarithmic
  17424. @item sqrt
  17425. square root
  17426. @item cbrt
  17427. cubic root
  17428. @item lin
  17429. linear
  17430. @item rlog
  17431. reverse logarithmic
  17432. @end table
  17433. Default is @code{log}.
  17434. @item ascale
  17435. Set amplitude scale.
  17436. It accepts the following values:
  17437. @table @samp
  17438. @item log
  17439. logarithmic
  17440. @item lin
  17441. linear
  17442. @end table
  17443. Default is @code{log}.
  17444. @item acount
  17445. Set how much frames to accumulate in histogram.
  17446. Default is 1. Setting this to -1 accumulates all frames.
  17447. @item rheight
  17448. Set histogram ratio of window height.
  17449. @item slide
  17450. Set sonogram sliding.
  17451. It accepts the following values:
  17452. @table @samp
  17453. @item replace
  17454. replace old rows with new ones.
  17455. @item scroll
  17456. scroll from top to bottom.
  17457. @end table
  17458. Default is @code{replace}.
  17459. @end table
  17460. @section aphasemeter
  17461. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  17462. representing mean phase of current audio frame. A video output can also be produced and is
  17463. enabled by default. The audio is passed through as first output.
  17464. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  17465. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  17466. and @code{1} means channels are in phase.
  17467. The filter accepts the following options, all related to its video output:
  17468. @table @option
  17469. @item rate, r
  17470. Set the output frame rate. Default value is @code{25}.
  17471. @item size, s
  17472. Set the video size for the output. For the syntax of this option, check the
  17473. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17474. Default value is @code{800x400}.
  17475. @item rc
  17476. @item gc
  17477. @item bc
  17478. Specify the red, green, blue contrast. Default values are @code{2},
  17479. @code{7} and @code{1}.
  17480. Allowed range is @code{[0, 255]}.
  17481. @item mpc
  17482. Set color which will be used for drawing median phase. If color is
  17483. @code{none} which is default, no median phase value will be drawn.
  17484. @item video
  17485. Enable video output. Default is enabled.
  17486. @end table
  17487. @section avectorscope
  17488. Convert input audio to a video output, representing the audio vector
  17489. scope.
  17490. The filter is used to measure the difference between channels of stereo
  17491. audio stream. A monaural signal, consisting of identical left and right
  17492. signal, results in straight vertical line. Any stereo separation is visible
  17493. as a deviation from this line, creating a Lissajous figure.
  17494. If the straight (or deviation from it) but horizontal line appears this
  17495. indicates that the left and right channels are out of phase.
  17496. The filter accepts the following options:
  17497. @table @option
  17498. @item mode, m
  17499. Set the vectorscope mode.
  17500. Available values are:
  17501. @table @samp
  17502. @item lissajous
  17503. Lissajous rotated by 45 degrees.
  17504. @item lissajous_xy
  17505. Same as above but not rotated.
  17506. @item polar
  17507. Shape resembling half of circle.
  17508. @end table
  17509. Default value is @samp{lissajous}.
  17510. @item size, s
  17511. Set the video size for the output. For the syntax of this option, check the
  17512. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17513. Default value is @code{400x400}.
  17514. @item rate, r
  17515. Set the output frame rate. Default value is @code{25}.
  17516. @item rc
  17517. @item gc
  17518. @item bc
  17519. @item ac
  17520. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  17521. @code{160}, @code{80} and @code{255}.
  17522. Allowed range is @code{[0, 255]}.
  17523. @item rf
  17524. @item gf
  17525. @item bf
  17526. @item af
  17527. Specify the red, green, blue and alpha fade. Default values are @code{15},
  17528. @code{10}, @code{5} and @code{5}.
  17529. Allowed range is @code{[0, 255]}.
  17530. @item zoom
  17531. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  17532. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  17533. @item draw
  17534. Set the vectorscope drawing mode.
  17535. Available values are:
  17536. @table @samp
  17537. @item dot
  17538. Draw dot for each sample.
  17539. @item line
  17540. Draw line between previous and current sample.
  17541. @end table
  17542. Default value is @samp{dot}.
  17543. @item scale
  17544. Specify amplitude scale of audio samples.
  17545. Available values are:
  17546. @table @samp
  17547. @item lin
  17548. Linear.
  17549. @item sqrt
  17550. Square root.
  17551. @item cbrt
  17552. Cubic root.
  17553. @item log
  17554. Logarithmic.
  17555. @end table
  17556. @item swap
  17557. Swap left channel axis with right channel axis.
  17558. @item mirror
  17559. Mirror axis.
  17560. @table @samp
  17561. @item none
  17562. No mirror.
  17563. @item x
  17564. Mirror only x axis.
  17565. @item y
  17566. Mirror only y axis.
  17567. @item xy
  17568. Mirror both axis.
  17569. @end table
  17570. @end table
  17571. @subsection Examples
  17572. @itemize
  17573. @item
  17574. Complete example using @command{ffplay}:
  17575. @example
  17576. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  17577. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  17578. @end example
  17579. @end itemize
  17580. @section bench, abench
  17581. Benchmark part of a filtergraph.
  17582. The filter accepts the following options:
  17583. @table @option
  17584. @item action
  17585. Start or stop a timer.
  17586. Available values are:
  17587. @table @samp
  17588. @item start
  17589. Get the current time, set it as frame metadata (using the key
  17590. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  17591. @item stop
  17592. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  17593. the input frame metadata to get the time difference. Time difference, average,
  17594. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  17595. @code{min}) are then printed. The timestamps are expressed in seconds.
  17596. @end table
  17597. @end table
  17598. @subsection Examples
  17599. @itemize
  17600. @item
  17601. Benchmark @ref{selectivecolor} filter:
  17602. @example
  17603. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  17604. @end example
  17605. @end itemize
  17606. @section concat
  17607. Concatenate audio and video streams, joining them together one after the
  17608. other.
  17609. The filter works on segments of synchronized video and audio streams. All
  17610. segments must have the same number of streams of each type, and that will
  17611. also be the number of streams at output.
  17612. The filter accepts the following options:
  17613. @table @option
  17614. @item n
  17615. Set the number of segments. Default is 2.
  17616. @item v
  17617. Set the number of output video streams, that is also the number of video
  17618. streams in each segment. Default is 1.
  17619. @item a
  17620. Set the number of output audio streams, that is also the number of audio
  17621. streams in each segment. Default is 0.
  17622. @item unsafe
  17623. Activate unsafe mode: do not fail if segments have a different format.
  17624. @end table
  17625. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  17626. @var{a} audio outputs.
  17627. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  17628. segment, in the same order as the outputs, then the inputs for the second
  17629. segment, etc.
  17630. Related streams do not always have exactly the same duration, for various
  17631. reasons including codec frame size or sloppy authoring. For that reason,
  17632. related synchronized streams (e.g. a video and its audio track) should be
  17633. concatenated at once. The concat filter will use the duration of the longest
  17634. stream in each segment (except the last one), and if necessary pad shorter
  17635. audio streams with silence.
  17636. For this filter to work correctly, all segments must start at timestamp 0.
  17637. All corresponding streams must have the same parameters in all segments; the
  17638. filtering system will automatically select a common pixel format for video
  17639. streams, and a common sample format, sample rate and channel layout for
  17640. audio streams, but other settings, such as resolution, must be converted
  17641. explicitly by the user.
  17642. Different frame rates are acceptable but will result in variable frame rate
  17643. at output; be sure to configure the output file to handle it.
  17644. @subsection Examples
  17645. @itemize
  17646. @item
  17647. Concatenate an opening, an episode and an ending, all in bilingual version
  17648. (video in stream 0, audio in streams 1 and 2):
  17649. @example
  17650. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  17651. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  17652. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  17653. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  17654. @end example
  17655. @item
  17656. Concatenate two parts, handling audio and video separately, using the
  17657. (a)movie sources, and adjusting the resolution:
  17658. @example
  17659. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  17660. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  17661. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  17662. @end example
  17663. Note that a desync will happen at the stitch if the audio and video streams
  17664. do not have exactly the same duration in the first file.
  17665. @end itemize
  17666. @subsection Commands
  17667. This filter supports the following commands:
  17668. @table @option
  17669. @item next
  17670. Close the current segment and step to the next one
  17671. @end table
  17672. @anchor{ebur128}
  17673. @section ebur128
  17674. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  17675. level. By default, it logs a message at a frequency of 10Hz with the
  17676. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  17677. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  17678. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  17679. sample format is double-precision floating point. The input stream will be converted to
  17680. this specification, if needed. Users may need to insert aformat and/or aresample filters
  17681. after this filter to obtain the original parameters.
  17682. The filter also has a video output (see the @var{video} option) with a real
  17683. time graph to observe the loudness evolution. The graphic contains the logged
  17684. message mentioned above, so it is not printed anymore when this option is set,
  17685. unless the verbose logging is set. The main graphing area contains the
  17686. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  17687. the momentary loudness (400 milliseconds), but can optionally be configured
  17688. to instead display short-term loudness (see @var{gauge}).
  17689. The green area marks a +/- 1LU target range around the target loudness
  17690. (-23LUFS by default, unless modified through @var{target}).
  17691. More information about the Loudness Recommendation EBU R128 on
  17692. @url{http://tech.ebu.ch/loudness}.
  17693. The filter accepts the following options:
  17694. @table @option
  17695. @item video
  17696. Activate the video output. The audio stream is passed unchanged whether this
  17697. option is set or no. The video stream will be the first output stream if
  17698. activated. Default is @code{0}.
  17699. @item size
  17700. Set the video size. This option is for video only. For the syntax of this
  17701. option, check the
  17702. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17703. Default and minimum resolution is @code{640x480}.
  17704. @item meter
  17705. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  17706. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  17707. other integer value between this range is allowed.
  17708. @item metadata
  17709. Set metadata injection. If set to @code{1}, the audio input will be segmented
  17710. into 100ms output frames, each of them containing various loudness information
  17711. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  17712. Default is @code{0}.
  17713. @item framelog
  17714. Force the frame logging level.
  17715. Available values are:
  17716. @table @samp
  17717. @item info
  17718. information logging level
  17719. @item verbose
  17720. verbose logging level
  17721. @end table
  17722. By default, the logging level is set to @var{info}. If the @option{video} or
  17723. the @option{metadata} options are set, it switches to @var{verbose}.
  17724. @item peak
  17725. Set peak mode(s).
  17726. Available modes can be cumulated (the option is a @code{flag} type). Possible
  17727. values are:
  17728. @table @samp
  17729. @item none
  17730. Disable any peak mode (default).
  17731. @item sample
  17732. Enable sample-peak mode.
  17733. Simple peak mode looking for the higher sample value. It logs a message
  17734. for sample-peak (identified by @code{SPK}).
  17735. @item true
  17736. Enable true-peak mode.
  17737. If enabled, the peak lookup is done on an over-sampled version of the input
  17738. stream for better peak accuracy. It logs a message for true-peak.
  17739. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  17740. This mode requires a build with @code{libswresample}.
  17741. @end table
  17742. @item dualmono
  17743. Treat mono input files as "dual mono". If a mono file is intended for playback
  17744. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  17745. If set to @code{true}, this option will compensate for this effect.
  17746. Multi-channel input files are not affected by this option.
  17747. @item panlaw
  17748. Set a specific pan law to be used for the measurement of dual mono files.
  17749. This parameter is optional, and has a default value of -3.01dB.
  17750. @item target
  17751. Set a specific target level (in LUFS) used as relative zero in the visualization.
  17752. This parameter is optional and has a default value of -23LUFS as specified
  17753. by EBU R128. However, material published online may prefer a level of -16LUFS
  17754. (e.g. for use with podcasts or video platforms).
  17755. @item gauge
  17756. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  17757. @code{shortterm}. By default the momentary value will be used, but in certain
  17758. scenarios it may be more useful to observe the short term value instead (e.g.
  17759. live mixing).
  17760. @item scale
  17761. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  17762. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  17763. video output, not the summary or continuous log output.
  17764. @end table
  17765. @subsection Examples
  17766. @itemize
  17767. @item
  17768. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  17769. @example
  17770. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  17771. @end example
  17772. @item
  17773. Run an analysis with @command{ffmpeg}:
  17774. @example
  17775. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  17776. @end example
  17777. @end itemize
  17778. @section interleave, ainterleave
  17779. Temporally interleave frames from several inputs.
  17780. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  17781. These filters read frames from several inputs and send the oldest
  17782. queued frame to the output.
  17783. Input streams must have well defined, monotonically increasing frame
  17784. timestamp values.
  17785. In order to submit one frame to output, these filters need to enqueue
  17786. at least one frame for each input, so they cannot work in case one
  17787. input is not yet terminated and will not receive incoming frames.
  17788. For example consider the case when one input is a @code{select} filter
  17789. which always drops input frames. The @code{interleave} filter will keep
  17790. reading from that input, but it will never be able to send new frames
  17791. to output until the input sends an end-of-stream signal.
  17792. Also, depending on inputs synchronization, the filters will drop
  17793. frames in case one input receives more frames than the other ones, and
  17794. the queue is already filled.
  17795. These filters accept the following options:
  17796. @table @option
  17797. @item nb_inputs, n
  17798. Set the number of different inputs, it is 2 by default.
  17799. @item duration
  17800. How to determine the end-of-stream.
  17801. @table @option
  17802. @item longest
  17803. The duration of the longest input. (default)
  17804. @item shortest
  17805. The duration of the shortest input.
  17806. @item first
  17807. The duration of the first input.
  17808. @end table
  17809. @end table
  17810. @subsection Examples
  17811. @itemize
  17812. @item
  17813. Interleave frames belonging to different streams using @command{ffmpeg}:
  17814. @example
  17815. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  17816. @end example
  17817. @item
  17818. Add flickering blur effect:
  17819. @example
  17820. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  17821. @end example
  17822. @end itemize
  17823. @section metadata, ametadata
  17824. Manipulate frame metadata.
  17825. This filter accepts the following options:
  17826. @table @option
  17827. @item mode
  17828. Set mode of operation of the filter.
  17829. Can be one of the following:
  17830. @table @samp
  17831. @item select
  17832. If both @code{value} and @code{key} is set, select frames
  17833. which have such metadata. If only @code{key} is set, select
  17834. every frame that has such key in metadata.
  17835. @item add
  17836. Add new metadata @code{key} and @code{value}. If key is already available
  17837. do nothing.
  17838. @item modify
  17839. Modify value of already present key.
  17840. @item delete
  17841. If @code{value} is set, delete only keys that have such value.
  17842. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  17843. the frame.
  17844. @item print
  17845. Print key and its value if metadata was found. If @code{key} is not set print all
  17846. metadata values available in frame.
  17847. @end table
  17848. @item key
  17849. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  17850. @item value
  17851. Set metadata value which will be used. This option is mandatory for
  17852. @code{modify} and @code{add} mode.
  17853. @item function
  17854. Which function to use when comparing metadata value and @code{value}.
  17855. Can be one of following:
  17856. @table @samp
  17857. @item same_str
  17858. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  17859. @item starts_with
  17860. Values are interpreted as strings, returns true if metadata value starts with
  17861. the @code{value} option string.
  17862. @item less
  17863. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  17864. @item equal
  17865. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  17866. @item greater
  17867. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  17868. @item expr
  17869. Values are interpreted as floats, returns true if expression from option @code{expr}
  17870. evaluates to true.
  17871. @item ends_with
  17872. Values are interpreted as strings, returns true if metadata value ends with
  17873. the @code{value} option string.
  17874. @end table
  17875. @item expr
  17876. Set expression which is used when @code{function} is set to @code{expr}.
  17877. The expression is evaluated through the eval API and can contain the following
  17878. constants:
  17879. @table @option
  17880. @item VALUE1
  17881. Float representation of @code{value} from metadata key.
  17882. @item VALUE2
  17883. Float representation of @code{value} as supplied by user in @code{value} option.
  17884. @end table
  17885. @item file
  17886. If specified in @code{print} mode, output is written to the named file. Instead of
  17887. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  17888. for standard output. If @code{file} option is not set, output is written to the log
  17889. with AV_LOG_INFO loglevel.
  17890. @item direct
  17891. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  17892. @end table
  17893. @subsection Examples
  17894. @itemize
  17895. @item
  17896. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  17897. between 0 and 1.
  17898. @example
  17899. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  17900. @end example
  17901. @item
  17902. Print silencedetect output to file @file{metadata.txt}.
  17903. @example
  17904. silencedetect,ametadata=mode=print:file=metadata.txt
  17905. @end example
  17906. @item
  17907. Direct all metadata to a pipe with file descriptor 4.
  17908. @example
  17909. metadata=mode=print:file='pipe\:4'
  17910. @end example
  17911. @end itemize
  17912. @section perms, aperms
  17913. Set read/write permissions for the output frames.
  17914. These filters are mainly aimed at developers to test direct path in the
  17915. following filter in the filtergraph.
  17916. The filters accept the following options:
  17917. @table @option
  17918. @item mode
  17919. Select the permissions mode.
  17920. It accepts the following values:
  17921. @table @samp
  17922. @item none
  17923. Do nothing. This is the default.
  17924. @item ro
  17925. Set all the output frames read-only.
  17926. @item rw
  17927. Set all the output frames directly writable.
  17928. @item toggle
  17929. Make the frame read-only if writable, and writable if read-only.
  17930. @item random
  17931. Set each output frame read-only or writable randomly.
  17932. @end table
  17933. @item seed
  17934. Set the seed for the @var{random} mode, must be an integer included between
  17935. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  17936. @code{-1}, the filter will try to use a good random seed on a best effort
  17937. basis.
  17938. @end table
  17939. Note: in case of auto-inserted filter between the permission filter and the
  17940. following one, the permission might not be received as expected in that
  17941. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  17942. perms/aperms filter can avoid this problem.
  17943. @section realtime, arealtime
  17944. Slow down filtering to match real time approximately.
  17945. These filters will pause the filtering for a variable amount of time to
  17946. match the output rate with the input timestamps.
  17947. They are similar to the @option{re} option to @code{ffmpeg}.
  17948. They accept the following options:
  17949. @table @option
  17950. @item limit
  17951. Time limit for the pauses. Any pause longer than that will be considered
  17952. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  17953. @item speed
  17954. Speed factor for processing. The value must be a float larger than zero.
  17955. Values larger than 1.0 will result in faster than realtime processing,
  17956. smaller will slow processing down. The @var{limit} is automatically adapted
  17957. accordingly. Default is 1.0.
  17958. A processing speed faster than what is possible without these filters cannot
  17959. be achieved.
  17960. @end table
  17961. @anchor{select}
  17962. @section select, aselect
  17963. Select frames to pass in output.
  17964. This filter accepts the following options:
  17965. @table @option
  17966. @item expr, e
  17967. Set expression, which is evaluated for each input frame.
  17968. If the expression is evaluated to zero, the frame is discarded.
  17969. If the evaluation result is negative or NaN, the frame is sent to the
  17970. first output; otherwise it is sent to the output with index
  17971. @code{ceil(val)-1}, assuming that the input index starts from 0.
  17972. For example a value of @code{1.2} corresponds to the output with index
  17973. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  17974. @item outputs, n
  17975. Set the number of outputs. The output to which to send the selected
  17976. frame is based on the result of the evaluation. Default value is 1.
  17977. @end table
  17978. The expression can contain the following constants:
  17979. @table @option
  17980. @item n
  17981. The (sequential) number of the filtered frame, starting from 0.
  17982. @item selected_n
  17983. The (sequential) number of the selected frame, starting from 0.
  17984. @item prev_selected_n
  17985. The sequential number of the last selected frame. It's NAN if undefined.
  17986. @item TB
  17987. The timebase of the input timestamps.
  17988. @item pts
  17989. The PTS (Presentation TimeStamp) of the filtered video frame,
  17990. expressed in @var{TB} units. It's NAN if undefined.
  17991. @item t
  17992. The PTS of the filtered video frame,
  17993. expressed in seconds. It's NAN if undefined.
  17994. @item prev_pts
  17995. The PTS of the previously filtered video frame. It's NAN if undefined.
  17996. @item prev_selected_pts
  17997. The PTS of the last previously filtered video frame. It's NAN if undefined.
  17998. @item prev_selected_t
  17999. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  18000. @item start_pts
  18001. The PTS of the first video frame in the video. It's NAN if undefined.
  18002. @item start_t
  18003. The time of the first video frame in the video. It's NAN if undefined.
  18004. @item pict_type @emph{(video only)}
  18005. The type of the filtered frame. It can assume one of the following
  18006. values:
  18007. @table @option
  18008. @item I
  18009. @item P
  18010. @item B
  18011. @item S
  18012. @item SI
  18013. @item SP
  18014. @item BI
  18015. @end table
  18016. @item interlace_type @emph{(video only)}
  18017. The frame interlace type. It can assume one of the following values:
  18018. @table @option
  18019. @item PROGRESSIVE
  18020. The frame is progressive (not interlaced).
  18021. @item TOPFIRST
  18022. The frame is top-field-first.
  18023. @item BOTTOMFIRST
  18024. The frame is bottom-field-first.
  18025. @end table
  18026. @item consumed_sample_n @emph{(audio only)}
  18027. the number of selected samples before the current frame
  18028. @item samples_n @emph{(audio only)}
  18029. the number of samples in the current frame
  18030. @item sample_rate @emph{(audio only)}
  18031. the input sample rate
  18032. @item key
  18033. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  18034. @item pos
  18035. the position in the file of the filtered frame, -1 if the information
  18036. is not available (e.g. for synthetic video)
  18037. @item scene @emph{(video only)}
  18038. value between 0 and 1 to indicate a new scene; a low value reflects a low
  18039. probability for the current frame to introduce a new scene, while a higher
  18040. value means the current frame is more likely to be one (see the example below)
  18041. @item concatdec_select
  18042. The concat demuxer can select only part of a concat input file by setting an
  18043. inpoint and an outpoint, but the output packets may not be entirely contained
  18044. in the selected interval. By using this variable, it is possible to skip frames
  18045. generated by the concat demuxer which are not exactly contained in the selected
  18046. interval.
  18047. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  18048. and the @var{lavf.concat.duration} packet metadata values which are also
  18049. present in the decoded frames.
  18050. The @var{concatdec_select} variable is -1 if the frame pts is at least
  18051. start_time and either the duration metadata is missing or the frame pts is less
  18052. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  18053. missing.
  18054. That basically means that an input frame is selected if its pts is within the
  18055. interval set by the concat demuxer.
  18056. @end table
  18057. The default value of the select expression is "1".
  18058. @subsection Examples
  18059. @itemize
  18060. @item
  18061. Select all frames in input:
  18062. @example
  18063. select
  18064. @end example
  18065. The example above is the same as:
  18066. @example
  18067. select=1
  18068. @end example
  18069. @item
  18070. Skip all frames:
  18071. @example
  18072. select=0
  18073. @end example
  18074. @item
  18075. Select only I-frames:
  18076. @example
  18077. select='eq(pict_type\,I)'
  18078. @end example
  18079. @item
  18080. Select one frame every 100:
  18081. @example
  18082. select='not(mod(n\,100))'
  18083. @end example
  18084. @item
  18085. Select only frames contained in the 10-20 time interval:
  18086. @example
  18087. select=between(t\,10\,20)
  18088. @end example
  18089. @item
  18090. Select only I-frames contained in the 10-20 time interval:
  18091. @example
  18092. select=between(t\,10\,20)*eq(pict_type\,I)
  18093. @end example
  18094. @item
  18095. Select frames with a minimum distance of 10 seconds:
  18096. @example
  18097. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  18098. @end example
  18099. @item
  18100. Use aselect to select only audio frames with samples number > 100:
  18101. @example
  18102. aselect='gt(samples_n\,100)'
  18103. @end example
  18104. @item
  18105. Create a mosaic of the first scenes:
  18106. @example
  18107. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  18108. @end example
  18109. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  18110. choice.
  18111. @item
  18112. Send even and odd frames to separate outputs, and compose them:
  18113. @example
  18114. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  18115. @end example
  18116. @item
  18117. Select useful frames from an ffconcat file which is using inpoints and
  18118. outpoints but where the source files are not intra frame only.
  18119. @example
  18120. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  18121. @end example
  18122. @end itemize
  18123. @section sendcmd, asendcmd
  18124. Send commands to filters in the filtergraph.
  18125. These filters read commands to be sent to other filters in the
  18126. filtergraph.
  18127. @code{sendcmd} must be inserted between two video filters,
  18128. @code{asendcmd} must be inserted between two audio filters, but apart
  18129. from that they act the same way.
  18130. The specification of commands can be provided in the filter arguments
  18131. with the @var{commands} option, or in a file specified by the
  18132. @var{filename} option.
  18133. These filters accept the following options:
  18134. @table @option
  18135. @item commands, c
  18136. Set the commands to be read and sent to the other filters.
  18137. @item filename, f
  18138. Set the filename of the commands to be read and sent to the other
  18139. filters.
  18140. @end table
  18141. @subsection Commands syntax
  18142. A commands description consists of a sequence of interval
  18143. specifications, comprising a list of commands to be executed when a
  18144. particular event related to that interval occurs. The occurring event
  18145. is typically the current frame time entering or leaving a given time
  18146. interval.
  18147. An interval is specified by the following syntax:
  18148. @example
  18149. @var{START}[-@var{END}] @var{COMMANDS};
  18150. @end example
  18151. The time interval is specified by the @var{START} and @var{END} times.
  18152. @var{END} is optional and defaults to the maximum time.
  18153. The current frame time is considered within the specified interval if
  18154. it is included in the interval [@var{START}, @var{END}), that is when
  18155. the time is greater or equal to @var{START} and is lesser than
  18156. @var{END}.
  18157. @var{COMMANDS} consists of a sequence of one or more command
  18158. specifications, separated by ",", relating to that interval. The
  18159. syntax of a command specification is given by:
  18160. @example
  18161. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  18162. @end example
  18163. @var{FLAGS} is optional and specifies the type of events relating to
  18164. the time interval which enable sending the specified command, and must
  18165. be a non-null sequence of identifier flags separated by "+" or "|" and
  18166. enclosed between "[" and "]".
  18167. The following flags are recognized:
  18168. @table @option
  18169. @item enter
  18170. The command is sent when the current frame timestamp enters the
  18171. specified interval. In other words, the command is sent when the
  18172. previous frame timestamp was not in the given interval, and the
  18173. current is.
  18174. @item leave
  18175. The command is sent when the current frame timestamp leaves the
  18176. specified interval. In other words, the command is sent when the
  18177. previous frame timestamp was in the given interval, and the
  18178. current is not.
  18179. @item expr
  18180. The command @var{ARG} is interpreted as expression and result of
  18181. expression is passed as @var{ARG}.
  18182. The expression is evaluated through the eval API and can contain the following
  18183. constants:
  18184. @table @option
  18185. @item POS
  18186. Original position in the file of the frame, or undefined if undefined
  18187. for the current frame.
  18188. @item PTS
  18189. The presentation timestamp in input.
  18190. @item N
  18191. The count of the input frame for video or audio, starting from 0.
  18192. @item T
  18193. The time in seconds of the current frame.
  18194. @item TS
  18195. The start time in seconds of the current command interval.
  18196. @item TE
  18197. The end time in seconds of the current command interval.
  18198. @item TI
  18199. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  18200. @end table
  18201. @end table
  18202. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  18203. assumed.
  18204. @var{TARGET} specifies the target of the command, usually the name of
  18205. the filter class or a specific filter instance name.
  18206. @var{COMMAND} specifies the name of the command for the target filter.
  18207. @var{ARG} is optional and specifies the optional list of argument for
  18208. the given @var{COMMAND}.
  18209. Between one interval specification and another, whitespaces, or
  18210. sequences of characters starting with @code{#} until the end of line,
  18211. are ignored and can be used to annotate comments.
  18212. A simplified BNF description of the commands specification syntax
  18213. follows:
  18214. @example
  18215. @var{COMMAND_FLAG} ::= "enter" | "leave"
  18216. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  18217. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  18218. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  18219. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  18220. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  18221. @end example
  18222. @subsection Examples
  18223. @itemize
  18224. @item
  18225. Specify audio tempo change at second 4:
  18226. @example
  18227. asendcmd=c='4.0 atempo tempo 1.5',atempo
  18228. @end example
  18229. @item
  18230. Target a specific filter instance:
  18231. @example
  18232. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  18233. @end example
  18234. @item
  18235. Specify a list of drawtext and hue commands in a file.
  18236. @example
  18237. # show text in the interval 5-10
  18238. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  18239. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  18240. # desaturate the image in the interval 15-20
  18241. 15.0-20.0 [enter] hue s 0,
  18242. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  18243. [leave] hue s 1,
  18244. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  18245. # apply an exponential saturation fade-out effect, starting from time 25
  18246. 25 [enter] hue s exp(25-t)
  18247. @end example
  18248. A filtergraph allowing to read and process the above command list
  18249. stored in a file @file{test.cmd}, can be specified with:
  18250. @example
  18251. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  18252. @end example
  18253. @end itemize
  18254. @anchor{setpts}
  18255. @section setpts, asetpts
  18256. Change the PTS (presentation timestamp) of the input frames.
  18257. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  18258. This filter accepts the following options:
  18259. @table @option
  18260. @item expr
  18261. The expression which is evaluated for each frame to construct its timestamp.
  18262. @end table
  18263. The expression is evaluated through the eval API and can contain the following
  18264. constants:
  18265. @table @option
  18266. @item FRAME_RATE, FR
  18267. frame rate, only defined for constant frame-rate video
  18268. @item PTS
  18269. The presentation timestamp in input
  18270. @item N
  18271. The count of the input frame for video or the number of consumed samples,
  18272. not including the current frame for audio, starting from 0.
  18273. @item NB_CONSUMED_SAMPLES
  18274. The number of consumed samples, not including the current frame (only
  18275. audio)
  18276. @item NB_SAMPLES, S
  18277. The number of samples in the current frame (only audio)
  18278. @item SAMPLE_RATE, SR
  18279. The audio sample rate.
  18280. @item STARTPTS
  18281. The PTS of the first frame.
  18282. @item STARTT
  18283. the time in seconds of the first frame
  18284. @item INTERLACED
  18285. State whether the current frame is interlaced.
  18286. @item T
  18287. the time in seconds of the current frame
  18288. @item POS
  18289. original position in the file of the frame, or undefined if undefined
  18290. for the current frame
  18291. @item PREV_INPTS
  18292. The previous input PTS.
  18293. @item PREV_INT
  18294. previous input time in seconds
  18295. @item PREV_OUTPTS
  18296. The previous output PTS.
  18297. @item PREV_OUTT
  18298. previous output time in seconds
  18299. @item RTCTIME
  18300. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  18301. instead.
  18302. @item RTCSTART
  18303. The wallclock (RTC) time at the start of the movie in microseconds.
  18304. @item TB
  18305. The timebase of the input timestamps.
  18306. @end table
  18307. @subsection Examples
  18308. @itemize
  18309. @item
  18310. Start counting PTS from zero
  18311. @example
  18312. setpts=PTS-STARTPTS
  18313. @end example
  18314. @item
  18315. Apply fast motion effect:
  18316. @example
  18317. setpts=0.5*PTS
  18318. @end example
  18319. @item
  18320. Apply slow motion effect:
  18321. @example
  18322. setpts=2.0*PTS
  18323. @end example
  18324. @item
  18325. Set fixed rate of 25 frames per second:
  18326. @example
  18327. setpts=N/(25*TB)
  18328. @end example
  18329. @item
  18330. Set fixed rate 25 fps with some jitter:
  18331. @example
  18332. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  18333. @end example
  18334. @item
  18335. Apply an offset of 10 seconds to the input PTS:
  18336. @example
  18337. setpts=PTS+10/TB
  18338. @end example
  18339. @item
  18340. Generate timestamps from a "live source" and rebase onto the current timebase:
  18341. @example
  18342. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  18343. @end example
  18344. @item
  18345. Generate timestamps by counting samples:
  18346. @example
  18347. asetpts=N/SR/TB
  18348. @end example
  18349. @end itemize
  18350. @section setrange
  18351. Force color range for the output video frame.
  18352. The @code{setrange} filter marks the color range property for the
  18353. output frames. It does not change the input frame, but only sets the
  18354. corresponding property, which affects how the frame is treated by
  18355. following filters.
  18356. The filter accepts the following options:
  18357. @table @option
  18358. @item range
  18359. Available values are:
  18360. @table @samp
  18361. @item auto
  18362. Keep the same color range property.
  18363. @item unspecified, unknown
  18364. Set the color range as unspecified.
  18365. @item limited, tv, mpeg
  18366. Set the color range as limited.
  18367. @item full, pc, jpeg
  18368. Set the color range as full.
  18369. @end table
  18370. @end table
  18371. @section settb, asettb
  18372. Set the timebase to use for the output frames timestamps.
  18373. It is mainly useful for testing timebase configuration.
  18374. It accepts the following parameters:
  18375. @table @option
  18376. @item expr, tb
  18377. The expression which is evaluated into the output timebase.
  18378. @end table
  18379. The value for @option{tb} is an arithmetic expression representing a
  18380. rational. The expression can contain the constants "AVTB" (the default
  18381. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  18382. audio only). Default value is "intb".
  18383. @subsection Examples
  18384. @itemize
  18385. @item
  18386. Set the timebase to 1/25:
  18387. @example
  18388. settb=expr=1/25
  18389. @end example
  18390. @item
  18391. Set the timebase to 1/10:
  18392. @example
  18393. settb=expr=0.1
  18394. @end example
  18395. @item
  18396. Set the timebase to 1001/1000:
  18397. @example
  18398. settb=1+0.001
  18399. @end example
  18400. @item
  18401. Set the timebase to 2*intb:
  18402. @example
  18403. settb=2*intb
  18404. @end example
  18405. @item
  18406. Set the default timebase value:
  18407. @example
  18408. settb=AVTB
  18409. @end example
  18410. @end itemize
  18411. @section showcqt
  18412. Convert input audio to a video output representing frequency spectrum
  18413. logarithmically using Brown-Puckette constant Q transform algorithm with
  18414. direct frequency domain coefficient calculation (but the transform itself
  18415. is not really constant Q, instead the Q factor is actually variable/clamped),
  18416. with musical tone scale, from E0 to D#10.
  18417. The filter accepts the following options:
  18418. @table @option
  18419. @item size, s
  18420. Specify the video size for the output. It must be even. For the syntax of this option,
  18421. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18422. Default value is @code{1920x1080}.
  18423. @item fps, rate, r
  18424. Set the output frame rate. Default value is @code{25}.
  18425. @item bar_h
  18426. Set the bargraph height. It must be even. Default value is @code{-1} which
  18427. computes the bargraph height automatically.
  18428. @item axis_h
  18429. Set the axis height. It must be even. Default value is @code{-1} which computes
  18430. the axis height automatically.
  18431. @item sono_h
  18432. Set the sonogram height. It must be even. Default value is @code{-1} which
  18433. computes the sonogram height automatically.
  18434. @item fullhd
  18435. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  18436. instead. Default value is @code{1}.
  18437. @item sono_v, volume
  18438. Specify the sonogram volume expression. It can contain variables:
  18439. @table @option
  18440. @item bar_v
  18441. the @var{bar_v} evaluated expression
  18442. @item frequency, freq, f
  18443. the frequency where it is evaluated
  18444. @item timeclamp, tc
  18445. the value of @var{timeclamp} option
  18446. @end table
  18447. and functions:
  18448. @table @option
  18449. @item a_weighting(f)
  18450. A-weighting of equal loudness
  18451. @item b_weighting(f)
  18452. B-weighting of equal loudness
  18453. @item c_weighting(f)
  18454. C-weighting of equal loudness.
  18455. @end table
  18456. Default value is @code{16}.
  18457. @item bar_v, volume2
  18458. Specify the bargraph volume expression. It can contain variables:
  18459. @table @option
  18460. @item sono_v
  18461. the @var{sono_v} evaluated expression
  18462. @item frequency, freq, f
  18463. the frequency where it is evaluated
  18464. @item timeclamp, tc
  18465. the value of @var{timeclamp} option
  18466. @end table
  18467. and functions:
  18468. @table @option
  18469. @item a_weighting(f)
  18470. A-weighting of equal loudness
  18471. @item b_weighting(f)
  18472. B-weighting of equal loudness
  18473. @item c_weighting(f)
  18474. C-weighting of equal loudness.
  18475. @end table
  18476. Default value is @code{sono_v}.
  18477. @item sono_g, gamma
  18478. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  18479. higher gamma makes the spectrum having more range. Default value is @code{3}.
  18480. Acceptable range is @code{[1, 7]}.
  18481. @item bar_g, gamma2
  18482. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  18483. @code{[1, 7]}.
  18484. @item bar_t
  18485. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  18486. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  18487. @item timeclamp, tc
  18488. Specify the transform timeclamp. At low frequency, there is trade-off between
  18489. accuracy in time domain and frequency domain. If timeclamp is lower,
  18490. event in time domain is represented more accurately (such as fast bass drum),
  18491. otherwise event in frequency domain is represented more accurately
  18492. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  18493. @item attack
  18494. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  18495. limits future samples by applying asymmetric windowing in time domain, useful
  18496. when low latency is required. Accepted range is @code{[0, 1]}.
  18497. @item basefreq
  18498. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  18499. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  18500. @item endfreq
  18501. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  18502. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  18503. @item coeffclamp
  18504. This option is deprecated and ignored.
  18505. @item tlength
  18506. Specify the transform length in time domain. Use this option to control accuracy
  18507. trade-off between time domain and frequency domain at every frequency sample.
  18508. It can contain variables:
  18509. @table @option
  18510. @item frequency, freq, f
  18511. the frequency where it is evaluated
  18512. @item timeclamp, tc
  18513. the value of @var{timeclamp} option.
  18514. @end table
  18515. Default value is @code{384*tc/(384+tc*f)}.
  18516. @item count
  18517. Specify the transform count for every video frame. Default value is @code{6}.
  18518. Acceptable range is @code{[1, 30]}.
  18519. @item fcount
  18520. Specify the transform count for every single pixel. Default value is @code{0},
  18521. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  18522. @item fontfile
  18523. Specify font file for use with freetype to draw the axis. If not specified,
  18524. use embedded font. Note that drawing with font file or embedded font is not
  18525. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  18526. option instead.
  18527. @item font
  18528. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  18529. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  18530. escaping.
  18531. @item fontcolor
  18532. Specify font color expression. This is arithmetic expression that should return
  18533. integer value 0xRRGGBB. It can contain variables:
  18534. @table @option
  18535. @item frequency, freq, f
  18536. the frequency where it is evaluated
  18537. @item timeclamp, tc
  18538. the value of @var{timeclamp} option
  18539. @end table
  18540. and functions:
  18541. @table @option
  18542. @item midi(f)
  18543. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  18544. @item r(x), g(x), b(x)
  18545. red, green, and blue value of intensity x.
  18546. @end table
  18547. Default value is @code{st(0, (midi(f)-59.5)/12);
  18548. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  18549. r(1-ld(1)) + b(ld(1))}.
  18550. @item axisfile
  18551. Specify image file to draw the axis. This option override @var{fontfile} and
  18552. @var{fontcolor} option.
  18553. @item axis, text
  18554. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  18555. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  18556. Default value is @code{1}.
  18557. @item csp
  18558. Set colorspace. The accepted values are:
  18559. @table @samp
  18560. @item unspecified
  18561. Unspecified (default)
  18562. @item bt709
  18563. BT.709
  18564. @item fcc
  18565. FCC
  18566. @item bt470bg
  18567. BT.470BG or BT.601-6 625
  18568. @item smpte170m
  18569. SMPTE-170M or BT.601-6 525
  18570. @item smpte240m
  18571. SMPTE-240M
  18572. @item bt2020ncl
  18573. BT.2020 with non-constant luminance
  18574. @end table
  18575. @item cscheme
  18576. Set spectrogram color scheme. This is list of floating point values with format
  18577. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  18578. The default is @code{1|0.5|0|0|0.5|1}.
  18579. @end table
  18580. @subsection Examples
  18581. @itemize
  18582. @item
  18583. Playing audio while showing the spectrum:
  18584. @example
  18585. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  18586. @end example
  18587. @item
  18588. Same as above, but with frame rate 30 fps:
  18589. @example
  18590. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  18591. @end example
  18592. @item
  18593. Playing at 1280x720:
  18594. @example
  18595. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  18596. @end example
  18597. @item
  18598. Disable sonogram display:
  18599. @example
  18600. sono_h=0
  18601. @end example
  18602. @item
  18603. A1 and its harmonics: A1, A2, (near)E3, A3:
  18604. @example
  18605. 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),
  18606. asplit[a][out1]; [a] showcqt [out0]'
  18607. @end example
  18608. @item
  18609. Same as above, but with more accuracy in frequency domain:
  18610. @example
  18611. 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),
  18612. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  18613. @end example
  18614. @item
  18615. Custom volume:
  18616. @example
  18617. bar_v=10:sono_v=bar_v*a_weighting(f)
  18618. @end example
  18619. @item
  18620. Custom gamma, now spectrum is linear to the amplitude.
  18621. @example
  18622. bar_g=2:sono_g=2
  18623. @end example
  18624. @item
  18625. Custom tlength equation:
  18626. @example
  18627. 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)))'
  18628. @end example
  18629. @item
  18630. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  18631. @example
  18632. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  18633. @end example
  18634. @item
  18635. Custom font using fontconfig:
  18636. @example
  18637. font='Courier New,Monospace,mono|bold'
  18638. @end example
  18639. @item
  18640. Custom frequency range with custom axis using image file:
  18641. @example
  18642. axisfile=myaxis.png:basefreq=40:endfreq=10000
  18643. @end example
  18644. @end itemize
  18645. @section showfreqs
  18646. Convert input audio to video output representing the audio power spectrum.
  18647. Audio amplitude is on Y-axis while frequency is on X-axis.
  18648. The filter accepts the following options:
  18649. @table @option
  18650. @item size, s
  18651. Specify size of video. For the syntax of this option, check the
  18652. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18653. Default is @code{1024x512}.
  18654. @item mode
  18655. Set display mode.
  18656. This set how each frequency bin will be represented.
  18657. It accepts the following values:
  18658. @table @samp
  18659. @item line
  18660. @item bar
  18661. @item dot
  18662. @end table
  18663. Default is @code{bar}.
  18664. @item ascale
  18665. Set amplitude scale.
  18666. It accepts the following values:
  18667. @table @samp
  18668. @item lin
  18669. Linear scale.
  18670. @item sqrt
  18671. Square root scale.
  18672. @item cbrt
  18673. Cubic root scale.
  18674. @item log
  18675. Logarithmic scale.
  18676. @end table
  18677. Default is @code{log}.
  18678. @item fscale
  18679. Set frequency scale.
  18680. It accepts the following values:
  18681. @table @samp
  18682. @item lin
  18683. Linear scale.
  18684. @item log
  18685. Logarithmic scale.
  18686. @item rlog
  18687. Reverse logarithmic scale.
  18688. @end table
  18689. Default is @code{lin}.
  18690. @item win_size
  18691. Set window size. Allowed range is from 16 to 65536.
  18692. Default is @code{2048}
  18693. @item win_func
  18694. Set windowing function.
  18695. It accepts the following values:
  18696. @table @samp
  18697. @item rect
  18698. @item bartlett
  18699. @item hanning
  18700. @item hamming
  18701. @item blackman
  18702. @item welch
  18703. @item flattop
  18704. @item bharris
  18705. @item bnuttall
  18706. @item bhann
  18707. @item sine
  18708. @item nuttall
  18709. @item lanczos
  18710. @item gauss
  18711. @item tukey
  18712. @item dolph
  18713. @item cauchy
  18714. @item parzen
  18715. @item poisson
  18716. @item bohman
  18717. @end table
  18718. Default is @code{hanning}.
  18719. @item overlap
  18720. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  18721. which means optimal overlap for selected window function will be picked.
  18722. @item averaging
  18723. Set time averaging. Setting this to 0 will display current maximal peaks.
  18724. Default is @code{1}, which means time averaging is disabled.
  18725. @item colors
  18726. Specify list of colors separated by space or by '|' which will be used to
  18727. draw channel frequencies. Unrecognized or missing colors will be replaced
  18728. by white color.
  18729. @item cmode
  18730. Set channel display mode.
  18731. It accepts the following values:
  18732. @table @samp
  18733. @item combined
  18734. @item separate
  18735. @end table
  18736. Default is @code{combined}.
  18737. @item minamp
  18738. Set minimum amplitude used in @code{log} amplitude scaler.
  18739. @end table
  18740. @section showspatial
  18741. Convert stereo input audio to a video output, representing the spatial relationship
  18742. between two channels.
  18743. The filter accepts the following options:
  18744. @table @option
  18745. @item size, s
  18746. Specify the video size for the output. For the syntax of this option, check the
  18747. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18748. Default value is @code{512x512}.
  18749. @item win_size
  18750. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  18751. @item win_func
  18752. Set window function.
  18753. It accepts the following values:
  18754. @table @samp
  18755. @item rect
  18756. @item bartlett
  18757. @item hann
  18758. @item hanning
  18759. @item hamming
  18760. @item blackman
  18761. @item welch
  18762. @item flattop
  18763. @item bharris
  18764. @item bnuttall
  18765. @item bhann
  18766. @item sine
  18767. @item nuttall
  18768. @item lanczos
  18769. @item gauss
  18770. @item tukey
  18771. @item dolph
  18772. @item cauchy
  18773. @item parzen
  18774. @item poisson
  18775. @item bohman
  18776. @end table
  18777. Default value is @code{hann}.
  18778. @item overlap
  18779. Set ratio of overlap window. Default value is @code{0.5}.
  18780. When value is @code{1} overlap is set to recommended size for specific
  18781. window function currently used.
  18782. @end table
  18783. @anchor{showspectrum}
  18784. @section showspectrum
  18785. Convert input audio to a video output, representing the audio frequency
  18786. spectrum.
  18787. The filter accepts the following options:
  18788. @table @option
  18789. @item size, s
  18790. Specify the video size for the output. For the syntax of this option, check the
  18791. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18792. Default value is @code{640x512}.
  18793. @item slide
  18794. Specify how the spectrum should slide along the window.
  18795. It accepts the following values:
  18796. @table @samp
  18797. @item replace
  18798. the samples start again on the left when they reach the right
  18799. @item scroll
  18800. the samples scroll from right to left
  18801. @item fullframe
  18802. frames are only produced when the samples reach the right
  18803. @item rscroll
  18804. the samples scroll from left to right
  18805. @end table
  18806. Default value is @code{replace}.
  18807. @item mode
  18808. Specify display mode.
  18809. It accepts the following values:
  18810. @table @samp
  18811. @item combined
  18812. all channels are displayed in the same row
  18813. @item separate
  18814. all channels are displayed in separate rows
  18815. @end table
  18816. Default value is @samp{combined}.
  18817. @item color
  18818. Specify display color mode.
  18819. It accepts the following values:
  18820. @table @samp
  18821. @item channel
  18822. each channel is displayed in a separate color
  18823. @item intensity
  18824. each channel is displayed using the same color scheme
  18825. @item rainbow
  18826. each channel is displayed using the rainbow color scheme
  18827. @item moreland
  18828. each channel is displayed using the moreland color scheme
  18829. @item nebulae
  18830. each channel is displayed using the nebulae color scheme
  18831. @item fire
  18832. each channel is displayed using the fire color scheme
  18833. @item fiery
  18834. each channel is displayed using the fiery color scheme
  18835. @item fruit
  18836. each channel is displayed using the fruit color scheme
  18837. @item cool
  18838. each channel is displayed using the cool color scheme
  18839. @item magma
  18840. each channel is displayed using the magma color scheme
  18841. @item green
  18842. each channel is displayed using the green color scheme
  18843. @item viridis
  18844. each channel is displayed using the viridis color scheme
  18845. @item plasma
  18846. each channel is displayed using the plasma color scheme
  18847. @item cividis
  18848. each channel is displayed using the cividis color scheme
  18849. @item terrain
  18850. each channel is displayed using the terrain color scheme
  18851. @end table
  18852. Default value is @samp{channel}.
  18853. @item scale
  18854. Specify scale used for calculating intensity color values.
  18855. It accepts the following values:
  18856. @table @samp
  18857. @item lin
  18858. linear
  18859. @item sqrt
  18860. square root, default
  18861. @item cbrt
  18862. cubic root
  18863. @item log
  18864. logarithmic
  18865. @item 4thrt
  18866. 4th root
  18867. @item 5thrt
  18868. 5th root
  18869. @end table
  18870. Default value is @samp{sqrt}.
  18871. @item fscale
  18872. Specify frequency scale.
  18873. It accepts the following values:
  18874. @table @samp
  18875. @item lin
  18876. linear
  18877. @item log
  18878. logarithmic
  18879. @end table
  18880. Default value is @samp{lin}.
  18881. @item saturation
  18882. Set saturation modifier for displayed colors. Negative values provide
  18883. alternative color scheme. @code{0} is no saturation at all.
  18884. Saturation must be in [-10.0, 10.0] range.
  18885. Default value is @code{1}.
  18886. @item win_func
  18887. Set window function.
  18888. It accepts the following values:
  18889. @table @samp
  18890. @item rect
  18891. @item bartlett
  18892. @item hann
  18893. @item hanning
  18894. @item hamming
  18895. @item blackman
  18896. @item welch
  18897. @item flattop
  18898. @item bharris
  18899. @item bnuttall
  18900. @item bhann
  18901. @item sine
  18902. @item nuttall
  18903. @item lanczos
  18904. @item gauss
  18905. @item tukey
  18906. @item dolph
  18907. @item cauchy
  18908. @item parzen
  18909. @item poisson
  18910. @item bohman
  18911. @end table
  18912. Default value is @code{hann}.
  18913. @item orientation
  18914. Set orientation of time vs frequency axis. Can be @code{vertical} or
  18915. @code{horizontal}. Default is @code{vertical}.
  18916. @item overlap
  18917. Set ratio of overlap window. Default value is @code{0}.
  18918. When value is @code{1} overlap is set to recommended size for specific
  18919. window function currently used.
  18920. @item gain
  18921. Set scale gain for calculating intensity color values.
  18922. Default value is @code{1}.
  18923. @item data
  18924. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  18925. @item rotation
  18926. Set color rotation, must be in [-1.0, 1.0] range.
  18927. Default value is @code{0}.
  18928. @item start
  18929. Set start frequency from which to display spectrogram. Default is @code{0}.
  18930. @item stop
  18931. Set stop frequency to which to display spectrogram. Default is @code{0}.
  18932. @item fps
  18933. Set upper frame rate limit. Default is @code{auto}, unlimited.
  18934. @item legend
  18935. Draw time and frequency axes and legends. Default is disabled.
  18936. @end table
  18937. The usage is very similar to the showwaves filter; see the examples in that
  18938. section.
  18939. @subsection Examples
  18940. @itemize
  18941. @item
  18942. Large window with logarithmic color scaling:
  18943. @example
  18944. showspectrum=s=1280x480:scale=log
  18945. @end example
  18946. @item
  18947. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  18948. @example
  18949. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  18950. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  18951. @end example
  18952. @end itemize
  18953. @section showspectrumpic
  18954. Convert input audio to a single video frame, representing the audio frequency
  18955. spectrum.
  18956. The filter accepts the following options:
  18957. @table @option
  18958. @item size, s
  18959. Specify the video size for the output. For the syntax of this option, check the
  18960. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18961. Default value is @code{4096x2048}.
  18962. @item mode
  18963. Specify display mode.
  18964. It accepts the following values:
  18965. @table @samp
  18966. @item combined
  18967. all channels are displayed in the same row
  18968. @item separate
  18969. all channels are displayed in separate rows
  18970. @end table
  18971. Default value is @samp{combined}.
  18972. @item color
  18973. Specify display color mode.
  18974. It accepts the following values:
  18975. @table @samp
  18976. @item channel
  18977. each channel is displayed in a separate color
  18978. @item intensity
  18979. each channel is displayed using the same color scheme
  18980. @item rainbow
  18981. each channel is displayed using the rainbow color scheme
  18982. @item moreland
  18983. each channel is displayed using the moreland color scheme
  18984. @item nebulae
  18985. each channel is displayed using the nebulae color scheme
  18986. @item fire
  18987. each channel is displayed using the fire color scheme
  18988. @item fiery
  18989. each channel is displayed using the fiery color scheme
  18990. @item fruit
  18991. each channel is displayed using the fruit color scheme
  18992. @item cool
  18993. each channel is displayed using the cool color scheme
  18994. @item magma
  18995. each channel is displayed using the magma color scheme
  18996. @item green
  18997. each channel is displayed using the green color scheme
  18998. @item viridis
  18999. each channel is displayed using the viridis color scheme
  19000. @item plasma
  19001. each channel is displayed using the plasma color scheme
  19002. @item cividis
  19003. each channel is displayed using the cividis color scheme
  19004. @item terrain
  19005. each channel is displayed using the terrain color scheme
  19006. @end table
  19007. Default value is @samp{intensity}.
  19008. @item scale
  19009. Specify scale used for calculating intensity color values.
  19010. It accepts the following values:
  19011. @table @samp
  19012. @item lin
  19013. linear
  19014. @item sqrt
  19015. square root, default
  19016. @item cbrt
  19017. cubic root
  19018. @item log
  19019. logarithmic
  19020. @item 4thrt
  19021. 4th root
  19022. @item 5thrt
  19023. 5th root
  19024. @end table
  19025. Default value is @samp{log}.
  19026. @item fscale
  19027. Specify frequency scale.
  19028. It accepts the following values:
  19029. @table @samp
  19030. @item lin
  19031. linear
  19032. @item log
  19033. logarithmic
  19034. @end table
  19035. Default value is @samp{lin}.
  19036. @item saturation
  19037. Set saturation modifier for displayed colors. Negative values provide
  19038. alternative color scheme. @code{0} is no saturation at all.
  19039. Saturation must be in [-10.0, 10.0] range.
  19040. Default value is @code{1}.
  19041. @item win_func
  19042. Set window function.
  19043. It accepts the following values:
  19044. @table @samp
  19045. @item rect
  19046. @item bartlett
  19047. @item hann
  19048. @item hanning
  19049. @item hamming
  19050. @item blackman
  19051. @item welch
  19052. @item flattop
  19053. @item bharris
  19054. @item bnuttall
  19055. @item bhann
  19056. @item sine
  19057. @item nuttall
  19058. @item lanczos
  19059. @item gauss
  19060. @item tukey
  19061. @item dolph
  19062. @item cauchy
  19063. @item parzen
  19064. @item poisson
  19065. @item bohman
  19066. @end table
  19067. Default value is @code{hann}.
  19068. @item orientation
  19069. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19070. @code{horizontal}. Default is @code{vertical}.
  19071. @item gain
  19072. Set scale gain for calculating intensity color values.
  19073. Default value is @code{1}.
  19074. @item legend
  19075. Draw time and frequency axes and legends. Default is enabled.
  19076. @item rotation
  19077. Set color rotation, must be in [-1.0, 1.0] range.
  19078. Default value is @code{0}.
  19079. @item start
  19080. Set start frequency from which to display spectrogram. Default is @code{0}.
  19081. @item stop
  19082. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19083. @end table
  19084. @subsection Examples
  19085. @itemize
  19086. @item
  19087. Extract an audio spectrogram of a whole audio track
  19088. in a 1024x1024 picture using @command{ffmpeg}:
  19089. @example
  19090. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  19091. @end example
  19092. @end itemize
  19093. @section showvolume
  19094. Convert input audio volume to a video output.
  19095. The filter accepts the following options:
  19096. @table @option
  19097. @item rate, r
  19098. Set video rate.
  19099. @item b
  19100. Set border width, allowed range is [0, 5]. Default is 1.
  19101. @item w
  19102. Set channel width, allowed range is [80, 8192]. Default is 400.
  19103. @item h
  19104. Set channel height, allowed range is [1, 900]. Default is 20.
  19105. @item f
  19106. Set fade, allowed range is [0, 1]. Default is 0.95.
  19107. @item c
  19108. Set volume color expression.
  19109. The expression can use the following variables:
  19110. @table @option
  19111. @item VOLUME
  19112. Current max volume of channel in dB.
  19113. @item PEAK
  19114. Current peak.
  19115. @item CHANNEL
  19116. Current channel number, starting from 0.
  19117. @end table
  19118. @item t
  19119. If set, displays channel names. Default is enabled.
  19120. @item v
  19121. If set, displays volume values. Default is enabled.
  19122. @item o
  19123. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  19124. default is @code{h}.
  19125. @item s
  19126. Set step size, allowed range is [0, 5]. Default is 0, which means
  19127. step is disabled.
  19128. @item p
  19129. Set background opacity, allowed range is [0, 1]. Default is 0.
  19130. @item m
  19131. Set metering mode, can be peak: @code{p} or rms: @code{r},
  19132. default is @code{p}.
  19133. @item ds
  19134. Set display scale, can be linear: @code{lin} or log: @code{log},
  19135. default is @code{lin}.
  19136. @item dm
  19137. In second.
  19138. If set to > 0., display a line for the max level
  19139. in the previous seconds.
  19140. default is disabled: @code{0.}
  19141. @item dmc
  19142. The color of the max line. Use when @code{dm} option is set to > 0.
  19143. default is: @code{orange}
  19144. @end table
  19145. @section showwaves
  19146. Convert input audio to a video output, representing the samples waves.
  19147. The filter accepts the following options:
  19148. @table @option
  19149. @item size, s
  19150. Specify the video size for the output. For the syntax of this option, check the
  19151. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19152. Default value is @code{600x240}.
  19153. @item mode
  19154. Set display mode.
  19155. Available values are:
  19156. @table @samp
  19157. @item point
  19158. Draw a point for each sample.
  19159. @item line
  19160. Draw a vertical line for each sample.
  19161. @item p2p
  19162. Draw a point for each sample and a line between them.
  19163. @item cline
  19164. Draw a centered vertical line for each sample.
  19165. @end table
  19166. Default value is @code{point}.
  19167. @item n
  19168. Set the number of samples which are printed on the same column. A
  19169. larger value will decrease the frame rate. Must be a positive
  19170. integer. This option can be set only if the value for @var{rate}
  19171. is not explicitly specified.
  19172. @item rate, r
  19173. Set the (approximate) output frame rate. This is done by setting the
  19174. option @var{n}. Default value is "25".
  19175. @item split_channels
  19176. Set if channels should be drawn separately or overlap. Default value is 0.
  19177. @item colors
  19178. Set colors separated by '|' which are going to be used for drawing of each channel.
  19179. @item scale
  19180. Set amplitude scale.
  19181. Available values are:
  19182. @table @samp
  19183. @item lin
  19184. Linear.
  19185. @item log
  19186. Logarithmic.
  19187. @item sqrt
  19188. Square root.
  19189. @item cbrt
  19190. Cubic root.
  19191. @end table
  19192. Default is linear.
  19193. @item draw
  19194. Set the draw mode. This is mostly useful to set for high @var{n}.
  19195. Available values are:
  19196. @table @samp
  19197. @item scale
  19198. Scale pixel values for each drawn sample.
  19199. @item full
  19200. Draw every sample directly.
  19201. @end table
  19202. Default value is @code{scale}.
  19203. @end table
  19204. @subsection Examples
  19205. @itemize
  19206. @item
  19207. Output the input file audio and the corresponding video representation
  19208. at the same time:
  19209. @example
  19210. amovie=a.mp3,asplit[out0],showwaves[out1]
  19211. @end example
  19212. @item
  19213. Create a synthetic signal and show it with showwaves, forcing a
  19214. frame rate of 30 frames per second:
  19215. @example
  19216. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  19217. @end example
  19218. @end itemize
  19219. @section showwavespic
  19220. Convert input audio to a single video frame, representing the samples waves.
  19221. The filter accepts the following options:
  19222. @table @option
  19223. @item size, s
  19224. Specify the video size for the output. For the syntax of this option, check the
  19225. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19226. Default value is @code{600x240}.
  19227. @item split_channels
  19228. Set if channels should be drawn separately or overlap. Default value is 0.
  19229. @item colors
  19230. Set colors separated by '|' which are going to be used for drawing of each channel.
  19231. @item scale
  19232. Set amplitude scale.
  19233. Available values are:
  19234. @table @samp
  19235. @item lin
  19236. Linear.
  19237. @item log
  19238. Logarithmic.
  19239. @item sqrt
  19240. Square root.
  19241. @item cbrt
  19242. Cubic root.
  19243. @end table
  19244. Default is linear.
  19245. @item draw
  19246. Set the draw mode.
  19247. Available values are:
  19248. @table @samp
  19249. @item scale
  19250. Scale pixel values for each drawn sample.
  19251. @item full
  19252. Draw every sample directly.
  19253. @end table
  19254. Default value is @code{scale}.
  19255. @end table
  19256. @subsection Examples
  19257. @itemize
  19258. @item
  19259. Extract a channel split representation of the wave form of a whole audio track
  19260. in a 1024x800 picture using @command{ffmpeg}:
  19261. @example
  19262. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  19263. @end example
  19264. @end itemize
  19265. @section sidedata, asidedata
  19266. Delete frame side data, or select frames based on it.
  19267. This filter accepts the following options:
  19268. @table @option
  19269. @item mode
  19270. Set mode of operation of the filter.
  19271. Can be one of the following:
  19272. @table @samp
  19273. @item select
  19274. Select every frame with side data of @code{type}.
  19275. @item delete
  19276. Delete side data of @code{type}. If @code{type} is not set, delete all side
  19277. data in the frame.
  19278. @end table
  19279. @item type
  19280. Set side data type used with all modes. Must be set for @code{select} mode. For
  19281. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  19282. in @file{libavutil/frame.h}. For example, to choose
  19283. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  19284. @end table
  19285. @section spectrumsynth
  19286. Synthesize audio from 2 input video spectrums, first input stream represents
  19287. magnitude across time and second represents phase across time.
  19288. The filter will transform from frequency domain as displayed in videos back
  19289. to time domain as presented in audio output.
  19290. This filter is primarily created for reversing processed @ref{showspectrum}
  19291. filter outputs, but can synthesize sound from other spectrograms too.
  19292. But in such case results are going to be poor if the phase data is not
  19293. available, because in such cases phase data need to be recreated, usually
  19294. it's just recreated from random noise.
  19295. For best results use gray only output (@code{channel} color mode in
  19296. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  19297. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  19298. @code{data} option. Inputs videos should generally use @code{fullframe}
  19299. slide mode as that saves resources needed for decoding video.
  19300. The filter accepts the following options:
  19301. @table @option
  19302. @item sample_rate
  19303. Specify sample rate of output audio, the sample rate of audio from which
  19304. spectrum was generated may differ.
  19305. @item channels
  19306. Set number of channels represented in input video spectrums.
  19307. @item scale
  19308. Set scale which was used when generating magnitude input spectrum.
  19309. Can be @code{lin} or @code{log}. Default is @code{log}.
  19310. @item slide
  19311. Set slide which was used when generating inputs spectrums.
  19312. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  19313. Default is @code{fullframe}.
  19314. @item win_func
  19315. Set window function used for resynthesis.
  19316. @item overlap
  19317. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  19318. which means optimal overlap for selected window function will be picked.
  19319. @item orientation
  19320. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  19321. Default is @code{vertical}.
  19322. @end table
  19323. @subsection Examples
  19324. @itemize
  19325. @item
  19326. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  19327. then resynthesize videos back to audio with spectrumsynth:
  19328. @example
  19329. 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
  19330. 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
  19331. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  19332. @end example
  19333. @end itemize
  19334. @section split, asplit
  19335. Split input into several identical outputs.
  19336. @code{asplit} works with audio input, @code{split} with video.
  19337. The filter accepts a single parameter which specifies the number of outputs. If
  19338. unspecified, it defaults to 2.
  19339. @subsection Examples
  19340. @itemize
  19341. @item
  19342. Create two separate outputs from the same input:
  19343. @example
  19344. [in] split [out0][out1]
  19345. @end example
  19346. @item
  19347. To create 3 or more outputs, you need to specify the number of
  19348. outputs, like in:
  19349. @example
  19350. [in] asplit=3 [out0][out1][out2]
  19351. @end example
  19352. @item
  19353. Create two separate outputs from the same input, one cropped and
  19354. one padded:
  19355. @example
  19356. [in] split [splitout1][splitout2];
  19357. [splitout1] crop=100:100:0:0 [cropout];
  19358. [splitout2] pad=200:200:100:100 [padout];
  19359. @end example
  19360. @item
  19361. Create 5 copies of the input audio with @command{ffmpeg}:
  19362. @example
  19363. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  19364. @end example
  19365. @end itemize
  19366. @section zmq, azmq
  19367. Receive commands sent through a libzmq client, and forward them to
  19368. filters in the filtergraph.
  19369. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  19370. must be inserted between two video filters, @code{azmq} between two
  19371. audio filters. Both are capable to send messages to any filter type.
  19372. To enable these filters you need to install the libzmq library and
  19373. headers and configure FFmpeg with @code{--enable-libzmq}.
  19374. For more information about libzmq see:
  19375. @url{http://www.zeromq.org/}
  19376. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  19377. receives messages sent through a network interface defined by the
  19378. @option{bind_address} (or the abbreviation "@option{b}") option.
  19379. Default value of this option is @file{tcp://localhost:5555}. You may
  19380. want to alter this value to your needs, but do not forget to escape any
  19381. ':' signs (see @ref{filtergraph escaping}).
  19382. The received message must be in the form:
  19383. @example
  19384. @var{TARGET} @var{COMMAND} [@var{ARG}]
  19385. @end example
  19386. @var{TARGET} specifies the target of the command, usually the name of
  19387. the filter class or a specific filter instance name. The default
  19388. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  19389. but you can override this by using the @samp{filter_name@@id} syntax
  19390. (see @ref{Filtergraph syntax}).
  19391. @var{COMMAND} specifies the name of the command for the target filter.
  19392. @var{ARG} is optional and specifies the optional argument list for the
  19393. given @var{COMMAND}.
  19394. Upon reception, the message is processed and the corresponding command
  19395. is injected into the filtergraph. Depending on the result, the filter
  19396. will send a reply to the client, adopting the format:
  19397. @example
  19398. @var{ERROR_CODE} @var{ERROR_REASON}
  19399. @var{MESSAGE}
  19400. @end example
  19401. @var{MESSAGE} is optional.
  19402. @subsection Examples
  19403. Look at @file{tools/zmqsend} for an example of a zmq client which can
  19404. be used to send commands processed by these filters.
  19405. Consider the following filtergraph generated by @command{ffplay}.
  19406. In this example the last overlay filter has an instance name. All other
  19407. filters will have default instance names.
  19408. @example
  19409. ffplay -dumpgraph 1 -f lavfi "
  19410. color=s=100x100:c=red [l];
  19411. color=s=100x100:c=blue [r];
  19412. nullsrc=s=200x100, zmq [bg];
  19413. [bg][l] overlay [bg+l];
  19414. [bg+l][r] overlay@@my=x=100 "
  19415. @end example
  19416. To change the color of the left side of the video, the following
  19417. command can be used:
  19418. @example
  19419. echo Parsed_color_0 c yellow | tools/zmqsend
  19420. @end example
  19421. To change the right side:
  19422. @example
  19423. echo Parsed_color_1 c pink | tools/zmqsend
  19424. @end example
  19425. To change the position of the right side:
  19426. @example
  19427. echo overlay@@my x 150 | tools/zmqsend
  19428. @end example
  19429. @c man end MULTIMEDIA FILTERS
  19430. @chapter Multimedia Sources
  19431. @c man begin MULTIMEDIA SOURCES
  19432. Below is a description of the currently available multimedia sources.
  19433. @section amovie
  19434. This is the same as @ref{movie} source, except it selects an audio
  19435. stream by default.
  19436. @anchor{movie}
  19437. @section movie
  19438. Read audio and/or video stream(s) from a movie container.
  19439. It accepts the following parameters:
  19440. @table @option
  19441. @item filename
  19442. The name of the resource to read (not necessarily a file; it can also be a
  19443. device or a stream accessed through some protocol).
  19444. @item format_name, f
  19445. Specifies the format assumed for the movie to read, and can be either
  19446. the name of a container or an input device. If not specified, the
  19447. format is guessed from @var{movie_name} or by probing.
  19448. @item seek_point, sp
  19449. Specifies the seek point in seconds. The frames will be output
  19450. starting from this seek point. The parameter is evaluated with
  19451. @code{av_strtod}, so the numerical value may be suffixed by an IS
  19452. postfix. The default value is "0".
  19453. @item streams, s
  19454. Specifies the streams to read. Several streams can be specified,
  19455. separated by "+". The source will then have as many outputs, in the
  19456. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  19457. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  19458. respectively the default (best suited) video and audio stream. Default
  19459. is "dv", or "da" if the filter is called as "amovie".
  19460. @item stream_index, si
  19461. Specifies the index of the video stream to read. If the value is -1,
  19462. the most suitable video stream will be automatically selected. The default
  19463. value is "-1". Deprecated. If the filter is called "amovie", it will select
  19464. audio instead of video.
  19465. @item loop
  19466. Specifies how many times to read the stream in sequence.
  19467. If the value is 0, the stream will be looped infinitely.
  19468. Default value is "1".
  19469. Note that when the movie is looped the source timestamps are not
  19470. changed, so it will generate non monotonically increasing timestamps.
  19471. @item discontinuity
  19472. Specifies the time difference between frames above which the point is
  19473. considered a timestamp discontinuity which is removed by adjusting the later
  19474. timestamps.
  19475. @end table
  19476. It allows overlaying a second video on top of the main input of
  19477. a filtergraph, as shown in this graph:
  19478. @example
  19479. input -----------> deltapts0 --> overlay --> output
  19480. ^
  19481. |
  19482. movie --> scale--> deltapts1 -------+
  19483. @end example
  19484. @subsection Examples
  19485. @itemize
  19486. @item
  19487. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  19488. on top of the input labelled "in":
  19489. @example
  19490. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  19491. [in] setpts=PTS-STARTPTS [main];
  19492. [main][over] overlay=16:16 [out]
  19493. @end example
  19494. @item
  19495. Read from a video4linux2 device, and overlay it on top of the input
  19496. labelled "in":
  19497. @example
  19498. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  19499. [in] setpts=PTS-STARTPTS [main];
  19500. [main][over] overlay=16:16 [out]
  19501. @end example
  19502. @item
  19503. Read the first video stream and the audio stream with id 0x81 from
  19504. dvd.vob; the video is connected to the pad named "video" and the audio is
  19505. connected to the pad named "audio":
  19506. @example
  19507. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  19508. @end example
  19509. @end itemize
  19510. @subsection Commands
  19511. Both movie and amovie support the following commands:
  19512. @table @option
  19513. @item seek
  19514. Perform seek using "av_seek_frame".
  19515. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  19516. @itemize
  19517. @item
  19518. @var{stream_index}: If stream_index is -1, a default
  19519. stream is selected, and @var{timestamp} is automatically converted
  19520. from AV_TIME_BASE units to the stream specific time_base.
  19521. @item
  19522. @var{timestamp}: Timestamp in AVStream.time_base units
  19523. or, if no stream is specified, in AV_TIME_BASE units.
  19524. @item
  19525. @var{flags}: Flags which select direction and seeking mode.
  19526. @end itemize
  19527. @item get_duration
  19528. Get movie duration in AV_TIME_BASE units.
  19529. @end table
  19530. @c man end MULTIMEDIA SOURCES